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:
+1
-1
@@ -19,7 +19,7 @@ import java.io.Serializable;
|
||||
* @author Gqr
|
||||
* @since 2024/11/11 18:31
|
||||
*/
|
||||
@TableName(value = "custom_plateno_seq", autoResultMap = true)
|
||||
@TableName(value = "custom_plateno_seq")
|
||||
@KeySequence("custom_plateno_seq_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
|
||||
+33
-16
@@ -15,14 +15,17 @@ import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteRe
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
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.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
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.mysql.customplateno.CustomPlateNoSeqMapper;
|
||||
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.enums.customplateno.CustomPlateNoRuleCodeEnum;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.enums.customplateno.ResetModeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.CustomPlateNoSeqService;
|
||||
import com.cf.imes.module.system.service.dict.DictDataService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -52,10 +55,10 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR = new ErrorCode(1_002_040_003, "规则编码【{}】不合法,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR = new ErrorCode(1_002_040_003, "时间格式【{}】不合法,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR = new ErrorCode(1_002_040_003, "自定义字符值不能为空,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_003, "规则【{}】复位/清零模式【{}】不合法,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_003, "参数【{}】不能为空,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_003, "数值类型参数{}:【{}】转换异常,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_003, "布尔类型参数{}:【{}】转换异常,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_003, "规则【{}】复位/清零模式不合法,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_003, "【{}】下的【{}】不能为空,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_003, "【{}】下的数值类型参数{}:【{}】转换异常,请检查配置规则");
|
||||
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_003, "【{}】下的布尔类型参数{}:【{}】转换异常,请检查配置规则");
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -67,6 +70,12 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoSeqService customPlateNoSeqService;
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
return null;
|
||||
@@ -172,8 +181,9 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
Map<String, String> bolTypeFieldMap = new HashMap<>() {{
|
||||
put("left_fill_zero", "是否左补零");
|
||||
}};
|
||||
intTypeFieldMap.forEach((k, v) -> checkInt(object.get(k), v));
|
||||
bolTypeFieldMap.forEach((k, v) -> checkBol(object.get(k), v));
|
||||
String ruleName = object.getString("ruleName");
|
||||
intTypeFieldMap.forEach((k, v) -> checkInt(object.get(k), v, ruleName));
|
||||
bolTypeFieldMap.forEach((k, v) -> checkBol(object.get(k), v, ruleName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,12 +193,12 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
* @param intObj
|
||||
* @param fieldName
|
||||
*/
|
||||
private void checkInt(Object intObj, String fieldName) {
|
||||
if (ObjectUtil.isNull(intObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, fieldName);
|
||||
private void checkInt(Object intObj, String fieldName, String ruleName) {
|
||||
if (ObjectUtil.isEmpty(intObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
}
|
||||
if (!NumberUtil.isInteger(intObj.toString())) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, fieldName, intObj);
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, ruleName, fieldName, intObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,12 +208,12 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
* @param bolObj
|
||||
* @param fieldName
|
||||
*/
|
||||
private void checkBol(Object bolObj, String fieldName) {
|
||||
if (ObjectUtil.isNull(bolObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, fieldName);
|
||||
private void checkBol(Object bolObj, String fieldName, String ruleName) {
|
||||
if (ObjectUtil.isEmpty(bolObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
}
|
||||
if (!(bolObj instanceof Boolean)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, fieldName, bolObj);
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, ruleName, fieldName, bolObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,8 +229,8 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
|| ObjectUtil.equal(resetMode, ResetModeEnum.MONTH.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.DAY.getMode());
|
||||
} else if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.PLATENO, custBoardRuleCodeEnum)) {
|
||||
checkSuccess = ObjectUtil.equal(resetMode, ResetModeEnum.ORDER.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.YEAR.getMode())
|
||||
|| ObjectUtil.equal(resetMode, ResetModeEnum.MONTH.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.ROOM.getMode())
|
||||
|| ObjectUtil.equal(resetMode, ResetModeEnum.BODY.getMode());
|
||||
|| ObjectUtil.equal(resetMode, ResetModeEnum.MONTH.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.DAY.getMode())
|
||||
|| ObjectUtil.equal(resetMode, ResetModeEnum.BODY.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.ROOM.getMode());
|
||||
} else if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.ROOMNO, custBoardRuleCodeEnum)) {
|
||||
checkSuccess = ObjectUtil.equal(resetMode, ResetModeEnum.ORDER.getMode());
|
||||
} else if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.BODYNO, custBoardRuleCodeEnum)) {
|
||||
@@ -269,6 +279,13 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
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);
|
||||
|
||||
// 查询机构下全局序号
|
||||
CustomPlateNoSeqDO plateNoSeqByConfigId = customPlateNoSeqService.getOrgCustomPlateNoSeq();
|
||||
// 提前生成板编号序号,存在则不处理
|
||||
if (ObjectUtil.isNull(plateNoSeqByConfigId)) {
|
||||
customPlateNoSeqMapper.insert(new CustomPlateNoSeqDO());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user