diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java new file mode 100644 index 0000000..994cbd3 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java @@ -0,0 +1,105 @@ +package com.inspur.web.controller.equip; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.equip.domain.IpcEquipInfo; +import com.inspur.equip.service.IIpcEquipInfoService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 设备信息Controller + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +@RestController +@RequestMapping("/equip/info") +public class IpcEquipInfoController extends BaseController +{ + @Autowired + private IIpcEquipInfoService ipcEquipInfoService; + + /** + * 查询设备信息列表 + */ + @PreAuthorize("@ss.hasPermi('equip:info:list')") + @GetMapping("/list") + public TableDataInfo list(IpcEquipInfo ipcEquipInfo) + { + startPage(); + List list = ipcEquipInfoService.selectIpcEquipInfoList(ipcEquipInfo); + return getDataTable(list); + } + + /** + * 导出设备信息列表 + */ + @PreAuthorize("@ss.hasPermi('equip:info:export')") + @Log(title = "设备信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcEquipInfo ipcEquipInfo) + { + List list = ipcEquipInfoService.selectIpcEquipInfoList(ipcEquipInfo); + ExcelUtil util = new ExcelUtil(IpcEquipInfo.class); + util.exportExcel(response, list, "设备信息数据"); + } + + /** + * 获取设备信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('equip:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoById(id)); + } + + /** + * 新增设备信息 + */ + @PreAuthorize("@ss.hasPermi('equip:info:add')") + @Log(title = "设备信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcEquipInfo ipcEquipInfo) + { + return toAjax(ipcEquipInfoService.insertIpcEquipInfo(ipcEquipInfo)); + } + + /** + * 修改设备信息 + */ + @PreAuthorize("@ss.hasPermi('equip:info:edit')") + @Log(title = "设备信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcEquipInfo ipcEquipInfo) + { + return toAjax(ipcEquipInfoService.updateIpcEquipInfo(ipcEquipInfo)); + } + + /** + * 删除设备信息 + */ + @PreAuthorize("@ss.hasPermi('equip:info:remove')") + @Log(title = "设备信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(ipcEquipInfoService.deleteIpcEquipInfoByIds(ids)); + } +} + diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/DataQueryController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/DataQueryController.java new file mode 100644 index 0000000..160cd5e --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/DataQueryController.java @@ -0,0 +1,89 @@ +package com.inspur.web.controller.industrial; + +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.industrial.service.IDataQueryService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 传感器数据查询控制器 + * @Author zhangjunwen + * @create 2024/4/2 + */ +@RestController +@RequestMapping("/dataQuery") +public class DataQueryController { + + @Resource + private IDataQueryService dataQueryService; + + /** + * 获取超压底缸大屏数据 + * @return + */ + @GetMapping("/bottomCyl") + public AjaxResult getBottomCylScreenData() + { + return AjaxResult.success(dataQueryService.queryBottomCylScreenData()); + } + + /** + * 获取可控中高辊顶辊大屏数据 + * @return + */ + @GetMapping("/topScoller") + public AjaxResult getTopScollerScreenData() + { + return AjaxResult.success(dataQueryService.queryTopScollerScreenData()); + } + + /** + * 获取可控中高辊底辊大屏数据 + * @return + */ + @GetMapping("/bottomScoller") + public AjaxResult getBottomScollerScreenData() + { + return AjaxResult.success(dataQueryService.queryBottomScollerScreenData()); + } + + /** + * 根据时间查询超压底缸数据 + */ + @GetMapping("/bottomCylByDate") + public AjaxResult queryBottomCylByColumnNameandDate(@RequestParam("columnName")String columnName, + @RequestParam("startTime") String startTime, + @RequestParam("endTime") String endTime) + { + String tableName = "zfipc_industrial_monitor_data1"; + return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime)); + } + + /** + * 根据时间查询可控中高辊顶辊数据 + */ + @GetMapping("/topScollerByDate") + public AjaxResult queryTopScollerByColumnNameandDate(@RequestParam("columnName")String columnName, + @RequestParam("startTime") String startTime, + @RequestParam("endTime") String endTime) + { + String tableName = "zfipc_industrial_monitor_data2"; + return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime)); + } + + /** + * 根据时间查询可控中高辊顶辊数据 + */ + @GetMapping("/bottomScollerByDate") + public AjaxResult queryBottomScollerByColumnNameandDate(@RequestParam("columnName")String columnName, + @RequestParam("startTime") String startTime, + @RequestParam("endTime") String endTime) + { + String tableName = "zfipc_industrial_monitor_data3"; + return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime)); + } +} diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/sensor/IpcSensorInfoController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/sensor/IpcSensorInfoController.java new file mode 100644 index 0000000..8d3808e --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/sensor/IpcSensorInfoController.java @@ -0,0 +1,105 @@ +package com.inspur.web.controller.sensor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.sensor.domain.IpcSensorInfo; +import com.inspur.sensor.service.IIpcSensorInfoService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 传感器信息Controller + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +@RestController +@RequestMapping("/sensor/info") +public class IpcSensorInfoController extends BaseController +{ + @Autowired + private IIpcSensorInfoService ipcSensorInfoService; + + /** + * 查询传感器信息列表 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:list')") + @GetMapping("/list") + public TableDataInfo list(IpcSensorInfo ipcSensorInfo) + { + startPage(); + List list = ipcSensorInfoService.selectIpcSensorInfoList(ipcSensorInfo); + return getDataTable(list); + } + + /** + * 导出传感器信息列表 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:export')") + @Log(title = "传感器信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcSensorInfo ipcSensorInfo) + { + List list = ipcSensorInfoService.selectIpcSensorInfoList(ipcSensorInfo); + ExcelUtil util = new ExcelUtil(IpcSensorInfo.class); + util.exportExcel(response, list, "传感器信息数据"); + } + + /** + * 获取传感器信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return AjaxResult.success(ipcSensorInfoService.selectIpcSensorInfoById(id)); + } + + /** + * 新增传感器信息 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:add')") + @Log(title = "传感器信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcSensorInfo ipcSensorInfo) + { + return toAjax(ipcSensorInfoService.insertIpcSensorInfo(ipcSensorInfo)); + } + + /** + * 修改传感器信息 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:edit')") + @Log(title = "传感器信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcSensorInfo ipcSensorInfo) + { + return toAjax(ipcSensorInfoService.updateIpcSensorInfo(ipcSensorInfo)); + } + + /** + * 删除传感器信息 + */ + @PreAuthorize("@ss.hasPermi('sensor:info:remove')") + @Log(title = "传感器信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(ipcSensorInfoService.deleteIpcSensorInfoByIds(ids)); + } +} + diff --git a/zfipc-server/zfipc-datasyn/pom.xml b/zfipc-server/zfipc-datasyn/pom.xml index 7d9f029..7b598b2 100644 --- a/zfipc-server/zfipc-datasyn/pom.xml +++ b/zfipc-server/zfipc-datasyn/pom.xml @@ -65,7 +65,7 @@ com.infiniteautomation modbus4j - 3.0.3 + 3.1.0 org.apache.commons diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java index 74d2d97..81fc361 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java @@ -53,92 +53,113 @@ public class IPCData2SyncThread implements Runnable { batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int batch.setContiguousRequests(false); BatchResults results = master.send(batch);*/ - - String measurement = "zfipc_monitor_data2_list"; + //可控中高辊顶辊液压系统 + String measurement = "zfipc_industrial_monitor_data2"; Map tags = new TreeMap(); - tags.put("equ_id","S02-27-001"); + tags.put("equ_id","5d6c1a1374ea490a91e1361c1f5400aa"); Map fields = new TreeMap(); - // 主电机电流 - fields.put("zdjdl",(float) 0 + Math.random()); - // 主泵输出流量 - fields.put("zbscll",(float) 0 + Math.random()); - // 冷却循环电机电流 - fields.put("lqxhdjdl",(float) 0 + Math.random()); + // 系统电流 + fields.put("sys_cur",(float) 0 + Math.random()); + // 系统流量 + fields.put("sys_flw",(float) 0 + Math.random()); // 系统压力 - fields.put("xtyl",(float) 0 + Math.random()); - // 液位 - fields.put("yw",(float) 0 + Math.random()); + fields.put("sys_press",(float) 0 + Math.random()); + // 系统液位 + fields.put("sys_level",(float) 0 + Math.random()); fields.put("ywcsz",0.5); fields.put("ywmin",0.3); fields.put("ywmax",1); - // 液温 - fields.put("ywen",(float) 0 + Math.random()); + // 系统温度 + fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 - fields.put("yykld4",(float) 0 + Math.random()); - fields.put("yykld6",(float) 0 + Math.random()); - fields.put("yykld14",(float) 0 + Math.random()); - fields.put("yykld21",(float) 0 + Math.random()); + fields.put("gran4",(float) 0 + Math.random()); + fields.put("gran6",(float) 0 + Math.random()); + fields.put("gran14",(float) 0 + Math.random()); + fields.put("gran21",(float) 0 + Math.random()); + //产线车速 + fields.put("line_speed",(float) 0 + Math.random()); // 油水检测 - fields.put("ysjc",(float) 0 + Math.random()); + fields.put("oil_water",(float) 0 + Math.random()); // 油品粘度 - fields.put("ypnd",(float) 0 + Math.random()); - // 铁磁检测 - fields.put("tcjc",(float) 0 + Math.random()); + fields.put("visc",(float) 0 + Math.random()); + +// +// // 主泵输出流量 +// fields.put("zbscll",(float) 0 + Math.random()); +// // 冷却循环电机电流 +// fields.put("lqxhdjdl",(float) 0 + Math.random()); +// // 系统压力 +// fields.put("xtyl",(float) 0 + Math.random()); +// // 液位 +// fields.put("yw",(float) 0 + Math.random()); +// fields.put("ywcsz",0.5); +// fields.put("ywmin",0.3); +// fields.put("ywmax",1); +// // 液温 +// fields.put("ywen",(float) 0 + Math.random()); +// // 油液颗粒度 +// fields.put("yykld4",(float) 0 + Math.random()); +// fields.put("yykld6",(float) 0 + Math.random()); +// fields.put("yykld14",(float) 0 + Math.random()); +// fields.put("yykld21",(float) 0 + Math.random()); +// // 油水检测 +// fields.put("ysjc",(float) 0 + Math.random()); +// // 油品粘度 +// fields.put("ypnd",(float) 0 + Math.random()); +// // 铁磁检测 +// fields.put("tcjc",(float) 0 + Math.random()); // 一压区比例减压阀 - fields.put("yqbljyf1",(float) 0 + Math.random()); + fields.put("press1",(float) 0 + Math.random()); // 二压区比例减压阀 - fields.put("yqbljyf2",(float) 0 + Math.random()); + fields.put("press2",(float) 0 + Math.random()); // 三压区比例减压阀 - fields.put("yqbljyf3",(float) 0 + Math.random()); + fields.put("press3",(float) 0 + Math.random()); // 四压区比例减压阀 - fields.put("yqbljyf4",(float) 0 + Math.random()); + fields.put("press4",(float) 0 + Math.random()); // 五压区比例减乐阀 - fields.put("yqbljyf5",(float) 0 + Math.random()); + fields.put("press5",(float) 0 + Math.random()); // 六压区比例减压阀 - fields.put("yqbljyf6",(float) 0 + Math.random()); + fields.put("press6",(float) 0 + Math.random()); // 七压区比例减压阀 - fields.put("yqbljyf7",(float) 0 + Math.random()); + fields.put("press7",(float) 0 + Math.random()); // 八压区比例减压阀 - fields.put("yqbljyf8",(float) 0 + Math.random()); + fields.put("press8",(float) 0 + Math.random()); // 九压区比例减压阀 - fields.put("yqbljyf9",(float) 0 + Math.random()); + fields.put("press9",(float) 0 + Math.random()); // 十压区比例减乐阀 - fields.put("yqbljyf10",(float) 0 + Math.random()); + fields.put("press10",(float) 0 + Math.random()); // 十一压区比例减压阀 - fields.put("yqbljyf11",(float) 0 + Math.random()); + fields.put("press11",(float) 0 + Math.random()); // 一压区流量 - fields.put("yqll1",(float) 0 + Math.random()); + fields.put("flw1",(float) 0 + Math.random()); // 二压区流量 - fields.put("yqll2",(float) 0 + Math.random()); + fields.put("flw2",(float) 0 + Math.random()); // 三压区流量 - fields.put("yqll3",(float) 0 + Math.random()); + fields.put("flw3",(float) 0 + Math.random()); // 四压区流量 - fields.put("yqll4",(float) 0 + Math.random()); + fields.put("flw4",(float) 0 + Math.random()); // 五压区流量 - fields.put("yqll5",(float) 0 + Math.random()); + fields.put("flw5",(float) 0 + Math.random()); // 六压区流量 - fields.put("yqll6",(float) 0 + Math.random()); + fields.put("flw6",(float) 0 + Math.random()); // 七压区流量 - fields.put("yqll7",(float) 0 + Math.random()); + fields.put("flw7",(float) 0 + Math.random()); // 八压区流量 - fields.put("yqll8",(float) 0 + Math.random()); + fields.put("flw8",(float) 0 + Math.random()); // 九压区流量 - fields.put("yqll9",(float) 0 + Math.random()); + fields.put("flw9",(float) 0 + Math.random()); // 十压区流量 - fields.put("yqll10",(float) 0 + Math.random()); + fields.put("flw10",(float) 0 + Math.random()); // 十一压区流量 - fields.put("yqll11",(float) 0 + Math.random()); - - - + fields.put("flw11",(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); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 判断并处理报警数据 - JudgeUtil.judgeAndSaveAlarmData(fields,"2"); +// JudgeUtil.judgeAndSaveAlarmData(fields,"2"); i.insert(measurement,tags,fields); } catch (Exception e) { e.printStackTrace(); diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java index 21fad62..52318a6 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java @@ -54,88 +54,86 @@ public class IPCData3SyncThread implements Runnable { batch.setContiguousRequests(false); BatchResults results = master.send(batch);*/ - String measurement = "zfipc_monitor_data3_list"; + String measurement = "zfipc_industrial_monitor_data3"; Map tags = new TreeMap(); - tags.put("equ_id","S02-27-001"); + tags.put("equ_id","8b2d5cb04e254c15ade1e53a4f594f3f"); Map fields = new TreeMap(); - // 主电机电流 - fields.put("zdjdl",(float) 0 + Math.random()); - // 主泵输出流量 - fields.put("zbscll",(float) 0 + Math.random()); - // 冷却循环电机电流 - fields.put("lqxhdjdl",(float) 0 + Math.random()); + // 系统电流 + fields.put("sys_cur",(float) 0 + Math.random()); + // 系统流量 + fields.put("sys_flw",(float) 0 + Math.random()); // 系统压力 - fields.put("xtyl",(float) 0 + Math.random()); - // 液位 - fields.put("yw",(float) 0 + Math.random()); + fields.put("sys_press",(float) 0 + Math.random()); + // 系统液位 + fields.put("sys_level",(float) 0 + Math.random()); fields.put("ywcsz",0.5); fields.put("ywmin",0.3); fields.put("ywmax",1); - // 液温 - fields.put("ywen",(float) 0 + Math.random()); + // 系统温度 + fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 - fields.put("yykld4",(float) 0 + Math.random()); - fields.put("yykld6",(float) 0 + Math.random()); - fields.put("yykld14",(float) 0 + Math.random()); - fields.put("yykld21",(float) 0 + Math.random()); + fields.put("gran4",(float) 0 + Math.random()); + fields.put("gran6",(float) 0 + Math.random()); + fields.put("gran14",(float) 0 + Math.random()); + fields.put("gran21",(float) 0 + Math.random()); + //产线车速 + fields.put("line_speed",(float) 0 + Math.random()); // 油水检测 - fields.put("ysjc",(float) 0 + Math.random()); + fields.put("oil_water",(float) 0 + Math.random()); // 油品粘度 - fields.put("ypnd",(float) 0 + Math.random()); - // 铁磁检测 - fields.put("tcjc",(float) 0 + Math.random()); + fields.put("visc",(float) 0 + Math.random()); // 一压区比例减压阀 - fields.put("yqbljyf1",(float) 0 + Math.random()); + fields.put("press1",(float) 0 + Math.random()); // 二压区比例减压阀 - fields.put("yqbljyf2",(float) 0 + Math.random()); + fields.put("press2",(float) 0 + Math.random()); // 三压区比例减压阀 - fields.put("yqbljyf3",(float) 0 + Math.random()); + fields.put("press3",(float) 0 + Math.random()); // 四压区比例减压阀 - fields.put("yqbljyf4",(float) 0 + Math.random()); + fields.put("press4",(float) 0 + Math.random()); // 五压区比例减乐阀 - fields.put("yqbljyf5",(float) 0 + Math.random()); + fields.put("press5",(float) 0 + Math.random()); // 六压区比例减压阀 - fields.put("yqbljyf6",(float) 0 + Math.random()); + fields.put("press6",(float) 0 + Math.random()); // 七压区比例减压阀 - fields.put("yqbljyf7",(float) 0 + Math.random()); + fields.put("press7",(float) 0 + Math.random()); // 八压区比例减压阀 - fields.put("yqbljyf8",(float) 0 + Math.random()); + fields.put("press8",(float) 0 + Math.random()); // 九压区比例减压阀 - fields.put("yqbljyf9",(float) 0 + Math.random()); + fields.put("press9",(float) 0 + Math.random()); // 十压区比例减乐阀 - fields.put("yqbljyf10",(float) 0 + Math.random()); + fields.put("press10",(float) 0 + Math.random()); // 十一压区比例减压阀 - fields.put("yqbljyf11",(float) 0 + Math.random()); + fields.put("press11",(float) 0 + Math.random()); // 一压区流量 - fields.put("yqll1",(float) 0 + Math.random()); + fields.put("flw1",(float) 0 + Math.random()); // 二压区流量 - fields.put("yqll2",(float) 0 + Math.random()); + fields.put("flw2",(float) 0 + Math.random()); // 三压区流量 - fields.put("yqll3",(float) 0 + Math.random()); + fields.put("flw3",(float) 0 + Math.random()); // 四压区流量 - fields.put("yqll4",(float) 0 + Math.random()); + fields.put("flw4",(float) 0 + Math.random()); // 五压区流量 - fields.put("yqll5",(float) 0 + Math.random()); + fields.put("flw5",(float) 0 + Math.random()); // 六压区流量 - fields.put("yqll6",(float) 0 + Math.random()); + fields.put("flw6",(float) 0 + Math.random()); // 七压区流量 - fields.put("yqll7",(float) 0 + Math.random()); + fields.put("flw7",(float) 0 + Math.random()); // 八压区流量 - fields.put("yqll8",(float) 0 + Math.random()); + fields.put("flw8",(float) 0 + Math.random()); // 九压区流量 - fields.put("yqll9",(float) 0 + Math.random()); + fields.put("flw9",(float) 0 + Math.random()); // 十压区流量 - fields.put("yqll10",(float) 0 + Math.random()); + fields.put("flw10",(float) 0 + Math.random()); // 十一压区流量 - fields.put("yqll11",(float) 0 + Math.random()); + fields.put("flw11",(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); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 判断并处理报警数据 - JudgeUtil.judgeAndSaveAlarmData(fields,"3"); +// JudgeUtil.judgeAndSaveAlarmData(fields,"3"); i.insert(measurement,tags,fields); } catch (Exception e) { e.printStackTrace(); diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java index 24f72ec..60fc59c 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java @@ -34,108 +34,137 @@ public class IPCDataSyncThread implements Runnable { @Override public void run() { try { - /* 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);*/ - - String measurement = "zfipc_monitor_data1_list"; +// 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); + //超压底缸加压液压系统 + String measurement = "zfipc_industrial_monitor_data1"; Map tags = new TreeMap(); - tags.put("equ_id","S02-27-001"); + tags.put("equ_id","e2ae4710b516419c84d1d4a819429348"); Map fields = new TreeMap(); - // 主电机电流 - fields.put("zdjdl",(float) 0 + Math.random()); - // 泵输出流量 - fields.put("bscll",(float) 0 + Math.random()); + // 系统电流 + fields.put("sys_cur",(float) 0 + Math.random()); + // 系统流量 + fields.put("sys_flw",(float) 0 + Math.random()); // 系统压力 - fields.put("xtyl",(float) 0 + Math.random()); - // 液位 - fields.put("yw",(float) 0 + Math.random()); + fields.put("sys_press",(float) 0 + Math.random()); + // 系统液位 + fields.put("sys_level",(float) 0 + Math.random()); fields.put("ywcsz",0.5); fields.put("ywmin",0.3); fields.put("ywmax",1); - // 液温 - fields.put("ywe",(float) 0 + Math.random()); + // 系统温度 + fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 - fields.put("yykld4",(float) 0 + Math.random()); - fields.put("yykld6",(float) 0 + Math.random()); - fields.put("yykld14",(float) 0 + Math.random()); - fields.put("yykld21",(float) 0 + Math.random()); + fields.put("gran4",(float) 0 + Math.random()); + fields.put("gran6",(float) 0 + Math.random()); + fields.put("gran14",(float) 0 + Math.random()); + fields.put("gran21",(float) 0 + Math.random()); // 油水检测 - fields.put("ysjc",(float) 0 + Math.random()); + fields.put("oil_water",(float) 0 + Math.random()); // 油品粘度 - fields.put("ypnd",(float) 0 + Math.random()); + fields.put("visc",(float) 0 + Math.random()); // 操作侧软辊流量 - fields.put("czcrgll",(float) 0 + Math.random()); + fields.put("opr_soft_flw",(float) 0 + Math.random()); // 操作侧热辊流量 - fields.put("czcregll",(float) 0 + Math.random()); + fields.put("opr_hot_flw",(float) 0 + Math.random()); // 传动侧软辊流量 - fields.put("cdcrgll",(float) 0 + Math.random()); + fields.put("driven_soft_flw",(float) 0 + Math.random()); // 传动侧热辊流量 - fields.put("cdcregll",(float) 0 + Math.random()); - // 车速 - fields.put("cs",(float) 0 + Math.random()); - // 底缸操作侧油缸位移 - fields.put("dgczcygwy",(float) 0 + Math.random()); - // 底缸传动侧油缸位移 - fields.put("dgcdcygwy",(float) 0 + Math.random()); - // 底缸操作侧比例伺服阀 - fields.put("dgczcblsff",(float) 0 + Math.random()); - // 底缸操作侧比例减压阀 - fields.put("dgczcbljyf",(float) 0 + Math.random()); - // 底缸传动侧比例伺服阀 - fields.put("dgcdcblsff",(float) 0 + Math.random()); - // 底缸传动侧比例减压阀 - fields.put("dgcdcbljyf",(float) 0 + Math.random()); - // TS软辊比例减压阀(TS软辊实际压力) - fields.put("tsrgsjyl",(float) 0 + Math.random()); - // TS热辊比例减压阀(TS热辊实际压力) - fields.put("tsregsjyl",(float) 0 + Math.random()); - // TS热辊合辊压力 - fields.put("tsreghgyl",0.8); - // TS热辊加压压力 - fields.put("tsregjyyl",0.7); - // TS软辊辊合辊压力 - fields.put("tsrghgyl",0.5); - // TS软辊加压压力 - fields.put("tsrgjyyl",0.4); - // DS软辊比例减压阀(DS软辊实际压力) - fields.put("dsrgsjyl",(float) 0 + Math.random()); - // DS热辊比例减压阀(DS热辊实际压力) - fields.put("dsregsjyl",(float) 0 + Math.random()); - // DS热辊合辊压力 - fields.put("dsreghgyl",0.8); - // DS热辊加压压力 - fields.put("dsregjyyl",0.7); - // DS软辊合辊压力 - fields.put("dsrghgyl",0.5); - // DS软辊加压压力 - fields.put("dsrgjyyl",0.4); + fields.put("driven_hot_flw",(float) 0 + Math.random()); + //操作侧底缸比例换向阀 + fields.put("opr_servo",(float) 0 + Math.random()); + //传动侧比例换向阀 + fields.put("driven_servo",(float) 0 + Math.random()); + //操作侧底缸压力 + fields.put("opr_bottom_press",(float) 0 + Math.random()); + //传动侧底缸压力 + fields.put("driven_bottom_press",(float) 0 + Math.random()); + //操作侧软辊压力 + fields.put("opr_soft_real_press",(float) 0 + Math.random());//实际压力 + fields.put("opr_soft_bond_press",(float) 0 + Math.random());//合辊压力 + fields.put("opr_soft_act_press",(float) 0 + Math.random());//加压压力 + //操作侧热辊压力 + fields.put("opr_hot_real_press",(float) 0 + Math.random()); + fields.put("opr_hot_bond_press",(float) 0 + Math.random()); + fields.put("opr_hot_act_press",(float) 0 + Math.random()); + //传动侧软辊压力 + fields.put("driven_soft_real_press",(float) 0 + Math.random());//实际 + fields.put("driven_soft_bond_press",(float) 0 + Math.random());//合辊 + fields.put("driven_soft_act_press",(float) 0 + Math.random());//加压 + //传动侧热辊压力 + fields.put("driven_hot_real_press",(float) 0 + Math.random()); + fields.put("driven_hot_bond_press",(float) 0 + Math.random()); + fields.put("driven_hot_act_press",(float) 0 + Math.random()); + //操作侧底缸位移 + fields.put("opr_bottom_dis",(float) 0 + Math.random()); + //传动侧底缸位移 + fields.put("driven_bottom_dis",(float) 0 + Math.random()); +// // 车速 +// fields.put("cs",(float) 0 + Math.random()); +// // 底缸操作侧油缸位移 +// fields.put("dgczcygwy",(float) 0 + Math.random()); +// // 底缸传动侧油缸位移 +// fields.put("dgcdcygwy",(float) 0 + Math.random()); +// // 底缸操作侧比例伺服阀 +// fields.put("dgczcblsff",(float) 0 + Math.random()); +// // 底缸操作侧比例减压阀 +// fields.put("dgczcbljyf",(float) 0 + Math.random()); +// // 底缸传动侧比例伺服阀 +// fields.put("dgcdcblsff",(float) 0 + Math.random()); +// // 底缸传动侧比例减压阀 +// fields.put("dgcdcbljyf",(float) 0 + Math.random()); +// // TS软辊比例减压阀(TS软辊实际压力) +// fields.put("tsrgsjyl",(float) 0 + Math.random()); +// // TS热辊比例减压阀(TS热辊实际压力) +// fields.put("tsregsjyl",(float) 0 + Math.random()); +// // TS热辊合辊压力 +// fields.put("tsreghgyl",0.8); +// // TS热辊加压压力 +// fields.put("tsregjyyl",0.7); +// // TS软辊辊合辊压力 +// fields.put("tsrghgyl",0.5); +// // TS软辊加压压力 +// fields.put("tsrgjyyl",0.4); +// // DS软辊比例减压阀(DS软辊实际压力) +// fields.put("dsrgsjyl",(float) 0 + Math.random()); +// // DS热辊比例减压阀(DS热辊实际压力) +// fields.put("dsregsjyl",(float) 0 + Math.random()); +// // DS热辊合辊压力 +// fields.put("dsreghgyl",0.8); +// // DS热辊加压压力 +// fields.put("dsregjyyl",0.7); +// // DS软辊合辊压力 +// fields.put("dsrghgyl",0.5); +// // DS软辊加压压力 +// fields.put("dsrgjyyl",0.4); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); String format = simpleDateFormat.format(new Date()); fields.put("insertTime",format); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 判断并处理报警数据 - JudgeUtil.judgeAndSaveAlarmData(fields,"1"); +// JudgeUtil.judgeAndSaveAlarmData(fields,"1"); i.insert(measurement,tags,fields); } catch (Exception e) { e.printStackTrace(); diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/domain/IpcEquipInfo.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/domain/IpcEquipInfo.java new file mode 100644 index 0000000..3ef9ac3 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/domain/IpcEquipInfo.java @@ -0,0 +1,112 @@ +package com.inspur.equip.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + * 设备信息对象 ipc_equip_info + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +public class IpcEquipInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备id */ + private String id; + + /** 设备型号 */ + @Excel(name = "设备型号") + private String equipNum; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String equipName; + + /** 生产厂商 */ + @Excel(name = "生产厂商") + private String equipManufacturer; + + /** 序列号 */ + @Excel(name = "序列号") + private String equipSerialNum; + + /** 出厂日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出厂日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date equipProductionDate; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setEquipNum(String equipNum) + { + this.equipNum = equipNum; + } + + public String getEquipNum() + { + return equipNum; + } + public void setEquipName(String equipName) + { + this.equipName = equipName; + } + + public String getEquipName() + { + return equipName; + } + public void setEquipManufacturer(String equipManufacturer) + { + this.equipManufacturer = equipManufacturer; + } + + public String getEquipManufacturer() + { + return equipManufacturer; + } + public void setEquipSerialNum(String equipSerialNum) + { + this.equipSerialNum = equipSerialNum; + } + + public String getEquipSerialNum() + { + return equipSerialNum; + } + public void setEquipProductionDate(Date equipProductionDate) + { + this.equipProductionDate = equipProductionDate; + } + + public Date getEquipProductionDate() + { + return equipProductionDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("equipNum", getEquipNum()) + .append("equipName", getEquipName()) + .append("equipManufacturer", getEquipManufacturer()) + .append("equipSerialNum", getEquipSerialNum()) + .append("equipProductionDate", getEquipProductionDate()) + .append("remark", getRemark()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java new file mode 100644 index 0000000..6551f09 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java @@ -0,0 +1,62 @@ +package com.inspur.equip.mapper; + +import java.util.List; +import com.inspur.equip.domain.IpcEquipInfo; + +/** + * 设备信息Mapper接口 + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +public interface IpcEquipInfoMapper +{ + /** + * 查询设备信息 + * + * @param id 设备信息主键 + * @return 设备信息 + */ + public IpcEquipInfo selectIpcEquipInfoById(String id); + + /** + * 查询设备信息列表 + * + * @param ipcEquipInfo 设备信息 + * @return 设备信息集合 + */ + public List selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo); + + /** + * 新增设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo); + + /** + * 修改设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo); + + /** + * 删除设备信息 + * + * @param id 设备信息主键 + * @return 结果 + */ + public int deleteIpcEquipInfoById(String id); + + /** + * 批量删除设备信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcEquipInfoByIds(String[] ids); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java new file mode 100644 index 0000000..3192b3b --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java @@ -0,0 +1,62 @@ +package com.inspur.equip.service; + +import java.util.List; +import com.inspur.equip.domain.IpcEquipInfo; + +/** + * 设备信息Service接口 + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +public interface IIpcEquipInfoService +{ + /** + * 查询设备信息 + * + * @param id 设备信息主键 + * @return 设备信息 + */ + public IpcEquipInfo selectIpcEquipInfoById(String id); + + /** + * 查询设备信息列表 + * + * @param ipcEquipInfo 设备信息 + * @return 设备信息集合 + */ + public List selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo); + + /** + * 新增设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo); + + /** + * 修改设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo); + + /** + * 批量删除设备信息 + * + * @param ids 需要删除的设备信息主键集合 + * @return 结果 + */ + public int deleteIpcEquipInfoByIds(String[] ids); + + /** + * 删除设备信息信息 + * + * @param id 设备信息主键 + * @return 结果 + */ + public int deleteIpcEquipInfoById(String id); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java new file mode 100644 index 0000000..96a69e7 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java @@ -0,0 +1,94 @@ +package com.inspur.equip.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.equip.mapper.IpcEquipInfoMapper; +import com.inspur.equip.domain.IpcEquipInfo; +import com.inspur.equip.service.IIpcEquipInfoService; + +/** + * 设备信息Service业务层处理 + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +@Service +public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService +{ + @Autowired + private IpcEquipInfoMapper ipcEquipInfoMapper; + + /** + * 查询设备信息 + * + * @param id 设备信息主键 + * @return 设备信息 + */ + @Override + public IpcEquipInfo selectIpcEquipInfoById(String id) + { + return ipcEquipInfoMapper.selectIpcEquipInfoById(id); + } + + /** + * 查询设备信息列表 + * + * @param ipcEquipInfo 设备信息 + * @return 设备信息 + */ + @Override + public List selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo) + { + return ipcEquipInfoMapper.selectIpcEquipInfoList(ipcEquipInfo); + } + + /** + * 新增设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + @Override + public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo) + { + return ipcEquipInfoMapper.insertIpcEquipInfo(ipcEquipInfo); + } + + /** + * 修改设备信息 + * + * @param ipcEquipInfo 设备信息 + * @return 结果 + */ + @Override + public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo) + { + return ipcEquipInfoMapper.updateIpcEquipInfo(ipcEquipInfo); + } + + /** + * 批量删除设备信息 + * + * @param ids 需要删除的设备信息主键 + * @return 结果 + */ + @Override + public int deleteIpcEquipInfoByIds(String[] ids) + { + return ipcEquipInfoMapper.deleteIpcEquipInfoByIds(ids); + } + + /** + * 删除设备信息信息 + * + * @param id 设备信息主键 + * @return 结果 + */ + @Override + public int deleteIpcEquipInfoById(String id) + { + return ipcEquipInfoMapper.deleteIpcEquipInfoById(id); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IDataQueryService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IDataQueryService.java new file mode 100644 index 0000000..02946dd --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IDataQueryService.java @@ -0,0 +1,36 @@ +package com.inspur.industrial.service; + +import java.util.Map; + +/** + * 采集数据查询业务层接口 + * @Author zhangjunwen + * @create 2024/4/1 + */ +public interface IDataQueryService { + + /** + * 查询最近一分钟内数据超压底缸加压液压系统大屏数据 + */ + public Map queryBottomCylScreenData(); + + + /** + * 查询最近一分钟内顶辊数据 + * @return + */ + public Map queryTopScollerScreenData(); + + + + /** + * 查询最近一分钟内底辊数据 + * @return + */ + public Map queryBottomScollerScreenData(); + + /** + * 根据起止时间和字段名称查询数据 + */ + public Map queryScreenDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime); +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java new file mode 100644 index 0000000..e982454 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java @@ -0,0 +1,352 @@ +package com.inspur.industrial.service.impl; + +import com.inspur.industrial.service.IDataQueryService; +import com.inspur.industrial.utils.InfluxdbTimeUtil; +import com.inspur.system.domain.SysConfig; +import com.inspur.system.service.ISysConfigService; +import com.inspur.system.service.influx.InfluxDBService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author zhangjunwen + * @create 2024/4/1 + */ +@Service +public class DataQueryService implements IDataQueryService { + + @Resource + private InfluxDBService influxDBUtils; + + @Resource + private ISysConfigService sysConfigService; + + /** + * 查询一分钟内超压底缸的数据 + * @return + */ + @Override + public Map queryBottomCylScreenData(){ + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", 60); + + Map resMap = new HashMap<>(); + resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量 + resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 + resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位 + resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值 + //TODO 获取系统液位高值和低值 + + resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度 + resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度 + resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度 + + //系统颗粒度 + resMap.put("sysgran4",list.get(0).get("gran4")); + resMap.put("sysgran6",list.get(0).get("gran6")); + resMap.put("sysgran14",list.get(0).get("gran14")); + resMap.put("sysgran21",list.get(0).get("gran21")); + +// Map oprsoftflw = (Map) new HashMap<>().put("oprsoftflw",list.get(0).get("opr_soft_flw") );//操作侧软辊流量 +// Map oprhotflw = (Map) new HashMap<>().put("oprhotflw",list.get(0).get("opr_hot_flw") );//操作侧热辊流量 +// Map drivensoftflw = (Map) new HashMap<>().put("drivensoftflw",list.get(0).get("driven_soft_flw") );//传动侧软辊流量 +// Map drivenhotflw = (Map) new HashMap<>().put("drivenhotflw",list.get(0).get("driven_hot_flw") );//传动侧软辊流量 + + resMap.put("oprservo",list.get(0).get("opr_servo"));//操作侧底缸比例换向阀 + resMap.put("drivenservo",list.get(0).get("driven_servo"));//操作侧底缸比例换向阀 + + //功率= √3IUcosΦ/1000 + resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000); + //系统效率 = 系统压力*系统流量/系统功率 + double power = (double) resMap.get("syspower"); + double sysflw = (double)resMap.get("sysflw"); + double pressure = (double)resMap.get("sysprs"); + resMap.put("syseff",pressure * sysflw/power); + + List syscur = new ArrayList<>();//系统电流 + + List oprbottompress = new ArrayList<>();//底缸操作侧压力 + List drivenbottompress = new ArrayList<>();//底缸传动侧压力 + + List oprsoftrealpress = new ArrayList<>();//操作侧软辊压力 + List oprsoftbondpress = new ArrayList<>();//操作侧软辊合辊压力 + List oprsoftactpress = new ArrayList<>();//操作侧软辊加压压力 + List oprhotrealpress = new ArrayList<>();//操作侧热辊压力 + List oprhotbondpress = new ArrayList<>();//操作侧热辊合辊压力 + List oprhotactpress = new ArrayList<>();//操作侧热辊加压压力 + + List drivensoftrealpress = new ArrayList<>();//传动侧软辊压力 + List drivensoftbondpress = new ArrayList<>();//传动侧软辊合辊压力 + List drivensoftactpress = new ArrayList<>();//传动侧软辊加压压力 + List drivenhotrealpress = new ArrayList<>();//传动侧热辊压力 + List drivenhotbondpress = new ArrayList<>();//传动侧热辊合辊压力 + List drivenhotactpress = new ArrayList<>();//传动侧热辊加压压力 + + List oprbottomdis = new ArrayList<>();//操作侧底缸位移 + List drivenbottomdis = new ArrayList<>();//传动侧底缸位移 + + List timelist = new ArrayList<>(); + + for (int i = list.size() - 1; i >= 0; i--) { + Map data = list.get(i); + + syscur.add(data.get("sys_cur")); + + oprbottompress.add(data.get("opr_bottom_press") == null ? 0 : data.get("opr_bottom_press")); + drivenbottompress.add(data.get("driven_bottom_press") == null ? 0 : data.get("driven_bottom_press")); + + oprsoftrealpress.add(data.get("opr_soft_real_press") == null ? 0 : data.get("opr_soft_real_press")); + oprsoftbondpress.add(data.get("opr_soft_bond_press") == null ? 0 : data.get("opr_soft_bond_press")); + oprsoftactpress.add(data.get("opr_soft_act_press") == null ? 0 : data.get("opr_soft_act_press")); + oprhotrealpress.add(data.get("opr_hot_real_press") == null ? 0 : data.get("opr_hot_real_press")); + oprhotbondpress.add(data.get("opr_hot_bond_press") == null ? 0 : data.get("opr_hot_bond_press")); + oprhotactpress.add(data.get("opr_hot_act_press") == null ? 0 : data.get("opr_hot_act_press")); + + drivensoftrealpress.add(data.get("driven_soft_real_press") == null ? 0 : data.get("driven_soft_real_press")); + drivensoftbondpress.add(data.get("driven_soft_bond_press") == null ? 0 : data.get("driven_soft_bond_press")); + drivensoftactpress.add(data.get("driven_soft_act_press") == null ? 0 : data.get("driven_soft_act_press")); + drivenhotrealpress.add(data.get("driven_hot_real_press") == null ? 0 : data.get("driven_hot_real_press")); + drivenhotbondpress.add(data.get("driven_hot_bond_press") == null ? 0 : data.get("driven_hot_bond_press")); + drivenhotactpress.add(data.get("driven_hot_act_press") == null ? 0 : data.get("driven_hot_act_press")); + + oprbottomdis.add(data.get("opr_bottom_dis") == null ? 0 : data.get("opr_bottom_dis")); + drivenbottomdis.add(data.get("driven_bottom_dis") == null ? 0 : data.get("driven_bottom_dis")); + + LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); + timelist.add( time.getMinute() < 10 ? "0" + time.getMinute() : time.getMinute() + ":" + (time.getSecond() < 10 ? "0" + time.getSecond() : time.getSecond())); + } + + resMap.put("syscur",syscur); + + resMap.put("oprbottompress",oprbottompress); + resMap.put("drivenbottompress",drivenbottompress); + + resMap.put("oprsoftrealpress",oprsoftrealpress); + resMap.put("oprsoftbondpress",oprsoftbondpress); + resMap.put("oprsoftactpress",oprsoftactpress); + resMap.put("oprhotrealpress",oprhotrealpress); + resMap.put("oprhotbondpress",oprhotbondpress); + resMap.put("oprhotactpress",oprhotactpress); + + resMap.put("drivensoftrealpress",drivensoftrealpress); + resMap.put("drivensoftbondpress",drivensoftbondpress); + resMap.put("drivensoftactpress",drivensoftactpress); + resMap.put("drivenhotrealpress",drivenhotrealpress); + resMap.put("drivenhotbondpress",drivenhotbondpress); + resMap.put("drivenhotactpress",drivenhotactpress); + + resMap.put("oprbottomdis",oprbottomdis); + resMap.put("drivenbottomdis",drivenbottomdis); + + resMap.put("timelist",timelist); + + return resMap; + } + + /** + * 查询最近一分钟内顶辊数据 + * @return + */ + @Override + public Map queryTopScollerScreenData(){ + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", 60); + return queryScollerData(list); + } + + /** + * 查询最近一分钟内底辊数据 + * @return + */ + @Override + public Map queryBottomScollerScreenData(){ + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", 60); + return queryScollerData(list); + } + + /** + * 根据起止时间和字段名称查询数据 + */ + @Override + public Map queryScreenDataByColumnNameandDate(String tableName,String columnName, String startTime, String endTime){ + String utcStartTime = InfluxdbTimeUtil.cstToUtc(startTime); + String utcEndTime = InfluxdbTimeUtil.cstToUtc(endTime); + + Map resMap = new HashMap<>(); + List> list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime); + if (list.size() == 0){ + return null; + } + + List columnList = new ArrayList<>(); + List timelist = new ArrayList<>(); + list.forEach(data ->{ + columnList.add(data.get(columnName)); + LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + timelist.add(time.format(formatter)); + }); + + resMap.put("y", columnList); + resMap.put("x", timelist); + + return resMap; + } + + /** + * 根据设备id查询最近num条数据 + * @param tableName 表名 + * @param equipId 设备id + * @param num 条数 + * @return 数据 + */ + private List> selectAllDataByEquId(String tableName, String equipId, int num){ + String sql = "select * from " + tableName + " where equ_id = '" + equipId + "' order by time desc limit " + num; + return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); + } + + /** + * 根据字段名称和起止时间查询数据 + * @param tableName 表名 + * @param columnName 字段名称 + * @param startTime 起始时间 + * @param endTime 结束时间 + * @return 数据 + */ + private List> selectDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime){ + String sql = "select time," + columnName + " from " + tableName + " where time >= '" + startTime + "' and time <= '" + endTime + "'"; + return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); + } + + /** + * 查询辊子的数据 + * @param list 查询的数据 + * @return 辊子大屏数据 + */ + private Map queryScollerData(List> list) + { + Map resMap = new HashMap<>(); + resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量 + resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 + resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位 + resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值 + //TODO 获取系统液位高值和低值 + + resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度 + resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度 + resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度 + + //系统颗粒度 + resMap.put("sysgran4",list.get(0).get("gran4")); + resMap.put("sysgran6",list.get(0).get("gran6")); + resMap.put("sysgran14",list.get(0).get("gran14")); + resMap.put("sysgran21",list.get(0).get("gran21")); + + resMap.put("linespeed",list.get(0).get("line_speed"));//车速 + + //功率= √3IUcosΦ/1000 + resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000); + //系统效率 = 系统压力*系统流量/系统功率 + double power = (double) resMap.get("syspower"); + double sysflw = (double)resMap.get("sysflw"); + double pressure = (double)resMap.get("sysprs"); + resMap.put("syseff",pressure * sysflw/power); + + List syscur = new ArrayList<>();//系统电流 + + List flw1 = new ArrayList<>();//一区流量 + List flw2 = new ArrayList<>();//二区流量 + List flw3 = new ArrayList<>();//三区流量 + List flw4 = new ArrayList<>();//四区流量 + List flw5 = new ArrayList<>();//五区流量 + List flw6 = new ArrayList<>();//六区流量 + List flw7 = new ArrayList<>();//七区流量 + List flw8 = new ArrayList<>();//八区流量 + List flw9 = new ArrayList<>();//九区流量 + List flw10 = new ArrayList<>();//十区流量 + List flw11 = new ArrayList<>();//十一区流量 + + List prs1 = new ArrayList<>();//一区压力 + List prs2 = new ArrayList<>();//二区压力 + List prs3 = new ArrayList<>();//三区压力 + List prs4 = new ArrayList<>();//四区压力 + List prs5 = new ArrayList<>();//五区压力 + List prs6 = new ArrayList<>();//六区压力 + List prs7 = new ArrayList<>();//七区压力 + List prs8 = new ArrayList<>();//八区压力 + List prs9 = new ArrayList<>();//九区压力 + List prs10 = new ArrayList<>();//十区压力 + List prs11 = new ArrayList<>();//十一区压力 + + List timelist = new ArrayList<>(); + + for (int i = list.size() - 1; i >= 0; i--) { + Map data = list.get(i); + + syscur.add(data.get("sys_cur") == null ? 0 : data.get("sys_cur")); + + flw1.add(data.get("flw1") == null ? 0 : data.get("flw1")); + flw2.add(data.get("flw2") == null ? 0 : data.get("flw2")); + flw3.add(data.get("flw3") == null ? 0 : data.get("flw3")); + flw4.add(data.get("flw4") == null ? 0 : data.get("flw4")); + flw5.add(data.get("flw5") == null ? 0 : data.get("flw5")); + flw6.add(data.get("flw6") == null ? 0 : data.get("flw6")); + flw7.add(data.get("flw7") == null ? 0 : data.get("flw7")); + flw8.add(data.get("flw8") == null ? 0 : data.get("flw8")); + flw9.add(data.get("flw9") == null ? 0 : data.get("flw9")); + flw10.add(data.get("flw10") == null ? 0 : data.get("flw10")); + flw11.add(data.get("flw11") == null ? 0 : data.get("flw11")); + + prs1.add(data.get("press1") == null ? 0 : data.get("press1")); + prs2.add(data.get("press2") == null ? 0 : data.get("press2")); + prs3.add(data.get("press3") == null ? 0 : data.get("press3")); + prs4.add(data.get("press4") == null ? 0 : data.get("press4")); + prs5.add(data.get("press5") == null ? 0 : data.get("press5")); + prs6.add(data.get("press6") == null ? 0 : data.get("press6")); + prs7.add(data.get("press7") == null ? 0 : data.get("press7")); + prs8.add(data.get("press8") == null ? 0 : data.get("press8")); + prs9.add(data.get("press9") == null ? 0 : data.get("press9")); + prs10.add(data.get("press10") == null ? 0 : data.get("press10")); + prs11.add(data.get("press11") == null ? 0 : data.get("press11")); + + LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); + timelist.add( time.getMinute() < 10 ? "0" + time.getMinute() : time.getMinute() + ":" + (time.getSecond() < 10 ? "0" + time.getSecond() : time.getSecond())); + } + + resMap.put("syscur",syscur); + + resMap.put("flw1",flw1); + resMap.put("flw2",flw2); + resMap.put("flw3",flw3); + resMap.put("flw4",flw4); + resMap.put("flw5",flw5); + resMap.put("flw6",flw6); + resMap.put("flw7",flw7); + resMap.put("flw8",flw8); + resMap.put("flw9",flw9); + resMap.put("flw10",flw10); + resMap.put("flw11",flw11); + + resMap.put("prs1",prs1); + resMap.put("prs2",prs2); + resMap.put("prs3",prs3); + resMap.put("prs4",prs4); + resMap.put("prs5",prs5); + resMap.put("prs6",prs6); + resMap.put("prs7",prs7); + resMap.put("prs8",prs8); + resMap.put("prs9",prs9); + resMap.put("prs10",prs10); + resMap.put("prs11",prs11); + + resMap.put("timelist",timelist); + + return resMap; + } + +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/InfluxdbTimeUtil.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/InfluxdbTimeUtil.java new file mode 100644 index 0000000..c7288de --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/InfluxdbTimeUtil.java @@ -0,0 +1,38 @@ +package com.inspur.industrial.utils; + + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; + +/** + *influxdb时间工具类 + * @Author zhangjunwen + * @create 2024/4/1 + */ +public class InfluxdbTimeUtil { + + /** + * 将utc时间转北京时间 + * @param date utc时间 + * @return 北京时间 + */ + public static LocalDateTime utcToCst(String date) { + DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME; + LocalDateTime localDateTime = LocalDateTime.parse(date, formatter); + return localDateTime.plusHours(8); + } + + /** + * 将北京时间转utc时间 + * @param date 北京时间 + * @return utc时间 + * 例如:输入”2020-04-01T08:00:00.000“ + * 返回”2020-04-01T00:00:00.000Z“ + */ + public static String cstToUtc(String date){ + LocalDateTime localDateTime = LocalDateTime.parse(date); + String utcTime = localDateTime.atZone(ZoneId.of("UTC+8")).withZoneSameInstant(ZoneId.of("UTC")).format(DateTimeFormatter.ISO_DATE_TIME); + return utcTime.substring(0, utcTime.indexOf("Z")+1); + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/domain/IpcSensorInfo.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/domain/IpcSensorInfo.java new file mode 100644 index 0000000..d4f6ccb --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/domain/IpcSensorInfo.java @@ -0,0 +1,123 @@ +package com.inspur.sensor.domain; + +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; + +/** + * 传感器信息对象 ipc_sensor_info + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +public class IpcSensorInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 传感器id */ + private String id; + + /** 传感器编号 */ + @Excel(name = "传感器编号") + private String sensorNum; + + /** 传感器名称 */ + @Excel(name = "传感器名称") + private String sensorName; + + /** 传感器型号 */ + @Excel(name = "传感器型号") + private String sensorModel; + + /** 生产厂商 */ + @Excel(name = "生产厂商") + private String sensorManufacturer; + + /** 类型 */ + @Excel(name = "类型") + private String sensorType; + + /** 设备id */ + @Excel(name = "设备id") + private String equipId; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setSensorNum(String sensorNum) + { + this.sensorNum = sensorNum; + } + + public String getSensorNum() + { + return sensorNum; + } + public void setSensorName(String sensorName) + { + this.sensorName = sensorName; + } + + public String getSensorName() + { + return sensorName; + } + public void setSensorModel(String sensorModel) + { + this.sensorModel = sensorModel; + } + + public String getSensorModel() + { + return sensorModel; + } + public void setSensorManufacturer(String sensorManufacturer) + { + this.sensorManufacturer = sensorManufacturer; + } + + public String getSensorManufacturer() + { + return sensorManufacturer; + } + public void setSensorType(String sensorType) + { + this.sensorType = sensorType; + } + + public String getSensorType() + { + return sensorType; + } + public void setEquipId(String equipId) + { + this.equipId = equipId; + } + + public String getEquipId() + { + return equipId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("sensorNum", getSensorNum()) + .append("sensorName", getSensorName()) + .append("sensorModel", getSensorModel()) + .append("sensorManufacturer", getSensorManufacturer()) + .append("sensorType", getSensorType()) + .append("equipId", getEquipId()) + .append("remark", getRemark()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/mapper/IpcSensorInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/mapper/IpcSensorInfoMapper.java new file mode 100644 index 0000000..e1abc69 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/mapper/IpcSensorInfoMapper.java @@ -0,0 +1,62 @@ +package com.inspur.sensor.mapper; + +import java.util.List; +import com.inspur.sensor.domain.IpcSensorInfo; + +/** + * 传感器信息Mapper接口 + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +public interface IpcSensorInfoMapper +{ + /** + * 查询传感器信息 + * + * @param id 传感器信息主键 + * @return 传感器信息 + */ + public IpcSensorInfo selectIpcSensorInfoById(String id); + + /** + * 查询传感器信息列表 + * + * @param ipcSensorInfo 传感器信息 + * @return 传感器信息集合 + */ + public List selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo); + + /** + * 新增传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo); + + /** + * 修改传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo); + + /** + * 删除传感器信息 + * + * @param id 传感器信息主键 + * @return 结果 + */ + public int deleteIpcSensorInfoById(String id); + + /** + * 批量删除传感器信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcSensorInfoByIds(String[] ids); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/IIpcSensorInfoService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/IIpcSensorInfoService.java new file mode 100644 index 0000000..fe4a00d --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/IIpcSensorInfoService.java @@ -0,0 +1,62 @@ +package com.inspur.sensor.service; + +import java.util.List; +import com.inspur.sensor.domain.IpcSensorInfo; + +/** + * 传感器信息Service接口 + * + * @author inspur + * @date 2024-04-01 + */ +public interface IIpcSensorInfoService +{ + /** + * 查询传感器信息 + * + * @param id 传感器信息主键 + * @return 传感器信息 + */ + public IpcSensorInfo selectIpcSensorInfoById(String id); + + /** + * 查询传感器信息列表 + * + * @param ipcSensorInfo 传感器信息 + * @return 传感器信息集合 + */ + public List selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo); + + /** + * 新增传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo); + + /** + * 修改传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo); + + /** + * 批量删除传感器信息 + * + * @param ids 需要删除的传感器信息主键集合 + * @return 结果 + */ + public int deleteIpcSensorInfoByIds(String[] ids); + + /** + * 删除传感器信息信息 + * + * @param id 传感器信息主键 + * @return 结果 + */ + public int deleteIpcSensorInfoById(String id); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/impl/IpcSensorInfoServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/impl/IpcSensorInfoServiceImpl.java new file mode 100644 index 0000000..01d6bb4 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/sensor/service/impl/IpcSensorInfoServiceImpl.java @@ -0,0 +1,94 @@ +package com.inspur.sensor.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.sensor.mapper.IpcSensorInfoMapper; +import com.inspur.sensor.domain.IpcSensorInfo; +import com.inspur.sensor.service.IIpcSensorInfoService; + +/** + * 传感器信息Service业务层处理 + * + * @Author zhangjunwen + * @create 2024/4/1 + */ +@Service +public class IpcSensorInfoServiceImpl implements IIpcSensorInfoService +{ + @Autowired + private IpcSensorInfoMapper ipcSensorInfoMapper; + + /** + * 查询传感器信息 + * + * @param id 传感器信息主键 + * @return 传感器信息 + */ + @Override + public IpcSensorInfo selectIpcSensorInfoById(String id) + { + return ipcSensorInfoMapper.selectIpcSensorInfoById(id); + } + + /** + * 查询传感器信息列表 + * + * @param ipcSensorInfo 传感器信息 + * @return 传感器信息 + */ + @Override + public List selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo) + { + return ipcSensorInfoMapper.selectIpcSensorInfoList(ipcSensorInfo); + } + + /** + * 新增传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + @Override + public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo) + { + return ipcSensorInfoMapper.insertIpcSensorInfo(ipcSensorInfo); + } + + /** + * 修改传感器信息 + * + * @param ipcSensorInfo 传感器信息 + * @return 结果 + */ + @Override + public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo) + { + return ipcSensorInfoMapper.updateIpcSensorInfo(ipcSensorInfo); + } + + /** + * 批量删除传感器信息 + * + * @param ids 需要删除的传感器信息主键 + * @return 结果 + */ + @Override + public int deleteIpcSensorInfoByIds(String[] ids) + { + return ipcSensorInfoMapper.deleteIpcSensorInfoByIds(ids); + } + + /** + * 删除传感器信息信息 + * + * @param id 传感器信息主键 + * @return 结果 + */ + @Override + public int deleteIpcSensorInfoById(String id) + { + return ipcSensorInfoMapper.deleteIpcSensorInfoById(id); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml new file mode 100644 index 0000000..6bd0473 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + select id, equip_num, equip_name, equip_manufacturer, equip_serial_num, equip_production_date, remark from ipc_equip_info + + + + + + + + insert into ipc_equip_info + + id, + equip_num, + equip_name, + equip_manufacturer, + equip_serial_num, + equip_production_date, + remark, + + + #{id}, + #{equipNum}, + #{equipName}, + #{equipManufacturer}, + #{equipSerialNum}, + #{equipProductionDate}, + #{remark}, + + + + + update ipc_equip_info + + equip_num = #{equipNum}, + equip_name = #{equipName}, + equip_manufacturer = #{equipManufacturer}, + equip_serial_num = #{equipSerialNum}, + equip_production_date = #{equipProductionDate}, + remark = #{remark}, + + where id = #{id} + + + + delete from ipc_equip_info where id = #{id} + + + + delete from ipc_equip_info where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/sensor/IpcSensorInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/sensor/IpcSensorInfoMapper.xml new file mode 100644 index 0000000..cfb4756 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/sensor/IpcSensorInfoMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + select id, sensor_num, sensor_name, sensor_model, sensor_manufacturer, sensor_type, equip_id, remark from ipc_sensor_info + + + + + + + + insert into ipc_sensor_info + + id, + sensor_num, + sensor_name, + sensor_model, + sensor_manufacturer, + sensor_type, + equip_id, + remark, + + + #{id}, + #{sensorNum}, + #{sensorName}, + #{sensorModel}, + #{sensorManufacturer}, + #{sensorType}, + #{equipId}, + #{remark}, + + + + + update ipc_sensor_info + + sensor_num = #{sensorNum}, + sensor_name = #{sensorName}, + sensor_model = #{sensorModel}, + sensor_manufacturer = #{sensorManufacturer}, + sensor_type = #{sensorType}, + equip_id = #{equipId}, + remark = #{remark}, + + where id = #{id} + + + + delete from ipc_sensor_info where id = #{id} + + + + delete from ipc_sensor_info where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-ui/package.json b/zfipc-ui/package.json index 726500a..6cd9651 100644 --- a/zfipc-ui/package.json +++ b/zfipc-ui/package.json @@ -5,7 +5,7 @@ "author": "", "license": "MIT", "scripts": { - "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", + "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", diff --git a/zfipc-ui/src/views/zf/cydg/yxjk.vue b/zfipc-ui/src/views/zf/cydg/yxjk.vue index 38c02bf..86779fd 100644 --- a/zfipc-ui/src/views/zf/cydg/yxjk.vue +++ b/zfipc-ui/src/views/zf/cydg/yxjk.vue @@ -19,7 +19,10 @@ class="dataCol" >
-
软辊合辊压力{{dsrghgyl}}bar
+
软辊合辊压力{{dsrghgyl}}bar
软辊加压压力{{dsrgjyyl}}bar
软辊实际压力{{dsrgsjyl}}bar
热辊合辊压力{{dsreghgyl}}bar
@@ -592,6 +595,64 @@ + + +
+ 时间 + + + 查 询 + 重置 +
+ +
+
+ 暂无数据 +
+
@@ -600,6 +661,14 @@ import * as echarts from "echarts"; import { isArray, merge } from "lodash"; import { cydgdata, cydgdataHistory } from "@/api/testScreen/testScreen.js"; import lbCompents from "../lb"; +import { + listBottomCylData, + listTopScollerData, + listBottomScollerData, + getBottomCylDataByDate, + getTopScollerDataByDate, + getBottomScollerDataByDate, +} from "@/api/data/query.js"; export default { name: "yxjk", components: { lbCompents }, @@ -683,6 +752,17 @@ export default { dgczcygwy: 0, // 有效开机率 percentage: 80, + dialogTitle: "", + isOpen: false, + chartLoading: false, + isNoData: false, + height: "300%", + queryParams: { + columnName: null, + startTime: null, + endTime: null, + }, + datetime: "", }; }, beforeDestroy() { @@ -692,6 +772,7 @@ export default { mounted() { this.queryDataInit(); this.intervalTask = setInterval(() => { + // this.test(); // 查询数据 this.queryData(); }, 1000); @@ -702,6 +783,214 @@ export default { }, 60 * 1000); }, methods: { + formatDateTime(date) { + return ( + date.getFullYear() + + "-" + + this.padZero(date.getMonth() + 1) + + "-" + + this.padZero(date.getDate()) + + "T" + + this.padZero(date.getHours()) + + ":" + + this.padZero(date.getMinutes()) + + ":" + + this.padZero(date.getSeconds()) + ); + }, + padZero(num) { + return num < 10 ? "0" + num : num; + }, + handleQuery() { + let startTime = new Date(this.datetime); + this.queryParams.startTime = this.formatDateTime(startTime); + let endTime = startTime; + endTime.setHours(endTime.getHours() + 10); + this.queryParams.endTime = this.formatDateTime(endTime); + console.log("查询的参数:", this.queryParams); + + this.getData(this.queryParams); + }, + resetQuery() { + this.datetime = new Date(); + }, + getData(queryObj) { + this.chartLoading = true; + //倒谱 + getBottomCylDataByDate(queryObj).then((response) => { + if (response.data == null) { + this.chartLoading = false; + this.isNoData = true; + } else { + this.isNoData = false; + this.initchart(response.data); + } + }); + }, + initchart(data) { + let p = new Promise((resolve) => { + resolve(); + }); + p.then(() => { + this.chart = echarts.init(this.$refs.chart); + let option = { + color: ["#637DCB"], + title: { + text: "", + right: "100", + textStyle: { fontWeight: "normal", color: "#637DCB" }, + }, + toolbox: { + top: 0, + itemSize: 13, //工具栏 icon 的大小 + iconStyle: { + color: "transparent", + borderColor: "#fff", + }, + feature: { + dataZoom: { + yAxisIndex: "none", + }, + restore: { show: false }, + saveAsImage: { show: false }, + }, + }, + tooltip: { + //提示框 + trigger: "axis", + axisPointer: { + type: "line", //显示提示框的时候的背景 line是一条线 shadow是个背景框 + }, + backgroundColor: "#fff", + extraCssText: "box-shadow: 4px 4px 4px 2px rgba(0, 0, 0, 0.2)", //提示框加阴影效果 + textStyle: { + color: "#4E5969", //设置文字颜色 + }, + formatter: (prams) => { + let name = parseFloat(_.get(prams, [0, "name"])).toFixed(4); + let value = parseFloat(_.get(prams, [0, "value"])).toFixed(4); + return ( + "" + + `(${name}` + + "," + + `${value})` + + "" + ); + }, + }, + xAxis: [ + { + type: "category", + name: "ms", + data: data.x, + nameTextStyle: { fontSize: "9" }, + axisLine: { + show: true, + lineStyle: { + color: "#fff", + width: 0, //这里是为了突出显示加上的 + }, + }, + axisLabel: { + textStyle: { + color: "#fff", + fontSize: "9", + }, + showMaxLabel: true, + showMinLabel: true, + }, + }, + ], + yAxis: [ + { + name: "dB", + type: "value", + nameLocation: "end", + nameTextStyle: { + color: "#fff", + fontSize: "9", + }, + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + interval: 0, + textStyle: { + fontSize: "9", + color: "#fff", + }, + }, + splitLine: { + //修改背景线条样式 + show: true, //是否展示 + lineStyle: { + color: "#3C506B", //线条颜色 + type: "dashed", //线条样式,默认是实现,dashed是虚线 + }, + }, + }, + ], + grid: { + left: "3%", + right: "8%", + bottom: "18%", + top: "14%", + containLabel: true, + }, + dataZoom: [ + { + show: true, + type: "slider", + xAxisIndex: 0, + filterMode: "none", + start: 0, + end: data.x.length, + bottom: "1%", + fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。 + borderColor: "#3C506B", + }, + { + show: true, + type: "inside", + xAxisIndex: 0, + filterMode: "none", + start: 0, + end: 10, + bottom: "1%", + fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。 + borderColor: "#E0E6F3", + }, + ], + series: [ + { + type: "line", + data: data.y, + symbol: "none", + }, + ], + }; + this.chart.setOption(option); + this.chartLoading = false; + }); + }, + clicktest(event) { + console.log("点击:", event.target.outerText); + var selected = event.target.outerText; + this.dialogTitle = selected + "历史记录查询"; + this.isOpen = true; + this.isNoData = true; + if ((selected = "软辊合辊压力")) { + this.queryParams.columnName = "driven_soft_bond_press"; + } + }, + test() { + listTopScollerData().then((response) => { + console.log("底缸数据:", response.data); + }); + }, queryHistoryData() { cydgdataHistory().then((response) => { // 主参数报警