Merge branch 'master' into 2.0-dev

* master:
  修改配置星巴克 肯德基 会员充值 话费 微信商户号
  修改配置星巴克 肯德基 会员充值 话费 微信商户号

# Conflicts:
#	hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
#	hai-cweb/src/main/java/com/cweb/controller/pay/ThirdOrderController.java
dev-discount
袁野 2 years ago
parent bc015c00c2
commit a4f1ba2e4b
  1. 36
      hai-order/src/main/java/com/web/controller/business/OrderTelChargeCallbackController.java
  2. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  3. 4
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  4. 15
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -9,7 +9,10 @@ import com.hai.config.WxMsgConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.enum_type.RechargePayType;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildStatus;
import com.hai.service.*;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
import io.swagger.annotations.Api;
@ -47,6 +50,12 @@ public class OrderTelChargeCallbackController {
@Resource
private ApiOrderRecordService apiOrderRecordService;
@Resource
private HighOrderService highOrderService;
@Resource
private OrderService orderService;
@RequestMapping(value = "/rechargeCallbackByJj", method = RequestMethod.POST)
@ApiOperation(value = "尖椒充值回调")
@ -90,6 +99,7 @@ public class OrderTelChargeCallbackController {
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
orderFinish(rechargeOrder);
// api商户订单
if (rechargeOrder.getPayType() == 6) {
@ -153,6 +163,7 @@ public class OrderTelChargeCallbackController {
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
orderFinish(rechargeOrder);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
@ -176,7 +187,7 @@ public class OrderTelChargeCallbackController {
// 101:充值成功 102: 充值中 103:充值失败 104 未充值
// 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (childOrder.getStatus() == 102 && rechargeOrder.getPayStatus() == 102) {
if (childOrder.getStatus() == 102 && rechargeOrder.getPayStatus() == 102) {
Date rechargeTime = rechargeOrder.getCreateTimed();
Date currentTime = new Date();
@ -194,13 +205,7 @@ public class OrderTelChargeCallbackController {
return;
}
rechargeOrder.setRechargeStatus(203);
childOrder.setStatus(103);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
outRechargeOrderService.rechargeOrderToRefund(rechargeOrder.getId());
outRechargeOrderService.refundOrder(rechargeOrder.getId() , childOrder);
// 发送充值失败 微信小程序服务通知
new Thread(() -> {
@ -215,6 +220,21 @@ public class OrderTelChargeCallbackController {
}
// 订单完成操作
private void orderFinish(OutRechargeOrder rechargeOrder) {
HighOrder highOrder = highOrderService.getOrderByOrderNo(rechargeOrder.getOrderNo());
if (highOrder != null) {
highOrder.setOrderStatus(OrderStatusEnum.type3.getType());
highOrder.setFinishTime(new Date());
for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) {
highChildOrder.setChildOrderStatus(OrderChildStatus.STATUS3.getNumber());
highChildOrder.setFinishTime(new Date());
}
orderService.updateOrderData(highOrder);
}
}
private void apiOrderRecord(OutRechargeOrder rechargeOrder) {
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("orderId" , rechargeOrder.getId());

@ -540,7 +540,7 @@ public class OrderServiceImpl implements OrderService {
, OrderPayType.getDataByType(order.getPayType())
, order.getPayRealPrice()
, order.getPayGold());
if (refundPrice.getRefundSuccess() == false) {
if (!refundPrice.getRefundSuccess()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试");
}

@ -158,12 +158,12 @@ public interface OutRechargeOrderService {
/**
* @Author Sum1Dream
* @Name refundOrder
* @Description //TODO
* @Description // 话费退款
* @Date 15:18 2022/11/2
* @Param [orderId]
* @Return void
*/
void refundOrder(Long orderId) throws Exception;
void refundOrder(Long orderId , OutRechargeChildOrder childOrder) throws Exception;
/**
* @Author Sum1Dream

@ -811,7 +811,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
@Override
public void refundOrder(Long orderId) throws Exception {
@Transactional(
propagation= Propagation.REQUIRES_NEW,
isolation = Isolation.READ_COMMITTED,
timeout = 10,
rollbackFor = Exception.class)
public void refundOrder(Long orderId , OutRechargeChildOrder childOrder) throws Exception {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
// 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
@ -820,8 +825,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
// 充值状态:201:充值中 202:充值成功 203:充值失败 204:未充值
if (outRechargeOrder.getRechargeStatus() == 201) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单处于充值中状态");
if (outRechargeOrder.getRechargeStatus() == 202) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单已充值成功无法退款z");
}
HighOrder highOrder = highOrderService.getOrderByOrderNo(outRechargeOrder.getOrderNo());
@ -832,6 +837,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
outRechargeOrder.setRechargeStatus(203);
outRechargeOrder.setRefundTime(new Date());
outRechargeOrderService.updateOrder(outRechargeOrder);
// 子订单修改状态
childOrder.setStatus(103);
outRechargeChildOrderService.updateOrder(childOrder);
}
public String doRefundRequest(String mchId, String data) throws Exception {

Loading…
Cancel
Save