Sfoglia il codice sorgente

fix:定时任务bug

wrj 3 settimane fa
parent
commit
8b4fb85617

+ 0 - 23
nightFragrance-framework/src/main/java/com/ylx/framework/config/BoundGeoOperationConfig.java

@@ -1,23 +0,0 @@
-//package com.ylx.framework.config;
-//
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.data.redis.core.BoundGeoOperations;
-//import org.springframework.data.redis.core.RedisTemplate;
-//
-///**
-// * @author jianlong
-// * @date 2024-04-08 09:31
-// */
-//
-//@Configuration
-//public class BoundGeoOperationConfig {
-//    @Autowired
-//    private RedisTemplate<String, Object> redisTemplate;
-//
-//    @Bean
-//    public BoundGeoOperations<String, Object> boundGeoOperations() {
-//        return (BoundGeoOperations<String, Object>) redisTemplate.opsForGeo();
-//    }
-//}

+ 0 - 32
nightFragrance-framework/src/main/java/com/ylx/framework/config/WeChatMpConfig.java

@@ -1,32 +0,0 @@
-//package com.ylx.framework.config;
-//
-//import com.ylx.common.config.WechatAccountConfig;
-//import me.chanjar.weixin.mp.api.WxMpConfigStorage;
-//import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
-//import me.chanjar.weixin.mp.api.WxMpService;
-//import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.stereotype.Component;
-//
-//@Component
-//public class WeChatMpConfig {
-//
-//    @Autowired
-//    private WechatAccountConfig wechatAccountConfig;
-//
-//    @Bean
-//    public WxMpService wxMpService(){
-//        WxMpService wxMpService = new WxMpServiceImpl();
-//        wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
-//        return wxMpService;
-//    }
-//
-//    @Bean
-//    public WxMpConfigStorage wxMpConfigStorage(){
-//        WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
-//        wxMpConfigStorage.setAppId(wechatAccountConfig.getMpAppId());
-//        wxMpConfigStorage.setSecret(wechatAccountConfig.getMpAppSecret());
-//        return wxMpConfigStorage;
-//    }
-//}

+ 21 - 15
nightFragrance-massage/src/main/java/com/ylx/massage/task/massageTask.java

@@ -20,9 +20,7 @@ import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 
 /**
@@ -109,6 +107,7 @@ public class massageTask {
             total = timeoutNotOrder(date);
         }
     }
+
     private Long timeoutNotOrder(Date nowDate) {
         LambdaQueryWrapper<TOrder> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
         objectLambdaQueryWrapper.eq(TOrder::getnStatus, OrderStatusEnum.WAIT_JD.getCode()).
@@ -131,7 +130,6 @@ public class massageTask {
     }
 
 
-
     public void isGetAmount() {
         Date nowDate = new Date();
         log.info("定时分配出账金额日期,{}", nowDate);
@@ -140,6 +138,7 @@ public class massageTask {
         log.info("定时分配出账金额日期,{}", date);
         isGetAmount(date);
     }
+
     private void isGetAmount(Date date) {
 
         //查询所有部门
@@ -155,7 +154,7 @@ public class massageTask {
                     LambdaQueryWrapper<TConsumptionLog> logLambdaQueryWrapper = new LambdaQueryWrapper<>();
                     logLambdaQueryWrapper.eq(TConsumptionLog::getIsGet, MassageConstants.INTEGER_ZERO).
                             eq(TConsumptionLog::getOpenId, js.getcOpenId()).
-                            in(TConsumptionLog::getBillType, Arrays.asList(BillTypeEnum.INCOME.getCode(),BillTypeEnum.DISTRIBUTION.getCode())).
+                            in(TConsumptionLog::getBillType, Arrays.asList(BillTypeEnum.INCOME.getCode(), BillTypeEnum.DISTRIBUTION.getCode())).
                             le(TConsumptionLog::getCreateTime, date).
                             orderByAsc(TConsumptionLog::getCreateTime);
                     List<TConsumptionLog> consumptionLogList = consumptionLogService.list(logLambdaQueryWrapper);
@@ -180,20 +179,21 @@ public class massageTask {
     }
 
 
-
-
     public void cancelNewJs() {
 
         Date nowDate = new Date();
         log.info("开始执行取消新技师标识任务当前时间,{}", nowDate);
 
-        long total = 1L;
-        while (total > 0L) {
+        long flag = 1L;
+        while (flag > 0L) {
             LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
             Date date = DateTimeUtils.addDays(nowDate, -7);
 
             log.info("开始执行取新技师当前时间减7天,{}", date);
-            objectLambdaQueryWrapper.eq(TJs::getnB2, MassageConstants.INTEGER_ONE).le(TJs::getcTime, date).orderByAsc(TJs::getcTime);
+            objectLambdaQueryWrapper.eq(TJs::getnB2, MassageConstants.INTEGER_ONE).
+                    le(TJs::getcTime, date).
+                    gt(TJs::getId, String.valueOf(flag)).
+                    orderByAsc(TJs::getId);
 
             Page<TJs> page = new Page<>();
             page.setSize(MassageConstants.TWO_HUNDRED);
@@ -208,8 +208,11 @@ public class massageTask {
                     jsService.updateById(js);
                     log.info("取消新技师标识,{}", js.getcOpenId() + js.getcName());
                 });
+                Optional<String> maxId = page1.getRecords().stream().max(Comparator.comparing(TJs::getId)).map(TJs::getId);
+                flag = Long.parseLong(maxId.orElse("0"));
+            } else {
+                flag = 0L;
             }
-            total = page1.getTotal();
         }
     }
 
@@ -219,10 +222,10 @@ public class massageTask {
         log.info("开始执行取消技师热度标识任务当前时间,{}", nowDate);
 
         Date date = DateTimeUtils.addDays(nowDate, -3);
-        long total = 1L;
-        while (total > 0L) {
+        long flag = 1L;
+        while (flag > 0L) {
             LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            objectLambdaQueryWrapper.eq(TJs::getnB3, MassageConstants.INTEGER_ONE);
+            objectLambdaQueryWrapper.eq(TJs::getnB3, MassageConstants.INTEGER_ONE).gt(TJs::getId, String.valueOf(flag)).orderByAsc(TJs::getId);
 
             Page<TJs> page = new Page<>();
             page.setSize(MassageConstants.TWO_HUNDRED);
@@ -239,8 +242,11 @@ public class massageTask {
                         log.info("取消热度技师标识,{}", js.getcOpenId() + js.getcName());
                     }
                 });
+                Optional<String> maxId = page1.getRecords().stream().max(Comparator.comparing(TJs::getId)).map(TJs::getId);
+                flag = Long.parseLong(maxId.orElse("0"));
+            } else {
+                flag = 0L;
             }
-            total = page1.getTotal();
         }
     }