Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
1c4dc03363
@ -6,7 +6,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DeviceEventInfo {
|
public class DeviceEventInfo {
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long eventTime;
|
private Long eventTime;
|
||||||
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
@ -22,7 +21,6 @@ public class DeviceEventInfo {
|
|||||||
|
|
||||||
private String confirmAccount;
|
private String confirmAccount;
|
||||||
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long confirmTime;
|
private Long confirmTime;
|
||||||
|
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
@ -2,6 +2,7 @@ package com.das.modules.data.service;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.modules.data.domain.DeviceEventInfo;
|
import com.das.modules.data.domain.DeviceEventInfo;
|
||||||
import com.das.modules.data.service.impl.DataServiceImpl;
|
import com.das.modules.data.service.impl.DataServiceImpl;
|
||||||
import com.das.modules.equipment.domain.vo.IotModelFieldVo;
|
import com.das.modules.equipment.domain.vo.IotModelFieldVo;
|
||||||
@ -609,9 +610,10 @@ public class TDEngineService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DeviceEventInfo> queryEvent(Integer eventLevel, Long startTime, Long endTime, List<String> deviceCodeList) {
|
public PageDataInfo<DeviceEventInfo> queryEvent(Integer eventLevel, Long startTime, Long endTime, List<String> deviceCodeList, Integer limit, Integer offset) {
|
||||||
List<DeviceEventInfo> result = new ArrayList<>();
|
List<DeviceEventInfo> result = new ArrayList<>();
|
||||||
StringBuffer sb = new StringBuffer(2048);
|
StringBuffer sb = new StringBuffer(2048);
|
||||||
|
Integer total = 0;
|
||||||
sb.append("select t.* from event_info t where ");
|
sb.append("select t.* from event_info t where ");
|
||||||
sb.append(String.format(" t.event_time >= %d and t.event_time < %d", startTime, endTime));
|
sb.append(String.format(" t.event_time >= %d and t.event_time < %d", startTime, endTime));
|
||||||
if (eventLevel != null) {
|
if (eventLevel != null) {
|
||||||
@ -628,7 +630,13 @@ public class TDEngineService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append(" order by t.event_time");
|
sb.append(" order by t.event_time");
|
||||||
|
if (limit != null){
|
||||||
|
sb.append(" limit ").append(offset).append(",").append(limit);
|
||||||
|
total = getEventCount(eventLevel,startTime,endTime,deviceCodeList);
|
||||||
|
}
|
||||||
|
|
||||||
log.debug(sb.toString());
|
log.debug(sb.toString());
|
||||||
|
|
||||||
try (Connection conn = hikariDataSource.getConnection();
|
try (Connection conn = hikariDataSource.getConnection();
|
||||||
Statement smt = conn.createStatement();
|
Statement smt = conn.createStatement();
|
||||||
ResultSet rs = smt.executeQuery(sb.toString())) {
|
ResultSet rs = smt.executeQuery(sb.toString())) {
|
||||||
@ -648,9 +656,42 @@ public class TDEngineService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取数据异常", e);
|
log.error("获取数据异常", e);
|
||||||
return result;
|
return PageDataInfo.build(result, total);
|
||||||
}
|
}
|
||||||
return result;
|
return PageDataInfo.build(result, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getEventCount(Integer eventLevel, Long startTime, Long endTime, List<String> deviceCodeList){
|
||||||
|
List<DeviceEventInfo> result = new ArrayList<>();
|
||||||
|
StringBuffer sb = new StringBuffer(2048);
|
||||||
|
sb.append("select count(t.*) as total from event_info t where ");
|
||||||
|
sb.append(String.format(" t.event_time >= %d and t.event_time < %d", startTime, endTime));
|
||||||
|
if (eventLevel != null) {
|
||||||
|
sb.append(String.format(" and t.event_level = %d", eventLevel));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(deviceCodeList)) {
|
||||||
|
sb.append(" and t.device_code in (");
|
||||||
|
for (int i = 0; i < deviceCodeList.size(); i++) {
|
||||||
|
if (i == deviceCodeList.size() - 1) {
|
||||||
|
sb.append("'").append(deviceCodeList.get(i)).append("')");
|
||||||
|
} else {
|
||||||
|
sb.append("'").append(deviceCodeList.get(i)).append("',");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug(sb.toString());
|
||||||
|
Integer total = null;
|
||||||
|
try (Connection conn = hikariDataSource.getConnection();
|
||||||
|
Statement smt = conn.createStatement();
|
||||||
|
ResultSet rs = smt.executeQuery(sb.toString())) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
total = rs.getInt("total");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取数据异常", e);
|
||||||
|
}
|
||||||
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirmEvent(DeviceEventInfo deviceEventInfo) {
|
public void confirmEvent(DeviceEventInfo deviceEventInfo) {
|
||||||
|
@ -2,6 +2,7 @@ package com.das.modules.event.controller;
|
|||||||
|
|
||||||
import com.das.common.result.R;
|
import com.das.common.result.R;
|
||||||
import com.das.common.utils.JsonUtils;
|
import com.das.common.utils.JsonUtils;
|
||||||
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.modules.data.domain.DeviceEventInfo;
|
import com.das.modules.data.domain.DeviceEventInfo;
|
||||||
import com.das.modules.event.domain.EventQueryParam;
|
import com.das.modules.event.domain.EventQueryParam;
|
||||||
import com.das.modules.event.service.EventService;
|
import com.das.modules.event.service.EventService;
|
||||||
@ -33,21 +34,21 @@ public class EventController {
|
|||||||
* @return TD数据库数据
|
* @return TD数据库数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
public R<List<DeviceEventInfo>> queryEvent(@RequestBody @Valid EventQueryParam param) {
|
public PageDataInfo<DeviceEventInfo> queryEvent(@RequestBody @Valid EventQueryParam param) {
|
||||||
if (log.isDebugEnabled()){
|
if (log.isDebugEnabled()){
|
||||||
log.debug("/api/event/query is calling");
|
log.debug("/api/event/query is calling");
|
||||||
log.debug(JsonUtils.toJsonString(param));
|
log.debug(JsonUtils.toJsonString(param));
|
||||||
}
|
}
|
||||||
return R.success(eventService.queryEvent(param));
|
return eventService.queryEvent(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认告警信息
|
* 确认告警信息
|
||||||
* @param deviceEventInfo 确认信息
|
* @param deviceEventInfoList 确认信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("/confirm")
|
@PostMapping("/confirm")
|
||||||
public R<Void> confirmEvent(@RequestBody DeviceEventInfo deviceEventInfo){
|
public R<Void> confirmEvent(@RequestBody List<DeviceEventInfo> deviceEventInfoList){
|
||||||
eventService.confirmEvent(deviceEventInfo);
|
eventService.confirmEvent(deviceEventInfoList);
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,12 @@ public class EventQueryParam
|
|||||||
/**
|
/**
|
||||||
* 开始时间
|
* 开始时间
|
||||||
*/
|
*/
|
||||||
private String startTime;
|
private Long startTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束时间
|
* 结束时间
|
||||||
*/
|
*/
|
||||||
private String endTime;
|
private Long endTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件等级
|
* 事件等级
|
||||||
@ -30,4 +30,14 @@ public class EventQueryParam
|
|||||||
* 设备编码列表
|
* 设备编码列表
|
||||||
*/
|
*/
|
||||||
private List<String> deviceCode;
|
private List<String> deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pageNum;
|
||||||
|
*/
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pageSize
|
||||||
|
*/
|
||||||
|
private Integer pageSize;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.das.modules.event.service;
|
package com.das.modules.event.service;
|
||||||
|
|
||||||
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.modules.data.domain.DeviceEventInfo;
|
import com.das.modules.data.domain.DeviceEventInfo;
|
||||||
import com.das.modules.event.domain.EventQueryParam;
|
import com.das.modules.event.domain.EventQueryParam;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -7,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface EventService {
|
public interface EventService {
|
||||||
List<DeviceEventInfo> queryEvent(EventQueryParam param);
|
PageDataInfo<DeviceEventInfo> queryEvent(EventQueryParam param);
|
||||||
|
|
||||||
void confirmEvent(DeviceEventInfo deviceEventInfo);
|
void confirmEvent(List<DeviceEventInfo> deviceEventInfoList);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.das.modules.event.service.impl;
|
|||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.das.common.config.SessionUtil;
|
import com.das.common.config.SessionUtil;
|
||||||
import com.das.common.exceptions.ServiceException;
|
import com.das.common.exceptions.ServiceException;
|
||||||
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.modules.auth.domain.vo.SysUserVo;
|
import com.das.modules.auth.domain.vo.SysUserVo;
|
||||||
import com.das.modules.data.domain.DeviceEventInfo;
|
import com.das.modules.data.domain.DeviceEventInfo;
|
||||||
import com.das.modules.data.service.TDEngineService;
|
import com.das.modules.data.service.TDEngineService;
|
||||||
@ -22,20 +23,26 @@ public class EventServiceImpl implements EventService {
|
|||||||
private TDEngineService tdEngineService;
|
private TDEngineService tdEngineService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceEventInfo> queryEvent(EventQueryParam param) {
|
public PageDataInfo<DeviceEventInfo> queryEvent(EventQueryParam param) {
|
||||||
if (param.getStartTime() == null || param.getEndTime() ==null){
|
if (param.getStartTime() == null || param.getEndTime() == null) {
|
||||||
throw new ServiceException("查询时间不能为空");
|
throw new ServiceException("查询时间不能为空");
|
||||||
}
|
}
|
||||||
List<DeviceEventInfo> deviceEventInfos = tdEngineService.queryEvent(param.getEventLevel(), Long.valueOf(param.getStartTime()), Long.valueOf(param.getEndTime()), param.getDeviceCode());
|
Integer offset = null;
|
||||||
|
if (param.getPageNum() != null) {
|
||||||
|
offset = (param.getPageNum() - 1) * param.getPageSize();
|
||||||
|
}
|
||||||
|
PageDataInfo<DeviceEventInfo> deviceEventInfos = tdEngineService.queryEvent(param.getEventLevel(), param.getStartTime(), param.getEndTime(), param.getDeviceCode(), param.getPageSize(), offset);
|
||||||
return deviceEventInfos;
|
return deviceEventInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void confirmEvent(DeviceEventInfo deviceEventInfo) {
|
public void confirmEvent(List<DeviceEventInfo> deviceEventInfoList) {
|
||||||
Long confirmTime = System.currentTimeMillis();
|
Long confirmTime = System.currentTimeMillis();
|
||||||
deviceEventInfo.setConfirmTime(confirmTime);
|
for (DeviceEventInfo deviceEventInfo : deviceEventInfoList){
|
||||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
deviceEventInfo.setConfirmTime(confirmTime);
|
||||||
deviceEventInfo.setConfirmAccount(sysUserVo.getAccount());
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
tdEngineService.confirmEvent(deviceEventInfo);
|
deviceEventInfo.setConfirmAccount(sysUserVo.getAccount());
|
||||||
|
tdEngineService.confirmEvent(deviceEventInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package com.das.modules.page.controller;
|
package com.das.modules.page.controller;
|
||||||
|
|
||||||
import com.das.common.result.R;
|
import com.das.common.result.R;
|
||||||
import com.das.modules.node.domain.dto.DeviceCommandDto;
|
|
||||||
import com.das.modules.operation.domain.dto.CommandInfoDto;
|
|
||||||
import com.das.modules.page.domian.WindTurbinesPageVo;
|
import com.das.modules.page.domian.WindTurbinesPageVo;
|
||||||
import com.das.modules.page.service.WindTurbinesPageService;
|
import com.das.modules.page.service.WindTurbinesPageService;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -42,15 +39,4 @@ public class WindTurbinesPageController {
|
|||||||
List<WindTurbinesPageVo> windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages();
|
List<WindTurbinesPageVo> windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages();
|
||||||
return R.success(windTurbinesPageVos);
|
return R.success(windTurbinesPageVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param controlList 遥控List
|
|
||||||
* @return 成功或者失败
|
|
||||||
*/
|
|
||||||
@PostMapping ("/windTurbinesControl")
|
|
||||||
public R<Void> windTurbinesControl(HttpServletRequest request ,@RequestBody List<CommandInfoDto> controlList){
|
|
||||||
windTurbinesPageService.windTurbinesControl(request,controlList);
|
|
||||||
return R.success();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,135 +1,10 @@
|
|||||||
package com.das.modules.page.service;
|
package com.das.modules.page.service;
|
||||||
|
|
||||||
import com.das.common.constant.EquipmentTypeIds;
|
|
||||||
import com.das.common.exceptions.ServiceException;
|
|
||||||
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
|
||||||
import com.das.modules.data.service.impl.DataServiceImpl;
|
|
||||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
|
||||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
|
||||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
|
||||||
import com.das.modules.node.domain.dto.DeviceCommandDto;
|
|
||||||
import com.das.modules.operation.domain.dto.CommandInfoDto;
|
|
||||||
import com.das.modules.operation.service.OperationService;
|
|
||||||
import com.das.modules.page.domian.WindTurbinesPageVo;
|
import com.das.modules.page.domian.WindTurbinesPageVo;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.StopWatch;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
public interface WindTurbinesPageService {
|
||||||
@Service
|
public List<String> queryBelongLines();
|
||||||
@Slf4j
|
public List<WindTurbinesPageVo> queryAllWindTurbinesPages();
|
||||||
public class WindTurbinesPageService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
SysEquipmentMapper sysEquipmentMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DataServiceImpl dataServiceImpl;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
OperationService optService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取风机机组所属线路列表
|
|
||||||
*
|
|
||||||
* @return 返回字符串数组
|
|
||||||
*/
|
|
||||||
public List<String> queryBelongLines() {
|
|
||||||
return sysEquipmentMapper.queryBelongLines(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取风机页面数据
|
|
||||||
*
|
|
||||||
* @return 返回风机页面数据
|
|
||||||
*/
|
|
||||||
public List<WindTurbinesPageVo> queryAllWindTurbinesPages() {
|
|
||||||
StopWatch stopWatch = new StopWatch();
|
|
||||||
stopWatch.start("获取风机页面数据");
|
|
||||||
SysEquipmentDto sysEquipmentDto = new SysEquipmentDto();
|
|
||||||
sysEquipmentDto.setObjectType(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG);
|
|
||||||
List<SysEquipmentVo> sysEquipmentVos = sysEquipmentMapper.queryEquipmentListInPage(sysEquipmentDto);
|
|
||||||
//风机返回数据列表
|
|
||||||
List<WindTurbinesPageVo> windTurbinesPageVos = new ArrayList<>();
|
|
||||||
List<SnapshotValueQueryParam> paramList = new ArrayList<>();
|
|
||||||
//构建需要查询的物模型属性
|
|
||||||
List<String> attributesList = new ArrayList<>();
|
|
||||||
//风速
|
|
||||||
attributesList.add("iwindspeed");
|
|
||||||
//风机状态
|
|
||||||
attributesList.add("iturbineoperationmode");
|
|
||||||
//有功功率(MW)
|
|
||||||
attributesList.add("igenpower");
|
|
||||||
//日发电量(kwh)
|
|
||||||
attributesList.add("ikwhthisday");
|
|
||||||
//总发电量(万kwh)
|
|
||||||
attributesList.add("ikwhoverall");
|
|
||||||
//机舱角度
|
|
||||||
attributesList.add("ivanedirection");
|
|
||||||
//叶轮转速(rmp)
|
|
||||||
attributesList.add("irotorspeed");
|
|
||||||
//发电机转速(rmp)
|
|
||||||
attributesList.add("igenspeed");
|
|
||||||
//机舱温度(℃)
|
|
||||||
attributesList.add("itempnacelle_1sec");
|
|
||||||
//主油路压力(kpa)
|
|
||||||
attributesList.add("ihydrpress");
|
|
||||||
//变桨角度ipitchangle1,ipitchangle2,ipitchangle3(取最小值)
|
|
||||||
attributesList.add("ipitchangle1");
|
|
||||||
attributesList.add("ipitchangle2");
|
|
||||||
attributesList.add("ipitchangle3");
|
|
||||||
//解缆状态
|
|
||||||
attributesList.add("iyplevel");
|
|
||||||
//电网故障停机
|
|
||||||
attributesList.add("gridlostdetected");
|
|
||||||
//是否锁定
|
|
||||||
attributesList.add("Locked");
|
|
||||||
|
|
||||||
for (SysEquipmentVo item : sysEquipmentVos) {
|
|
||||||
//构建查询属性参数
|
|
||||||
SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam();
|
|
||||||
snapshotValueQueryParam.setAttributes(attributesList);
|
|
||||||
snapshotValueQueryParam.setDeviceId(item.getId().toString());
|
|
||||||
paramList.add(snapshotValueQueryParam);
|
|
||||||
//构建风机数据返回
|
|
||||||
WindTurbinesPageVo windTurbinesPageVo = new WindTurbinesPageVo();
|
|
||||||
windTurbinesPageVo.setIrn(item.getId());
|
|
||||||
windTurbinesPageVo.setName(item.getName());
|
|
||||||
windTurbinesPageVo.setModel(item.getModel());
|
|
||||||
windTurbinesPageVo.setModelId(item.getIotModelId());
|
|
||||||
windTurbinesPageVo.setBelongLine(item.getBelongLine());
|
|
||||||
windTurbinesPageVos.add(windTurbinesPageVo);
|
|
||||||
|
|
||||||
}
|
|
||||||
//获取设备测点数据
|
|
||||||
Map<String, Map<String, Object>> map = dataServiceImpl.querySnapshotValues(paramList);
|
|
||||||
for (WindTurbinesPageVo item : windTurbinesPageVos) {
|
|
||||||
item.setAttributeMap(map.get(item.getIrn().toString()));
|
|
||||||
}
|
|
||||||
stopWatch.stop();
|
|
||||||
//监控查询时间
|
|
||||||
log.debug(stopWatch.prettyPrint(TimeUnit.SECONDS));
|
|
||||||
return windTurbinesPageVos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windTurbinesControl(HttpServletRequest request,List<CommandInfoDto> controlList) {
|
|
||||||
for (CommandInfoDto item : controlList) {
|
|
||||||
try {
|
|
||||||
optService.executeOperation(request,item);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("下控失败", e);
|
|
||||||
throw new ServiceException("下控失败" + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
package com.das.modules.page.service.impl;
|
||||||
|
|
||||||
|
import com.das.common.constant.EquipmentTypeIds;
|
||||||
|
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
||||||
|
import com.das.modules.data.service.impl.DataServiceImpl;
|
||||||
|
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||||
|
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||||
|
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||||
|
import com.das.modules.operation.service.OperationService;
|
||||||
|
import com.das.modules.page.domian.WindTurbinesPageVo;
|
||||||
|
import com.das.modules.page.service.WindTurbinesPageService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class WindTurbinesPageServiceImpl implements WindTurbinesPageService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysEquipmentMapper sysEquipmentMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataServiceImpl dataServiceImpl;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OperationService optService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取风机机组所属线路列表
|
||||||
|
*
|
||||||
|
* @return 返回字符串数组
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> queryBelongLines() {
|
||||||
|
return sysEquipmentMapper.queryBelongLines(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取风机页面数据
|
||||||
|
*
|
||||||
|
* @return 返回风机页面数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WindTurbinesPageVo> queryAllWindTurbinesPages() {
|
||||||
|
StopWatch stopWatch = new StopWatch();
|
||||||
|
stopWatch.start("获取风机页面数据");
|
||||||
|
SysEquipmentDto sysEquipmentDto = new SysEquipmentDto();
|
||||||
|
sysEquipmentDto.setObjectType(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG);
|
||||||
|
List<SysEquipmentVo> sysEquipmentVos = sysEquipmentMapper.queryEquipmentListInPage(sysEquipmentDto);
|
||||||
|
//风机返回数据列表
|
||||||
|
List<WindTurbinesPageVo> windTurbinesPageVos = new ArrayList<>();
|
||||||
|
List<SnapshotValueQueryParam> paramList = new ArrayList<>();
|
||||||
|
//构建需要查询的物模型属性
|
||||||
|
List<String> attributesList = new ArrayList<>();
|
||||||
|
//风速
|
||||||
|
attributesList.add("iwindspeed");
|
||||||
|
//风机状态
|
||||||
|
attributesList.add("iturbineoperationmode");
|
||||||
|
//有功功率(MW)
|
||||||
|
attributesList.add("igenpower");
|
||||||
|
//日发电量(kwh)
|
||||||
|
attributesList.add("ikwhthisday");
|
||||||
|
//总发电量(万kwh)
|
||||||
|
attributesList.add("ikwhoverall");
|
||||||
|
//机舱角度
|
||||||
|
attributesList.add("ivanedirection");
|
||||||
|
//叶轮转速(rmp)
|
||||||
|
attributesList.add("irotorspeed");
|
||||||
|
//发电机转速(rmp)
|
||||||
|
attributesList.add("igenspeed");
|
||||||
|
//机舱温度(℃)
|
||||||
|
attributesList.add("itempnacelle_1sec");
|
||||||
|
//主油路压力(kpa)
|
||||||
|
attributesList.add("ihydrpress");
|
||||||
|
//变桨角度ipitchangle1,ipitchangle2,ipitchangle3(取最小值)
|
||||||
|
attributesList.add("ipitchangle1");
|
||||||
|
attributesList.add("ipitchangle2");
|
||||||
|
attributesList.add("ipitchangle3");
|
||||||
|
//解缆状态
|
||||||
|
attributesList.add("iyplevel");
|
||||||
|
//电网故障停机
|
||||||
|
attributesList.add("gridlostdetected");
|
||||||
|
//是否锁定
|
||||||
|
attributesList.add("Locked");
|
||||||
|
|
||||||
|
for (SysEquipmentVo item : sysEquipmentVos) {
|
||||||
|
//构建查询属性参数
|
||||||
|
SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam();
|
||||||
|
snapshotValueQueryParam.setAttributes(attributesList);
|
||||||
|
snapshotValueQueryParam.setDeviceId(item.getId().toString());
|
||||||
|
paramList.add(snapshotValueQueryParam);
|
||||||
|
//构建风机数据返回
|
||||||
|
WindTurbinesPageVo windTurbinesPageVo = new WindTurbinesPageVo();
|
||||||
|
windTurbinesPageVo.setIrn(item.getId());
|
||||||
|
windTurbinesPageVo.setName(item.getName());
|
||||||
|
windTurbinesPageVo.setModel(item.getModel());
|
||||||
|
windTurbinesPageVo.setModelId(item.getIotModelId());
|
||||||
|
windTurbinesPageVo.setBelongLine(item.getBelongLine());
|
||||||
|
windTurbinesPageVos.add(windTurbinesPageVo);
|
||||||
|
|
||||||
|
}
|
||||||
|
//获取设备测点数据
|
||||||
|
Map<String, Map<String, Object>> map = dataServiceImpl.querySnapshotValues(paramList);
|
||||||
|
for (WindTurbinesPageVo item : windTurbinesPageVos) {
|
||||||
|
item.setAttributeMap(map.get(item.getIrn().toString()));
|
||||||
|
}
|
||||||
|
stopWatch.stop();
|
||||||
|
//监控查询时间
|
||||||
|
log.debug(stopWatch.prettyPrint(TimeUnit.SECONDS));
|
||||||
|
return windTurbinesPageVos;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
- [数据字段接口](api/enumPage.md)
|
- [数据字段接口](api/enumPage.md)
|
||||||
- [人工操作接口](api/operation.md)
|
- [人工操作接口](api/operation.md)
|
||||||
- [页面访问接口](api/pages/)
|
- [页面访问接口](api/pages/)
|
||||||
|
- [告警事件接口](api/event.md)
|
||||||
- [首页接口](api/pages/home.md)
|
- [首页接口](api/pages/home.md)
|
||||||
- [数据采集](datacollect/)
|
- [数据采集](datacollect/)
|
||||||
- [系统部署](deploy/)
|
- [系统部署](deploy/)
|
||||||
|
118
docs/api/event.md
Normal file
118
docs/api/event.md
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# 告警相关模块
|
||||||
|
|
||||||
|
## API接口一览表
|
||||||
|
|
||||||
|
| 接口分类 | 接口描述 | API接口 | 权限 |
|
||||||
|
|---------|-----------------| ------------------------------------- | --------------------------- |
|
||||||
|
| 1.1告警相关操作 | 1.1.1查询设备告警信息列表 | /api/event/query | |
|
||||||
|
| | 1.2.1确认告警信息 | /api/event/confirm | |
|
||||||
|
| | | | |
|
||||||
|
|
||||||
|
|
||||||
|
### 1.1 告警相关操作接口
|
||||||
|
|
||||||
|
#### 1.1.1查询设备告警信息列表
|
||||||
|
|
||||||
|
POST 请求接口
|
||||||
|
|
||||||
|
> /api/event/query
|
||||||
|
|
||||||
|
请求参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"startTime":1730778600161,
|
||||||
|
"endTime":1730779105676,
|
||||||
|
"eventLevel": 0,
|
||||||
|
"deviceCode":["A-001"],
|
||||||
|
"pageNum": 1,
|
||||||
|
"pageSize": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
入参描述
|
||||||
|
|
||||||
|
| 参数名 | 参数类型 | 必填 | 描述 |
|
||||||
|
| ------------ |---------|-----|--------|
|
||||||
|
| startTime | Long | True | 开始时间 |
|
||||||
|
| endTime | Long | True | 结束时间 |
|
||||||
|
| eventLevel | int | False | 事件等级0:告警,1:故障 |
|
||||||
|
| deviceCode | List | True | 设备编码数组 |
|
||||||
|
| pageNum | Integer | NO | 当前页 |
|
||||||
|
| pageSize | Integer | NO | 每页显示大小 |
|
||||||
|
|
||||||
|
返回报文
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"total": 10501,
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"eventTime": 1730778601000,
|
||||||
|
"eventId": "1853647068678127617",
|
||||||
|
"eventType": 0,
|
||||||
|
"eventLevel": 0,
|
||||||
|
"eventText": "风机由于变桨系统安全链断开导致机组急停 动作",
|
||||||
|
"confirmed": 1,
|
||||||
|
"confirmAccount": "null",
|
||||||
|
"confirmTime": 1730789465314,
|
||||||
|
"deviceId": "1846101273013739522",
|
||||||
|
"deviceCode": "A-001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"eventTime": 1730778601000,
|
||||||
|
"eventId": "1853647068678127618",
|
||||||
|
"eventType": 0,
|
||||||
|
"eventLevel": 0,
|
||||||
|
"eventText": "风机轮毂温度>60℃ 复归",
|
||||||
|
"confirmed": 0,
|
||||||
|
"confirmTime": 0,
|
||||||
|
"deviceId": "1846101273013739522",
|
||||||
|
"deviceCode": "A-001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"code": 200,
|
||||||
|
"msg": "查询成功"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 1.1.2 确认告警信息
|
||||||
|
|
||||||
|
POST 请求接口
|
||||||
|
|
||||||
|
> /api/event/confirm
|
||||||
|
|
||||||
|
请求参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"eventTime": 1730778601000,
|
||||||
|
"eventId": "1853647068678127617",
|
||||||
|
"confirmed": 1,
|
||||||
|
"deviceId": "1846101273013739522"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
入参描述
|
||||||
|
|
||||||
|
| 参数名 | 参数类型 | 必填 | 描述 |
|
||||||
|
| ------------ |---------|-----|------|
|
||||||
|
| eventTime | Long | true | 事件时间 |
|
||||||
|
| eventId | String | true | 事件id |
|
||||||
|
| confirmed | int | true | 是否确认:0不确认,1确认 |
|
||||||
|
| deviceId | String | true | 设备id |
|
||||||
|
|
||||||
|
返回报文
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"success": true,
|
||||||
|
"msg": "操作成功"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -4,7 +4,15 @@ import { RequestReturnRowType, GetAlarmsTableParam, AlarmsTableType } from '/@/v
|
|||||||
// 告警列表
|
// 告警列表
|
||||||
export const getAlarmListReq = (data: GetAlarmsTableParam) => {
|
export const getAlarmListReq = (data: GetAlarmsTableParam) => {
|
||||||
return createAxios<never, RequestReturnRowType<AlarmsTableType[]>>({
|
return createAxios<never, RequestReturnRowType<AlarmsTableType[]>>({
|
||||||
url: '/api/alarm/list',
|
url: 'api/event/query',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const eventComfirm = (data: any) => {
|
||||||
|
return createAxios<never, RequestReturnRowType<any>>({
|
||||||
|
url: '/api/event/confirm',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
})
|
})
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
style="height: 40px"
|
style="height: 40px"
|
||||||
v-model="timeRange"
|
v-model="timeRange"
|
||||||
type="daterange"
|
type="datetimerange"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
range-separator="-"
|
range-separator="-"
|
||||||
:start-placeholder="t('alarm.selectDate')"
|
:start-placeholder="t('alarm.selectDate')"
|
||||||
:end-placeholder="t('alarm.selectDate')"
|
:end-placeholder="t('alarm.selectDate')"
|
||||||
|
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]"
|
||||||
:shortcuts="shortcuts"
|
:shortcuts="shortcuts"
|
||||||
/>
|
/>
|
||||||
<div style="width: 20px"></div>
|
<div style="width: 20px"></div>
|
||||||
@ -32,16 +32,21 @@
|
|||||||
<el-main class="mainMain">
|
<el-main class="mainMain">
|
||||||
<div class="tabsPart">
|
<div class="tabsPart">
|
||||||
<el-table :data="alarmsTableData" class="tablePart" highlight-current-row>
|
<el-table :data="alarmsTableData" class="tablePart" highlight-current-row>
|
||||||
<el-table-column prop="alarmTime" :label="AlarmsFieldsEnums['alarmTime']" align="center"> </el-table-column>
|
<el-table-column prop="eventTimeFormate" :label="AlarmsFieldsEnums['alarmTime']" align="center"> </el-table-column>
|
||||||
<el-table-column prop="airBlowerNumber" :label="AlarmsFieldsEnums['airBlowerNumber']" align="center"> </el-table-column>
|
<el-table-column prop="deviceCode" :label="AlarmsFieldsEnums['airBlowerNumber']" align="center"> </el-table-column>
|
||||||
<el-table-column prop="faultDescription" :label="AlarmsFieldsEnums['faultDescription']" align="center"> </el-table-column>
|
<el-table-column prop="eventText" :label="AlarmsFieldsEnums['faultDescription']" align="center"> </el-table-column>
|
||||||
<el-table-column prop="alarmGrade" :label="AlarmsFieldsEnums['alarmGrade']" align="center"> </el-table-column>
|
<el-table-column prop="eventType" :label="AlarmsFieldsEnums['alarmType']" align="center">
|
||||||
<el-table-column prop="alarmType" :label="AlarmsFieldsEnums['alarmType']" align="center"> </el-table-column>
|
<template #default="scope">
|
||||||
|
<div class="fault" v-if="scope.row.eventType">故障</div>
|
||||||
|
<div class="alarm" v-else>告警</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" width="200" align="center">
|
<el-table-column label="操作" width="200" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="tableOperate">
|
<div class="tableOperate comfirmed" v-if="scope.row.confirmed">已确认</div>
|
||||||
<a @click="okSubmit(scope.row)">确认</a>
|
<div class="tableOperate" v-else>
|
||||||
|
<a @click="open(scope.row)">确认</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -65,13 +70,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, nextTick, onMounted } from 'vue'
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
import { ElMessage, TableInstance, TreeInstance } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Search } from '@element-plus/icons-vue'
|
import { Search } from '@element-plus/icons-vue'
|
||||||
import { AlarmsFieldsEnums, AlarmsTableType, GetAlarmsTableParam } from './type'
|
import { AlarmsFieldsEnums, AlarmsTableType, GetAlarmsTableParam } from './type'
|
||||||
import { getAlarmListReq } from '/@/api/backend/alarms/request'
|
import { getAlarmListReq, eventComfirm } from '/@/api/backend/alarms/request'
|
||||||
import { equipList } from '/@/api/backend/realData/request.ts'
|
import { equipList } from '/@/api/backend/realData/request'
|
||||||
import { debounce, cloneDeep } from 'lodash'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||||
@ -79,32 +83,29 @@ const adminInfo = useAdminInfo()
|
|||||||
|
|
||||||
// 告警时间
|
// 告警时间
|
||||||
|
|
||||||
const timeRange = ref([])
|
const timeRange = ref([new Date().setHours(0, 0, 0, 0), new Date()])
|
||||||
const shortcuts = [
|
const shortcuts = [
|
||||||
{
|
{
|
||||||
text: '今天',
|
text: '今天',
|
||||||
value: () => {
|
value: () => {
|
||||||
|
const start = getFormattedDate(0) + ' 00:00:00'
|
||||||
const end = new Date()
|
const end = new Date()
|
||||||
const start = new Date()
|
|
||||||
return [start, end]
|
return [start, end]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '昨天',
|
text: '昨天',
|
||||||
value: () => {
|
value: () => {
|
||||||
const end = new Date()
|
const start = getFormattedDate(-1) + ' 00:00:00'
|
||||||
end.setDate(end.getDate() - 1)
|
const end = getFormattedDate(-1) + ' 23:59:59'
|
||||||
const start = new Date()
|
|
||||||
start.setDate(start.getDate() - 1)
|
|
||||||
return [start, end]
|
return [start, end]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '前3天',
|
text: '前3天',
|
||||||
value: () => {
|
value: () => {
|
||||||
const end = new Date()
|
const start = getFormattedDate(-3) + ' 00:00:00'
|
||||||
const start = new Date()
|
const end = getFormattedDate(-1) + ' 23:59:59'
|
||||||
start.setDate(start.getDate() - 2)
|
|
||||||
return [start, end]
|
return [start, end]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -121,6 +122,15 @@ const shortcuts = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
const getFormattedDate = (offset: number) => {
|
||||||
|
const date = new Date()
|
||||||
|
date.setDate(date.getDate() + offset)
|
||||||
|
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day}`
|
||||||
|
}
|
||||||
|
|
||||||
// 风机编号
|
// 风机编号
|
||||||
const airBlowerNumberValue = ref('')
|
const airBlowerNumberValue = ref('')
|
||||||
@ -128,18 +138,26 @@ const airBlowerList = ref([{ label: '', value: '' }])
|
|||||||
// 类别
|
// 类别
|
||||||
const alarmTypeValue = ref('')
|
const alarmTypeValue = ref('')
|
||||||
const alarmTypes = ref([
|
const alarmTypes = ref([
|
||||||
|
{ label: '告警', value: 0 },
|
||||||
{ label: '故障', value: 1 },
|
{ label: '故障', value: 1 },
|
||||||
{ label: '告警', value: 2 },
|
|
||||||
])
|
])
|
||||||
|
|
||||||
const searchalarms = (): GetAlarmsTableParam => {
|
const searchalarms = (): GetAlarmsTableParam => {
|
||||||
const start = timeRange.value[0]
|
const start = timeRange.value[0]
|
||||||
const end = timeRange.value[1]
|
const end = timeRange.value[1]
|
||||||
|
const deviceCode: any = []
|
||||||
|
if (airBlowerNumberValue.value.length) {
|
||||||
|
deviceCode.push(airBlowerNumberValue.value)
|
||||||
|
} else {
|
||||||
|
airBlowerList.value.forEach((item: any) => {
|
||||||
|
deviceCode.push(item.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
startTime: start || '',
|
startTime: new Date(start).getTime() || new Date().setHours(0, 0, 0, 0).valueOf(),
|
||||||
endTime: end || '',
|
endTime: new Date(end).getTime() || new Date().valueOf(),
|
||||||
airBlowerNumber: airBlowerNumberValue.value,
|
eventLevel: alarmTypeValue.value || null,
|
||||||
alarmType: alarmTypeValue.value,
|
deviceCode: deviceCode,
|
||||||
pageNum: paginationOptions.current,
|
pageNum: paginationOptions.current,
|
||||||
pageSize: paginationOptions.pageSize,
|
pageSize: paginationOptions.pageSize,
|
||||||
}
|
}
|
||||||
@ -160,49 +178,74 @@ const getcurrentPage = () => {
|
|||||||
|
|
||||||
const getalarmsList = () => {
|
const getalarmsList = () => {
|
||||||
const transparams = searchalarms()
|
const transparams = searchalarms()
|
||||||
console.log('🚀 ~ getalarmsList ~ transparams:', transparams)
|
getAlarmListReq(transparams)
|
||||||
setTimeout(() => {
|
.then((res: any) => {
|
||||||
alarmsTableData.value = [
|
if (res.code == 200) {
|
||||||
{
|
paginationOptions.total = res.total
|
||||||
alarmTime: '2024-09-30 14:08:00',
|
alarmsTableData.value = res.rows.map((item: any) => {
|
||||||
airBlowerNumber: 'sc-001',
|
return {
|
||||||
faultDescription: '变桨轴1处于紧急模式',
|
...item,
|
||||||
alarmGrade: '一级',
|
eventTimeFormate: timestampToTime(item.eventTime),
|
||||||
alarmType: '故障',
|
}
|
||||||
},
|
})
|
||||||
{
|
} else {
|
||||||
alarmTime: '2024-09-30 14:08:00',
|
ElMessage.error(res.msg ?? '查询失败')
|
||||||
airBlowerNumber: 'sc-001',
|
}
|
||||||
faultDescription: '变桨轴1处于紧急模式',
|
})
|
||||||
alarmGrade: '一级',
|
.catch((err) => {
|
||||||
alarmType: '故障',
|
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
alarmTime: '2024-09-30 14:08:00',
|
const timestampToTime = (timestamp: any) => {
|
||||||
airBlowerNumber: 'sc-001',
|
timestamp = timestamp ? timestamp : null
|
||||||
faultDescription: '变桨轴1处于紧急模式',
|
let date = new Date(timestamp)
|
||||||
alarmGrade: '一级',
|
let Y = date.getFullYear() + '-'
|
||||||
alarmType: '故障',
|
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
|
||||||
},
|
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
|
||||||
]
|
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
|
||||||
paginationOptions.total = 3
|
let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||||
|
return Y + M + D + h + m
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = (val: any) => {
|
||||||
|
ElMessageBox.confirm('是否确认?', '提示', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
})
|
})
|
||||||
// getAlarmListReq(transparams)
|
.then(() => {
|
||||||
// .then((res) => {
|
okSubmit(val)
|
||||||
// if (res.rows) {
|
})
|
||||||
// paginationOptions.total = res.total
|
.catch(() => {
|
||||||
// } else {
|
ElMessage({
|
||||||
// ElMessage.error(res.msg ?? '查询失败')
|
type: 'info',
|
||||||
// }
|
message: '取消确认',
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
})
|
||||||
// ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const okSubmit = (val: any) => {
|
const okSubmit = (val: any) => {
|
||||||
console.log(val)
|
const reqData: any = [
|
||||||
getalarmsList()
|
{
|
||||||
|
eventTime: val.eventTime,
|
||||||
|
eventId: val.eventId,
|
||||||
|
confirmed: 1,
|
||||||
|
deviceId: val.deviceId,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
eventComfirm(reqData)
|
||||||
|
.then((res: any) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage.success(res.msg ?? '确认成功')
|
||||||
|
getalarmsList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg ?? '查询失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const getDateRange = (type: 'week' | 'month') => {
|
const getDateRange = (type: 'week' | 'month') => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
@ -233,13 +276,13 @@ onMounted(() => {
|
|||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
airBlowerList.value = res.data.map((item: any) => {
|
airBlowerList.value = res.data.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
label: item.code,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.code,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
getalarmsList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getalarmsList()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -294,6 +337,22 @@ $paginationHeight: 32px;
|
|||||||
}
|
}
|
||||||
.tablePart {
|
.tablePart {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
.alarm {
|
||||||
|
border: 1px solid rgb(228, 161, 18);
|
||||||
|
width: fit-content;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: rgb(228, 161, 18);
|
||||||
|
}
|
||||||
|
.fault {
|
||||||
|
border: 1px solid #a03b1d;
|
||||||
|
width: fit-content;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #a03b1d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.tableOperate {
|
.tableOperate {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -307,6 +366,10 @@ $paginationHeight: 32px;
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.comfirmed {
|
||||||
|
font-weight: 600;
|
||||||
|
color: rgb(5, 174, 163);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.mainFooter {
|
.mainFooter {
|
||||||
|
@ -20,12 +20,12 @@ export type AlarmsTableType = {
|
|||||||
alarmType: string
|
alarmType: string
|
||||||
}
|
}
|
||||||
export type GetAlarmsTableParam = {
|
export type GetAlarmsTableParam = {
|
||||||
startTime: string
|
startTime: string | number
|
||||||
endTime: string
|
endTime: string | number
|
||||||
airBlowerNumber: string
|
deviceCode: any
|
||||||
alarmType: string
|
eventLevel: string | null
|
||||||
pageNum: number
|
pageNum: Number
|
||||||
pageSize: number
|
pageSize: Number
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AlarmsFieldsEnums {
|
export enum AlarmsFieldsEnums {
|
||||||
|
Loading…
Reference in New Issue
Block a user