自定义板编号配置:支持自定义/时间类型没有配置值不生成该部分

This commit is contained in:
gaoqr
2025-01-22 14:41:40 +08:00
parent e93c6c328a
commit b00d9221dd
@@ -22,6 +22,7 @@ import com.cf.imes.module.system.api.systemconfig.SystemConfigApi;
import com.cf.imes.module.system.api.systemconfig.dto.SystemConfigRespDTO;
import com.cf.imes.module.system.enums.customplateno.CustomPlateNoRuleCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
@@ -123,10 +124,13 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
// 遍历规则列表
for (CustomPlateNoRuleVO plateNoRule : orgCustomPlateNoRuleVOList) {
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.CUSTOM.getRuleCode(), plateNoRule.getRuleCode())) {
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getStrValue());
plateDO.getCustomPlateNoBuilder().append(Optional.ofNullable(plateNoRule.getStrValue()).orElse(""));
}
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.DATE.getRuleCode(), plateNoRule.getRuleCode())) {
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getNow().format(DateTimeFormatter.ofPattern(plateNoRule.getDateValue())));
String dateValue = plateNoRule.getDateValue();
if (StringUtils.isNotEmpty(dateValue)) {
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getNow().format(DateTimeFormatter.ofPattern(dateValue)));
}
}
// 遍历规则生成服务列表,获取对应的规则服务
for (CustomPlateNoGenerateRuleService ruleService : ruleServices) {