Merge remote-tracking branch 'origin/main'

This commit is contained in:
liuyusheng 2024-04-16 11:24:02 +08:00
commit 3638e08897
17 changed files with 588 additions and 91 deletions

View File

@ -46,4 +46,9 @@ public class CacheConstants
* ipc规则 * ipc规则
*/ */
public static final String IPC_RULES_KEY = "ipc_rules:"; public static final String IPC_RULES_KEY = "ipc_rules:";
/**
* ipc运行状态
*/
public static final String IPC_RUNNING_STATUS_KEY = "ipc_running_status:";
} }

View File

@ -5,8 +5,12 @@ import com.inspur.equip.domain.IpcEquipInfo;
import com.inspur.equip.service.IIpcEquipInfoService; import com.inspur.equip.service.IIpcEquipInfoService;
import com.inspur.industrial.domain.IpcAlarmRecord; import com.inspur.industrial.domain.IpcAlarmRecord;
import com.inspur.industrial.domain.IpcAlarmRules; import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.domain.IpcRunningStatusRecord;
import com.inspur.industrial.domain.IpcSysStatus;
import com.inspur.industrial.service.IIpcAlarmRecordService; import com.inspur.industrial.service.IIpcAlarmRecordService;
import com.inspur.industrial.service.IIpcAlarmRulesService; import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.industrial.service.IIpcRunningStatusRecordService;
import com.inspur.industrial.service.IIpcSysStatusService;
import com.inspur.industrial.utils.Constant; import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil; import com.inspur.industrial.utils.IpcUtil;
import com.inspur.system.service.influx.InfluxDBService; import com.inspur.system.service.influx.InfluxDBService;
@ -15,6 +19,7 @@ import com.serotonin.modbus4j.ModbusMaster;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -80,7 +85,7 @@ public class IpcDataProcess implements Runnable {
String bottomCylId = equipList.stream().filter(equip -> equip.getEquipName().equals("超压底缸")).collect(Collectors.toList()).get(0).getId(); String bottomCylId = equipList.stream().filter(equip -> equip.getEquipName().equals("超压底缸")).collect(Collectors.toList()).get(0).getId();
String topScollerId = equipList.stream().filter(equip -> equip.getEquipName().equals("可控中高辊顶辊")).collect(Collectors.toList()).get(0).getId(); String topScollerId = equipList.stream().filter(equip -> equip.getEquipName().equals("可控中高辊顶辊")).collect(Collectors.toList()).get(0).getId();
String bottomScollerId = equipList.stream().filter(equip -> equip.getEquipName().equals("可控中高辊底辊")).collect(Collectors.toList()).get(0).getId(); String bottomScollerId = equipList.stream().filter(equip -> equip.getEquipName().equals("可控中高辊底辊")).collect(Collectors.toList()).get(0).getId();
saveRunningStatus("1");
bottomCylinderDataProcess(null, bottomCylId, i, ipcUtil, alarmRulesService, alarmRecordService); bottomCylinderDataProcess(null, bottomCylId, i, ipcUtil, alarmRulesService, alarmRecordService);
scollerDataProcess(null, topScollerId, topScollerMeasurement, i, ipcUtil, alarmRulesService, alarmRecordService); scollerDataProcess(null, topScollerId, topScollerMeasurement, i, ipcUtil, alarmRulesService, alarmRecordService);
scollerDataProcess(null, bottomScollerId, bottomScollerMeasurement, i, ipcUtil, alarmRulesService, alarmRecordService); scollerDataProcess(null, bottomScollerId, bottomScollerMeasurement, i, ipcUtil, alarmRulesService, alarmRecordService);
@ -110,7 +115,6 @@ public class IpcDataProcess implements Runnable {
Map<String, String> tags = new TreeMap(); Map<String, String> tags = new TreeMap();
tags.put("equ_id", equipId); tags.put("equ_id", equipId);
Map<String, Object> fields = new TreeMap(); Map<String, Object> fields = new TreeMap();
//TODO 停机运维状态数据不储存 //TODO 停机运维状态数据不储存
tags.put("status", "1");//正常运行 0停机 1正常运行 2待机 3试运行 tags.put("status", "1");//正常运行 0停机 1正常运行 2待机 3试运行
@ -125,7 +129,7 @@ public class IpcDataProcess implements Runnable {
fields.put("sys_level", (float) 0 + Math.random()); fields.put("sys_level", (float) 0 + Math.random());
//液位最小和最大值通过报警参数设置获取 //液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule(equipId); IpcAlarmRules levelRule = getLevelAlarmRule(equipId, Constant.RUNNING);//TODO 根据接收运行参数确定参数
//正式需要放开 //正式需要放开
fields.put("level_min", levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue()); fields.put("level_min", levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max", levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue()); fields.put("level_max", levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
@ -182,8 +186,8 @@ public class IpcDataProcess implements Runnable {
//传动侧底缸位移 //传动侧底缸位移
fields.put("driven_bottom_dis", (float) 0 + Math.random()); fields.put("driven_bottom_dis", (float) 0 + Math.random());
//报警处理 //报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(equipId); List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesConfigListByCache(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList)); alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));//TODO 根据运行状态确定规则
i.insert(measurement, tags, fields); i.insert(measurement, tags, fields);
if (!alarmRecordList.isEmpty()) {//运行需放开 if (!alarmRecordList.isEmpty()) {//运行需放开
@ -213,7 +217,7 @@ public class IpcDataProcess implements Runnable {
// fields.put("ywmin",0.3); // fields.put("ywmin",0.3);
// fields.put("ywmax",1); // fields.put("ywmax",1);
//液位最小和最大值通过报警参数设置获取 //液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule(equipId); IpcAlarmRules levelRule = getLevelAlarmRule(equipId, Constant.RUNNING);//TODO 根据接收运行参数确定参数
//正式需要放开 //正式需要放开
fields.put("level_min", levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue()); fields.put("level_min", levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max", levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue()); fields.put("level_max", levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
@ -277,8 +281,8 @@ public class IpcDataProcess implements Runnable {
fields.put("flw11", (float) 0 + Math.random()); fields.put("flw11", (float) 0 + Math.random());
//报警处理 //报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(equipId); List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesConfigListByCache(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList)); alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));//TODO 根据运行状态确定规则
if (!alarmRecordList.isEmpty()) {//运行需放开 if (!alarmRecordList.isEmpty()) {//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList); // alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
} }
@ -290,12 +294,44 @@ public class IpcDataProcess implements Runnable {
* *
* @return * @return
*/ */
private IpcAlarmRules getLevelAlarmRule(String equipId) { private IpcAlarmRules getLevelAlarmRule(String equipId,Integer type) {
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class); IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules(); IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(equipId); query.setEquipId(equipId);
query.setAlarmNameKey("sys_level"); query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中 query.setType(type);//运行中
return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0); return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0);
} }
/**
* 根据状态存储时间0停机维护1运行2待机3试运行
*/
private void saveRunningStatus(String status) {
IIpcRunningStatusRecordService ipcRunningStatusRecordService = SpringUtils.getBean(IIpcRunningStatusRecordService.class);
String latestStatus = ipcRunningStatusRecordService.selectLatestStatus();
if (latestStatus == null || !latestStatus.equals(status)) {
IpcRunningStatusRecord ipcRunningStatusRecord = new IpcRunningStatusRecord(status);
ipcRunningStatusRecordService.insertIpcRunningStatusRecord(ipcRunningStatusRecord);
//修改系统状态时间
IIpcSysStatusService ipcSysStatusService = SpringUtils.getBean(IIpcSysStatusService.class);
IpcSysStatus sysStatus = ipcSysStatusService.selectIpcSysStatusList(null).get(0);
//0:停机维护1运行2待机3试运行
switch(status) {
case "0" :
sysStatus.setShutdownTime(LocalDateTime.now());
break;
case "1" :
sysStatus.setNormalTime(LocalDateTime.now());
break;
case "2" :
sysStatus.setStandbyTime(LocalDateTime.now());
break;
case "3" :
sysStatus.setTrialTime(LocalDateTime.now());
break;
}
ipcSysStatusService.updateIpcSysStatus(sysStatus);
}
}
} }

View File

@ -183,21 +183,21 @@ public class IpcAlarmRecord extends BaseEntity
this.alarmLevel = alarmLevel; this.alarmLevel = alarmLevel;
} }
// public IpcEquipInfo getEquipInfo() { public IpcEquipInfo getEquipInfo() {
// return equipInfo; return equipInfo;
// } }
//
// public void setEquipInfo(IpcEquipInfo equipInfo) { public void setEquipInfo(IpcEquipInfo equipInfo) {
// this.equipInfo = equipInfo; this.equipInfo = equipInfo;
// } }
//
// public IpcAlarmRules getAlarmRules() { public IpcAlarmRules getAlarmRules() {
// return alarmRules; return alarmRules;
// } }
//
// public void setAlarmRules(IpcAlarmRules alarmRules) { public void setAlarmRules(IpcAlarmRules alarmRules) {
// this.alarmRules = alarmRules; this.alarmRules = alarmRules;
// } }
public String[] getIds() { public String[] getIds() {
return ids; return ids;

View File

@ -0,0 +1,76 @@
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.util.Date;
/**
* 运行状态记录对象 ipc_running_status_record
*
* @author inspur
* @date 2024-04-09
*/
public class IpcRunningStatusRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 运行状态 */
@Excel(name = "运行状态")
private String runningStatus;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setRunningStatus(String runningStatus)
{
this.runningStatus = runningStatus;
}
public String getRunningStatus()
{
return runningStatus;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public IpcRunningStatusRecord() {
}
public IpcRunningStatusRecord(String runningStatus) {
this.runningStatus = runningStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("runningStatus", getRunningStatus())
.append("startTime", getStartTime())
.toString();
}
}

View File

@ -0,0 +1,69 @@
package com.inspur.industrial.mapper;
import com.inspur.industrial.domain.IpcRunningStatusRecord;
import java.util.List;
/**
* 运行状态记录Mapper接口
*
* @author inspur
* @date 2024-04-09
*/
public interface IpcRunningStatusRecordMapper
{
/**
* 查询运行状态记录
*
* @param id 运行状态记录主键
* @return 运行状态记录
*/
public IpcRunningStatusRecord selectIpcRunningStatusRecordById(Long id);
/**
* 查询运行状态记录列表
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 运行状态记录集合
*/
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 新增运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
public int insertIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 修改运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
public int updateIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 删除运行状态记录
*
* @param id 运行状态记录主键
* @return 结果
*/
public int deleteIpcRunningStatusRecordById(Long id);
/**
* 批量删除运行状态记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcRunningStatusRecordByIds(Long[] ids);
/**
* 查询最新状态
*
* @return 结果
*/
String selectLatestStatus();
}

View File

@ -0,0 +1,70 @@
package com.inspur.industrial.service;
import com.inspur.industrial.domain.IpcRunningStatusRecord;
import java.util.List;
/**
* 运行状态记录Service接口
*
* @author inspur
* @date 2024-04-09
*/
public interface IIpcRunningStatusRecordService
{
/**
* 查询运行状态记录
*
* @param id 运行状态记录主键
* @return 运行状态记录
*/
public IpcRunningStatusRecord selectIpcRunningStatusRecordById(Long id);
/**
* 查询运行状态记录列表
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 运行状态记录集合
*/
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 新增运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
public int insertIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 修改运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
public int updateIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 批量删除运行状态记录
*
* @param ids 需要删除的运行状态记录主键集合
* @return 结果
*/
public int deleteIpcRunningStatusRecordByIds(Long[] ids);
/**
* 删除运行状态记录信息
*
* @param id 运行状态记录主键
* @return 结果
*/
public int deleteIpcRunningStatusRecordById(Long id);
/**
* 查询最新状态
*
* @return 结果
*/
String selectLatestStatus();
String getSSS();
}

View File

@ -43,39 +43,41 @@ public class DataQueryService implements IDataQueryService {
return null; return null;
} }
Map<String, Object> resMap = new HashMap<>(); Map<String, Object> resMap = new HashMap<>();
resMap.put("sysstatus", list.get(0).get("status"));//系统状态 resMap.put("sysstatus", list.get(0).get("status") == null ? 0 : list.get(0).get("status") );//系统状态
resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量 resMap.put("sysflw", list.get(0).get("sys_flw") == null ? 0 : list.get(0).get("sys_flw"));//系统流量
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 resMap.put("sysprs", list.get(0).get("sys_press") == null ? 0 : list.get(0).get("sys_press"));//系统压力
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位 resMap.put("syslevel", list.get(0).get("sys_level") == null ? 0 : list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Float.parseFloat(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值 resMap.put("syslevelinit", Float.parseFloat(sysConfigService.selectConfigByKey("sys.liquidlevel.init") == null ?
resMap.put("levelmax", list.get(0).get("level_max")); "0" : sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
resMap.put("levelmin", list.get(0).get("level_min")); resMap.put("levelmax", list.get(0).get("level_max") == null ? 0 : list.get(0).get("level_max"));
resMap.put("levelmin", list.get(0).get("level_min") == null ? 0 : list.get(0).get("level_min"));
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度 resMap.put("systemp",list.get(0).get("sys_temp") == null ? 0 : list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度 resMap.put("syshumid",list.get(0).get("oil_water") == null ? 0 : list.get(0).get("oil_water"));//系统湿度
resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度 resMap.put("sysvisc",list.get(0).get("visc") == null ? 0 : list.get(0).get("visc"));//系统粘度
//系统颗粒度 //系统颗粒度
resMap.put("sysgran4",list.get(0).get("gran4")); resMap.put("sysgran4",list.get(0).get("gran4") == null ? 0 : list.get(0).get("gran4"));
resMap.put("sysgran6",list.get(0).get("gran6")); resMap.put("sysgran6",list.get(0).get("gran6") == null ? 0 : list.get(0).get("gran6"));
resMap.put("sysgran14",list.get(0).get("gran14")); resMap.put("sysgran14",list.get(0).get("gran14") == null ? 0 : list.get(0).get("gran14"));
resMap.put("sysgran21",list.get(0).get("gran21")); resMap.put("sysgran21",list.get(0).get("gran21") == null ? 0 : list.get(0).get("gran21"));
// Map<String, Object> oprsoftflw = (Map<String, Object>) new HashMap<>().put("oprsoftflw",list.get(0).get("opr_soft_flw") );//操作侧软辊流量 // Map<String, Object> oprsoftflw = (Map<String, Object>) new HashMap<>().put("oprsoftflw",list.get(0).get("opr_soft_flw") );//操作侧软辊流量
// Map<String, Object> oprhotflw = (Map<String, Object>) new HashMap<>().put("oprhotflw",list.get(0).get("opr_hot_flw") );//操作侧热辊流量 // Map<String, Object> oprhotflw = (Map<String, Object>) new HashMap<>().put("oprhotflw",list.get(0).get("opr_hot_flw") );//操作侧热辊流量
// Map<String, Object> drivensoftflw = (Map<String, Object>) new HashMap<>().put("drivensoftflw",list.get(0).get("driven_soft_flw") );//传动侧软辊流量 // Map<String, Object> drivensoftflw = (Map<String, Object>) new HashMap<>().put("drivensoftflw",list.get(0).get("driven_soft_flw") );//传动侧软辊流量
// Map<String, Object> drivenhotflw = (Map<String, Object>) new HashMap<>().put("drivenhotflw",list.get(0).get("driven_hot_flw") );//传动侧软辊流量 // Map<String, Object> drivenhotflw = (Map<String, Object>) new HashMap<>().put("drivenhotflw",list.get(0).get("driven_hot_flw") );//传动侧软辊流量
resMap.put("oprservo",list.get(0).get("opr_servo"));//操作侧底缸比例换向阀 resMap.put("oprservo",list.get(0).get("opr_servo") == null ? 0 : list.get(0).get("opr_servo"));//操作侧底缸比例换向阀
resMap.put("drivenservo",list.get(0).get("driven_servo"));//操作侧底缸比例换向阀 resMap.put("drivenservo",list.get(0).get("driven_servo") == null ? 0 : list.get(0).get("driven_servo"));//操作侧底缸比例换向阀
//功率= 3IUcosΦ/1000 //功率= 3IUcosΦ/1000
resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000); resMap.put("syspower",list.get(0).get("sys_cur") == null ? 0 : Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000);
//系统效率 = 系统压力*系统流量/系统功率 //系统效率 = 系统压力*系统流量/系统功率
double power = (double) resMap.get("syspower"); double power = (double)resMap.get("syspower") == 0 ? 0 : (double)resMap.get("syspower");
double sysflw = (double)resMap.get("sysflw"); double sysflw = (double)resMap.get("sysflw") == 0 ? 0 : (double)resMap.get("sysflw");
double pressure = (double)resMap.get("sysprs"); double pressure = (double)resMap.get("sysprs") == 0 ? 0 : (double)resMap.get("sysprs");
resMap.put("syseff",pressure * sysflw/power*100);
resMap.put("syseff",power == 0 ? 0 : pressure * sysflw/power*100);
List<Object> syscur = new ArrayList<>();//系统电流 List<Object> syscur = new ArrayList<>();//系统电流
@ -111,7 +113,7 @@ public class DataQueryService implements IDataQueryService {
for (int i = list.size() - 1; i >= 0; i--) { for (int i = list.size() - 1; i >= 0; i--) {
Map<String, Object> data = list.get(i); Map<String, Object> data = list.get(i);
syscur.add(data.get("sys_cur")); syscur.add(data.get("sys_cur") == null ? 0 : data.get("sys_cur"));
oprsoftflw.add(data.get("opr_soft_flw") == null ? 0 : data.get("opr_soft_flw")); oprsoftflw.add(data.get("opr_soft_flw") == null ? 0 : data.get("opr_soft_flw"));
oprhotflw.add(data.get("opr_hot_flw") == null ? 0 : data.get("opr_hot_flw")); oprhotflw.add(data.get("opr_hot_flw") == null ? 0 : data.get("opr_hot_flw"));
@ -409,33 +411,33 @@ public class DataQueryService implements IDataQueryService {
private Map<String, Object> queryScollerData(List<Map<String, Object>> list) private Map<String, Object> queryScollerData(List<Map<String, Object>> list)
{ {
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") == null ? 0 : (double) list.get(0).get("sys_flw"));//系统流量
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力 resMap.put("sysprs", list.get(0).get("sys_press") == null ? 0 : (double) list.get(0).get("sys_press"));//系统压力
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位 resMap.put("syslevel", list.get(0).get("sys_level") == null ? 0 : (double) list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值 resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init") == null ? "0" : sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
//TODO 获取系统液位高值和低值 //TODO 获取系统液位高值和低值
resMap.put("levelmax", list.get(0).get("level_max")); resMap.put("levelmax", list.get(0).get("level_max") == null ? 0 : (double) list.get(0).get("level_max"));
resMap.put("levelmin", list.get(0).get("level_min")); resMap.put("levelmin", list.get(0).get("level_min") == null ? 0 : (double) list.get(0).get("level_min"));
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度 resMap.put("systemp",list.get(0).get("sys_temp") == null ? 0 : (double) list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度 resMap.put("syshumid",list.get(0).get("oil_water") == null ? 0 : (double) list.get(0).get("oil_water"));//系统湿度
resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度 resMap.put("sysvisc",list.get(0).get("visc") == null ? 0 : (double) list.get(0).get("visc"));//系统粘度
//系统颗粒度 //系统颗粒度
resMap.put("sysgran4",list.get(0).get("gran4")); resMap.put("sysgran4",list.get(0).get("gran4") == null ? 0 : (double) list.get(0).get("gran4"));
resMap.put("sysgran6",list.get(0).get("gran6")); resMap.put("sysgran6",list.get(0).get("gran6") == null ? 0 : (double) list.get(0).get("gran6"));
resMap.put("sysgran14",list.get(0).get("gran14")); resMap.put("sysgran14",list.get(0).get("gran14") == null ? 0 : (double) list.get(0).get("gran14"));
resMap.put("sysgran21",list.get(0).get("gran21")); resMap.put("sysgran21",list.get(0).get("gran21") == null ? 0 : (double) list.get(0).get("gran21"));
resMap.put("linespeed",list.get(0).get("line_speed"));//车速 resMap.put("linespeed",list.get(0).get("line_speed") == null ? 0 : (double) list.get(0).get("line_speed"));//车速
//功率= 3IUcosΦ/1000 //功率= 3IUcosΦ/1000
resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000); resMap.put("syspower",list.get(0).get("sys_cur") == null ? 0 : Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000);
//系统效率 = 系统压力*系统流量/系统功率 //系统效率 = 系统压力*系统流量/系统功率
double power = (double) resMap.get("syspower"); double power = (double) resMap.get("syspower");
double sysflw = (double)resMap.get("sysflw"); double sysflw = (double)resMap.get("sysflw");
double pressure = (double)resMap.get("sysprs"); double pressure = (double)resMap.get("sysprs");
resMap.put("syseff",pressure * sysflw/power); resMap.put("syseff",power == 0 ? 0 : pressure * sysflw/power);
List<Object> syscur = new ArrayList<>();//系统电流 List<Object> syscur = new ArrayList<>();//系统电流

View File

@ -44,11 +44,10 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
//加载规则到缓存 //加载规则到缓存
@PostConstruct @PostConstruct
public void init(){ public void init(){
List<IpcAlarmRules> rules = selectIpcAlarmRulesList(null);
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null); List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
for (IpcEquipInfo equip : equips) { for (IpcEquipInfo equip : equips) {
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId()); List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY+equip.getId(),rulesByEquipId); redisCache.setCacheList((CacheConstants.IPC_RULES_KEY+equip.getId()),rulesByEquipId);
} }
} }
@ -173,7 +172,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId); List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
if (rules == null || rules.size() == 0){ if (rules == null || rules.size() == 0){
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId); List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
redisCache.setCacheList(CacheConstants.IPC_RULES_KEY + equipId,rulesList); redisCache.setCacheList((CacheConstants.IPC_RULES_KEY + equipId),rulesList);
return rulesList; return rulesList;
} }
return rules; return rules;

View File

@ -0,0 +1,119 @@
package com.inspur.industrial.service.impl;
import com.inspur.common.constant.CacheConstants;
import com.inspur.common.core.redis.RedisCache;
import com.inspur.common.utils.StringUtils;
import com.inspur.industrial.domain.IpcRunningStatusRecord;
import com.inspur.industrial.mapper.IpcRunningStatusRecordMapper;
import com.inspur.industrial.service.IIpcRunningStatusRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 运行状态记录Service业务层处理
*
* @author inspur
* @date 2024-04-09
*/
@Service
public class IpcRunningStatusRecordServiceImpl implements IIpcRunningStatusRecordService
{
@Autowired
private IpcRunningStatusRecordMapper ipcRunningStatusRecordMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询运行状态记录
*
* @param id 运行状态记录主键
* @return 运行状态记录
*/
@Override
public IpcRunningStatusRecord selectIpcRunningStatusRecordById(Long id)
{
return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordById(id);
}
/**
* 查询运行状态记录列表
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 运行状态记录
*/
@Override
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord)
{
return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordList(ipcRunningStatusRecord);
}
/**
* 新增运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
@Override
public int insertIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord)
{
int num = ipcRunningStatusRecordMapper.insertIpcRunningStatusRecord(ipcRunningStatusRecord);
// 更新缓存
redisCache.setCacheObject(CacheConstants.IPC_RUNNING_STATUS_KEY,ipcRunningStatusRecord.getRunningStatus());
return num;
}
/**
* 修改运行状态记录
*
* @param ipcRunningStatusRecord 运行状态记录
* @return 结果
*/
@Override
public int updateIpcRunningStatusRecord(IpcRunningStatusRecord ipcRunningStatusRecord)
{
return ipcRunningStatusRecordMapper.updateIpcRunningStatusRecord(ipcRunningStatusRecord);
}
/**
* 批量删除运行状态记录
*
* @param ids 需要删除的运行状态记录主键
* @return 结果
*/
@Override
public int deleteIpcRunningStatusRecordByIds(Long[] ids)
{
return ipcRunningStatusRecordMapper.deleteIpcRunningStatusRecordByIds(ids);
}
/**
* 删除运行状态记录信息
*
* @param id 运行状态记录主键
* @return 结果
*/
@Override
public int deleteIpcRunningStatusRecordById(Long id)
{
return ipcRunningStatusRecordMapper.deleteIpcRunningStatusRecordById(id);
}
/**
* 查询最新状态
*
* @return 结果
*/
@Override
public String selectLatestStatus(){
String status = redisCache.getCacheObject(CacheConstants.IPC_RUNNING_STATUS_KEY);
if(StringUtils.isNull(status) || StringUtils.isEmpty(status)){
status = ipcRunningStatusRecordMapper.selectLatestStatus();
redisCache.setCacheObject(CacheConstants.IPC_RUNNING_STATUS_KEY,status);
}
return status;
}
@Override
public String getSSS(){
return redisCache.getCacheObject("status_test");
}
}

View File

@ -0,0 +1,65 @@
<?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.IpcRunningStatusRecordMapper">
<resultMap type="IpcRunningStatusRecord" id="IpcRunningStatusRecordResult">
<result property="id" column="id" />
<result property="runningStatus" column="running_status" />
<result property="startTime" column="start_time" />
</resultMap>
<sql id="selectIpcRunningStatusRecordVo">
select id, running_status, start_time from ipc_running_status_record
</sql>
<select id="selectIpcRunningStatusRecordList" parameterType="IpcRunningStatusRecord" resultMap="IpcRunningStatusRecordResult">
<include refid="selectIpcRunningStatusRecordVo"/>
<where>
<if test="runningStatus != null and runningStatus != ''"> and running_status = #{runningStatus}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
</where>
</select>
<select id="selectIpcRunningStatusRecordById" parameterType="Long" resultMap="IpcRunningStatusRecordResult">
<include refid="selectIpcRunningStatusRecordVo"/>
where id = #{id}
</select>
<insert id="insertIpcRunningStatusRecord" parameterType="IpcRunningStatusRecord" useGeneratedKeys="true" keyProperty="id">
insert into ipc_running_status_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="runningStatus != null">running_status,</if>
start_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="runningStatus != null">#{runningStatus},</if>
SYSDATE()
</trim>
</insert>
<update id="updateIpcRunningStatusRecord" parameterType="IpcRunningStatusRecord">
update ipc_running_status_record
<trim prefix="SET" suffixOverrides=",">
<if test="runningStatus != null">running_status = #{runningStatus},</if>
<if test="startTime != null">start_time = #{startTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcRunningStatusRecordById" parameterType="Long">
delete from ipc_running_status_record where id = #{id}
</delete>
<delete id="deleteIpcRunningStatusRecordByIds" parameterType="String">
delete from ipc_running_status_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectLatestStatus" resultType="string">
SELECT running_status FROM `ipc_running_status_record` ORDER BY start_time DESC LIMIT 1
</select>
</mapper>

View File

@ -26,4 +26,25 @@ export default {
.el-picker-panel__footer { .el-picker-panel__footer {
background-color: #001129; background-color: #001129;
} }
div.el-table tr {
background-color: #0b2d57;
}
.el-tabs--border-card {
background-color: #002250;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
background-color: #124b86;
border-color: white;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item {
background-color: #002250;
border-color: white;
}
.el-tabs--border-card > .el-tabs__header {
background-color: #002250;
}
.pagination-container {
height: 30px;
}
</style> </style>

View File

@ -16,6 +16,7 @@
v-model="activeName" v-model="activeName"
type="border-card" type="border-card"
@tab-click="handleTabClick" @tab-click="handleTabClick"
style="margin-top:20px"
> >
<el-tab-pane <el-tab-pane
label="超压底缸加压液压系统" label="超压底缸加压液压系统"
@ -1127,11 +1128,12 @@ export default {
} }
.content-but { .content-but {
height: 40px; height: 25px;
display: flex; display: flex;
align-items: center; align-items: center;
float: right; float: right;
padding-right: 50px; padding-right: 50px;
padding-top: 10px;
} }
.button-start { .button-start {

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-tabs <el-tabs
v-model="activeName" v-model="activeName"
type="card" type="border-card"
@tab-click="handleTabClick" @tab-click="handleTabClick"
> >
<el-tab-pane <el-tab-pane

View File

@ -6,12 +6,12 @@
size="small" size="small"
:inline="true" :inline="true"
v-show="showSearch" v-show="showSearch"
label-width="68px"
style="text-align:right" style="text-align:right"
> >
<el-form-item <el-form-item
label="监测设备" label="监测设备"
prop="equipId" prop="equipId"
label-width="60px"
> >
<el-select <el-select
v-model="queryParams.equipId" v-model="queryParams.equipId"
@ -30,6 +30,7 @@
<el-form-item <el-form-item
label="参数名称" label="参数名称"
prop="alarmRulesId" prop="alarmRulesId"
label-width="60px"
> >
<el-select <el-select
v-model="queryParams.alarmRulesId" v-model="queryParams.alarmRulesId"
@ -48,6 +49,7 @@
<el-form-item <el-form-item
label="报警等级" label="报警等级"
prop="alarmLevel" prop="alarmLevel"
label-width="60px"
> >
<el-select <el-select
v-model="queryParams.alarmLevel" v-model="queryParams.alarmLevel"
@ -65,6 +67,7 @@
<el-form-item <el-form-item
label="报警时间" label="报警时间"
prop="alarmTime" prop="alarmTime"
label-width="60px"
> >
<el-date-picker <el-date-picker
class="picker" class="picker"
@ -80,6 +83,7 @@
<el-form-item <el-form-item
label="状态" label="状态"
prop="alarmStatus" prop="alarmStatus"
label-width="40px"
> >
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"

View File

@ -401,52 +401,55 @@
<el-row style="height: 40%"> <el-row style="height: 40%">
<el-col <el-col
:span="12" :span="12"
id="dlnd" style="height: 100%;"
style="height: 100%"
@click="trendClick('visc'
,'油品粘度','')"
> >
<div
id="dlnd"
style="width: 100%;height: 100%;"
@click="trendClick('visc'
,'油品粘度','')"
></div>
</el-col> </el-col>
<el-col <el-col
:span="12" :span="12"
id="xdsd"
style="height: 100%" style="height: 100%"
@click="trendClick('oil_water' >
,'油品湿度','%')" <div
></el-col> id="xdsd"
style="width: 100%;height: 100%;"
@click="trendClick('oil_water'
,'油品湿度','%')"
></div>
</el-col>
</el-row> </el-row>
<el-row style="height: 10%;padding-top: 3%;"> <el-row style="height: 10%;padding-top: 3%;">
<el-col <el-col
:span="3" :span="3"
style="text-align: right;;height: 100%" style="text-align: right;;height: 100%"
@click="trendClick('gran4' ><span @click="trendClick('gran4'
,'油液颗粒度4um','PM')" ,'油液颗粒度4um','PM')">4um</span></el-col>
>4um</el-col>
<el-col :span="3"> <el-col :span="3">
<span class="numCol">{{ yykld4 }}</span> <span class="numCol">{{ yykld4 }}</span>
</el-col> </el-col>
<el-col <el-col
:span="3" :span="3"
style="text-align: right;height: 100%" style="text-align: right;height: 100%"
@click="trendClick('gran6' ><span @click="trendClick('gran6'
,'油液颗粒度6um','PM')" ,'油液颗粒度6um','PM')">6um</span></el-col><el-col :span="3">
>6um</el-col><el-col :span="3">
<span class="numCol">{{ yykld6 }}</span> <span class="numCol">{{ yykld6 }}</span>
</el-col> </el-col>
<el-col <el-col
:span="3" :span="3"
style="text-align: right;height: 100%" style="text-align: right;height: 100%"
@click="trendClick('gran14' ><span @click="trendClick('gran14'
,'油液颗粒度14um','PM')" ,'油液颗粒度14um','PM')">14um</span></el-col><el-col :span="3">
>14um</el-col><el-col :span="3">
<span class="numCol">{{ yykld14 }}</span> <span class="numCol">{{ yykld14 }}</span>
</el-col> </el-col>
<el-col <el-col
:span="3" :span="3"
style="text-align: right;height: 100%" style="text-align: right;height: 100%"
@click="trendClick('gran21' ><span @click="trendClick('gran21'
,'油液颗粒度21um','PM')" ,'油液颗粒度21um','PM')">21um</span></el-col><el-col :span="3">
>21um</el-col><el-col :span="3">
<span class="numCol">{{ yykld21 }}</span> <span class="numCol">{{ yykld21 }}</span>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -458,12 +458,25 @@
id="dlnd" id="dlnd"
style="height: 100%" style="height: 100%"
> >
<div
id="dlnd"
style="width: 100%;height: 100%;"
@click="trendClick('visc'
,'油品粘度','')"
></div>
</el-col> </el-col>
<el-col <el-col
:span="12" :span="12"
id="xdsd" id="xdsd"
style="height: 100%" style="height: 100%"
></el-col> >
<div
id="xdsd"
style="width: 100%;height: 100%;"
@click="trendClick('oil_water'
,'油品湿度','%')"
></div>
</el-col>
</el-row> </el-row>
<el-row style="height: 10%;padding-top: 3%;"> <el-row style="height: 10%;padding-top: 3%;">
<el-col <el-col

View File

@ -458,12 +458,25 @@
id="dlnd" id="dlnd"
style="height: 100%" style="height: 100%"
> >
<div
id="dlnd"
style="width: 100%;height: 100%;"
@click="trendClick('visc'
,'油品粘度','')"
></div>
</el-col> </el-col>
<el-col <el-col
:span="12" :span="12"
id="xdsd" id="xdsd"
style="height: 100%" style="height: 100%"
></el-col> >
<div
id="xdsd"
style="width: 100%;height: 100%;"
@click="trendClick('oil_water'
,'油品湿度','%')"
></div>
</el-col>
</el-row> </el-row>
<el-row style="height: 10%;padding-top: 3%;"> <el-row style="height: 10%;padding-top: 3%;">
<el-col <el-col