Просмотр исходного кода

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

# Conflicts:
#	src/test/java/com/mokamrp/AutoMPPangu.java
leon 4 лет назад
Родитель
Сommit
916c2efea5

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

@@ -11,9 +11,11 @@ import com.mokamrp.privates.help.Analysis;
 import com.mokamrp.privates.interceptor.AuthUser;
 import com.mokamrp.privates.interceptor.AuthUser;
 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.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashTaskList;
 import com.mokamrp.privates.mapper.pojo.User;
 import com.mokamrp.privates.mapper.pojo.User;
 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.FosterwxCashScheduleTaskListService;
+import com.mokamrp.privates.service.pangu.FosterwxCashTaskTemplateService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +53,9 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
     @Autowired
     @Autowired
     public FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
     public FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
 
 
+    @Autowired
+    public FosterwxCashTaskTemplateService fosterwxCashTaskTemplateService;
+
     /*
     /*
      * @fast
      * @fast
      * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
      * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
@@ -128,17 +133,24 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
     }
     }
 
 
     @PostMapping("/preview")
     @PostMapping("/preview")
-    @ApiOperation(value = "预览按钮---缺少老王的方法")
+    @ApiOperation(value = "预览按钮")
     public Object priview(FosterwxCashAccountScheduleHandle handle) {
     public Object priview(FosterwxCashAccountScheduleHandle handle) {
-        // TODO 等老王的接口
+        ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(handle.getTemplateId());
 
 
-        return AjaxResult.success("");
+        return AjaxResult.success(resHandle);
     }
     }
 
 
     @PostMapping("/cancelTask")
     @PostMapping("/cancelTask")
     @ApiOperation(value = "取消任务按钮")
     @ApiOperation(value = "取消任务按钮")
     public Object cancelTask(FosterwxCashAccountScheduleHandle handle, @AuthUser User user) {
     public Object cancelTask(FosterwxCashAccountScheduleHandle handle, @AuthUser User user) {
         Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
         Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
+            fosterwxCashAccountScheduleService.updateById(new FosterwxCashAccountSchedule() {{
+                setId(Integer.valueOf(id));
+                setStatus(0);
+                setUpdateAt(LocalDateTime.now());
+                setUpdateUid(user.getId());
+            }});
+
             LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
             LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
             fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, id);
             fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, id);
             fosterwxCashScheduleTaskListLambdaQueryWrapper.notIn(FosterwxCashScheduleTaskList::getStatus, 3, 5, 6);
             fosterwxCashScheduleTaskListLambdaQueryWrapper.notIn(FosterwxCashScheduleTaskList::getStatus, 3, 5, 6);

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

@@ -9,6 +9,7 @@
         <result column="group_id" property="groupId" />
         <result column="group_id" property="groupId" />
         <result column="template_id" property="templateId" />
         <result column="template_id" property="templateId" />
         <result column="status" property="status" />
         <result column="status" property="status" />
+        <result column="type" property="type" />
         <result column="create_uid" property="createUid" />
         <result column="create_uid" property="createUid" />
         <result column="create_user" property="createUser" />
         <result column="create_user" property="createUser" />
         <result column="update_uid" property="updateUid" />
         <result column="update_uid" property="updateUid" />

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

@@ -12,6 +12,7 @@
         <result column="remark" property="remark" />
         <result column="remark" property="remark" />
         <result column="task_content" property="taskContent" />
         <result column="task_content" property="taskContent" />
         <result column="status" property="status" />
         <result column="status" property="status" />
+        <result column="type" property="type" />
         <result column="err_info" property="errInfo" />
         <result column="err_info" property="errInfo" />
         <result column="send_time" property="sendTime" />
         <result column="send_time" property="sendTime" />
         <result column="create_uid" property="createUid" />
         <result column="create_uid" property="createUid" />

+ 85 - 15
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxCashAccountSchedule.java

@@ -1,12 +1,14 @@
 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.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+import java.io.Serializable;
 import java.time.LocalDate;
 import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import java.io.Serializable;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -24,7 +26,7 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
     /**
     /**
      * id
      * id
      */
      */
-      @TableId(value = "id", type = IdType.AUTO)
+    @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
     private Integer id;
 
 
     /**
     /**
@@ -48,6 +50,11 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
     private Integer status;
     private Integer status;
 
 
     /**
     /**
+     * 类型(1:个微任务 2:企微任务)
+     */
+    private Integer type;
+
+    /**
      * 创建人
      * 创建人
      */
      */
     private Integer createUid;
     private Integer createUid;
@@ -72,6 +79,20 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
      */
      */
     private LocalDateTime updateAt;
     private LocalDateTime updateAt;
 
 
+    @TableField(exist = false)
+    private String groupName;
+
+    @TableField(exist = false)
+    private String templateName;
+
+    @TableField(exist = false)
+    private Integer createdCount;
+
+    @TableField(exist = false)
+    private Integer sendedCount;
+
+    @TableField(exist = false)
+    private Integer totalCount;
 
 
     public Integer getId() {
     public Integer getId() {
         return id;
         return id;
@@ -113,6 +134,14 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
         this.status = status;
         this.status = status;
     }
     }
 
 
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
     public Integer getCreateUid() {
     public Integer getCreateUid() {
         return createUid;
         return createUid;
     }
     }
@@ -158,19 +187,60 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
         return this.id;
         return this.id;
     }
     }
 
 
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public void setTemplateName(String templateName) {
+        this.templateName = templateName;
+    }
+
+    public Integer getCreatedCount() {
+        return createdCount;
+    }
+
+    public void setCreatedCount(Integer createdCount) {
+        this.createdCount = createdCount;
+    }
+
+    public Integer getSendedCount() {
+        return sendedCount;
+    }
+
+    public void setSendedCount(Integer sendedCount) {
+        this.sendedCount = sendedCount;
+    }
+
+    public Integer getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(Integer totalCount) {
+        this.totalCount = totalCount;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "FosterwxCashAccountSchedule{" +
         return "FosterwxCashAccountSchedule{" +
-        "id=" + id +
-        ", scheduleDate=" + scheduleDate +
-        ", groupId=" + groupId +
-        ", templateId=" + templateId +
-        ", status=" + status +
-        ", createUid=" + createUid +
-        ", createUser=" + createUser +
-        ", updateUid=" + updateUid +
-        ", createAt=" + createAt +
-        ", updateAt=" + updateAt +
-        "}";
+                "id=" + id +
+                ", scheduleDate=" + scheduleDate +
+                ", groupId=" + groupId +
+                ", templateId=" + templateId +
+                ", status=" + status +
+                ", type=" + type +
+                ", createUid=" + createUid +
+                ", createUser=" + createUser +
+                ", updateUid=" + updateUid +
+                ", createAt=" + createAt +
+                ", updateAt=" + updateAt +
+                "}";
     }
     }
 }
 }

+ 15 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxCashScheduleTaskList.java

@@ -62,6 +62,12 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
     private Integer status;
     private Integer status;
 
 
     /**
     /**
+     * 类型(1:个微任务 2:企微任务)
+     */
+    private Integer type;
+
+
+    /**
      * 失败原因
      * 失败原因
      */
      */
     private String errInfo;
     private String errInfo;
@@ -161,6 +167,14 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
         this.status = status;
         this.status = status;
     }
     }
 
 
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
     public String getErrInfo() {
     public String getErrInfo() {
         return errInfo;
         return errInfo;
     }
     }
@@ -233,6 +247,7 @@ public class FosterwxCashScheduleTaskList extends Model<FosterwxCashScheduleTask
         ", remark=" + remark +
         ", remark=" + remark +
         ", taskContent=" + taskContent +
         ", taskContent=" + taskContent +
         ", status=" + status +
         ", status=" + status +
+        ", type=" + type +
         ", errInfo=" + errInfo +
         ", errInfo=" + errInfo +
         ", sendTime=" + sendTime +
         ", sendTime=" + sendTime +
         ", createUid=" + createUid +
         ", createUid=" + createUid +

+ 2 - 0
src/main/java/com/mokamrp/privates/service/pangu/FosterwxCashAccountScheduleService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 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.pojo.User;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -22,6 +23,7 @@ public interface FosterwxCashAccountScheduleService extends IService<FosterwxCas
     /**
     /**
      * 根据排期id 创建任务列表
      * 根据排期id 创建任务列表
      * @param id
      * @param id
+     *
      */
      */
     void createTask(Integer id);
     void createTask(Integer id);
 }
 }

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

@@ -5,13 +5,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.FosterwxCashAccountScheduleMapper;
 import com.mokamrp.privates.mapper.pangu.FosterwxCashAccountScheduleMapper;
+import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
 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.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.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;
 
 
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -31,6 +34,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
     @Autowired
     @Autowired
     public FosterwxCashTaskTemplateService fosterwxCashTaskTemplateService;
     public FosterwxCashTaskTemplateService fosterwxCashTaskTemplateService;
 
 
+    @Autowired
+    public FosterwxCashScheduleTaskListMapper fosterwxCashScheduleTaskListMapper;
+
     /**
     /**
      * 获取数据列表 支持分页
      * 获取数据列表 支持分页
      * @param handle
      * @param handle
@@ -63,6 +69,7 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
     /**
     /**
      * 根据id创建任务列表
      * 根据id创建任务列表
      * @param id
      * @param id
+     *
      */
      */
     @Override
     @Override
     public void createTask(Integer id) {
     public void createTask(Integer id) {
@@ -73,8 +80,29 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
             ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getId());
             ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getId());
 
 
             resHandle.getList().forEach(fosterwxCashTaskList -> {
             resHandle.getList().forEach(fosterwxCashTaskList -> {
+                FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
+                fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
+                fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
+                fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
+                fosterwxCashScheduleTaskList.setTaskType(fosterwxCashTaskList.getTaskType());
+                fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
+                fosterwxCashScheduleTaskList.setTaskContent("");
+                fosterwxCashScheduleTaskList.setStatus(1);
+                fosterwxCashScheduleTaskList.setErrInfo("");
+                fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashTaskList.getSendAt()));
+                fosterwxCashScheduleTaskList.setCreateUid(fosterwxCashAccountSchedule.getCreateUid());
+                fosterwxCashScheduleTaskList.setCreateUser(fosterwxCashAccountSchedule.getCreateUser());
+                fosterwxCashScheduleTaskList.setUpdateUid(fosterwxCashAccountSchedule.getCreateUid());
+                fosterwxCashScheduleTaskList.setCreateAt(LocalDateTime.now());
+                fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
 
 
+                fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
             });
             });
+
+            // 任务列表创建完成后 账号排期状态设置成正常
+            fosterwxCashAccountSchedule.setStatus(1);
+            fosterwxCashAccountSchedule.setUpdateAt(LocalDateTime.now());
+            fosterwxCashAccountScheduleMapper.updateById(fosterwxCashAccountSchedule);
         }
         }
     }
     }
 }
 }

+ 67 - 2
src/main/java/com/mokamrp/privates/task/pangu/SyncCreateCashTask.java

@@ -1,30 +1,95 @@
 package com.mokamrp.privates.task.pangu;
 package com.mokamrp.privates.task.pangu;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mokamrp.privates.entity.ResHandle;
+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.service.pangu.FosterwxCashAccountScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
+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;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 每天五点定时生成第二天的任务列表
  * 每天五点定时生成第二天的任务列表
  */
  */
+@Component
+@Slf4j
 public class SyncCreateCashTask {
 public class SyncCreateCashTask {
+    public static final String FEISHU_ROBOT = "https://open.feishu.cn/open-apis/bot/v2/hook/9bc38791-e7d1-48a1-ae64-0df632e81a36";
     @Autowired
     @Autowired
     private FosterwxCashAccountScheduleService fosterwxCashAccountScheduleService;
     private FosterwxCashAccountScheduleService fosterwxCashAccountScheduleService;
 
 
+    @Autowired
+    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 execute() {
+    public void syncCreateCashTask() {
         // 获取明天日期
         // 获取明天日期
         LocalDate nextDay = LocalDate.now().plusDays(1);
         LocalDate nextDay = LocalDate.now().plusDays(1);
 
 
-        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay));
+        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay).eq(FosterwxCashAccountSchedule::getStatus, 2));
 
 
         fosterwxCashAccountSchedules.forEach(fosterwxCashAccountSchedule -> fosterwxCashAccountScheduleService.createTask(fosterwxCashAccountSchedule.getId()));
         fosterwxCashAccountSchedules.forEach(fosterwxCashAccountSchedule -> fosterwxCashAccountScheduleService.createTask(fosterwxCashAccountSchedule.getId()));
     }
     }
+
+    /**
+     * 每天起点飞书提醒 任务失败详情
+     */
+    @Scheduled(cron = "0 0 7 * * ?")
+    @SchedulerLock(name = "pangu:TaskInfoNotify", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void taskInfoNotify() {
+        // 获取当天日期
+        LocalDate localDate = LocalDate.now();
+
+        FosterwxCashAccountScheduleHandle handle = new FosterwxCashAccountScheduleHandle();
+        handle.setScheduleDate(localDate);
+        handle.setPage(1);
+        handle.setPageSize(999999999);
+
+        ResHandle<List<FosterwxCashAccountSchedule>> res = fosterwxCashAccountScheduleService.getList(handle);
+
+        Map<String, Object> body = new HashMap<>(1);
+        body.put("msg_type", "post");
+        JSONArray content = new JSONArray();
+        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);
+        });
+        JSONObject post = new JSONObject();
+        JSONObject zh_cn = new JSONObject();
+        JSONObject outContent = new JSONObject();
+        zh_cn.put("title", "飞书汇总提醒任务失败详情:");
+        zh_cn.put("content", content);
+        post.put("zh_cn", zh_cn);
+        outContent.put("post", post);
+        body.put("content", outContent);
+        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("没有错误数据");
+        }
+    }
 }
 }

+ 67 - 70
src/test/java/com/mokamrp/AutoMPPangu.java

@@ -6,85 +6,82 @@ import com.baomidou.mybatisplus.generator.AutoGenerator;
 import com.baomidou.mybatisplus.generator.InjectionConfig;
 import com.baomidou.mybatisplus.generator.InjectionConfig;
 import com.baomidou.mybatisplus.generator.config.*;
 import com.baomidou.mybatisplus.generator.config.*;
 import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
 import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskTemplate;
 import org.junit.Test;
 import org.junit.Test;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
 public class AutoMPPangu {
 public class AutoMPPangu {
-	/**
-	 * 代码生成    示例代码
-	 */
-	@Test
-	public void testGenerator() {
+    /**
+     * 代码生成    示例代码
+     */
+    @Test
+    public void testGenerator() {
 
 
-		//1. 全局配置
-		String outPutDir = "D://project/moka-private/src/main/java";
-		GlobalConfig config = new GlobalConfig();
-		config.setActiveRecord(true) // 是否支持AR模式
-				.setAuthor("leon") // 作者
-				.setOutputDir(outPutDir) // 生成路径
-				.setFileOverride(true)  // 文件覆盖
-				.setIdType(IdType.AUTO) // 主键策略
-				.setServiceName("%sService")  // 设置生成的service接口的名字的首字母是否为I
-				// IEmployeeService
-				.setBaseResultMap(true) //生成sql映射文件
-				.setBaseColumnList(true);//生成sql片段
+        //1. 全局配置
+        String outPutDir = "D://project/moka-private/src/main/java";
+        GlobalConfig config = new GlobalConfig();
+        config.setActiveRecord(true) // 是否支持AR模式
+                .setAuthor("leon") // 作者
+                .setOutputDir(outPutDir) // 生成路径
+                .setFileOverride(true)  // 文件覆盖
+                .setIdType(IdType.AUTO) // 主键策略
+                .setServiceName("%sService")  // 设置生成的service接口的名字的首字母是否为I
+                // IEmployeeService
+                .setBaseResultMap(true) //生成sql映射文件
+                .setBaseColumnList(true);//生成sql片段
 
 
-		//2. 数据源配置
-		DataSourceConfig  dsConfig  = new DataSourceConfig();
-		dsConfig.setDbType(DbType.MYSQL)  // 设置数据库类型
-				.setDriverName("com.mysql.cj.jdbc.Driver")
-				.setUrl("jdbc:mysql://172.18.71.27:3306/mochat")
-				.setUsername("typer")
-				.setPassword("jch9sh_shl");
-
-		//3. 策略配置
-		StrategyConfig stConfig = new StrategyConfig();
-		stConfig.setCapitalMode(true) //全局大写命名
-				.setRestControllerStyle(true) //.RestController
-				.setSuperControllerClass("BaseController")
-				.setColumnNaming(NamingStrategy.underline_to_camel)
-				.setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略,下划线转驼峰命名
-				.setTablePrefix("pan_") //表名前缀
-				.setInclude("pan_fosterwx_cash_oas_box_group");
-		//4. 包名策略配置
-		PackageConfig pkConfig = new PackageConfig();
-		pkConfig.setParent("com.mokamrp.privates")
-				.setMapper("mapper.pangu")
-				.setService("service.pangu")
-				.setServiceImpl("service.pangu.impl")
-				.setController("controller.pangu")
-				.setEntity("mapper.pangu.pojo")
-				.setXml("mapper.pangu");
-		//5. 注入自定义配置
-		InjectionConfig cfg = new InjectionConfig() {
-			@Override
-			public void initMap() {
-				Map<String, Object> map = new HashMap<String, Object>();
-				this.setMap(map);
-			}
-		};
-
-		//6. 整合配置
-		AutoGenerator  ag = new AutoGenerator();
-		ag.setGlobalConfig(config)
-		  .setDataSource(dsConfig)
-		  .setStrategy(stConfig)
-		  .setPackageInfo(pkConfig);
-		//. @leon 自定义模板
-		TemplateConfig tc = new TemplateConfig();
-		tc.setService("/template/service.java.vm");
-		tc.setServiceImpl("/template/serviceImpl.java.vm");
-		tc.setController("/template/controller.java.vm");
-		tc.setMapper("/template/mapper.java.vm");
-		tc.setXml("/template/mapper.xml.vm");
-		ag.setTemplate(tc);
-		//7. 执行
-		ag.execute();
-	}
+        //2. 数据源配置
+        DataSourceConfig dsConfig = new DataSourceConfig();
+        dsConfig.setDbType(DbType.MYSQL)  // 设置数据库类型
+                .setDriverName("com.mysql.cj.jdbc.Driver")
+                .setUrl("jdbc:mysql://172.18.71.27:3306/mochat")
+                .setUsername("typer")
+                .setPassword("jch9sh_shl");
+        //3. 策略配置
+        StrategyConfig stConfig = new StrategyConfig();
+        stConfig.setCapitalMode(true) //全局大写命名
+                .setRestControllerStyle(true) //.RestController
+                .setSuperControllerClass("BaseController")
+                .setColumnNaming(NamingStrategy.underline_to_camel)
+                .setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略,下划线转驼峰命名
+                .setTablePrefix("pan_") //表名前缀
+                .setInclude("pan_fosterwx_cash_account_schedule").setInclude("pan_fosterwx_cash_schedule_task_list");
+        //4. 包名策略配置
+        PackageConfig pkConfig = new PackageConfig();
+        pkConfig.setParent("com.mokamrp.privates")
+                .setMapper("mapper.pangu")
+                .setService("service.pangu")
+                .setServiceImpl("service.pangu.impl")
+                .setController("controller.pangu")
+                .setEntity("mapper.pangu.pojo")
+                .setXml("mapper.pangu");
+        //5. 注入自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                Map<String, Object> map = new HashMap<String, Object>();
+                this.setMap(map);
+            }
+        };
 
 
+        //6. 整合配置
+        AutoGenerator ag = new AutoGenerator();
+        ag.setGlobalConfig(config)
+                .setDataSource(dsConfig)
+                .setStrategy(stConfig)
+                .setPackageInfo(pkConfig);
+        //. @leon 自定义模板
+        TemplateConfig tc = new TemplateConfig();
+        tc.setService("/template/service.java.vm");
+        tc.setServiceImpl("/template/serviceImpl.java.vm");
+        tc.setController("/template/controller.java.vm");
+        tc.setMapper("/template/mapper.java.vm");
+        tc.setXml("/template/mapper.xml.vm");
+        ag.setTemplate(tc);
+        //7. 执行
+        ag.execute();
+    }
 
 
 
 
 }
 }

+ 9 - 0
src/test/java/com/mokamrp/WebTest.java

@@ -10,6 +10,7 @@ import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileTaskTimeListService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileTaskTimeListService;
 import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
+import com.mokamrp.privates.task.pangu.SyncCreateCashTask;
 import com.mokamrp.privates.task.pangu.SyncFosterwxMobilePool;
 import com.mokamrp.privates.task.pangu.SyncFosterwxMobilePool;
 import com.mokamrp.privates.task.pangu.SyncMobilePoolFans;
 import com.mokamrp.privates.task.pangu.SyncMobilePoolFans;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -46,6 +47,9 @@ public class WebTest {
     @Autowired
     @Autowired
     private SyncMobilePoolFans syncMobilePoolFans;
     private SyncMobilePoolFans syncMobilePoolFans;
 
 
+    @Autowired
+    private SyncCreateCashTask syncCreateCashTask;
+
     @Test
     @Test
     public void test1() {
     public void test1() {
         // 清洗数据
         // 清洗数据
@@ -99,4 +103,9 @@ public class WebTest {
             }
             }
         });
         });
     }
     }
+
+    @Test
+    public void test4(){
+        syncCreateCashTask.taskInfoNotify();
+    }
 }
 }