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

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

@@ -23,6 +23,5 @@ public class FosterwxCashAccountScheduleHandle {
     private Integer createUid;
     private String createUser;
     private String ids;
-    @NonNull
     private LocalDate scheduleDate;
 }

+ 6 - 4
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashAccountScheduleServiceImpl.java

@@ -8,10 +8,10 @@ import com.mokamrp.privates.mapper.pangu.FosterwxCashAccountScheduleMapper;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
+import com.mokamrp.privates.service.pangu.FosterwxCashTaskTemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -28,6 +28,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
     @Autowired
     public FosterwxCashAccountScheduleMapper fosterwxCashAccountScheduleMapper;
 
+    @Autowired
+    public FosterwxCashTaskTemplateService fosterwxCashTaskTemplateService;
+
     /**
      * 获取数据列表 支持分页
      * @param handle
@@ -67,10 +70,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
 
         if (null != fosterwxCashAccountSchedule) {
             // 根据任务模板id获取任务模板详情
-            // TODO 需要老王那边配合写个方法
-            List<FosterwxCashTaskList> fosterwxCashTaskLists = new ArrayList<>();
+            ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getId());
 
-            fosterwxCashTaskLists.forEach(fosterwxCashTaskList -> {
+            resHandle.getList().forEach(fosterwxCashTaskList -> {
 
             });
         }

+ 14 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncCreateCashTask.java

@@ -1,16 +1,30 @@
 package com.mokamrp.privates.task.pangu;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
+import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
 import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 
+import java.time.LocalDate;
+import java.util.List;
+
 /**
  * 每天五点定时生成第二天的任务列表
  */
 public class SyncCreateCashTask {
+    @Autowired
+    private FosterwxCashAccountScheduleService fosterwxCashAccountScheduleService;
 
     @Scheduled(cron = "0 0 17 * * ?")
     @SchedulerLock(name = "pangu:SyncCreateCashTask", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
     public void execute() {
+        // 获取明天日期
+        LocalDate nextDay = LocalDate.now().plusDays(1);
+
+        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay));
 
+        fosterwxCashAccountSchedules.forEach(fosterwxCashAccountSchedule -> fosterwxCashAccountScheduleService.createTask(fosterwxCashAccountSchedule.getId()));
     }
 }