From 0af2a8b43b8ba614f6ad89f9bb65ecfa12fb777c Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Fri, 27 Sep 2024 10:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspur/ipc/domain/IpcRunningStatusRecord.java | 6 +++--- .../inspur/ipc/service/IIpcMonitorFieldService.java | 5 +++++ .../service/impl/IpcMonitorFieldServiceImpl.java | 13 ++++++++++--- .../ipc/utils/IpcRedisCacheConfiguration.java | 8 ++++---- .../mapper/ipc/IpcRunningStatusRecordMapper.xml | 12 ++++++------ 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcRunningStatusRecord.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcRunningStatusRecord.java index a0a6bd3..b7cf95d 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcRunningStatusRecord.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcRunningStatusRecord.java @@ -9,7 +9,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; /** - * 运行状态记录对象 ipc_running_status_record + * 产线运行状态记录对象 ipc_running_status_record_dept * * @author inspur * @date 2024-04-09 @@ -31,8 +31,8 @@ public class IpcRunningStatusRecord extends BaseEntity { /** * 开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date startTime; private Long detpId; diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcMonitorFieldService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcMonitorFieldService.java index 1c9d033..87163bd 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcMonitorFieldService.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcMonitorFieldService.java @@ -67,6 +67,11 @@ public interface IIpcMonitorFieldService */ public List selectFieldDataByType(String fieldType); + /** + * 更新缓存 + */ + public List updateFieldDataByType(String fieldType); + /** * 获取监测设备 */ diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcMonitorFieldServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcMonitorFieldServiceImpl.java index 00e8ec9..7a5af87 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcMonitorFieldServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcMonitorFieldServiceImpl.java @@ -101,12 +101,19 @@ public class IpcMonitorFieldServiceImpl implements IIpcMonitorFieldService { public List selectFieldDataByType(String type) { List list = redisCache.getCacheObject(CacheConstants.IPC_PREFIX + type); if (list == null || list.isEmpty()) { - list = ipcMonitorFieldMapper.selectFieldDataByType(type); - redisCache.setCacheObject(CacheConstants.IPC_PREFIX + type, list); + list = this.updateFieldDataByType(type); } return list; } - + /** + * 更新缓存 + */ + @Override + public List updateFieldDataByType(String fieldType){ + List list = ipcMonitorFieldMapper.selectFieldDataByType(fieldType); + redisCache.setCacheObject(CacheConstants.IPC_PREFIX + fieldType, list); + return list; + } /** * 获取监测设备 */ diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcRedisCacheConfiguration.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcRedisCacheConfiguration.java index 6e88901..66631c7 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcRedisCacheConfiguration.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcRedisCacheConfiguration.java @@ -26,10 +26,10 @@ public class IpcRedisCacheConfiguration { */ @PostConstruct public void preloadedRedisCache(){ - iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_EQUIP_KEY); - iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY); - iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); - iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_READ_KEY); + iIpcMonitorFieldService.updateFieldDataByType(CacheConstants.MONITOR_EQUIP_KEY); + iIpcMonitorFieldService.updateFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY); + iIpcMonitorFieldService.updateFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); + iIpcMonitorFieldService.updateFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_READ_KEY); iIpcAlarmRulesConfigService.updateRedisCache(); iIpcRunningStatusRecordService.selectLatestStatus(); } diff --git a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcRunningStatusRecordMapper.xml b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcRunningStatusRecordMapper.xml index 17c7aae..9b052f7 100644 --- a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcRunningStatusRecordMapper.xml +++ b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcRunningStatusRecordMapper.xml @@ -12,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, running_status, start_time,dept_id from ipc_running_status_record + select id, running_status, start_time,dept_id from ipc_running_status_record_dept - insert into ipc_running_status_record + insert into ipc_running_status_record_dept running_status, start_time, @@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update ipc_running_status_record + update ipc_running_status_record_dept running_status = #{runningStatus}, start_time = #{startTime}, @@ -54,17 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from ipc_running_status_record where id = #{id} + delete from ipc_running_status_record_dept where id = #{id} - delete from ipc_running_status_record where id in + delete from ipc_running_status_record_dept where id in #{id}