Commit b14a29df by ping.wu

非空参数校验

parent da581850
...@@ -69,6 +69,7 @@ public class AppCreateOrderVo { ...@@ -69,6 +69,7 @@ public class AppCreateOrderVo {
@Builder.Default @Builder.Default
private String menuType = "saas"; private String menuType = "saas";
@Valid
private List<OrderProductVo> orderProducts; private List<OrderProductVo> orderProducts;
/** /**
......
...@@ -3,6 +3,7 @@ package cn.freemud.entities.vo; ...@@ -3,6 +3,7 @@ package cn.freemud.entities.vo;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.Min;
import java.util.List; import java.util.List;
/** /**
...@@ -34,6 +35,7 @@ public class OrderProductVo { ...@@ -34,6 +35,7 @@ public class OrderProductVo {
/** /**
* 数量 * 数量
*/ */
@Min(value = 1,message = "数量不能小于1")
private Integer qty; private Integer qty;
/** /**
......
...@@ -263,7 +263,7 @@ public class AppOrderServiceImpl implements AppOrderService { ...@@ -263,7 +263,7 @@ public class AppOrderServiceImpl implements AppOrderService {
} }
if (CollectionUtils.isEmpty(spuIds)) { if (CollectionUtils.isEmpty(spuIds)) {
throw new ServiceException(ResponseResult.SYSTEM_BUSINESS_ERROR); throw new ServiceException(ResponseResult.PARAMETER_MISSING);
} }
//去重 //去重
List<String> result = spuIds.stream().distinct().collect(Collectors.toList()); List<String> result = spuIds.stream().distinct().collect(Collectors.toList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment