判断金额问题

This commit is contained in:
Jerry Yan 2025-03-02 23:25:59 +08:00
parent e9890a3856
commit 8d329e6b05
3 changed files with 17 additions and 10 deletions

View File

@ -44,7 +44,6 @@ public class AppWxPayController {
@ApiOperation(value = "微信支付回调", notes = "微信支付回调") @ApiOperation(value = "微信支付回调", notes = "微信支付回调")
@PostMapping("/payNotify") @PostMapping("/payNotify")
@IgnoreToken @IgnoreToken
@RequestToFile
public ApiResponse<?> payNotify(HttpServletRequest request) { public ApiResponse<?> payNotify(HttpServletRequest request) {
wxPayService.payNotify(request); wxPayService.payNotify(request);
return ApiResponse.success(BizCodeEnum.REQUEST_OK); return ApiResponse.success(BizCodeEnum.REQUEST_OK);
@ -61,7 +60,6 @@ public class AppWxPayController {
@ApiOperation(value = "微信支付退款回调", notes = "微信支付退款回调") @ApiOperation(value = "微信支付退款回调", notes = "微信支付退款回调")
@PostMapping("/refundNotify") @PostMapping("/refundNotify")
@IgnoreToken @IgnoreToken
@RequestToFile
public ApiResponse<?> refundNotify(@RequestBody String refundResult) throws GeneralSecurityException, IOException { public ApiResponse<?> refundNotify(@RequestBody String refundResult) throws GeneralSecurityException, IOException {
return ApiResponse.buildResult(wxPayService.refundNotify(refundResult) ? return ApiResponse.buildResult(wxPayService.refundNotify(refundResult) ?
BizCodeEnum.SUCCESS : BizCodeEnum.SUCCESS :

View File

@ -17,6 +17,7 @@ import java.util.List;
@ApiModel("移动端订单信息响应类") @ApiModel("移动端订单信息响应类")
public class OrderAppRespVO { public class OrderAppRespVO {
private Long id; private Long id;
private Integer type;
/** /**
* 价格 * 价格
*/ */

View File

@ -163,7 +163,7 @@ public class OrderServiceImpl implements OrderService {
goodsName = "景区照片包"; goodsName = "景区照片包";
} }
} }
if (order.getPayPrice().equals(BigDecimal.ZERO)) { if (order.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
// 0元支付 // 0元支付
WxPayRespVO wxPayRespVO = new WxPayRespVO(); WxPayRespVO wxPayRespVO = new WxPayRespVO();
wxPayRespVO.setNeedPay(false); wxPayRespVO.setNeedPay(false);
@ -172,7 +172,7 @@ public class OrderServiceImpl implements OrderService {
wxPayOrderReqVO.setOpenId(order.getOpenId()) wxPayOrderReqVO.setOpenId(order.getOpenId())
.setMemberId(order.getMemberId()) .setMemberId(order.getMemberId())
.setOrderSn(order.getId()) .setOrderSn(order.getId())
.setTotalPrice(BigDecimalUtil.convertToCents(order.getPrice())) .setTotalPrice(BigDecimalUtil.convertToCents(order.getPayPrice()))
.setGoodsName(goodsName) .setGoodsName(goodsName)
.setDescription(goodsName); .setDescription(goodsName);
@ -350,9 +350,13 @@ public class OrderServiceImpl implements OrderService {
return ApiResponse.fail("订单添加失败"); return ApiResponse.fail("订单添加失败");
} }
//点击支付按钮统计 //点击支付按钮统计
if (order.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
WxPayRespVO wxPayRespVO = initiatePayment(order, orderItems); orderBiz.paidOrder(order.getId());
return ApiResponse.success(wxPayRespVO); return ApiResponse.success(new WxPayRespVO());
} else {
WxPayRespVO wxPayRespVO = initiatePayment(order, orderItems);
return ApiResponse.success(wxPayRespVO);
}
} }
@Override @Override
@ -404,9 +408,13 @@ public class OrderServiceImpl implements OrderService {
log.error("订单明细添加失败"); log.error("订单明细添加失败");
return ApiResponse.fail("订单添加失败"); return ApiResponse.fail("订单添加失败");
} }
if (order.getPayPrice().equals(BigDecimal.ZERO)) {
WxPayRespVO wxPayRespVO = initiatePayment(order, orderItems); orderBiz.paidOrder(order.getId());
return ApiResponse.success(wxPayRespVO); return ApiResponse.success(new WxPayRespVO());
} else {
WxPayRespVO wxPayRespVO = initiatePayment(order, orderItems);
return ApiResponse.success(wxPayRespVO);
}
} }
} }