修改查询订单状态封装
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.hutool.core.io.IoUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.PayCst;
|
||||
import com.czg.PolyPayUtils;
|
||||
import com.czg.constant.PayChannelCst;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.dto.req.WechatNotifyReqDto;
|
||||
import com.czg.dto.req.WechatPayNotifyDataDto;
|
||||
@@ -77,7 +78,7 @@ public class NotifyController {
|
||||
|
||||
WechatPayNotifyDataDto dataDto = JSONObject.parseObject(decrypted, WechatPayNotifyDataDto.class);
|
||||
PayNotifyRespDTO respDTO = dataDto.convertToPayNotifyRespDTO();
|
||||
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, 0);
|
||||
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, PayChannelCst.NATIVE, 0);
|
||||
return "success";
|
||||
} else if (PayCst.Platform.ALIPAY.equalsIgnoreCase(platform)) {
|
||||
// 支付宝
|
||||
@@ -112,7 +113,7 @@ public class NotifyController {
|
||||
PayNotifyRespDTO respDTO = PolyPayUtils.getNotifyResp(respParams);
|
||||
AssertUtil.isNull(respDTO, "支付回调数据为空");
|
||||
log.info("支付回调数据为:{}", respDTO);
|
||||
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, 0);
|
||||
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, PayChannelCst.POLY, 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.czg.controller.pay;
|
||||
|
||||
import com.czg.annotation.Debounce;
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.pay.QueryOrderRespDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.order.dto.VipMemberPayParamDTO;
|
||||
import com.czg.service.order.dto.VipPayParamDTO;
|
||||
@@ -10,6 +12,7 @@ import com.czg.service.order.service.PayService;
|
||||
import com.czg.service.order.service.ShopUserPayService;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.ServletUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -32,6 +35,9 @@ public class VipPayController {
|
||||
@Resource
|
||||
private ShopUserPayService shopUserPayService;
|
||||
|
||||
@Resource
|
||||
private OrderPaymentService orderPaymentService;
|
||||
|
||||
/**
|
||||
* 现金充值
|
||||
* 如果shop_info的 is_member_in_pwd=1 则pwd必填 店铺操作密码
|
||||
@@ -168,10 +174,16 @@ public class VipPayController {
|
||||
public CzgResult<String> queryOrderStatus(Long shopId, String payOrderNo) {
|
||||
AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||
AssertUtil.isBlank(payOrderNo, "支付单号不能为空");
|
||||
|
||||
OrderPayment payment = orderPaymentService.getOne(QueryWrapper.create().eq(OrderPayment::getOrderNo, payOrderNo));
|
||||
if (payment == null) {
|
||||
return CzgResult.failure("支付单号不存在");
|
||||
}
|
||||
|
||||
CzgResult<String> result = CzgResult.success();
|
||||
CzgResult<CzgBaseResp> queryPayOrder = payService.queryPayOrder(shopId, null, payOrderNo);
|
||||
if (queryPayOrder.getCode() == 200 && queryPayOrder.getData() != null) {
|
||||
String state = queryPayOrder.getData().getState();
|
||||
CzgResult<QueryOrderRespDTO> queryPayOrder = payService.queryPayOrder(shopId, null, payOrderNo, payment.getPlatformType());
|
||||
if (queryPayOrder.isSuccess() && queryPayOrder.getData() != null) {
|
||||
String state = queryPayOrder.getData().getStatus();
|
||||
result.setData(state);
|
||||
switch (state) {
|
||||
case "TRADE_AWAIT" -> result.setMsg("等待用户付款");
|
||||
|
||||
Reference in New Issue
Block a user