Selaa lähdekoodia

CSV格式文件导入,与回调2

zhaoxian 1 vuosi sitten
vanhempi
commit
59cff9ba72

+ 13 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/controller/FirstDeliveryValidController.java

@@ -60,16 +60,21 @@ public class FirstDeliveryValidController {
         String key = nowDate + "_importExcelMaterials";
         Object creative = redisUtil.get(key);
         if (Check.isNull(creative)) {
-            StringBuffer path = new StringBuffer();
-            path.append(downloadPath).append("excel").append("/").append(DateUtils.formatDate()).append("/");
-            String newFileUrl = FileUtil.approvalFile(file, path.toString());
-            //宇鹏本地服务
+            try {
+                redisUtil.set(key, "NO");
+                StringBuffer path = new StringBuffer();
+                path.append(downloadPath).append("excel").append("/").append(DateUtils.formatDate()).append("/");
+                String newFileUrl = FileUtil.approvalFile(file, path.toString());
+                //宇鹏本地服务
 //            HttpUtils.fileUpload("http://192.168.1.149:8765/webhook/get_file", newFileUrl, null);
-            //宇鹏外网服务
-            HttpUtils.fileUpload("http://111.204.208.194:9998/webhook/get_file", newFileUrl, null);
-            redisUtil.set(key, "NO");
+                //宇鹏外网服务
+                HttpUtils.fileUpload("http://111.204.208.194:9998/webhook/get_file", newFileUrl, null);
+            } catch (Exception e) {
+                e.printStackTrace();
+                redisUtil.removeAll(key);
+            }
         } else {
-            return Result.successMsg("文件上传中...", null);
+            return Result.error("文件上传中...");
         }
         return Result.successMsg("ok", null);
     }