ソースを参照

渠道号。。。修改bug

zhaoxian 3 年 前
コミット
e2f54032f5

+ 25 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -42,6 +42,7 @@ import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.RedisUtil;
@@ -415,6 +416,19 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
             } else {
                 //有应用则继续判断应用标记是否一致,不一致则修改,一致就获取appId
                 if (strategy.getAppVersion().equals(app.getAppVersion())) {
+                    QueryWrapper<KuaishouChannelAppInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("account_id", strategy.getProjectId());
+                    queryWrapper.eq("app_version", app.getAppVersion());
+                    queryWrapper.eq("url", app.getUrl()).last("limit 1");
+                    KuaishouChannelAppInfo one = channelAppInfoService.getOne(queryWrapper);
+                    if (Check.isNull(one)) {
+                        KuaishouChannelAppInfo channelAppInfo = new KuaishouChannelAppInfo();
+                        BeanUtils.copyProperties(app, channelAppInfo);
+                        channelAppInfo.setId(null);
+                        channelAppInfo.setType("copy");
+                        channelAppInfo.setRemark("copy原有App");
+                        channelAppInfoService.save(channelAppInfo);
+                    }
                     strategy.setAppId(app.getAppId());
                 } else {
                     //------------------------------修改应用---------------------------------------
@@ -770,12 +784,20 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 list.add(obj);
             }
         }
+        String msg = "";
         if (!list.isEmpty()) {
-            for (JSONObject request : list) {
-                customizedCreate(request, 2);
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject jsonObject = list.get(i);
+                Result<Object> result = customizedCreate(jsonObject, 2);
+                if (result.getCode() != CommonConstant.SC_OK_200) {
+                    msg += "第" + (i + 1) + "行(" + result.getMessage() + "),";
+                }
+            }
+            if (!Check.isNull(msg)) {
+                msg = ",其中" + msg.substring(0, msg.length() - 1) + "导入失败!";
             }
         }
-        return Result.ok("文件导入成功");
+        return Result.ok("文件导入成" + msg);
     }