lqc 4 лет назад
Родитель
Сommit
64cf0231d9

+ 4 - 3
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashAccountScheduleController.java

@@ -137,13 +137,14 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
     @PostMapping("/immediateCreate")
     @Transactional(rollbackFor = Exception.class)
     @ApiOperation(value = "生成")
-    public Object immediateCreate(@RequestBody FosterwxCashAccountScheduleHandle handle) {
-        Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
+    public Object immediateCreate(@RequestBody FosterwxCashAccountScheduleHandle handle) throws Exception {
+        for (int i = 0; i < Arrays.asList(handle.getIds().split(REGEX)).size(); i++) {
+            String id = Arrays.asList(handle.getIds().split(REGEX)).get(i);
             List<FosterwxCashScheduleTaskList> newsList = fosterwxCashAccountScheduleService.createTask(Integer.valueOf(id));
             // 由于不能浪费公众号发文为 需要整合起来一起发送
             // 调用typer生成链接
             fosterwxCashScheduleTaskListService.create(newsList);
-        });
+        }
 
         return AjaxResult.success("生成成功");
     }

+ 3 - 2
src/main/java/com/mokamrp/privates/service/impl/CoralApiServiceImpl.java

@@ -44,10 +44,11 @@ public class CoralApiServiceImpl implements CoralApiService {
         String res = HttpUtils.sendGet(newCoral + url, params);
         System.out.println(res);
         JSONObject info = JSON.parseObject(res);
-        JSONObject data = JSON.parseObject(info.get("data").toString());
         if (Integer.parseInt(info.get("code").toString()) != 0) {
-            return "";
+            return null;
         }
+        JSONObject data = JSON.parseObject(info.get("data").toString());
+
         return data;
     }
 }

+ 1 - 1
src/main/java/com/mokamrp/privates/service/pangu/FosterwxCashScheduleTaskListService.java

@@ -33,7 +33,7 @@ public interface FosterwxCashScheduleTaskListService extends IService<FosterwxCa
      * 生成任务 正常生成 | 生成失败|检测到公众号封禁重新生成链接
      * @param newsList
      */
-    void create(List<FosterwxCashScheduleTaskList> newsList);
+    void create(List<FosterwxCashScheduleTaskList> newsList) throws Exception;
 
     /**
      * 获取被封禁的任务

+ 5 - 2
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashScheduleTaskListServiceImpl.java

@@ -113,7 +113,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
      * @param newsList
      */
     @Override
-    public void create(List<FosterwxCashScheduleTaskList> newsList) {
+    public void create(List<FosterwxCashScheduleTaskList> newsList) throws Exception {
         if (newsList.isEmpty()) return;
         List<FosterwxCashScheduleTaskList> editList = new ArrayList<>();
         newsList.forEach(fosterwxCashScheduleTaskList -> editList.add(fosterwxCashScheduleTaskList));
@@ -150,7 +150,10 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
             fosterwxCashScheduleTaskList.setSendUrl("");
 
             if (fosterwxCashScheduleTaskList.getTaskType() == 1) {
-                fosterwxCashScheduleTaskList.setBoxInfo(coralApiService.getBoxInfo(fosterwxCashScheduleTaskList.getBoxGhid()));
+                Object obj = coralApiService.getBoxInfo(fosterwxCashScheduleTaskList.getBoxGhid());
+                if (obj == null)
+                    throw new Exception("小程序:" + fosterwxCashScheduleTaskList.getBoxGhid() + "无法从珊瑚云获取信息,请录入");
+                fosterwxCashScheduleTaskList.setBoxInfo(obj);
             }
 
             fosterwxCashScheduleTaskListMapper.updateById(fosterwxCashScheduleTaskList);