瀏覽代碼

Merge branch 'master' of http://git.mokasz.com/marketing/moka-private

leon 4 年之前
父節點
當前提交
3a3c66103e

+ 7 - 8
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashWorkClientController.java

@@ -91,12 +91,11 @@ public class FosterwxCashWorkClientController {
 
         List<FosterwxCashBoxClientInfo> fosterwxCashBoxClientInfoList = new ArrayList<>();
         fosterwxCashScheduleTaskListList.forEach(fosterwxCashScheduleTaskList -> {
-            // TODO 注释掉更改状态的代码 方便爬虫测试
-            // fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
-            //     setId(fosterwxCashScheduleTaskList.getId());
-            //     setStatus(5);
-            //     setUpdateAt(LocalDateTime.now());
-            // }});
+            fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
+                setId(fosterwxCashScheduleTaskList.getId());
+                setStatus(5);
+                setUpdateAt(LocalDateTime.now());
+            }});
 
             // 获取任务详情
             FosterwxCashWorkwxTaskList fosterwxCashWorkwxTaskList = fosterwxCashWorkwxTaskListService.getOne(new LambdaQueryWrapper<FosterwxCashWorkwxTaskList>().
@@ -119,8 +118,8 @@ public class FosterwxCashWorkClientController {
                     boxInfo.setImage_key1(fosterwxCashWorkBoxClientInfo.getImageKey1());
                     boxInfo.setImage_key2(fosterwxCashWorkBoxClientInfo.getImageKey2());
                     boxInfo.setImage_key3(fosterwxCashWorkBoxClientInfo.getImageKey3());
-                    boxInfo.setImageSize(fosterwxCashWorkBoxClientInfo.getImageSize());
-                    boxInfo.setAppType(fosterwxCashWorkBoxClientInfo.getAppType());
+                    boxInfo.setImage_size(fosterwxCashWorkBoxClientInfo.getImageSize());
+                    boxInfo.setApp_type(fosterwxCashWorkBoxClientInfo.getAppType());
                     boxInfo.setDesc(fosterwxCashWorkBoxClientInfo.getDesc());
                     fosterwxCashBoxClientInfo.setBoxInfo(boxInfo);
                 }

+ 29 - 0
src/main/java/com/mokamrp/privates/entity/pangu/FosterCashTaskJobController.java

@@ -0,0 +1,29 @@
+package com.mokamrp.privates.entity.pangu;
+
+import com.mokamrp.privates.help.AjaxResult;
+import com.mokamrp.privates.task.pangu.SyncCreateCashTask;
+import io.swagger.annotations.Api;
+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.RestController;
+
+/**
+ * @Classname FosterCashTaskJobController
+ * @Description TODO
+ * @Date 2021/10/28 5:09 下午
+ * @Created by luqiucheng
+ */
+@RestController
+@RequestMapping("/pangu/job")
+@Api(tags = "触发任务接口")
+public class FosterCashTaskJobController {
+    @Autowired
+    private SyncCreateCashTask syncCreateCashTask;
+
+    @GetMapping("syncCreateCashTask")
+    public Object syncCreateCashTask() {
+        syncCreateCashTask.syncCreateCashTask();
+        return AjaxResult.success("触发成功");
+    }
+}

+ 2 - 2
src/main/java/com/mokamrp/privates/entity/pangu/FosterwxCashBoxClientInfo.java

@@ -84,12 +84,12 @@ public class FosterwxCashBoxClientInfo {
         /**
          * 缩略图大小
          */
-        private Integer imageSize;
+        private Integer image_size;
 
         /**
          * 小程序类型,默认2(0:小图样式 2:大图样式)
          */
-        private Integer appType;
+        private Integer app_type;
 
         /**
          * 小程序分享的标题

+ 1 - 0
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashAccountScheduleServiceImpl.java

@@ -223,6 +223,7 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
             fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
             fosterwxCashScheduleTaskList.setTaskContent("");
             fosterwxCashScheduleTaskList.setGhId("");
+            fosterwxCashScheduleTaskList.setType(fosterwxCashAccountSchedule.getType());
             // 任务类型为链接是直接赋值
             if (4 == fosterwxCashTaskList.getTaskType()) {
                 fosterwxCashScheduleTaskList.setSendUrl(fosterwxCashTaskList.getUrl());

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

@@ -110,7 +110,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
 
     /**
      * 生成任务 正常生成 | 生成失败|检测到公众号封禁重新生成链接
-     * @param editList
+     * @param newsList
      */
     @Override
     public void create(List<FosterwxCashScheduleTaskList> newsList) {
@@ -154,6 +154,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
             }
 
             fosterwxCashScheduleTaskListMapper.updateById(fosterwxCashScheduleTaskList);
+            log.info("任务信息{}", fosterwxCashScheduleTaskList);
             if (1 == fosterwxCashScheduleTaskList.getType()) {
                 fosterwxCashScheduleTaskList.setFosterwxCashTaskList(fosterwxCashTaskListService.getById(fosterwxCashScheduleTaskList.getTaskId()));
             } else {
@@ -251,7 +252,8 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
         fosterwxCashOasBoxService.addSendTextCnt(fosterwxCashScheduleTaskList.getGroupId(), fosterwxCashOasBox.getGhId());
 
         // 状态
-        fosterwxCashScheduleTaskList.setStatus(1);
+        if (3 != fosterwxCashWorkwxTaskList.getTaskType())
+            fosterwxCashScheduleTaskList.setStatus(1);
         // 失败原因
         fosterwxCashScheduleTaskList.setErrInfo("");
         // 分配的公众号
@@ -272,9 +274,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
         }
 
         fosterwxCashScheduleTaskList.setSendUrl(sendUrl);
-        if (1 == fosterwxCashWorkwxTaskList.getTaskType()) {
-            fosterwxCashScheduleTaskList.setBoxUrl(sendUrl);
-        }
+        fosterwxCashScheduleTaskList.setBoxUrl(sendUrl);
 
         fosterwxCashScheduleTaskListMapper.updateById(fosterwxCashScheduleTaskList);
     }

+ 7 - 3
src/main/java/com/mokamrp/privates/task/pangu/SyncCreateCashTask.java

@@ -22,7 +22,10 @@ import org.springframework.web.client.RestTemplate;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 每天五点定时生成第二天的任务列表
@@ -57,7 +60,7 @@ public class SyncCreateCashTask {
         // 获取明天日期
         LocalDate nextDay = LocalDate.now().plusDays(1);
 
-        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getType, 1).eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay).eq(FosterwxCashAccountSchedule::getStatus, 2));
+        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay).eq(FosterwxCashAccountSchedule::getStatus, 2));
 
         List<FosterwxCashScheduleTaskList> newsList = new ArrayList<>();
         fosterwxCashAccountSchedules.forEach(fosterwxCashAccountSchedule -> {
@@ -73,7 +76,8 @@ public class SyncCreateCashTask {
             if (groupList.get(groupId) != null) {
                 groupList.get(groupId).add(fosterwxCashScheduleTaskList);
             } else {
-                groupList.put(groupId, Collections.singletonList(fosterwxCashScheduleTaskList));
+                groupList.put(groupId, new ArrayList<>());
+                groupList.get(groupId).add(fosterwxCashScheduleTaskList);
             }
         });
         // 调用typer生成链接