From 549a753b2e669ea34dfcb52105a012794f2ce98b Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Tue, 2 Apr 2024 14:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ipc/IpcDataLogController.java | 42 +++ .../controller/ipc/IpcDataShowController.java | 32 ++ .../datasyn/modbus/IPCData2SyncThread.java | 4 +- .../datasyn/modbus/IPCDataSyncThread.java | 4 +- .../framework/config/SecurityConfig.java | 8 +- .../ipc/service/IIpcDataLogService.java | 21 ++ .../ipc/service/IIpcDataShowService.java | 15 + .../service/impl/IpcDataLogServiceImpl.java | 37 +++ .../service/impl/IpcDataShowServiceImpl.java | 234 +++++++++++++++ .../com/inspur/ipc/utils/IpcConstant.java | 25 ++ tzipc-ui/src/api/ipc/dataLog.js | 17 ++ tzipc-ui/src/api/ipc/dataShow.js | 9 + tzipc-ui/src/views/ipc/alarmRecord/index.vue | 4 +- tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue | 280 ++++++++++++++++++ .../src/views/ipc/dataLog/sensorDataLog.vue | 238 +++++++++++++++ tzipc-ui/src/views/ipc/rulesConfig/index.vue | 4 +- 16 files changed, 962 insertions(+), 12 deletions(-) create mode 100644 tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java create mode 100644 tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java create mode 100644 tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java create mode 100644 tzipc-ui/src/api/ipc/dataLog.js create mode 100644 tzipc-ui/src/api/ipc/dataShow.js create mode 100644 tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue create mode 100644 tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java new file mode 100644 index 0000000..3a041a4 --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java @@ -0,0 +1,42 @@ +package com.inspur.web.controller.ipc; + +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.ipc.service.IIpcDataLogService; +import com.inspur.ipc.service.IIpcDataShowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据展示界面 + * + * @author inspur + */ +@RestController +@RequestMapping("/ipc/dataLog") +public class IpcDataLogController extends BaseController { + @Autowired + private IIpcDataLogService iIpcDataLogService; + /** + * 查询plc数据记录 + */ + @PreAuthorize("@ss.hasPermi('ipc:dataLog:query')") + @GetMapping(value = "/plc/{part}") + public AjaxResult queryPlcDataLog(@PathVariable String part) + { + return AjaxResult.success(iIpcDataLogService.queryPlcDataLog(part)); + } + /** + * 查询传感器温振数据记录 + */ + @PreAuthorize("@ss.hasPermi('ipc:dataLog:query')") + @GetMapping(value = "/sensor/{part}") + public AjaxResult querySensorDataLog(@PathVariable String part) + { + return AjaxResult.success(iIpcDataLogService.querySensorDataLog(part)); + } +} diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java new file mode 100644 index 0000000..ff308bb --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java @@ -0,0 +1,32 @@ +package com.inspur.web.controller.ipc; + +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.ipc.service.IIpcDataShowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据展示界面 + * + * @author inspur + */ +@RestController +@RequestMapping("ipc/dataShow") +public class IpcDataShowController extends BaseController { + @Autowired + private IIpcDataShowService iIpcDataShowService; + /** + * 获取展示数据 + */ +// @PreAuthorize("@ss.hasPermi('ipc:dataShow:query')") + @GetMapping(value = "/byPart/{parts}") + public AjaxResult getShowData(@PathVariable("parts") String[] parts) + { + return AjaxResult.success(iIpcDataShowService.getShowData(parts)); + } +} diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java index 15c7941..4c32f53 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java @@ -8,6 +8,7 @@ import com.inspur.ipc.domain.IpcMonitorField; import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.utils.GetBeanUtil; +import com.inspur.ipc.utils.IpcConstant; import com.inspur.ipc.utils.IpcUtil; import com.inspur.system.service.influx.InfluxDBService; import com.serotonin.modbus4j.BatchRead; @@ -73,7 +74,6 @@ public class IPCData2SyncThread implements Runnable { List partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List sensorList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY); List alarmRecordList = new ArrayList<>(); - String measurement = "tzipc_sensor_monitor_data_list"; // 字典数据列表集合 for (IpcMonitorField part : partList) { Map tags = new TreeMap(); @@ -116,7 +116,7 @@ public class IPCData2SyncThread implements Runnable { InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 根据报警规则校验 alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.SENSOR_MONITOR_PARAMS_KEY)); - i.insert(measurement, tags, fields); + i.insert(IpcConstant.SENSOR_MEASUREMENT, tags, fields); } // 批量保存报警数据 if(!alarmRecordList.isEmpty()){ diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java index 5625c8b..2391c77 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java @@ -9,6 +9,7 @@ import com.inspur.ipc.domain.IpcMonitorField; import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.utils.GetBeanUtil; +import com.inspur.ipc.utils.IpcConstant; import com.inspur.ipc.utils.IpcUtil; import com.inspur.system.service.ISysDictDataService; import com.inspur.system.service.influx.InfluxDBService; @@ -77,7 +78,6 @@ public class IPCDataSyncThread implements Runnable { List partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List plcList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); List alarmRecordList = new ArrayList<>(); - String measurement = "tzipc_plc_monitor_data_list"; // 字典数据列表集合 for (IpcMonitorField part : partList) { Map tags = new TreeMap(); @@ -120,7 +120,7 @@ public class IPCDataSyncThread implements Runnable { InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 根据报警规则校验 alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.PLC_MONITOR_PARAMS_KEY)); - i.insert(measurement, tags, fields); + i.insert(IpcConstant.PLC_MEASUREMENT, tags, fields); } // 批量保存报警数据 if(!alarmRecordList.isEmpty()){ diff --git a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java index 2205df4..d4ccc58 100644 --- a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java +++ b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java @@ -22,7 +22,7 @@ import com.inspur.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author inspur */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @@ -109,7 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").anonymous() + .antMatchers("/login", "/register", "/captchaImage","/data/show/byPart/**").anonymous() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java new file mode 100644 index 0000000..99c1913 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java @@ -0,0 +1,21 @@ +package com.inspur.ipc.service; + +import java.util.List; +import java.util.Map; + +/** + * 数据展示界面Service接口 + * + * @author inspur + */ +public interface IIpcDataLogService { + /** + * plc数据记录接口 + */ + public List> queryPlcDataLog(String part); + + /** + * 温振传感器数据记录接口 + */ + public List> querySensorDataLog(String part); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java new file mode 100644 index 0000000..18f26fe --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java @@ -0,0 +1,15 @@ +package com.inspur.ipc.service; + +import java.util.Map; + +/** + * 数据展示界面Service接口 + * + * @author inspur + */ +public interface IIpcDataShowService { + /** + * 展示数据获取 + */ + public Map getShowData(String [] parts); +} 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 new file mode 100644 index 0000000..643f104 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java @@ -0,0 +1,37 @@ +package com.inspur.ipc.service.impl; + +import com.inspur.ipc.service.IIpcDataLogService; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.influxdb.dto.QueryResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class IpcDataLogServiceImpl implements IIpcDataLogService { + @Autowired + private InfluxDBService influxDBService; + + /** + * plc数据记录接口 + */ + @Override + public List> queryPlcDataLog(String part) { + QueryResult query = influxDBService.query("select * from "+ IpcConstant.PLC_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20"); + List> maps = influxDBService.queryResultProcess(query); + return maps; + } + + /** + * 温振传感器数据记录接口 + */ + @Override + public List> querySensorDataLog(String part) { + QueryResult query = influxDBService.query("select * from "+ IpcConstant.SENSOR_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20"); + List> maps = influxDBService.queryResultProcess(query); + return maps; + } +} 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 new file mode 100644 index 0000000..60197e3 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java @@ -0,0 +1,234 @@ +package com.inspur.ipc.service.impl; + +import com.inspur.ipc.service.IIpcDataShowService; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.influxdb.dto.QueryResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * 数据展示界面Service业务层处理 + * + * @author inspur + */ +@Service +public class IpcDataShowServiceImpl implements IIpcDataShowService { + + @Autowired + private InfluxDBService influxDBService; + + /** + * 展示数据获取 + */ + @Override + public Map getShowData(String[] parts) { + Map dataMap = new HashMap<>(); + 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)); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + return dataMap; + } + + /** + * plc数据处理 + * @param parts + * @return + */ + private Map> dealPlcData(String[] parts){ + Map> dataMap = new HashMap<>(); + try { + for (String part : parts) { + // 数据获取 + QueryResult plcQuery = influxDBService.query("select * from " + IpcConstant.PLC_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60"); + List> plcMaps = influxDBService.queryResultProcess(plcQuery); + // plc数据处理 + // 横轴时间轴 + List xPlcData = new ArrayList<>(); + //颗粒度4μm + List pz4 = new ArrayList<>(); + //颗粒度6μm + List pz6 = new ArrayList<>(); + //颗粒度14μm + List pz14 = new ArrayList<>(); + //颗粒度21μm + List pz21 = new ArrayList<>(); + //油水含量 + List owc = new ArrayList<>(); + //油品粘度 + List ov = new ArrayList<>(); + //回油温度 + List rot = new ArrayList<>(); + //轴套区温度 + List ssat = new ArrayList<>(); + //进油压力 + List oip = new ArrayList<>(); + //油液密度 + List od = new ArrayList<>(); + for (int i = plcMaps.size() - 1; i > -1; i--) { + System.out.println("1111111111111"); + Map plcObj = plcMaps.get(i); + pz4.add(plcObj.get("pz4") == null ? 0 : plcObj.get("pz4")); + pz6.add(plcObj.get("pz6") == null ? 0 : plcObj.get("pz6")); + pz14.add(plcObj.get("pz14") == null ? 0 : plcObj.get("pz14")); + pz21.add(plcObj.get("pz21") == null ? 0 : plcObj.get("pz21")); + owc.add(plcObj.get("owc") == null ? 0 : plcObj.get("owc")); + ov.add(plcObj.get("ov") == null ? 0 : plcObj.get("ov")); + rot.add(plcObj.get("rot") == null ? 0 : plcObj.get("rot")); + ssat.add(plcObj.get("ssat") == null ? 0 : plcObj.get("ssat")); + 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")); + } + } + Map map = new HashMap<>(); + if (!xPlcData.isEmpty()) { + int plcIndex = xPlcData.size() - 1; + map.put("xPlcData", xPlcData); + map.put("pz4", pz4); + map.put("pz6", pz6); + map.put("pz14", pz14); + map.put("pz21", pz21); + map.put("owc", owc.get(plcIndex)); + map.put("ov", ov.get(plcIndex)); + map.put("rot", rot.get(plcIndex)); + map.put("ssat", ssat.get(plcIndex)); + map.put("oip", oip.get(plcIndex)); + map.put("od", od.get(plcIndex)); + } + // 根据位置处理 + if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { + // 操作侧 + dataMap.put(IpcConstant.OPERATION_NAME, map); + } else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) { + // 传动侧 + dataMap.put(IpcConstant.DRIVE_NAME, map); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return dataMap; + } + /** + * 传感器温振数据处理 + * @param parts + * @return + */ + private Map> dealSensorData(String[] parts){ + Map> dataMap = new HashMap<>(); + try { + for (String part : parts) { + // 数据获取 + QueryResult sensorQuery = influxDBService.query("select * from " + IpcConstant.SENSOR_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60"); + List> sensorMaps = influxDBService.queryResultProcess(sensorQuery); + // 传感器温振数据处理 + // 横轴时间轴 + List xSensorData = new ArrayList<>(); + //振动温度 + List vt = new ArrayList<>(); + //振动x轴 + List vx = new ArrayList<>(); + //振动y轴 + List vy = new ArrayList<>(); + //振动z轴 + List vz = new ArrayList<>(); + for (int i = sensorMaps.size() - 1; i > -1; i--) { + System.out.println("222222222222"); + Map sensorObj = sensorMaps.get(i); + vt.add(sensorObj.get("vt") == null ? 0 : sensorObj.get("vt")); + vx.add(sensorObj.get("vx") == null ? 0 : sensorObj.get("vx")); + vy.add(sensorObj.get("vy") == null ? 0 : sensorObj.get("vy")); + vz.add(sensorObj.get("vz") == null ? 0 : sensorObj.get("vz")); + if (sensorObj.containsKey("insertTime") && null != sensorObj.get("insertTime")) { + xSensorData.add(this.dateTimeDeal(sensorObj.get("insertTime"),"hour")); + } + } + Map map = new HashMap<>(); + if (!xSensorData.isEmpty()) { + int sensorIndex = xSensorData.size() - 1; + map.put("xSensorData", xSensorData); + map.put("vt", vt.get(sensorIndex)); + map.put("vx", vx); + map.put("vy", vy); + map.put("vz", vz); + } + // 根据位置处理 + if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { + // 操作侧 + dataMap.put(IpcConstant.OPERATION_NAME, map); + } else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) { + // 传动侧 + dataMap.put(IpcConstant.DRIVE_NAME, map); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return dataMap; + } + + /** + * 时间格式处理 + * + * @param obj + * @return + */ + private String dateTimeDeal(Object obj, String type) { + String dateTime = ""; + //处理时间 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date time = simpleDateFormat.parse(String.valueOf(obj)); + 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); + switch (type) { + case "year": + dateTime = y + "-" + month + "-" + d + " " + h + ":" + m + ":" + s; + break; + case "month": + dateTime = month + "-" + d + " " + h + ":" + m + ":" + s; + break; + case "day": + dateTime = d + " " + h + ":" + m + ":" + s; + break; + case "hour": + dateTime = h + ":" + m + ":" + s; + break; + case "minute": + dateTime = m + ":" + s; + break; + default: + dateTime = m + ":" + s; + break; + } + } catch (ParseException e) { + e.printStackTrace(); + } + return dateTime; + } +} 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 97cb377..acdacbf 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 @@ -35,4 +35,29 @@ public class IpcConstant { * 区间外 */ public static final String OUTSIDE_INTERVAL = "区间外"; + + /** + * plc数据表名 + */ + public static final String PLC_MEASUREMENT = "tzipc_plc_monitor_data_list"; + /** + * 温振传感器数据表名 + */ + public static final String SENSOR_MEASUREMENT = "tzipc_sensor_monitor_data_list"; + /** + * 操作侧简写 + */ + public static final String OPERATION_PROFILE = "o"; + /** + * 传动侧简写 + */ + public static final String DRIVE_PROFILE = "d"; + /** + * 操作侧 + */ + public static final String OPERATION_NAME = "operation"; + /** + * 传动侧 + */ + public static final String DRIVE_NAME = "drive"; } diff --git a/tzipc-ui/src/api/ipc/dataLog.js b/tzipc-ui/src/api/ipc/dataLog.js new file mode 100644 index 0000000..da30284 --- /dev/null +++ b/tzipc-ui/src/api/ipc/dataLog.js @@ -0,0 +1,17 @@ +import request from "@/utils/request"; + +// 查询plc数据记录 +export function getPlcDataLog(part) { + return request({ + url: "/ipc/dataLog/plc/" + part, + method: "get", + }); +} + +// 查询传感器温振数据记录 +export function getSensorDataLog(part) { + return request({ + url: "/ipc/dataLog/sensor/" + part, + method: "get", + }); +} diff --git a/tzipc-ui/src/api/ipc/dataShow.js b/tzipc-ui/src/api/ipc/dataShow.js new file mode 100644 index 0000000..10a84c5 --- /dev/null +++ b/tzipc-ui/src/api/ipc/dataShow.js @@ -0,0 +1,9 @@ +import request from "@/utils/request"; + +// 根据部位查询展示数据 +export function getShowData(parts) { + return request({ + url: "/ipc/dataShow/byPart/" + parts, + method: "get", + }); +} diff --git a/tzipc-ui/src/views/ipc/alarmRecord/index.vue b/tzipc-ui/src/views/ipc/alarmRecord/index.vue index eea2092..220d727 100644 --- a/tzipc-ui/src/views/ipc/alarmRecord/index.vue +++ b/tzipc-ui/src/views/ipc/alarmRecord/index.vue @@ -677,7 +677,7 @@ export default { \ No newline at end of file + diff --git a/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue new file mode 100644 index 0000000..3b02320 --- /dev/null +++ b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue b/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue new file mode 100644 index 0000000..5648577 --- /dev/null +++ b/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue @@ -0,0 +1,238 @@ + + + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/rulesConfig/index.vue b/tzipc-ui/src/views/ipc/rulesConfig/index.vue index 29a5b47..f4e5fb3 100644 --- a/tzipc-ui/src/views/ipc/rulesConfig/index.vue +++ b/tzipc-ui/src/views/ipc/rulesConfig/index.vue @@ -673,6 +673,6 @@ export default { width: 100%; } .color-green { - color: greenyellow; + color: green; } - \ No newline at end of file +