From 79d970ad9381065339f78e56c2286915da390e9c Mon Sep 17 00:00:00 2001 From: gaowdong Date: Fri, 25 Apr 2025 16:59:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A9=BF=E7=AB=99=E4=BB=98=E6=AC=BE=E9=80=80?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/controller/OrderInfoMobileController.java | 6 +++++- .../mobile/controller/OrderPlaceMobileController.java | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java index d05f5224..233b21c2 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java @@ -140,11 +140,15 @@ public class OrderInfoMobileController extends BaseController { notes = "驿站退款" ) public AjaxResult stageRefundMobile(@RequestHeader Map headers, - @RequestBody @Valid StageRefundParam request) { + @RequestBody StageRefundParam request) { String sign = HeaderFetchUtil.getSign(headers); if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) { return AjaxResult.error("签名失败"); } + if(request.getTradeId() == null) { + return AjaxResult.error("交易ID不能为空"); + } + UnifyRefundVO resultVO = this.orderRefundBusiness.stageRefund(request); return AjaxResult.success(resultVO); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderPlaceMobileController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderPlaceMobileController.java index 440b646a..eca1956c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderPlaceMobileController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderPlaceMobileController.java @@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.math.BigDecimal; import java.util.Map; @RestController @@ -141,11 +142,17 @@ public class OrderPlaceMobileController { notes = "驿站付款" ) public AjaxResult stageOrderPay(@RequestHeader Map headers, - @RequestBody @Valid StagePayMobileDTO stagePayDTO) { + @RequestBody StagePayMobileDTO stagePayDTO) { String sign = HeaderFetchUtil.getSign(headers); if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) { return AjaxResult.error("签名失败"); } + if(stagePayDTO.getAmount() == null) { + return AjaxResult.error("金额不能为空"); + } + if(BigDecimal.ZERO.compareTo(stagePayDTO.getAmount()) >= 0) { + return AjaxResult.error("金额必须大于0"); + } UnifyPayVO mobileVO = null; try{ long startTime = System.currentTimeMillis(); @@ -156,7 +163,7 @@ public class OrderPlaceMobileController { LogUtil.info("[驿站支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO); }catch (Exception ex) { log.error("驿站支付异常", ex); - return AjaxResult.error("支付失败", 500); + return AjaxResult.error("支付失败"); } return AjaxResult.success(mobileVO); }