|
|
@ -42,209 +42,30 @@ public class HighOrderSchedule { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighGoldRecService highGoldRecService; |
|
|
|
private HighGoldRecService highGoldRecService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsIntegralRebateService bsIntegralRebateService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsOrderRebateService bsOrderRebateService; |
|
|
|
private BsOrderRebateService bsOrderRebateService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @Author 胡锐 |
|
|
|
|
|
|
|
* @Description 取消订单 15分钟 |
|
|
|
|
|
|
|
* @Date 2021/4/4 22:45 |
|
|
|
|
|
|
|
**/ |
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
|
|
|
|
|
|
|
|
public void cancelOrder() { |
|
|
|
|
|
|
|
List<HighOrder> orderList = highOrderService.getCloseOrder(); |
|
|
|
|
|
|
|
if (orderList != null && orderList.size() > 0) { |
|
|
|
|
|
|
|
for (HighOrder order : orderList) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
highOrderService.cancelOrder(order.getId()); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponSchedule --> expiredCoupon() error!", e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @Author 胡锐 |
|
|
|
|
|
|
|
* @Description 处理话费充值订单 |
|
|
|
|
|
|
|
* @Date 2021/4/4 22:45 |
|
|
|
|
|
|
|
**/ |
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
|
|
|
|
|
|
|
|
public void handleMobileOrder() { |
|
|
|
|
|
|
|
List<HighOrder> orderList = highOrderService.getAlreadyPaidMobileOrder(); |
|
|
|
|
|
|
|
if (orderList != null && orderList.size() > 0) { |
|
|
|
|
|
|
|
for (HighOrder order : orderList) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HighOrder highOrder = highOrderService.getOrderById(order.getId()); |
|
|
|
|
|
|
|
if (highOrder != null) { |
|
|
|
|
|
|
|
JSONObject mobileOrderJson = QianZhuConfig.getMobileOrderByOrderNo(highOrder.getOrderNo()); |
|
|
|
|
|
|
|
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) { |
|
|
|
|
|
|
|
JSONObject data = mobileOrderJson.getJSONObject("data"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 订单状态 0:待付款 5:已支付 10:充值中 15:交易成功 -5:已取消 -10:充值失败
|
|
|
|
|
|
|
|
if (data.getInteger("status") == 15) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
highOrder.setOrderStatus(3); |
|
|
|
|
|
|
|
highOrder.setFinishTime(new Date()); |
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (data.getInteger("status") == -10 || data.getInteger("status") == -5) { |
|
|
|
|
|
|
|
if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) { |
|
|
|
|
|
|
|
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); |
|
|
|
|
|
|
|
if (orderRefundModel.getResult_code().equals("SUCCESS")) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
highOrder.setOrderStatus(4); |
|
|
|
|
|
|
|
//highOrder.setRefundTime(new Date());
|
|
|
|
|
|
|
|
//highOrder.setRefundPrice(highOrder.getPayRealPrice());
|
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
highOrder.setCancelTime(new Date()); |
|
|
|
|
|
|
|
highOrder.setOrderStatus(5); |
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponSchedule --> handleMobileOrder() error!", e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @Author Sum1Dream |
|
|
|
|
|
|
|
* @name handleThirdOrder.java |
|
|
|
|
|
|
|
* @Description // 处理第三方订单
|
|
|
|
|
|
|
|
* @Date 16:24 2022/7/8 |
|
|
|
|
|
|
|
* @Param [] |
|
|
|
|
|
|
|
* @return void |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
|
|
|
|
|
|
|
|
public void handleThirdOrder() { |
|
|
|
|
|
|
|
List<HighOrder> orderList = highOrderService.getThirdOrder(); |
|
|
|
|
|
|
|
// 判断是否存在订单
|
|
|
|
|
|
|
|
if (orderList != null && orderList.size() > 0) { |
|
|
|
|
|
|
|
for (HighOrder order : orderList) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HighOrder highOrder = highOrderService.getOrderById(order.getId()); |
|
|
|
|
|
|
|
if (highOrder != null) { |
|
|
|
|
|
|
|
// 肯德基订单
|
|
|
|
|
|
|
|
if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 4) { |
|
|
|
|
|
|
|
JSONObject orderObject = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo()); |
|
|
|
|
|
|
|
if (orderObject != null && orderObject.getBoolean("success")) { |
|
|
|
|
|
|
|
JSONObject data = orderObject.getJSONObject("data"); |
|
|
|
|
|
|
|
// 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
|
|
|
|
|
|
|
|
if (data.getInteger("status") == 15) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highOrder.setOrderStatus(3); |
|
|
|
|
|
|
|
highOrder.setFinishTime(new Date()); |
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 订单失败
|
|
|
|
|
|
|
|
if (data.getInteger("status") == -5) { |
|
|
|
|
|
|
|
if (highOrder.getOrderStatus() == 2) { |
|
|
|
|
|
|
|
highOrderService.thirdOrderToRefund(order.getId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
highOrderService.thirdCancelOrder(order.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 9) { |
|
|
|
|
|
|
|
// 星巴克订单
|
|
|
|
|
|
|
|
// 根据订单号查询订单详情
|
|
|
|
|
|
|
|
JSONObject orderObject = QianZhuConfig.starbucksOrderByOrderNo(highOrder.getOrderNo()); |
|
|
|
|
|
|
|
if (orderObject != null && orderObject.getBoolean("success")) { |
|
|
|
|
|
|
|
JSONObject data = orderObject.getJSONObject("data"); |
|
|
|
|
|
|
|
// 订单状态 0:待付款 5:已支付 10:出单中 15:出单成功 20:配送中 25:配送完成 -5:已取消 -10:失败
|
|
|
|
|
|
|
|
if (data.getInteger("status") == 15) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
highOrder.setOrderStatus(3); |
|
|
|
|
|
|
|
highOrder.setFinishTime(new Date()); |
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 订单失败
|
|
|
|
|
|
|
|
if (data.getInteger("status") == -5) { |
|
|
|
|
|
|
|
if (highOrder.getOrderStatus() == 2) { |
|
|
|
|
|
|
|
highOrderService.thirdOrderToRefund(order.getId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
highOrderService.thirdCancelOrder(order.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 10) { |
|
|
|
|
|
|
|
// 会员充值订单
|
|
|
|
|
|
|
|
// 根据订单号查询订单详情
|
|
|
|
|
|
|
|
JSONObject orderObject = QianZhuConfig.QueryV2(highOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderObject != null && orderObject.getLong("Code") == 999) { |
|
|
|
|
|
|
|
// 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败
|
|
|
|
|
|
|
|
if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { |
|
|
|
|
|
|
|
// 订单失败
|
|
|
|
|
|
|
|
if (order.getOrderStatus() == 2) { |
|
|
|
|
|
|
|
highOrderService.thirdOrderToRefund(order.getId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
highOrderService.thirdCancelOrder(order.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败
|
|
|
|
|
|
|
|
if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrderStatus(3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
highOrder.setOrderStatus(3); |
|
|
|
|
|
|
|
highOrder.setFinishTime(new Date()); |
|
|
|
|
|
|
|
highOrderService.updateOrder(highOrder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOrderSchedule --> handleThirdOrder() error!", e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Author 胡锐 |
|
|
|
* @Author 胡锐 |
|
|
|
* @Description 完成团油订单 超过支付时间24小时订单自动完成 |
|
|
|
* @Description 完成团油订单 超过支付时间24小时订单自动完成 |
|
|
|
* @Date 2021/4/4 22:45 |
|
|
|
* @Date 2021/4/4 22:45 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
|
|
|
|
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
|
|
|
|
public void finishGasOrder() { |
|
|
|
// public void finishGasOrder() {
|
|
|
|
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder(); |
|
|
|
// List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
|
|
|
|
if (mapList != null && mapList.size() > 0) { |
|
|
|
// if (mapList != null && mapList.size() > 0) {
|
|
|
|
for (Map<String, Object> map : mapList) { |
|
|
|
// for (Map<String, Object> map : mapList) {
|
|
|
|
HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString())); |
|
|
|
// HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString()));
|
|
|
|
if (order != null) { |
|
|
|
// if (order != null) {
|
|
|
|
order.setOrderStatus(3); |
|
|
|
// order.setOrderStatus(3);
|
|
|
|
order.setFinishTime(new Date()); |
|
|
|
// order.setFinishTime(new Date());
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
// highOrderService.updateOrderDetail(order);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Author Sum1Dream |
|
|
|
* @Author Sum1Dream |
|
|
|
* @name integralRebateOrder.java |
|
|
|
* @name integralRebateOrder.java |
|
|
|