mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
1、自定义板编号配置相关实体字段调整;2、服务处理类AbstractSystemConfigGenerateService相关命名修改;3、新增自定义板编号配置修改状态后缓存移除操作;
This commit is contained in:
+1
-39
@@ -60,49 +60,11 @@ public class CustomPlateNoSeqDO implements Serializable {
|
|||||||
private Integer orderNoSeq;
|
private Integer orderNoSeq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上次板件号
|
* 板序号前值
|
||||||
*/
|
|
||||||
@TableField(value = "last_plateNo")
|
|
||||||
private String lastPlateNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 板件序号前值
|
|
||||||
*/
|
*/
|
||||||
@TableField(value = "plateNo_seq")
|
@TableField(value = "plateNo_seq")
|
||||||
private Integer plateNoSeq;
|
private Integer plateNoSeq;
|
||||||
|
|
||||||
/**
|
|
||||||
* 上次房间
|
|
||||||
*/
|
|
||||||
private String lastRoom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 房间序号前值
|
|
||||||
*/
|
|
||||||
private Integer roomSeq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上次柜体
|
|
||||||
*/
|
|
||||||
private String lastBody;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 柜体序号前值
|
|
||||||
*/
|
|
||||||
private Integer bodySeq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上次加工组
|
|
||||||
*/
|
|
||||||
@TableField(value = "last_process_group")
|
|
||||||
private String lastProcessGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加工组序号前值
|
|
||||||
*/
|
|
||||||
@TableField(value = "process_group_seq")
|
|
||||||
private Integer processGroupSeq;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上次年
|
* 上次年
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
@@ -63,4 +63,9 @@ public class SystemConfigDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Long organId;
|
private Long organId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private int version;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-7
@@ -18,7 +18,7 @@ import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
|||||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
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.SystemConfigServiceFactory;
|
||||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigGenerateService;
|
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
@@ -74,7 +74,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
|||||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||||
Long id = reqVO.getId();
|
Long id = reqVO.getId();
|
||||||
// 根据配置类型选择对应的service
|
// 根据配置类型选择对应的service
|
||||||
AbstractSystemConfigGenerateService configService = configServiceFactory.getConfigService(reqVO.getType());
|
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(reqVO.getType());
|
||||||
// 校验规则
|
// 校验规则
|
||||||
configService.checkValid(reqVO.getSetting());
|
configService.checkValid(reqVO.getSetting());
|
||||||
// 系统配置保存前操作
|
// 系统配置保存前操作
|
||||||
@@ -98,7 +98,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateStatus(ConfigUpdateStatusReqVO reqVO) {
|
public void updateStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||||
// 根据配置类型选择对应的service
|
// 根据配置类型选择对应的service
|
||||||
AbstractSystemConfigGenerateService configService = configServiceFactory.getConfigService(reqVO.getType());
|
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(reqVO.getType());
|
||||||
Long id = reqVO.getId();
|
Long id = reqVO.getId();
|
||||||
// 校验存在
|
// 校验存在
|
||||||
SystemConfigDO systemConfigDO = validateSystemConfigExists(id);
|
SystemConfigDO systemConfigDO = validateSystemConfigExists(id);
|
||||||
@@ -110,15 +110,19 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(cacheNames = RedisKeyConstants.SYSTEM_CONFIG, key = "'" + RedisKeyConstants.CUSTOM_PLATE_NO + "'")
|
@Cacheable(cacheNames = RedisKeyConstants.SYSTEM_CONFIG, key = "'" + RedisKeyConstants.CUSTOM_PLATE_NO + "'", unless = "#result == null")
|
||||||
public SystemConfigCopyDO getOrgCustomPlateNoConfig() {
|
public SystemConfigCopyDO getOrgCustomPlateNoConfig() {
|
||||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaUpdateWrapper<SystemConfigDO>()
|
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||||
.eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
.eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
||||||
SystemConfigCopyDO copyDO = JSON.parseObject(JSON.toJSONString(systemConfigDO), SystemConfigCopyDO.class);
|
if (ObjectUtil.isNotNull(systemConfigDO)) {
|
||||||
copyDO.setRuleList(JSON.parseArray(systemConfigDO.getSetting(), SystemConfigCustomPlateNoRuleItemCopyDO.class));
|
SystemConfigCopyDO copyDO = JSON.parseObject(JSON.toJSONString(systemConfigDO), SystemConfigCopyDO.class);
|
||||||
return copyDO;
|
copyDO.setRuleList(JSON.parseArray(systemConfigDO.getSetting(), SystemConfigCustomPlateNoRuleItemCopyDO.class));
|
||||||
|
return copyDO;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@ package com.cf.imes.module.system.service.config.factory;
|
|||||||
|
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
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.AbstractSystemConfigServiceHandler;
|
||||||
import com.cf.imes.module.system.service.config.factory.service.impl.CustomPlateNoGenerateService;
|
import com.cf.imes.module.system.service.config.factory.service.impl.CustomPlateNoGenerateServiceHandler;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -32,10 +32,10 @@ public class SystemConfigServiceFactory {
|
|||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public AbstractSystemConfigGenerateService getConfigService(int type) {
|
public AbstractSystemConfigServiceHandler getConfigServiceHandler(int type) {
|
||||||
switch (SystemConfigTypeEnum.fromType(type)) {
|
switch (SystemConfigTypeEnum.fromType(type)) {
|
||||||
case CUSTOM_PLATE_NO:
|
case CUSTOM_PLATE_NO:
|
||||||
return applicationContext.getBean(CustomPlateNoGenerateService.class);
|
return applicationContext.getBean(CustomPlateNoGenerateServiceHandler.class);
|
||||||
case INTELLIGENT_BRANCH:
|
case INTELLIGENT_BRANCH:
|
||||||
// todo 智能分线
|
// todo 智能分线
|
||||||
case ADVANCED_SCREEN:
|
case ADVANCED_SCREEN:
|
||||||
|
|||||||
+2
-2
@@ -5,12 +5,12 @@ import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateSt
|
|||||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统配置生成服务抽象类
|
* 系统配置服务处理器抽象类
|
||||||
*
|
*
|
||||||
* @author Gqr
|
* @author Gqr
|
||||||
* @since 2024/11/8 16:45
|
* @since 2024/11/8 16:45
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSystemConfigGenerateService {
|
public abstract class AbstractSystemConfigServiceHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验配置的合法性
|
* 校验配置的合法性
|
||||||
+16
-5
@@ -9,17 +9,20 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
|||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO;
|
import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
import com.cf.imes.module.system.dal.mysql.customplateno.CustomPlateNoSeqMapper;
|
import com.cf.imes.module.system.dal.mysql.customplateno.CustomPlateNoSeqMapper;
|
||||||
|
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||||
import com.cf.imes.module.system.enums.config.CustBoardRuleCodeEnum;
|
import com.cf.imes.module.system.enums.config.CustBoardRuleCodeEnum;
|
||||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigGenerateService;
|
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||||
import com.cf.imes.module.system.service.dict.DictDataService;
|
import com.cf.imes.module.system.service.dict.DictDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -31,14 +34,14 @@ import java.util.Optional;
|
|||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_BOARD_NO_RULE_SAVE_CHECK_ERROR;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_BOARD_NO_RULE_SAVE_CHECK_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义板编号生成服务
|
* 自定义板编号服务处理器
|
||||||
*
|
*
|
||||||
* @author Gqr
|
* @author Gqr
|
||||||
* @since 2024/11/8 16:48
|
* @since 2024/11/8 16:48
|
||||||
*/
|
*/
|
||||||
@Service("customPlateNoGenerateService")
|
@Service("customPlateNoGenerateServiceHandler")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CustomPlateNoGenerateService extends AbstractSystemConfigGenerateService {
|
public class CustomPlateNoGenerateServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||||
|
|
||||||
// 自定义板编号校验错误全部统一编号:1_002_040_003
|
// 自定义板编号校验错误全部统一编号:1_002_040_003
|
||||||
public static final ErrorCode CUSTOM_BOARD_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_003, "规则编码不能为空");
|
public static final ErrorCode CUSTOM_BOARD_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_003, "规则编码不能为空");
|
||||||
@@ -56,6 +59,9 @@ public class CustomPlateNoGenerateService extends AbstractSystemConfigGenerateSe
|
|||||||
@Resource
|
@Resource
|
||||||
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkValid(String setting) {
|
public void checkValid(String setting) {
|
||||||
// 字典中的时间格式
|
// 字典中的时间格式
|
||||||
@@ -214,6 +220,11 @@ public class CustomPlateNoGenerateService extends AbstractSystemConfigGenerateSe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||||
// todo afterUpdateStatus
|
if (CommonStatusEnum.DISABLE.getStatus().equals(reqVO.getStatus())) {
|
||||||
|
// 禁用配置移除缓存
|
||||||
|
String redisKey = String.format("%s:%d:%s", RedisKeyConstants.SYSTEM_CONFIG, OrganContextHolder.getOrganId(), RedisKeyConstants.CUSTOM_PLATE_NO);
|
||||||
|
Boolean delete = stringRedisTemplate.delete(redisKey);
|
||||||
|
log.info("[CustomPlateNoGenerateService][afterUpdateStatus]key:{}缓存删除结果:{}", redisKey, delete);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user