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 160cd5e..d555ad5 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 @@ -86,4 +86,43 @@ public class DataQueryController { String tableName = "zfipc_industrial_monitor_data3"; return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime)); } + + /** + * 获取超压底缸数据记录 + * @return + */ + @GetMapping("/bottomCylData") + public AjaxResult getBottomCylData(String startTime, + String endTime, + @RequestParam("pageSize") int pageSize, + @RequestParam("pageNum") int pageNum) + { + return AjaxResult.success(dataQueryService.getBottomCylDataList(startTime, endTime, pageSize, pageNum)); + } + + /** + * 获取可控中高辊顶辊数据记录 + * @return + */ + @GetMapping("/topScollerData") + public AjaxResult getTopScollerData(String startTime, + String endTime, + @RequestParam("pageSize") int pageSize, + @RequestParam("pageNum") int pageNum) + { + return AjaxResult.success(dataQueryService.getTopScollerDataList(startTime, endTime, pageSize, pageNum)); + } + + /** + * 获取可控中高辊底辊数据记录 + * @return + */ + @GetMapping("/bottomScollerData") + public AjaxResult getBottomScollerData(String startTime, + String endTime, + @RequestParam("pageSize") int pageSize, + @RequestParam("pageNum") int pageNum) + { + return AjaxResult.success(dataQueryService.getBottomScollerDataList(startTime, endTime, pageSize, pageNum)); + } } diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java new file mode 100644 index 0000000..ba2b65f --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java @@ -0,0 +1,118 @@ +package com.inspur.web.controller.industrial; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.aspectj.weaver.loadtime.Aj; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +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.industrial.domain.IpcSysStatus; +import com.inspur.industrial.service.IIpcSysStatusService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 系统状态Controller + * + * @Author zhangjunwen + * @create 2024/4/3 + */ +@RestController +@RequestMapping("/system/status") +public class IpcSysStatusController extends BaseController +{ + @Autowired + private IIpcSysStatusService ipcSysStatusService; + + /** + * 查询系统状态列表 + */ + @PreAuthorize("@ss.hasPermi('system:status:list')") + @GetMapping("/list") + public TableDataInfo list(IpcSysStatus ipcSysStatus) + { + startPage(); + List list = ipcSysStatusService.selectIpcSysStatusList(ipcSysStatus); + return getDataTable(list); + } + + /** + * 系统信息 + */ + @GetMapping("/getSysStatus") + public AjaxResult getSysStatus(@RequestParam("equipName")String equipName) + { + return AjaxResult.success(ipcSysStatusService.selectLatestIpcSysStatusByEquipName(equipName)); + } + + /** + * 系统监控信息 + */ + @GetMapping("/getMonitorInfo") + public AjaxResult getMonitorInfo(@RequestParam("equipName")String equipName) + { + return AjaxResult.success(ipcSysStatusService.selectMonitorInfoByEquipName(equipName)); + } + + /** + * 导出系统状态列表 + */ + @PreAuthorize("@ss.hasPermi('system:status:export')") + @Log(title = "系统状态", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcSysStatus ipcSysStatus) + { + List list = ipcSysStatusService.selectIpcSysStatusList(ipcSysStatus); + ExcelUtil util = new ExcelUtil(IpcSysStatus.class); + util.exportExcel(response, list, "系统状态数据"); + } + + /** + * 获取系统状态详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:status:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(ipcSysStatusService.selectIpcSysStatusById(id)); + } + + /** + * 新增系统状态 + */ + @PreAuthorize("@ss.hasPermi('system:status:add')") + @Log(title = "系统状态", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcSysStatus ipcSysStatus) + { + return toAjax(ipcSysStatusService.insertIpcSysStatus(ipcSysStatus)); + } + + /** + * 修改系统状态 + */ + @PreAuthorize("@ss.hasPermi('system:status:edit')") + @Log(title = "系统状态", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcSysStatus ipcSysStatus) + { + return toAjax(ipcSysStatusService.updateIpcSysStatus(ipcSysStatus)); + } + + /** + * 删除系统状态 + */ + @PreAuthorize("@ss.hasPermi('system:status:remove')") + @Log(title = "系统状态", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(ipcSysStatusService.deleteIpcSysStatusByIds(ids)); + } +} + diff --git a/zfipc-server/zfipc-system/pom.xml b/zfipc-server/zfipc-system/pom.xml index f9967c6..0f4a6f5 100644 --- a/zfipc-server/zfipc-system/pom.xml +++ b/zfipc-server/zfipc-system/pom.xml @@ -40,6 +40,10 @@ poi-ooxml 4.1.2 + + org.projectlombok + lombok + 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 new file mode 100644 index 0000000..f2dcc05 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcData.java @@ -0,0 +1,281 @@ +package com.inspur.industrial.domain; + +import lombok.Data; + +/** + * @Author zhangjunwen + * @create 2024/4/7 + */ +@Data +public class IpcData { + + /** + * 时间 + */ + private String time; + + /** + * 系统流量 + */ + private double sysFlow; + + /** + * 系统压力 + */ + private double sysPress; + + /** + * 系统液位 + */ + private double sysLevel; + + /** + * 系统电流 + */ + private double sysCur; + + /** + * 系统温度 + */ + private double sysTemp; + + /** + * 4mm颗粒度 + */ + private double gran4; + + /** + * 6mm颗粒度 + */ + private double gran6; + + /** + * 14mm颗粒度 + */ + private double gran14; + + /** + * 21mm颗粒度 + */ + private double gran21; + + /** + * 湿度 + */ + private double humi; + + /** + * 粘度 + */ + 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/IpcSysStatus.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcSysStatus.java new file mode 100644 index 0000000..ba87bfa --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcSysStatus.java @@ -0,0 +1,116 @@ +package com.inspur.industrial.domain; + +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; + +import java.time.LocalDateTime; + +/** + * 系统状态对象 ipc_sys_status + * + * @Author zhangjunwen + * @create 2024/4/3 + */ +public class IpcSysStatus extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 系统时间id */ + private Long id; + + /** 停机维护时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "停机维护时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDateTime shutdownTime; + + /** 待机时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "待机时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDateTime standbyTime; + + /** 试运行时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "试运行时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDateTime trialTime; + + /** 正常生产时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "正常生产时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDateTime normalTime; + + /** + * 设备id + */ + private String equipId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setShutdownTime(LocalDateTime shutdownTime) + { + this.shutdownTime = shutdownTime; + } + + public LocalDateTime getShutdownTime() + { + return shutdownTime; + } + public void setStandbyTime(LocalDateTime standbyTime) + { + this.standbyTime = standbyTime; + } + + public LocalDateTime getStandbyTime() + { + return standbyTime; + } + public void setTrialTime(LocalDateTime trialTime) + { + this.trialTime = trialTime; + } + + public LocalDateTime getTrialTime() + { + return trialTime; + } + public void setNormalTime(LocalDateTime normalTime) + { + this.normalTime = normalTime; + } + + public LocalDateTime getNormalTime() + { + return normalTime; + } + + public String getEquipId() { + return equipId; + } + + public void setEquipId(String equipId) { + this.equipId = equipId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("createTime", getCreateTime()) + .append("shutdownTime", getShutdownTime()) + .append("standbyTime", getStandbyTime()) + .append("trialTime", getTrialTime()) + .append("normalTime", getNormalTime()) + .append("equipId", getEquipId()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java new file mode 100644 index 0000000..a8ba8c1 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java @@ -0,0 +1,85 @@ +package com.inspur.industrial.domain; + +/** + * 监测信息 + * @Author zhangjunwen + * @create 2024/4/3 + */ +public class MonitorInfo { + + /** + * 设备名 + */ + String equipName; + + /** + * 设备型号 + */ + String equipNum; + + /** + * 当前时间 + */ + String nowTime; + + /** + * 起始时间 + */ + String startTime; + + /** + * 在线时间 + */ + String onlineTime; + + public String getEquipName() { + return equipName; + } + + public void setEquipName(String equipName) { + this.equipName = equipName; + } + + public String getEquipNum() { + return equipNum; + } + + public void setEquipNum(String equipNum) { + this.equipNum = equipNum; + } + + public String getNowTime() { + return nowTime; + } + + public void setNowTime(String nowTime) { + this.nowTime = nowTime; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getOnlineTime() { + return onlineTime; + } + + public void setOnlineTime(String onlineTime) { + this.onlineTime = onlineTime; + } + + @Override + public String toString() { + return "MonitorInfo{" + + "equipName='" + equipName + '\'' + + ", equipNum='" + equipNum + '\'' + + ", nowTime='" + nowTime + '\'' + + ", startTime='" + startTime + '\'' + + ", onlineTime='" + onlineTime + '\'' + + '}'; + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java new file mode 100644 index 0000000..d91fd45 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java @@ -0,0 +1,69 @@ +package com.inspur.industrial.mapper; + +import java.util.List; +import com.inspur.industrial.domain.IpcSysStatus; + +/** + * 系统状态Mapper接口 + * + * @Author zhangjunwen + * @create 2024/4/3 + */ +public interface IpcSysStatusMapper +{ + /** + * 查询系统状态 + * + * @param id 系统状态主键 + * @return 系统状态 + */ + public IpcSysStatus selectIpcSysStatusById(Long id); + + /** + * 查询系统状态列表 + * + * @param ipcSysStatus 系统状态 + * @return 系统状态集合 + */ + public List selectIpcSysStatusList(IpcSysStatus ipcSysStatus); + + /** + * 根据设备查询最新一条系统状态 + * @param equipId 设备id + * @return 最新一条状态信息 + */ + public IpcSysStatus selectLatestIpcSysStatusByEquipId(String equipId); + + /** + * 新增系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + public int insertIpcSysStatus(IpcSysStatus ipcSysStatus); + + /** + * 修改系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + public int updateIpcSysStatus(IpcSysStatus ipcSysStatus); + + /** + * 删除系统状态 + * + * @param id 系统状态主键 + * @return 结果 + */ + public int deleteIpcSysStatusById(Long id); + + /** + * 批量删除系统状态 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcSysStatusByIds(Long[] ids); +} + 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 index 02946dd..4a4bab1 100644 --- 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 @@ -1,5 +1,8 @@ package com.inspur.industrial.service; +import com.inspur.industrial.domain.IpcData; + +import java.util.List; import java.util.Map; /** @@ -33,4 +36,19 @@ public interface IDataQueryService { * 根据起止时间和字段名称查询数据 */ public Map queryScreenDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime); + + /** + * 获取一分钟底缸数据数据 + */ + public Map getBottomCylDataList(String startTime, String endTime, int pageSize, int pageNum); + + /** + * 获取一分钟顶辊数据数据 + */ + public Map getTopScollerDataList(String startTime, String endTime, int pageSize, int pageNum); + + /** + * 获取一分钟底辊数据数据 + */ + public Map getBottomScollerDataList(String startTime, String endTime, int pageSize, int pageNum); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java new file mode 100644 index 0000000..8a65cff --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java @@ -0,0 +1,77 @@ +package com.inspur.industrial.service; + +import java.util.List; +import com.inspur.industrial.domain.IpcSysStatus; +import com.inspur.industrial.domain.MonitorInfo; + +/** + * 系统状态Service接口 + * + * @Author zhangjunwen + * @create 2024/4/3 + */ +public interface IIpcSysStatusService +{ + /** + * 查询系统状态 + * + * @param id 系统状态主键 + * @return 系统状态 + */ + public IpcSysStatus selectIpcSysStatusById(Long id); + + /** + * 查询系统状态列表 + * + * @param ipcSysStatus 系统状态 + * @return 系统状态集合 + */ + public List selectIpcSysStatusList(IpcSysStatus ipcSysStatus); + + /** + * 根据设备名查询最新一条系统状态 + * @param equipName 设备名 + * @return 最新一条状态信息 + */ + public IpcSysStatus selectLatestIpcSysStatusByEquipName(String equipName); + + /** + * 根据设备名查询监控信息 + * @param equipName 设备名 + * @return 监控信息 + */ + public MonitorInfo selectMonitorInfoByEquipName(String equipName); + + /** + * 新增系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + public int insertIpcSysStatus(IpcSysStatus ipcSysStatus); + + /** + * 修改系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + public int updateIpcSysStatus(IpcSysStatus ipcSysStatus); + + /** + * 批量删除系统状态 + * + * @param ids 需要删除的系统状态主键集合 + * @return 结果 + */ + public int deleteIpcSysStatusByIds(Long[] ids); + + /** + * 删除系统状态信息 + * + * @param id 系统状态主键 + * @return 结果 + */ + public int deleteIpcSysStatusById(Long id); +} + 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 e982454..d8398ff 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,5 +1,6 @@ package com.inspur.industrial.service.impl; +import com.inspur.industrial.domain.IpcData; import com.inspur.industrial.service.IDataQueryService; import com.inspur.industrial.utils.InfluxdbTimeUtil; import com.inspur.system.domain.SysConfig; @@ -10,6 +11,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -34,8 +36,10 @@ public class DataQueryService implements IDataQueryService { */ @Override public Map queryBottomCylScreenData(){ - List> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", 60); - + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", null, null, 60, 1); + if (list.size() == 0){ + return null; + } Map resMap = new HashMap<>(); resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量 resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 @@ -155,7 +159,10 @@ public class DataQueryService implements IDataQueryService { */ @Override public Map queryTopScollerScreenData(){ - List> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", 60); + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa",null,null, 60,1); + if (list.size() == 0){ + return null; + } return queryScollerData(list); } @@ -165,7 +172,7 @@ public class DataQueryService implements IDataQueryService { */ @Override public Map queryBottomScollerScreenData(){ - List> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", 60); + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", null, null , 60, 1); return queryScollerData(list); } @@ -177,20 +184,37 @@ public class DataQueryService implements IDataQueryService { String utcStartTime = InfluxdbTimeUtil.cstToUtc(startTime); String utcEndTime = InfluxdbTimeUtil.cstToUtc(endTime); + //计算utcStartTime与utcEndTime的时间差 + LocalDateTime stime = LocalDateTime.parse(startTime); + LocalDateTime etime = LocalDateTime.parse(endTime); + long intervalHours = ChronoUnit.HOURS.between(stime, etime); + List> list = new ArrayList<>(); + if(intervalHours <= 6){//6小时内全查 + list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime); + }else if(intervalHours <= 7*24 ){//7天内,每30s一个 + list = selectLongTimeDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime, "30s"); + }else if(intervalHours <= 30*24 ){//30天内,每2min一个 + list = selectLongTimeDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime, "2m"); + }else if (intervalHours <= 90*24){//90天以上,每4h一个 + list = selectLongTimeDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime, "6m"); + } + 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 ->{ + if(intervalHours > 6){ + columnName = "mean"; + } + for (Map data : list) { 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); @@ -198,6 +222,113 @@ public class DataQueryService implements IDataQueryService { return resMap; } + /** + * 获取一分钟底缸数据数据 + */ + @Override + public Map getBottomCylDataList(String startTime, String endTime, int pageSize, int pageNum){ + startTime = InfluxdbTimeUtil.cstToUtc(startTime); + endTime = InfluxdbTimeUtil.cstToUtc(endTime); + + List> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", startTime, endTime, pageSize, pageNum); + int total = countInfluxdbList("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", startTime, endTime); + if (list.size() == 0){ + return null; + } + + List resList = new ArrayList<>(); + list.forEach(data -> { + IpcData ipcData = new IpcData(); + 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")); + ipcData.setSysPress(data.get("sys_press") == null ? 0 : (double) data.get("sys_press")); + ipcData.setSysFlow(data.get("sys_flw") == null ? 0 : (double) data.get("sys_flw")); + ipcData.setHumi(data.get("oil_water") == null ? 0 : (double) data.get("oil_water")); + ipcData.setVisc(data.get("visc") == null ? 0 : (double) data.get("visc")); + + ipcData.setGran4(data.get("gran4") == null ? 0 : (double) data.get("gran4")); + ipcData.setGran6(data.get("gran6") == null ? 0 : (double) data.get("gran6")); + ipcData.setGran14(data.get("gran14") == null ? 0 : (double) data.get("gran14")); + ipcData.setGran21(data.get("gran21") == null ? 0 : (double) data.get("gran21")); + + ipcData.setOpSoftFlow(data.get("opr_soft_flw") == null ? 0 : (double) data.get("opr_soft_flw")); + ipcData.setOpHotFlow(data.get("opr_hot_flw") == null ? 0 : (double) data.get("opr_hot_flw")); + + ipcData.setTranSoftFlow(data.get("driven_soft_flw") == null ? 0 : (double) data.get("driven_soft_flw")); + ipcData.setTranHotFlow(data.get("driven_hot_flw") == null ? 0 : (double) data.get("driven_hot_flw")); + + ipcData.setOpBottomPress(data.get("opr_bottom_press") == null ? 0 : (double) data.get("opr_bottom_press")); + ipcData.setTranBottomPress(data.get("driven_bottom_press") == null ? 0 : (double) data.get("driven_bottom_press")); + + ipcData.setOpSoftPress(data.get("opr_soft_real_press") == null ? 0 : (double) data.get("opr_soft_real_press")); + ipcData.setOpSoftHoldPress(data.get("opr_soft_bond_press") == null ? 0 : (double) data.get("opr_soft_bond_press")); + ipcData.setOpSoftPushPress(data.get("opr_soft_act_press") == null ? 0 : (double) data.get("opr_soft_act_press")); + + ipcData.setOpHotPress(data.get("opr_hot_real_press") == null ? 0 : (double) data.get("opr_hot_real_press")); + ipcData.setOpHotHoldPress(data.get("opr_hot_bond_press") == null ? 0 : (double) data.get("opr_hot_bond_press")); + ipcData.setOpHotPushPress(data.get("opr_hot_act_press") == null ? 0 : (double) data.get("opr_hot_act_press")); + + ipcData.setTranSoftPress(data.get("driven_soft_real_press") == null ? 0 : (double) data.get("driven_soft_real_press")); + ipcData.setTranSoftHoldPress(data.get("driven_soft_bond_press") == null ? 0 : (double) data.get("driven_soft_bond_press")); + ipcData.setTranSoftPushPress(data.get("driven_soft_act_press") == null ? 0 : (double) data.get("driven_soft_act_press")); + + ipcData.setTranHotPress(data.get("driven_hot_real_press") == null ? 0 : (double) data.get("driven_hot_real_press")); + ipcData.setTranHotHoldPress(data.get("driven_hot_bond_press") == null ? 0 : (double) data.get("driven_hot_bond_press")); + ipcData.setTranHotPushPress(data.get("driven_hot_act_press") == null ? 0 : (double) data.get("driven_hot_act_press")); + + ipcData.setOpBottomDis(data.get("opr_bottom_dis") == null ? 0 : (double) data.get("opr_bottom_dis")); + ipcData.setTranBottomDis(data.get("driven_bottom_dis") == null ? 0 : (double) data.get("driven_bottom_dis")); + + resList.add(ipcData); + }); + + Map resMap = new HashMap<>(); + resMap.put("total", total); + resMap.put("list", resList); + + return resMap; + } + + /** + * 获取一分钟顶辊数据数据 + */ + @Override + public Map getTopScollerDataList(String startTime, String endTime, int pageSize, int pageNum){ + startTime = InfluxdbTimeUtil.cstToUtc(startTime); + endTime = InfluxdbTimeUtil.cstToUtc(endTime); + 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); + + Map resMap = new HashMap<>(); + resMap.put("total", total); + resMap.put("list", resList); + + return resMap; + } + + /** + * 获取一分钟底辊数据数据 + */ + @Override + public Map getBottomScollerDataList(String startTime, String endTime, int pageSize, int pageNum){ + 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); + + Map resMap = new HashMap<>(); + resMap.put("total", total); + resMap.put("list", resList); + + return resMap; + } + + /** * 根据设备id查询最近num条数据 * @param tableName 表名 @@ -205,8 +336,15 @@ public class DataQueryService implements IDataQueryService { * @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; + private List> selectAllDataByEquId(String tableName, String equipId,String startTime, String endTime, int pageSize, int pageNum){ + String sql = "select * from " + tableName + " where equ_id = '" + equipId + "'"; + if(startTime != null){ + sql += " and time >= '" + startTime + "'"; + } + if(endTime != null){ + sql += " and time <= '" + endTime + "'"; + } + sql += " order by time desc limit " + pageSize + " offset " +(pageNum - 1)*pageSize; return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); } @@ -223,6 +361,15 @@ public class DataQueryService implements IDataQueryService { return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); } + /** + * 查询长时间数据,每分钟取一条展示(最长3个月) + * @return + */ + private List> selectLongTimeDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime, String interval){ + String sql = "select time, mean(" + columnName + ") from " + tableName + " where time >= '" + startTime + "' and time <= '" + endTime + "' group by time(" + interval +")"; + return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); + } + /** * 查询辊子的数据 * @param list 查询的数据 @@ -349,4 +496,66 @@ public class DataQueryService implements IDataQueryService { return resMap; } + private List getScollerDataList(List> list) { + if (list.size() == 0){ + return null; + } + List resList = new ArrayList<>(); + list.forEach(data -> { + IpcData ipcData = new IpcData(); + ipcData.setTime(InfluxdbTimeUtil.utcToCst(data.get("time").toString()).toString()); + 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")); + ipcData.setSysPress(data.get("sys_press") == null ? 0 : (double) data.get("sys_press")); + ipcData.setSysFlow(data.get("sys_flw") == null ? 0 : (double) data.get("sys_flw")); + ipcData.setHumi(data.get("oil_water") == null ? 0 : (double) data.get("oil_water")); + ipcData.setVisc(data.get("visc") == null ? 0 : (double) data.get("visc")); + + ipcData.setGran4(data.get("gran4") == null ? 0 : (double) data.get("gran4")); + ipcData.setGran6(data.get("gran6") == null ? 0 : (double) data.get("gran6")); + ipcData.setGran14(data.get("gran14") == null ? 0 : (double) data.get("gran14")); + ipcData.setGran21(data.get("gran21") == null ? 0 : (double) data.get("gran21")); + + ipcData.setPress1(data.get("press1") == null ? 0 : (double) data.get("press1")); + ipcData.setPress2(data.get("press2") == null ? 0 : (double) data.get("press2")); + ipcData.setPress3(data.get("press3") == null ? 0 : (double) data.get("press3")); + ipcData.setPress4(data.get("press4") == null ? 0 : (double) data.get("press4")); + ipcData.setPress5(data.get("press5") == null ? 0 : (double) data.get("press5")); + ipcData.setPress6(data.get("press6") == null ? 0 : (double) data.get("press6")); + ipcData.setPress7(data.get("press7") == null ? 0 : (double) data.get("press7")); + ipcData.setPress8(data.get("press8") == null ? 0 : (double) data.get("press8")); + ipcData.setPress9(data.get("press9") == null ? 0 : (double) data.get("press9")); + ipcData.setPress10(data.get("press10") == null ? 0 : (double) data.get("press10")); + ipcData.setPress11(data.get("press11") == null ? 0 : (double) data.get("press11")); + + ipcData.setFlow1(data.get("flw1") == null ? 0 : (double) data.get("flw1")); + ipcData.setFlow2(data.get("flw2") == null ? 0 : (double) data.get("flw2")); + ipcData.setFlow3(data.get("flw3") == null ? 0 : (double) data.get("flw3")); + ipcData.setFlow4(data.get("flw4") == null ? 0 : (double) data.get("flw4")); + ipcData.setFlow5(data.get("flw5") == null ? 0 : (double) data.get("flw5")); + ipcData.setFlow6(data.get("flw6") == null ? 0 : (double) data.get("flw6")); + ipcData.setFlow7(data.get("flw7") == null ? 0 : (double) data.get("flw7")); + ipcData.setFlow8(data.get("flw8") == null ? 0 : (double) data.get("flw8")); + ipcData.setFlow9(data.get("flw9") == null ? 0 : (double) data.get("flw9")); + ipcData.setFlow10(data.get("flw10") == null ? 0 : (double) data.get("flw10")); + ipcData.setFlow11(data.get("flw11") == null ? 0 : (double) data.get("flw11")); + + resList.add(ipcData); + }); + return resList; + } + + private int countInfluxdbList(String tableName, String equipId,String startTime, String endTime){ + String sql = "select count(sys_cur) from " + tableName + " where equ_id = '" + equipId + "'"; + if(startTime != null){ + sql += " and time >= '" + startTime + "'"; + } + if(endTime != null){ + sql += " and time <= '" + endTime + "'"; + } + List> list = influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); + return list.size() == 0 ? 0 : ((Double)list.get(0).get("count")).intValue(); + } + } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java new file mode 100644 index 0000000..3fd487a --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java @@ -0,0 +1,166 @@ +package com.inspur.industrial.service.impl; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.List; +import com.inspur.common.utils.DateUtils; +import com.inspur.equip.domain.IpcEquipInfo; +import com.inspur.equip.service.IIpcEquipInfoService; +import com.inspur.industrial.domain.MonitorInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.industrial.mapper.IpcSysStatusMapper; +import com.inspur.industrial.domain.IpcSysStatus; +import com.inspur.industrial.service.IIpcSysStatusService; + +import javax.annotation.Resource; + +/** + * 系统状态Service业务层处理 + * + * @Author zhangjunwen + * @create 2024/4/3 + */ +@Service +public class IpcSysStatusServiceImpl implements IIpcSysStatusService +{ + @Autowired + private IpcSysStatusMapper ipcSysStatusMapper; + + @Resource + private IIpcEquipInfoService ipcEquipInfoService; + + /** + * 查询系统状态 + * + * @param id 系统状态主键 + * @return 系统状态 + */ + @Override + public IpcSysStatus selectIpcSysStatusById(Long id) + { + return ipcSysStatusMapper.selectIpcSysStatusById(id); + } + + /** + * 查询系统状态列表 + * + * @param ipcSysStatus 系统状态 + * @return 系统状态 + */ + @Override + public List selectIpcSysStatusList(IpcSysStatus ipcSysStatus) + { + return ipcSysStatusMapper.selectIpcSysStatusList(ipcSysStatus); + } + + /** + * 根据设备查询最新一条系统状态 + * @param equipId 设备id + * @return 最新一条状态信息 + */ + public IpcSysStatus selectLatestIpcSysStatusByEquipName(String equipName){ + + IpcEquipInfo queryEquipInfo = new IpcEquipInfo(); + queryEquipInfo.setEquipName(equipName); + List equipInfoList = ipcEquipInfoService.selectIpcEquipInfoList(queryEquipInfo); + if (equipInfoList.size() == 0){ + return null; + } + String equipId = equipInfoList.get(0).getId(); + return ipcSysStatusMapper.selectLatestIpcSysStatusByEquipId(equipId); + } + + /** + * 根据设备名查询监控信息 + * @param equipName 设备名 + * @return 监控信息 + */ + public MonitorInfo selectMonitorInfoByEquipName(String equipName){ + MonitorInfo monitorInfo = new MonitorInfo(); + IpcEquipInfo equipInfo = getEquipInfoByEquipName(equipName); + if (equipInfo == null){ + return null; + } + monitorInfo.setEquipName(equipInfo.getEquipName()); + monitorInfo.setEquipNum(equipInfo.getEquipNum()); + LocalDateTime now = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + monitorInfo.setNowTime(now.format(formatter)); + IpcSysStatus sysStatus = selectLatestIpcSysStatusByEquipName(equipName); + monitorInfo.setStartTime(sysStatus == null ? null : sysStatus.getTrialTime().format(formatter)); + //运行时间 + if(sysStatus != null && sysStatus.getTrialTime() != null) { + long hours = ChronoUnit.HOURS.between(sysStatus.getTrialTime(), now); + long minutes = ChronoUnit.MINUTES.between(sysStatus.getTrialTime(), now) % 60; + long seconds = ChronoUnit.SECONDS.between(sysStatus.getTrialTime(), now) % 60; + monitorInfo.setOnlineTime(hours + "小时" + minutes + "分钟" + seconds + "秒"); + } + return monitorInfo; + } + + /** + * 新增系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + @Override + public int insertIpcSysStatus(IpcSysStatus ipcSysStatus) + { + ipcSysStatus.setCreateTime(DateUtils.getNowDate()); + return ipcSysStatusMapper.insertIpcSysStatus(ipcSysStatus); + } + + /** + * 修改系统状态 + * + * @param ipcSysStatus 系统状态 + * @return 结果 + */ + @Override + public int updateIpcSysStatus(IpcSysStatus ipcSysStatus) + { + return ipcSysStatusMapper.updateIpcSysStatus(ipcSysStatus); + } + + /** + * 批量删除系统状态 + * + * @param ids 需要删除的系统状态主键 + * @return 结果 + */ + @Override + public int deleteIpcSysStatusByIds(Long[] ids) + { + return ipcSysStatusMapper.deleteIpcSysStatusByIds(ids); + } + + /** + * 删除系统状态信息 + * + * @param id 系统状态主键 + * @return 结果 + */ + @Override + public int deleteIpcSysStatusById(Long id) + { + return ipcSysStatusMapper.deleteIpcSysStatusById(id); + } + + /** + * 通过设备名获取设备信息 + */ + private IpcEquipInfo getEquipInfoByEquipName(String equipName){ + IpcEquipInfo queryEquipInfo = new IpcEquipInfo(); + queryEquipInfo.setEquipName(equipName); + List equipInfoList = ipcEquipInfoService.selectIpcEquipInfoList(queryEquipInfo); + if (equipInfoList.size() == 0){ + return null; + } + return equipInfoList.get(0); + } + +} + diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml new file mode 100644 index 0000000..347575c --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + select id, create_time, shutdown_time, standby_time, trial_time, normal_time, equip_id from ipc_sys_status + + + + + + + + + + + insert into ipc_sys_status + + create_time, + shutdown_time, + standby_time, + trial_time, + normal_time, + equip_id, + + + #{createTime}, + #{shutdownTime}, + #{standbyTime}, + #{trialTime}, + #{normalTime}, + #{equipId}, + + + + + update ipc_sys_status + + create_time = #{createTime}, + shutdown_time = #{shutdownTime}, + standby_time = #{standbyTime}, + trial_time = #{trialTime}, + normal_time = #{normalTime}, + equip_id = #{equipId} + + where id = #{id} + + + + delete from ipc_sys_status where id = #{id} + + + + delete from ipc_sys_status where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-ui/src/api/data/query.js b/zfipc-ui/src/api/data/query.js index 1fc9326..b1cc4fe 100644 --- a/zfipc-ui/src/api/data/query.js +++ b/zfipc-ui/src/api/data/query.js @@ -34,27 +34,46 @@ export function getBottomCylDataByDate(params) { } //根据时间查询可控中高辊顶辊数据 -export function getTopScollerDataByDate(columnName, startTime, endTime) { +export function getTopScollerDataByDate(params) { return request({ url: "/dataQuery/topScollerByDate", method: "get", - params: { - columnName: columnName, - startTime: startTime, - endTime: endTime, - }, + params: params, }); } // 根据时间查询可控中高辊顶辊数据 -export function getBottomScollerDataByDate(columnName, startTime, endTime) { +export function getBottomScollerDataByDate(params) { return request({ url: "/dataQuery/bottomScollerByDate", method: "get", - params: { - columnName: columnName, - startTime: startTime, - endTime: endTime, - }, + params: params, + }); +} + +// 查询超压底缸数据记录 +export function getBottomCylData(params) { + return request({ + url: "/dataQuery/bottomCylData", + method: "get", + params: params, + }); +} + +// 查询可控中高辊顶辊数据记录 +export function getTopScollerData(params) { + return request({ + url: "/dataQuery/topScollerData", + method: "get", + params: params, + }); +} + +// 查询可控中高辊底辊数据记录 +export function getBottomScollerData(params) { + return request({ + url: "/dataQuery/bottomScollerData", + method: "get", + params: params, }); } diff --git a/zfipc-ui/src/api/industrial/sysStatus.js b/zfipc-ui/src/api/industrial/sysStatus.js new file mode 100644 index 0000000..9833272 --- /dev/null +++ b/zfipc-ui/src/api/industrial/sysStatus.js @@ -0,0 +1,62 @@ +import request from "@/utils/request"; + +// 查询系统状态列表 +export function listStatus(query) { + return request({ + url: "/system/status/list", + method: "get", + params: query, + }); +} + +// 获取设备状态信息 +export function getStatusByEquipName(query) { + return request({ + url: "/system/status/getSysStatus", + method: "get", + params: query, + }); +} + +// 获取设备监控信息 +export function getMonitorInfoByEquipName(query) { + return request({ + url: "/system/status/getMonitorInfo", + method: "get", + params: query, + }); +} + +// 查询系统状态详细 +export function getStatus(id) { + return request({ + url: "/system/status/" + id, + method: "get", + }); +} + +// 新增系统状态 +export function addStatus(data) { + return request({ + url: "/system/status", + method: "post", + data: data, + }); +} + +// 修改系统状态 +export function updateStatus(data) { + return request({ + url: "/system/status", + method: "put", + data: data, + }); +} + +// 删除系统状态 +export function delStatus(id) { + return request({ + url: "/system/status/" + id, + method: "delete", + }); +} diff --git a/zfipc-ui/src/views/dataLog/index.vue b/zfipc-ui/src/views/dataLog/index.vue index 33a1c42..6902c42 100644 --- a/zfipc-ui/src/views/dataLog/index.vue +++ b/zfipc-ui/src/views/dataLog/index.vue @@ -12,157 +12,286 @@ @click="startRefresh" >自动刷新 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ 导出 +
+ + + 查 询 + 重置 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 可控中高辊顶辊液压系统 + 可控中高辊底辊液压系统 +