嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java

78 lines
2.4 KiB

package com.hai.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.config.RechargeConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeChildOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.order.service.OrderService;
import com.hai.service.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @serviceName HighRechargeOrderSchedule.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 充值订单定时任务
* @createTime 09:57 2023/1/13
**/
@Configuration
public class HighRechargeOrderSchedule {
private static final Logger log = LoggerFactory.getLogger(OutRechargeOrderServiceImpl.class);
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService rechargeChildOrderService;
@Resource
private OrderService orderService;
/**
* @return void
* @Author Sum1Dream
* @name cancelOrder.java
* @Description // 定时发起
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/120 * * * ?") //每120分钟执行一次
public void initRechargeOrder() {
log.info("处理话费订单定时任务开始");
Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102));
map.put("rechargeStatus", String.valueOf(201));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
log.info("处理话费订单条数:" + orderList.size());
if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
outRechargeOrderService.prepaidRechargeHandle(order);
} catch (Exception e) {
log.info("话费定时任务订单业务出现异常", e);
}
}
}
}
}