Commit 288959d2 authored by tianyiming's avatar tianyiming

安装告知、使用登记审批完成后作废流程设备需要修改为未纳管

parent cf3731b4
package com.yeejoin.amos.boot.module.jg.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
@AllArgsConstructor
/**
* 使用登记审批完成后作废流程
* 设备需要修改为未纳管类别
*/
public enum UseRegisterCancelEquipEnum {
ldsqzj("流动式起重机", "4400"),
jdgycl("机动工业车辆", "5100"),
fglylyggcl("非公路用旅游观光车辆", "5200"),
qp("气瓶", "2300");
private final String name;
private final String code;
public static String getMessage(String code) {
for (UseRegisterCancelEquipEnum constants : values()) {
if (constants.getCode().equals(code)) {
return constants.getName();
}
}
return null;
}
public static List<String> getCodes() {
List<String> codes = new ArrayList<>();
for (UseRegisterCancelEquipEnum constants : values()) {
codes.add(constants.getCode());
}
return codes;
}
public static Map<Integer,String> getName=new HashMap<>();
public static Map<String,Integer> getCode=new HashMap<>();
static {
for (ConstructionEnum e : ConstructionEnum.values()){
getName.put(e.code, e.name);
getCode.put(e.name, e.code);
}
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
......@@ -1501,28 +1501,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
this.updateById(installationNotice);
// 2.更新关联的业务
this.processElseDataByStatus(Objects.requireNonNull(FlowStatusEnum.getEumByCode(Integer.parseInt(oldNoticeStatus))), installationNotice);
// 3.更新ES、IdxBizJgUseInfo中关联设备为未纳管
Map<String, Map<String, Object>> objMap = new HashMap<>();
LambdaQueryWrapper<JgInstallationNoticeEq> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(lambdaQueryWrapper);
if (!ObjectUtils.isEmpty(jgInstallationNoticeEqs) && jgInstallationNoticeEqs.size() > 0) {
for (JgInstallationNoticeEq jgInstallationNoticeEq : jgInstallationNoticeEqs) {
// 组装修改es条件及数据
Map<String, Object> map = new HashMap<>();
map.put("IS_INTO_MANAGEMENT", Boolean.FALSE);
objMap.put(jgInstallationNoticeEq.getEquId(), map);
}
}
// 组装更新IdxBizJgUseInfo条件
LambdaQueryWrapper<IdxBizJgUseInfo> jgUseInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
jgUseInfoLambdaQueryWrapper.in(IdxBizJgUseInfo::getRecord, jgInstallationNoticeEqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList()));
List<IdxBizJgUseInfo> list = idxBizJgUseInfoMapper.selectList(jgUseInfoLambdaQueryWrapper);
for (IdxBizJgUseInfo useInfo : list) {
useInfo.setIsIntoManagement(Boolean.FALSE);
}
idxBizJgUseInfoService.saveOrUpdateBatch(list);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
return installationNotice;
}
......@@ -1585,6 +1563,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
updateWrapper.eq(IdxBizJgUseInfo::getRecord, jgRelationEquip.getEquId()); // 设置更新条件
updateWrapper.set(IdxBizJgUseInfo::getUseUnitCreditCode, null);
updateWrapper.set(IdxBizJgUseInfo::getUseUnitName, null);
updateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, Boolean.FALSE);
useInfoService.update(updateWrapper);
// 2.2 es的USE_UNIT_CREDIT_CODE赋空
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(jgRelationEquip.getEquId());
......@@ -1592,6 +1571,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(null);
esEquipmentCategoryDto.setUSE_UNIT_NAME(null);
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.FALSE);
esEquipmentCategory.save(esEquipmentCategoryDto);
}
});
......
......@@ -2352,20 +2352,31 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
List<JgUseRegistrationEq> eqList = jgRelationEquipMapper.selectList(eqLambdaQueryWrapper);
eqList.forEach(e -> {
String record = e.getEquId();
Boolean flag = Boolean.FALSE;
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(IdxBizJgRegisterInfo::getRecord, record);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaQueryWrapper);
if (!ObjectUtils.isEmpty(idxBizJgRegisterInfo)) {
String equCategory = idxBizJgRegisterInfo.getEquCategory();
List<String> codes = UseRegisterCancelEquipEnum.getCodes();
if (codes.contains(equCategory)) {
flag = Boolean.TRUE;
}
}
// 1.使用信息表部分字段赋空
this.rollBackUseInfo(record);
this.rollBackUseInfo(record, flag);
// 2.回滚更新idx_biz_jg_register_info表
this.rollBackRegisterInfo(record);
// 3.回滚更新idx_biz_jg_supervision_info表
this.rollBackSupervisionInfo(record);
// 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS
this.rollBackForEquipEsInfo(record);
this.rollBackForEquipEsInfo(record, flag);
// 5.检验检测流水表-找不到关系暂不更新(删除)
// 6.idx_biz_jg_other_info表监管码、96333、claimStatus,监管码、96333、claimStatus
});
}
private void rollBackForEquipEsInfo(String record) {
private void rollBackForEquipEsInfo(String record, Boolean flag) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
......@@ -2374,6 +2385,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
esEquipmentCategoryDto.setEQU_STATE(null);
esEquipmentCategoryDto.setORG_BRANCH_CODE(null);
esEquipmentCategoryDto.setORG_BRANCH_NAME(null);
if (flag) {
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.FALSE);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
......@@ -2439,7 +2453,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
idxBizJgRegisterInfoService.update(updateWrapper);
}
private void rollBackUseInfo(String record) {
private void rollBackUseInfo(String record, Boolean flag) {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
updateWrapper.set(IdxBizJgUseInfo::getCity, null);
......@@ -2459,6 +2473,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
updateWrapper.set(IdxBizJgUseInfo::getSafetyManagerId, null);
updateWrapper.set(IdxBizJgUseInfo::getSafetyManager, null);
updateWrapper.set(IdxBizJgUseInfo::getFactoryUseSiteStreet, null);
if (flag) {
updateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, Boolean.FALSE);
}
useInfoMapper.update(null, updateWrapper);
}
......
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