1.变压器bug修改。

2.冀北首页变压器统计相关业务代码提交
This commit is contained in:
wr
2023-08-09 19:11:21 +08:00
parent 5670524153
commit dc15bd5d20
14 changed files with 205 additions and 42 deletions

View File

@@ -16,8 +16,13 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
@@ -52,6 +57,8 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.enums.StatisticsEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import freemarker.template.TemplateException;
import java.io.*;
@@ -119,6 +126,7 @@ public class ReportServiceImpl implements ReportService {
private final MonitorClient monitorClient;
private final PwMonitorClient pwMonitorClient;
private final EventDetailService eventDetailService;
private final EventDetailMapper eventDetailMapper;
@@ -394,31 +402,55 @@ public class ReportServiceImpl implements ReportService {
//pq系统
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData();
lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
} else if (waveTypeParam.getType() == 1) {
}
if (waveTypeParam.getType() == 1) {
//pms系统
PmsDeviceInfoParam param = new PmsDeviceInfoParam();
param.setDeptIndex(waveTypeParam.getDeptIndex());
param.setStatisticalType(waveTypeParam.getStatisticalType());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData();
lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
} else {
}
if (waveTypeParam.getType() == 2) {
PmsDeviceInfoParam param = new PmsDeviceInfoParam();
param.setDeptIndex(waveTypeParam.getDeptIndex());
param.setStatisticalType(waveTypeParam.getStatisticalType());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(param).getData();
lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
}
if (waveTypeParam.getType() == 3) {
//获取配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(waveTypeParam.getDeptIndex());
List<PwPmsMonitorDTO> pwPmsMonitorDTOS = pwMonitorClient.getPwSubsetMonitorList(pwPmsMonitorParam).getData();
//获取主网监测点
List<PmsMonitorDTO> monitorList = this.getMonitorList(waveTypeParam.getDeptIndex());
if (CollUtil.isNotEmpty(monitorList)) {
lineIds.addAll(monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()));
}
lineIds.addAll(pwPmsMonitorDTOS.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()));
}
if (CollectionUtil.isEmpty(lineIds)) {
throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY);
}
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
.orderByDesc(RmpEventDetailPO::getStartTime)
);
Page<RmpEventDetailPO> pageInfo=new Page<>();
if(waveTypeParam.getType() != 3){
pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
.orderByDesc(RmpEventDetailPO::getStartTime)
);
}else{
pageInfo.setRecords(eventDetailService.list( new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
.orderByDesc(RmpEventDetailPO::getStartTime)));
}
List<EventDetailNew> info = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class);
if (CollectionUtil.isNotEmpty(info)) {
ArrayList<String> idlist = new ArrayList<>();
@@ -475,7 +507,20 @@ public class ReportServiceImpl implements ReportService {
return page;
}
private List<PmsMonitorDTO> getMonitorList(String orgID) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(orgID, WebUtil.filterDeptType()).getData();
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位code集合
List<String> orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setOrgIds(orgCodeList); //单位codes
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
return monitorList;
}
/**
* 暂降次数统计
*