feat(event): 添加监测点状态显示和DVR治理效果查询功能

- 在AppLineDetailVo中新增runStatus字段用于显示监测点通讯状态
- 新增queryEventPageWebDvr方法支持DVR治理效果事件查询
- 添加PqGovernPlanFeignClient依赖注入用于获取治理方案数据
- 修改queryEventPageWeb方法支持根据isDvr参数判断查询方式
- 在CsEventUserQueryPage中新增isDvr字段标识是否为DVR治理效果
- 修复CT/PT变比计算中的空指针异常问题
- 更新PqGovernPlanController接口描述为根据监测点查询方案数据
- 移除StableDataServiceImpl中的注释代码
This commit is contained in:
xy
2026-06-23 18:39:30 +08:00
parent 57d5b159ef
commit 6f66e1d336
8 changed files with 184 additions and 98 deletions

View File

@@ -78,4 +78,7 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
@ApiModelProperty(value = "排序字段 0:发生时间 1:幅值 2:持续时间")
private Integer sortField;
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
private Integer isDvr;
}

View File

@@ -28,6 +28,9 @@ public class AppLineDetailVo implements Serializable {
@ApiModelProperty("监测点id")
private String pointId;
@ApiModelProperty("监测点通讯状态 1:离线 2:在线")
private Integer runStatus;
@ApiModelProperty("数据时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Instant dataTime;

View File

@@ -105,7 +105,7 @@ public class PqGovernPlanController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getListByMonitorPoint")
@ApiOperation("清空治理前后监测点数据")
@ApiOperation("根据监测点查询方案数据")
@ApiImplicitParam(name = "ids", value = "监测点id集合", required = true)
public HttpResult<List<PqGovernPlan>> getListByMonitorPoint(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("clearGovernPoints");

View File

@@ -38,6 +38,8 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
//查询暂态事件(未读)
List<String> queryTempEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);

View File

@@ -283,6 +283,101 @@
order by b.start_time desc
</select>
<select id="queryEventPageWebDvr" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
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,
CASE
WHEN b.level = 4 THEN 3
WHEN b.level = 5 THEN 3
WHEN b.level = 6 THEN 2
WHEN b.level = 7 THEN 1
ELSE b.level
END AS level,
b.location location,b.cl_did clDid
,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 !=''">
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
</if>
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
</if>
</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>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">
AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryPage.startTime})
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
and b.tag in
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and b.line_id in
<foreach collection="lineIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
AND b.type =#{ csEventUserQueryPage.type} and b.level in (1,2,3,6,7)
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
AND b.type =#{ csEventUserQueryPage.type}
</if>
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 1 ">
AND b.level IN (1,7)
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 2 ">
AND b.level IN (2,6)
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 3 ">
AND b.level IN (3)
</if>
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
AND b.tag = #{csEventUserQueryPage.eventType}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.location != null and csEventUserQueryPage.location !=''">
AND b.location = #{csEventUserQueryPage.location}
</if>
order by b.start_time desc
</select>
<select id="queryTempEvent" resultType="java.lang.String">
SELECT
t1.event_id

View File

@@ -16,6 +16,7 @@ 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;
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
import com.njcn.csharmonic.mapper.CsEventPOMapper;
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
import com.njcn.csharmonic.param.CldWarnParam;
@@ -24,6 +25,7 @@ import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.dto.UnReadEventDto;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
import com.njcn.csharmonic.service.CsEventUserPOService;
@@ -72,6 +74,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
private final CsLineFeignClient csLineFeignClient;
private final PqGovernPlanFeignClient pqGovernPlanClient;
@Override
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
@@ -379,63 +382,76 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
@Override
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
List<String> devIds = new ArrayList<>();
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
Objects.equals(temp.getName(), csEventUserQueryPage.getDeviceTypeName())).collect(Collectors.toList());
//便携式设备和治理设备拆分
List<CsLedgerVO> portableDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.portableDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(portableDevTree)){
portableDevTree = portableDevTree.get(0).getChildren();
}
List<CsLedgerVO> governmentDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.governmentDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(governmentDevTree)){
governmentDevTree = governmentDevTree.get(0).getChildren();
}
List<CsLedgerVO> cldDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.cldDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(cldDevTree)){
cldDevTree = cldDevTree.get(0).getChildren();
}
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
List<String> cldDevIds = cldDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
devIds.addAll(cldDevIds);
List<String> lineIds = new ArrayList<>();
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
PqGovernPlan plan = pqGovernPlanClient.getById(csEventUserQueryPage.getDeviceId()).getData();
if (Objects.isNull(plan)) {
return returnpage;
}
String beforeId = plan.getGovernBefore();
String afterId = plan.getGovernAfter();
lineIds = Arrays.asList(beforeId, afterId);
if (CollectionUtil.isEmpty(lineIds)) {
return returnpage;
}
} else {
devIds.add(csEventUserQueryPage.getDeviceId());
}
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
Objects.equals(temp.getName(), csEventUserQueryPage.getDeviceTypeName())).collect(Collectors.toList());
//便携式设备和治理设备拆分
List<CsLedgerVO> portableDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.portableDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(portableDevTree)){
portableDevTree = portableDevTree.get(0).getChildren();
}
List<CsLedgerVO> governmentDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.governmentDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(governmentDevTree)){
governmentDevTree = governmentDevTree.get(0).getChildren();
}
List<CsLedgerVO> cldDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.cldDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(cldDevTree)){
cldDevTree = cldDevTree.get(0).getChildren();
}
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
List<String> cldDevIds = cldDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
devIds.addAll(cldDevIds);
} else {
devIds.add(csEventUserQueryPage.getDeviceId());
}
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
}
}
//获取tag
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
@@ -444,11 +460,14 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
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);
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
} else {
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
}
returnpage.getRecords().forEach(temp->{
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
temp.setEquipmentName(devDetail.getEquipmentName());

View File

@@ -142,8 +142,8 @@ public class DataServiceImpl implements IDataService {
List<ApfData> data14 = new ArrayList<>();
List<CsLinePO> linePo = csLineFeignClient.queryLineById(Collections.singletonList(param.getLineId())).getData();
Double ct = linePo.get(0).getCtRatio() / (Objects.isNull(linePo.get(0).getCt2Ratio())?1.0:linePo.get(0).getCt2Ratio());
Double pt = linePo.get(0).getPtRatio() / (Objects.isNull(linePo.get(0).getPt2Ratio())?1.0:linePo.get(0).getPt2Ratio());
Double ct = Objects.isNull(linePo.get(0).getCtRatio())?1.0:linePo.get(0).getCtRatio() / (Objects.isNull(linePo.get(0).getCt2Ratio())?1.0:linePo.get(0).getCt2Ratio());
Double pt = Objects.isNull(linePo.get(0).getPtRatio())?1.0:linePo.get(0).getPtRatio() / (Objects.isNull(linePo.get(0).getPt2Ratio())?1.0:linePo.get(0).getPt2Ratio());
Map<String,CsLinePO> lineMap = linePo.stream().collect(Collectors.toMap(CsLinePO::getLineId, item->item));
//拆分治理监测点 、 监测监测点
List<CsLinePO> line1 = linePo.stream().filter(item->item.getClDid()==0).collect(Collectors.toList());
@@ -1488,6 +1488,7 @@ public class DataServiceImpl implements IDataService {
if (item2.getLineList() != null && item2.getLineList().contains(item.getLineId())) {
vo.setProjectName(item2.getProjectName());
vo.setDeviceName(item2.getEquipmentName());
vo.setRunStatus(item.getRunStatus());
break;
}
}
@@ -1720,8 +1721,8 @@ public class DataServiceImpl implements IDataService {
targetDetail.setData(Math.round(targetDetail.getData() * 100.0) / 100.0);
}
} else if (Objects.equals(dataLevel, "Secondary")) {
Double ct = item.getCtRatio() / (Objects.isNull(item.getCt2Ratio())?1.0:item.getCt2Ratio());
Double pt = item.getPtRatio() / (Objects.isNull(item.getPt2Ratio())?1.0:item.getPt2Ratio());
Double ct = Objects.isNull(item.getCtRatio())?1.0:item.getCtRatio() / (Objects.isNull(item.getCt2Ratio())?1.0:item.getCt2Ratio());
Double pt = Objects.isNull(item.getPtRatio())?1.0:item.getPtRatio() / (Objects.isNull(item.getPt2Ratio())?1.0:item.getPt2Ratio());
String formula = targetDetail.getPrimaryFormula();
if (formula == null) {
targetDetail.setData(Math.round(targetDetail.getData() * 100.0) / 100.0);

View File

@@ -330,43 +330,6 @@ public class StableDataServiceImpl implements StableDataService {
}).collect(Collectors.toList());
result.addAll(collect2);
}
// map.forEach((key, value) -> {
// if (!Objects.isNull(loadSideLine) && Objects.equals(key, loadSideLine.getLineId())) {
// List<ThdDataVO> collect1 = value.stream().map(temp -> {
// ThdDataVO vo = new ThdDataVO();
// vo.setLineId(temp.getLineId());
// vo.setPhase(temp.getPhaseType());
// vo.setPosition(loadSideLine.getPosition());
// vo.setTime(temp.getTime());
// vo.setStatMethod(temp.getValueType());
// vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
// vo.setStatisticalIndex(epdPqd.getId());
// vo.setUnit(epdPqd.getUnit());
// vo.setStatisticalName(epdPqd.getName());
// vo.setAnotherName("治理前");
// return vo;
// }).collect(Collectors.toList());
// result.addAll(collect1);
// }
// if (!Objects.isNull(gridSideLine) && Objects.equals(key, gridSideLine.getLineId())) {
// List<ThdDataVO> collect1 = value.stream().map(temp -> {
// ThdDataVO vo = new ThdDataVO();
// vo.setLineId(temp.getLineId());
// vo.setPhase(temp.getPhaseType());
// vo.setPosition(gridSideLine.getPosition());
// vo.setTime(temp.getTime());
// vo.setStatMethod(temp.getValueType());
// vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
// vo.setStatisticalIndex(epdPqd.getId());
// vo.setUnit(epdPqd.getUnit());
// vo.setStatisticalName(epdPqd.getName());
// vo.setAnotherName("治理后");
// return vo;
// }).collect(Collectors.toList());
// result.addAll(collect1);
// }
// });
}
});
}