Commit 2d4f8393 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

parents 6f4ec3e8 5f8aa960
......@@ -2845,26 +2845,51 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if ("his".equals(equipInfoDto.getDataSource())) {
String useRegistrationCode = equipInfoDto.getUseOrgCode();
String key = useRegistrationCode.substring(0, 5);
if(redisUtils.hasKey(key)){
String extractedValue = useRegistrationCode.substring(5, 10);
String extractedYearStr = useRegistrationCode.substring(useRegistrationCode.indexOf('(') + 1, useRegistrationCode.indexOf(')'));
int currentYearLastTwoDigits = LocalDate.now().getYear() % 100;
try {
int extractedNumber = Integer.parseInt(extractedValue);
ValueOperations<String, String> valueOps = redisTemplate.opsForValue();
String currentSequenceStr = valueOps.get(key);
assert currentSequenceStr != null;
int redisNumber = Integer.parseInt(currentSequenceStr);
int extractedYear = Integer.parseInt(extractedYearStr);
if (extractedNumber > redisNumber && currentYearLastTwoDigits == extractedYear) {
throw new BadRequest("登记证编号不能使用系统还未生成编号!");
//使用登记证编号判断是否使用未来系统生成编号
String key = useRegistrationCode.length() >= 5 ? useRegistrationCode.substring(0, 5) : useRegistrationCode;
List<String> prefixes = Collections.unmodifiableList(Arrays.asList("容", "锅", "管", "瓶", "梯", "起", "索", "游", "车"));
//容15鲁G00302(12)
if (useRegistrationCode.length() == 14 && prefixes.stream().anyMatch(key::startsWith) && redisUtils.hasKey(useRegistrationCode.substring(0, 5))) {
String prefix = useRegistrationCode.substring(0, 3);
// 如果 prefix 不等于 "瓶31" 或 "瓶32" 则继续执行逻辑
ValueOperations<String, String> valueOps = redisTemplate.opsForValue();
String currentSequenceStr = valueOps.get(key);
if (Stream.of("瓶31", "瓶32").noneMatch(prefix::equals) && currentSequenceStr != null) {
String extractedValue = useRegistrationCode.substring(5, 10);
String extractedYearStr = useRegistrationCode.substring(useRegistrationCode.indexOf('(') + 1, useRegistrationCode.indexOf(')'));
int currentYearLastTwoDigits = LocalDate.now().getYear() % 100;
try {
// 提取年份
int extractedYear = Integer.parseInt(extractedYearStr);
if(currentYearLastTwoDigits == extractedYear){
if (Character.isLetter(extractedValue.charAt(0))) {
// 提取字母部分并比较
char extractedLetter = extractedValue.charAt(0);
int extractedNumber = Integer.parseInt(extractedValue.substring(1)); // 提取数字部分
// 提取 Redis 中的字母和数字部分
char redisLetter = currentSequenceStr.charAt(0);
//redis中不是字母开头,输入的是字母开头
if (!Character.isLetter(redisLetter) ) {
throw new BadRequest("登记证编号不能使用系统还未生成编号!");
}
int redisNumber = Integer.parseInt(currentSequenceStr.substring(1));
// 比较字母和数字
if ((extractedLetter > redisLetter || (extractedLetter == redisLetter && extractedNumber > redisNumber))) {
throw new BadRequest("登记证编号不能使用系统还未生成编号!");
}
} else {
// 如果首字符不是字母,直接进行字符串比较
if (extractedValue.compareTo(currentSequenceStr) > 0) {
throw new BadRequest("登记证编号不能使用系统还未生成编号!");
}
}
}
} catch (NumberFormatException e) {
throw new BadRequest("数据格式错误");
}
} catch (NumberFormatException e) {
throw new BadRequest("数据格式错误");
}
}
}
......@@ -3297,7 +3322,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result));
checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result);
checkNotBlank(data.getInspectOrgCode(), "检测机构代码不能为空;", result);
checkInspectOrg(data.getInspectOrgCode(), result);
//checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构
checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result);
checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result);
checkDateFormatCorrect(data.getInspectDate(), "检测日期格式不正确;", result);
......
......@@ -13,7 +13,9 @@ import com.github.pagehelper.util.StringUtil;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -1128,9 +1130,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgRegisterInfo idxBizJgRegisterInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(jgRelationEquip);
String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine())
.orElse(idxBizJgRegisterInfo.getEquCategory());
String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
......@@ -1287,7 +1287,19 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
public void genJgCertificateChangeRecord(JgInstallationNotice jgInstallationNotice, Long sequenceNbr, String registrationCode, IdxBizJgRegisterInfo idxBizJgRegisterInfo, TaskV2Model taskV2Model1) {
private IdxBizJgRegisterInfo getIdxBizJgRegisterInfo(JgInstallationNoticeEq jgRelationEquip) {
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
return tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
}
private IdxBizJgRegisterInfo getIdxBizJgRegisterInfo2(JgInstallationNoticeEq jgRelationEquip) {
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
queryWrapper2.select(TzsBaseEntity::getSequenceNbr,IdxBizJgRegisterInfo::getRecord, IdxBizJgRegisterInfo::getEquCodeType);
return tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
}
private void genJgCertificateChangeRecord(JgInstallationNotice jgInstallationNotice, Long sequenceNbr, String registrationCode, IdxBizJgRegisterInfo idxBizJgRegisterInfo, TaskV2Model taskV2Model1) {
// 生成一条tzs_jg_certificate_change_record记录
JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord();
jgCertificateChangeRecord.setApplyNo(jgInstallationNotice.getApplyNo());
......@@ -1577,29 +1589,93 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) {
// 2.1 数据库的的USE_UNIT_CREDIT_CODE赋空
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr());
queryWrapper.select(JgInstallationNoticeEq::getEquipTransferId, BaseEntity::getSequenceNbr,JgInstallationNoticeEq::getEquId);
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
jgInstallationNoticeEqs.forEach(jgRelationEquip -> {
// 强制更新字段为 NULL
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, jgRelationEquip.getEquId()); // 设置更新条件
updateWrapper.set(IdxBizJgUseInfo::getUseUnitCreditCode, null);
updateWrapper.set(IdxBizJgUseInfo::getUseUnitName, null);
useInfoService.update(updateWrapper);
// 2.2 es的USE_UNIT_CREDIT_CODE赋空
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(jgRelationEquip.getEquId());
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(null);
esEquipmentCategoryDto.setUSE_UNIT_NAME(null);
esEquipmentCategory.save(esEquipmentCategoryDto);
}
// 1.use_info 回退
this.rollBackUseInfo(jgRelationEquip);
// 2.other_info 回退
this.rollBackOtherInfo(jgRelationEquip);
// 3.supervise_info回退
this.rollBackSuperviseInfo(jgRelationEquip);
// 4.设备代码 回退
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo2(jgRelationEquip);
this.rollBackRegisterInfo(jgRelationEquip, idxBizJgRegisterInfo);
// 5.es 回退
this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo);
});
}
private void rollBackEsInfo(JgInstallationNoticeEq jgRelationEquip, IdxBizJgRegisterInfo idxBizJgRegisterInfo) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(jgRelationEquip.getEquId());
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(null);
esEquipmentCategoryDto.setUSE_UNIT_NAME(null);
esEquipmentCategoryDto.setORG_BRANCH_CODE(null);
esEquipmentCategoryDto.setORG_BRANCH_NAME(null);
esEquipmentCategoryDto.setSUPERVISORY_CODE(null);
esEquipmentCategoryDto.setCODE96333(null);
esEquipmentCategoryDto.setUSE_PLACE(null);
esEquipmentCategoryDto.setUSE_PLACE_CODE(null);
esEquipmentCategoryDto.setADDRESS(null);
if (EquCodeTypeEnum.SYSTEM_GENERATED.getCode().equals(idxBizJgRegisterInfo.getEquCodeType())){
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
private void rollBackRegisterInfo(JgInstallationNoticeEq jgRelationEquip, IdxBizJgRegisterInfo idxBizJgRegisterInfo) {
if (EquCodeTypeEnum.SYSTEM_GENERATED.getCode().equals(idxBizJgRegisterInfo.getEquCodeType())) {
// 如果设备代码是系统自动生成,回退注册信息表的设备代码字段
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
updateWrapper.set(IdxBizJgRegisterInfo::getEquCode, null);
tzsJgRegistrationInfoMapper.update(null,updateWrapper);
}
}
private void rollBackSuperviseInfo(JgInstallationNoticeEq jgRelationEquip) {
LambdaUpdateWrapper<IdxBizJgSupervisionInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
updateWrapper.set(IdxBizJgSupervisionInfo::getOrgBranchCode, null);
updateWrapper.set(IdxBizJgSupervisionInfo::getOrgBranchName, null);
updateWrapper.set(IdxBizJgSupervisionInfo::getCompanyOrgBranchCode, null);
idxBizJgSupervisionInfoMapper.update(null, updateWrapper);
}
private void rollBackOtherInfo(JgInstallationNoticeEq jgRelationEquip) {
LambdaUpdateWrapper<OtherInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AbstractEquipBaseEntity::getRecord,jgRelationEquip.getEquId());
updateWrapper.set(OtherInfo::getCode96333, null);
updateWrapper.set(OtherInfo::getSupervisoryCode, null);
tzsJgOtherInfoMapper.update(null, updateWrapper);
}
private void rollBackUseInfo(JgInstallationNoticeEq jgRelationEquip) {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, jgRelationEquip.getEquId()); // 设置更新条件
// 强制更新字段为 NULL
updateWrapper.set(IdxBizJgUseInfo::getUseUnitCreditCode, null);
updateWrapper.set(IdxBizJgUseInfo::getUseUnitName, null);
updateWrapper.set(IdxBizJgUseInfo::getProvince, null);
updateWrapper.set(IdxBizJgUseInfo::getProvinceName, null);
updateWrapper.set(IdxBizJgUseInfo::getCity, null);
updateWrapper.set(IdxBizJgUseInfo::getCityName, null);
updateWrapper.set(IdxBizJgUseInfo::getCounty, null);
updateWrapper.set(IdxBizJgUseInfo::getCountyName, null);
updateWrapper.set(IdxBizJgUseInfo::getFactoryUseSiteStreet, null);
updateWrapper.set(IdxBizJgUseInfo::getStreetName, null);
updateWrapper.set(IdxBizJgUseInfo::getIsNotXiXian, null);
updateWrapper.set(IdxBizJgUseInfo::getEstateUnitCreditCode, null);
updateWrapper.set(IdxBizJgUseInfo::getEstateUnitName, null);
updateWrapper.set(IdxBizJgUseInfo::getAddress, null);
useInfoService.update(updateWrapper);
}
@Transactional
@Override
public Boolean historyDataRepair() {
......
......@@ -405,7 +405,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
// 设置检验、检测资质信息
setBaseUnitLicences(unitCode, jyjcOpeningApplicationModel, true);
// 设置检验、检测人员信息
setJYJCUserList(unitCode, jyjcOpeningApplicationModel, false, jyjcOpeningApplicationModel.getOpenBizType());
setJYJCUserList(unitCode, jyjcOpeningApplicationModel, false, "jy,jc");
} else {
jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel();
jyjcOpeningApplicationModel.setResultType("input");
......
......@@ -81,13 +81,13 @@ public class EquipTechParamPipeline extends AbstractEquipBaseEntity {
*/
@TableField(value = "\"NOMINAL_DIAMETER\"")
private BigDecimal nominalDiameter;
private String nominalDiameter;
/**
* * 公称壁厚
*/
@TableField(value = "\"WALL_THICKNESS\"")
private BigDecimal wallThickness;
private String wallThickness;
/**
* * 管道长度 (单位:m)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment