From 9beb7275ba40754a425edf214ca1a67a87196c22 Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Wed, 10 Apr 2024 15:50:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=A0=E6=84=9F=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E6=94=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ipc/IpcDataReceiveController.java | 68 ++++---- .../common/constant/CacheConstants.java | 21 ++- .../datasyn/modbus/IPCDataSyncTask.java | 2 +- .../datasyn/modbus/IPCPlcDataSyncThread.java | 37 ++-- .../modbus/IPCSensorDataSyncThread.java | 6 +- .../ipc/domain/IpcBg4gszhp01tempdata.java | 162 ++++++++++++++++++ .../ipc/service/IIpcDataReceiveService.java | 10 ++ .../IIpcRunningStatusRecordService.java | 1 + .../impl/IpcAlarmRulesConfigServiceImpl.java | 2 +- .../service/impl/IpcDataLogServiceImpl.java | 2 - .../impl/IpcDataReceiveServiceImpl.java | 99 +++++++++++ .../service/impl/IpcDataShowServiceImpl.java | 57 +++--- .../impl/IpcMonitorFieldServiceImpl.java | 4 +- .../IpcRunningStatusRecordServiceImpl.java | 9 +- .../com/inspur/ipc/utils/IpcConstant.java | 4 +- .../java/com/inspur/ipc/utils/IpcUtil.java | 15 +- tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue | 3 +- .../src/views/ipc/dataLog/sensorDataLog.vue | 27 +-- tzipc-ui/src/views/zf/bigscreen/index.vue | 15 +- 19 files changed, 422 insertions(+), 122 deletions(-) create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataReceiveService.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java index c3bab39..1d4c826 100644 --- a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java @@ -2,6 +2,8 @@ package com.inspur.web.controller.ipc; import com.inspur.common.core.domain.AjaxResult; import com.inspur.common.core.redis.RedisCache; +import com.inspur.ipc.domain.IpcBg4gszhp01tempdata; +import com.inspur.ipc.service.IIpcDataReceiveService; import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.utils.IpcConstant; import com.serotonin.modbus4j.BatchRead; @@ -35,7 +37,8 @@ public class IpcDataReceiveController { @Autowired private IIpcMonitorFieldService iIpcMonitorFieldService; - + @Autowired + private IIpcDataReceiveService iIpcDataReceiveService; /** * 工厂。 */ @@ -51,39 +54,39 @@ public class IpcDataReceiveController { * 接收PLC数据 */ @PostMapping("/plcData") - public AjaxResult plcData(@RequestBody Map> map) throws ModbusInitException, ModbusTransportException, ErrorResponseException { + public AjaxResult plcData(@RequestBody Map map) throws ModbusInitException, ModbusTransportException, ErrorResponseException { // 如果是工控机端,接收plc数据;如果是云端,接收传感器数据 if (model.equals(IpcConstant.MODEL_CLIENT)) { // { // "children":["123","222"] // } } - IpParameters params = new IpParameters(); - params.setHost(""); - params.setPort(Integer.parseInt("")); - ModbusMaster master = modbusFactory.createTcpMaster(params, true);// TCP 协议 - master.init(); - BatchRead batch = new BatchRead(); - batch.addLocator(0, BaseLocator.holdingRegister(1, 0, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油压力,float - batch.addLocator(1, BaseLocator.holdingRegister(1, 2, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油油液温度,float - batch.addLocator(2, BaseLocator.holdingRegister(1, 4, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 回油油液温度,float - batch.addLocator(3, BaseLocator.holdingRegister(1, 6, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油水监测,float - batch.addLocator(4, BaseLocator.holdingRegister(1, 8, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液粘度,float - batch.addLocator(5, BaseLocator.holdingRegister(1, 10, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 力传感器,float - batch.addLocator(6, BaseLocator.holdingRegister(1, 12, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 速度传感器,float - batch.addLocator(7, BaseLocator.holdingRegister(1, 14, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X1轴位置传感器一,float - batch.addLocator(8, BaseLocator.holdingRegister(1, 16, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X2轴位置传感器二,float - batch.addLocator(9, BaseLocator.holdingRegister(1, 18, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y1轴位置传感器三,float - batch.addLocator(10, BaseLocator.holdingRegister(1, 20, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y2轴位置传感器四,float - batch.addLocator(11, BaseLocator.holdingRegister(1, 22, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Z轴位置传感器五,float - batch.addLocator(12, BaseLocator.holdingRegister(1, 24, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液密度,float - batch.addLocator(13, BaseLocator.holdingRegister(1, 26, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度4um,int - batch.addLocator(14, BaseLocator.holdingRegister(1, 27, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度6um,int - batch.addLocator(15, BaseLocator.holdingRegister(1, 28, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度14um,int - batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int - batch.setContiguousRequests(false); - BatchResults results = master.send(batch); - System.out.println(results); +// IpParameters params = new IpParameters(); +// params.setHost(""); +// params.setPort(Integer.parseInt("")); +// ModbusMaster master = modbusFactory.createTcpMaster(params, true);// TCP 协议 +// master.init(); +// BatchRead batch = new BatchRead(); +// batch.addLocator(0, BaseLocator.holdingRegister(1, 0, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油压力,float +// batch.addLocator(1, BaseLocator.holdingRegister(1, 2, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油油液温度,float +// batch.addLocator(2, BaseLocator.holdingRegister(1, 4, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 回油油液温度,float +// batch.addLocator(3, BaseLocator.holdingRegister(1, 6, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油水监测,float +// batch.addLocator(4, BaseLocator.holdingRegister(1, 8, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液粘度,float +// batch.addLocator(5, BaseLocator.holdingRegister(1, 10, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 力传感器,float +// batch.addLocator(6, BaseLocator.holdingRegister(1, 12, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 速度传感器,float +// batch.addLocator(7, BaseLocator.holdingRegister(1, 14, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X1轴位置传感器一,float +// batch.addLocator(8, BaseLocator.holdingRegister(1, 16, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X2轴位置传感器二,float +// batch.addLocator(9, BaseLocator.holdingRegister(1, 18, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y1轴位置传感器三,float +// batch.addLocator(10, BaseLocator.holdingRegister(1, 20, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y2轴位置传感器四,float +// batch.addLocator(11, BaseLocator.holdingRegister(1, 22, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Z轴位置传感器五,float +// batch.addLocator(12, BaseLocator.holdingRegister(1, 24, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液密度,float +// batch.addLocator(13, BaseLocator.holdingRegister(1, 26, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度4um,int +// batch.addLocator(14, BaseLocator.holdingRegister(1, 27, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度6um,int +// batch.addLocator(15, BaseLocator.holdingRegister(1, 28, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度14um,int +// batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int +// batch.setContiguousRequests(false); +// BatchResults results = master.send(batch); +// System.out.println(results); return AjaxResult.success(1); } @@ -91,12 +94,7 @@ public class IpcDataReceiveController { * 接收温振传感器数据 */ @PostMapping("/sensorData") - public AjaxResult sensorData(@RequestBody Map> map) { - // 如果是工控机端,接收plc数据;如果是云端,接收传感器数据 - if (model.equals(IpcConstant.MODEL_CLOUD)) { - - } - System.out.println(map.toString()); - return AjaxResult.success(1); + public AjaxResult sensorData(@RequestBody IpcBg4gszhp01tempdata ipcBg4gszhp01tempdata) { + return AjaxResult.success(iIpcDataReceiveService.dealSensorData(ipcBg4gszhp01tempdata)); } } diff --git a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java index 378e06b..ee2e294 100644 --- a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java +++ b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java @@ -74,11 +74,30 @@ public class CacheConstants /** * 运行状态 */ - public static final String RUNNING_STATUS = "running_status:"; + public static final String RUNNING_STATUS = "running_status"; /** * ipc前缀 */ public static final String IPC_PREFIX = "ipc:"; + + + /** + * 传感器数据缓存 + */ + public static final String SENSOR_DATA_CACHE = "sensor_data:"; + + /** + * 通道号X + */ + public static final String SENSOR_CHN_X = "X"; + /** + * 通道号Y + */ + public static final String SENSOR_CHN_Y = "Y"; + /** + * 通道号Z + */ + public static final String SENSOR_CHN_Z = "Z"; } diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java index b186f3b..dc7b2db 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java @@ -81,7 +81,7 @@ public class IPCDataSyncTask implements ApplicationRunner { public void run() { threadPoolTaskExecutor.execute(new IPCSensorDataSyncThread(null, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()))); } - }, 1000, 1000*60); + }, 1000, 1000*60*10); final Timer timer3 = new Timer(); timer3.schedule(new TimerTask() { diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCPlcDataSyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCPlcDataSyncThread.java index dc0ce03..7e9077e 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCPlcDataSyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCPlcDataSyncThread.java @@ -1,6 +1,7 @@ package com.inspur.datasyn.modbus; import com.inspur.common.constant.CacheConstants; +import com.inspur.common.core.redis.RedisCache; import com.inspur.common.utils.StringUtils; import com.inspur.common.utils.spring.SpringUtils; import com.inspur.ipc.domain.IpcAlarmRecord; @@ -46,7 +47,6 @@ public class IPCPlcDataSyncThread implements Runnable { IIpcAlarmRulesConfigService iIpcAlarmRulesConfigService = SpringUtils.getBean(IIpcAlarmRulesConfigService.class); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); IIpcRunningStatusRecordService iIpcRunningStatusRecordService = SpringUtils.getBean(IIpcRunningStatusRecordService.class); - /* BatchRead batch = new BatchRead(); batch.addLocator(0, BaseLocator.holdingRegister(1, 0, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油压力,float batch.addLocator(1, BaseLocator.holdingRegister(1, 2, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油油液温度,float @@ -69,12 +69,15 @@ public class IPCPlcDataSyncThread implements Runnable { BatchResults results = master.send(batch);*/ // 获取运行状态,不一致则新增运行状态 String status = iIpcRunningStatusRecordService.selectLatestStatus(); - if(StringUtils.isNull(status) || !status.equals("4")){ - status="4"; + String sss = iIpcRunningStatusRecordService.getSSS(); + if(sss==null){sss="4";} + if (StringUtils.isNull(status) || !status.equals(sss)) { + status = sss; iIpcRunningStatusRecordService.insertIpcRunningStatusRecord(new IpcRunningStatusRecord(status)); + System.out.println("状态更新"+status); } // 如果不是停机数据,进行处理 - if(!IpcConstant.RUNNING_STATUS_SHUTDOWN.equals(status)) { + if (!IpcConstant.RUNNING_STATUS_SHUTDOWN.equals(status)) { // 温压数据 List partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List plcList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); @@ -87,7 +90,11 @@ public class IPCPlcDataSyncThread implements Runnable { for (IpcMonitorField field : plcList) { // 可以配置源字段,获取时通过源字段获取数据 // field.getSourceField() - fields.put(field.getFieldValue(), Math.random()); + if(field.getFieldValue().equals("rstatus")){ + fields.put(field.getFieldValue(), status); + }else{ + fields.put(field.getFieldValue(), Math.random()); + } } // //颗粒度4μm // fields.put("pz4", (float) 0 + Math.random()); @@ -103,30 +110,24 @@ public class IPCPlcDataSyncThread implements Runnable { // fields.put("ov", (float) 0 + Math.random()); // //回油温度 // fields.put("rot", (float) 0 + Math.random()); -// //轴套区温度 -// fields.put("ssat", (float) 0 + Math.random()); // //进油压力 // fields.put("oip", (float) 0 + Math.random()); -// //振动温度 -// fields.put("ssat", (float) 0 + Math.random()); -// //振动x轴 -// fields.put("vx", (float) 0 + Math.random()); -// //振动y轴 -// fields.put("vy", (float) 0 + Math.random()); -// //振动z轴 -// fields.put("vz", (float) 0 + Math.random()); +// //油液密度 +// fields.put("od", (float) 0 + Math.random()); +// // 运行状态 +// fields.put("rstatus", (float) 0 + Math.random()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); String format = simpleDateFormat.format(new Date()); fields.put("insertTime", format); // 根据运行状态获取规则 List rulesConfigList = iIpcAlarmRulesConfigService.selectIpcAlarmRulesConfigList(tags.get("part")); - if(IpcConstant.RUNNING_STATUS_RUNNING.equals(status)){ + if (IpcConstant.RUNNING_STATUS_RUNNING.equals(status)) { rulesConfigList = rulesConfigList.stream().filter(ipcAlarmRulesConfig -> ipcAlarmRulesConfig.getType().equals(IpcConstant.RULE_TYPE_IN_RUNNING)).collect(Collectors.toList()); - }else{ + } else { rulesConfigList = rulesConfigList.stream().filter(ipcAlarmRulesConfig -> ipcAlarmRulesConfig.getType().equals(IpcConstant.RULE_TYPE_TRIAL_RUN)).collect(Collectors.toList()); } // 根据报警规则校验 - alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, CacheConstants.PLC_MONITOR_PARAMS_KEY, rulesConfigList)); + alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, rulesConfigList)); i.insert(IpcConstant.PLC_MEASUREMENT, tags, fields); } // 批量保存报警数据 diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCSensorDataSyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCSensorDataSyncThread.java index 859a026..4327c5a 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCSensorDataSyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCSensorDataSyncThread.java @@ -51,9 +51,9 @@ public class IPCSensorDataSyncThread implements Runnable { for (IpcMonitorField field : sensorList) { // 可以配置源字段,获取时通过源字段获取数据 // field.getSourceField() - if (field.getFieldValue().equals("stime")) { - fields.put(field.getFieldValue(), getDate()); - } else { + if(field.getFieldValue().equals("ssat")) { + fields.put(field.getFieldValue(), Math.random()+""); + }else{ fields.put(field.getFieldValue(), getData()); } } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java new file mode 100644 index 0000000..e50a8ff --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java @@ -0,0 +1,162 @@ +package com.inspur.ipc.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * BG-4G-SZHP01传感器临时数据对象 phm_bg4gszhp01tempdata + * + * @author inspur + * @date 2024-01-09 + */ +public class IpcBg4gszhp01tempdata extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Integer id; + + /** 传感器唯一标识 */ + @Excel(name = "传感器唯一标识") + @JsonProperty(value="DevID") + private String devID; + + /** 通道号 */ + @Excel(name = "通道号") + @JsonProperty(value="Chn") + private String Chn; + + /** 电池电量 */ + @Excel(name = "电池电量") + @JsonProperty(value="Bat") + private String Bat; + + /** 频率 */ + @Excel(name = "频率") + @JsonProperty(value="Fre") + private String Fre; + + /** 温度 */ + @Excel(name = "温度") + @JsonProperty(value="Temp") + private String Temp; + + /** 包数 */ + @Excel(name = "包数") + @JsonProperty(value="PakNum") + private Integer PakNum; + + /** 包总数 */ + @Excel(name = "包总数") + @JsonProperty(value="PakCount") + private Integer PakCount; + + /** 包长度 */ + @Excel(name = "包长度") + @JsonProperty(value="PakLength") + private Integer PakLength; + + /** 源数据 */ + @Excel(name = "源数据") + @JsonProperty(value="WData") + private String WData; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDevID() { + return devID; + } + + public void setDevID(String devID) { + this.devID = devID; + } + + public String getChn() { + return Chn; + } + + public void setChn(String chn) { + Chn = chn; + } + + public String getBat() { + return Bat; + } + + public void setBat(String bat) { + Bat = bat; + } + + public String getFre() { + return Fre; + } + + public void setFre(String fre) { + Fre = fre; + } + + public String getTemp() { + return Temp; + } + + public void setTemp(String temp) { + Temp = temp; + } + + public Integer getPakNum() { + return PakNum; + } + + public void setPakNum(Integer pakNum) { + PakNum = pakNum; + } + + public Integer getPakCount() { + return PakCount; + } + + public void setPakCount(Integer pakCount) { + PakCount = pakCount; + } + + public Integer getPakLength() { + return PakLength; + } + + public void setPakLength(Integer pakLength) { + PakLength = pakLength; + } + + public String getWData() { + return WData; + } + + public void setWData(String WData) { + this.WData = WData; + } + + @Override + public String toString() { + return "IpcBg4gszhp01tempdata{" + + "id=" + id + + ", devID='" + devID + '\'' + + ", Chn='" + Chn + '\'' + + ", Bat='" + Bat + '\'' + + ", Fre='" + Fre + '\'' + + ", Temp='" + Temp + '\'' + + ", PakNum=" + PakNum + + ", PakCount=" + PakCount + + ", PakLength=" + PakLength + + ", WData='" + WData + '\'' + + '}'; + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataReceiveService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataReceiveService.java new file mode 100644 index 0000000..8fc78a4 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataReceiveService.java @@ -0,0 +1,10 @@ +package com.inspur.ipc.service; + +import com.inspur.ipc.domain.IpcBg4gszhp01tempdata; + +public interface IIpcDataReceiveService { + /** + * 振动数据处理 + */ + String dealSensorData(IpcBg4gszhp01tempdata ipcBg4gszhp01tempdata); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcRunningStatusRecordService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcRunningStatusRecordService.java index 1c9e1fd..e4c922e 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcRunningStatusRecordService.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcRunningStatusRecordService.java @@ -65,4 +65,5 @@ public interface IIpcRunningStatusRecordService * @return 结果 */ String selectLatestStatus(); + String getSSS(); } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java index d6de762..29541c5 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java @@ -106,7 +106,7 @@ public class IpcAlarmRulesConfigServiceImpl implements IIpcAlarmRulesConfigServi List list = ipcAlarmRulesConfigMapper.selectIpcAlarmRulesConfigList(new IpcAlarmRulesConfig()); for (IpcMonitorField field : partList) { List redisList = list.stream().filter(ipcAlarmRulesConfig -> ipcAlarmRulesConfig.getPartKey().equals(field.getFieldValue())).collect(Collectors.toList()); - redisCache.setCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RULE_CONFIG + field.getFieldValue(), redisList,CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.HOURS); + redisCache.setCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RULE_CONFIG + field.getFieldValue(), redisList); } } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java index 6aa1073..86cb018 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java @@ -147,7 +147,6 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService { sql += " and time <= '" + endTime + "'"; } sql += " order by time desc limit " + pageSize + " offset " + (pageNum - 1) * pageSize; - System.out.println(sql); return influxDBService.queryResultProcess(influxDBService.query(sql)); } @@ -165,7 +164,6 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService { sql += " and time <= '" + endTime + "'"; } List> list = influxDBService.queryResultProcess(influxDBService.query(sql)); - System.out.println(sql); return list.size() == 0 ? 0 : ((Double) list.get(0).get("count")).intValue(); } } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java new file mode 100644 index 0000000..60b8598 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java @@ -0,0 +1,99 @@ +package com.inspur.ipc.service.impl; + +import com.inspur.common.constant.CacheConstants; +import com.inspur.common.core.redis.RedisCache; +import com.inspur.common.utils.spring.SpringUtils; +import com.inspur.ipc.domain.IpcBg4gszhp01tempdata; +import com.inspur.ipc.domain.IpcMonitorField; +import com.inspur.ipc.service.IIpcDataReceiveService; +import com.inspur.ipc.service.IIpcMonitorFieldService; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +@Service +public class IpcDataReceiveServiceImpl implements IIpcDataReceiveService { + @Autowired + private IIpcMonitorFieldService iIpcMonitorFieldService; + @Autowired + private InfluxDBService influxDBService; + @Autowired + private RedisCache redisCache; + + /** + * 振动数据处理 + */ + @Override + public String dealSensorData(IpcBg4gszhp01tempdata ipcBg4gszhp01tempdata) { + // 获取设备列表 + List fieldList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); + // 判断设备id是否存在,不存在则返回error + Optional ipcMonitorField = fieldList.stream().filter(field -> field.getSourceField().equals(ipcBg4gszhp01tempdata.getDevID())).findAny(); + if (!ipcMonitorField.isPresent()) { + return "error"; + } + // 将数据保存到缓存中,过期时间1分钟 + String keyPrefix = CacheConstants.IPC_PREFIX + CacheConstants.SENSOR_DATA_CACHE + ipcMonitorField.get().getFieldValue() + CacheConstants.REDIS_KEY_SEPARATOR; + switch (ipcBg4gszhp01tempdata.getChn()) { + case CacheConstants.SENSOR_CHN_X: + redisCache.setCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_X, ipcBg4gszhp01tempdata, CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.MINUTES); + break; + case CacheConstants.SENSOR_CHN_Y: + redisCache.setCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Y, ipcBg4gszhp01tempdata, CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.MINUTES); + break; + case CacheConstants.SENSOR_CHN_Z: + redisCache.setCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Z, ipcBg4gszhp01tempdata, CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.MINUTES); + break; + default: + // 通道号不存在则返回error + return "error"; + } + CompletableFuture result = CompletableFuture.supplyAsync(() -> saveData(keyPrefix, ipcMonitorField.get().getFieldValue())); + try { + return result.get(); + } catch (InterruptedException e) { + e.printStackTrace(); + return "error"; + } catch (ExecutionException e) { + e.printStackTrace(); + return "error"; + } + } + + private String saveData(String keyPrefix, String part) { + try { + // 通道号X,Y,Z均已传输 + if (redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_X) != null && redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Y) != null && redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Z) != null) { + IpcBg4gszhp01tempdata ipcBg4gszhp01tempdataX = redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_X); + IpcBg4gszhp01tempdata ipcBg4gszhp01tempdataY = redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Y); + IpcBg4gszhp01tempdata ipcBg4gszhp01tempdataZ = redisCache.getCacheObject(keyPrefix + CacheConstants.SENSOR_CHN_Z); + + Map tags = new TreeMap(); + tags.put("part", part); + Map fields = new TreeMap(); + fields.put("ssat", ipcBg4gszhp01tempdataX.getTemp()); + fields.put("vx", ipcBg4gszhp01tempdataX.getWData()); + fields.put("vy", ipcBg4gszhp01tempdataY.getWData()); + fields.put("vz", ipcBg4gszhp01tempdataZ.getWData()); + + // 获取当前时间 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); + String format = simpleDateFormat.format(new Date()); + fields.put("insertTime", format); + influxDBService.insert(IpcConstant.SENSOR_MEASUREMENT, tags, fields); + redisCache.deleteObject(Arrays.asList(new String[]{keyPrefix + CacheConstants.SENSOR_CHN_X, keyPrefix + CacheConstants.SENSOR_CHN_Y, keyPrefix + CacheConstants.SENSOR_CHN_Z})); + } + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + return "success"; + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java index 90de38b..d0736ad 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java @@ -31,19 +31,20 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { private InfluxDBService influxDBService; @Autowired private IIpcAlarmRecordService ipcAlarmRecordService; + /** * 展示数据获取 */ @Override public Map getShowData(String[] parts) { Map dataMap = new HashMap<>(); - CompletableFuture>> plcDataMap = CompletableFuture.supplyAsync(() -> dealPlcData(parts)); - CompletableFuture>> sensorDataMap = CompletableFuture.supplyAsync(() -> dealSensorData(parts)); + CompletableFuture>> plcDataMap = CompletableFuture.supplyAsync(() -> dealPlcData(parts)); + CompletableFuture>> sensorDataMap = CompletableFuture.supplyAsync(() -> dealSensorData(parts)); try { plcDataMap.get().get(IpcConstant.OPERATION_NAME).putAll(sensorDataMap.get().get(IpcConstant.OPERATION_NAME)); plcDataMap.get().get(IpcConstant.DRIVE_NAME).putAll(sensorDataMap.get().get(IpcConstant.DRIVE_NAME)); - dataMap.put(IpcConstant.OPERATION_NAME,plcDataMap.get().get(IpcConstant.OPERATION_NAME)); - dataMap.put(IpcConstant.DRIVE_NAME,plcDataMap.get().get(IpcConstant.DRIVE_NAME)); + dataMap.put(IpcConstant.OPERATION_NAME, plcDataMap.get().get(IpcConstant.OPERATION_NAME)); + dataMap.put(IpcConstant.DRIVE_NAME, plcDataMap.get().get(IpcConstant.DRIVE_NAME)); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { @@ -54,11 +55,12 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { /** * plc数据处理 + * * @param parts * @return */ - private Map> dealPlcData(String[] parts){ - Map> dataMap = new HashMap<>(); + private Map> dealPlcData(String[] parts) { + Map> dataMap = new HashMap<>(); try { for (String part : parts) { // 数据获取 @@ -97,7 +99,7 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { oip.add(plcObj.get("oip") == null ? 0 : plcObj.get("oip")); od.add(plcObj.get("od") == null ? 0 : plcObj.get("od")); if (plcObj.containsKey("insertTime") && null != plcObj.get("insertTime")) { - xPlcData.add(this.dateTimeDeal(plcObj.get("insertTime"),"minute")); + xPlcData.add(this.dateTimeDeal(plcObj.get("insertTime"), "minute")); } } Map map = new HashMap<>(); @@ -120,9 +122,9 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { ipcAlarmRecord.setAlarmStatus("0"); List list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord); // 颗粒度报警 - map.put("pzAlarmStr", String.join(IpcConstant.DATA_SEPARATOR,list.stream().filter(ipcAlarmRecord1 -> ipcAlarmRecord1.getNameKey().startsWith("pz")).map(IpcAlarmRecord::getAlarmDetail).collect(Collectors.toList()))); + map.put("pzAlarmStr", String.join(IpcConstant.DATA_SEPARATOR, list.stream().filter(ipcAlarmRecord1 -> ipcAlarmRecord1.getNameKey().startsWith("pz")).map(IpcAlarmRecord::getAlarmDetail).collect(Collectors.toList()))); // 其他报警 - map.put("otherAlarmStr", String.join(IpcConstant.DATA_SEPARATOR,list.stream().filter(ipcAlarmRecord1 -> !ipcAlarmRecord1.getNameKey().startsWith("pz")).map(IpcAlarmRecord::getAlarmDetail).collect(Collectors.toList()))); + map.put("otherAlarmStr", String.join(IpcConstant.DATA_SEPARATOR, list.stream().filter(ipcAlarmRecord1 -> !ipcAlarmRecord1.getNameKey().startsWith("pz")).map(IpcAlarmRecord::getAlarmDetail).collect(Collectors.toList()))); // 根据位置处理 if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { // 操作侧 @@ -137,13 +139,15 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { } return dataMap; } + /** * 传感器温振数据处理 + * * @param parts * @return */ - private Map> dealSensorData(String[] parts){ - Map> dataMap = new HashMap<>(); + private Map> dealSensorData(String[] parts) { + Map> dataMap = new HashMap<>(); try { for (String part : parts) { // 数据获取 @@ -153,28 +157,25 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { // 横轴时间轴 List xSensorData = new ArrayList<>(); //振动温度 - List ssat = new ArrayList<>(); + Object ssat; //振动x轴 List vx = new ArrayList<>(); //振动y轴 List vy = new ArrayList<>(); //振动z轴 List vz = new ArrayList<>(); - Map sensorMap=sensorMaps.get(0); - xSensorData.addAll(sensorMap.get("stime") == null ? new ArrayList<>() : Arrays.asList(String.valueOf(sensorMap.get("stime")).split(IpcConstant.DATA_SEPARATOR))); - ssat.addAll(sensorMap.get("ssat") == null ? new ArrayList<>() : Arrays.asList(String.valueOf(sensorMap.get("ssat")).split(IpcConstant.DATA_SEPARATOR))); + Map sensorMap = sensorMaps.get(0); + ssat = sensorMap.get("ssat") == null ? "0" : String.valueOf(sensorMap.get("ssat")); vx.addAll(sensorMap.get("vx") == null ? new ArrayList<>() : Arrays.asList(String.valueOf(sensorMap.get("vx")).split(IpcConstant.DATA_SEPARATOR))); vy.addAll(sensorMap.get("vy") == null ? new ArrayList<>() : Arrays.asList(String.valueOf(sensorMap.get("vy")).split(IpcConstant.DATA_SEPARATOR))); vz.addAll(sensorMap.get("stime") == null ? new ArrayList<>() : Arrays.asList(String.valueOf(sensorMap.get("vz")).split(IpcConstant.DATA_SEPARATOR))); + // 返回数据 Map map = new HashMap<>(); - if (!xSensorData.isEmpty()) { - int sensorIndex = xSensorData.size() - 1; - map.put("xSensorData", xSensorData); - map.put("ssat", ssat.get(sensorIndex)); - map.put("vx", vx); - map.put("vy", vy); - map.put("vz", vz); - } + map.put("xSensorData", xSensorData); + map.put("ssat", ssat); + map.put("vx", vx); + map.put("vy", vy); + map.put("vz", vz); // 根据位置处理 if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { // 操作侧 @@ -205,11 +206,11 @@ public class IpcDataShowServiceImpl implements IIpcDataShowService { Calendar calendar = Calendar.getInstance(); calendar.setTime(time); int y = calendar.get(Calendar.YEAR); - String month = calendar.get(Calendar.MONTH) > 9 ? ""+calendar.get(Calendar.MONTH) : "0"+calendar.get(Calendar.MONTH); - String d = calendar.get(Calendar.DAY_OF_MONTH) > 9 ? ""+calendar.get(Calendar.DAY_OF_MONTH) : "0"+calendar.get(Calendar.DAY_OF_MONTH); - String h = calendar.get(Calendar.HOUR_OF_DAY) > 9 ? ""+calendar.get(Calendar.HOUR_OF_DAY) : "0"+calendar.get(Calendar.HOUR_OF_DAY); - String m = calendar.get(Calendar.MINUTE) > 9 ? ""+calendar.get(Calendar.MINUTE) : "0"+calendar.get(Calendar.MINUTE); - String s = calendar.get(Calendar.SECOND) > 9 ? ""+calendar.get(Calendar.SECOND) : "0"+calendar.get(Calendar.SECOND); + String month = calendar.get(Calendar.MONTH) > 9 ? "" + calendar.get(Calendar.MONTH) : "0" + calendar.get(Calendar.MONTH); + String d = calendar.get(Calendar.DAY_OF_MONTH) > 9 ? "" + calendar.get(Calendar.DAY_OF_MONTH) : "0" + calendar.get(Calendar.DAY_OF_MONTH); + String h = calendar.get(Calendar.HOUR_OF_DAY) > 9 ? "" + calendar.get(Calendar.HOUR_OF_DAY) : "0" + calendar.get(Calendar.HOUR_OF_DAY); + String m = calendar.get(Calendar.MINUTE) > 9 ? "" + calendar.get(Calendar.MINUTE) : "0" + calendar.get(Calendar.MINUTE); + String s = calendar.get(Calendar.SECOND) > 9 ? "" + calendar.get(Calendar.SECOND) : "0" + calendar.get(Calendar.SECOND); switch (type) { case "year": dateTime = y + "-" + month + "-" + d + " " + h + ":" + m + ":" + s; 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 ac927ce..38a42ca 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 @@ -99,10 +99,10 @@ public class IpcMonitorFieldServiceImpl implements IIpcMonitorFieldService { */ @Override public List selectFieldDataByType(String type) { - List list = redisCache.getCacheObject(CacheConstants.IPC_PREFIX+type + CacheConstants.REDIS_KEY_SEPARATOR); + List list = redisCache.getCacheObject(CacheConstants.IPC_PREFIX+type); if (list == null || list.isEmpty()) { list = ipcMonitorFieldMapper.selectFieldDataByType(type); - redisCache.setCacheObject(CacheConstants.IPC_PREFIX+type + CacheConstants.REDIS_KEY_SEPARATOR, list,CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.HOURS); + redisCache.setCacheObject(CacheConstants.IPC_PREFIX+type, list); } return list; } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcRunningStatusRecordServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcRunningStatusRecordServiceImpl.java index 5196e73..1bf3fcc 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcRunningStatusRecordServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcRunningStatusRecordServiceImpl.java @@ -59,7 +59,8 @@ public class IpcRunningStatusRecordServiceImpl implements IIpcRunningStatusRecor public int insertIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord) { int num = ipcRunningStatusRecordMapper.insertIpcRunningStatusRecord(ipcRunningStatusRecord); - selectLatestStatus(); + // 更新缓存 + redisCache.setCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RUNNING_STATUS,ipcRunningStatusRecord.getRunningStatus()); return num; } @@ -108,8 +109,12 @@ public class IpcRunningStatusRecordServiceImpl implements IIpcRunningStatusRecor String status = redisCache.getCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RUNNING_STATUS); if(StringUtils.isNull(status) || StringUtils.isEmpty(status)){ status = ipcRunningStatusRecordMapper.selectLatestStatus(); - redisCache.setCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RUNNING_STATUS,status,CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.HOURS); + redisCache.setCacheObject(CacheConstants.IPC_PREFIX+CacheConstants.RUNNING_STATUS,status); } return status; } + @Override + public String getSSS(){ + return redisCache.getCacheObject("status_test"); + } } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java index 115399e..c95bffb 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java @@ -39,11 +39,11 @@ public class IpcConstant { /** * plc数据表名 */ - public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list1"; + public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list2"; /** * 温振传感器数据表名 */ - public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list1"; + public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list2"; /** * 操作侧简写 */ diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java index f6cf7ea..b1f6af7 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java @@ -71,18 +71,15 @@ public class IpcUtil { /** * 批量处理实时数据 */ - public List dealRealTimeData(Map map, Map tags, String type, List rulesConfigList) { + public List dealRealTimeData(Map map, Map tags, List rulesConfigList) { List returnList = new ArrayList<>(); String isAlarm = "0"; for (IpcAlarmRulesConfig rulesConfig : rulesConfigList) { - // 判断是否当前参数类型 - if (type.equals(rulesConfig.getType())) { - if (judgeAlarm(map.get(rulesConfig.getNameKey()), rulesConfig.getReferenceValue1(), rulesConfig.getReferenceValue2(), rulesConfig.getReferenceCon())) { - // 报警数据 - isAlarm = "1"; - IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(), rulesConfig.getPartKey(), rulesConfig.getPart(), rulesConfig.getNameKey(), rulesConfig.getName(), String.valueOf(map.get(rulesConfig.getNameKey())), rulesConfig.getUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getAlarmDetail(), rulesConfig.getId()); - returnList.add(ipcAlarmRecord); - } + if (judgeAlarm(map.get(rulesConfig.getNameKey()), rulesConfig.getReferenceValue1(), rulesConfig.getReferenceValue2(), rulesConfig.getReferenceCon())) { + // 报警数据 + isAlarm = "1"; + IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(), rulesConfig.getPartKey(), rulesConfig.getPart(), rulesConfig.getNameKey(), rulesConfig.getName(), String.valueOf(map.get(rulesConfig.getNameKey())), rulesConfig.getUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getAlarmDetail(), rulesConfig.getId()); + returnList.add(ipcAlarmRecord); } } tags.put("isAlarm", isAlarm); diff --git a/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue index d31bd11..03d388d 100644 --- a/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue +++ b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue @@ -14,7 +14,6 @@ - { this.monitorPartList = res.data; - this.queryParams.part = this.monitorPartList[0].fieldValue; + if (this.$route.query.partKey) { + this.queryParams.part = this.$route.query.partKey; + } else { + this.queryParams.part = this.monitorPartList[0].fieldValue; + } this.getList(); }) .catch((error) => { @@ -504,6 +507,8 @@ export default { }, /** 查询列表 */ getList() { + this.queryParams.startTime = null; + this.queryParams.endTime = null; if (this.queryParams.datetimerange && this.queryParams.datetimerange[0]) { this.queryParams.startTime = this.dateToStr( this.queryParams.datetimerange[0] diff --git a/tzipc-ui/src/views/zf/bigscreen/index.vue b/tzipc-ui/src/views/zf/bigscreen/index.vue index de2aab3..a2c481c 100644 --- a/tzipc-ui/src/views/zf/bigscreen/index.vue +++ b/tzipc-ui/src/views/zf/bigscreen/index.vue @@ -6,7 +6,7 @@
{{ title1 }}数据监控
油膜轴承振动监测
{{ title2 }}数据监控
油膜轴承振动监测
轴套区温度
@@ -204,7 +204,7 @@
轴套区温度
@@ -1201,8 +1201,11 @@ export default { }); }, // 跳转温振数据记录页面 - jumpSensorDataLog() { - this.$router.push("/dataLog/sensor"); + jumpSensorDataLog(param) { + this.$router.push({ + path: "/dataLog/sensor", + query: { partKey: param }, + }); }, // 跳转报警记录页面 jumpAlarmRecord(param) { From 64b4de25b7a173564ddb1ac4b467029a7991f3fd Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Wed, 10 Apr 2024 15:50:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A8=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/inspur/ipc/utils/IpcConstant.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java index c95bffb..19c7cd8 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java @@ -39,11 +39,11 @@ public class IpcConstant { /** * plc数据表名 */ - public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list2"; + public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list"; /** * 温振传感器数据表名 */ - public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list2"; + public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list"; /** * 操作侧简写 */