|
@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.ylx.common.constant.MassageConstants;
|
|
import com.ylx.common.constant.MassageConstants;
|
|
|
|
+import com.ylx.massage.domain.TJs;
|
|
import com.ylx.massage.domain.TOrder;
|
|
import com.ylx.massage.domain.TOrder;
|
|
import com.ylx.massage.enums.OrderStatusEnum;
|
|
import com.ylx.massage.enums.OrderStatusEnum;
|
|
|
|
+import com.ylx.massage.service.TJsService;
|
|
import com.ylx.massage.service.TOrderService;
|
|
import com.ylx.massage.service.TOrderService;
|
|
import com.ylx.massage.utils.DateTimeUtils;
|
|
import com.ylx.massage.utils.DateTimeUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -13,12 +15,12 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author jianlong
|
|
* @author jianlong
|
|
* @date 2024-04-19 14:11
|
|
* @date 2024-04-19 14:11
|
|
- *
|
|
|
|
*/
|
|
*/
|
|
@Slf4j
|
|
@Slf4j
|
|
@Component("massageTask")
|
|
@Component("massageTask")
|
|
@@ -27,6 +29,8 @@ public class massageTask {
|
|
@Resource
|
|
@Resource
|
|
private TOrderService orderService;
|
|
private TOrderService orderService;
|
|
|
|
|
|
|
|
+ private TJsService jsService;
|
|
|
|
+
|
|
public void cancelOrder() {
|
|
public void cancelOrder() {
|
|
|
|
|
|
Date nowDate = new Date();
|
|
Date nowDate = new Date();
|
|
@@ -35,7 +39,7 @@ public class massageTask {
|
|
Date date = DateTimeUtils.addMinute(nowDate, -5);
|
|
Date date = DateTimeUtils.addMinute(nowDate, -5);
|
|
log.info("开始执行取消订单任务当前时间减5分钟,{}", date);
|
|
log.info("开始执行取消订单任务当前时间减5分钟,{}", date);
|
|
long total = 1L;
|
|
long total = 1L;
|
|
- while(total > 0L){
|
|
|
|
|
|
+ while (total > 0L) {
|
|
total = extracted(date);
|
|
total = extracted(date);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -53,7 +57,7 @@ public class massageTask {
|
|
|
|
|
|
Page<TOrder> resPage = orderService.page(page, objectLambdaQueryWrapper);
|
|
Page<TOrder> resPage = orderService.page(page, objectLambdaQueryWrapper);
|
|
if (CollectionUtil.isNotEmpty(resPage.getRecords())) {
|
|
if (CollectionUtil.isNotEmpty(resPage.getRecords())) {
|
|
- resPage.getRecords().forEach(order->{
|
|
|
|
|
|
+ resPage.getRecords().forEach(order -> {
|
|
TOrder newOrder = new TOrder();
|
|
TOrder newOrder = new TOrder();
|
|
//todo 订单锁
|
|
//todo 订单锁
|
|
newOrder.setcId(order.getcId());
|
|
newOrder.setcId(order.getcId());
|
|
@@ -65,4 +69,67 @@ public class massageTask {
|
|
return resPage.getTotal();
|
|
return resPage.getTotal();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void cancelNewJs() {
|
|
|
|
+
|
|
|
|
+ Date nowDate = new Date();
|
|
|
|
+ log.info("开始执行取消新技师标识任务当前时间,{}", nowDate);
|
|
|
|
+
|
|
|
|
+ long total = 1L;
|
|
|
|
+ while (total > 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);
|
|
|
|
+
|
|
|
|
+ Page<TJs> page = new Page<>();
|
|
|
|
+ page.setSize(MassageConstants.TWO_HUNDRED);
|
|
|
|
+
|
|
|
|
+ Page<TJs> page1 = jsService.page(page, objectLambdaQueryWrapper);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtil.isNotEmpty(page1.getRecords())) {
|
|
|
|
+ page1.getRecords().forEach(tjs -> {
|
|
|
|
+ TJs js = new TJs();
|
|
|
|
+ js.setId(tjs.getId());
|
|
|
|
+ js.setnB2(MassageConstants.INTEGER_ZERO);
|
|
|
|
+ jsService.updateById(js);
|
|
|
|
+ log.info("取消新技师标识,{}", js.getcOpenId() + js.getcName());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ total = page1.getTotal();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void cancelHotJs() {
|
|
|
|
+
|
|
|
|
+ Date nowDate = new Date();
|
|
|
|
+ log.info("开始执行取消技师热度标识任务当前时间,{}", nowDate);
|
|
|
|
+
|
|
|
|
+ Date date = DateTimeUtils.addDays(nowDate, -3);
|
|
|
|
+ long total = 1L;
|
|
|
|
+ while (total > 0L) {
|
|
|
|
+ LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ objectLambdaQueryWrapper.eq(TJs::getnB3, MassageConstants.INTEGER_ONE);
|
|
|
|
+
|
|
|
|
+ Page<TJs> page = new Page<>();
|
|
|
|
+ page.setSize(MassageConstants.TWO_HUNDRED);
|
|
|
|
+ Page<TJs> page1 = jsService.page(page, objectLambdaQueryWrapper);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtil.isNotEmpty(page1.getRecords())) {
|
|
|
|
+ page1.getRecords().forEach(tjs -> {
|
|
|
|
+ List<TOrder> list = orderService.list(new LambdaQueryWrapper<TOrder>().eq(TOrder::getcJsId, tjs.getId()).ge(TOrder::getDtCreateTime, date));
|
|
|
|
+ if(CollectionUtil.isEmpty(list) || list.size() < 3){
|
|
|
|
+ TJs js = new TJs();
|
|
|
|
+ js.setId(tjs.getId());
|
|
|
|
+ js.setnB3(MassageConstants.INTEGER_ZERO);
|
|
|
|
+ jsService.updateById(js);
|
|
|
|
+ log.info("取消热度技师标识,{}", js.getcOpenId() + js.getcName());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ total = page1.getTotal();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|