Commit da34e0d0 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_bugfix

parents 27a26a7d 5f8aa960
...@@ -13,7 +13,9 @@ import com.github.pagehelper.util.StringUtil; ...@@ -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.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; 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.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.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.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -1128,9 +1130,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1128,9 +1130,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId()); queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1); OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryWrapper2 = new LambdaQueryWrapper<>(); IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(jgRelationEquip);
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgRegisterInfo idxBizJgRegisterInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine()) String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine())
.orElse(idxBizJgRegisterInfo.getEquCategory()); .orElse(idxBizJgRegisterInfo.getEquCategory());
String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm; String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
...@@ -1287,7 +1287,19 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -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记录 // 生成一条tzs_jg_certificate_change_record记录
JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord(); JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord();
jgCertificateChangeRecord.setApplyNo(jgInstallationNotice.getApplyNo()); jgCertificateChangeRecord.setApplyNo(jgInstallationNotice.getApplyNo());
...@@ -1577,29 +1589,93 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1577,29 +1589,93 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} }
private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) { private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) {
// 2.1 数据库的的USE_UNIT_CREDIT_CODE赋空
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr()); queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr());
queryWrapper.select(JgInstallationNoticeEq::getEquipTransferId, BaseEntity::getSequenceNbr,JgInstallationNoticeEq::getEquId);
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper); List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
jgInstallationNoticeEqs.forEach(jgRelationEquip -> { jgInstallationNoticeEqs.forEach(jgRelationEquip -> {
// 强制更新字段为 NULL // 1.use_info 回退
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); this.rollBackUseInfo(jgRelationEquip);
updateWrapper.eq(IdxBizJgUseInfo::getRecord, jgRelationEquip.getEquId()); // 设置更新条件 // 2.other_info 回退
updateWrapper.set(IdxBizJgUseInfo::getUseUnitCreditCode, null); this.rollBackOtherInfo(jgRelationEquip);
updateWrapper.set(IdxBizJgUseInfo::getUseUnitName, null); // 3.supervise_info回退
useInfoService.update(updateWrapper); this.rollBackSuperviseInfo(jgRelationEquip);
// 2.2 es的USE_UNIT_CREDIT_CODE赋空 // 4.设备代码 回退
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(jgRelationEquip.getEquId()); IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo2(jgRelationEquip);
if (optional.isPresent()) { this.rollBackRegisterInfo(jgRelationEquip, idxBizJgRegisterInfo);
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); // 5.es 回退
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(null); this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo);
esEquipmentCategoryDto.setUSE_UNIT_NAME(null);
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}); });
} }
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 @Transactional
@Override @Override
public Boolean historyDataRepair() { public Boolean historyDataRepair() {
......
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