|
@@ -1,83 +0,0 @@
|
|
|
-package com.bosshand.virgo.api.workark.task;
|
|
|
-
|
|
|
-import com.bosshand.virgo.api.workark.model.OrderInfo;
|
|
|
-import com.bosshand.virgo.api.workark.model.RefundInfo;
|
|
|
-import com.bosshand.virgo.api.workark.service.OrderInfoService;
|
|
|
-import com.bosshand.virgo.api.workark.service.RefundInfoService;
|
|
|
-import com.bosshand.virgo.api.workark.service.WxPayService;
|
|
|
-import org.apache.commons.logging.Log;
|
|
|
-import org.apache.commons.logging.LogFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-@Component
|
|
|
-public class WxPayTask {
|
|
|
-
|
|
|
- private final static Log log = LogFactory.getLog(WxPayTask.class);
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private OrderInfoService orderInfoService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WxPayService wxPayService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RefundInfoService refundInfoService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 秒 分 时 日 月 周
|
|
|
- * 以秒为例
|
|
|
- * *:每秒都执行
|
|
|
- * 1-3:从第1秒开始执行,到第3秒结束执行
|
|
|
- * 0/3:从第0秒开始,每隔3秒执行1次
|
|
|
- * 1,2,3:在指定的第1、2、3秒执行
|
|
|
- * ?:不指定
|
|
|
- * 日和周不能同时制定,指定其中之一,则另一个设置为?
|
|
|
- */
|
|
|
- //@Scheduled(cron = "0/3 * * * * ?")
|
|
|
- public void task1(){
|
|
|
- log.info("task1 被执行......");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 从第0秒开始每隔30秒执行1次,查询到二维码过期时间,并且未支付的订单
|
|
|
- */
|
|
|
- @Scheduled(cron = "0/30 * * * * ?")
|
|
|
- public void orderConfirm() throws Exception {
|
|
|
- log.info("orderConfirm 被执行......");
|
|
|
-
|
|
|
- List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration();
|
|
|
-
|
|
|
- for (OrderInfo orderInfo : orderInfoList) {
|
|
|
- String orderNo = orderInfo.getOrderNo();
|
|
|
- log.warn("超时订单 ===>"+orderNo);
|
|
|
-
|
|
|
- //核实订单状态:调用微信支付查单接口
|
|
|
- wxPayService.checkOrderClosed(orderNo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 从第0秒开始每隔30秒执行1次,查询创建超过5分钟,并且未成功的退款单
|
|
|
- */
|
|
|
- //@Scheduled(cron = "0/30 * * * * ?")
|
|
|
- public void refundConfirm() throws Exception {
|
|
|
- log.info("refundConfirm 被执行......");
|
|
|
-
|
|
|
- //找出申请退款超过5分钟并且未成功的退款单
|
|
|
- List<RefundInfo> refundInfoList = refundInfoService.getNoRefundOrderByDuration(1);
|
|
|
-
|
|
|
- for (RefundInfo refundInfo : refundInfoList) {
|
|
|
- String refundNo = refundInfo.getRefundNo();
|
|
|
- log.warn("超时未退款的退款单号 ===>"+ refundNo);
|
|
|
-
|
|
|
- //核实订单状态:调用微信支付查询退款接口
|
|
|
- wxPayService.checkRefundStatus(refundNo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|