1.优化暂降报告

This commit is contained in:
wr
2025-06-03 10:40:23 +08:00
parent 12cffe4ad7
commit 4aa4044d86
3 changed files with 5217 additions and 5219 deletions

View File

@@ -935,12 +935,12 @@ public class EventReportServiceImpl implements EventReportService {
//添加detail
for (EventDetail detail : info) {
for (DictData data : reasonData) {
if (detail.getAdvanceReason().equals(data.getId())) {
if (data.getId().equals(detail.getAdvanceReason())) {
detail.setAdvanceReason(data.getName());
}
}
for (DictData data : typeData) {
if (detail.getAdvanceType().equals(data.getId())) {
if (data.getId().equals(detail.getAdvanceType())) {
detail.setAdvanceType(data.getName());
}
}
@@ -961,13 +961,13 @@ public class EventReportServiceImpl implements EventReportService {
for (EventDetail detail : info) {
for (DictData data : reasonData) {
reasonMap.put(data.getName(), 0);
if (detail.getAdvanceReason().equals(data.getId())) {
if (data.getId().equals(detail.getAdvanceReason())) {
detail.setAdvanceReason(data.getName());
}
}
for (DictData data : typeData) {
typeMap.put(data.getName(), 0);
if (detail.getAdvanceType().equals(data.getId())) {
if (data.getId().equals(detail.getAdvanceType())) {
detail.setAdvanceType(data.getName());
}
}

View File

@@ -500,6 +500,7 @@ public class ReportServiceImpl implements ReportService {
return page;
}
private List<PmsMonitorDTO> getMonitorList(String orgID) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(orgID, WebUtil.filterDeptType()).getData();
@@ -514,6 +515,7 @@ public class ReportServiceImpl implements ReportService {
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
return monitorList;
}
/**
* 暂降次数统计
*
@@ -651,6 +653,7 @@ public class ReportServiceImpl implements ReportService {
/**
* 生成暂态报告xlsx
*
* @param businessParam
* @return
* @throws TemplateException
@@ -2080,31 +2083,21 @@ public class ReportServiceImpl implements ReportService {
List<DictData> eventTypeList = type.getData();
for (WaveTypeVO waveTypeVO : eventDetailList) {
if (waveTypeVO.getAdvanceReason() != null) {
for (DictData dictData : eventReasonList) {
//将字典数据id与VO中属性eventReason对应的字符串进行比较
if (waveTypeVO.getAdvanceReason().equals(dictData.getId())) {
if (dictData.getId().equals(waveTypeVO.getAdvanceReason())) {
waveTypeVO.setAdvanceReason(dictData.getName());
}
}
} else {
//抛出异常,当前暂态原因为空
throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND);
}
}
for (WaveTypeVO waveTypeVO : eventDetailList) {
if (waveTypeVO.getAdvanceType() != null) {
for (DictData dictData : eventTypeList) {
//将字典数据id与VO中属性eventType对应的字符串进行比较
if (waveTypeVO.getAdvanceType().equals(dictData.getId())) {
if (dictData.getId().equals(waveTypeVO.getAdvanceType())) {
waveTypeVO.setAdvanceType(dictData.getName());
}
}
} else {
//抛出异常,当前暂态类型为空
throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND);
}
}
page = BeanUtil.copyProperties(pageInfo, Page.class);
@@ -4739,7 +4732,9 @@ public class ReportServiceImpl implements ReportService {
Map<String, Integer> resultMap = new HashMap<>();
//优化数据根据暂降原因进行分组统计有多少条数据key:暂降原因idvalue次数)
Map<String, Long> reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getAdvanceReason, Collectors.counting()));
Map<String, Long> reasonMapCount = eventDetailList.stream()
.filter(x -> StrUtil.isNotBlank(x.getAdvanceReason()))
.collect(Collectors.groupingBy(EventDetailNew::getAdvanceReason, Collectors.counting()));
//将数据重新整合为key暂降原因的名称value:暂降原因测次数)
reasonMap.forEach((key, value) -> {
if (reasonMapCount.containsKey(key)) {
@@ -7468,8 +7463,6 @@ public class ReportServiceImpl implements ReportService {
AreaTableParam areaTableParam = new AreaTableParam();
//创建结果集合
List<EventDetailNew> info = eventDetailList;

View File

@@ -1,5 +1,6 @@
package com.njcn.system.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
@@ -22,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -165,10 +167,13 @@ public class EventTemplateController extends BaseController{
@PostMapping("/selectReleation")
@ApiOperation("根据模板id查询关系")
@ApiImplicitParam(name = "id", value = "角色索引", required = true)
public HttpResult<List<EventReportDictVO>> selectRelation(@RequestParam @Validated String id) {
public HttpResult<List<EventReportDictVO>> selectRelation(@RequestParam(required = false,name = "id") String id) {
String methodDescribe = getMethodDescribe("selectRelation");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, id);
List<EventReportDictVO> res = iEventTemplateService.selectRelation(id);
List<EventReportDictVO> res = new ArrayList<>();
if (StrUtil.isNotBlank(id)) {
res.addAll(iEventTemplateService.selectRelation(id)) ;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
}