Commit d40ef5af authored by suhuiguang's avatar suhuiguang

1.生产bug处理

parent 14e0b571
...@@ -20,4 +20,12 @@ public interface JgInstallationNoticeEqMapper extends CustomBaseMapper<JgInstall ...@@ -20,4 +20,12 @@ public interface JgInstallationNoticeEqMapper extends CustomBaseMapper<JgInstall
* @return List<JgInstallationNoticeEq> 管道record数组 * @return List<JgInstallationNoticeEq> 管道record数组
*/ */
List<JgInstallationNoticeEq> selectErrorRecordOfInIntoManage(); List<JgInstallationNoticeEq> selectErrorRecordOfInIntoManage();
/**
* 查询安装告知(非删除、已作废)的装置id和设备的使用信息装置id不一样的设备
*
* @return List<JgInstallationNoticeEq> 管道record数组
*/
List<JgInstallationNoticeEq> selectPCIdNeErrorPieLineInUseInfo();
} }
...@@ -59,4 +59,11 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -59,4 +59,11 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
* @return 登记关联的告知 * @return 登记关联的告知
*/ */
JgInstallationNotice selectNoticeDataByUseRegisterId(@Param("useRegisterId") String useRegisterId ); JgInstallationNotice selectNoticeDataByUseRegisterId(@Param("useRegisterId") String useRegisterId );
/**
*
* 查询按照告知已完成但是未生成装置的施工信息的安装告知单据
* @return 已完成但是未生成装置的施工信息的安装告知单据列表
*/
List<JgInstallationNotice> selectNotInsertProjectConstructionInstallNoticeList();
} }
...@@ -17,4 +17,21 @@ ...@@ -17,4 +17,21 @@
and (u."IS_INTO_MANAGEMENT" = false or u."IS_INTO_MANAGEMENT" is null) and (u."IS_INTO_MANAGEMENT" = false or u."IS_INTO_MANAGEMENT" is null)
and n.project_contraption <![CDATA[<>]]> '' and n.project_contraption <![CDATA[<>]]> ''
</select> </select>
<select id="selectPCIdNeErrorPieLineInUseInfo" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq">
SELECT
distinct ne.equ_id as equ_id
FROM
"tzs_jg_installation_notice" n,
tzs_jg_installation_notice_eq ne,
"idx_biz_jg_use_info" u,
idx_biz_jg_project_contraption pc
WHERE
ne.equip_transfer_id = n.sequence_nbr
and ne.equ_id = u."RECORD"
and pc.sequence_nbr = n.project_contraption_id
and n.is_delete = '0'
and n.notice_status != '6617'
and u.project_contraption_id != n.project_contraption_id
and pc."rec_user_name" LIKE '%杨生元%' AND pc."rec_date" >= '2025-01-06 00:00:00'
</select>
</mapper> </mapper>
...@@ -337,4 +337,16 @@ ...@@ -337,4 +337,16 @@
) )
limit 1 limit 1
</select> </select>
<select id="selectNotInsertProjectConstructionInstallNoticeList"
resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice">
select
*
from
"tzs_jg_installation_notice" n
WHERE
n.notice_status = '6616'
and n.is_delete = '0'
and n.project_contraption_id <![CDATA[ <> ]]> ''
and not EXISTS (select 1 from idx_biz_jg_project_construction c where c.record=n.sequence_nbr)
</select>
</mapper> </mapper>
...@@ -94,4 +94,22 @@ public class DataHandlerController extends BaseController { ...@@ -94,4 +94,22 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@ApiOperation(httpMethod = "PUT", value = "20250108-刷管道,设备使用信息表装置id未更新,导致的错误数据处理,已es为准", notes = "历史数据处理")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/v3/projectContraption/useInfo")
public ResponseModel<Boolean> projectUseInfoUpdateV3(){
dataHandlerService.projectUseInfoUpdateV3();
return ResponseHelper.buildResponse(true);
}
@ApiOperation(httpMethod = "PUT", value = "20250108-1220上线时, 已完成安装告知管道未写入装置的施工信息表(导致使用登记不能回显施工信息),刷库", notes = "历史数据处理")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/v3/projectContraption/info")
public ResponseModel<Boolean> projectContraptionInfoUpdateV3(){
dataHandlerService.projectContraptionInfoUpdateV3();
return ResponseHelper.buildResponse(true);
}
} }
...@@ -12,13 +12,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -12,13 +12,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
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.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.SnowflakeIdUtil; 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.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum; import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
...@@ -116,6 +116,8 @@ public class DataHandlerServiceImpl { ...@@ -116,6 +116,8 @@ public class DataHandlerServiceImpl {
IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService; IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
@Autowired @Autowired
private IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper; private IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
/** /**
...@@ -660,11 +662,18 @@ public class DataHandlerServiceImpl { ...@@ -660,11 +662,18 @@ public class DataHandlerServiceImpl {
if(!projectContraptionList.isEmpty()){ if(!projectContraptionList.isEmpty()){
projectContraptionService.saveBatch(projectContraptionList); projectContraptionService.saveBatch(projectContraptionList);
} }
// 更新设备es的装置id // 更新设备es的装置id、使用信息的装置id
projectContraptionIdRecordsMap.forEach((k,v)->{ projectContraptionIdRecordsMap.forEach((k,v)->{
Iterable<ESEquipmentCategoryDto> equipmentCategories = esEquipmentCategory.findAllById(v); Iterable<ESEquipmentCategoryDto> equipmentCategories = esEquipmentCategory.findAllById(v);
equipmentCategories.forEach(e-> e.setProjectContraptionId(k + "")); equipmentCategories.forEach(e-> e.setProjectContraptionId(k + ""));
esEquipmentCategory.saveAll(equipmentCategories); esEquipmentCategory.saveAll(equipmentCategories);
Collection<IdxBizJgUseInfo> useInfos = useInfoService.listByIds(v);
useInfos.forEach(u->{
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, u.getRecord());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, u.getProjectContraptionId());
useInfoService.update(updateWrapper);
});
}); });
List<JgInstallationNoticeEq> eqsAfter = jgInstallationNoticeEqMapper.selectErrorRecordOfInIntoManage(); List<JgInstallationNoticeEq> eqsAfter = jgInstallationNoticeEqMapper.selectErrorRecordOfInIntoManage();
log.info("处理后统计:3.安装告知完成但是设备状态未非已纳管状态的设备数量:{}", eqsAfter.size()); log.info("处理后统计:3.安装告知完成但是设备状态未非已纳管状态的设备数量:{}", eqsAfter.size());
...@@ -705,8 +714,8 @@ public class DataHandlerServiceImpl { ...@@ -705,8 +714,8 @@ public class DataHandlerServiceImpl {
idxBizJgProjectConstruction.setConstructionOtherAccessories(installationNotice.getOtherAccessories()); idxBizJgProjectConstruction.setConstructionOtherAccessories(installationNotice.getOtherAccessories());
idxBizJgProjectConstruction.setRecDate(new Date()); idxBizJgProjectConstruction.setRecDate(new Date());
idxBizJgProjectConstruction.setRecUserId(RequestContext.getExeUserId()); idxBizJgProjectConstruction.setRecUserId(RequestContext.getExeUserId());
// 获取施工类型id
LambdaQueryWrapper<DataDictionary> lambda = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DataDictionary> lambda = new LambdaQueryWrapper<>();
// 获取施工类型id
lambda.eq(DataDictionary::getType, CONSTRUCTION_TYPE); lambda.eq(DataDictionary::getType, CONSTRUCTION_TYPE);
lambda.eq(DataDictionary::getName, CONSTRUCTION_TYPE_NAME); lambda.eq(DataDictionary::getName, CONSTRUCTION_TYPE_NAME);
List<DataDictionary> dataDictionaries = dataDictionaryMapper.selectList(lambda); List<DataDictionary> dataDictionaries = dataDictionaryMapper.selectList(lambda);
...@@ -851,4 +860,46 @@ public class DataHandlerServiceImpl { ...@@ -851,4 +860,46 @@ public class DataHandlerServiceImpl {
List<IdxBizJgProjectContraption> projectConstructionsAfter = idxBizJgProjectContraptionMapper.selectErrorManagementProject(); List<IdxBizJgProjectContraption> projectConstructionsAfter = idxBizJgProjectContraptionMapper.selectErrorManagementProject();
log.info("处理后:安装告知审批完成但是装置是否纳管状态不正确的数据量:{}", projectConstructionsAfter.size()); log.info("处理后:安装告知审批完成但是装置是否纳管状态不正确的数据量:{}", projectConstructionsAfter.size());
} }
@Transactional(rollbackFor = Exception.class)
public void projectUseInfoUpdateV3() {
List<JgInstallationNoticeEq> eqs = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo();
log.info("处理前:查询安装告知(非删除、已作废)的装置id和设备的使用信息装置id不一样的设备:{}", eqs.size());
eqs.forEach(eq->{
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getEquId());
equInfosWithEs.ifPresent(equInfoEs -> {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, equInfoEs.getSEQUENCE_NBR());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, equInfoEs.getProjectContraptionId());
useInfoService.update(updateWrapper);
});
});
List<JgInstallationNoticeEq> eqsAfter = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo();
log.info("处理后:查询安装告知(非删除、已作废)的装置id和设备的使用信息装置id不一样的设备:{}", eqsAfter.size());
}
@Transactional(rollbackFor = Exception.class)
public void projectContraptionInfoUpdateV3() {
// 1220上线时, 已完成安装告知管道未写入装置的施工信息表的告知单据查询
List<JgInstallationNotice> noticeList = getNotInsertProjectConstructionInstallNotice();
log.info("处理前统计:1.管道已完成安装告知,但是未写入装置的施工信息表的告知单据数量:{}", noticeList.size());
for(JgInstallationNotice installationNotice : noticeList){
List<JgInstallationNoticeEq> noticeEqs = installationNoticeEqService.list(new LambdaQueryWrapper<JgInstallationNoticeEq>()
.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr()).
select(JgInstallationNoticeEq::getEquId));
if(noticeEqs.isEmpty()){
continue;
}
List<String> records = noticeEqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList());
// 安装告知完成后,创建装置的施工信息表
saveProjectConstructionAfterFinish(installationNotice, true, noticeEqs, Long.parseLong(installationNotice.getProjectContraptionId()), records);
}
List<JgInstallationNotice> noticeListAfter = getNotInsertProjectConstructionInstallNotice();
log.info("处理后统计:1.管道已完成安装告知,但是未写入装置的施工信息表的告知单据数量:{}", noticeListAfter.size());
}
private List<JgInstallationNotice> getNotInsertProjectConstructionInstallNotice() {
return jgInstallationNoticeMapper.selectNotInsertProjectConstructionInstallNoticeList();
}
} }
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