Compare commits

...

2 Commits

11 changed files with 518 additions and 52 deletions

View File

@ -46,4 +46,9 @@ public class CacheConstants
* ipc规则
*/
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.industrial.domain.IpcAlarmRecord;
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.IIpcAlarmRulesService;
import com.inspur.industrial.service.IIpcRunningStatusRecordService;
import com.inspur.industrial.service.IIpcSysStatusService;
import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil;
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.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
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 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();
saveRunningStatus("1");
bottomCylinderDataProcess(null, bottomCylId, i, ipcUtil, alarmRulesService, alarmRecordService);
scollerDataProcess(null, topScollerId, topScollerMeasurement, 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();
tags.put("equ_id", equipId);
Map<String, Object> fields = new TreeMap();
//TODO 停机运维状态数据不储存
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());
//液位最小和最大值通过报警参数设置获取
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_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());
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesConfigListByCache(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));//TODO 根据运行状态确定规则
i.insert(measurement, tags, fields);
if (!alarmRecordList.isEmpty()) {//运行需放开
@ -213,7 +217,7 @@ public class IpcDataProcess implements Runnable {
// fields.put("ywmin",0.3);
// 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_max", levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
@ -277,8 +281,8 @@ public class IpcDataProcess implements Runnable {
fields.put("flw11", (float) 0 + Math.random());
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesConfigListByCache(equipId);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields, tags, Constant.RUNNING, rulesList));//TODO 根据运行状态确定规则
if (!alarmRecordList.isEmpty()) {//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
@ -290,12 +294,44 @@ public class IpcDataProcess implements Runnable {
*
* @return
*/
private IpcAlarmRules getLevelAlarmRule(String equipId) {
private IpcAlarmRules getLevelAlarmRule(String equipId,Integer type) {
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(equipId);
query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中
query.setType(type);//运行中
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

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

View File

@ -44,11 +44,13 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
//加载规则到缓存
@PostConstruct
public void init(){
List<IpcAlarmRules> rules = selectIpcAlarmRulesList(null);
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
for (IpcEquipInfo equip : equips) {
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY+equip.getId(),rulesByEquipId);
if(redisCache.getCacheObject(CacheConstants.IPC_RULES_KEY+equip.getId()) != null){
redisCache.deleteObject(CacheConstants.IPC_RULES_KEY+equip.getId());
}
redisCache.setCacheList((CacheConstants.IPC_RULES_KEY+equip.getId()),rulesByEquipId);
}
}
@ -173,7 +175,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
if (rules == null || rules.size() == 0){
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
redisCache.setCacheList(CacheConstants.IPC_RULES_KEY + equipId,rulesList);
redisCache.setCacheList((CacheConstants.IPC_RULES_KEY + equipId),rulesList);
return rulesList;
}
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,24 @@ export default {
.el-picker-panel__footer {
background-color: #001129;
}
div.el-table tr {
background-color: #0b2d57;
}
.el-tabs--border-card {
background-color: #124b86;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
background-color: #002250;
border-color: white;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item {
background-color: #124b86;
border-color: white;
}
.el-tabs--border-card > .el-tabs__header {
background-color: #124b86;
}
.pagination-container {
height: 30px;
}
</style>

View File

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