Преглед изворни кода

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

leon пре 4 година
родитељ
комит
c367a648f4

+ 2 - 2
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashScheduleTaskListController.java

@@ -48,7 +48,7 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
      */
      */
 
 
     @PostMapping("/list")
     @PostMapping("/list")
-    @ApiOperation(value = "获取任务列表")
+    @ApiOperation(value = "获取任务列表,排期页面过来的情况传排期的id就能获取他的任务")
     public Object list(@Valid @RequestBody FosterwxCashScheduleTaskListHandle handle, BindingResult bindingResult) {
     public Object list(@Valid @RequestBody FosterwxCashScheduleTaskListHandle handle, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
@@ -68,7 +68,7 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
     @PostMapping("/reCreate")
     @PostMapping("/reCreate")
     @ApiOperation("重新生成")
     @ApiOperation("重新生成")
     public Object reCreate(FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList) {
     public Object reCreate(FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList) {
-        //TODO 等typer接口
+        fosterwxCashScheduleTaskListService.create(fosterwxCashScheduleTaskList);
 
 
         return AjaxResult.success("重新生成成功");
         return AjaxResult.success("重新生成成功");
     }
     }

+ 1 - 1
src/main/java/com/mokamrp/privates/entity/pangu/FosterwxCashAccountScheduleHandle.java

@@ -1,7 +1,6 @@
 package com.mokamrp.privates.entity.pangu;
 package com.mokamrp.privates.entity.pangu;
 
 
 import lombok.Data;
 import lombok.Data;
-import lombok.NonNull;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
 
 
@@ -18,6 +17,7 @@ public class FosterwxCashAccountScheduleHandle {
     private Integer page;
     private Integer page;
     private Integer pageSize;
     private Integer pageSize;
     private Integer id;
     private Integer id;
+    private Integer type;
     private Integer groupId;
     private Integer groupId;
     private Integer templateId;
     private Integer templateId;
     private Integer createUid;
     private Integer createUid;

+ 1 - 0
src/main/java/com/mokamrp/privates/entity/pangu/FosterwxCashScheduleTaskListHandle.java

@@ -17,6 +17,7 @@ public class FosterwxCashScheduleTaskListHandle {
     private Integer page;
     private Integer page;
     private Integer pageSize;
     private Integer pageSize;
     private Integer id;
     private Integer id;
+    private Integer scheduleId;
     private Integer templateId;
     private Integer templateId;
     private Integer groupId;
     private Integer groupId;
     private Integer taskType;
     private Integer taskType;

+ 3 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashAccountScheduleMapper.xml

@@ -34,7 +34,7 @@
                     pan_fosterwx_cash_schedule_task_list
                     pan_fosterwx_cash_schedule_task_list
                 WHERE
                 WHERE
                     schedule_id = account_schedule.id
                     schedule_id = account_schedule.id
-                  AND STATUS IN ( '2', '4', '5', '6' )) AS created_count,
+                  AND STATUS IN ( '2', '4', '5', '6' )) AS createdCount,
             (
             (
                 SELECT
                 SELECT
                     count( id )
                     count( id )
@@ -42,8 +42,8 @@
                     pan_fosterwx_cash_schedule_task_list
                     pan_fosterwx_cash_schedule_task_list
                 WHERE
                 WHERE
                     schedule_id = account_schedule.id
                     schedule_id = account_schedule.id
-                  AND STATUS IN ( '5' )) AS sended_count,
-            ( SELECT count( id ) FROM pan_fosterwx_cash_schedule_task_list WHERE schedule_id = account_schedule.id ) AS total_count
+                  AND STATUS IN ( '5' )) AS sendedCount,
+            ( SELECT count( id ) FROM pan_fosterwx_cash_schedule_task_list WHERE schedule_id = account_schedule.id ) AS totalCount
         FROM
         FROM
             pan_fosterwx_cash_account_schedule account_schedule
             pan_fosterwx_cash_account_schedule account_schedule
         LEFT JOIN pan_fosterwx_cash_task_template task_template ON account_schedule.template_id = task_template.id
         LEFT JOIN pan_fosterwx_cash_task_template task_template ON account_schedule.template_id = task_template.id

+ 2 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.java

@@ -19,4 +19,6 @@ import java.util.List;
 @Component
 @Component
 public interface FosterwxCashScheduleTaskListMapper extends BaseMapper<FosterwxCashScheduleTaskList> {
 public interface FosterwxCashScheduleTaskListMapper extends BaseMapper<FosterwxCashScheduleTaskList> {
     public List<FosterwxCashScheduleTaskList> getList(@Param("ew") LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper, @Param("limit") Integer page, @Param("offset") Integer offset);
     public List<FosterwxCashScheduleTaskList> getList(@Param("ew") LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper, @Param("limit") Integer page, @Param("offset") Integer offset);
+
+    List<FosterwxCashScheduleTaskList> getBannedGhid();
 }
 }

+ 13 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.xml

@@ -7,10 +7,12 @@
         <id column="id" property="id" />
         <id column="id" property="id" />
         <result column="schedule_id" property="scheduleId" />
         <result column="schedule_id" property="scheduleId" />
         <result column="template_id" property="templateId" />
         <result column="template_id" property="templateId" />
+        <result column="task_id" property="taskId" />
         <result column="group_id" property="groupId" />
         <result column="group_id" property="groupId" />
         <result column="task_type" property="taskType" />
         <result column="task_type" property="taskType" />
         <result column="remark" property="remark" />
         <result column="remark" property="remark" />
         <result column="task_content" property="taskContent" />
         <result column="task_content" property="taskContent" />
+        <result column="gh_id" property="ghId" />
         <result column="status" property="status" />
         <result column="status" property="status" />
         <result column="type" property="type" />
         <result column="type" property="type" />
         <result column="err_info" property="errInfo" />
         <result column="err_info" property="errInfo" />
@@ -24,7 +26,7 @@
 
 
     <!-- 通用查询结果列 -->
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
-        id, schedule_id, template_id, group_id, task_type, remark, task_content, status, err_info, send_time, create_uid, update_uid, create_at, update_at
+        id, schedule_id, template_id, task_id, group_id, task_type, remark, task_content, status, err_info, send_time, create_uid, update_uid, create_at, update_at
     </sql>
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
         SELECT
         SELECT
@@ -48,4 +50,14 @@
         order by task_list.id desc
         order by task_list.id desc
         limit #{limit} offset #{offset}
         limit #{limit} offset #{offset}
     </select>
     </select>
+    <select id="getBannedGhid" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
+        SELECT
+            task_list.*
+        FROM
+            pan_fosterwx_cash_schedule_task_list task_list
+                LEFT JOIN pan_fosterwx_cash_oas_box box ON task_list.gh_id = box.gh_id
+        WHERE
+            box.fobidden_status = 2
+            AND task_list.`status` = 4
+    </select>
 </mapper>
 </mapper>

+ 64 - 22
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxCashScheduleTaskList.java

@@ -1,11 +1,13 @@
 package com.mokamrp.privates.mapper.pangu.pojo;
 package com.mokamrp.privates.mapper.pangu.pojo;
 
 
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+
 import java.io.Serializable;
 import java.io.Serializable;
+import java.time.LocalDateTime;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -23,7 +25,7 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
     /**
     /**
      * id
      * id
      */
      */
-      @TableId(value = "id", type = IdType.AUTO)
+    @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
     private Integer id;
 
 
     /**
     /**
@@ -37,6 +39,11 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
     private Integer templateId;
     private Integer templateId;
 
 
     /**
     /**
+     * 任务id
+     */
+    private Integer taskId;
+
+    /**
      * 组别id
      * 组别id
      */
      */
     private Integer groupId;
     private Integer groupId;
@@ -52,11 +59,16 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
     private String remark;
     private String remark;
 
 
     /**
     /**
-     * 任务名称
+     * 任务详情
      */
      */
     private String taskContent;
     private String taskContent;
 
 
     /**
     /**
+     * gh_id
+     */
+    private String ghId;
+
+    /**
      * 状态(1、待生成;2、已生成;3、生成失败;4、待发送;5、已发送;6、已取消)
      * 状态(1、待生成;2、已生成;3、生成失败;4、待发送;5、已发送;6、已取消)
      */
      */
     private Integer status;
     private Integer status;
@@ -102,6 +114,9 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
      */
      */
     private LocalDateTime updateAt;
     private LocalDateTime updateAt;
 
 
+    @TableField(exist = false)
+    private FosterwxCashTaskList fosterwxCashTaskList;
+
 
 
     public Integer getId() {
     public Integer getId() {
         return id;
         return id;
@@ -127,6 +142,14 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
         this.templateId = templateId;
         this.templateId = templateId;
     }
     }
 
 
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
+
     public Integer getGroupId() {
     public Integer getGroupId() {
         return groupId;
         return groupId;
     }
     }
@@ -159,6 +182,14 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
         this.taskContent = taskContent;
         this.taskContent = taskContent;
     }
     }
 
 
+    public String getGhId() {
+        return ghId;
+    }
+
+    public void setGhId(String ghId) {
+        this.ghId = ghId;
+    }
+
     public Integer getStatus() {
     public Integer getStatus() {
         return status;
         return status;
     }
     }
@@ -231,6 +262,15 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
         this.updateAt = updateAt;
         this.updateAt = updateAt;
     }
     }
 
 
+
+    public FosterwxCashTaskList getFosterwxCashTaskList() {
+        return fosterwxCashTaskList;
+    }
+
+    public void setFosterwxCashTaskList(FosterwxCashTaskList fosterwxCashTaskList) {
+        this.fosterwxCashTaskList = fosterwxCashTaskList;
+    }
+
     @Override
     @Override
     protected Serializable pkVal() {
     protected Serializable pkVal() {
         return this.id;
         return this.id;
@@ -239,22 +279,24 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "FosterwxCashScheduleTaskList{" +
         return "FosterwxCashScheduleTaskList{" +
-        "id=" + id +
-        ", scheduleId=" + scheduleId +
-        ", templateId=" + templateId +
-        ", groupId=" + groupId +
-        ", taskType=" + taskType +
-        ", remark=" + remark +
-        ", taskContent=" + taskContent +
-        ", status=" + status +
-        ", type=" + type +
-        ", errInfo=" + errInfo +
-        ", sendTime=" + sendTime +
-        ", createUid=" + createUid +
-        ", createUser=" + createUser +
-        ", updateUid=" + updateUid +
-        ", createAt=" + createAt +
-        ", updateAt=" + updateAt +
-        "}";
+                "id=" + id +
+                ", scheduleId=" + scheduleId +
+                ", templateId=" + templateId +
+                ", taskId=" + taskId +
+                ", groupId=" + groupId +
+                ", taskType=" + taskType +
+                ", remark=" + remark +
+                ", taskContent=" + taskContent +
+                ", ghId=" + ghId +
+                ", status=" + status +
+                ", type=" + type +
+                ", errInfo=" + errInfo +
+                ", sendTime=" + sendTime +
+                ", createUid=" + createUid +
+                ", createUser=" + createUser +
+                ", updateUid=" + updateUid +
+                ", createAt=" + createAt +
+                ", updateAt=" + updateAt +
+                "}";
     }
     }
 }
 }

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

@@ -26,4 +26,16 @@ public interface FosterwxCashScheduleTaskListService extends IService<FosterwxCa
      * @param userId
      * @param userId
      */
      */
     void cancelTask(Integer id, Integer userId);
     void cancelTask(Integer id, Integer userId);
+
+    /**
+     * 生成任务 正常生成 | 生成失败|检测到公众号封禁重新生成链接
+     * @param fosterwxCashScheduleTaskList
+     */
+    void create(FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList);
+
+    /**
+     * 获取被封禁的任务
+     * @return
+     */
+    List<FosterwxCashScheduleTaskList> getBannedGhid();
 }
 }

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

@@ -10,6 +10,7 @@ import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
+import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashTaskTemplateService;
 import com.mokamrp.privates.service.pangu.FosterwxCashTaskTemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -37,6 +38,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
     @Autowired
     @Autowired
     public FosterwxCashScheduleTaskListMapper fosterwxCashScheduleTaskListMapper;
     public FosterwxCashScheduleTaskListMapper fosterwxCashScheduleTaskListMapper;
 
 
+    @Autowired
+    public FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
+
     /**
     /**
      * 获取数据列表 支持分页
      * 获取数据列表 支持分页
      * @param handle
      * @param handle
@@ -46,7 +50,10 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
         Integer pagesize = handle.getPageSize();
         Integer pagesize = handle.getPageSize();
         Integer page = handle.getPage();
         Integer page = handle.getPage();
         LambdaQueryWrapper<FosterwxCashAccountSchedule> fosterwxCashAccountScheduleLambdaQueryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<FosterwxCashAccountSchedule> fosterwxCashAccountScheduleLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        // 排期日期
         fosterwxCashAccountScheduleLambdaQueryWrapper.eq(FosterwxCashAccountSchedule::getScheduleDate, handle.getScheduleDate());
         fosterwxCashAccountScheduleLambdaQueryWrapper.eq(FosterwxCashAccountSchedule::getScheduleDate, handle.getScheduleDate());
+        // 任务类型 1:个微任务 2:企微任务
+        fosterwxCashAccountScheduleLambdaQueryWrapper.eq(FosterwxCashAccountSchedule::getType, handle.getType());
         // 任务模板
         // 任务模板
         if (null != handle.getTemplateId())
         if (null != handle.getTemplateId())
             fosterwxCashAccountScheduleLambdaQueryWrapper.eq(FosterwxCashAccountSchedule::getTemplateId, handle.getTemplateId());
             fosterwxCashAccountScheduleLambdaQueryWrapper.eq(FosterwxCashAccountSchedule::getTemplateId, handle.getTemplateId());
@@ -77,16 +84,20 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
 
 
         if (null != fosterwxCashAccountSchedule) {
         if (null != fosterwxCashAccountSchedule) {
             // 根据任务模板id获取任务模板详情
             // 根据任务模板id获取任务模板详情
-            ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getId());
+            ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getTemplateId());
 
 
             resHandle.getList().forEach(fosterwxCashTaskList -> {
             resHandle.getList().forEach(fosterwxCashTaskList -> {
+                // 创建任务
                 FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
                 FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
                 fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
                 fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
                 fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
                 fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
+                fosterwxCashScheduleTaskList.setTaskId(fosterwxCashTaskList.getId());
                 fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
                 fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
                 fosterwxCashScheduleTaskList.setTaskType(fosterwxCashTaskList.getTaskType());
                 fosterwxCashScheduleTaskList.setTaskType(fosterwxCashTaskList.getTaskType());
                 fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
                 fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
                 fosterwxCashScheduleTaskList.setTaskContent("");
                 fosterwxCashScheduleTaskList.setTaskContent("");
+                //TODO 传递组别 随机获取ghid
+                fosterwxCashScheduleTaskList.setGhId("");
                 fosterwxCashScheduleTaskList.setStatus(1);
                 fosterwxCashScheduleTaskList.setStatus(1);
                 fosterwxCashScheduleTaskList.setErrInfo("");
                 fosterwxCashScheduleTaskList.setErrInfo("");
                 fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashTaskList.getSendAt()));
                 fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashTaskList.getSendAt()));
@@ -97,6 +108,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
                 fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
                 fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
 
 
                 fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
                 fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
+
+                // 调用typer生成链接
+                fosterwxCashScheduleTaskListService.create(fosterwxCashScheduleTaskList);
             });
             });
 
 
             // 任务列表创建完成后 账号排期状态设置成正常
             // 任务列表创建完成后 账号排期状态设置成正常

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

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.service.pangu.impl;
 package com.mokamrp.privates.service.pangu.impl;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.ResHandle;
@@ -7,6 +8,9 @@ import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
 import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
+import com.mokamrp.privates.service.pangu.FosterwxCashTaskListService;
+import com.mokamrp.privates.utils.pangu.redis.task.TaskRedis;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -27,6 +31,12 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
     @Autowired
     @Autowired
     public FosterwxCashScheduleTaskListMapper fosterwxCashScheduleTaskListMapper;
     public FosterwxCashScheduleTaskListMapper fosterwxCashScheduleTaskListMapper;
 
 
+    @Autowired
+    public TaskRedis taskRedis;
+
+    @Autowired
+    public FosterwxCashTaskListService fosterwxCashTaskListService;
+
     /**
     /**
      * 获取数据列表 支持分页
      * 获取数据列表 支持分页
      * @param handle
      * @param handle
@@ -51,6 +61,9 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
         // 账号分组
         // 账号分组
         if (null != handle.getGroupId())
         if (null != handle.getGroupId())
             fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getGroupId, handle.getGroupId());
             fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getGroupId, handle.getGroupId());
+        // 排期id
+        if (null != handle.getScheduleId())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, handle.getScheduleId());
 
 
         List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(fosterwxCashScheduleTaskListLambdaQueryWrapper, pagesize, (page - 1) * pagesize);
         List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(fosterwxCashScheduleTaskListLambdaQueryWrapper, pagesize, (page - 1) * pagesize);
         ResHandle<List<FosterwxCashScheduleTaskList>> res = new ResHandle<>();
         ResHandle<List<FosterwxCashScheduleTaskList>> res = new ResHandle<>();
@@ -73,4 +86,34 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
             setUpdateAt(LocalDateTime.now());
             setUpdateAt(LocalDateTime.now());
         }});
         }});
     }
     }
+
+    /**
+     * 生成任务 正常生成 | 生成失败|检测到公众号封禁重新生成链接
+     * @param fosterwxCashScheduleTaskList
+     */
+    @Override
+    public void create(FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList) {
+        // 状态
+        fosterwxCashScheduleTaskList.setStatus(1);
+        // 失败原因
+        fosterwxCashScheduleTaskList.setErrInfo("");
+
+        fosterwxCashScheduleTaskListMapper.updateById(fosterwxCashScheduleTaskList);
+
+        fosterwxCashScheduleTaskList.setFosterwxCashTaskList(fosterwxCashTaskListService.getById(fosterwxCashScheduleTaskList.getTaskId()));
+
+        taskRedis.createUrlByTyper(JSON.toJSONString(fosterwxCashScheduleTaskList));
+    }
+
+    /**
+     * 获取被封禁的任务
+     * @return
+     */
+    @Override
+    public List<FosterwxCashScheduleTaskList> getBannedGhid() {
+        // 获取被封禁的任务
+        List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskLists = fosterwxCashScheduleTaskListMapper.getBannedGhid();
+
+        return fosterwxCashScheduleTaskLists;
+    }
 }
 }

+ 81 - 20
src/main/java/com/mokamrp/privates/task/pangu/SyncCreateCashTask.java

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.pangu.FosterwxCashAccountScheduleHandle;
 import com.mokamrp.privates.entity.pangu.FosterwxCashAccountScheduleHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
+import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import net.javacrumbs.shedlock.core.SchedulerLock;
 import net.javacrumbs.shedlock.core.SchedulerLock;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,8 +34,14 @@ public class SyncCreateCashTask {
     private FosterwxCashAccountScheduleService fosterwxCashAccountScheduleService;
     private FosterwxCashAccountScheduleService fosterwxCashAccountScheduleService;
 
 
     @Autowired
     @Autowired
+    private FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
+
+    @Autowired
     private RestTemplate restTemplate;
     private RestTemplate restTemplate;
 
 
+    /**
+     * 每天下午五点生成第二天的任务及链接
+     */
     @Scheduled(cron = "0 0 17 * * ?")
     @Scheduled(cron = "0 0 17 * * ?")
     @SchedulerLock(name = "pangu:SyncCreateCashTask", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
     @SchedulerLock(name = "pangu:SyncCreateCashTask", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
     public void syncCreateCashTask() {
     public void syncCreateCashTask() {
@@ -65,31 +73,84 @@ public class SyncCreateCashTask {
         body.put("msg_type", "post");
         body.put("msg_type", "post");
         JSONArray content = new JSONArray();
         JSONArray content = new JSONArray();
         res.getList().forEach(fosterwxCashAccountSchedule -> {
         res.getList().forEach(fosterwxCashAccountSchedule -> {
-            JSONArray rowData = new JSONArray();
-            rowData.add(new JSONObject() {
-                {
-                    {
-                        put("tag", "text");
-                        put("text", "排期日期:" + fosterwxCashAccountSchedule.getScheduleDate() + " 账号组: " + fosterwxCashAccountSchedule.getGroupName() + " 任务失败数量:" + (fosterwxCashAccountSchedule.getTotalCount() - fosterwxCashAccountSchedule.getCreatedCount()) + "个");
-                    }
-                }
-            });
-            content.add(rowData);
+            content.add(getJsonArray("排期日期:" + fosterwxCashAccountSchedule.getScheduleDate() + " 账号组: " + fosterwxCashAccountSchedule.getGroupName() + " 任务失败数量:" + (fosterwxCashAccountSchedule.getTotalCount() - fosterwxCashAccountSchedule.getCreatedCount()) + "个"));
+        });
+
+        if (content.size() > 0) {
+            JSONObject post = new JSONObject();
+            JSONObject zh_cn = new JSONObject();
+            JSONObject outContent = new JSONObject();
+            zh_cn.put("title", "飞书汇总提醒任务失败详情:");
+            sendTofeishu(body, content, post, zh_cn, outContent);
+        }
+    }
+
+    /**
+     * 检查微信公众号封禁情况 封禁的情况下 需要重新换公众号重新生成
+     */
+    @Scheduled(cron = "0 */1 * * * ?")
+    @SchedulerLock(name = "pangu:TaskInfoNotify", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void checkGhidStatus() {
+        // 获取待发送状态的封禁的任务
+        List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskLists = fosterwxCashScheduleTaskListService.getBannedGhid();
+
+        Map<String, Object> body = new HashMap<>(1);
+        body.put("msg_type", "post");
+        JSONArray content = new JSONArray();
+
+        fosterwxCashScheduleTaskLists.forEach(fosterwxCashScheduleTaskList -> {
+            // 飞书通知消息设置
+            content.add(getJsonArray("任务ID:" + fosterwxCashScheduleTaskList.getId() + " 公众号: " + fosterwxCashScheduleTaskList.getGhId() + " 发送时间:" + fosterwxCashScheduleTaskList.getSendTime()));
+            // 重新创建
+            fosterwxCashScheduleTaskListService.create(fosterwxCashScheduleTaskList);
         });
         });
-        JSONObject post = new JSONObject();
-        JSONObject zh_cn = new JSONObject();
-        JSONObject outContent = new JSONObject();
-        zh_cn.put("title", "飞书汇总提醒任务失败详情:");
+
+        if (content.size() > 0) {
+            JSONObject post = new JSONObject();
+            JSONObject zh_cn = new JSONObject();
+            JSONObject outContent = new JSONObject();
+            zh_cn.put("title", "飞书汇总公众号封禁任务:");
+
+            // 重新生成提醒
+            content.add(getJsonArray("以上任务已重新生成!"));
+
+            sendTofeishu(body, content, post, zh_cn, outContent);
+        }
+    }
+
+    /**
+     * 发送到飞书
+     * @param body
+     * @param content
+     * @param post
+     * @param zh_cn
+     * @param outContent
+     */
+    private void sendTofeishu(Map<String, Object> body, JSONArray content, JSONObject post, JSONObject zh_cn, JSONObject outContent) {
         zh_cn.put("content", content);
         zh_cn.put("content", content);
         post.put("zh_cn", zh_cn);
         post.put("zh_cn", zh_cn);
         outContent.put("post", post);
         outContent.put("post", post);
         body.put("content", outContent);
         body.put("content", outContent);
         HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, null);
         HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, null);
-        if (content.size() > 0) {
-            JSONObject result = restTemplate.exchange(FEISHU_ROBOT, HttpMethod.POST, httpEntity, JSONObject.class).getBody();
-            log.info("{}", result);
-        } else {
-            log.info("没有错误数据");
-        }
+        // 发送飞书提醒
+        restTemplate.exchange(FEISHU_ROBOT, HttpMethod.POST, httpEntity, JSONObject.class);
+    }
+
+    /**
+     * 飞书提醒格式化
+     * @param text
+     * @return
+     */
+    private JSONArray getJsonArray(String text) {
+        JSONArray rowData = new JSONArray();
+        rowData.add(new JSONObject() {
+            {
+                {
+                    put("tag", "text");
+                    put("text", text);
+                }
+            }
+        });
+        return rowData;
     }
     }
 }
 }

+ 26 - 0
src/main/java/com/mokamrp/privates/utils/pangu/redis/task/TaskRedis.java

@@ -0,0 +1,26 @@
+package com.mokamrp.privates.utils.pangu.redis.task;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+@Component
+public class TaskRedis {
+    // 缓存的任务信息数据
+    public static final String PANGU_CASH_TASK_INFO = "pangu_cash_task_info";
+    // 缓存生成的链接
+    public static final String PANGU_CASH_CREATED_URL = "pangu_cash_created_url";
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    /**
+     * 缓存给typer制作url所需的数据
+     * @param json
+     */
+    public void createUrlByTyper(String json) {
+
+        // 把数据存放到redis缓存中
+        stringRedisTemplate.opsForList().leftPush(PANGU_CASH_TASK_INFO, json);
+    }
+}

+ 1 - 1
src/test/java/com/mokamrp/AutoMPPangu.java

@@ -46,7 +46,7 @@ public class AutoMPPangu {
                 .setColumnNaming(NamingStrategy.underline_to_camel)
                 .setColumnNaming(NamingStrategy.underline_to_camel)
                 .setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略,下划线转驼峰命名
                 .setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略,下划线转驼峰命名
                 .setTablePrefix("pan_") //表名前缀
                 .setTablePrefix("pan_") //表名前缀
-                .setInclude("pan_fosterwx_cash_account_schedule").setInclude("pan_fosterwx_cash_schedule_task_list");
+                .setInclude("pan_fosterwx_cash_schedule_task_list");
         //4. 包名策略配置
         //4. 包名策略配置
         PackageConfig pkConfig = new PackageConfig();
         PackageConfig pkConfig = new PackageConfig();
         pkConfig.setParent("com.mokamrp.privates")
         pkConfig.setParent("com.mokamrp.privates")