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 index d555ad5..d04dcd1 100644 --- 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 @@ -1,13 +1,19 @@ package com.inspur.web.controller.industrial; +import com.inspur.common.annotation.Log; import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.industrial.domain.BottomCylData; +import com.inspur.industrial.domain.IpcData; +import com.inspur.industrial.domain.ScollerData; 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 org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; /** * 传感器数据查询控制器 @@ -125,4 +131,52 @@ public class DataQueryController { { return AjaxResult.success(dataQueryService.getBottomScollerDataList(startTime, endTime, pageSize, pageNum)); } + + + /** + * 超压底缸导出数据记录 + */ + @Log(title = "超压底缸数据记录", businessType = BusinessType.EXPORT) + @PostMapping("/bottomCylExport") + public void bottomCylExport( + HttpServletResponse response, + String startTime, + String endTime + ) + { + Map resMap = dataQueryService.getBottomCylDataList(startTime, endTime, 0, 0); + ExcelUtil util = new ExcelUtil(BottomCylData.class); + util.exportExcel(response, (List)resMap.get("list"), "超压底缸数据"); + } + + /** + * 超压底缸导出数据记录 + */ + @Log(title = "数据记录", businessType = BusinessType.EXPORT) + @PostMapping("/topScollerExport") + public void topScollerExport( + HttpServletResponse response, + String startTime, + String endTime + ) + { + Map resMap = dataQueryService.getTopScollerDataList(startTime, endTime, 0, 0); + ExcelUtil util = new ExcelUtil(ScollerData.class); + util.exportExcel(response, (List)resMap.get("list"), "可控中高辊顶辊数据"); + } + + /** + * 超压底缸导出数据记录 + */ + @Log(title = "数据记录", businessType = BusinessType.EXPORT) + @PostMapping("/bottomScollerExport") + public void export( + HttpServletResponse response, + String startTime, + String endTime) + { + Map resMap = dataQueryService.getBottomScollerDataList(startTime, endTime, 0, 0); + ExcelUtil util = new ExcelUtil(ScollerData.class); + util.exportExcel(response, (List)resMap.get("list"), "可控中高辊底辊数据"); + } } 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 81fc361..d6c6716 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 @@ -68,9 +68,9 @@ public class IPCData2SyncThread implements Runnable { 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("ywcsz",0.5); +// fields.put("ywmin",0.3); +// fields.put("ywmax",1); // 系统温度 fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 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 52318a6..cbf1ca0 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 @@ -67,9 +67,9 @@ public class IPCData3SyncThread implements Runnable { 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("ywcsz",0.5); +// fields.put("ywmin",0.3); +// fields.put("ywmax",1); // 系统温度 fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/BottomCylData.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/BottomCylData.java new file mode 100644 index 0000000..5caf86e --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/BottomCylData.java @@ -0,0 +1,133 @@ +package com.inspur.industrial.domain; + +import com.inspur.common.annotation.Excel; +import lombok.Data; + +/** + * 底缸数据实体类 + * @Author zhangjunwen + * @create 2024/4/8 + */ +@Data +public class BottomCylData extends IpcData{ + @Excel(name = "操作侧软辊流量") + /** + * 操作侧软辊流量 + */ + private double opSoftFlow; + + @Excel(name = "操作侧热辊流量") + /** + * 操作侧热辊流量 + */ + private double opHotFlow; + + @Excel(name = "传动侧软辊流量") + /** + * 传动侧软辊流量 + */ + private double tranSoftFlow; + + @Excel(name = "传动侧热辊流量") + /** + * 传动侧热辊流量 + */ + private double tranHotFlow; + + @Excel(name = "操作侧底缸压力") + /** + * 操作侧底缸压力 + */ + private double opBottomPress; + + @Excel(name = "传动侧底缸压力") + /** + * 传动侧底缸压力 + */ + private double tranBottomPress; + + @Excel(name = "操作侧软辊实际压力") + /** + * 操作侧软辊实际压力 + */ + private double opSoftPress; + + @Excel(name = "操作侧软辊合辊压力") + /** + * 操作侧软辊合辊压力 + */ + private double opSoftHoldPress; + + @Excel(name = "操作侧软辊加压压力") + /** + * 操作侧软辊加压压力 + */ + private double opSoftPushPress; + + @Excel(name = "操作侧热辊实际压力") + /** + * 操作侧热辊实际压力 + */ + private double opHotPress; + + @Excel(name = "操作侧热辊合辊压力") + /** + * 操作侧热辊合辊压力 + */ + private double opHotHoldPress; + + @Excel(name = "操作侧热辊加压压力") + /** + * 操作侧热辊加压压力 + */ + private double opHotPushPress; + + @Excel(name = "传动侧软辊实际压力") + /** + * 传动侧软辊实际压力 + */ + private double tranSoftPress; + + @Excel(name = "传动侧软辊合辊压力") + /** + * 传动侧软辊合辊压力 + */ + private double tranSoftHoldPress; + + @Excel(name = "传动侧软辊加压压力") + /** + * 传动侧软辊加压压力 + */ + private double tranSoftPushPress; + + @Excel(name = "传动侧热辊实际压力") + /** + * 传动侧热辊实际压力 + */ + private double tranHotPress; + + @Excel(name = "传动侧热辊合辊压力") + /** + * 传动侧热辊合辊压力 + */ + private double tranHotHoldPress; + + @Excel(name = "传动侧热辊加压压力") + /** + * 传动侧热辊加压压力 + */ + private double tranHotPushPress; + + @Excel(name = "操作侧底缸位移") + /** + * 操作侧底缸位移 + */ + private double opBottomDis; + + @Excel(name = "传动侧底缸位移") + /** + * 传动侧底缸位移 + */ + private double tranBottomDis; + +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcData.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcData.java index f2dcc05..d2f461c 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcData.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcData.java @@ -1,5 +1,7 @@ package com.inspur.industrial.domain; +import com.inspur.common.annotation.Excel; +import com.inspur.common.annotation.Excels; import lombok.Data; /** @@ -9,273 +11,77 @@ import lombok.Data; @Data public class IpcData { + @Excel(name = "时间") /** * 时间 */ private String time; + @Excel(name = "系统流量") /** * 系统流量 */ private double sysFlow; + @Excel(name = "系统压力") /** * 系统压力 */ private double sysPress; + @Excel(name = "系统液位") /** * 系统液位 */ private double sysLevel; + @Excel(name = "系统电流") /** * 系统电流 */ private double sysCur; + @Excel(name = "系统温度") /** * 系统温度 */ private double sysTemp; + @Excel(name = "4mm颗粒度") /** * 4mm颗粒度 */ private double gran4; + @Excel(name = "6mm颗粒度") /** * 6mm颗粒度 */ private double gran6; + @Excel(name = "14mm颗粒度") /** * 14mm颗粒度 */ private double gran14; + @Excel(name = "21mm颗粒度") /** * 21mm颗粒度 */ private double gran21; + @Excel(name = "湿度") /** * 湿度 */ private double humi; + @Excel(name = "粘度") /** * 粘度 */ private double visc; - /** - * 操作侧软辊流量 - */ - private double opSoftFlow; - /** - * 操作侧热辊流量 - */ - private double opHotFlow; - - /** - * 传动侧软辊流量 - */ - private double tranSoftFlow; - - /** - * 传动侧热辊流量 - */ - private double tranHotFlow; - - /** - * 操作侧底缸压力 - */ - private double opBottomPress; - - /** - * 传动侧底缸压力 - */ - private double tranBottomPress; - - /** - * 操作侧软辊实际压力 - */ - private double opSoftPress; - - /** - * 操作侧软辊合辊压力 - */ - private double opSoftHoldPress; - - /** - * 操作侧软辊加压压力 - */ - private double opSoftPushPress; - - /** - * 操作侧热辊实际压力 - */ - private double opHotPress; - - /** - * 操作侧热辊合辊压力 - */ - private double opHotHoldPress; - - /** - * 操作侧热辊加压压力 - */ - private double opHotPushPress; - - /** - * 传动侧软辊实际压力 - */ - private double tranSoftPress; - - /** - * 传动侧软辊合辊压力 - */ - private double tranSoftHoldPress; - - /** - * 传动侧软辊加压压力 - */ - private double tranSoftPushPress; - - /** - * 传动侧热辊实际压力 - */ - private double tranHotPress; - - /** - * 传动侧热辊合辊压力 - */ - private double tranHotHoldPress; - - /** - * 传动侧热辊加压压力 - */ - private double tranHotPushPress; - - /** - * 操作侧底缸位移 - */ - private double opBottomDis; - - /** - * 传动侧底缸位移 - */ - private double tranBottomDis; - - /** - * 一区压力 - */ - private double press1; - - /** - * 二区压力 - */ - private double press2; - - /** - * 三区压力 - */ - private double press3; - - /** - * 四区压力 - */ - private double press4; - - /** - * 五区压力 - */ - private double press5; - - /** - * 六区压力 - */ - private double press6; - - /** - * 七区压力 - */ - private double press7; - - /** - * 八区压力 - */ - private double press8; - - /** - * 九区压力 - */ - private double press9; - - /** - * 十区压力 - */ - private double press10; - - /** - * 十一区压力 - */ - private double press11; - - /** - * 一区流量 - */ - private double flow1; - - /** - * 二区流量 - */ - private double flow2; - - /** - * 三区流量 - */ - private double flow3; - - /** - * 四区流量 - */ - private double flow4; - - /** - * 五区流量 - */ - private double flow5; - - /** - * 六区流量 - */ - private double flow6; - - /** - * 七区流量 - */ - private double flow7; - - /** - * 八区流量 - */ - private double flow8; - - /** - * 九区流量 - */ - private double flow9; - - /** - * 十区流量 - */ - private double flow10; - - /** - * 十一区流量 - */ - private double flow11; } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/ScollerData.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/ScollerData.java new file mode 100644 index 0000000..4067d70 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/ScollerData.java @@ -0,0 +1,146 @@ +package com.inspur.industrial.domain; + +import com.inspur.common.annotation.Excel; +import lombok.Data; + +/** + * 辊子数据 + * @Author zhangjunwen + * @create 2024/4/8 + */ +@Data +public class ScollerData extends IpcData{ + + @Excel(name = "一区压力") + /** + * 一区压力 + */ + private double press1; + + @Excel(name = "二区压力") + /** + * 二区压力 + */ + private double press2; + + @Excel(name = "三区压力") + /** + * 三区压力 + */ + private double press3; + + @Excel(name = "四区压力") + /** + * 四区压力 + */ + private double press4; + + @Excel(name = "五区压力") + /** + * 五区压力 + */ + private double press5; + + @Excel(name = "六区压力") + /** + * 六区压力 + */ + private double press6; + + @Excel(name = "七区压力") + /** + * 七区压力 + */ + private double press7; + + @Excel(name = "八区压力") + /** + * 八区压力 + */ + private double press8; + + @Excel(name = "九区压力") + /** + * 九区压力 + */ + private double press9; + + @Excel(name = "十区压力") + /** + * 十区压力 + */ + private double press10; + + @Excel(name = "十一区压力") + /** + * 十一区压力 + */ + private double press11; + + @Excel(name = "一区流量") + /** + * 一区流量 + */ + private double flow1; + + @Excel(name = "二区流量") + /** + * 二区流量 + */ + private double flow2; + + @Excel(name = "三区流量") + /** + * 三区流量 + */ + private double flow3; + + @Excel(name = "四区流量") + /** + * 四区流量 + */ + private double flow4; + + @Excel(name = "五区流量") + /** + * 五区流量 + */ + private double flow5; + + @Excel(name = "六区流量") + /** + * 六区流量 + */ + private double flow6; + + @Excel(name = "七区流量") + /** + * 七区流量 + */ + private double flow7; + + @Excel(name = "八区流量") + /** + * 八区流量 + */ + private double flow8; + + @Excel(name = "九区流量") + /** + * 九区流量 + */ + private double flow9; + + @Excel(name = "十区流量") + /** + * 十区流量 + */ + private double flow10; + + @Excel(name = "十一区流量") + /** + * 十一区流量 + */ + private double flow11; + +} 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 index d8398ff..b01c2e7 100644 --- 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 @@ -1,6 +1,8 @@ package com.inspur.industrial.service.impl; +import com.inspur.industrial.domain.BottomCylData; import com.inspur.industrial.domain.IpcData; +import com.inspur.industrial.domain.ScollerData; import com.inspur.industrial.service.IDataQueryService; import com.inspur.industrial.utils.InfluxdbTimeUtil; import com.inspur.system.domain.SysConfig; @@ -236,9 +238,9 @@ public class DataQueryService implements IDataQueryService { return null; } - List resList = new ArrayList<>(); + List resList = new ArrayList<>(); list.forEach(data -> { - IpcData ipcData = new IpcData(); + BottomCylData ipcData = new BottomCylData(); ipcData.setTime(InfluxdbTimeUtil.utcToCst(data.get("time").toString()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); ipcData.setSysCur(data.get("sys_cur") == null ? 0 : (double) data.get("sys_cur")); ipcData.setSysLevel(data.get("sys_level") == null ? 0 : (double) data.get("sys_level")); @@ -301,7 +303,7 @@ public class DataQueryService implements IDataQueryService { List> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", startTime, endTime, pageSize, pageNum); int total = countInfluxdbList("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", startTime, endTime); - List resList = getScollerDataList(list); + List resList = getScollerDataList(list); Map resMap = new HashMap<>(); resMap.put("total", total); @@ -315,11 +317,14 @@ public class DataQueryService implements IDataQueryService { */ @Override public Map getBottomScollerDataList(String startTime, String endTime, int pageSize, int pageNum){ + startTime = InfluxdbTimeUtil.cstToUtc(startTime); + endTime = InfluxdbTimeUtil.cstToUtc(endTime); + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", startTime, endTime, pageSize, pageNum); int total = countInfluxdbList("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", startTime, endTime); - List resList = getScollerDataList(list); + List resList = getScollerDataList(list); Map resMap = new HashMap<>(); resMap.put("total", total); @@ -333,7 +338,6 @@ public class DataQueryService implements IDataQueryService { * 根据设备id查询最近num条数据 * @param tableName 表名 * @param equipId 设备id - * @param num 条数 * @return 数据 */ private List> selectAllDataByEquId(String tableName, String equipId,String startTime, String endTime, int pageSize, int pageNum){ @@ -496,14 +500,14 @@ public class DataQueryService implements IDataQueryService { return resMap; } - private List getScollerDataList(List> list) { + private List getScollerDataList(List> list) { if (list.size() == 0){ return null; } - List resList = new ArrayList<>(); + List resList = new ArrayList<>(); list.forEach(data -> { - IpcData ipcData = new IpcData(); - ipcData.setTime(InfluxdbTimeUtil.utcToCst(data.get("time").toString()).toString()); + ScollerData ipcData = new ScollerData(); + ipcData.setTime(InfluxdbTimeUtil.utcToCst(data.get("time").toString()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); ipcData.setSysCur(data.get("sys_cur") == null ? 0 : (double) data.get("sys_cur")); ipcData.setSysLevel(data.get("sys_level") == null ? 0 : (double) data.get("sys_level")); ipcData.setSysTemp(data.get("sys_temp") == null ? 0 : (double) data.get("sys_temp")); diff --git a/zfipc-ui/src/views/dataLog/index.vue b/zfipc-ui/src/views/dataLog/index.vue index 6902c42..cac621c 100644 --- a/zfipc-ui/src/views/dataLog/index.vue +++ b/zfipc-ui/src/views/dataLog/index.vue @@ -15,6 +15,7 @@ 导出
可控中高辊顶辊液压系统 + > +
+ 导出 +
+ + + 查 询 + 重置 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 可控中高辊底辊液压系统 + > +
+ 导出 +
+ + + 查 询 + 重置 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -319,15 +852,81 @@ export default { this.startRefresh(); }, methods: { - /** 导出按钮操作 */ - handleExport() { - this.download( - "patrol/card/export", - { - ...this.queryParams, - }, - this.activeName + `_${new Date().getTime()}.xlsx` - ); + handleTabClick() { + this.stopRefresh(); + // this.datetime = this.getDefaultTimeRange(); + // this.queryParams = { + // startTime : this.datetime[0], + // endTime : this.datetime[1], + // pageSize : 10, + // pageNum : 1, + // } + this.resetQueryParams(); + this.getList(); + this.startRefresh(); + }, + resetQueryParams() { + this.datetime = this.getDefaultTimeRange(); + this.queryParams = { + startTime: this.datetime[0], + endTime: this.datetime[1], + pageSize: 10, + pageNum: 1, + }; + }, + /** 超压底缸导出按钮操作 */ + handleBottomCylExport() { + if (this.total > 10000) { + this.$message({ + showClose: true, + message: "数据量过大,请联系管理员进行导出!", + type: "warning", + }); + } else { + this.download( + "dataQuery/bottomCylExport", + { + ...this.queryParams, + }, + `超压底缸数据_${new Date().getTime()}.xlsx` + ); + } + }, + /** 可控中高辊顶辊导出按钮操作 */ + handleTopScollerExport() { + if (this.total > 10000) { + this.$message({ + showClose: true, + message: "数据量过大,请联系管理员进行导出!", + type: "warning", + }); + } else { + this.download( + "dataQuery/topScollerExport", + { + ...this.queryParams, + }, + `可控中高辊顶辊数据_${new Date().getTime()}.xlsx` + ); + } + }, + /** 可控中高辊底辊导出按钮操作 */ + handleBottomScollerExport() { + if (this.total > 10000) { + this.$message({ + showClose: true, + message: "数据量过大,请联系管理员进行导出!", + type: "warning", + }); + } else { + this.download( + "dataQuery/bottomScollerExport", + { + ...this.queryParams, + }, + `可控中高辊底辊数据_${new Date().getTime()}.xlsx` + ); + } }, handleQuery() { this.stopRefresh(); @@ -375,11 +974,16 @@ export default { }); } else if (this.activeName == "topScoller") { getTopScollerData(this.queryParams).then((response) => { - console.log("顶辊数据:", response.data); + this.dataList = response.data.list; + this.total = response.data.total; + this.loading = false; }); } else { getBottomScollerData(this.queryParams).then((response) => { - console.log("底辊数据:", response.data); + console.log("底辊数据:", response); + this.dataList = response.data.list; + this.total = response.data.total; + this.loading = false; }); } },