Quellcode durchsuchen

v1.1.1 修改计划预设模板

yumeng vor 4 Jahren
Ursprung
Commit
0faad4d869

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

@@ -135,7 +135,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.151.174:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver

+ 21 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
 import com.alibaba.fastjson.JSON;
@@ -90,17 +91,30 @@ public class KuaiShouBatchCampaignTemplateController {
      */
     @AutoLog(value = "计划模板-编辑")
     @ApiOperation(value = "计划模板-编辑", notes = "计划模板-编辑")
-    @PutMapping(value = "/edit")
+    @PostMapping(value = "/saveOrUpdate")
     public Result<KuaiShouBatchCampaignTemplate> edit(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
         Result<KuaiShouBatchCampaignTemplate> result = new Result<KuaiShouBatchCampaignTemplate>();
-        KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
-        if (kuaiShouBatchCampaignTemplateEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
+        boolean ok;
+        try {
+            Long id = kuaiShouBatchCampaignTemplate.getId();
+            if (Check.isNull(id)) {
+                ok = kuaiShouBatchCampaignTemplateService.save(kuaiShouBatchCampaignTemplate);
+            } else {
+                KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
+                if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
+                    ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
+                } else {
+                    throw new Exception("未获取到账户id对应的详细信息");
+                }
+            }
             if (ok) {
-                result.success("修改成功!");
+                result.success("操作成功!");
             }
+        } catch (Exception e) {
+            result.error500(e.getMessage());
+            e.printStackTrace();
+
+
         }
 
         return result;