From c00bb441bb1204f81162b9a693003327f2ab6ac8 Mon Sep 17 00:00:00 2001 From: zhouquanseaskyshcom <zhouquan@seaskysh.com> Date: Wed, 26 Oct 2022 09:14:59 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E6=A0=B8=E5=AE=9A=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/seasky/projectplan/api/IQuotaManage.java | 6 +++++- .../seasky/projectplan/dto/quotamanage/QuotaManageCmd.java | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ServiceSite/facade/src/main/java/com/seasky/projectplan/api/IQuotaManage.java b/ServiceSite/facade/src/main/java/com/seasky/projectplan/api/IQuotaManage.java index 4c8fc8c9..1708b8dc 100644 --- a/ServiceSite/facade/src/main/java/com/seasky/projectplan/api/IQuotaManage.java +++ b/ServiceSite/facade/src/main/java/com/seasky/projectplan/api/IQuotaManage.java @@ -3,10 +3,12 @@ package com.seasky.projectplan.api; import com.seasky.core.common.Result; import com.seasky.projectplan.dto.quotamanage.*; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import javax.validation.Valid; import java.math.BigDecimal; import java.sql.ResultSet; import java.util.List; @@ -19,6 +21,7 @@ import java.util.List; */ @FeignClient("projectplan-provider") @RequestMapping("quotaManage") +@Validated public interface IQuotaManage { /** @@ -82,7 +85,8 @@ public interface IQuotaManage { * @return {@link Integer} */ @PostMapping(path = "/saveProjectMoney") - Result<Integer> saveProjectMoney(QuotaManageCmd cmd); + @Validated({QuotaManageCmd.SaveQuotaManageCmdInterface.class}) + Result<Integer> saveProjectMoney(@Valid QuotaManageCmd cmd); //浠ヤ笅 Q绾� diff --git a/ServiceSite/facade/src/main/java/com/seasky/projectplan/dto/quotamanage/QuotaManageCmd.java b/ServiceSite/facade/src/main/java/com/seasky/projectplan/dto/quotamanage/QuotaManageCmd.java index ca7da78f..ea9a3070 100644 --- a/ServiceSite/facade/src/main/java/com/seasky/projectplan/dto/quotamanage/QuotaManageCmd.java +++ b/ServiceSite/facade/src/main/java/com/seasky/projectplan/dto/quotamanage/QuotaManageCmd.java @@ -8,6 +8,9 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Digits; import javax.validation.constraints.Size; import java.math.BigDecimal; @@ -22,6 +25,7 @@ import java.math.BigDecimal; @NoArgsConstructor @EqualsAndHashCode(callSuper = true) public class QuotaManageCmd extends BaseDto { + public interface SaveQuotaManageCmdInterface{} @ApiModelProperty(value = "涓婚敭id",example = "") private Long id; @@ -30,6 +34,8 @@ public class QuotaManageCmd extends BaseDto { private Integer year; @ApiModelProperty(value = "鏍稿畾閲戦",example = "") + @Digits(integer = 22,fraction = 2,message = "鏍稿畾閲戦鏍煎紡涓嶆纭�",groups = {SaveQuotaManageCmdInterface.class}) + @DecimalMin(value = "0", message = "鏍稿畾閲戦涓嶈兘灏忎簬0",groups = {SaveQuotaManageCmdInterface.class}) private BigDecimal quotaMoney; @ApiModelProperty(value = "椤圭洰绫诲瀷鍚嶇О",example = "椤圭洰绫诲瀷鍚嶇О1") -- GitLab