Merge branch '2.0-dev' into 2.0-master

dev-discount
胡锐 2 years ago
commit 2d1cfdbb1b
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 7
      hai-order/src/main/java/com/web/controller/business/OrderTelChargeCallbackController.java
  3. 2
      hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java
  4. 2
      hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java
  5. 207
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  6. 64
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java
  7. 10
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  8. 13
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

File diff suppressed because one or more lines are too long

@ -164,9 +164,10 @@ public class OrderTelChargeCallbackController {
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
orderFinish(rechargeOrder);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
// todo 代理商话费回调
// if (rechargeOrder.getPayType() == 6) {
// apiOrderRecord(rechargeOrder);
// }
} else {
callbackResult(childOrder , rechargeOrder);
}

@ -26,7 +26,7 @@ public class ApiThirdProductSchedule {
private ApiProductService apiProductService;
@Scheduled(cron="0 0/1 * * * ?") //每10分钟执行一次
@Scheduled(cron="0 0/30 * * * ?") //每30分钟执行一次
public void getStarbucksProducts() throws Exception {
JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200);

@ -30,7 +30,7 @@ public class HighIntegralSchedule {
@Resource
private HighUserService highUserService;
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次
public void integralRebateOrder() {
List<HighGoldRec> list = highGoldRecService.selectByExpiringSoonByAll(365);

@ -42,209 +42,30 @@ public class HighOrderSchedule {
@Resource
private HighGoldRecService highGoldRecService;
@Resource
private BsIntegralRebateService bsIntegralRebateService;
@Resource
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 胡锐
* @Description 完成团油订单 超过支付时间24小时订单自动完成
* @Date 2021/4/4 22:45
**/
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
public void finishGasOrder() {
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
if (mapList != null && mapList.size() > 0) {
for (Map<String, Object> map : mapList) {
HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString()));
if (order != null) {
order.setOrderStatus(3);
order.setFinishTime(new Date());
highOrderService.updateOrderDetail(order);
}
}
}
}
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
// public void finishGasOrder() {
// List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
// if (mapList != null && mapList.size() > 0) {
// for (Map<String, Object> map : mapList) {
// HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString()));
// if (order != null) {
// order.setOrderStatus(3);
// order.setFinishTime(new Date());
// highOrderService.updateOrderDetail(order);
// }
// }
// }
// }
/**
* @Author Sum1Dream
* @name integralRebateOrder.java

@ -45,28 +45,6 @@ public class HighRechargeOrderSchedule {
@Resource
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
* @Author Sum1Dream
@ -75,7 +53,7 @@ public class HighRechargeOrderSchedule {
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次
@Scheduled(cron = "0 0/5 * * * ?") //每5分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102));
@ -104,7 +82,7 @@ public class HighRechargeOrderSchedule {
continue;
}
System.out.println("话费定时任务 -> 退款任务" + order.getId());
outRechargeOrderService.rechargeOrderToRefund(order.getId());
outRechargeOrderService.refundOrder(order.getId() , childOrderList.get(0));
}
} catch (Exception e) {
@ -115,18 +93,22 @@ public class HighRechargeOrderSchedule {
System.out.println("话费定时任务 -> 结束任务");
}
@Scheduled(cron = "0 0/10 * * * ?") //每10分钟执行一次
public void failRechargeOrder() throws Exception {
@Scheduled(cron = "0 0/30 * * * ?") //每30分钟执行一次
public void failRechargeOrder() {
List<HighOrder> highOrders = orderService.phoneErrorOrder();
JSONObject object;
for (HighOrder order: highOrders) {
try {
object = new JSONObject();
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(order.getOrderNo());
OutRechargeChildOrder childOrder = outRechargeOrder.getOutRechargeChildOrders().get(0);
if (outRechargeOrder.getPayStatus() == 102 && outRechargeOrder.getRechargeStatus() != 202) {
if (outRechargeOrder.getOutRechargeChildOrders().size() == 0) {
@ -140,11 +122,11 @@ public class HighRechargeOrderSchedule {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeChildOrder);
} else {
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getStatus() != 101) {
if (childOrder.getStatus() != 101) {
// 龙阅
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getRechargePlatform() == 2) {
if (childOrder.getRechargePlatform() == 2) {
object.put("out_trade_nums" , outRechargeOrder.getOutRechargeChildOrders().get(0).getOrderNo());
object.put("out_trade_nums" , childOrder.getOrderNo());
JSONObject jsonObject = RechargeConfig.checkOrderByLy(object);
@ -154,30 +136,34 @@ public class HighRechargeOrderSchedule {
objectData = (JSONObject) objects;
}
if (objectData.size() == 0) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0));
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder);
} 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 (objectData.getInteger("state") == 2) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder);
} else if (objectData.getInteger("state") == 1) {
outRechargeOrderService.completeOrder(outRechargeOrder , childOrder);
}
}
}
// 嗨购
if (outRechargeOrder.getOutRechargeChildOrders().get(0).getRechargePlatform() == 4) {
object.put("orderid" , outRechargeOrder.getOutRechargeChildOrders().get(0).getOrderNo());
if (childOrder.getRechargePlatform() == 4) {
object.put("orderid" , childOrder.getOrderNo());
JSONObject jsonObject = RechargeConfig.checkOrderByHg(object);
if (jsonObject.getJSONArray("data") == null) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0));
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") == 1 || objectData.getInteger("status") == 0 || objectData.getInteger("status") == 4)) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , outRechargeOrder.getOutRechargeChildOrders().get(0));
if (objectData.getInteger("status") == 2) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId() , childOrder);
} else if (objectData.getInteger("status") == 1) {
outRechargeOrderService.completeOrder(outRechargeOrder , childOrder);
}
}
}
@ -186,6 +172,10 @@ public class HighRechargeOrderSchedule {
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}

@ -175,6 +175,16 @@ public interface OutRechargeOrderService {
*/
void pollRequest(OutRechargeOrder outRechargeOrder) throws Exception;
/**
* @Author Sum1Dream
* @Name completeOrder
* @Description // 完成话费订单
* @Date 14:58 2023/2/13
* @Param [order, childOrder]
* @Return void
*/
void completeOrder(OutRechargeOrder order , OutRechargeChildOrder childOrder);
/**
* @Author Sum1Dream
* @name rechargeOrderNum.java

@ -814,7 +814,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Transactional(
propagation= Propagation.REQUIRES_NEW,
isolation = Isolation.READ_COMMITTED,
timeout = 10,
timeout = 25,
rollbackFor = Exception.class)
public void refundOrder(Long orderId , OutRechargeChildOrder childOrder) throws Exception {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
@ -1037,6 +1037,17 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
outRechargeOrderService.updateOrder(outRechargeOrder);
}
@Override
public void completeOrder(OutRechargeOrder order, OutRechargeChildOrder childOrder) {
childOrder.setStatus(101);
order.setRechargeStatus(202);
order.setPayStatus(100);
order.setFinishTime(new Date());
outRechargeOrderService.updateOrder(order);
outRechargeChildOrderService.updateOrder(childOrder);
}
@Override
public Integer rechargeOrderNum(Long userId) {
OutRechargeOrderExample example = new OutRechargeOrderExample();

Loading…
Cancel
Save