|
@@ -1,8 +1,11 @@
|
|
|
package cn.com.ctop.kuaishou.modules.batch.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
+import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCampaignPreviewService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -21,7 +24,6 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -56,6 +58,12 @@ import java.util.Map;
|
|
|
public class KuaishouBatchCampaignPreviewController {
|
|
|
@Autowired
|
|
|
private IKuaishouBatchCampaignPreviewService kuaishouBatchCampaignPreviewService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouBatchCampaignPreviewService campaignPreviewService;
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouUpdateService kuaiShouUpdateService;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
@@ -168,6 +176,39 @@ public class KuaishouBatchCampaignPreviewController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 手动修改定时启动
|
|
|
+ *
|
|
|
+ * @param kuaishouBatchCampaignPreview
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "手动修改定时启动")
|
|
|
+ @ApiOperation(value = "手动修改定时启动", notes = "手动修改定时启动")
|
|
|
+ @PostMapping(value = "/updateStatus")
|
|
|
+ public Result<Object> kuaishouBatchCampaignTimeStartJob() {
|
|
|
+ try {
|
|
|
+ List<KuaishouBatchCampaignPreview> campaignPreviewList = campaignPreviewService.queryListByTime();
|
|
|
+ if (!Check.isNull(campaignPreviewList)) {
|
|
|
+ for (KuaishouBatchCampaignPreview campaignPreview : campaignPreviewList) {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(campaignPreview.getAccountId());
|
|
|
+ if (!Check.isNull(token)) {
|
|
|
+ Map<String, Object> map = kuaiShouUpdateService.updateCampaignStatus(token.getAccessToken(), campaignPreview.getAccountId(), campaignPreview.getCampaignId(), 1, "timingStart");
|
|
|
+ if ((boolean) map.get("success")) {
|
|
|
+ QueryWrapper<KuaishouBatchCampaignPreview> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("id", campaignPreview.getId());
|
|
|
+ KuaishouBatchCampaignPreview campaign = new KuaishouBatchCampaignPreview();
|
|
|
+ campaign.setMessage("定时启动成功!");
|
|
|
+ campaignPreviewService.update(campaign, queryWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return Result.error("error:" + e.getMessage());
|
|
|
+ }
|
|
|
+ return Result.ok("success");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 通过id删除
|
|
|
*
|
|
|
* @param id
|