暂降监测点报告抽取公共方法
This commit is contained in:
@@ -13,7 +13,7 @@ import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.LineDetailDataCommVO;
|
||||
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -78,7 +78,7 @@ public class ExportModelController extends BaseController {
|
||||
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException {
|
||||
String methodDescribe = getMethodDescribe("exportWorld");
|
||||
|
||||
LineDetailDataCommVO lineDetailDataCommVO;
|
||||
HarmLineDetailDataCommDTO harmLineDetailDataCommDTO;
|
||||
OverLimitInfoCommDTO overLimitInfoCommDTO;
|
||||
DeviceUnitCommDTO deviceUnitCommDTO;
|
||||
|
||||
@@ -119,12 +119,12 @@ public class ExportModelController extends BaseController {
|
||||
//数据单位
|
||||
deviceUnit = deviceUnitClient.lineUnitDetail(lineIndex).getData();
|
||||
|
||||
lineDetailDataCommVO = BeanUtil.copyProperties(lineDto, LineDetailDataCommVO.class);
|
||||
harmLineDetailDataCommDTO = BeanUtil.copyProperties(lineDto, HarmLineDetailDataCommDTO.class);
|
||||
overLimitInfoCommDTO = BeanUtil.copyProperties(overLimit, OverLimitInfoCommDTO.class);
|
||||
deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
|
||||
|
||||
|
||||
|
||||
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file,lineDetailDataCommVO,overLimitInfoCommDTO,deviceUnitCommDTO);
|
||||
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.harmonic.rstatlimitrate.mapper.ExcelRptTempMapper">
|
||||
<mapper namespace="com.njcn.harmonic.common.mapper.ExcelRptTempMapper">
|
||||
|
||||
<select id="getReportTemplateListPage" resultType="com.njcn.harmonic.common.pojo.vo.ReportTemplateVO">
|
||||
select
|
||||
@@ -53,10 +53,6 @@
|
||||
LEFT JOIN sys_dept_temp b ON a.Id = b.temp_id
|
||||
WHERE
|
||||
a.activation = 1
|
||||
and b.dept_id in
|
||||
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by a.sort asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/1/17
|
||||
*/
|
||||
@Data
|
||||
public class LineDetailDataCommVO {
|
||||
public class HarmLineDetailDataCommDTO {
|
||||
|
||||
private String lineId;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.harmonic.common.service;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -21,5 +22,5 @@ public interface CustomReportTableService {
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response);
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, Map<String,String> newMap, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.harmonic.common.service;
|
||||
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.LineDetailDataCommVO;
|
||||
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -25,5 +25,5 @@ public interface MonitorHarmonicReportService {
|
||||
String crmName,
|
||||
Boolean isUrl,
|
||||
MultipartFile file,
|
||||
LineDetailDataCommVO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit);
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONTokener;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -91,7 +92,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
private final String VOLTAGE_DEV = "VOLTAGE_DEV";
|
||||
|
||||
@Override
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam,Map<String,String> newMap, HttpServletResponse response) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
|
||||
if (Objects.isNull(excelRptTemp)) {
|
||||
@@ -99,7 +100,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
}
|
||||
if (Objects.isNull(reportSearchParam.getCustomType())) {
|
||||
//通用报表
|
||||
analyzeReport(reportSearchParam, excelRptTemp, response);
|
||||
analyzeReport(reportSearchParam, excelRptTemp, newMap,response);
|
||||
|
||||
log.info("报表执行时间{}秒", timeInterval.intervalSecond());
|
||||
}
|
||||
@@ -113,7 +114,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
* @date 2023/10/8
|
||||
*/
|
||||
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp,Map<String,String> newMap, HttpServletResponse response) {
|
||||
//定义一个线程集合
|
||||
List<Future<?>> futures = new ArrayList<>();
|
||||
//指标
|
||||
@@ -162,7 +163,9 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||
//每张表开启一个独立线程查询
|
||||
futures.add(executorService.submit(() -> {
|
||||
DynamicDataSourceContextHolder.push("sjzx");
|
||||
//avg.max,min,cp95
|
||||
try {
|
||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||
//相别分组
|
||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||
@@ -180,8 +183,10 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
|
||||
});
|
||||
});
|
||||
}finally {
|
||||
DynamicDataSourceContextHolder.poll();
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
// 等待所有任务完成
|
||||
@@ -197,7 +202,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
//处理指标最终判定合格还是不合格
|
||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||
}
|
||||
resultAssemble(endList,reportSearchParam,terminalList,jsonArray);
|
||||
resultAssemble(endList,reportSearchParam,terminalList,newMap,jsonArray);
|
||||
//导出自定义报表
|
||||
downReport(jsonArray, response);
|
||||
}
|
||||
@@ -685,20 +690,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
* @author cdf
|
||||
* @date 2026/1/16
|
||||
*/
|
||||
public void resultAssemble(List<ReportTemplateDTO> endList,ReportSearchParam reportSearchParam,List<ReportTemplateDTO> terminalList,JSONArray jsonArray){
|
||||
public void resultAssemble(List<ReportTemplateDTO> endList,ReportSearchParam reportSearchParam,List<ReportTemplateDTO> terminalList,Map<String,String> finalTerminalMap,JSONArray jsonArray){
|
||||
if (CollUtil.isNotEmpty(endList)) {
|
||||
//数据单位信息
|
||||
Map<String, String> unit = unitMap(reportSearchParam);
|
||||
//进行反向赋值到模板
|
||||
//1、根据itemName分组
|
||||
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
||||
//处理台账信息
|
||||
Map<String, String> finalTerminalMap;
|
||||
if (CollUtil.isNotEmpty(terminalList)) {
|
||||
finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
|
||||
}else {
|
||||
finalTerminalMap = new HashMap<>();
|
||||
}
|
||||
//2、把itemName的value赋给v和m
|
||||
jsonArray.forEach(item -> {
|
||||
JSONObject jsonObject = (JSONObject) item;
|
||||
@@ -777,7 +775,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
/**
|
||||
* map key转大写
|
||||
*/
|
||||
public static <V> Map<String, V> convertKeysToUpperCase(Map<String, V> originalMap) {
|
||||
public <V> Map<String, V> convertKeysToUpperCase(Map<String, V> originalMap) {
|
||||
Map<String, V> newMap = new HashMap<>();
|
||||
for (Map.Entry<String, V> entry : originalMap.entrySet()) {
|
||||
newMap.put(entry.getKey().toUpperCase(), entry.getValue());
|
||||
|
||||
@@ -561,8 +561,6 @@ public class MonitorCommReportServiceImpl implements MonitorCommReportService {
|
||||
int finalI = i;
|
||||
collect.forEach((key, value) -> {
|
||||
Map<String, List<RStatDataIDPO>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataIDPO::getValueType));
|
||||
|
||||
|
||||
ReportValue reportValue = new ReportValue();
|
||||
String attribute = "";
|
||||
if (fly) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.DeviceUnitClient;
|
||||
@@ -20,7 +19,7 @@ import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||
import com.njcn.harmonic.pojo.po.report.Pass;
|
||||
import com.njcn.harmonic.pojo.po.report.ReportTarget;
|
||||
import com.njcn.harmonic.pojo.vo.ReportValue;
|
||||
import com.njcn.harmonic.common.pojo.dto.LineDetailDataCommVO;
|
||||
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import com.njcn.harmonic.common.service.MonitorCommReportService;
|
||||
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
|
||||
@@ -115,7 +114,7 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
String crmName,
|
||||
Boolean isUrl,
|
||||
MultipartFile file,
|
||||
LineDetailDataCommVO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit) {
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit) {
|
||||
//获取监测点信息
|
||||
String bdname;
|
||||
Integer pttype;
|
||||
@@ -187,8 +186,6 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
param.setEndTime(DateUtil.format(endDate, "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
param.setB(day == 0);
|
||||
|
||||
|
||||
if (Objects.isNull(overLimit)) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"限值获取为空");
|
||||
}
|
||||
@@ -1198,7 +1195,7 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
String strMap = "$RI";
|
||||
String strCurrent = strMap + (i + 1) + "%";
|
||||
|
||||
// 基波电压含有率
|
||||
// 谐波电流幅值
|
||||
strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
|
||||
strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
|
||||
strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
|
||||
|
||||
Reference in New Issue
Block a user