From 31fc69c7d7db18d922041e197eafbb577b82fc6a Mon Sep 17 00:00:00 2001 From: gaowdong Date: Fri, 25 Apr 2025 16:35:45 +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 --- .../bonus/canteen/core/order/common/dto/StageRefundParam.java | 2 ++ .../order/mobile/controller/OrderInfoMobileController.java | 2 +- .../order/mobile/controller/OrderPlaceMobileController.java | 3 ++- .../bonus/canteen/core/order/mobile/dto/StagePayMobileDTO.java | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/StageRefundParam.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/StageRefundParam.java index f63b201b..23306b02 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/StageRefundParam.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/StageRefundParam.java @@ -8,10 +8,12 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.util.List; @Data public class StageRefundParam extends OrderRefundParam { + @NotNull(message = "交易ID不能为空") private Long tradeId; } 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 638951c2..d05f5224 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,7 +140,7 @@ public class OrderInfoMobileController extends BaseController { notes = "驿站退款" ) public AjaxResult stageRefundMobile(@RequestHeader Map headers, - @RequestBody StageRefundParam request) { + @RequestBody @Valid StageRefundParam request) { String sign = HeaderFetchUtil.getSign(headers); if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) { return AjaxResult.error("签名失败"); 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 7021995d..440b646a 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 @@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.Map; @RestController @@ -140,7 +141,7 @@ public class OrderPlaceMobileController { notes = "驿站付款" ) public AjaxResult stageOrderPay(@RequestHeader Map headers, - @RequestBody StagePayMobileDTO stagePayDTO) { + @RequestBody @Valid StagePayMobileDTO stagePayDTO) { String sign = HeaderFetchUtil.getSign(headers); if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) { return AjaxResult.error("签名失败"); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/dto/StagePayMobileDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/dto/StagePayMobileDTO.java index 415c0dc1..8a0a2607 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/dto/StagePayMobileDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/dto/StagePayMobileDTO.java @@ -14,6 +14,6 @@ import java.math.BigDecimal; @Data public class StagePayMobileDTO extends OrderPayMobileDTO{ @ApiModelProperty("支付金额") - private @NotNull @Min(value = 0L, message = "金额不能小于0") BigDecimal amount; + private @NotNull(message = "支付金额不能为空") @Min(value = 0L, message = "金额不能小于0") BigDecimal amount; }