feat(event): 添加暂态事件数据分析功能并优化数据集排序
- 在CsEventPO中新增暂态事件相关字段:暂态事件落点、暂降源关系、瞬态有效值和电压变化 - 扩展DataGroupEventVO和EventDetailVO以支持事件落点、暂降原因、暂降类型等新属性 - 重构CsEquipmentDeliveryServiceImpl中的数据集添加逻辑,实现按序号排序的数据集管理 - 更新设备数据集结构,将原有数据类型调整为实时、历史、暂态、运行等分类 - 修改CsUpgradeLogsController将GET请求改为POST请求以支持请求体参数 - 在LineTargetServiceImpl中修复数据类型转换问题,确保toUpperCase调用正确 - 优化统计数据显示逻辑,在StatisticsDataDataServiceImpl中修复完整性计算公式 - 为EleEpdPqdMapper添加数据源注解以支持多数据库操作
This commit is contained in:
@@ -70,4 +70,16 @@ public class DataGroupEventVO {
|
|||||||
@ApiModelProperty("波形路径")
|
@ApiModelProperty("波形路径")
|
||||||
private String wavePath;
|
private String wavePath;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件落点")
|
||||||
|
private String landPoint;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降原因")
|
||||||
|
private String advanceReason;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降类型")
|
||||||
|
private String advanceType;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
|
||||||
|
private String sagSource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@ public class DeviceManagerVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -45,7 +48,7 @@ public class CsUpgradeLogsController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
@GetMapping("/getByDevId")
|
@PostMapping("/getByDevId")
|
||||||
@ApiOperation("查询指定devId的所有升级日志")
|
@ApiOperation("查询指定devId的所有升级日志")
|
||||||
@ApiImplicitParam(name = "devId", value = "装置Id", required = true)
|
@ApiImplicitParam(name = "devId", value = "装置Id", required = true)
|
||||||
public HttpResult<List<CsUpgradeLogs>> getByDevId(@RequestBody String devId) {
|
public HttpResult<List<CsUpgradeLogs>> getByDevId(@RequestBody String devId) {
|
||||||
|
|||||||
@@ -511,6 +511,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSetVO.setName(item.getAnotherName());
|
dataSetVO.setName(item.getAnotherName());
|
||||||
dataSetVO.setType("rt");
|
dataSetVO.setType("rt");
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
|
dataSetVO.setSort(item.getIdx());
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -518,33 +519,39 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||||
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
||||||
|
|
||||||
addDataSet(dataSetList, item, "最新数据", "rt");
|
addDataSet(dataSetList, item, "最新数据", "rt",0);
|
||||||
addDataSet(dataSetList, item, "历史统计数据", "history");
|
|
||||||
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
|
||||||
if (item.getClDev() == 0 && item.getType() == 0) {
|
if (item.getClDev() == 0 && item.getType() == 0) {
|
||||||
//限制角色展示
|
//限制角色展示
|
||||||
String role = RequestUtil.getUserRole();
|
String role = RequestUtil.getUserRole();
|
||||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||||
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode()) || strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || strings.contains(AppRoleEnum.ROOT.getCode())) {
|
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode()) || strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || strings.contains(AppRoleEnum.ROOT.getCode())) {
|
||||||
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
addDataSet(dataSetList, item, "模块数据", "moduleData",3);
|
||||||
}
|
}
|
||||||
|
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||||
|
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||||
|
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||||
} else {
|
} else {
|
||||||
addDataSet(dataSetList, item, "电度数据", "kilowattHour");
|
addDataSet(dataSetList, item, "实时数据", "realtimedata",1);
|
||||||
|
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||||
|
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||||
|
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||||
|
addDataSet(dataSetList, item, "电度数据", "kilowattHour",6);
|
||||||
}
|
}
|
||||||
if (isPortableDevice) {
|
if (isPortableDevice) {
|
||||||
// 便携式设备特有的数据集
|
// 便携式设备特有的数据集
|
||||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
addDataSet(dataSetList, item, "测试项数据", "items",7);
|
||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
|
||||||
addDataSet(dataSetList, item, "测试项日志", "items");
|
|
||||||
}
|
}
|
||||||
if (isCLdDevice) {
|
// if (isCLdDevice) {
|
||||||
// 云前置数据集
|
// // 云前置数据集
|
||||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
// addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
// addDataSet(dataSetList, item, "暂态数据", "event");
|
||||||
}
|
// }
|
||||||
addDataSet(dataSetList, item, "运行趋势", "devRunTrend");
|
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(dataSetList)) {
|
||||||
|
dataSetList.sort(Comparator.comparing(DeviceManagerVO.DataSetVO::getSort));
|
||||||
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||||
if (!csLinePOS.isEmpty()) {
|
if (!csLinePOS.isEmpty()) {
|
||||||
@@ -554,11 +561,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
|
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type, Integer sort) {
|
||||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
dataSetVO.setId(item.getId());
|
dataSetVO.setId(item.getId());
|
||||||
dataSetVO.setName(name);
|
dataSetVO.setName(name);
|
||||||
dataSetVO.setType(type);
|
dataSetVO.setType(type);
|
||||||
|
dataSetVO.setSort(sort);
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,27 @@ public class CsEventPO extends BaseEntity {
|
|||||||
@TableField(value = "advance_type")
|
@TableField(value = "advance_type")
|
||||||
private String advanceType;
|
private String advanceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂态事件落点(A区/B区/C区/D区;解析失败或未匹配返回 null)
|
||||||
|
*/
|
||||||
@TableField(value = "land_point")
|
@TableField(value = "land_point")
|
||||||
private String landPoint;
|
private String landPoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降源与监测位置关系 0-未知、1-上游、2-下游
|
||||||
|
*/
|
||||||
|
@TableField(value = "sag_source")
|
||||||
|
private String sagSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瞬态-有效值
|
||||||
|
*/
|
||||||
|
@TableField(value = "rms")
|
||||||
|
private Double rms;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瞬态-电压变化
|
||||||
|
*/
|
||||||
|
@TableField(value = "uchg")
|
||||||
|
private Double uchg;
|
||||||
}
|
}
|
||||||
@@ -139,4 +139,13 @@ public class EventDetailVO {
|
|||||||
@ApiModelProperty("事件落点")
|
@ApiModelProperty("事件落点")
|
||||||
private String landPoint;
|
private String landPoint;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降原因")
|
||||||
|
private String advanceReason;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降类型")
|
||||||
|
private String advanceType;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
|
||||||
|
private String sagSource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,10 @@
|
|||||||
b.LEVEL LEVEL,
|
b.LEVEL LEVEL,
|
||||||
b.location location,
|
b.location location,
|
||||||
c.dev_type devType,
|
c.dev_type devType,
|
||||||
b.land_point landPoint
|
b.land_point landPoint,
|
||||||
|
b.advance_reason advanceReason,
|
||||||
|
b.advance_type advanceType,
|
||||||
|
b.sag_source sagSource
|
||||||
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||||
,d.NAME lineName
|
,d.NAME lineName
|
||||||
</if>
|
</if>
|
||||||
@@ -240,7 +243,7 @@
|
|||||||
select DISTINCT b.id id,
|
select DISTINCT b.id id,
|
||||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
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
|
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
|
,d.name lineName,b.advance_reason advanceReason,b.advance_type advanceType,b.sag_source sagSource
|
||||||
from cs_event b
|
from cs_event b
|
||||||
left join cs_line d on d.line_id=b.line_id
|
left join cs_line d on d.line_id=b.line_id
|
||||||
where 1=1
|
where 1=1
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
|||||||
*/
|
*/
|
||||||
public CsRtDataVO getLineRtData(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target, String cldId) {
|
public CsRtDataVO getLineRtData(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target, String cldId) {
|
||||||
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
||||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType,cldId);
|
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType.toUpperCase(),cldId);
|
||||||
if(Objects.isNull(statisticalDataDTO)){
|
if(Objects.isNull(statisticalDataDTO)){
|
||||||
statisticalDataDTO = new StatisticalDataDTO();
|
statisticalDataDTO = new StatisticalDataDTO();
|
||||||
statisticalDataDTO.setLineId(lineId);
|
statisticalDataDTO.setLineId(lineId);
|
||||||
@@ -304,7 +304,7 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
|||||||
public CsRtDataVO getLineRtDataNew(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target,String uint) {
|
public CsRtDataVO getLineRtDataNew(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target,String uint) {
|
||||||
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
||||||
String clDid = influxDbParamUtil.getClDidByLineId(lineId);
|
String clDid = influxDbParamUtil.getClDidByLineId(lineId);
|
||||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType,clDid);
|
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType.toUpperCase(),clDid);
|
||||||
if(Objects.isNull(statisticalDataDTO)){
|
if(Objects.isNull(statisticalDataDTO)){
|
||||||
statisticalDataDTO = new StatisticalDataDTO();
|
statisticalDataDTO = new StatisticalDataDTO();
|
||||||
statisticalDataDTO.setLineId(lineId);
|
statisticalDataDTO.setLineId(lineId);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
|
|||||||
BigDecimal.valueOf(l1.stream().mapToDouble(RStatIntegrityD::getDueTime).sum()),
|
BigDecimal.valueOf(l1.stream().mapToDouble(RStatIntegrityD::getDueTime).sum()),
|
||||||
2, RoundingMode.HALF_UP
|
2, RoundingMode.HALF_UP
|
||||||
).doubleValue();
|
).doubleValue();
|
||||||
vo.setIntegrity(ratio);
|
vo.setIntegrity(Math.max(ratio,100.0));
|
||||||
} else {
|
} else {
|
||||||
vo.setIntegrity(0.0);
|
vo.setIntegrity(0.0);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
|
|||||||
if (CollectionUtil.isNotEmpty(l2)) {
|
if (CollectionUtil.isNotEmpty(l2)) {
|
||||||
int onlineMin = l2.stream().mapToInt(RStatOnlineRateD::getOnlineMin).sum();
|
int onlineMin = l2.stream().mapToInt(RStatOnlineRateD::getOnlineMin).sum();
|
||||||
double ratio = new BigDecimal(onlineMin * 100.0 / (1440 * l2.size())).setScale(2,RoundingMode.HALF_UP).doubleValue();
|
double ratio = new BigDecimal(onlineMin * 100.0 / (1440 * l2.size())).setScale(2,RoundingMode.HALF_UP).doubleValue();
|
||||||
vo.setOnlineRate(ratio);
|
vo.setOnlineRate(Math.max(ratio,100.0));
|
||||||
} else {
|
} else {
|
||||||
vo.setOnlineRate(0.0);
|
vo.setOnlineRate(0.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,13 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.csharmonic.service.event.CsEventMonitorReportService;
|
import com.njcn.csharmonic.service.event.CsEventMonitorReportService;
|
||||||
import com.njcn.echarts.util.DrawPicUtil;
|
|
||||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||||
import com.njcn.event.pojo.param.ExportParam;
|
import com.njcn.event.pojo.param.ExportParam;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@@ -43,6 +42,7 @@ public class CsEventMonitorReportServiceImpl implements CsEventMonitorReportServ
|
|||||||
LineDetailDataCommDTO lineDetailDataCommDTO = new LineDetailDataCommDTO();
|
LineDetailDataCommDTO lineDetailDataCommDTO = new LineDetailDataCommDTO();
|
||||||
LineDetailDataVO lineDetailDataVO = csLineFeignClient.getLineDetailData(exportParam.getLineId()).getData();
|
LineDetailDataVO lineDetailDataVO = csLineFeignClient.getLineDetailData(exportParam.getLineId()).getData();
|
||||||
BeanUtil.copyProperties(lineDetailDataVO,lineDetailDataCommDTO);
|
BeanUtil.copyProperties(lineDetailDataVO,lineDetailDataCommDTO);
|
||||||
|
lineDetailDataCommDTO.setIsDip(true);
|
||||||
monitorEventReportService.getLineExport(exportParam,lineDetailDataCommDTO, response);
|
monitorEventReportService.getLineExport(exportParam,lineDetailDataCommDTO, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.cssystem.mapper;
|
package com.njcn.cssystem.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
|||||||
* @author xuyang
|
* @author xuyang
|
||||||
* @since 2023-05-24
|
* @since 2023-05-24
|
||||||
*/
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
public interface EleEpdPqdMapper extends BaseMapper<EleEpdPqd> {
|
public interface EleEpdPqdMapper extends BaseMapper<EleEpdPqd> {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user