Commit f0d71a38 authored by tianyiming's avatar tianyiming

refactor: 注释掉无效的参数设置并添加ES设备操作

refactor: 作废单位类型业务处理新索引数据,添加ES设备DAO注入及数据操作 refactor: 在SupervisionInfoMapper中添加对idx_biz_jg_supervision_info的删除操作
parent 25b9c03a
......@@ -29,7 +29,9 @@ 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.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
......@@ -225,6 +227,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
private ESEquipmentCategory esEquipmentCategory;
@Autowired
private EsEquipmentDao esEquipmentDao;
@Autowired
private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
......@@ -3322,6 +3326,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
superviseInfoMapper.deleteDataAll(records);
//删除es中的数据
esEquipmentCategory.deleteAll(esDtoList);
// 构建设备删除的 新索引的DTO 列表
List<ESEquipmentInfo> esNewDtoList = records.stream().map(v -> {
ESEquipmentInfo esDto = new ESEquipmentInfo();
esDto.setSEQUENCE_NBR(v);
return esDto;
}).collect(Collectors.toList());
//删除es新索引中的数据
esEquipmentDao.deleteAll(esNewDtoList);
//作废使用登记证 & 生成使用登记证的流水
this.invalidUseRegistrationCertificate(jgUseRegistration);
// 单据逻辑删除
......@@ -3361,6 +3373,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
equInfoEs.setProjectContraptionId(v.getOriginProjectContraptionId());
esEquipmentCategory.save(equInfoEs);
ESEquipmentInfo esEquipmentInfo = esEquipmentDao.findById(v.getEquId()).get();
esEquipmentInfo.setProjectContraptionId(v.getOriginProjectContraptionId());
esEquipmentDao.save(esEquipmentInfo);
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(v.getEquId()));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
......@@ -3737,6 +3753,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.eq(IdxBizJgOtherInfo::getRecord, record)
.select(IdxBizJgOtherInfo::getSupervisoryCode, IdxBizJgOtherInfo::getCode96333Type));
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
Optional<ESEquipmentInfo> esEquipmentDaoOptional = esEquipmentDao.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
// 非历史有证设备,作废清除使用登记证编号
......@@ -3758,6 +3776,28 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
if (esEquipmentDaoOptional.isPresent()) {
ESEquipmentInfo esEquipmentInfo = esEquipmentDaoOptional.get();
// 非历史有证设备,作废清除使用登记证编号
if (!"1".equals(jgUseRegistration.getRegType())) {
esEquipmentInfo.setUSE_ORG_CODE(null);
}
// 历史有证设备、历史无证设备,系统生成的96333清空
if (("1".equals(jgUseRegistration.getRegType()) || "2".equals(jgUseRegistration.getRegType())) && "2".equals(otherInfo.getCode96333Type())) {
esEquipmentInfo.setCODE96333(null);
}
esEquipmentInfo.setUSE_ORG_CODE(null);
//esEquipmentCategoryDto.setSTATUS(null);
esEquipmentInfo.setEQU_STATE(null);
esEquipmentInfo.setORG_BRANCH_CODE(null);
esEquipmentInfo.setORG_BRANCH_NAME(null);
if (jgConstructionInfo != null) {
esEquipmentInfo.setUSC_UNIT_NAME(jgConstructionInfo.getUscUnitName());
esEquipmentInfo.setUSC_UNIT_CREDIT_CODE(jgConstructionInfo.getUscUnitCreditCode());
}
esEquipmentDao.save(esEquipmentInfo);
}
}
/**
......
......@@ -51,9 +51,9 @@ public class DPSubController {
if (ValidationUtil.isEmpty(param.get("equList"))){
param.put("equList", param.get("EQU_LIST_CODE"));
}
if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){
param.put("PRODUCT_NAME", param.get("EQU_LIST"));
}
// if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){
// param.put("PRODUCT_NAME", param.get("EQU_LIST"));
// }
if (!ValidationUtil.isEmpty(param.get("equListCode"))){ // 问题列表关联设备
param.put("equList", param.get("equListCode"));
param.put("EQU_LIST_CODE", param.get("equListCode"));
......
......@@ -89,6 +89,10 @@
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_supervision_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_maintenance_record_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
......
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