系统状态等和数据记录功能更新

This commit is contained in:
zhangjunwen 2024-04-08 09:34:43 +08:00
parent f18ad8ef04
commit 2ff1f7fa14
16 changed files with 1773 additions and 179 deletions

View File

@ -86,4 +86,43 @@ public class DataQueryController {
String tableName = "zfipc_industrial_monitor_data3"; String tableName = "zfipc_industrial_monitor_data3";
return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime)); 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));
}
} }

View File

@ -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<IpcSysStatus> 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<IpcSysStatus> list = ipcSysStatusService.selectIpcSysStatusList(ipcSysStatus);
ExcelUtil<IpcSysStatus> util = new ExcelUtil<IpcSysStatus>(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));
}
}

View File

@ -40,6 +40,10 @@
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>4.1.2</version> <version>4.1.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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<IpcSysStatus> 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);
}

View File

@ -1,5 +1,8 @@
package com.inspur.industrial.service; package com.inspur.industrial.service;
import com.inspur.industrial.domain.IpcData;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -33,4 +36,19 @@ public interface IDataQueryService {
* 根据起止时间和字段名称查询数据 * 根据起止时间和字段名称查询数据
*/ */
public Map<String, Object> queryScreenDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime); public Map<String, Object> queryScreenDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime);
/**
* 获取一分钟底缸数据数据
*/
public Map<String, Object> getBottomCylDataList(String startTime, String endTime, int pageSize, int pageNum);
/**
* 获取一分钟顶辊数据数据
*/
public Map<String, Object> getTopScollerDataList(String startTime, String endTime, int pageSize, int pageNum);
/**
* 获取一分钟底辊数据数据
*/
public Map<String, Object> getBottomScollerDataList(String startTime, String endTime, int pageSize, int pageNum);
} }

View File

@ -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<IpcSysStatus> 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);
}

View File

@ -1,5 +1,6 @@
package com.inspur.industrial.service.impl; package com.inspur.industrial.service.impl;
import com.inspur.industrial.domain.IpcData;
import com.inspur.industrial.service.IDataQueryService; import com.inspur.industrial.service.IDataQueryService;
import com.inspur.industrial.utils.InfluxdbTimeUtil; import com.inspur.industrial.utils.InfluxdbTimeUtil;
import com.inspur.system.domain.SysConfig; import com.inspur.system.domain.SysConfig;
@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -34,8 +36,10 @@ public class DataQueryService implements IDataQueryService {
*/ */
@Override @Override
public Map<String, Object> queryBottomCylScreenData(){ public Map<String, Object> queryBottomCylScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", 60); List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", null, null, 60, 1);
if (list.size() == 0){
return null;
}
Map<String, Object> resMap = new HashMap<>(); Map<String, Object> resMap = new HashMap<>();
resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量 resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力
@ -155,7 +159,10 @@ public class DataQueryService implements IDataQueryService {
*/ */
@Override @Override
public Map<String, Object> queryTopScollerScreenData(){ public Map<String, Object> queryTopScollerScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", 60); List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa",null,null, 60,1);
if (list.size() == 0){
return null;
}
return queryScollerData(list); return queryScollerData(list);
} }
@ -165,7 +172,7 @@ public class DataQueryService implements IDataQueryService {
*/ */
@Override @Override
public Map<String, Object> queryBottomScollerScreenData(){ public Map<String, Object> queryBottomScollerScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", 60); List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", null, null , 60, 1);
return queryScollerData(list); return queryScollerData(list);
} }
@ -177,20 +184,37 @@ public class DataQueryService implements IDataQueryService {
String utcStartTime = InfluxdbTimeUtil.cstToUtc(startTime); String utcStartTime = InfluxdbTimeUtil.cstToUtc(startTime);
String utcEndTime = InfluxdbTimeUtil.cstToUtc(endTime); 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<Map<String, Object>> 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<String, Object> resMap = new HashMap<>(); Map<String, Object> resMap = new HashMap<>();
List<Map<String, Object>> list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime);
if (list.size() == 0){ if (list.size() == 0){
return null; return null;
} }
List<Object> columnList = new ArrayList<>(); List<Object> columnList = new ArrayList<>();
List<String> timelist = new ArrayList<>(); List<String> timelist = new ArrayList<>();
list.forEach(data ->{ if(intervalHours > 6){
columnName = "mean";
}
for (Map<String, Object> data : list) {
columnList.add(data.get(columnName)); columnList.add(data.get(columnName));
LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
timelist.add(time.format(formatter)); timelist.add(time.format(formatter));
}); }
resMap.put("y", columnList); resMap.put("y", columnList);
resMap.put("x", timelist); resMap.put("x", timelist);
@ -198,6 +222,113 @@ public class DataQueryService implements IDataQueryService {
return resMap; return resMap;
} }
/**
* 获取一分钟底缸数据数据
*/
@Override
public Map<String, Object> getBottomCylDataList(String startTime, String endTime, int pageSize, int pageNum){
startTime = InfluxdbTimeUtil.cstToUtc(startTime);
endTime = InfluxdbTimeUtil.cstToUtc(endTime);
List<Map<String, Object>> 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<IpcData> 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<String, Object> resMap = new HashMap<>();
resMap.put("total", total);
resMap.put("list", resList);
return resMap;
}
/**
* 获取一分钟顶辊数据数据
*/
@Override
public Map<String, Object> getTopScollerDataList(String startTime, String endTime, int pageSize, int pageNum){
startTime = InfluxdbTimeUtil.cstToUtc(startTime);
endTime = InfluxdbTimeUtil.cstToUtc(endTime);
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", startTime, endTime, pageSize, pageNum);
int total = countInfluxdbList("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", startTime, endTime);
List<IpcData> resList = getScollerDataList(list);
Map<String, Object> resMap = new HashMap<>();
resMap.put("total", total);
resMap.put("list", resList);
return resMap;
}
/**
* 获取一分钟底辊数据数据
*/
@Override
public Map<String, Object> getBottomScollerDataList(String startTime, String endTime, int pageSize, int pageNum){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", startTime, endTime, pageSize, pageNum);
int total = countInfluxdbList("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", startTime, endTime);
List<IpcData> resList = getScollerDataList(list);
Map<String, Object> resMap = new HashMap<>();
resMap.put("total", total);
resMap.put("list", resList);
return resMap;
}
/** /**
* 根据设备id查询最近num条数据 * 根据设备id查询最近num条数据
* @param tableName 表名 * @param tableName 表名
@ -205,8 +336,15 @@ public class DataQueryService implements IDataQueryService {
* @param num 条数 * @param num 条数
* @return 数据 * @return 数据
*/ */
private List<Map<String, Object>> selectAllDataByEquId(String tableName, String equipId, int num){ private List<Map<String, Object>> selectAllDataByEquId(String tableName, String equipId,String startTime, String endTime, int pageSize, int pageNum){
String sql = "select * from " + tableName + " where equ_id = '" + equipId + "' order by time desc limit " + num; 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)); return influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
} }
@ -223,6 +361,15 @@ public class DataQueryService implements IDataQueryService {
return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); return influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
} }
/**
* 查询长时间数据每分钟取一条展示最长3个月
* @return
*/
private List<Map<String, Object>> 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 查询的数据 * @param list 查询的数据
@ -349,4 +496,66 @@ public class DataQueryService implements IDataQueryService {
return resMap; return resMap;
} }
private List<IpcData> getScollerDataList(List<Map<String, Object>> list) {
if (list.size() == 0){
return null;
}
List<IpcData> 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<Map<String, Object>> list = influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
return list.size() == 0 ? 0 : ((Double)list.get(0).get("count")).intValue();
}
} }

View File

@ -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<IpcSysStatus> selectIpcSysStatusList(IpcSysStatus ipcSysStatus)
{
return ipcSysStatusMapper.selectIpcSysStatusList(ipcSysStatus);
}
/**
* 根据设备查询最新一条系统状态
* @param equipId 设备id
* @return 最新一条状态信息
*/
public IpcSysStatus selectLatestIpcSysStatusByEquipName(String equipName){
IpcEquipInfo queryEquipInfo = new IpcEquipInfo();
queryEquipInfo.setEquipName(equipName);
List<IpcEquipInfo> 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<IpcEquipInfo> equipInfoList = ipcEquipInfoService.selectIpcEquipInfoList(queryEquipInfo);
if (equipInfoList.size() == 0){
return null;
}
return equipInfoList.get(0);
}
}

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.industrial.mapper.IpcSysStatusMapper">
<resultMap type="IpcSysStatus" id="IpcSysStatusResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="shutdownTime" column="shutdown_time" />
<result property="standbyTime" column="standby_time" />
<result property="trialTime" column="trial_time" />
<result property="normalTime" column="normal_time" />
<result property="equipId" column="equip_id" />
</resultMap>
<sql id="selectIpcSysStatusVo">
select id, create_time, shutdown_time, standby_time, trial_time, normal_time, equip_id from ipc_sys_status
</sql>
<select id="selectIpcSysStatusList" parameterType="IpcSysStatus" resultMap="IpcSysStatusResult">
<include refid="selectIpcSysStatusVo"/>
<where>
<if test="shutdownTime != null "> and shutdown_time = #{shutdownTime}</if>
<if test="standbyTime != null "> and standby_time = #{standbyTime}</if>
<if test="trialTime != null "> and trial_time = #{trialTime}</if>
<if test="normalTime != null "> and normal_time = #{normalTime}</if>
<if test="equipId != null "> and equip_id = #{equipId}</if>
</where>
</select>
<!-- 根据设备查询最新一条系统状态 selectLatestIpcSysStatusByEquipId-->
<select id="selectLatestIpcSysStatusByEquipId" parameterType="String" resultMap="IpcSysStatusResult">
<include refid="selectIpcSysStatusVo"/>
where equip_id = #{equipId} order by id desc limit 1
</select>
<select id="selectIpcSysStatusById" parameterType="Long" resultMap="IpcSysStatusResult">
<include refid="selectIpcSysStatusVo"/>
where id = #{id}
</select>
<insert id="insertIpcSysStatus" parameterType="IpcSysStatus" useGeneratedKeys="true" keyProperty="id">
insert into ipc_sys_status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="shutdownTime != null">shutdown_time,</if>
<if test="standbyTime != null">standby_time,</if>
<if test="trialTime != null">trial_time,</if>
<if test="normalTime != null">normal_time,</if>
<if test="equipId != null ">equip_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="shutdownTime != null">#{shutdownTime},</if>
<if test="standbyTime != null">#{standbyTime},</if>
<if test="trialTime != null">#{trialTime},</if>
<if test="normalTime != null">#{normalTime},</if>
<if test="equipId != null ">#{equipId},</if>
</trim>
</insert>
<update id="updateIpcSysStatus" parameterType="IpcSysStatus">
update ipc_sys_status
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="shutdownTime != null">shutdown_time = #{shutdownTime},</if>
<if test="standbyTime != null">standby_time = #{standbyTime},</if>
<if test="trialTime != null">trial_time = #{trialTime},</if>
<if test="normalTime != null">normal_time = #{normalTime},</if>
<if test="equipId != null ">equip_id = #{equipId}</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcSysStatusById" parameterType="Long">
delete from ipc_sys_status where id = #{id}
</delete>
<delete id="deleteIpcSysStatusByIds" parameterType="String">
delete from ipc_sys_status where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -34,27 +34,46 @@ export function getBottomCylDataByDate(params) {
} }
//根据时间查询可控中高辊顶辊数据 //根据时间查询可控中高辊顶辊数据
export function getTopScollerDataByDate(columnName, startTime, endTime) { export function getTopScollerDataByDate(params) {
return request({ return request({
url: "/dataQuery/topScollerByDate", url: "/dataQuery/topScollerByDate",
method: "get", method: "get",
params: { params: params,
columnName: columnName,
startTime: startTime,
endTime: endTime,
},
}); });
} }
// 根据时间查询可控中高辊顶辊数据 // 根据时间查询可控中高辊顶辊数据
export function getBottomScollerDataByDate(columnName, startTime, endTime) { export function getBottomScollerDataByDate(params) {
return request({ return request({
url: "/dataQuery/bottomScollerByDate", url: "/dataQuery/bottomScollerByDate",
method: "get", method: "get",
params: { params: params,
columnName: columnName, });
startTime: startTime, }
endTime: endTime,
}, // 查询超压底缸数据记录
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,
}); });
} }

View File

@ -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",
});
}

View File

@ -12,157 +12,286 @@
@click="startRefresh" @click="startRefresh"
>自动刷新</div> >自动刷新</div>
</div> </div>
<el-table <el-tabs
class="tableCss" v-model="activeName"
v-loading="loading" type="card"
:data="dataList"
:row-class-name="tableRowClassName"
header-row-class-name="header-row"
> >
<el-table-column <el-tab-pane
label="序号" label="超压底缸加压液压系统"
type="index" name="bottomCyl"
align="center"
> >
<template slot-scope="scope"> <div style="display: flex;justify-content: space-between;">
<span>{{scope.$index + 1}}</span> <el-button
</template> type="warning"
</el-table-column> plain
<el-table-column icon="el-icon-download"
label="时间" size="mini"
align="center" @click="handleExport"
key="insertTime" >导出</el-button>
prop="insertTime" <div
width="200" style="text-align:right;margin-bottom: 1%;"
:show-overflow-tooltip="true" class="block"
/> >
<el-table-column <el-date-picker
label="4μm颗粒度" v-model="datetime"
align="center" type="datetimerange"
key="iPM4" range-separator="至"
prop="iPM4" start-placeholder="开始日期"
/> end-placeholder="结束日期"
<el-table-column align="right"
label="6μm颗粒度" style="margin-right:5px"
align="center" >
key="iPM6" </el-date-picker>
prop="iPM6" <el-button
/> type="primary"
<el-table-column icon="el-icon-search"
label="14μm颗粒度" size="mini"
align="center" @click="handleQuery"
key="iPM14" > </el-button>
prop="iPM14" <el-button
/> icon="el-icon-refresh"
<el-table-column size="mini"
label="21μm颗粒度" @click="resetQuery"
align="center" >重置</el-button>
key="iPM21" </div>
prop="iPM21" </div>
show-overflow-tooltip="false" <el-table
/> class="tableCss"
<el-table-column v-loading="loading"
label="进油油液温度" :data="dataList"
align="center" :row-class-name="tableRowClassName"
key="rPT1" header-row-class-name="header-row"
prop="rPT1" >
show-overflow-tooltip="false" <el-table-column
/> label="序号"
<el-table-column type="index"
label="回油油液温度" align="center"
align="center" >
key="rPT2" <template slot-scope="scope">
prop="rPT2" <span>{{scope.$index + 1}}</span>
show-overflow-tooltip="false" </template>
/> </el-table-column>
<el-table-column <el-table-column
label="进油压力" label="时间"
align="center" align="center"
key="rSP1" prop="time"
prop="rSP1" width="200"
show-overflow-tooltip="false" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="相对湿度" label="系统电流"
align="center" align="center"
key="rRH" prop="sysCur"
prop="rRH" :show-overflow-tooltip="true"
show-overflow-tooltip="false" />
/> <el-table-column
<el-table-column label="系统压力"
label="油液粘度" align="center"
align="center" prop="sysPress"
key="rU" :show-overflow-tooltip="true"
prop="rU" />
show-overflow-tooltip="false" <el-table-column
/> label="系统流量"
<el-table-column align="center"
label="油液密度" prop="sysFlow"
align="center" :show-overflow-tooltip="true"
show-overflow-tooltip="false" />
> <el-table-column
<template slot-scope="scope"> label="系统液位"
{{scope.row.rp == undefined || scope.row.rp == null ? "0" : scope.row.rp}} align="center"
</template> prop="sysLevel"
</el-table-column> :show-overflow-tooltip="true"
<el-table-column />
label="X1轴震动" <el-table-column
align="center" label="系统温度"
key="rX1" align="center"
prop="rX1" prop="sysTemp"
show-overflow-tooltip="false" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="X2轴震动" label="系统湿度"
align="center" align="center"
key="rX2" prop="humi"
prop="rX2" :show-overflow-tooltip="true"
show-overflow-tooltip="false" />
/> <el-table-column
<el-table-column label="系统粘度"
label="Y1轴震动" align="center"
align="center" prop="visc"
key="rY1" :show-overflow-tooltip="true"
prop="rY1" />
show-overflow-tooltip="false" <el-table-column
/> label="4μm颗粒度"
<el-table-column align="center"
label="Y2轴震动" prop="gran4"
align="center" :show-overflow-tooltip="true"
key="rY2" />
prop="rY2" <el-table-column
show-overflow-tooltip="false" label="6μm颗粒度"
/> align="center"
<el-table-column prop="gran6"
label="z轴震动" :show-overflow-tooltip="true"
align="center" />
key="rZ" <el-table-column
prop="rZ" label="14μm颗粒度"
show-overflow-tooltip="false" align="center"
/> prop="gran14"
<el-table-column :show-overflow-tooltip="true"
label="负载" />
align="center" <el-table-column
> label="21μm颗粒度"
<template slot-scope="scope"> align="center"
{{scope.row.rL == undefined || scope.row.rL == null ? "0" : scope.row.rL}} prop="gran21"
</template> :show-overflow-tooltip="true"
</el-table-column> />
<el-table-column <el-table-column
label="车速" label="操作侧软辊流量"
align="center" align="center"
> prop="opSoftFlow"
<template slot-scope="scope"> :show-overflow-tooltip="true"
{{scope.row.rS == undefined || scope.row.rS == null ? "0" : scope.row.rS}} />
</template> <el-table-column
</el-table-column> label="操作侧热辊流量"
</el-table> align="center"
prop="opHotFlow"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧软辊流量"
align="center"
prop="tranSoftFlow"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧热辊流量"
align="center"
prop="tranHotFlow"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧底缸压力"
align="center"
prop="opBottomPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧底缸压力"
align="center"
prop="tranBottomPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧软辊实际压力"
align="center"
prop="opSoftPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧软辊实合辊压力"
align="center"
prop="opSoftHoldPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧软辊实加压压力"
align="center"
prop="opSoftHoldPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧热辊实际压力"
align="center"
prop="opHotPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧热辊实合辊压力"
align="center"
prop="opHotHoldPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧热辊实加压压力"
align="center"
prop="opHotPushPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧软辊实际压力"
align="center"
prop="tranSoftPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧软辊实合辊压力"
align="center"
prop="tranSoftHoldPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧软辊实加压压力"
align="center"
prop="tranSoftPushPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧热辊实际压力"
align="center"
prop="tranHotPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧热辊实合辊压力"
align="center"
prop="tranHotHoldPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧热辊实加压压力"
align="center"
prop="tranHotPushPress"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作侧底缸位移"
align="center"
prop="opBottomDis"
:show-overflow-tooltip="true"
/>
<el-table-column
label="传动侧底缸位移"
align="center"
prop="tranBottomDis"
:show-overflow-tooltip="true"
/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane
label="可控中高辊顶辊液压系统"
name="topScoller"
>可控中高辊顶辊液压系统</el-tab-pane>
<el-tab-pane
label="可控中高辊底辊液压系统"
name="bottomScoller"
>可控中高辊底辊液压系统</el-tab-pane>
</el-tabs>
</div> </div>
</template> </template>
<script> <script>
import { dataList } from "@/api/industrial/dataLog"; import {
getBottomCylData,
getTopScollerData,
getBottomScollerData,
} from "@/api/data/query.js";
export default { export default {
name: "dataLog", name: "dataLog",
data() { data() {
@ -178,19 +307,81 @@ export default {
}, },
dataList: [], dataList: [],
refresh: false, refresh: false,
activeName: "bottomCyl",
datetime: this.getDefaultTimeRange(),
getDataTimer: null,
}; };
}, },
created() { created() {
this.queryParams.startTime = this.datetime[0];
this.queryParams.endTime = this.datetime[1];
this.getList(); this.getList();
this.startRefresh();
}, },
methods: { methods: {
/** 导出按钮操作 */
handleExport() {
this.download(
"patrol/card/export",
{
...this.queryParams,
},
this.activeName + `_${new Date().getTime()}.xlsx`
);
},
handleQuery() {
this.stopRefresh();
let startTime = new Date(this.datetime[0]);
this.queryParams.startTime = this.formatDateTime(startTime);
let endTime = new Date(this.datetime[1]);
this.queryParams.endTime = this.formatDateTime(endTime);
this.loading = true;
this.getList();
},
resetQuery() {
this.startRefresh();
},
getDefaultTimeRange() {
const now = new Date();
const twoHoursAgo = new Date(now.getTime() - 1 * 60 * 60 * 1000);
return [this.formatDateTime(twoHoursAgo), this.formatDateTime(now)];
},
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;
},
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; // this.loading = true;
dataList(this.queryParams).then((response) => { if (this.activeName == "bottomCyl") {
this.dataList = response.data; getBottomCylData(this.queryParams).then((response) => {
this.loading = false; this.dataList = response.data.list;
}); this.total = response.data.total;
this.loading = false;
});
} else if (this.activeName == "topScoller") {
getTopScollerData(this.queryParams).then((response) => {
console.log("顶辊数据:", response.data);
});
} else {
getBottomScollerData(this.queryParams).then((response) => {
console.log("底辊数据:", response.data);
});
}
}, },
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 0) { if (rowIndex % 2 === 0) {
@ -201,6 +392,9 @@ export default {
startRefresh() { startRefresh() {
this.refresh = true; this.refresh = true;
this.getDataTimer = setInterval(() => { this.getDataTimer = setInterval(() => {
let datetime = this.getDefaultTimeRange();
this.queryParams.startTime = datetime[0];
this.queryParams.endTime = datetime[1];
this.getList(); this.getList();
}, 1000); }, 1000);
}, },
@ -228,6 +422,7 @@ export default {
background-image: url(../../assets/images/industrial/check.png); background-image: url(../../assets/images/industrial/check.png);
height: 960px; height: 960px;
padding-top: 0px; padding-top: 0px;
display: inline;
} }
.content { .content {
max-width: 1400px; max-width: 1400px;

View File

@ -607,8 +607,12 @@
<span class="demonstration">时间</span> <span class="demonstration">时间</span>
<el-date-picker <el-date-picker
v-model="datetime" v-model="datetime"
type="datetime" type="datetimerange"
placeholder="选择日期时间" :picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
> >
</el-date-picker> </el-date-picker>
<el-button <el-button
@ -669,6 +673,10 @@ import {
getTopScollerDataByDate, getTopScollerDataByDate,
getBottomScollerDataByDate, getBottomScollerDataByDate,
} from "@/api/data/query.js"; } from "@/api/data/query.js";
import {
getStatusByEquipName,
getMonitorInfoByEquipName,
} from "@/api/industrial/sysStatus.js";
export default { export default {
name: "yxjk", name: "yxjk",
components: { lbCompents }, components: { lbCompents },
@ -762,7 +770,39 @@ export default {
startTime: null, startTime: null,
endTime: null, endTime: null,
}, },
datetime: "", datetime: this.getDefaultTimeRange(),
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
},
}; };
}, },
beforeDestroy() { beforeDestroy() {
@ -770,6 +810,15 @@ export default {
clearInterval(this.historyIntervalTask); clearInterval(this.historyIntervalTask);
}, },
mounted() { mounted() {
let query = {
equipName: "超压底缸",
};
getStatusByEquipName(query).then((response) => {
console.log("设备状态信息:", response.data);
});
getMonitorInfoByEquipName(query).then((response) => {
console.log("设备监控信息:", response.data);
});
this.queryDataInit(); this.queryDataInit();
this.intervalTask = setInterval(() => { this.intervalTask = setInterval(() => {
// this.test(); // this.test();
@ -783,6 +832,11 @@ export default {
}, 60 * 1000); }, 60 * 1000);
}, },
methods: { methods: {
getDefaultTimeRange() {
const now = new Date();
const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000);
return [this.formatDateTime(twoHoursAgo), this.formatDateTime(now)];
},
formatDateTime(date) { formatDateTime(date) {
return ( return (
date.getFullYear() + date.getFullYear() +
@ -802,13 +856,10 @@ export default {
return num < 10 ? "0" + num : num; return num < 10 ? "0" + num : num;
}, },
handleQuery() { handleQuery() {
let startTime = new Date(this.datetime); let startTime = new Date(this.datetime[0]);
this.queryParams.startTime = this.formatDateTime(startTime); this.queryParams.startTime = this.formatDateTime(startTime);
let endTime = startTime; let endTime = new Date(this.datetime[1]);
endTime.setHours(endTime.getHours() + 10);
this.queryParams.endTime = this.formatDateTime(endTime); this.queryParams.endTime = this.formatDateTime(endTime);
console.log("查询的参数:", this.queryParams);
this.getData(this.queryParams); this.getData(this.queryParams);
}, },
resetQuery() { resetQuery() {
@ -816,7 +867,6 @@ export default {
}, },
getData(queryObj) { getData(queryObj) {
this.chartLoading = true; this.chartLoading = true;
//
getBottomCylDataByDate(queryObj).then((response) => { getBottomCylDataByDate(queryObj).then((response) => {
if (response.data == null) { if (response.data == null) {
this.chartLoading = false; this.chartLoading = false;