package com.yeshi.fanli.job.order;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg;
|
import com.yeshi.fanli.entity.order.CommonOrder;
|
import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
import com.yeshi.fanli.util.Constant;
|
import com.yeshi.fanli.util.StringUtil;
|
import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @author hxh
|
* @title: UpdateOrderJob
|
* @description: 订单更新任务
|
* @date 2023/1/11 10:52
|
*/
|
@Component
|
public class UpdateCommonOrderJob {
|
|
@Resource
|
private CommonOrderService commonOrderService;
|
|
@XxlJob("order-update-pay-state")
|
public ReturnT<String> updatePayState(String param) throws Exception {
|
//更新20-25天之前的未处理订单
|
List<CommonOrder> resultList = null;
|
if (!StringUtil.isNullOrEmpty(param)) {
|
if (param.length() > 1) {
|
resultList = commonOrderService.getByOrderNo(null, param);
|
} else {
|
resultList = commonOrderService.listPayStateOrder(Integer.parseInt(param), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 25), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 10), 1, 500);
|
}
|
} else {
|
resultList = commonOrderService.listPayStateOrder(null, new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 25), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 20), 1, 500);
|
}
|
for (CommonOrder co : resultList) {
|
OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(co.getOrderNo(), co.getSourceType()));
|
}
|
return ReturnT.SUCCESS;
|
}
|
}
|