微调
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.njcn.harmonic.common.service;
|
||||
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -22,5 +23,5 @@ public interface CustomReportTableService {
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, Map<String,String> newMap, HttpServletResponse response);
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, Map<String,String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
||||
import com.njcn.harmonic.pojo.dto.ReportTemplateDTO;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
@@ -92,7 +93,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
private final String VOLTAGE_DEV = "VOLTAGE_DEV";
|
||||
|
||||
@Override
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam,Map<String,String> newMap, HttpServletResponse response) {
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam,Map<String,String> newMap,DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
|
||||
if (Objects.isNull(excelRptTemp)) {
|
||||
@@ -100,7 +101,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
}
|
||||
if (Objects.isNull(reportSearchParam.getCustomType())) {
|
||||
//通用报表
|
||||
analyzeReport(reportSearchParam, excelRptTemp, newMap,response);
|
||||
analyzeReport(reportSearchParam, excelRptTemp, newMap,deviceUnitCommDTO,response);
|
||||
|
||||
log.info("报表执行时间{}秒", timeInterval.intervalSecond());
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
* @date 2023/10/8
|
||||
*/
|
||||
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp,Map<String,String> newMap, HttpServletResponse response) {
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp,Map<String,String> newMap,DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
//定义一个线程集合
|
||||
List<Future<?>> futures = new ArrayList<>();
|
||||
//指标
|
||||
@@ -202,7 +203,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
//处理指标最终判定合格还是不合格
|
||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||
}
|
||||
resultAssemble(endList,reportSearchParam,terminalList,newMap,jsonArray);
|
||||
resultAssemble(endList,reportSearchParam,newMap,deviceUnitCommDTO,jsonArray);
|
||||
//导出自定义报表
|
||||
downReport(jsonArray, response);
|
||||
}
|
||||
@@ -624,17 +625,8 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
|
||||
/**
|
||||
* 数据单位信息
|
||||
*
|
||||
* @param reportSearchParam
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> unitMap(ReportSearchParam reportSearchParam) {
|
||||
PqsDeviceUnit deviceUnit;
|
||||
if (Objects.isNull(reportSearchParam.getResourceType())) {
|
||||
deviceUnit = commTerminalGeneralClient.lineUnitDetail(reportSearchParam.getLineId()).getData();
|
||||
} else {
|
||||
deviceUnit = csCommTerminalFeignClient.lineUnitDetail(reportSearchParam.getLineId()).getData();
|
||||
}
|
||||
private Map<String, String> unitMap(DeviceUnitCommDTO deviceUnit) {
|
||||
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_UNIT.getCode()).getData();
|
||||
Map<String, String> unit = new HashMap<>();
|
||||
List<String> list = dictData.stream().map(DictData::getCode).collect(Collectors.toList());
|
||||
@@ -690,10 +682,10 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
* @author cdf
|
||||
* @date 2026/1/16
|
||||
*/
|
||||
public void resultAssemble(List<ReportTemplateDTO> endList,ReportSearchParam reportSearchParam,List<ReportTemplateDTO> terminalList,Map<String,String> finalTerminalMap,JSONArray jsonArray){
|
||||
public void resultAssemble(List<ReportTemplateDTO> endList,ReportSearchParam reportSearchParam,Map<String,String> finalTerminalMap,DeviceUnitCommDTO deviceUnitCommDTO,JSONArray jsonArray){
|
||||
if (CollUtil.isNotEmpty(endList)) {
|
||||
//数据单位信息
|
||||
Map<String, String> unit = unitMap(reportSearchParam);
|
||||
Map<String, String> unit = unitMap(deviceUnitCommDTO);
|
||||
//进行反向赋值到模板
|
||||
//1、根据itemName分组
|
||||
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
||||
|
||||
Reference in New Issue
Block a user