mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、统计枚举、校验统一使用common模块;2、旧超管统计相关代码移除;
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.api.organ.dto;
|
||||
|
||||
import com.cf.imes.module.system.validation.org.OrgStatisticsUnitInEnum;
|
||||
import com.cf.imes.framework.common.util.validation.statistics.StatisticsUnitInEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -26,6 +26,6 @@ public class OrgStatisticsReqDTO {
|
||||
*/
|
||||
@Schema(description = "统计维度单位", example = "0", allowableValues = {"0", "1", "2", "3"}, type = "integer")
|
||||
@NotNull(message = "统计维度单位不能为空")
|
||||
@OrgStatisticsUnitInEnum
|
||||
@StatisticsUnitInEnum
|
||||
private Integer unit;
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.cf.imes.module.system.validation.org;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/8/19 9:56
|
||||
*/
|
||||
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 生产单统计维度单位入参校验注解
|
||||
*/
|
||||
@Target({
|
||||
ElementType.METHOD,
|
||||
ElementType.FIELD,
|
||||
ElementType.ANNOTATION_TYPE,
|
||||
ElementType.CONSTRUCTOR,
|
||||
ElementType.PARAMETER,
|
||||
ElementType.TYPE_USE
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {OrgStatisticsUnitInEnumValidator.class}
|
||||
)
|
||||
public @interface OrgStatisticsUnitInEnum {
|
||||
String message() default "生产单统计维度单位[unit]错误,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.cf.imes.module.system.validation.org;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.OrderStatisticsUnit;
|
||||
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 生产单统计维度单位入参校验器
|
||||
*/
|
||||
public class OrgStatisticsUnitInEnumValidator implements ConstraintValidator<OrgStatisticsUnitInEnum, Integer> {
|
||||
|
||||
@Override
|
||||
public void initialize(OrgStatisticsUnitInEnum constraintAnnotation) {
|
||||
ConstraintValidator.super.initialize(constraintAnnotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
OrderStatisticsUnit unit = OrderStatisticsUnit.fromValue(value);
|
||||
if (ObjectUtil.isNotNull(unit)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user