|
|
@ -45,28 +45,6 @@ public class HighRechargeOrderSchedule { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private OrderService orderService; |
|
|
|
private OrderService orderService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return void |
|
|
|
|
|
|
|
* @Author Sum1Dream |
|
|
|
|
|
|
|
* @name cancelMobileOrder.java |
|
|
|
|
|
|
|
* @Description // 取消话费订单
|
|
|
|
|
|
|
|
* @Date 3:33 下午 2021/12/10 |
|
|
|
|
|
|
|
* @Param [] |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每15分钟执行一次
|
|
|
|
|
|
|
|
public void cancelMobileOrder() { |
|
|
|
|
|
|
|
List<OutRechargeOrder> orderList = outRechargeOrderService.getOutRechargeOrderList(); |
|
|
|
|
|
|
|
if (orderList != null && orderList.size() > 0) { |
|
|
|
|
|
|
|
for (OutRechargeOrder order : orderList) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
outRechargeOrderService.cancelOrder(order.getId()); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponSchedule --> expiredCoupon() error!", e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @return void |
|
|
|
* @Author Sum1Dream |
|
|
|
* @Author Sum1Dream |
|
|
@ -75,7 +53,7 @@ public class HighRechargeOrderSchedule { |
|
|
|
* @Date 14:18 2022/5/31 |
|
|
|
* @Date 14:18 2022/5/31 |
|
|
|
* @Param [] |
|
|
|
* @Param [] |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次
|
|
|
|
@Scheduled(cron = "0 0/5 * * * ?") //每5分钟执行一次
|
|
|
|
public void initRechargeOrder() { |
|
|
|
public void initRechargeOrder() { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("payStatus", String.valueOf(102)); |
|
|
|
map.put("payStatus", String.valueOf(102)); |
|
|
@ -104,7 +82,7 @@ public class HighRechargeOrderSchedule { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println("话费定时任务 -> 退款任务" + order.getId()); |
|
|
|
System.out.println("话费定时任务 -> 退款任务" + order.getId()); |
|
|
|
outRechargeOrderService.rechargeOrderToRefund(order.getId()); |
|
|
|
outRechargeOrderService.refundOrder(order.getId() , childOrderList.get(0)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -115,78 +93,90 @@ public class HighRechargeOrderSchedule { |
|
|
|
System.out.println("话费定时任务 -> 结束任务"); |
|
|
|
System.out.println("话费定时任务 -> 结束任务"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ?") //每10分钟执行一次
|
|
|
|
@Scheduled(cron = "0 0/30 * * * ?") //每30分钟执行一次
|
|
|
|
public void failRechargeOrder() throws Exception { |
|
|
|
public void failRechargeOrder() { |
|
|
|
List<HighOrder> highOrders = orderService.phoneErrorOrder(); |
|
|
|
List<HighOrder> highOrders = orderService.phoneErrorOrder(); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject object; |
|
|
|
JSONObject object; |
|
|
|
|
|
|
|
|
|
|
|
for (HighOrder order: highOrders) { |
|
|
|
for (HighOrder order: highOrders) { |
|
|
|
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(order.getOrderNo()); |
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
|
|
|
|
if (outRechargeOrder.getPayStatus() == 102 && outRechargeOrder.getRechargeStatus() != 202) { |
|
|
|
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(order.getOrderNo()); |
|
|
|
|
|
|
|
|
|
|
|
if (outRechargeOrder.getOutRechargeChildOrders().size() == 0) { |
|
|
|
OutRechargeChildOrder childOrder = outRechargeOrder.getOutRechargeChildOrders().get(0); |
|
|
|
|
|
|
|
|
|
|
|
OutRechargeChildOrder outRechargeChildOrder = new OutRechargeChildOrder(); |
|
|
|
if (outRechargeOrder.getPayStatus() == 102 && outRechargeOrder.getRechargeStatus() != 202) { |
|
|
|
|
|
|
|
|
|
|
|
outRechargeChildOrder.setOrderNo("CZ" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); |
|
|
|
if (outRechargeOrder.getOutRechargeChildOrders().size() == 0) { |
|
|
|
outRechargeChildOrder.setParentOrderId(outRechargeOrder.getId()); |
|
|
|
|
|
|
|
outRechargeChildOrder.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
outRechargeChildOrder.setCreateTime(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeChildOrder); |
|
|
|
OutRechargeChildOrder outRechargeChildOrder = new OutRechargeChildOrder(); |
|
|
|
} else { |
|
|
|
|
|
|
|
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getStatus() != 101) { |
|
|
|
|
|
|
|
// 龙阅
|
|
|
|
|
|
|
|
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getRechargePlatform() == 2) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.put("out_trade_nums" , outRechargeOrder.getOutRechargeChildOrders().get(0).getOrderNo()); |
|
|
|
outRechargeChildOrder.setOrderNo("CZ" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); |
|
|
|
|
|
|
|
outRechargeChildOrder.setParentOrderId(outRechargeOrder.getId()); |
|
|
|
|
|
|
|
outRechargeChildOrder.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
outRechargeChildOrder.setCreateTime(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = RechargeConfig.checkOrderByLy(object); |
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeChildOrder); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (childOrder.getStatus() != 101) { |
|
|
|
|
|
|
|
// 龙阅
|
|
|
|
|
|
|
|
if (childOrder.getRechargePlatform() == 2) { |
|
|
|
|
|
|
|
|
|
|
|
JSONArray objectJSONArray = jsonObject.getJSONArray("data"); |
|
|
|
object.put("out_trade_nums" , childOrder.getOrderNo()); |
|
|
|
JSONObject objectData = new JSONObject(); |
|
|
|
|
|
|
|
for (Object objects : objectJSONArray) { |
|
|
|
JSONObject jsonObject = RechargeConfig.checkOrderByLy(object); |
|
|
|
objectData = (JSONObject) objects; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (objectData.size() == 0) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
|
|
|
|
|
|
|
|
if (!(objectData.getInteger("state") == 1 || objectData.getInteger("state") == 0 || objectData.getInteger("state") == 3)) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 嗨购
|
|
|
|
|
|
|
|
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getRechargePlatform() == 4) { |
|
|
|
|
|
|
|
object.put("orderid" , outRechargeOrder.getOutRechargeChildOrders().get(0).getOrderNo()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); |
|
|
|
|
|
|
|
if (jsonObject.getJSONArray("data") == null) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
JSONArray objectJSONArray = jsonObject.getJSONArray("data"); |
|
|
|
JSONArray objectJSONArray = jsonObject.getJSONArray("data"); |
|
|
|
JSONObject objectData; |
|
|
|
JSONObject objectData = new JSONObject(); |
|
|
|
for (Object objects : objectJSONArray) { |
|
|
|
for (Object objects : objectJSONArray) { |
|
|
|
objectData = (JSONObject) objects; |
|
|
|
objectData = (JSONObject) objects; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (objectData.size() == 0) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder); |
|
|
|
|
|
|
|
} else { |
|
|
|
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
|
|
|
|
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
|
|
|
|
if (!(objectData.getInteger("status") == 1 || objectData.getInteger("status") == 0 || objectData.getInteger("status") == 4)) { |
|
|
|
if (objectData.getInteger("state") == 2) { |
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0)); |
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder); |
|
|
|
|
|
|
|
} else if (objectData.getInteger("state") == 1) { |
|
|
|
|
|
|
|
outRechargeOrderService.completeOrder(outRechargeOrder , childOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 嗨购
|
|
|
|
|
|
|
|
if (childOrder.getRechargePlatform() == 4) { |
|
|
|
|
|
|
|
object.put("orderid" , childOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); |
|
|
|
|
|
|
|
if (jsonObject.getJSONArray("data") == null) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
JSONArray objectJSONArray = jsonObject.getJSONArray("data"); |
|
|
|
|
|
|
|
JSONObject objectData; |
|
|
|
|
|
|
|
for (Object objects : objectJSONArray) { |
|
|
|
|
|
|
|
objectData = (JSONObject) objects; |
|
|
|
|
|
|
|
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
|
|
|
|
|
|
|
|
if (objectData.getInteger("status") == 2) { |
|
|
|
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder); |
|
|
|
|
|
|
|
} else if (objectData.getInteger("status") == 1) { |
|
|
|
|
|
|
|
outRechargeOrderService.completeOrder(outRechargeOrder , childOrder); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponSchedule --> expiredCoupon() error!", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|