feat(harmonic): 优化事件管理功能并调整日志级别

- 将多个模块的根日志级别从info调整为warn
- 在CldEventParam中为幅值和持续时间字段添加更明确的描述
- 为CommonStatisticalQueryParam添加持续时间、特征幅值、严重度等范围验证参数
- 在CsEngineeringServiceImpl中添加排序功能支持
- 为设备交付相关参数和实体类添加治理方法、敏感用户、治理类型等新字段
- 在事件服务中实现持续时间、幅值、严重度等多维度筛选查询功能
- 为CsEventPO添加严重度字段并实现相关计算逻辑
- 优化事件列表查询性能,添加波形文件存在性过滤条件
- 更新XML映射文件以支持新的查询参数和字段映射
- 重构台账树构建逻辑,提升数据加载效率
- 修复数据查询中的大小写匹配问题
This commit is contained in:
xy
2026-06-10 10:51:59 +08:00
parent 681ec99f23
commit 85f0775c97
35 changed files with 1546 additions and 579 deletions

View File

@@ -111,4 +111,13 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
private Integer upgrade;
@ApiModelProperty(value="治理方法")
private String governMethod;
@ApiModelProperty(value="敏感用户id")
private String monitorUser;
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
private String governType;
}

View File

@@ -116,4 +116,13 @@ public class CsEquipmentDeliveryAuditParm {
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
private Integer upgrade;
@ApiModelProperty(value="治理方法")
private String governMethod;
@ApiModelProperty(value="敏感用户id")
private String monitorUser;
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
private String governType;
}

View File

@@ -158,4 +158,28 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
* 是否支持升级(0:否 1:是)
*/
private Integer upgrade;
/**
* 治理方法
*/
@TableField(value = "govern_method")
private String governMethod;
/**
* 敏感用户id
*/
@TableField(value = "monitor_user")
private String monitorUser;
/**
* 治理类型(稳态:harmonic 暂态:event)
*/
@TableField(value = "govern_type")
private String governType;
/**
* 治理报告文件路径
*/
@TableField(value = "report_file_path")
private String reportFilePath;
}

View File

@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -31,6 +30,9 @@ public class DataGroupEventVO {
@ApiModelProperty("装置ID")
private String deviceId;
@ApiModelProperty("设备网络码")
private String nDid;
@ApiModelProperty("装置名称")
private String devName;
@@ -65,7 +67,7 @@ public class DataGroupEventVO {
private Double amplitude;
@ApiModelProperty("严重度")
private String severity;
private Double severity;
@ApiModelProperty("波形路径")
private String wavePath;
@@ -82,4 +84,7 @@ public class DataGroupEventVO {
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
private String sagSource;
@ApiModelProperty("监测点电压等级")
private Double lineVoltage;
}

View File

@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
@@ -20,6 +21,9 @@ public class RecordAllDevTreeVo {
@ApiModelProperty("设备名称")
private String name;
@ApiModelProperty("设备状态")
private Integer runStatus;
@ApiModelProperty("线路")
private List<RecordAllLineTreeVo> children;

View File

@@ -1,39 +1,25 @@
package com.njcn.csdevice.controller.ledger;
import cn.hutool.core.collection.CollUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.service.CsCommTerminalService;
import com.njcn.csdevice.service.CsDeviceUserPOService;
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
import com.njcn.csdevice.service.CsLinePOService;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.constant.UserType;
import com.njcn.user.pojo.vo.UserVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**

View File

@@ -21,7 +21,7 @@
<select id="getRecordAll" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo">
<if test="wlRecordPageParam.isTrueFlag == 0">
select a.dev_id as id,b.name as name from wl_record a
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
left join cs_equipment_delivery b on a.dev_id = b.id
where a.type=1 and a.state =1 and a.end_time is not null
and
@@ -31,7 +31,7 @@
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
</if>
<if test="wlRecordPageParam.isTrueFlag == 1">
select a.dev_id as id,b.name as name from wl_record a
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
left join cs_equipment_delivery b on a.dev_id = b.id
where a.type=1 and a.state =1 and a.end_time is not null
and exists

View File

@@ -138,6 +138,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
csLedger1.setName(csEngineeringAuditParm.getName());
}
csLedger1.setSort(csEngineeringAuditParm.getSort());
csLedgerMapper.updateById(csLedger1);
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
if(list.size()>1){

View File

@@ -25,12 +25,14 @@ import com.njcn.csdevice.mapper.CsDataSetMapper;
import com.njcn.csdevice.mapper.CsGroArrMapper;
import com.njcn.csdevice.mapper.CsGroupMapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.dto.CsLineDTO;
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.csdevice.pojo.vo.CsGroupVO;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
import com.njcn.csdevice.service.CsLinePOService;
import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csdevice.service.ICsLedgerService;
@@ -109,6 +111,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
private final CsLinePOService csLinePOService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -517,9 +520,24 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
csEventUserQueryPage.setEvtParamTmMin(commonStatisticalQueryParam.getEvtParamTmMin());
csEventUserQueryPage.setEvtParamTmMax(commonStatisticalQueryParam.getEvtParamTmMax());
csEventUserQueryPage.setFeatureAmplitudeMin(commonStatisticalQueryParam.getFeatureAmplitudeMin());
csEventUserQueryPage.setFeatureAmplitudeMax(commonStatisticalQueryParam.getFeatureAmplitudeMax());
csEventUserQueryPage.setSeverityMin(commonStatisticalQueryParam.getSeverityMin());
csEventUserQueryPage.setSeverityMax(commonStatisticalQueryParam.getSeverityMax());
csEventUserQueryPage.setTarget(commonStatisticalQueryParam.getTarget());
csEventUserQueryPage.setFileFlag(commonStatisticalQueryParam.getFileFlag());
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
//获取监测点电压等级
List<CsLineDTO> list = csLinePOService.getAllLineDetail();
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
csEventVOPage.getRecords().forEach(temp->{
//监测点电压等级
Double volGrade = map.get(temp.getLineId()).getVolGrade();
if (!Objects.isNull(volGrade)) {
temp.setLineVoltage(volGrade);
}
//事件描述、相别、暂降幅值,需要特殊处理赋值
//事件描述
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
@@ -1137,7 +1155,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(finalCsLinePO.getLineId());
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(fittingDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
@@ -1146,7 +1164,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
String dataType = param.getValueType();
if (StrUtil.isEmpty(dataType)) {
// 电能质量指标,取限值计算类型,判断是否越限
dataType = epdPqd.getFormula();
dataType = epdPqd.getFormula().toUpperCase();
} else {
dataType = dataType.toUpperCase();
}
commonQueryParam.setDataType(dataType);

View File

@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
import com.njcn.csdevice.api.CsMarketDataFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.*;
@@ -1171,60 +1170,33 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
public CsLedgerVO cldTree() {
List<CsLedgerVO> allList = this.baseMapper.getAll();
if (CollectionUtil.isEmpty(allList)) {
CsLedgerVO government = new CsLedgerVO();
government.setLevel(-1);
government.setName("台账树");
government.setPid("0");
government.setId(IdUtil.simpleUUID());
government.setChildren(new ArrayList<>());
return government;
return buildTreeRootNode(new ArrayList<>());
}
List<CsLedgerVO> engineeringList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode()))
Map<Integer, List<CsLedgerVO>> levelMap = allList.stream()
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
.collect(Collectors.groupingBy(CsLedgerVO::getLevel));
List<CsLedgerVO> projectList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
List<CsLedgerVO> lineList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
List<CsLedgerVO> engineeringList = levelMap.getOrDefault(LineBaseEnum.ENGINEERING_LEVEL.getCode(), new ArrayList<>());
List<CsLedgerVO> projectList = levelMap.getOrDefault(LineBaseEnum.PROJECT_LEVEL.getCode(), new ArrayList<>());
List<CsLedgerVO> deviceList = levelMap.getOrDefault(LineBaseEnum.DEVICE_LEVEL.getCode(), new ArrayList<>());
List<CsLedgerVO> lineList = levelMap.getOrDefault(LineBaseEnum.LINE_LEVEL.getCode(), new ArrayList<>());
if (CollectionUtil.isEmpty(deviceList)) {
CsLedgerVO government = new CsLedgerVO();
government.setLevel(-1);
government.setName("台账树");
government.setPid("0");
government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList);
return government;
Map<String, List<CsLedgerVO>> projectByPidMap = projectList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
engineeringList.forEach(eng -> eng.setChildren(projectByPidMap.getOrDefault(eng.getId(), new ArrayList<>())));
return buildTreeRootNode(engineeringList);
}
// 批量查询设备交付信息
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
Map<String, String> lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
Set<String> cldDevIds = devs.stream()
.map(CsEquipmentDeliveryPO::getId)
.collect(Collectors.toSet());
Map<String, List<CsLedgerVO>> projectToDeviceMap = deviceList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
Map<String, List<CsLedgerVO>> deviceToLineMap = lineList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream()
.collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
Set<String> cldDevIds = devs.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toSet());
// 填充设备状态信息
deviceList.forEach(device -> {
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
if (dev != null) {
@@ -1233,6 +1205,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
}
});
// 填充监测点状态信息
Map<String, String> lineDevMap = lineList.stream()
.collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
lineList.forEach(line -> {
String devId = lineDevMap.get(line.getId());
if (devId != null) {
@@ -1243,39 +1218,48 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
}
});
engineeringList.forEach(engineering -> {
List<CsLedgerVO> sortedProjects = projectList.stream()
.filter(project -> project.getPid().equals(engineering.getId()))
.peek(project -> {
List<CsLedgerVO> projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>());
if (CollectionUtil.isNotEmpty(projectDevices)) {
List<CsLedgerVO> sortedDevices = projectDevices.stream()
.filter(device -> cldDevIds.contains(device.getId()))
.peek(device -> {
List<CsLedgerVO> sortedLines = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>())
.stream()
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
device.setChildren(sortedLines);
})
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
project.setChildren(sortedDevices);
}
})
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
engineering.setChildren(sortedProjects);
// 预构建pid映射
Map<String, List<CsLedgerVO>> projectByEngineeringMap = projectList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
Map<String, List<CsLedgerVO>> deviceByProjectMap = deviceList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
Map<String, List<CsLedgerVO>> lineByDeviceMap = lineList.stream()
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
// 逐层构建树:设备 -> 监测点
deviceList.forEach(device -> {
if (cldDevIds.contains(device.getId())) {
device.setChildren(lineByDeviceMap.getOrDefault(device.getId(), new ArrayList<>()));
}
});
CsLedgerVO government = new CsLedgerVO();
government.setLevel(-1);
government.setName("台账树");
government.setPid("0");
government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList);
// 项目 -> 设备(仅包含有交付记录的设备)
projectList.forEach(project -> {
List<CsLedgerVO> projectDevices = deviceByProjectMap.getOrDefault(project.getId(), new ArrayList<>());
if (CollectionUtil.isNotEmpty(projectDevices)) {
List<CsLedgerVO> validDevices = projectDevices.stream()
.filter(device -> cldDevIds.contains(device.getId()))
.collect(Collectors.toList());
project.setChildren(validDevices);
}
});
return government;
// 工程 -> 项目
engineeringList.forEach(eng ->
eng.setChildren(projectByEngineeringMap.getOrDefault(eng.getId(), new ArrayList<>()))
);
return buildTreeRootNode(engineeringList);
}
private CsLedgerVO buildTreeRootNode(List<CsLedgerVO> children) {
CsLedgerVO root = new CsLedgerVO();
root.setLevel(-1);
root.setName("台账树");
root.setPid("0");
root.setId(IdUtil.simpleUUID());
root.setChildren(children);
return root;
}
@Override

View File

@@ -164,9 +164,8 @@ class IcdServiceImpl implements IcdService {
}
Integer level = csLedger.getLevel();
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
Integer sort = csLedger.getSort();
// 设置工程信息(所有级别都需要)
setEngineeringInfo(vo, level, pids, id, sort);
setEngineeringInfo(vo, level, pids, id);
// 根据级别设置不同的业务数据
switch (level) {
case 0:
@@ -328,7 +327,7 @@ class IcdServiceImpl implements IcdService {
.collect(Collectors.toList());
event.setMonitorIdList(monitorIds);
if (bzType == 0) {
if (!Objects.isNull(bzType) && bzType == 0) {
event.setDataType(0);
} else {
event.setDataType(1);
@@ -371,7 +370,7 @@ class IcdServiceImpl implements IcdService {
reply.setDeviceId(device.getId());
reply.setLineId(lineId);
reply.setIsReceived(0);
if (bzType == 0) {
if (!Objects.isNull(bzType) && bzType == 0) {
reply.setCode("harmonic");
} else {
reply.setCode("allEvent");
@@ -494,7 +493,7 @@ class IcdServiceImpl implements IcdService {
/**
* 设置工程信息
*/
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id, Integer sort) {
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id) {
String engineeringId;
if (level == 0) {
@@ -513,7 +512,7 @@ class IcdServiceImpl implements IcdService {
vo.setProvince(po.getProvince());
vo.setCity(po.getCity());
vo.setEngineeringDescription(po.getDescription());
vo.setSort(sort);
vo.setSort(po.getSort());
}
}

View File

@@ -43,7 +43,7 @@ spring:
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
root: warn
data:
source:

View File

@@ -23,10 +23,10 @@ public class CldEventParam implements Serializable {
@ApiModelProperty("暂降触发时间")
private String startTime;
@ApiModelProperty("幅值")
@ApiModelProperty("幅值 没带百分比")
private Double amplitude;
@ApiModelProperty("持续时间")
@ApiModelProperty("持续时间 s")
private Double duration;
@ApiModelProperty("暂态类型 0-未知 1-暂降 2-暂升 3-中断 4-瞬态")

View File

@@ -2,6 +2,7 @@ package com.njcn.csharmonic.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import java.util.List;
@@ -52,4 +53,35 @@ public class CommonStatisticalQueryParam {
@ApiModelProperty(value = "数据模型 0:全量查询 1:增量查询")
private Integer dataModel;
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMin;
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMax;
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMin;
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMax;
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
private Integer fileFlag;
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMin;
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMax;
@ApiModelProperty(value = "事件类型",name = "target")
private List<String> target;
}

View File

@@ -3,6 +3,7 @@ package com.njcn.csharmonic.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@@ -28,6 +29,35 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
private Integer pageSize;
@ApiModelProperty(value = "搜索内容",name = "searchValue")
private String searchValue;
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMin;
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMax;
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMin;
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMax;
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
private Integer fileFlag;
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMin;
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMax;
@ApiModelProperty(value = "设备类型名称(便携式,治理)")
private String deviceTypeName;

View File

@@ -45,6 +45,7 @@ public class CsEventUserQueryParam {
private String status;
private String level;
@ApiModelProperty(value="起始时间")
private String startTime;

View File

@@ -0,0 +1,50 @@
package com.njcn.csharmonic.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import java.io.Serializable;
import java.util.List;
/**
* @author 徐扬
*/
@Data
public class ItemParam extends BaseParam implements Serializable{
@ApiModelProperty("测试项id")
private String id;
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMin;
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
private Double evtParamTmMax;
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMin;
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
private Double featureAmplitudeMax;
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
private Integer fileFlag;
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMin;
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
private Double severityMax;
@ApiModelProperty(value = "事件类型",name = "target")
private List<String> target;
}

View File

@@ -165,4 +165,10 @@ public class CsEventPO extends BaseEntity {
*/
@TableField(value = "uchg")
private Double uchg;
/**
* 暂降严重度
*/
@TableField(value = "severity")
private Double severity;
}

View File

@@ -46,6 +46,9 @@ public class EventDetailVO {
*/
private String deviceId;
@ApiModelProperty(value = "设备网络id")
private String nDid;
@ApiModelProperty(value = "设备类型")
private String devType;
@@ -69,10 +72,19 @@ public class EventDetailVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime startTime2;
/**
* 事件字典id
*/
private String dictDataId;
/**
* 事件类型
*/
private String tag;
/**
* 事件名称
*/
private String showName;
/**
@@ -148,4 +160,10 @@ public class EventDetailVO {
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
private String sagSource;
@ApiModelProperty("监测点电压等级")
private Double lineVoltage;
@ApiModelProperty("事件严重度")
private Double severity;
}

View File

@@ -1,5 +1,8 @@
package com.njcn.csharmonic.utils;
import java.util.ArrayList;
import java.util.List;
public class DataChangeUtil {
/**
@@ -43,4 +46,34 @@ public class DataChangeUtil {
return data;
}
public static List<String> getTag(List<String> target) {
List<String> tag = new ArrayList<>();
target.forEach(temp -> {
switch (temp) {
case "暂降":
tag.add("Evt_Sys_DipStr");
break;
case "中断":
tag.add("Evt_Sys_IntrStr");
break;
case "暂升":
tag.add("Evt_Sys_SwlStr");
break;
case "瞬态":
tag.add("Evt_Sys_QitrV");
tag.add("Evt_Sys_QitrA");
tag.add("Transient");
break;
case "振荡":
tag.add("Evt_Sys_PoscLowStr");
tag.add("Evt_Sys_PoscSyncStr");
tag.add("Evt_Sys_PoscWideStr");
break;
default:
break;
}
});
return tag;
}
}

View File

@@ -9,8 +9,8 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csdevice.pojo.vo.EachModuleVO;
import com.njcn.csdevice.pojo.vo.RecordVo;
import com.njcn.csharmonic.param.DataParam;
import com.njcn.csharmonic.param.ItemParam;
import com.njcn.csharmonic.pojo.vo.AppLineDetailVo;
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
import com.njcn.csharmonic.service.IDataService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
@@ -38,9 +38,9 @@ public class DataController extends BaseController {
@PostMapping("/realTimeData")
@ApiOperation("设备监控-》准实时数据")
@ApiImplicitParam(name = "param", value = "参数", required = true)
public HttpResult<List<RealTimeDataVo>> realTimeData(@RequestBody DataParam param) {
public HttpResult<List<AppLineDetailVo>> realTimeData(@RequestBody DataParam param) {
String methodDescribe = getMethodDescribe("realTimeData");
List<RealTimeDataVo> list = dataService.getRealTimeData(param);
List<AppLineDetailVo> list = dataService.getRealTimeData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@@ -57,10 +57,10 @@ public class DataController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getEventByItem")
@ApiOperation("方案数据-》根据测试项获取暂态事件")
@ApiImplicitParam(name = "id", value = "id", required = true)
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestParam("id") String id) {
@ApiImplicitParam(name = "param", value = "param", required = true)
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestBody ItemParam param) {
String methodDescribe = getMethodDescribe("getEventByItem");
List<DataGroupEventVO> list = dataService.getEventByItem(id);
List<DataGroupEventVO> list = dataService.getEventByItem(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}

View File

@@ -11,6 +11,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -137,5 +139,18 @@ public class PqSensitiveUserController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
/**
* 治理用户与设备关系树
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getUserDevTree")
@ApiOperation("治理用户与设备关系树")
@ApiImplicitParam(name = "type", value = "治理类型")
public HttpResult<Map<String,List<CsEquipmentDeliveryPO>>> getUserDevTree(@RequestParam(name = "type") String type) {
String methodDescribe = getMethodDescribe("getUserDevTree");
Map<String,List<CsEquipmentDeliveryPO>> map = pqSensitiveUserService.getUserDevTree(type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe);
}
}

View File

@@ -243,10 +243,40 @@
select DISTINCT b.id id,
b.device_id deviceId,b.line_id lineId,b.code code,
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
,d.name lineName,b.advance_reason advanceReason,b.advance_type advanceType,b.sag_source sagSource
,d.name lineName,b.advance_reason advanceReason,b.advance_type advanceType,b.sag_source sagSource,e.dev_type devType,b.severity severity,e.ndid nDid
from cs_event b
left join cs_line d on d.line_id=b.line_id
left join cs_equipment_delivery e on b.device_id = e.id
where 1=1
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMin != null and csEventUserQueryPage.evtParamTmMin !=''">
AND b.persist_time &gt; #{csEventUserQueryPage.evtParamTmMin}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMax != null and csEventUserQueryPage.evtParamTmMax !=''">
AND b.persist_time &lt; #{csEventUserQueryPage.evtParamTmMax}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMin != null and csEventUserQueryPage.featureAmplitudeMin !=''">
AND b.amplitude &gt; #{csEventUserQueryPage.featureAmplitudeMin}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMax != null and csEventUserQueryPage.featureAmplitudeMax !=''">
AND b.amplitude &lt; #{csEventUserQueryPage.featureAmplitudeMax}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMin != null and csEventUserQueryPage.severityMin !=''">
AND b.severity &gt; #{csEventUserQueryPage.severityMin}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMax != null and csEventUserQueryPage.severityMax !=''">
AND b.severity &lt; #{csEventUserQueryPage.severityMax}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
AND b.wave_path is null
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 1 ">
AND b.wave_path is not null
</if>
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
AND DATE(b.start_time) &lt;= DATE(#{csEventUserQueryPage.endTime})
</if>

View File

@@ -3,10 +3,7 @@ package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.param.CldEventParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.param.DataParam;
import com.njcn.csharmonic.param.*;
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
@@ -57,7 +54,7 @@ public interface CsEventPOService extends IService<CsEventPO>{
void getFileZip(String eventId,HttpServletResponse response);
List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId);
List<DataGroupEventVO> queryEventList(ItemParam param, LocalDateTime startDate, LocalDateTime endDate, String lineId);
List<CsEventPO> queryByModelId(DataParam param);
@@ -73,5 +70,4 @@ public interface CsEventPOService extends IService<CsEventPO>{
List<CsEventPO> getEvents(List<String> idList);
List<CsEventPO> getDevAlarmList(CsEventUserQueryParam param);
}

View File

@@ -4,6 +4,7 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csdevice.pojo.vo.EachModuleVO;
import com.njcn.csdevice.pojo.vo.RecordVo;
import com.njcn.csharmonic.param.DataParam;
import com.njcn.csharmonic.param.ItemParam;
import com.njcn.csharmonic.pojo.vo.AppLineDetailVo;
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
@@ -19,7 +20,7 @@ public interface IDataService {
* @param param
* @return
*/
List<RealTimeDataVo> getRealTimeData(DataParam param);
List<AppLineDetailVo> getRealTimeData(DataParam param);
/**
* 获取监测点测试项信息
@@ -29,7 +30,7 @@ public interface IDataService {
/**
* 根据测试项id获取时间范围内的暂态事件
*/
List<DataGroupEventVO> getEventByItem(String id);
List<DataGroupEventVO> getEventByItem(ItemParam param);
/**
* 获取治理监测点下所有模块的事件数据

View File

@@ -2,12 +2,14 @@ package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
import com.njcn.web.pojo.param.BaseParam;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -27,4 +29,6 @@ public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
Map<String,List<CsEquipmentDeliveryPO>> getUserDevTree(String type);
}

View File

@@ -25,10 +25,7 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.enums.CsEventEnum;
import com.njcn.csharmonic.enums.CsTransientEnum;
import com.njcn.csharmonic.mapper.CsEventPOMapper;
import com.njcn.csharmonic.param.CldEventParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.param.DataParam;
import com.njcn.csharmonic.param.*;
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
@@ -36,6 +33,7 @@ import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.service.CsEventPOService;
import com.njcn.csharmonic.service.CsEventUserPOService;
import com.njcn.csharmonic.utils.DataChangeUtil;
import com.njcn.cssystem.api.MsgSendFeignClient;
import com.njcn.cssystem.pojo.param.MsgSendParam;
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
@@ -180,8 +178,37 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
}
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (!Objects.isNull(csEventUserQueryPage.getEvtParamTmMin())) {
lambdaQueryWrapper.gt(CsEventPO::getPersistTime,csEventUserQueryPage.getEvtParamTmMin());
}
if (!Objects.isNull(csEventUserQueryPage.getEvtParamTmMax())) {
lambdaQueryWrapper.lt(CsEventPO::getPersistTime,csEventUserQueryPage.getEvtParamTmMax());
}
if (!Objects.isNull(csEventUserQueryPage.getFeatureAmplitudeMin())) {
lambdaQueryWrapper.gt(CsEventPO::getAmplitude,csEventUserQueryPage.getFeatureAmplitudeMin());
}
if (!Objects.isNull(csEventUserQueryPage.getFeatureAmplitudeMax())) {
lambdaQueryWrapper.lt(CsEventPO::getAmplitude,csEventUserQueryPage.getFeatureAmplitudeMax());
}
if (!Objects.isNull(csEventUserQueryPage.getSeverityMin())) {
lambdaQueryWrapper.gt(CsEventPO::getSeverity,csEventUserQueryPage.getSeverityMin());
}
if (!Objects.isNull(csEventUserQueryPage.getSeverityMax())) {
lambdaQueryWrapper.lt(CsEventPO::getSeverity,csEventUserQueryPage.getSeverityMax());
}
if (CollUtil.isNotEmpty(csEventUserQueryPage.getTarget())) {
List<String> tag = DataChangeUtil.getTag(csEventUserQueryPage.getTarget());
lambdaQueryWrapper.in(CsEventPO::getTag,tag);
}
if (!Objects.isNull(csEventUserQueryPage.getFileFlag()) && csEventUserQueryPage.getFileFlag() == 0) {
lambdaQueryWrapper.isNull(CsEventPO::getWavePath);
} else if (!Objects.isNull(csEventUserQueryPage.getFileFlag()) && csEventUserQueryPage.getFileFlag() == 1) {
lambdaQueryWrapper.isNotNull(CsEventPO::getWavePath);
}
lambdaQueryWrapper.eq(CsEventPO::getLineId,csEventUserQueryPage.getLineId())
.eq(CsEventPO::getType,0).between(CsEventPO::getStartTime,begin,end)
.eq(CsEventPO::getType,0)
.between(CsEventPO::getStartTime,begin,end)
.orderByDesc(CsEventPO::getStartTime);
Page<CsEventPO> page = this.page(new Page<>(csEventUserQueryPage.getPageNum(),csEventUserQueryPage.getPageSize()),lambdaQueryWrapper);
if(CollUtil.isNotEmpty(page.getRecords())){
@@ -247,9 +274,9 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
dataGroupEventVOList.forEach(item->{
item.setLineName(linePOMap.getOrDefault(item.getLineId(),"/"));
if(CsTransientEnum.EVT_SYS_SWLSTR.getCode().equals(item.getTag())){
item.setSeverity("/");
item.setSeverity(null);
}else {
item.setSeverity(getYzd(item.getPersistTime()*1000,item.getAmplitude()/100.0));
item.setSeverity(Double.valueOf(getYzd(item.getPersistTime()*1000,item.getAmplitude()/100.0)));
}
item.setTag(CsTransientEnum.getNameByCode(item.getTag()));
item.setPersistTime(BigDecimal.valueOf(item.getPersistTime()).setScale(3, RoundingMode.HALF_UP).doubleValue());
@@ -332,9 +359,38 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
}
@Override
public List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId) {
public List<DataGroupEventVO> queryEventList(ItemParam param, LocalDateTime startDate, LocalDateTime endDate, String lineId) {
List<DataGroupEventVO> dataGroupEventVOList = new ArrayList<>();
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (!Objects.isNull(param.getEvtParamTmMin())) {
lambdaQueryWrapper.gt(CsEventPO::getPersistTime,param.getEvtParamTmMin());
}
if (!Objects.isNull(param.getEvtParamTmMax())) {
lambdaQueryWrapper.lt(CsEventPO::getPersistTime,param.getEvtParamTmMax());
}
if (!Objects.isNull(param.getFeatureAmplitudeMin())) {
lambdaQueryWrapper.gt(CsEventPO::getAmplitude,param.getFeatureAmplitudeMin());
}
if (!Objects.isNull(param.getFeatureAmplitudeMax())) {
lambdaQueryWrapper.lt(CsEventPO::getAmplitude,param.getFeatureAmplitudeMax());
}
if (!Objects.isNull(param.getSeverityMin())) {
lambdaQueryWrapper.gt(CsEventPO::getSeverity,param.getSeverityMin());
}
if (!Objects.isNull(param.getSeverityMax())) {
lambdaQueryWrapper.lt(CsEventPO::getSeverity,param.getSeverityMax());
}
if (CollUtil.isNotEmpty(param.getTarget())) {
List<String> tag = DataChangeUtil.getTag(param.getTarget());
lambdaQueryWrapper.in(CsEventPO::getTag,tag);
}
if (!Objects.isNull(param.getFileFlag()) && param.getFileFlag() == 0) {
lambdaQueryWrapper.isNull(CsEventPO::getWavePath);
} else if (!Objects.isNull(param.getFileFlag()) && param.getFileFlag() == 1) {
lambdaQueryWrapper.isNotNull(CsEventPO::getWavePath);
}
lambdaQueryWrapper.eq(CsEventPO::getLineId,lineId)
.eq(CsEventPO::getType,0).between(CsEventPO::getStartTime,startDate,endDate)
.orderByDesc(CsEventPO::getStartTime);
@@ -397,6 +453,12 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
eventPo.setPhase(param.getPhase());
String dropZone = eventAnalysisService.determineDropZone(String.valueOf(param.getAmplitude() * 100),String.valueOf(param.getDuration()));
eventPo.setLandPoint(dropZone);
if (param.getEventType() == 1) {
if (!Objects.isNull(param.getDuration()) && !Objects.isNull(param.getAmplitude())) {
eventPo.setSeverity(Double.valueOf(getYzd(param.getDuration()*1000,param.getAmplitude())));
}
}
this.baseMapper.insert(eventPo);
//influxDB数据录入
List<String> records = new ArrayList<String>();
@@ -414,7 +476,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
}
//同步数据到 r_mp_event_detail
insertEvent(uuid, param, time);
insertEvent(uuid, param, time, eventPo.getSeverity());
//获取台账信息
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getDeviceId()).getData();
@@ -507,7 +569,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
return result;
}
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time) {
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time, Double severity) {
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
rmpEventDetailPO.setEventId(uuid);
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
@@ -519,6 +581,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
rmpEventDetailPO.setPhase(param.getPhase());
rmpEventDetailPO.setDealFlag(0);
rmpEventDetailPO.setFileFlag(0);
rmpEventDetailPO.setSeverity(severity);
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
}
@@ -588,6 +651,29 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
return this.list(wrapper);
}
/**
* 获取该事件的严重度
*
* @param persisttime 持续时间 ms单位
* @param eventvaule 暂降、暂升幅值
*/
public static String getYzd(Float persisttime, Float eventvaule) {
float yzd;
DecimalFormat df = new DecimalFormat("0.000");// 格式化小数
if (persisttime <= 20) {
yzd = 1 - eventvaule;
} else if (persisttime > 20 && persisttime <= 200) {
yzd = 2 * (1 - eventvaule);
} else if (persisttime > 200 && persisttime <= 500) {
yzd = 3.3f * (1 - eventvaule);
} else if (persisttime > 500 && persisttime <= 10000) {
yzd = 5 * (1 - eventvaule);
} else {
yzd = 10 * (1 - eventvaule);
}
return df.format(yzd);
}
public String getTag(Integer type) {
String tag;
switch (type) {

View File

@@ -10,11 +10,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.constant.LogInfo;
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.api.NodeFeignClient;
import com.njcn.csdevice.api.*;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.pojo.dto.CsLineDTO;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.po.Node;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
@@ -29,6 +27,7 @@ import com.njcn.csharmonic.pojo.po.CsEventUserPO;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
import com.njcn.csharmonic.service.CsEventUserPOService;
import com.njcn.csharmonic.utils.DataChangeUtil;
import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.service.EvtDataService;
import com.njcn.system.api.DicDataFeignClient;
@@ -46,8 +45,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -74,6 +71,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
private final NodeFeignClient nodeFeignClient;
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
private final CsLineFeignClient csLineFeignClient;
@Override
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
@@ -439,6 +437,17 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
}
//获取tag
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
if (CollUtil.isNotEmpty(csEventUserQueryPage.getTarget())) {
List<String> tag = DataChangeUtil.getTag(csEventUserQueryPage.getTarget());
csEventUserQueryPage.setTarget(tag);
}
}
//获取监测点电压等级
List<CsLineDTO> list = csLineFeignClient.getAllLineDetail().getData();
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
returnpage.getRecords().forEach(temp->{
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
@@ -447,6 +456,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
temp.setProjectName(devDetail.getProjectName());
temp.setEngineeringid(devDetail.getEngineeringid());
temp.setEngineeringName(devDetail.getEngineeringName());
if (ObjectUtil.isNotNull(temp.getLineId())) {
temp.setLineVoltage(map.get(temp.getLineId()).getVolGrade());
}
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
if (Objects.isNull(ele)) {
temp.setShowName(temp.getTag());

View File

@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
@@ -42,8 +44,8 @@ import java.util.stream.Collectors;
public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMapper, PqSensitiveUser> implements IPqSensitiveUserService {
private final CsLineFeignClient csLineFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final EquipmentFeignClient equipmentFeignClient;
@Override
public Page<PqSensitiveUserVo> getList(BaseParam param) {
@@ -146,6 +148,32 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
return this.updateById(pqSensitiveUser);
}
@Override
public Map<String, List<CsEquipmentDeliveryPO>> getUserDevTree(String type) {
Map<String, List<CsEquipmentDeliveryPO>> map = new HashMap<>();
List<PqSensitiveUser> list = this.list();
if (CollUtil.isNotEmpty(list)) {
List<CsEquipmentDeliveryPO> devList = equipmentFeignClient.getAll().getData();
Map<String,List<CsEquipmentDeliveryPO>> devMap = new HashMap<>();
if (CollUtil.isNotEmpty(devList)) {
String governType = Objects.equals(type, "apf") ? "harmonic" : "event";
devMap = devList.stream()
.filter(po -> po.getMonitorUser() != null && Objects.equals(po.getGovernType(), governType))
.sorted(Comparator.comparing(CsEquipmentDeliveryPO::getSort))
.collect(Collectors.groupingBy(
CsEquipmentDeliveryPO::getMonitorUser,
LinkedHashMap::new,
Collectors.toList()
));
}
Map<String, List<CsEquipmentDeliveryPO>> finalDevMap = devMap;
list.forEach(item->{
map.put(item.getName(), finalDevMap.get(item.getId()));
});
}
return map;
}
private void checkParam(PqSensitiveUserParam param,boolean update){
DictData data = dicDataFeignClient.getDicDataById(param.getLoadType()).getData();

View File

@@ -40,7 +40,7 @@ public class RealDataServiceImpl implements RealDataService {
private final MqttUtil mqttUtil;
private final DictTreeFeignClient dictTreeFeignClient;
@Override
// @Override
public boolean getBaseRealData(String lineId) {
boolean result = true;
try {
@@ -74,21 +74,26 @@ public class RealDataServiceImpl implements RealDataService {
redisUtil.saveByKeyWithExpire("rtDataUserId:"+lineId, RequestUtil.getUserIndex(),600L);
}
//等待装置响应,获取询问结果
Thread.sleep(5000);
Object object;
if (Objects.equals(DicDataEnum.DEV_CLD.getCode(),devModelCode) && Objects.equals(dev.getDevAccessMethod(),"CLD")) {
object = redisUtil.getObjectByKey("devResponse:" + lineId);
} else {
object = redisUtil.getObjectByKey("devResponse");
}
if (Objects.isNull(object)) {
result = false;
//throw new BusinessException("数据获取失败,设备无响应");
} else {
int code = (Integer) object;
if (code != 200) {
for (int i = 0; i < 5; i++) {
Thread.sleep(1000);
Object object;
if (Objects.equals(DicDataEnum.DEV_CLD.getCode(),devModelCode) && Objects.equals(dev.getDevAccessMethod(),"CLD")) {
object = redisUtil.getObjectByKey("devResponse:" + lineId);
} else {
object = redisUtil.getObjectByKey("devResponse");
}
if (Objects.isNull(object)) {
result = false;
//throw new BusinessException("数据获取失败,设备无响应");
} else {
int code = (Integer) object;
if (code != 200) {
result = false;
//throw new BusinessException("数据获取失败,设备无响应");
} else {
result = true;
break;
}
}
}
} catch (Exception e) {

View File

@@ -244,27 +244,17 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam) {
List<ThdDataVO> result = new ArrayList();
Optional.ofNullable(commonStatisticalQueryParam.getDevId()).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DEVICE_LOSE));
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(commonStatisticalQueryParam.getDevId()).getData();
if(CollectionUtil.isEmpty(csLinePOList)){
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<CsLinePO> csLinePOList1 = csLinePOList.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(commonStatisticalQueryParam.getStatisticalId())).getData();
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
if(CollectionUtil.isNotEmpty(data)){
List<CsLinePO> finalCsLinePOList = csLinePOList;
data.forEach(epdPqd->{
@@ -295,7 +285,6 @@ public class StableDataServiceImpl implements StableDataService {
}).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId());
@@ -314,8 +303,6 @@ public class StableDataServiceImpl implements StableDataService {
result.addAll(collect1);
});
}
return result;
}

View File

@@ -43,7 +43,7 @@ spring:
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
root: warn
#mybatis配置信息

View File

@@ -39,7 +39,7 @@ spring:
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
root: warn
#mybatis配置信息

View File

@@ -39,7 +39,7 @@ spring:
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
root: warn
#mybatis配置信息