Commit 5b2cc3df authored by tianbo's avatar tianbo

fix(jg): 修复安全问题追踪逻辑与字段引用错误

- 修改CommonMapper.xml中删除标识字段引用错误,从s_delete改为is_delete - 移除EquipmentSafetyProblemRefreshHandler中未使用 - 优化SafetyProblemTopicMessage中日期解析逻辑,使用DateUtil工具类替换原有手动解析 - 在SafetyProblemTracingServiceImpl中增加空值校验,避免空指针异常
parent 8cc27be1
...@@ -2723,7 +2723,7 @@ ...@@ -2723,7 +2723,7 @@
WHERE WHERE
ei.use_unit_code IS NOT NULL ei.use_unit_code IS NOT NULL
AND ul.is_delete = 0 AND ul.is_delete = 0
and ei.s_delete = '0' and ei.is_delete = '0'
AND ul.expiry_date <![CDATA[<]]> to_char( now( ), 'YYYY-MM-DD' ) AND ul.expiry_date <![CDATA[<]]> to_char( now( ), 'YYYY-MM-DD' )
</select> </select>
......
package com.yeejoin.amos.boot.module.jg.biz.listener; package com.yeejoin.amos.boot.module.jg.biz.listener;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
...@@ -255,11 +256,7 @@ public class SafetyProblemTopicMessage extends EmqxListener { ...@@ -255,11 +256,7 @@ public class SafetyProblemTopicMessage extends EmqxListener {
if (problemTimeObj instanceof Long) { if (problemTimeObj instanceof Long) {
problemTime = new Date((Long) problemTimeObj); problemTime = new Date((Long) problemTimeObj);
} else if (problemTimeObj instanceof String && !((String) problemTimeObj).isEmpty()) { } else if (problemTimeObj instanceof String && !((String) problemTimeObj).isEmpty()) {
try { problemTime = DateUtil.parseDate((String) problemTimeObj);
problemTime = new Date(Long.parseLong((String) problemTimeObj));
} catch (NumberFormatException e) {
log.warn("无法解析problemTime: {}", problemTimeObj);
}
} else if (problemTimeObj instanceof Date) { } else if (problemTimeObj instanceof Date) {
problemTime = (Date) problemTimeObj; problemTime = (Date) problemTimeObj;
} }
......
package com.yeejoin.amos.boot.module.jg.biz.refresh.handler; package com.yeejoin.amos.boot.module.jg.biz.refresh.handler;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.entity.TzsDataRefreshMessage; import com.yeejoin.amos.boot.module.common.api.entity.TzsDataRefreshMessage;
import com.yeejoin.amos.boot.module.common.api.service.IDataRefreshHandler; import com.yeejoin.amos.boot.module.common.api.service.IDataRefreshHandler;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
...@@ -23,7 +22,6 @@ public class EquipmentSafetyProblemRefreshHandler implements IDataRefreshHandler ...@@ -23,7 +22,6 @@ public class EquipmentSafetyProblemRefreshHandler implements IDataRefreshHandler
private final IdxBizJgUseInfoServiceImpl useInfoService; private final IdxBizJgUseInfoServiceImpl useInfoService;
private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService; private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
private final EsEquipmentDao esEquipmentDao;
private final IdxBizJgMaintenanceRecordInfoServiceImpl maintenanceRecordInfoService; private final IdxBizJgMaintenanceRecordInfoServiceImpl maintenanceRecordInfoService;
private final SafetyProblemTracingServiceImpl safetyProblemTracingService; private final SafetyProblemTracingServiceImpl safetyProblemTracingService;
......
...@@ -72,8 +72,8 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -72,8 +72,8 @@ public class SafetyProblemTracingGenServiceImpl{
} }
@Scheduled(cron = "0 0 1 * * ?") @Scheduled(cron = "0 0 1 * * ?")
@SchedulerLock(name = "executePersonnalCertification", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M") @SchedulerLock(name = "executePersonnelCertification", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M")
public void executePersonnalCertification() { public void executePersonnelCertification() {
executePersonnalCertificationCheck(); executePersonnalCertificationCheck();
} }
......
...@@ -292,13 +292,13 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -292,13 +292,13 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
safetyProblemTracings.forEach(item -> { safetyProblemTracings.forEach(item -> {
// 一个设备某类未处理的问题只有一个,所以直接更新某个类型问题 // 一个设备某类未处理的问题只有一个,所以直接更新某个类型问题
if (item.getProblemTypeCode().equals(SafetyProblemTypeEnum.JYCQ.getProblemTypeCode()) if (item.getProblemTypeCode().equals(SafetyProblemTypeEnum.JYCQ.getProblemTypeCode())
&& inspectionDetectionInfo != null && !ValidationUtil.isEmpty(inspectionDetectionInfo) && !ValidationUtil.isEmpty(inspectionDetectionInfo.getNextInspectDate())
&& new Date().before(inspectionDetectionInfo.getNextInspectDate())) { && new Date().before(inspectionDetectionInfo.getNextInspectDate())) {
item.setProblemStatusCode(SafetyProblemStatusEnum.HANDLED.getCode()); item.setProblemStatusCode(SafetyProblemStatusEnum.HANDLED.getCode());
item.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getName()); item.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getName());
} }
if (item.getProblemTypeCode().equals(SafetyProblemTypeEnum.WBCQ.getProblemTypeCode()) if (item.getProblemTypeCode().equals(SafetyProblemTypeEnum.WBCQ.getProblemTypeCode())
&& lastMaintenanceRecordInfo != null && !ValidationUtil.isEmpty(lastMaintenanceRecordInfo) && !ValidationUtil.isEmpty(lastMaintenanceRecordInfo.getInformEnd())
&& new Date().before(lastMaintenanceRecordInfo.getInformEnd())) { && new Date().before(lastMaintenanceRecordInfo.getInformEnd())) {
item.setProblemStatusCode(SafetyProblemStatusEnum.HANDLED.getCode()); item.setProblemStatusCode(SafetyProblemStatusEnum.HANDLED.getCode());
item.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getName()); item.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getName());
......
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