|
|
|
@@ -3,16 +3,17 @@ package com.simple.schedule; |
|
|
|
import com.simple.common.ErrorCode; |
|
|
|
import com.simple.common.ResultData; |
|
|
|
import com.simple.config.PayProperty; |
|
|
|
import com.simple.domain.po.WxAppinfo; |
|
|
|
import com.simple.domain.po.WxCouponOrder; |
|
|
|
import com.simple.domain.po.WxMerchantBUser; |
|
|
|
import com.simple.domain.po.*; |
|
|
|
import com.simple.domain.vo.WxCouponOrderCVo; |
|
|
|
import com.simple.enums.EnumAppType; |
|
|
|
import com.simple.enums.EnumPayStatus; |
|
|
|
import com.simple.enums.EnumPayWay; |
|
|
|
import com.simple.enums.EnumRefundWay; |
|
|
|
import com.simple.exception.MallinkException; |
|
|
|
import com.simple.mapper.WxCouponChannelMapper; |
|
|
|
import com.simple.mapper.WxCouponMapper; |
|
|
|
import com.simple.mapper.WxCouponOrderMapper; |
|
|
|
import com.simple.mapper.WxMallMapper; |
|
|
|
import com.simple.mapper.*; |
|
|
|
import com.simple.service.WxAppinfoService; |
|
|
|
import com.simple.service.WxPayOrderService; |
|
|
|
import com.simple.service.WxRefundOrderService; |
|
|
|
import org.apache.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
@@ -34,6 +35,15 @@ public class CouponOrderExpiringSchedule { |
|
|
|
@Autowired |
|
|
|
private PayProperty payProperty; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxRefundOrderService wxRefundOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxPayOrderService wxPayOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxAppinfoMapper wxAppinfoMapper; |
|
|
|
|
|
|
|
@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 |
|
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
@@ -43,11 +53,24 @@ public class CouponOrderExpiringSchedule { |
|
|
|
|
|
|
|
@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 |
|
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public void couponOrderRefundSchedule() { |
|
|
|
|
|
|
|
List<WxCouponOrder> list = wxCouponOrderMapper.findExpiredCouponOrderByValidDate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(WxCouponOrder co:list) { |
|
|
|
|
|
|
|
WxAppinfo appinfo = new WxAppinfo(); |
|
|
|
appinfo.setTenantId(co.getOrderId().toString()); |
|
|
|
appinfo.setType(EnumAppType.B.getCode()); |
|
|
|
appinfo = wxAppinfoMapper.findList(appinfo).get(0); |
|
|
|
|
|
|
|
try { |
|
|
|
wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, co.getId(), EnumRefundWay.AUTO, null); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |