Jelajahi Sumber

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

leon 4 tahun lalu
induk
melakukan
58e2f190c5

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

@@ -124,7 +124,7 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
                 // 任务类型为链接是直接赋值
                 if (4 == fosterwxCashTaskList.getTaskType()) {
                     fosterwxCashScheduleTaskList.setSendUrl(fosterwxCashTaskList.getUrl());
-                    fosterwxCashScheduleTaskList.setStatus(2);
+                    fosterwxCashScheduleTaskList.setStatus(4);
                     fosterwxCashScheduleTaskList.setErrInfo("");
                 } else {
                     fosterwxCashScheduleTaskList.setSendUrl("");

+ 36 - 19
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCash.java

@@ -1,6 +1,7 @@
 package com.mokamrp.privates.task.pangu;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import com.mokamrp.privates.utils.pangu.redis.task.TaskRedis;
@@ -11,6 +12,10 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
 /**
  * 同步变现任务到缓存 供H5页面展示
  */
@@ -27,24 +32,6 @@ public class SyncFosterwxCash {
     private TaskRedis taskRedis;
 
     /**
-     * 每隔一分钟扫描今天待发送以及已经发送的任务
-     */
-    // @Scheduled(cron = "10 */1 * * * ?")
-    // @SchedulerLock(name = "pangu:SyncFosterwxCash", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
-    // public void syncFosterwxCash() {
-    //     // 获取当前时间
-    //     LocalDateTime minDateTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
-    //     LocalDateTime localDateTime = LocalDateTime.now();
-    //
-    //     List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskLists = fosterwxCashScheduleTaskListService.list(
-    //             new LambdaQueryWrapper<FosterwxCashScheduleTaskList>().
-    //                     eq(FosterwxCashScheduleTaskList::getType, 1).
-    //                     between(FosterwxCashScheduleTaskList::getSendTime, minDateTime, localDateTime));
-    //
-    //     stringRedisTemplate.opsForHash().put("pan_fosterwx_cash_group_id:", null, null);
-    // }
-
-    /**
      * 定时同步typer已经生成的url
      */
     @Scheduled(cron = "20 */1 * * * ?")
@@ -59,7 +46,7 @@ public class SyncFosterwxCash {
                 fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
                     setId(Integer.valueOf(jsonObject.get("automatic_id").toString()));
                     setSendUrl(jsonObject.get("article_url").toString());
-                    setStatus(2);
+                    setStatus(4);
                 }});
             } else {
                 fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
@@ -72,4 +59,34 @@ public class SyncFosterwxCash {
             urlInfo = taskRedis.getPanguCashTaskInfo();
         }
     }
+
+    /**
+     * 每天一分钟定时更新需要发送的任务的状态
+     * @since: 1.18.1
+     * @param: []
+     * @return: void
+     * @author: lqc
+     * @date: 2021/10/22
+     */
+    @Scheduled(cron = "5 */1 * * * ?")
+    @SchedulerLock(name = "pangu:SyncCreatedUrlInfo", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void syncTaskListStatus() {
+        LocalDateTime localDateTime = LocalDateTime.now();
+
+        LocalDateTime zeroDateTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
+
+
+        // 更新个微任务
+        fosterwxCashScheduleTaskListService.update(
+                new FosterwxCashScheduleTaskList() {{
+                    setStatus(5);
+                    setUpdateAt(LocalDateTime.now());
+                }},
+                new LambdaQueryWrapper<FosterwxCashScheduleTaskList>().
+                        eq(FosterwxCashScheduleTaskList::getStatus, 4).
+                        eq(FosterwxCashScheduleTaskList::getType, 1).
+                        between(FosterwxCashScheduleTaskList::getSendTime, zeroDateTime, localDateTime)
+        );
+
+    }
 }