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 IMqttUserService mqttUserService;
|
||||
private final CsCommTerminalFeignClient commTerminalService;
|
||||
private final AppProjectService appProjectService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -272,9 +273,15 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
break;
|
||||
}
|
||||
}
|
||||
//获取项目数量
|
||||
if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
||||
vo.setCurrentProjectCount(currentProjectIds.size());
|
||||
//获取项目数量 这边可能项目下没有挂载设备,这边项目数量直接从接口获取
|
||||
// if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
||||
// 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)) {
|
||||
|
||||
@@ -300,7 +300,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> portables = ledger.stream()
|
||||
.peek(c -> {
|
||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||
c.setPid(portable.getId());
|
||||
c.setPid("2");
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
@@ -365,13 +365,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
portable1.setId("1");
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setPid("1");
|
||||
portable2.setId("2");
|
||||
portable2.setChildren(portables);
|
||||
|
||||
portable1.setChildren(Collections.singletonList(portable2));
|
||||
@@ -719,7 +719,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> portables = ledger.stream()
|
||||
.peek(c -> {
|
||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||
c.setPid(portable.getId());
|
||||
c.setPid("2");
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
@@ -776,18 +776,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
portable1.setId("1");
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setPid("1");
|
||||
portable2.setId("2");
|
||||
portable2.setChildren(portables);
|
||||
|
||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||
|
||||
@@ -628,6 +628,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
} else {
|
||||
rmpEventDetailPo.setDealFlag(0);
|
||||
}
|
||||
if (!Objects.isNull(item.getSagSource())) {
|
||||
rmpEventDetailPo.setSagsource(item.getSagSource());
|
||||
}
|
||||
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -81,4 +82,6 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
||||
|
||||
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
||||
private Integer isDvr;
|
||||
|
||||
private List<String> epdTagList;
|
||||
}
|
||||
@@ -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> 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);
|
||||
|
||||
|
||||
@@ -224,12 +224,24 @@
|
||||
AND b.severity < #{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},'%')
|
||||
AND (
|
||||
<!-- 名称匹配(根据type区分线路名/设备名) -->
|
||||
<choose>
|
||||
<when test="csEventUserQueryPage.type != null and csEventUserQueryPage.type == 3">
|
||||
(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 test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
||||
@@ -255,6 +267,12 @@
|
||||
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</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 == 3 ">
|
||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||
@@ -320,7 +338,8 @@
|
||||
</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},'%')
|
||||
-- AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||
AND (e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
|
||||
</if>
|
||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
||||
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 i1 = 0; i1 < param.getDevList().size(); i1++) {
|
||||
if (Objects.equals(devIds[i], param.getDevList().get(i1))) {
|
||||
|
||||
CsLedgerVO csLedgerVO = ledgerMap.get(devIds[i]);
|
||||
|
||||
AlarmVO.AlarmDetail alarmDetail = new AlarmVO.AlarmDetail();
|
||||
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建默认的告警数据详情
|
||||
* @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);
|
||||
}
|
||||
//同步数据到 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();
|
||||
@@ -577,7 +577,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
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.setEventId(uuid);
|
||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||
@@ -590,6 +590,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
rmpEventDetailPO.setDealFlag(0);
|
||||
rmpEventDetailPO.setFileFlag(0);
|
||||
rmpEventDetailPO.setSeverity(severity);
|
||||
rmpEventDetailPO.setSagsource(sagSource);
|
||||
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -414,11 +415,16 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
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());
|
||||
//便携式就1层下边就是设备 这边给便携式设备添加了假的工程和项目,id是写死的
|
||||
List<String> portableDevIds = new ArrayList<>();
|
||||
if (Objects.equals(csEventUserQueryPage.getEngineeringid(),"1")
|
||||
|| Objects.equals(csEventUserQueryPage.getProjectId(),"2")
|
||||
|| (!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())||
|
||||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||
@@ -453,6 +459,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
if (CollectionUtils.isEmpty(devIds)){
|
||||
return returnpage;
|
||||
}
|
||||
if (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|
||||
lineIds.add(csEventUserQueryPage.getLineId());
|
||||
}
|
||||
}
|
||||
//获取tag
|
||||
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
||||
@@ -461,13 +470,24 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
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();
|
||||
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
||||
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
||||
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
||||
} else {
|
||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds,lineIds);
|
||||
}
|
||||
returnpage.getRecords().forEach(temp->{
|
||||
CsLineDTO dto = map.get(temp.getLineId());
|
||||
@@ -559,65 +579,172 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
@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());
|
||||
// 1. 获取全量节点并构建映射(始终保留全量map用于后续VO转换)
|
||||
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||
if (CollectionUtil.isEmpty(nodeList)) {
|
||||
return result;
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||
List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
||||
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<>();
|
||||
queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
||||
.between(CsEventPO::getStartTime,
|
||||
// 搜索条件下 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));
|
||||
}
|
||||
} else {
|
||||
// 无搜索词:正常按全部节点查询
|
||||
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds);
|
||||
}
|
||||
// 时间范围 & 类型固定条件
|
||||
queryWrapper.between(CsEventPO::getStartTime,
|
||||
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||
.eq(CsEventPO::getType, 4)
|
||||
.orderByDesc(CsEventPO::getStartTime);
|
||||
if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
|
||||
// 等级筛选
|
||||
if (StrUtil.isNotBlank(baseParam.getLevel())) {
|
||||
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(levelList)) {
|
||||
queryWrapper.in(CsEventPO::getLevel, levelList);
|
||||
}
|
||||
page = csEventPOMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 执行分页查询
|
||||
Page<CsEventPO> page = csEventPOMapper.selectPage(
|
||||
new Page<>(baseParam.getPageNum(), baseParam.getPageSize()), queryWrapper);
|
||||
// 7. 结果转换
|
||||
List<CsEventPO> records = page.getRecords();
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
List<FrontWarnVo> frontWarnVos = new ArrayList<>();
|
||||
Map<String, Node> finalNodeMap = nodeMap;
|
||||
page.getRecords().forEach(item->{
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return result;
|
||||
}
|
||||
List<FrontWarnVo> frontWarnVos = records.stream().map(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) {
|
||||
// 填充节点信息(使用全量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 (item.getLevel() == 6) {
|
||||
} else if (level == 6) {
|
||||
item.setLevel(2);
|
||||
} else if (item.getLevel() == 7) {
|
||||
} else if (level == 7) {
|
||||
item.setLevel(1);
|
||||
}
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
frontWarnVos.add(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;
|
||||
}
|
||||
|
||||
// @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
|
||||
public List<CsEventUserPO> queryEventListByUserId(String userIndex, List<String> eventList) {
|
||||
LambdaQueryWrapper<CsEventUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -1757,7 +1757,7 @@ public class DataServiceImpl implements IDataService {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
result.sort(Comparator.comparing(AppLineDetailVo::getProjectName)
|
||||
.thenComparing(AppLineDetailVo::getDeviceName)
|
||||
.thenComparing(AppLineDetailVo::getPointId));
|
||||
.thenComparing(AppLineDetailVo::getPointName));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -2042,7 +2042,7 @@ public class DataServiceImpl implements IDataService {
|
||||
children2.sort(Comparator.comparingInt(AppLineDetailVo.targetDetail::getSort));
|
||||
children2.forEach(item2->{
|
||||
if (Objects.isNull(item2.getData())) {
|
||||
item2.setData(3.15159);
|
||||
item2.setData(3.14159);
|
||||
}
|
||||
if (!Objects.equals(item2.getData(),NULL_DATA)) {
|
||||
item2.setData(BigDecimal.valueOf(item2.getData()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
Reference in New Issue
Block a user