初始版本提交

This commit is contained in:
hzj
2025-07-02 09:36:19 +08:00
parent 9c02a7cb8e
commit 3ecffc99b8
5 changed files with 42 additions and 14 deletions

View File

@@ -17,5 +17,6 @@ import java.util.List;
*/ */
public interface PqLineService extends IService<PqLine>{ public interface PqLineService extends IService<PqLine>{
List<LedgerBaseInfoDTO> queryListByIds(List<Integer> lineIds);
List<LedgerBaseInfoDTO> getBaseLineInfo(List<Integer> ids);
} }

View File

@@ -1,9 +1,12 @@
package com.njcn.gather.event.devcie.service.impl; package com.njcn.gather.event.devcie.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO; import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.devcie.mapper.PqLineMapper; import com.njcn.gather.event.devcie.mapper.PqLineMapper;
@@ -20,8 +23,21 @@ import com.njcn.gather.event.devcie.service.PqLineService;
@Service @Service
public class PqLineServiceImpl extends ServiceImpl<PqLineMapper, PqLine> implements PqLineService{ public class PqLineServiceImpl extends ServiceImpl<PqLineMapper, PqLine> implements PqLineService{
@Override @Override
public List<LedgerBaseInfoDTO> queryListByIds(List<Integer> lineIds) { public List<LedgerBaseInfoDTO> getBaseLineInfo(List<Integer> ids){
return this.baseMapper.getBaseLineInfo(lineIds); List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
} if(ids.size()>1000){
List<List<Integer>> listIds = CollUtil.split(ids,1000);
for(List<Integer> itemIds : listIds){
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLineInfo(itemIds);
ledgerBaseInfoDTOS.addAll(temp);
}
}else {
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLineInfo(ids);
ledgerBaseInfoDTOS.addAll(temp);
}
return ledgerBaseInfoDTOS;
};
} }

View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
@@ -96,5 +97,6 @@ public class PqsEventdetail {
@TableField(value = "NOTICE_FLAG") @TableField(value = "NOTICE_FLAG")
private Integer noticeFlag; private Integer noticeFlag;
@TableField(exist = false)
private Integer eventSeverity;
} }

View File

@@ -45,5 +45,7 @@ public class EventDetailVO {
private String objName; private String objName;
private Integer needDealFlag; private Integer needDealFlag;
private List<MsgEventInfo> msgEventInfoList; private long msgEventInfoSize;
//1告警2预警
private Integer eventSeverity;
} }

View File

@@ -138,7 +138,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
ledgerCountVO.setRunSubCount(runSubCount); ledgerCountVO.setRunSubCount(runSubCount);
ledgerCountVO.setRunLineCount(runLineCount); ledgerCountVO.setRunLineCount(runLineCount);
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.queryListByIds(allLineIds); List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLineInfo(allLineIds);
ledgerBaseInfoDTOS.stream().forEach(temp->temp.setRunFlag(runLineList.contains(temp.getLineId())?1:0)); ledgerBaseInfoDTOS.stream().forEach(temp->temp.setRunFlag(runLineList.contains(temp.getLineId())?1:0));
ledgerCountVO.setAllLineList(ledgerBaseInfoDTOS); ledgerCountVO.setAllLineList(ledgerBaseInfoDTOS);
List<DeviceDTO> deviceDTOS = pqDeviceService.queryListByIds(devList); List<DeviceDTO> deviceDTOS = pqDeviceService.queryListByIds(devList);
@@ -205,8 +205,10 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
Integer eventCount = eventdetails.size(); Integer eventCount = eventdetails.size();
// 告警 // 告警
List<PqsEventdetail> aLarmEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() < 0.5).collect(Collectors.toList()); List<PqsEventdetail> aLarmEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() < 0.5).collect(Collectors.toList());
aLarmEvent.forEach(temp->temp.setEventSeverity(1));
// 预警 // 预警
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList()); List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
aLarmEvent.forEach(temp->temp.setEventSeverity(2));
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList()); List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
//通知 //通知
List<MsgEventInfo> msgEventInfoList = new ArrayList<>(); List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
@@ -380,12 +382,12 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId()); List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId());
//获取对应监测点id //获取对应监测点id
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list(); List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList()); List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(deptslineIds)) { if (CollectionUtils.isEmpty(deptslineIds)) {
throw new BusinessException("部门下暂无监测点"); throw new BusinessException("部门下暂无监测点");
} }
List<LedgerBaseInfoDTO> pqLineList = pqLineMapper.getBaseLineInfo(deptslineIds); List<LedgerBaseInfoDTO> pqLineList = pqLineService.getBaseLineInfo(deptslineIds);
Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
QueryWrapper<PqsEventdetail> queryWrapper = new QueryWrapper<>(); QueryWrapper<PqsEventdetail> queryWrapper = new QueryWrapper<>();
@@ -521,7 +523,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
if (CollUtil.isNotEmpty(allList)) { if (CollUtil.isNotEmpty(allList)) {
List<Integer> ids = allList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList()); List<Integer> ids = allList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
List<LedgerBaseInfoDTO> pqLineList = pqLineMapper.getBaseLineInfo(ids); List<LedgerBaseInfoDTO> pqLineList = pqLineService.getBaseLineInfo(ids);
Map<Integer, LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); Map<Integer, LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
for(PqsEventdetail it : allList){ for(PqsEventdetail it : allList){
EventDetailVO eventDetailVO = new EventDetailVO(); EventDetailVO eventDetailVO = new EventDetailVO();
@@ -589,7 +591,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
mapCountVO.setDeptsIndex(k); mapCountVO.setDeptsIndex(k);
mapCountVO.setDeptsName(stringPqsDeptsMap.get(k).getDeptsname()); mapCountVO.setDeptsName(stringPqsDeptsMap.get(k).getDeptsname());
mapCountVO.setLineCount(v.size()); mapCountVO.setLineCount(v.size());
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.queryListByIds(v.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList())); List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLineInfo(v.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList()));
mapCountVO.setLineList(ledgerBaseInfoDTOS); mapCountVO.setLineList(ledgerBaseInfoDTOS);
List<Integer> deptslineIds = v.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList()); List<Integer> deptslineIds = v.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
List<PqsEventdetail> eventdetails = pqsEventdetailService.lambdaQuery() List<PqsEventdetail> eventdetails = pqsEventdetailService.lambdaQuery()
@@ -706,9 +708,10 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
return result; return result;
} }
List<Integer> lineidList = list.stream().map(PqsEventdetail::getLineid).collect(Collectors.toList()); List<Integer> lineidList = list.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
List<LedgerBaseInfoDTO> pqLineList = pqLineMapper.getBaseLineInfo(lineidList);
List<LedgerBaseInfoDTO> pqLineList = pqLineService.getBaseLineInfo(lineidList);
Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
result = list.stream().map(temp -> { result = list.stream().map(temp -> {
@@ -721,7 +724,11 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
eventDetailVO.setEventvalue(temp.getEventvalue()); eventDetailVO.setEventvalue(temp.getEventvalue());
eventDetailVO.setLookFlag(temp.getLookFlag()); eventDetailVO.setLookFlag(temp.getLookFlag());
eventDetailVO.setNoticeFlag(temp.getNoticeFlag()); eventDetailVO.setNoticeFlag(temp.getNoticeFlag());
eventDetailVO.setMsgEventInfoList(handleMsg.stream().filter(msg->Objects.equals(msg.getEventIndex(),temp.getEventdetailIndex())).collect(Collectors.toList())); if(Objects.nonNull(temp.getEventSeverity())){
eventDetailVO.setEventSeverity(temp.getEventSeverity());
}
eventDetailVO.setMsgEventInfoSize(handleMsg.stream().filter(msg->Objects.equals(msg.getEventIndex(),temp.getEventdetailIndex())).count());
if(ledgerBaseInfoDTOMap.containsKey(temp.getLineid())){ if(ledgerBaseInfoDTOMap.containsKey(temp.getLineid())){
LedgerBaseInfoDTO ledgerBaseInfoDTO = ledgerBaseInfoDTOMap.get(temp.getLineid()); LedgerBaseInfoDTO ledgerBaseInfoDTO = ledgerBaseInfoDTOMap.get(temp.getLineid());
eventDetailVO.setLineid(ledgerBaseInfoDTO.getLineId()); eventDetailVO.setLineid(ledgerBaseInfoDTO.getLineId());