| @@ -6,11 +6,13 @@ import com.iformall.domain.po.WxOrderGroup; | |||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.enums.EnumOrderType; | import com.iformall.enums.EnumOrderType; | ||||
| import com.iformall.enums.EnumRefundStatus; | |||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.mapper.WxOrderGroupMapper; | import com.iformall.mapper.WxOrderGroupMapper; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| import com.iformall.service.WxOrderGroupService; | import com.iformall.service.WxOrderGroupService; | ||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import com.iformall.service.WxRefundOrderService; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -46,7 +48,7 @@ public class OrderExpiringSchedule { | |||||
| WxAppinfoMapper wxAppinfoMapper; | WxAppinfoMapper wxAppinfoMapper; | ||||
| @Autowired | @Autowired | ||||
| com.iformall.service.WxRefundOrderService WxRefundOrderService; | |||||
| WxRefundOrderService wxRefundOrderService; | |||||
| @Scheduled(cron = "0 */5 * * * *?") // 每5分钟检查一次 | @Scheduled(cron = "0 */5 * * * *?") // 每5分钟检查一次 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| @@ -147,7 +149,10 @@ public class OrderExpiringSchedule { | |||||
| appinfo.setType(EnumAppType.C.getCode()); | appinfo.setType(EnumAppType.C.getCode()); | ||||
| appinfo = wxAppinfoMapper.findList(appinfo).get(0); | appinfo = wxAppinfoMapper.findList(appinfo).get(0); | ||||
| //退款流程 | //退款流程 | ||||
| WxRefundOrderService.returnMoney(appinfo, order.getId()); | |||||
| boolean has = wxRefundOrderService.hasRefundOrder(order.getId(), EnumRefundStatus.REFUND_SUCCESS.getCode()); | |||||
| if (!has) { | |||||
| wxRefundOrderService.returnMoney(appinfo, order.getId()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -99,4 +99,6 @@ public interface WxRefundOrderService { | |||||
| ResultData returnMoney(WxAppinfo appInfo, Long orderId); | ResultData returnMoney(WxAppinfo appInfo, Long orderId); | ||||
| boolean hasRefundOrder(Long orderId, Integer status); | |||||
| } | } | ||||
| @@ -11,6 +11,7 @@ import com.iformall.domain.vo.WxOrderGroupMarketing; | |||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.enums.EnumCouponStatus; | import com.iformall.enums.EnumCouponStatus; | ||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.enums.EnumRefundStatus; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxOrderGroupService; | import com.iformall.service.WxOrderGroupService; | ||||
| @@ -57,7 +58,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| WxAppinfoMapper wxAppinfoMapper; | WxAppinfoMapper wxAppinfoMapper; | ||||
| @Autowired | @Autowired | ||||
| WxRefundOrderService WxRefundOrderService; | |||||
| WxRefundOrderService wxRefundOrderService; | |||||
| @Autowired | @Autowired | ||||
| RedisLock redisLock; | RedisLock redisLock; | ||||
| @@ -317,9 +318,12 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| for (WxOrder temp : list) { | for (WxOrder temp : list) { | ||||
| if (temp.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()) | if (temp.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()) | ||||
| || temp.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode())) { | || temp.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode())) { | ||||
| //去库存 | |||||
| wxOrderService.stockBack(temp); | |||||
| WxRefundOrderService.returnMoney(appinfo, temp.getId()); | |||||
| boolean has = wxRefundOrderService.hasRefundOrder(order.getId(), EnumRefundStatus.REFUND_SUCCESS.getCode()); | |||||
| if (!has) { | |||||
| //去库存 | |||||
| wxOrderService.stockBack(temp); | |||||
| wxRefundOrderService.returnMoney(appinfo, temp.getId()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1568,4 +1568,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public boolean hasRefundOrder(Long orderId, Integer status) { | |||||
| WxRefundOrder order = new WxRefundOrder(); | |||||
| order.setOrderId(orderId); | |||||
| order.setRefundOrderStatus(status); | |||||
| return wxRefundOrderMapper.selectCount(order) > 0 ? true : false; | |||||
| } | |||||
| } | } | ||||