mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
systemconfig实体、接口命名修正
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.baseconfig.vo;
|
||||
|
||||
import com.cf.imes.module.system.validation.config.ConfigEnumValid;
|
||||
import com.cf.imes.module.system.validation.config.SystemConfigTypeEnumValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ConfigSaveReqVO {
|
||||
|
||||
@Schema(description = "配置类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "配置类型不能为空")
|
||||
@ConfigEnumValid
|
||||
@SystemConfigTypeEnumValid
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "配置规则")
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ConfigTypeEnum {
|
||||
public enum SystemConfigTypeEnum {
|
||||
/**
|
||||
* 自定义板编号
|
||||
*/
|
||||
@@ -39,11 +39,11 @@ public enum ConfigTypeEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
public static ConfigTypeEnum fromType(Integer type) {
|
||||
public static SystemConfigTypeEnum fromType(Integer type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
for (ConfigTypeEnum value : values()) {
|
||||
for (SystemConfigTypeEnum value : values()) {
|
||||
if (ObjectUtil.equal(value.getType(), type)) {
|
||||
return value;
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ import com.cf.imes.module.system.controller.admin.baseconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.baseconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.baseconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.config.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.ConfigTypeEnum;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.SystemConfigServiceFactory;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigGenerateService;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -46,7 +46,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
||||
public PageResult<SystemConfigDO> getBaseConfigPage(ConfigPageReqVO reqVO) {
|
||||
PageResult<SystemConfigDO> configDOPageResult = baseConfigMapper.selectPage(reqVO);
|
||||
// todo 后续所有configTypeEnum中的类型需要上到列表补全时通过遍历enum来补充
|
||||
ConfigTypeEnum customBoardNoEnum = ConfigTypeEnum.CUSTOM_BOARD_NO;
|
||||
SystemConfigTypeEnum customBoardNoEnum = SystemConfigTypeEnum.CUSTOM_BOARD_NO;
|
||||
CopyOnWriteArrayList<SystemConfigDO> configDOS = Lists.newCopyOnWriteArrayList(configDOPageResult.getList());
|
||||
Optional<SystemConfigDO> configDOOptional = configDOS.stream().filter(c -> ObjectUtil.equal(customBoardNoEnum.getType(), c.getType())).findAny();
|
||||
if (configDOOptional.isEmpty()) {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.service.config.factory;
|
||||
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.system.enums.config.ConfigTypeEnum;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigGenerateService;
|
||||
import com.cf.imes.module.system.service.config.factory.service.impl.CustomBoardNoGenerateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -33,7 +33,7 @@ public class SystemConfigServiceFactory {
|
||||
* @return
|
||||
*/
|
||||
public AbstractSystemConfigGenerateService getConfigService(int type) {
|
||||
switch (ConfigTypeEnum.fromType(type)) {
|
||||
switch (SystemConfigTypeEnum.fromType(type)) {
|
||||
case CUSTOM_BOARD_NO:
|
||||
return applicationContext.getBean(CustomBoardNoGenerateService.class);
|
||||
case INTELLIGENT_BRANCH:
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {ConfigEnumValidator.class}
|
||||
validatedBy = {SystemConfigTypeEnumValidator.class}
|
||||
)
|
||||
public @interface ConfigEnumValid {
|
||||
public @interface SystemConfigTypeEnumValid {
|
||||
String message() default "配置类型非法输入,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.validation.config;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.config.ConfigTypeEnum;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
@@ -13,9 +13,9 @@ import javax.validation.ConstraintValidatorContext;
|
||||
* @author Gqr
|
||||
* @since 2024/11/8 14:01
|
||||
*/
|
||||
public class ConfigEnumValidator implements ConstraintValidator<ConfigEnumValid, Integer> {
|
||||
public class SystemConfigTypeEnumValidator implements ConstraintValidator<SystemConfigTypeEnumValid, Integer> {
|
||||
@Override
|
||||
public void initialize(ConfigEnumValid constraintAnnotation) {
|
||||
public void initialize(SystemConfigTypeEnumValid constraintAnnotation) {
|
||||
ConstraintValidator.super.initialize(constraintAnnotation);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ConfigEnumValidator implements ConstraintValidator<ConfigEnumValid,
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
ConfigTypeEnum configTypeEnum = ConfigTypeEnum.fromType(value);
|
||||
SystemConfigTypeEnum configTypeEnum = SystemConfigTypeEnum.fromType(value);
|
||||
if (ObjectUtil.isNotNull(configTypeEnum)) {
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user