Commit 4b9f939d authored by tianbo's avatar tianbo

fix(safety): 修复追溯单重复生成问题

- 修改了检验检测超期和维保超期检查的逻辑 - 排除了追溯表中未处理的超期设备记录
parent 36bcb92d
...@@ -1123,7 +1123,6 @@ ...@@ -1123,7 +1123,6 @@
) tt on tt."RECORD" = ui."RECORD" ) tt on tt."RECORD" = ui."RECORD"
WHERE si."ORG_BRANCH_CODE" like '50%' WHERE si."ORG_BRANCH_CODE" like '50%'
AND oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领') AND oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
AND (oi."STATUS" is null or oi."STATUS" = '1')
AND tt."NEXT_INSPECT_DATE" is not null AND tt."NEXT_INSPECT_DATE" is not null
</select> </select>
<select id="countBizFinishedNumForDP" resultType="java.lang.Long"> <select id="countBizFinishedNumForDP" resultType="java.lang.Long">
......
...@@ -82,16 +82,33 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -82,16 +82,33 @@ public class SafetyProblemTracingGenServiceImpl{
public void executeInspectionCheck() { public void executeInspectionCheck() {
logger.info("开始检验检测超期检查"); logger.info("开始检验检测超期检查");
Set<String> outOfInspectionEquipIds = safetyProblemTracingService.getBaseMapper().selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.JYCQ.getProblemTypeCode()))
.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toSet());
// 查询当天检验超期的设备 // 查询当天检验超期的设备
List<Map<String, Object>> outOfInspectionRecords = commonMapper.queryOutOfInspectionRecord(); List<Map<String, Object>> outOfInspectionRecords = commonMapper.queryOutOfInspectionRecord();
// 追溯表里未处理的检验超期设备需要排除在外
outOfInspectionRecords.removeIf(item -> outOfInspectionEquipIds.contains(String.valueOf(item.get("RECORD"))));
updateEquipAndSendMessage(outOfInspectionRecords, SafetyProblemTypeEnum.JYCQ); updateEquipAndSendMessage(outOfInspectionRecords, SafetyProblemTypeEnum.JYCQ);
logger.info("检验检测超期检查结束"); logger.info("检验检测超期检查结束");
} }
public void executeMaintenanceCheck() { public void executeMaintenanceCheck() {
logger.info("开始维保超期检查"); logger.info("开始维保超期检查");
Set<String> outOfMaintenanceEquipIds = safetyProblemTracingService.getBaseMapper().selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.WBCQ.getProblemTypeCode()))
.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toSet());
// 查询当天维保超期的设备 // 查询当天维保超期的设备
List<Map<String, Object>> outOfMaintenanceRecords = commonMapper.queryOutOfMaintenanceRecord(); List<Map<String, Object>> outOfMaintenanceRecords = commonMapper.queryOutOfMaintenanceRecord();
// 追溯表里未处理的维保超期设备需要排除在外
outOfMaintenanceRecords.removeIf(item -> outOfMaintenanceEquipIds.contains(String.valueOf(item.get("RECORD"))));
updateEquipAndSendMessage(outOfMaintenanceRecords, SafetyProblemTypeEnum.WBCQ); updateEquipAndSendMessage(outOfMaintenanceRecords, SafetyProblemTypeEnum.WBCQ);
logger.info("维保超期检查结束"); logger.info("维保超期检查结束");
} }
......
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