mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
获取未排贴皮板件数据接口增加查询入参;
This commit is contained in:
+4
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.controller.admin.veneer.vo;
|
||||
|
||||
import com.cf.imes.module.executor.validation.veneer.VeneerDimensionRangeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@@ -50,11 +51,14 @@ public class UnplannedVeneerPlateDataReqVO {
|
||||
private String plateName;
|
||||
|
||||
@Schema(description = "长度范围(mm),依次为最小值、最大值")
|
||||
@VeneerDimensionRangeValid(message = "{veneer.unplanned.plate.query.length.range.invalid}")
|
||||
private BigDecimal[] length;
|
||||
|
||||
@Schema(description = "宽度范围(mm),依次为最小值、最大值")
|
||||
@VeneerDimensionRangeValid(message = "{veneer.unplanned.plate.query.width.range.invalid}")
|
||||
private BigDecimal[] width;
|
||||
|
||||
@Schema(description = "厚度范围(mm),依次为最小值、最大值")
|
||||
@VeneerDimensionRangeValid(message = "{veneer.unplanned.plate.query.thickness.range.invalid}")
|
||||
private BigDecimal[] thickness;
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.executor.validation.veneer;
|
||||
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 贴皮板件尺寸查询区间校验注解。
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(validatedBy = VeneerDimensionRangeValidator.class)
|
||||
public @interface VeneerDimensionRangeValid {
|
||||
|
||||
/**
|
||||
* 校验失败提示。
|
||||
*
|
||||
* @return 国际化消息模板
|
||||
*/
|
||||
String message();
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.cf.imes.module.executor.validation.veneer;
|
||||
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 贴皮板件尺寸查询区间校验器。
|
||||
*/
|
||||
public class VeneerDimensionRangeValidator
|
||||
implements ConstraintValidator<VeneerDimensionRangeValid, BigDecimal[]> {
|
||||
|
||||
/**
|
||||
* 单个尺寸允许的最大整数位数。
|
||||
*/
|
||||
private static final int MAX_INTEGER_DIGITS = 5;
|
||||
|
||||
/**
|
||||
* 单个尺寸允许的最大小数位数。
|
||||
*/
|
||||
private static final int MAX_FRACTION_DIGITS = 3;
|
||||
|
||||
@Override
|
||||
public boolean isValid(BigDecimal[] range, ConstraintValidatorContext context) {
|
||||
if (range == null) {
|
||||
return true;
|
||||
}
|
||||
if (range.length != 2 || !isValidDimension(range[0]) || !isValidDimension(range[1])) {
|
||||
return false;
|
||||
}
|
||||
return range[0].compareTo(range[1]) <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验尺寸值非负,且整数、小数位数均未超过限制。
|
||||
*
|
||||
* @param value 待校验尺寸值
|
||||
* @return 是否合法
|
||||
*/
|
||||
private boolean isValidDimension(BigDecimal value) {
|
||||
if (value == null || value.signum() < 0) {
|
||||
return false;
|
||||
}
|
||||
String[] parts = value.toPlainString().split("\\.", -1);
|
||||
int integerLength = parts[0].length();
|
||||
int fractionLength = parts.length == 2 ? parts[1].length() : 0;
|
||||
return integerLength <= MAX_INTEGER_DIGITS && fractionLength <= MAX_FRACTION_DIGITS;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -482,7 +482,7 @@
|
||||
AND opv.plate_name LIKE CONCAT('%', #{req.plateName}, '%')
|
||||
</if>
|
||||
<if test="req.length != null and req.length.length == 2">
|
||||
AND opv.plate_height BETWEEN #{req.length[0]} AND #{req.length[1]}
|
||||
AND opv.plate_length BETWEEN #{req.length[0]} AND #{req.length[1]}
|
||||
</if>
|
||||
<if test="req.width != null and req.width.length == 2">
|
||||
AND opv.plate_width BETWEEN #{req.width[0]} AND #{req.width[1]}
|
||||
|
||||
+3
@@ -43,6 +43,9 @@ veneer.unplanned.plate.query.sourceVeneerNo.length.max=貼皮商品編號不能
|
||||
veneer.unplanned.plate.query.material.length.max=貼皮材質不能超過64個字元
|
||||
veneer.unplanned.plate.query.color.length.max=貼皮顏色不能超過32個字元
|
||||
veneer.unplanned.plate.query.plateName.length.max=板名稱不能超過64個字元
|
||||
veneer.unplanned.plate.query.length.range.invalid=長度範圍必須包含兩個非負數,整數最多5位、小數最多3位,且最小值不能大於最大值
|
||||
veneer.unplanned.plate.query.width.range.invalid=寬度範圍必須包含兩個非負數,整數最多5位、小數最多3位,且最小值不能大於最大值
|
||||
veneer.unplanned.plate.query.thickness.range.invalid=厚度範圍必須包含兩個非負數,整數最多5位、小數最多3位,且最小值不能大於最大值
|
||||
veneer.defect.save.id.not.null=貼皮ID不能為空
|
||||
veneer.classification.name.save.name.not.null=分類名稱不能為空
|
||||
veneer.classification.name.save.name.length.max=分類名稱不能超過64個字元
|
||||
|
||||
+3
@@ -43,6 +43,9 @@ veneer.unplanned.plate.query.sourceVeneerNo.length.max=veneer product number can
|
||||
veneer.unplanned.plate.query.material.length.max=veneer material cannot exceed 64 characters
|
||||
veneer.unplanned.plate.query.color.length.max=veneer color cannot exceed 32 characters
|
||||
veneer.unplanned.plate.query.plateName.length.max=plate name cannot exceed 64 characters
|
||||
veneer.unplanned.plate.query.length.range.invalid=length range must contain two non-negative numbers with at most 5 integer digits and 3 decimal places, and the minimum cannot exceed the maximum
|
||||
veneer.unplanned.plate.query.width.range.invalid=width range must contain two non-negative numbers with at most 5 integer digits and 3 decimal places, and the minimum cannot exceed the maximum
|
||||
veneer.unplanned.plate.query.thickness.range.invalid=thickness range must contain two non-negative numbers with at most 5 integer digits and 3 decimal places, and the minimum cannot exceed the maximum
|
||||
veneer.defect.save.id.not.null=veneer id cannot be empty
|
||||
veneer.classification.name.save.name.not.null=classification name cannot be empty
|
||||
veneer.classification.name.save.name.length.max=classification name length cannot exceed 64 characters
|
||||
|
||||
+3
@@ -43,6 +43,9 @@ veneer.unplanned.plate.query.sourceVeneerNo.length.max=贴皮商品编号不能
|
||||
veneer.unplanned.plate.query.material.length.max=贴皮材质不能超过64个字符
|
||||
veneer.unplanned.plate.query.color.length.max=贴皮颜色不能超过32个字符
|
||||
veneer.unplanned.plate.query.plateName.length.max=板名称不能超过64个字符
|
||||
veneer.unplanned.plate.query.length.range.invalid=长度范围必须包含两个非负数,整数最多5位、小数最多3位,且最小值不能大于最大值
|
||||
veneer.unplanned.plate.query.width.range.invalid=宽度范围必须包含两个非负数,整数最多5位、小数最多3位,且最小值不能大于最大值
|
||||
veneer.unplanned.plate.query.thickness.range.invalid=厚度范围必须包含两个非负数,整数最多5位、小数最多3位,且最小值不能大于最大值
|
||||
veneer.defect.save.id.not.null=贴皮ID不能为空
|
||||
veneer.classification.name.save.name.not.null=分类名称不能为空
|
||||
veneer.classification.name.save.name.length.max=分类名称长度不能超过64
|
||||
|
||||
Reference in New Issue
Block a user