Переглянути джерело

Merge remote-tracking branch 'origin/test' into test

syh 5 роки тому
батько
коміт
2a745214f5

+ 10 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java

@@ -38,7 +38,16 @@ public class KuaishouCommentAutoDelete implements Job {
                             log.info("正在删除评论:{}", account.getAccountName());
                             kuaishouWebInterfaceService.adkuaishouWebLogin(account.getAccountName(), account.getPassword());
                             kuaishouWebInterfaceService.deleteAllComment(new HashMap<>());
-                            Runtime.getRuntime().exec(cleanUrl);
+                            Runtime runtime = Runtime.getRuntime();
+                            Process pro = runtime.exec(cleanUrl);
+                            int status = pro.waitFor();
+                            if (status == 0) {
+                                log.info("success,删除评论调用shell脚本执行成功");
+                            } else {
+                                log.info("error,删除评论调用shell脚本执行失败");
+                            }
+
+
                             Thread.sleep(10000);
                         } catch (Exception e) {
                             e.printStackTrace();

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -158,4 +158,4 @@ logging:
   config: classpath:logback-dev.xml
 chrome:
   script:
-    clean: /mnt/webapp/cleanProcess.sh
+    clean: sh /mnt/webapp/cleanProcess.sh

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -155,5 +155,5 @@ logging:
   config: classpath:logback-prod.xml
 chrome:
   script:
-    clean: /mnt/webapp/cleanProcess.sh
+    clean: sh /mnt/webapp/cleanProcess.sh
 

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -158,4 +158,4 @@ logging:
   config: classpath:logback-test.xml
 chrome:
   script:
-    clean: /mnt/webapp/cleanProcess.sh
+    clean: sh /mnt/webapp/cleanProcess.sh

+ 47 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -8,7 +8,9 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
 import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -18,10 +20,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -39,6 +38,10 @@ public class BatchController {
     private IBatchService batchService;
     @Autowired
     private IKuaiShouCampaignService kuaiShouCampaignService;
+    @Autowired
+    private IKuaiShouUpdateService updateService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
 
 
     /**
@@ -103,4 +106,44 @@ public class BatchController {
     }
 
 
+    /**
+     * 批量修改广告计划预算
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/batchUpdateDayBudget")
+    public Result<JSONObject> batchUpdateDayBudget(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("账号信息为空");
+            }
+            Long dayBudget = requestJson.getLong("dayBudget");
+            if (Check.isNull(dayBudget)) {
+                throw new Exception("预算信息为空");
+            }
+            String userId = requestJson.getString("userId");
+            JSONArray campaignIds = requestJson.getJSONArray("campaignIds");
+            if (!Check.isNull(campaignIds)) {
+                for (int i = 0; i < campaignIds.size(); i++) {
+                    Long campaignId = campaignIds.getLong(i);
+                    if (!Check.isNull(campaignId)) {
+                        updateService.updateCampaign(token.getAccessToken(), accountId, campaignId, dayBudget, userId);
+                    }
+                }
+            }
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
 }