|
|
@@ -34,6 +34,9 @@ import com.ylx.massage.enums.BillTypeEnum;
|
|
|
import com.ylx.massage.service.RefundVoucherService;
|
|
|
import com.ylx.massage.service.TRechargeService;
|
|
|
import com.ylx.massage.service.TWxUserService;
|
|
|
+import com.ylx.order.domain.TOrder;
|
|
|
+import com.ylx.order.enums.OrderStatusEnum;
|
|
|
+import com.ylx.order.service.TOrderService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -75,6 +78,8 @@ public class PayController {
|
|
|
private WxPayService wxPayService;
|
|
|
@Resource
|
|
|
private IGiftCardOrderService giftCardOrderService;
|
|
|
+ @Resource
|
|
|
+ private TOrderService orderService;
|
|
|
|
|
|
/**
|
|
|
* 小程序微信支付的第一步,统一下单
|
|
|
@@ -229,6 +234,28 @@ public class PayController {
|
|
|
this.giftCardOrderService.processGiftCardPayment(result, wxUser, cardOrder);
|
|
|
} else if (WxPayTypeEnum.EMOTION_GOODS.getCode().equals(attach)) {
|
|
|
log.info("检测到情感服务商品支付成功,订单号: {}", outTradeNo);
|
|
|
+
|
|
|
+ // 3.1 更新订单支付状态
|
|
|
+ LambdaQueryWrapper<TOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(TOrder::getOrderNo, outTradeNo);
|
|
|
+ TOrder order = this.orderService.getOne(wrapper);
|
|
|
+ if (ObjectUtil.isNull(order)) {
|
|
|
+ log.error("订单不存在,订单号: {}", outTradeNo);
|
|
|
+ resp.put("code", "FAIL");
|
|
|
+ resp.put("message", "订单不存在");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ // 3.2 检查是否已处理
|
|
|
+ if (ObjectUtil.equals(OrderStatusEnum.PENDING_DISPATCH.getCode(), order.getStatus())) {
|
|
|
+ log.warn("订单已处理过:{}", outTradeNo);
|
|
|
+ resp.put("code", "SUCCESS");
|
|
|
+ resp.put("message", "OK");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.3 处理订单相关数据
|
|
|
+ this.orderService.processOrderPayment(result, wxUser, order);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|