This commit is contained in:
cdf
2026-01-17 20:56:30 +08:00
parent 7ca23b9431
commit df149a3cc2
3 changed files with 30 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
package com.njcn.harmonic.service.report.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
@@ -20,6 +21,9 @@ import com.njcn.csdevice.api.WlRecordFeignClient;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo;
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
import com.njcn.harmonic.common.service.CustomReportTableService;
import com.njcn.harmonic.enums.HarmonicResponseEnum;
import com.njcn.harmonic.mapper.DeptTempMapper;
import com.njcn.harmonic.mapper.EleEpdMapper;
@@ -98,6 +102,8 @@ public class CustomReportServiceImpl implements CustomReportService {
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
private final CustomReportTableService customReportTableService;
private final WlRecordFeignClient wlRecordFeignClient;
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
@@ -114,15 +120,20 @@ public class CustomReportServiceImpl implements CustomReportService {
@Override
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
TimeInterval timeInterval = new TimeInterval();
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
if (Objects.isNull(excelRptTemp)) {
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
}
if (Objects.isNull(reportSearchParam.getCustomType())) {
//通用报表
analyzeReport(reportSearchParam, excelRptTemp, response);
PqsDeviceUnit deviceUnit = commTerminalGeneralClient.lineUnitDetail(reportSearchParam.getLineId()).getData();
DeviceUnitCommDTO deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
Map<String,String> finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
customReportTableService.getCustomReport(reportSearchParam,finalTerminalMap,deviceUnitCommDTO, response);
} else {
//浙江无线报表
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
if (Objects.isNull(excelRptTemp)) {
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
}
analyzeReportZhejiang(reportSearchParam, excelRptTemp, response);
}
@@ -859,6 +870,7 @@ public class CustomReportServiceImpl implements CustomReportService {
* @date 2023/10/8
*/
/*
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
//定义一个线程集合
List<Future<?>> futures = new ArrayList<>();
@@ -1029,13 +1041,14 @@ public class CustomReportServiceImpl implements CustomReportService {
downReport(jsonArray, response);
}
*/
/**
* 解析模板
* @author cdf
* @date 2023/10/20
*/
private void parseTemplate(JSONArray jsonArray, List<ReportTemplateDTO> reportTemplateDTOList, List<ReportTemplateDTO> reportLimitList, List<ReportTemplateDTO> terminalList) {
/* private void parseTemplate(JSONArray jsonArray, List<ReportTemplateDTO> reportTemplateDTOList, List<ReportTemplateDTO> reportLimitList, List<ReportTemplateDTO> terminalList) {
try {
//通过文件服务器获取
jsonArray.forEach(item -> {
@@ -1103,7 +1116,7 @@ public class CustomReportServiceImpl implements CustomReportService {
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
}
}
*/
/**
* 获取测点限值