mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 余料板放置枚举类
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RemainPlatePlaceStyleEnum {
|
||||
|
||||
ZERO(0, "正面"),
|
||||
ONE(1, "正面右转"),
|
||||
TWO(2, "正面后转"),
|
||||
THREE(3, "正面左转"),
|
||||
FOUR(4, "反面"),
|
||||
FIVE(5, "反面右转"),
|
||||
SIX(6, "反面后转"),
|
||||
SEVEN(7, "反面左转");
|
||||
|
||||
private final Integer status;
|
||||
private String description;
|
||||
|
||||
public boolean equals(Integer status) {
|
||||
return this.status .equals(status) ;
|
||||
}
|
||||
|
||||
public boolean equals(RemainPlatePlaceStyleEnum enableStatusEnum) {
|
||||
return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum RemainPlateStatusEnum {
|
||||
UNUSED(0, "未使用"),
|
||||
IN_USE(1, "使用中");
|
||||
USED(1, "已使用");
|
||||
|
||||
private final Integer status;
|
||||
private String description;
|
||||
|
||||
+4
-8
@@ -1,8 +1,6 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.longConvert.ValidLong;
|
||||
import com.cf.imes.module.manage.validation.texture.ValidBoolean;
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -38,22 +36,21 @@ public class PlateSaveReqVO {
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ValidBoolean
|
||||
private Boolean texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
@ValidLength()
|
||||
@NumberValid(name = "宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "高度不能为空")
|
||||
@ValidLength()
|
||||
@NumberValid(name = "高度")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "厚度不能为空")
|
||||
@ValidLength()
|
||||
@NumberValid(name = "厚度")
|
||||
private Double thickness;
|
||||
|
||||
// @Schema(description = "价格", example = "3380")
|
||||
@@ -71,6 +68,5 @@ public class PlateSaveReqVO {
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@ValidLong
|
||||
private Long organId;
|
||||
}
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.manage.validation.common.ValidCommonStatus;
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.placeStyle.ValidPlaceStyle;
|
||||
import com.cf.imes.module.manage.validation.type.ValidTypeField;
|
||||
import lombok.*;
|
||||
@@ -70,6 +70,7 @@ public class RemainPlatePageReqVO extends PageParam {
|
||||
private BigDecimal[] length;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
@NumberValid(name = "厚度")
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
|
||||
+4
-8
@@ -1,8 +1,7 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.manage.validation.common.ValidCommonStatus;
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.nonZero.ValidNonZero;
|
||||
import com.cf.imes.module.manage.validation.placeStyle.ValidPlaceStyle;
|
||||
import com.cf.imes.module.manage.validation.type.ValidTypeField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -63,20 +62,17 @@ public class RemainPlateSaveReqVO {
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
@NumberValid(name = "宽度")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "长度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
@NumberValid(name = "长度")
|
||||
private BigDecimal length;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "厚度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
@NumberValid(name = "厚度")
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
validateRemainPlateExists(ids);
|
||||
if (useType != RemainPlateUseTypeEnum.TYPE_ONE.getStatus() && useType != RemainPlateUseTypeEnum.TYPE_ZERO.getStatus()) { //余料使用状态为2或3
|
||||
// 判断该排单是否存在以使用的余料
|
||||
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.IN_USE.getStatus(),
|
||||
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.USED.getStatus(),
|
||||
DeletedCodeEnum.NOT_DELETED.getStatus(), OrganContextHolder.getOrganId()).size() > 0) {
|
||||
// 余料状态还原
|
||||
remainPlateMapper.updateRemainPlateStatusByPlanId(RemainPlateStatusEnum.UNUSED.getStatus(), RemainPlateUseTypeEnum.TYPE_ZERO.getStatus(),
|
||||
@@ -81,7 +81,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
}
|
||||
if (ids != null){
|
||||
//判断是否符合核销标准
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.USED.getStatus());
|
||||
//以id为条件批量修改余料库中的状态
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(), planId);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(updateReqVO.getId());
|
||||
// 是否使用
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.IN_USE.getStatus()) {
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) {
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
}
|
||||
// 判断是否为开料添加
|
||||
@@ -132,7 +132,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
// 余料存在判断
|
||||
validateRemainPlateExists(ids);
|
||||
// 判断余料的状态是否存在使用中
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.USED.getStatus());
|
||||
// 删除
|
||||
remainPlateMapper.deleteBatchIds(ids);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
private void validateRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||
for (Long id : ids) {
|
||||
if (validateRemainPlateStatus(id) == status) {
|
||||
if (status == RemainPlateStatusEnum.IN_USE.getStatus())
|
||||
if (status == RemainPlateStatusEnum.USED.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_NO_USED);
|
||||
|
||||
+12
-1
@@ -2,14 +2,25 @@ package com.cf.imes.module.manage.validation.common;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import com.cf.imes.module.manage.enums.RemainPlateStatusEnum;
|
||||
|
||||
/**
|
||||
* 状态校验
|
||||
*/
|
||||
public class CommonStatusValidator implements ConstraintValidator<ValidCommonStatus, Integer> {
|
||||
|
||||
private ValidCommonStatus annotation;
|
||||
|
||||
@Override
|
||||
public void initialize(ValidCommonStatus constraintAnnotation) {
|
||||
this.annotation = constraintAnnotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value == null || (value == 0 || value == 1);
|
||||
if (value == null) {
|
||||
value = RemainPlateStatusEnum.UNUSED.getStatus(); // 默认值为未使用
|
||||
}
|
||||
return value == RemainPlateStatusEnum.UNUSED.getStatus() || value == RemainPlateStatusEnum.USED.getStatus();
|
||||
}
|
||||
}
|
||||
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.length;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数字长度校验器注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = WidthLengthValidator.class)
|
||||
@Documented
|
||||
public @interface ValidLength {
|
||||
String message() default "数值长度不符合";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
int maxDigits() default 8; // 最大总位数
|
||||
int maxFractionalDigits() default 3; // 小数点后的最大位数
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.length;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 数字长度校验器
|
||||
*/
|
||||
public class WidthLengthValidator implements ConstraintValidator<ValidLength, Double> {
|
||||
|
||||
private int maxDigits;
|
||||
private int maxFractionalDigits;
|
||||
|
||||
@Override
|
||||
public void initialize(ValidLength constraintAnnotation) {
|
||||
this.maxDigits = constraintAnnotation.maxDigits();
|
||||
this.maxFractionalDigits = constraintAnnotation.maxFractionalDigits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Double value, ConstraintValidatorContext context) {
|
||||
if (value == null) {
|
||||
return true; // 允许 null 值
|
||||
}
|
||||
String valueAsString = Double.toString(value);
|
||||
int decimalPointIndex = valueAsString.indexOf('.');
|
||||
|
||||
// 计算整数部分和小数部分的位数
|
||||
int integerPartLength = decimalPointIndex == -1 ? valueAsString.length() : decimalPointIndex;
|
||||
int fractionalPartLength = decimalPointIndex == -1 ? 0 : valueAsString.length() - decimalPointIndex - 1;
|
||||
|
||||
int totalDigits = integerPartLength + fractionalPartLength;
|
||||
|
||||
return totalDigits <= maxDigits && fractionalPartLength <= maxFractionalDigits;
|
||||
}
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.longConvert;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
public class LongValidator implements ConstraintValidator<ValidLong, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if (value == null) {
|
||||
return true; // 允许 null 值
|
||||
}
|
||||
try {
|
||||
Long.parseLong(value);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.longConvert;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = LongValidator.class)
|
||||
@Documented
|
||||
public @interface ValidLong {
|
||||
|
||||
String message() default "ID参数类型有误";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.nonZero;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 数值大于0校验
|
||||
*/
|
||||
public class NonNegativeValidator implements ConstraintValidator<ValidNonZero, BigDecimal> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(BigDecimal value, ConstraintValidatorContext context) {
|
||||
return value == null || value.signum() >= 0;
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.nonZero;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数值大于0校验注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = NonNegativeValidator.class)
|
||||
@Documented
|
||||
public @interface ValidNonZero {
|
||||
|
||||
String message() default "长度数值必须大于等于0";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+20
-2
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.manage.validation.placeStyle;
|
||||
|
||||
import com.cf.imes.module.manage.enums.RemainPlatePlaceStyleEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
@@ -8,9 +10,25 @@ import javax.validation.ConstraintValidatorContext;
|
||||
*/
|
||||
public class PlaceStyleValidator implements ConstraintValidator<ValidPlaceStyle, Integer> {
|
||||
|
||||
private ValidPlaceStyle annotation;
|
||||
|
||||
@Override
|
||||
public void initialize(ValidPlaceStyle constraintAnnotation) {
|
||||
this.annotation = constraintAnnotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value == null || (value == 0 || value == 1 || value == 2 || value == 3
|
||||
|| value == 4 || value == 5 || value == 6 || value == 7);
|
||||
if (value == null) {
|
||||
value = RemainPlatePlaceStyleEnum.ZERO.getStatus(); // 默认值为正面
|
||||
}
|
||||
return value == RemainPlatePlaceStyleEnum.ONE.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.TWO.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.THREE.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.FOUR.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.FIVE.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.SIX.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.SEVEN.getStatus()
|
||||
|| value == RemainPlatePlaceStyleEnum.ZERO.getStatus();
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.manage.validation.placeStyle;
|
||||
|
||||
import com.cf.imes.module.manage.validation.texture.BooleanTypeValidator;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.texture;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 纹理校验
|
||||
*/
|
||||
public class BooleanTypeValidator implements ConstraintValidator<ValidBoolean, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if (value == null) {
|
||||
return true; // 允许 null 值
|
||||
}
|
||||
return value.equalsIgnoreCase("true") ||
|
||||
value.equalsIgnoreCase("false") ||
|
||||
value.equals("0") ||
|
||||
value.equals("1");
|
||||
}
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.cf.imes.module.manage.validation.texture;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
/**
|
||||
* 纹理校验注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = BooleanTypeValidator.class)
|
||||
@Documented
|
||||
public @interface ValidBoolean {
|
||||
|
||||
String message() default "纹理不合法,1:有、0:无";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+17
-1
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.manage.validation.type;
|
||||
|
||||
import com.cf.imes.module.manage.enums.RemainPlateUseTypeEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
@@ -8,8 +10,22 @@ import javax.validation.ConstraintValidatorContext;
|
||||
*/
|
||||
public class TypeFieldValidator implements ConstraintValidator<ValidTypeField, Integer> {
|
||||
|
||||
private ValidTypeField annotation;
|
||||
|
||||
@Override
|
||||
public void initialize(ValidTypeField constraintAnnotation) {
|
||||
this.annotation = constraintAnnotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value == null || (value == 0 || value == 1 || value == 2);
|
||||
// 如果值为 null,则不做校验,直接返回 true
|
||||
if (value == null) {
|
||||
value = RemainPlateUseTypeEnum.TYPE_ZERO.getStatus(); // 默认值为未使用
|
||||
}
|
||||
return value == RemainPlateUseTypeEnum.TYPE_ONE.getStatus() ||
|
||||
value == RemainPlateUseTypeEnum.TYPE_TWO.getStatus() ||
|
||||
value == RemainPlateUseTypeEnum.TYPE_THREE.getStatus() ||
|
||||
value == RemainPlateUseTypeEnum.TYPE_ZERO.getStatus();
|
||||
}
|
||||
}
|
||||
-4
@@ -26,10 +26,6 @@ public class UserPageReqVO extends PageParam {
|
||||
@Size(max = 30, message = "用户昵称长度不能超过30个字符")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户账号")
|
||||
@Size(max = 30, message = "用户账号长度不能超过30个字符")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "手机号码,模糊匹配", example = "chenfeng")
|
||||
@Mobile
|
||||
@Size(max = 11, message = "手机号码长度不能超过11个字符")
|
||||
|
||||
-3
@@ -393,9 +393,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if (StringUtils.isNotBlank(reqVO.getNickname())) {
|
||||
reqVO.setPyFirstChar(PinYinUtils.convertFirstChar(reqVO.getNickname()));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getNickname()).replace(" ", ""));
|
||||
} else if (StringUtils.isNotBlank((reqVO.getUsername()))) {
|
||||
reqVO.setPyFirstChar(PinYinUtils.convertFirstChar(reqVO.getUsername()));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getUsername()).replace(" ", ""));
|
||||
} else {
|
||||
// 避免name为空外部传入拼音查询字段
|
||||
reqVO.setPyFirstChar(null);
|
||||
|
||||
Reference in New Issue
Block a user