Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a07a0fe6ed | |||
| 4e7a10f46e | |||
| b265e95bdf | |||
| f185fa4706 |
@@ -60,6 +60,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsCommTerminalFeignClient commTerminalService;
|
private final CsCommTerminalFeignClient commTerminalService;
|
||||||
|
private final AppProjectService appProjectService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -272,9 +273,15 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取项目数量
|
//获取项目数量 这边可能项目下没有挂载设备,这边项目数量直接从接口获取
|
||||||
if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
// if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
||||||
vo.setCurrentProjectCount(currentProjectIds.size());
|
// vo.setCurrentProjectCount(currentProjectIds.size());
|
||||||
|
// }
|
||||||
|
List<AppProjectPO> projectInfoList = appProjectService.getProjectByEngineering(Collections.singletonList(id));
|
||||||
|
if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||||
|
vo.setCurrentProjectCount(projectInfoList.size());
|
||||||
|
} else {
|
||||||
|
vo.setCurrentProjectCount(0);
|
||||||
}
|
}
|
||||||
//获取设备总数、在线设备、离线设备
|
//获取设备总数、在线设备、离线设备
|
||||||
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> portables = ledger.stream()
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
.peek(c -> {
|
.peek(c -> {
|
||||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid("2");
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
@@ -365,13 +365,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
portable1.setName("便携式工程");
|
portable1.setName("便携式工程");
|
||||||
portable1.setPid("0");
|
portable1.setPid("0");
|
||||||
portable1.setId(id);
|
portable1.setId("1");
|
||||||
|
|
||||||
CsLedgerVO portable2 = new CsLedgerVO();
|
CsLedgerVO portable2 = new CsLedgerVO();
|
||||||
portable2.setLevel(1);
|
portable2.setLevel(1);
|
||||||
portable2.setName("便携式项目");
|
portable2.setName("便携式项目");
|
||||||
portable2.setPid(id);
|
portable2.setPid("1");
|
||||||
portable2.setId(IdUtil.simpleUUID());
|
portable2.setId("2");
|
||||||
portable2.setChildren(portables);
|
portable2.setChildren(portables);
|
||||||
|
|
||||||
portable1.setChildren(Collections.singletonList(portable2));
|
portable1.setChildren(Collections.singletonList(portable2));
|
||||||
@@ -719,7 +719,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> portables = ledger.stream()
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
.peek(c -> {
|
.peek(c -> {
|
||||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid("2");
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
@@ -776,18 +776,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(portables)) {
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
portable1.setName("便携式工程");
|
portable1.setName("便携式工程");
|
||||||
portable1.setPid("0");
|
portable1.setPid("0");
|
||||||
portable1.setId(id);
|
portable1.setId("1");
|
||||||
|
|
||||||
CsLedgerVO portable2 = new CsLedgerVO();
|
CsLedgerVO portable2 = new CsLedgerVO();
|
||||||
portable2.setLevel(1);
|
portable2.setLevel(1);
|
||||||
portable2.setName("便携式项目");
|
portable2.setName("便携式项目");
|
||||||
portable2.setPid(id);
|
portable2.setPid("1");
|
||||||
portable2.setId(IdUtil.simpleUUID());
|
portable2.setId("2");
|
||||||
portable2.setChildren(portables);
|
portable2.setChildren(portables);
|
||||||
|
|
||||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||||
|
|||||||
@@ -628,6 +628,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
} else {
|
} else {
|
||||||
rmpEventDetailPo.setDealFlag(0);
|
rmpEventDetailPo.setDealFlag(0);
|
||||||
}
|
}
|
||||||
|
if (!Objects.isNull(item.getSagSource())) {
|
||||||
|
rmpEventDetailPo.setSagsource(item.getSagSource());
|
||||||
|
}
|
||||||
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.hibernate.validator.constraints.Range;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -81,4 +82,6 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
|||||||
|
|
||||||
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
||||||
private Integer isDvr;
|
private Integer isDvr;
|
||||||
|
|
||||||
|
private List<String> epdTagList;
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ public class MqttMessageHandler {
|
|||||||
public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||||
List<CsRtDataVO> list = lineTargetService.getLineData(pageId);
|
List<CsRtDataVO> list = lineTargetService.getLineData(pageId);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
|
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1)
|
@MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
|
|||||||
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds);
|
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
|
||||||
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
|
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect,@Param("lineIds") List<String> collect2);
|
||||||
|
|
||||||
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
||||||
|
|
||||||
|
|||||||
@@ -223,13 +223,25 @@
|
|||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMax != null and csEventUserQueryPage.severityMax !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMax != null and csEventUserQueryPage.severityMax !=''">
|
||||||
AND b.severity < #{csEventUserQueryPage.severityMax}
|
AND b.severity < #{csEventUserQueryPage.severityMax}
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue != ''">
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
AND (
|
||||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
<!-- 名称匹配(根据type区分线路名/设备名) -->
|
||||||
</if>
|
<choose>
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
<when test="csEventUserQueryPage.type != null and csEventUserQueryPage.type == 3">
|
||||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
(e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
d.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%')
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<!-- OR tag匹配:当epdTagList不为空时,加入tag IN条件 -->
|
||||||
|
<if test="csEventUserQueryPage.epdTagList != null and csEventUserQueryPage.epdTagList.size() > 0">
|
||||||
|
OR b.tag IN
|
||||||
|
<foreach collection="csEventUserQueryPage.epdTagList" item="tagItem" open="(" separator="," close=")">
|
||||||
|
#{tagItem}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
||||||
@@ -255,6 +267,12 @@
|
|||||||
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="lineIds != null and lineIds.size() > 0">
|
||||||
|
AND b.line_id IN
|
||||||
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||||
@@ -320,7 +338,8 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
||||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
-- AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||||
|
AND (e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
||||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||||
|
|||||||
@@ -185,9 +185,7 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
for (int i = 0; i < devIds.length; i++) {
|
for (int i = 0; i < devIds.length; i++) {
|
||||||
for (int i1 = 0; i1 < param.getDevList().size(); i1++) {
|
for (int i1 = 0; i1 < param.getDevList().size(); i1++) {
|
||||||
if (Objects.equals(devIds[i], param.getDevList().get(i1))) {
|
if (Objects.equals(devIds[i], param.getDevList().get(i1))) {
|
||||||
|
|
||||||
CsLedgerVO csLedgerVO = ledgerMap.get(devIds[i]);
|
CsLedgerVO csLedgerVO = ledgerMap.get(devIds[i]);
|
||||||
|
|
||||||
AlarmVO.AlarmDetail alarmDetail = new AlarmVO.AlarmDetail();
|
AlarmVO.AlarmDetail alarmDetail = new AlarmVO.AlarmDetail();
|
||||||
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
||||||
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
||||||
@@ -243,6 +241,36 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//特殊处理,如果完整性和在线率没有告警,需要特殊处理下,模拟数据
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item->{
|
||||||
|
if (Objects.isNull(item.getDataDetails())) {
|
||||||
|
item.setDataDetails(buildDefaultAlarmData(item.getDevName()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建默认的告警数据详情
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @return 默认结构的 CsAlarmData
|
||||||
|
*/
|
||||||
|
private CsAlarmData buildDefaultAlarmData(String deviceId) {
|
||||||
|
CsAlarmData defaultData = new CsAlarmData();
|
||||||
|
defaultData.setDeviceId(deviceId);
|
||||||
|
// 构建 onlineRate 默认结构
|
||||||
|
CsAlarmData.OnlineRateAlarm onlineRate = new CsAlarmData.OnlineRateAlarm();
|
||||||
|
onlineRate.setValue(0.0);
|
||||||
|
onlineRate.setThreshold(0.0);
|
||||||
|
onlineRate.setIsAbnormal(false);
|
||||||
|
defaultData.setOnlineRate(onlineRate);
|
||||||
|
// 构建 integrity 默认结构
|
||||||
|
CsAlarmData.IntegrityAlarm integrity = new CsAlarmData.IntegrityAlarm();
|
||||||
|
integrity.setThreshold(0.0);
|
||||||
|
integrity.setMonitorPoints(new ArrayList<>());
|
||||||
|
defaultData.setIntegrity(integrity);
|
||||||
|
return defaultData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
||||||
}
|
}
|
||||||
//同步数据到 r_mp_event_detail
|
//同步数据到 r_mp_event_detail
|
||||||
insertEvent(uuid, param, time, eventPo.getSeverity());
|
insertEvent(uuid, param, time, eventPo.getSeverity(),eventPo.getSagSource());
|
||||||
|
|
||||||
//获取台账信息
|
//获取台账信息
|
||||||
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getDeviceId()).getData();
|
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getDeviceId()).getData();
|
||||||
@@ -577,7 +577,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time, Double severity) {
|
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time, Double severity, String sagSource) {
|
||||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||||
rmpEventDetailPO.setEventId(uuid);
|
rmpEventDetailPO.setEventId(uuid);
|
||||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||||
@@ -590,6 +590,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
rmpEventDetailPO.setDealFlag(0);
|
rmpEventDetailPO.setDealFlag(0);
|
||||||
rmpEventDetailPO.setFileFlag(0);
|
rmpEventDetailPO.setFileFlag(0);
|
||||||
rmpEventDetailPO.setSeverity(severity);
|
rmpEventDetailPO.setSeverity(severity);
|
||||||
|
rmpEventDetailPO.setSagsource(sagSource);
|
||||||
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
|
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -414,11 +415,16 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
cldDevTree = cldDevTree.get(0).getChildren();
|
cldDevTree = cldDevTree.get(0).getChildren();
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
|
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
|
||||||
//便携式就1层下边就是设备
|
//便携式就1层下边就是设备 这边给便携式设备添加了假的工程和项目,id是写死的
|
||||||
List<String> portableDevIds = portableDevTree.stream().filter(
|
List<String> portableDevIds = new ArrayList<>();
|
||||||
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
if (Objects.equals(csEventUserQueryPage.getEngineeringid(),"1")
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
|| Objects.equals(csEventUserQueryPage.getProjectId(),"2")
|
||||||
).map(CsLedgerVO::getId).collect(Collectors.toList());
|
|| (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId()))) {
|
||||||
|
portableDevIds = portableDevTree.stream().map(CsLedgerVO::getId).filter(
|
||||||
|
id -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
||||||
|
Objects.equals(id, csEventUserQueryPage.getDeviceId())
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||||
@@ -453,6 +459,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
if (CollectionUtils.isEmpty(devIds)){
|
if (CollectionUtils.isEmpty(devIds)){
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
if (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|
||||||
|
lineIds.add(csEventUserQueryPage.getLineId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//获取tag
|
//获取tag
|
||||||
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
||||||
@@ -461,13 +470,24 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
csEventUserQueryPage.setTarget(tag);
|
csEventUserQueryPage.setTarget(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取告警码
|
||||||
|
String searchValue = csEventUserQueryPage.getSearchValue();
|
||||||
|
if (StrUtil.isNotBlank(searchValue)) {
|
||||||
|
List<EleEpdPqd> epdList = epdFeignClient.findListByCode(searchValue).getData();
|
||||||
|
if (CollUtil.isNotEmpty(epdList)) {
|
||||||
|
List<String> epdTagList = epdList.stream()
|
||||||
|
.map(EleEpdPqd::getName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
csEventUserQueryPage.setEpdTagList(epdTagList);
|
||||||
|
}
|
||||||
|
}
|
||||||
//获取监测点电压等级
|
//获取监测点电压等级
|
||||||
List<CsLineDTO> list = csLineFeignClient.getAllLineDetail().getData();
|
List<CsLineDTO> list = csLineFeignClient.getAllLineDetail().getData();
|
||||||
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
||||||
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
||||||
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
||||||
} else {
|
} else {
|
||||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds,lineIds);
|
||||||
}
|
}
|
||||||
returnpage.getRecords().forEach(temp->{
|
returnpage.getRecords().forEach(temp->{
|
||||||
CsLineDTO dto = map.get(temp.getLineId());
|
CsLineDTO dto = map.get(temp.getLineId());
|
||||||
@@ -559,65 +579,172 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
@Override
|
@Override
|
||||||
public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
||||||
Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
|
||||||
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
|
||||||
Map<String, Node> nodeMap = new HashMap<>();
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(nodeList)) {
|
// 1. 获取全量节点并构建映射(始终保留全量map用于后续VO转换)
|
||||||
nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||||
if (ObjectUtil.isNotNull(baseParam.getSearchValue()) || StringUtil.isNotBlank(baseParam.getSearchValue())) {
|
if (CollectionUtil.isEmpty(nodeList)) {
|
||||||
nodeList = nodeList.stream().filter(item-> item.getName().contains(baseParam.getSearchValue()) || item.getIp().contains(baseParam.getSearchValue())).collect(Collectors.toList());
|
return result;
|
||||||
|
}
|
||||||
|
Map<String, Node> nodeMap = nodeList.stream()
|
||||||
|
.collect(Collectors.toMap(Node::getId, Function.identity(), (a, b) -> a));
|
||||||
|
|
||||||
|
// 2. 提取搜索关键词,避免重复调用getter
|
||||||
|
String searchValue = baseParam.getSearchValue();
|
||||||
|
boolean hasSearchValue = StrUtil.isNotBlank(searchValue);
|
||||||
|
// 3. 根据搜索词筛选出"名称/IP匹配"的节点ID(仅作为OR条件的一部分)
|
||||||
|
List<String> matchedNodeIds;
|
||||||
|
if (hasSearchValue) {
|
||||||
|
matchedNodeIds = nodeList.stream()
|
||||||
|
.filter(item -> item.getName().contains(searchValue)
|
||||||
|
|
||||||
|
|| item.getIp().contains(searchValue))
|
||||||
|
.map(Node::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
matchedNodeIds = Collections.emptyList();
|
||||||
|
}
|
||||||
|
// 4. 全量节点ID(用于限定查询总范围,防止code LIKE查到无关设备)
|
||||||
|
List<String> allNodeIds = nodeList.stream()
|
||||||
|
.map(Node::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 5. 构建查询条件
|
||||||
|
LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 搜索条件下 deviceId 与 code 改为 OR 关系
|
||||||
|
if (hasSearchValue) {
|
||||||
|
if (CollectionUtil.isNotEmpty(matchedNodeIds)) {
|
||||||
|
// 有匹配节点:(deviceId IN 匹配节点 OR code LIKE) AND deviceId IN 全部节点
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds)
|
||||||
|
.and(w -> w
|
||||||
|
.in(CsEventPO::getDeviceId, matchedNodeIds)
|
||||||
|
.or()
|
||||||
|
.like(CsEventPO::getCode, searchValue)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 无匹配节点:仅靠 code LIKE,但仍限定在全部节点范围内
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds)
|
||||||
|
.and(w -> w.like(CsEventPO::getCode, searchValue));
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(nodeList)) {
|
} else {
|
||||||
List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
// 无搜索词:正常按全部节点查询
|
||||||
LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds);
|
||||||
queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
}
|
||||||
.between(CsEventPO::getStartTime,
|
// 时间范围 & 类型固定条件
|
||||||
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
queryWrapper.between(CsEventPO::getStartTime,
|
||||||
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||||
.eq(CsEventPO::getType, 4)
|
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||||
.orderByDesc(CsEventPO::getStartTime);
|
.eq(CsEventPO::getType, 4)
|
||||||
if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
|
.orderByDesc(CsEventPO::getStartTime);
|
||||||
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
// 等级筛选
|
||||||
.map(String::trim)
|
if (StrUtil.isNotBlank(baseParam.getLevel())) {
|
||||||
.filter(s -> !s.isEmpty())
|
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
||||||
.map(Integer::parseInt)
|
.map(String::trim)
|
||||||
.collect(Collectors.toList());
|
.filter(s -> !s.isEmpty())
|
||||||
queryWrapper.in(CsEventPO::getLevel, levelList);
|
.map(Integer::parseInt)
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
page = csEventPOMapper.selectPage(page, queryWrapper);
|
if (CollectionUtil.isNotEmpty(levelList)) {
|
||||||
|
queryWrapper.in(CsEventPO::getLevel, levelList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 6. 执行分页查询
|
||||||
|
Page<CsEventPO> page = csEventPOMapper.selectPage(
|
||||||
|
new Page<>(baseParam.getPageNum(), baseParam.getPageSize()), queryWrapper);
|
||||||
|
// 7. 结果转换
|
||||||
List<CsEventPO> records = page.getRecords();
|
List<CsEventPO> records = page.getRecords();
|
||||||
if (CollUtil.isNotEmpty(records)) {
|
if (CollUtil.isEmpty(records)) {
|
||||||
List<FrontWarnVo> frontWarnVos = new ArrayList<>();
|
return result;
|
||||||
Map<String, Node> finalNodeMap = nodeMap;
|
|
||||||
page.getRecords().forEach(item->{
|
|
||||||
FrontWarnVo vo = new FrontWarnVo();
|
|
||||||
//这边将前置名称放进lineId字段;将前置IP放进wavePath字段;进程号使用clDid
|
|
||||||
Node node = finalNodeMap.get(item.getDeviceId());
|
|
||||||
item.setLineId(Objects.isNull(node) ? null : node.getName());
|
|
||||||
item.setWavePath(Objects.isNull(node) ? null : node.getIp());
|
|
||||||
//事件等级(1:Ⅰ级||ERROR 2:Ⅱ级||WARN 3:Ⅲ级||(DEBUG&&NORMAL))
|
|
||||||
if (item.getLevel() == 4 || item.getLevel() == 5) {
|
|
||||||
item.setLevel(3);
|
|
||||||
} else if (item.getLevel() == 6) {
|
|
||||||
item.setLevel(2);
|
|
||||||
} else if (item.getLevel() == 7) {
|
|
||||||
item.setLevel(1);
|
|
||||||
}
|
|
||||||
BeanUtils.copyProperties(item, vo);
|
|
||||||
frontWarnVos.add(vo);
|
|
||||||
});
|
|
||||||
result.setRecords(frontWarnVos);
|
|
||||||
result.setTotal(page.getTotal());
|
|
||||||
result.setPages(page.getPages());
|
|
||||||
result.setCurrent(page.getCurrent());
|
|
||||||
result.setSize(page.getSize());
|
|
||||||
}
|
}
|
||||||
|
List<FrontWarnVo> frontWarnVos = records.stream().map(item -> {
|
||||||
|
FrontWarnVo vo = new FrontWarnVo();
|
||||||
|
// 填充节点信息(使用全量nodeMap,而非过滤后的列表)
|
||||||
|
Node node = nodeMap.get(item.getDeviceId());
|
||||||
|
item.setLineId(node != null ? node.getName() : null);
|
||||||
|
item.setWavePath(node != null ? node.getIp() : null);
|
||||||
|
// 事件等级映射: 4,5→3(DEBUG/NORMAL) | 6→2(WARN) | 7→1(ERROR)
|
||||||
|
Integer level = item.getLevel();
|
||||||
|
if (level == 4 || level == 5) {
|
||||||
|
item.setLevel(3);
|
||||||
|
} else if (level == 6) {
|
||||||
|
item.setLevel(2);
|
||||||
|
} else if (level == 7) {
|
||||||
|
item.setLevel(1);
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
result.setRecords(frontWarnVos);
|
||||||
|
result.setTotal(page.getTotal());
|
||||||
|
result.setPages(page.getPages());
|
||||||
|
result.setCurrent(page.getCurrent());
|
||||||
|
result.setSize(page.getSize());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
||||||
|
// Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
|
// Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
|
// List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||||
|
// Map<String, Node> nodeMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
// nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
||||||
|
// if (ObjectUtil.isNotNull(baseParam.getSearchValue()) || StringUtil.isNotBlank(baseParam.getSearchValue())) {
|
||||||
|
// nodeList = nodeList.stream().filter(item-> item.getName().contains(baseParam.getSearchValue()) || item.getIp().contains(baseParam.getSearchValue())).collect(Collectors.toList());
|
||||||
|
// }
|
||||||
|
// if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
// List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
||||||
|
// LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
||||||
|
// .between(CsEventPO::getStartTime,
|
||||||
|
// DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||||
|
// DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||||
|
// .eq(CsEventPO::getType, 4)
|
||||||
|
// .like(StrUtil.isNotBlank(baseParam.getSearchValue()), CsEventPO::getCode, baseParam.getSearchValue())
|
||||||
|
// .orderByDesc(CsEventPO::getStartTime);
|
||||||
|
// if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
|
||||||
|
// List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
||||||
|
// .map(String::trim)
|
||||||
|
// .filter(s -> !s.isEmpty())
|
||||||
|
// .map(Integer::parseInt)
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// queryWrapper.in(CsEventPO::getLevel, levelList);
|
||||||
|
// }
|
||||||
|
// page = csEventPOMapper.selectPage(page, queryWrapper);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// List<CsEventPO> records = page.getRecords();
|
||||||
|
// if (CollUtil.isNotEmpty(records)) {
|
||||||
|
// List<FrontWarnVo> frontWarnVos = new ArrayList<>();
|
||||||
|
// Map<String, Node> finalNodeMap = nodeMap;
|
||||||
|
// page.getRecords().forEach(item->{
|
||||||
|
// FrontWarnVo vo = new FrontWarnVo();
|
||||||
|
// //这边将前置名称放进lineId字段;将前置IP放进wavePath字段;进程号使用clDid
|
||||||
|
// Node node = finalNodeMap.get(item.getDeviceId());
|
||||||
|
// item.setLineId(Objects.isNull(node) ? null : node.getName());
|
||||||
|
// item.setWavePath(Objects.isNull(node) ? null : node.getIp());
|
||||||
|
// //事件等级(1:Ⅰ级||ERROR 2:Ⅱ级||WARN 3:Ⅲ级||(DEBUG&&NORMAL))
|
||||||
|
// if (item.getLevel() == 4 || item.getLevel() == 5) {
|
||||||
|
// item.setLevel(3);
|
||||||
|
// } else if (item.getLevel() == 6) {
|
||||||
|
// item.setLevel(2);
|
||||||
|
// } else if (item.getLevel() == 7) {
|
||||||
|
// item.setLevel(1);
|
||||||
|
// }
|
||||||
|
// BeanUtils.copyProperties(item, vo);
|
||||||
|
// frontWarnVos.add(vo);
|
||||||
|
// });
|
||||||
|
// result.setRecords(frontWarnVos);
|
||||||
|
// result.setTotal(page.getTotal());
|
||||||
|
// result.setPages(page.getPages());
|
||||||
|
// result.setCurrent(page.getCurrent());
|
||||||
|
// result.setSize(page.getSize());
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEventUserPO> queryEventListByUserId(String userIndex, List<String> eventList) {
|
public List<CsEventUserPO> queryEventListByUserId(String userIndex, List<String> eventList) {
|
||||||
LambdaQueryWrapper<CsEventUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEventUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -1757,7 +1757,7 @@ public class DataServiceImpl implements IDataService {
|
|||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
result.sort(Comparator.comparing(AppLineDetailVo::getProjectName)
|
result.sort(Comparator.comparing(AppLineDetailVo::getProjectName)
|
||||||
.thenComparing(AppLineDetailVo::getDeviceName)
|
.thenComparing(AppLineDetailVo::getDeviceName)
|
||||||
.thenComparing(AppLineDetailVo::getPointId));
|
.thenComparing(AppLineDetailVo::getPointName));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2042,7 +2042,7 @@ public class DataServiceImpl implements IDataService {
|
|||||||
children2.sort(Comparator.comparingInt(AppLineDetailVo.targetDetail::getSort));
|
children2.sort(Comparator.comparingInt(AppLineDetailVo.targetDetail::getSort));
|
||||||
children2.forEach(item2->{
|
children2.forEach(item2->{
|
||||||
if (Objects.isNull(item2.getData())) {
|
if (Objects.isNull(item2.getData())) {
|
||||||
item2.setData(3.15159);
|
item2.setData(3.14159);
|
||||||
}
|
}
|
||||||
if (!Objects.equals(item2.getData(),NULL_DATA)) {
|
if (!Objects.equals(item2.getData(),NULL_DATA)) {
|
||||||
item2.setData(BigDecimal.valueOf(item2.getData()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
item2.setData(BigDecimal.valueOf(item2.getData()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||||
|
|||||||
Reference in New Issue
Block a user