微调
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.gather.report.pojo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -34,4 +35,5 @@ public class DevReportParam implements Serializable {
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
private List<String> devIdList;
|
||||
}
|
||||
|
||||
@@ -67,5 +67,5 @@ public interface IPqReportService extends IService<PqReport> {
|
||||
|
||||
void downloadReport(DevReportParam devReportParam, HttpServletResponse response);
|
||||
|
||||
Map<String, Object> getMap(DevReportParam devReportParam);
|
||||
//Map<String, Object> getMap(DevReportParam devReportParam);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -18,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
@@ -72,8 +72,6 @@ import org.docx4j.jaxb.Context;
|
||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
||||
import org.docx4j.wml.*;
|
||||
import org.docx4j.wml.CTTblLayoutType;
|
||||
import org.docx4j.wml.STTblLayoutType;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -85,7 +83,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
@@ -525,50 +522,53 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
* @param devReportParam 被检设备信息
|
||||
*/
|
||||
private void generateReportByDevType(AdPlan plan, DevReportParam devReportParam) {
|
||||
// 根据设备类型找到报告模板
|
||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||
if (Objects.isNull(pqDevVO)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||
}
|
||||
// 获取设备型号
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (Objects.isNull(devType)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||
}
|
||||
DictData reportName = devTypeService.getReportName(pqDevVO.getDevType());
|
||||
if (Objects.isNull(reportName)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
// 读取模板文件
|
||||
ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX);
|
||||
try (InputStream inputStream = resource.getInputStream()) {
|
||||
// 加载Word文档
|
||||
XWPFDocument baseModelDocument = new XWPFDocument(inputStream);
|
||||
// 处理基础模版中的信息
|
||||
Map<String, String> baseModelDataMap = dealBaseModelData(pqDevVO, devType, "${", "}");
|
||||
// 替换模板中的信息,避免信息丢失,段落和表格均参与替换
|
||||
WordUtil.replacePlaceholders(baseModelDocument, baseModelDataMap);
|
||||
// 处理数据页中的信息
|
||||
dealDataModel(baseModelDocument, devReportParam, pqDevVO);
|
||||
// 处理需要输出的目录地址 基础路径+设备类型+装置编号.docx
|
||||
// 最终文件输出的路径
|
||||
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
||||
// 确保目录存在
|
||||
ensureDirectoryExists(dirPath);
|
||||
FileOutputStream out = new FileOutputStream(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(".docx"));
|
||||
// 4. 保存新的Word文档
|
||||
try {
|
||||
baseModelDocument.write(out);
|
||||
devReportParam.getDevIdList().forEach(devId -> {
|
||||
devReportParam.setDevId(devId);
|
||||
// 根据设备类型找到报告模板
|
||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||
if (Objects.isNull(pqDevVO)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||
}
|
||||
// 获取设备型号
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (Objects.isNull(devType)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||
}
|
||||
DictData reportName = devTypeService.getReportName(pqDevVO.getDevType());
|
||||
if (Objects.isNull(reportName)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
// 读取模板文件
|
||||
ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX);
|
||||
try (InputStream inputStream = resource.getInputStream()) {
|
||||
// 加载Word文档
|
||||
XWPFDocument baseModelDocument = new XWPFDocument(inputStream);
|
||||
// 处理基础模版中的信息
|
||||
Map<String, String> baseModelDataMap = dealBaseModelData(pqDevVO, devType, "${", "}");
|
||||
// 替换模板中的信息,避免信息丢失,段落和表格均参与替换
|
||||
WordUtil.replacePlaceholders(baseModelDocument, baseModelDataMap);
|
||||
// 处理数据页中的信息
|
||||
dealDataModel(baseModelDocument, devReportParam, pqDevVO);
|
||||
// 处理需要输出的目录地址 基础路径+设备类型+装置编号.docx
|
||||
// 最终文件输出的路径
|
||||
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
||||
// 确保目录存在
|
||||
ensureDirectoryExists(dirPath);
|
||||
FileOutputStream out = new FileOutputStream(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(".docx"));
|
||||
// 4. 保存新的Word文档
|
||||
try {
|
||||
baseModelDocument.write(out);
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
out.close();
|
||||
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
} catch (IOException e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
out.close();
|
||||
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
} catch (IOException e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,41 +579,44 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
* @param devReportParam 设备信息
|
||||
*/
|
||||
private void generateReportByPlan(AdPlan plan, DevReportParam devReportParam) {
|
||||
// 准备被检设备的基础信息
|
||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||
if (Objects.isNull(pqDevVO)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||
}
|
||||
// 获取设备型号
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (Objects.isNull(devType)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||
}
|
||||
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
if (Objects.isNull(report)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
try {
|
||||
WordprocessingMLPackage baseModelDocument = WordprocessingMLPackage.load(new File(report.getBasePath()));
|
||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(new File(report.getDetailPath()));
|
||||
// 获取文档基础部分,并替换占位符
|
||||
MainDocumentPart baseDocumentPart = baseModelDocument.getMainDocumentPart();
|
||||
Map<String, String> baseModelDataMap = dealBaseModelData(pqDevVO, devType, "", "");
|
||||
baseDocumentPart.variableReplace(baseModelDataMap);
|
||||
// 获取数据模版页内容,根据脚本动态组装数据页内容
|
||||
MainDocumentPart detailDocumentPart = detailModelDocument.getMainDocumentPart();
|
||||
dealDataModelScattered(baseDocumentPart, detailDocumentPart, devReportParam, pqDevVO);
|
||||
// 保存新的文档
|
||||
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
||||
// 确保目录存在
|
||||
ensureDirectoryExists(dirPath);
|
||||
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
|
||||
devReportParam.getDevIdList().forEach(devId -> {
|
||||
devReportParam.setDevId(devId);
|
||||
// 准备被检设备的基础信息
|
||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||
if (Objects.isNull(pqDevVO)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||
}
|
||||
// 获取设备型号
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (Objects.isNull(devType)) {
|
||||
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||
}
|
||||
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
if (Objects.isNull(report)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
try {
|
||||
WordprocessingMLPackage baseModelDocument = WordprocessingMLPackage.load(new File(report.getBasePath()));
|
||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(new File(report.getDetailPath()));
|
||||
// 获取文档基础部分,并替换占位符
|
||||
MainDocumentPart baseDocumentPart = baseModelDocument.getMainDocumentPart();
|
||||
Map<String, String> baseModelDataMap = dealBaseModelData(pqDevVO, devType, "", "");
|
||||
baseDocumentPart.variableReplace(baseModelDataMap);
|
||||
// 获取数据模版页内容,根据脚本动态组装数据页内容
|
||||
MainDocumentPart detailDocumentPart = detailModelDocument.getMainDocumentPart();
|
||||
dealDataModelScattered(baseDocumentPart, detailDocumentPart, devReportParam, pqDevVO);
|
||||
// 保存新的文档
|
||||
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
||||
// 确保目录存在
|
||||
ensureDirectoryExists(dirPath);
|
||||
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
|
||||
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
} catch (Exception e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
} catch (Exception e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -956,7 +959,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
TcPr tcPr = element.getValue().getTcPr();
|
||||
TblWidth cellWidth = factory.createTblWidth();
|
||||
cellWidth.setType("dxa");
|
||||
cellWidth.setW(BigInteger.valueOf(5000/tableKeys.size()));
|
||||
cellWidth.setW(BigInteger.valueOf(5000 / tableKeys.size()));
|
||||
tcPr.setTcW(cellWidth);
|
||||
tbl.getContent().remove(existingRow);
|
||||
// 迭代增加行,需要填充的表格keys在tableKeys集合中
|
||||
@@ -970,7 +973,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 插入段落,处理下样式
|
||||
|
||||
|
||||
|
||||
paragraphs.add(position++, copiedTableElement);
|
||||
}
|
||||
}
|
||||
@@ -1057,7 +1059,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 获取设备型号
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.DEV_TYPE.getKey() + suffix, devType.getName());
|
||||
// 检测员
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.INSPECTOR.getKey() + suffix, pqDevVO.getCheckBy());
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.INSPECTOR.getKey() + suffix, pqDevVO.getCheckBy() + "");
|
||||
// 调试日期
|
||||
if (pqDevVO.getCheckTime() != null) {
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
||||
@@ -1115,147 +1117,39 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
singleNonHarmParam.setChannelNo(i);
|
||||
|
||||
// 获取数据
|
||||
Map<String, String> dataModelMap = new HashMap<>(16);
|
||||
Map<String, String> dataModelMap = new HashMap<>();
|
||||
dataModelMap.put("${CreateId}", pqDevVO.getCreateId());
|
||||
dataModelMap.put("${total}", pqDevVO.getDevChns().toString());
|
||||
dataModelMap.put("${count}", i + "");
|
||||
// 区分谐波和非谐波数据
|
||||
// 谐波类
|
||||
|
||||
// 读取模板文件中的占位符
|
||||
List<String> allMarkList = getAllKeys(dataModelDocumentTemp);
|
||||
Map<String, Set<String>> indexKeysMap = allMarkList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
obj -> obj.split("#")[0].replace("${", ""),
|
||||
Collectors.mapping(obj -> {
|
||||
int index1 = obj.indexOf("#") + 1;
|
||||
return obj.substring(index1, obj.indexOf("#", index1));
|
||||
}, Collectors.toSet()))); //key为index,value为该index下所有测试项对应的code
|
||||
|
||||
// 非谐波类
|
||||
// 57V电压 电压&相角 index 不用计算了,固定为1
|
||||
// Integer testItemIndex = getTestItemIndex(scriptId, "e797c4b940389404e64fb92e4507c5f4", "Base", "VOL", 57);
|
||||
// 获取输出脚本ID
|
||||
Integer testItemIndex = 1;
|
||||
// String pqScriptCheckDataService = getPqScriptCheckDataByScriptId(scriptId,testItemIndex,1,Arrays.asList("A","B","C"));
|
||||
String pqScriptCheckDataService = "8e221487f242c77f1eff05234580d4c5";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "57Ua", "57Ub", "57Uc");
|
||||
|
||||
// 57V相角
|
||||
testItemIndex = 1;
|
||||
pqScriptCheckDataService = "e8bbfaad7a3fa343d3c46d345fb45fa3";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "57UaA", "57UbA", "57UcA");
|
||||
|
||||
// 10V电压
|
||||
testItemIndex = 2;
|
||||
pqScriptCheckDataService = "8e221487f242c77f1eff05234580d4c5";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "10Ua", "10Ub", "10Uc");
|
||||
|
||||
|
||||
// 电压偏差
|
||||
testItemIndex = 3;
|
||||
pqScriptCheckDataService = "8e221487f242c77f1eff05234580d4c5";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "DELTA_Ua", "DELTA_Ub", "DELTA_Uc");
|
||||
// 特殊处理电压偏差
|
||||
specialDealVoltage(dataModelMap, "${DELTA_Ua}");
|
||||
specialDealVoltage(dataModelMap, "${DELTA_Ub}");
|
||||
specialDealVoltage(dataModelMap, "${DELTA_Uc}");
|
||||
|
||||
// 5A 电流
|
||||
testItemIndex = 4;
|
||||
pqScriptCheckDataService = "7fbadbeb9dd5ccb69d216f4f9ad60b4f";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "5Ia", "5Ib", "5Ic");
|
||||
|
||||
// 5A 电流相角
|
||||
testItemIndex = 4;
|
||||
pqScriptCheckDataService = "fdffc6b5dfdc8751b9fde9b599b8ea51";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "5IaA", "5IbA", "5IcA");
|
||||
|
||||
// 1A 电流
|
||||
testItemIndex = 5;
|
||||
pqScriptCheckDataService = "7fbadbeb9dd5ccb69d216f4f9ad60b4f";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValue(singleNonHarmParam, dataModelMap, "1Ia", "1Ib", "1Ic");
|
||||
|
||||
|
||||
// 三相电压不平衡度
|
||||
testItemIndex = 6;
|
||||
pqScriptCheckDataService = "9e9910f3627870c7fcf5846342f29d26";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueT(singleNonHarmParam, dataModelMap, "V_UNBAN");
|
||||
|
||||
|
||||
// 频率 45
|
||||
testItemIndex = 7;
|
||||
pqScriptCheckDataService = "2da2a32c0cd19fb6368b9f4c249c2b3c";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueT(singleNonHarmParam, dataModelMap, "FREQ45");
|
||||
|
||||
|
||||
// 频率 50
|
||||
testItemIndex = 8;
|
||||
pqScriptCheckDataService = "2da2a32c0cd19fb6368b9f4c249c2b3c";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueT(singleNonHarmParam, dataModelMap, "FREQ50");
|
||||
|
||||
|
||||
// 频率 55
|
||||
testItemIndex = 9;
|
||||
pqScriptCheckDataService = "2da2a32c0cd19fb6368b9f4c249c2b3c";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueT(singleNonHarmParam, dataModelMap, "FREQ55");
|
||||
|
||||
// 谐波电压
|
||||
testItemIndex = 10;
|
||||
pqScriptCheckDataService = "cce92410f1902897a61f644d875f2216";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueHarm(singleNonHarmParam, dataModelMap, "Uha", "Uhb", "Uhc", 57.74, 100);
|
||||
|
||||
// 谐波电电流
|
||||
testItemIndex = 11;
|
||||
pqScriptCheckDataService = "3e5e384d38485ca4242152fba336de1d";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueHarm(singleNonHarmParam, dataModelMap, "Iha", "Ihb", "Ihc", 1, 1);
|
||||
|
||||
// 间谐波电压
|
||||
testItemIndex = 12;
|
||||
pqScriptCheckDataService = "d57ea0e085ecf6c4e9f4da09b948befe";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueHarm(singleNonHarmParam, dataModelMap, "InUa", "InUb", "InUc", 57.74, 100);
|
||||
|
||||
// 间谐波电流
|
||||
testItemIndex = 13;
|
||||
pqScriptCheckDataService = "6bc58769dcbb2f83a13ff965a20a3cf3";
|
||||
// 获取数据
|
||||
singleNonHarmParam.setAdType(pqScriptCheckDataService);
|
||||
singleNonHarmParam.setSort(testItemIndex);
|
||||
fillMapValueHarm(singleNonHarmParam, dataModelMap, "InIa", "InIb", "InIc", 1, 1);
|
||||
List<AdNonHarmonicResult> adNonHarmonicResultList = adNonHarmonicService.listAll(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||
List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAll(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||
|
||||
// 填充数据
|
||||
indexKeysMap.forEach((index, keys) -> {
|
||||
String s1 = keys.stream().findFirst().get();
|
||||
// 谐波类
|
||||
if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) {
|
||||
fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index);
|
||||
} else {
|
||||
// 非谐波类
|
||||
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
||||
fillMapValueT(adNonHarmonicResultList, dataModelMap, keys, index);
|
||||
} else {
|
||||
fillMapValueABC(adNonHarmonicResultList, dataModelMap, keys, index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 替换文档内容
|
||||
WordUtil.replacePlaceholdersInParagraphs(dataModelDocumentTemp, dataModelMap);
|
||||
@@ -1264,6 +1158,171 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据(ABC相)
|
||||
*
|
||||
* @param allNonHarmonicResultList
|
||||
* @param dataModelMap
|
||||
* @param keys
|
||||
* @param index
|
||||
*/
|
||||
private void fillMapValueABC(List<AdNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||
keys.forEach(key -> {
|
||||
List<AdNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
AdNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
||||
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
||||
dataModelMap.put("${" + index + "#" + key + "#A}", devValue(adNonHarmonicResult.getAValue(), 1, 1));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B}", devValue(adNonHarmonicResult.getBValue(), 1, 1));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C}", devValue(adNonHarmonicResult.getCValue(), 1, 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据(T相)
|
||||
*
|
||||
* @param allNonHarmonicResultList
|
||||
* @param dataModelMap
|
||||
* @param keys
|
||||
* @param index
|
||||
*/
|
||||
private void fillMapValueT(List<AdNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||
keys.forEach(key -> {
|
||||
List<AdNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
AdNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
||||
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
||||
dataModelMap.put("${" + index + "#" + key + "#T}", devValue(adNonHarmonicResult.getTValue(), 1, 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据(谐波类)
|
||||
*
|
||||
* @param allHarmonicResultList
|
||||
* @param dataModelMap
|
||||
* @param keys
|
||||
* @param index
|
||||
*/
|
||||
private void fillMapValueHarm(List<AdHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||
keys.forEach(key -> {
|
||||
List<AdHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
AdHarmonicResult adHarmonicResult = resultList.get(0);
|
||||
if (Objects.nonNull(adHarmonicResult)) {
|
||||
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100);
|
||||
}
|
||||
if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) {
|
||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对谐波类数据进行处理,并填充到map中
|
||||
*
|
||||
* @param dataModelMap
|
||||
* @param adHarmonicResult
|
||||
* @param index
|
||||
* @param key
|
||||
* @param baseValue
|
||||
* @param percent
|
||||
*/
|
||||
private void fillHarm(Map<String, String> dataModelMap, AdHarmonicResult adHarmonicResult, String index, String key, double baseValue, int percent) {
|
||||
// 要处理 2 5 7 11 23 35 43 50
|
||||
// 基波
|
||||
String aBase = devValue(adHarmonicResult.getAValue1(), 1, 1);
|
||||
String bBase = devValue(adHarmonicResult.getBValue1(), 1, 1);
|
||||
String cBase = devValue(adHarmonicResult.getCValue1(), 1, 1);
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#1}", aBase);
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#1}", bBase);
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#1}", cBase);
|
||||
|
||||
double aBaseValue = baseValue;
|
||||
double bBaseValue = baseValue;
|
||||
double cBaseValue = baseValue;
|
||||
|
||||
if (!aBase.equals(StrPool.SLASH)) {
|
||||
aBaseValue = Double.parseDouble(aBase);
|
||||
}
|
||||
if (!bBase.equals(StrPool.SLASH)) {
|
||||
bBaseValue = Double.parseDouble(bBase);
|
||||
}
|
||||
if (!cBase.equals(StrPool.SLASH)) {
|
||||
cBaseValue = Double.parseDouble(cBase);
|
||||
}
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#2}", devValue(adHarmonicResult.getAValue2(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#2}", devValue(adHarmonicResult.getBValue2(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#2}", devValue(adHarmonicResult.getCValue2(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#5}", devValue(adHarmonicResult.getAValue5(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#5}", devValue(adHarmonicResult.getBValue5(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#5}", devValue(adHarmonicResult.getCValue5(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#7}", devValue(adHarmonicResult.getAValue7(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#7}", devValue(adHarmonicResult.getBValue7(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#7}", devValue(adHarmonicResult.getCValue7(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#11}", devValue(adHarmonicResult.getAValue11(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#11}", devValue(adHarmonicResult.getBValue11(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#11}", devValue(adHarmonicResult.getCValue11(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#23}", devValue(adHarmonicResult.getAValue23(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#23}", devValue(adHarmonicResult.getBValue23(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#23}", devValue(adHarmonicResult.getCValue23(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#35}", devValue(adHarmonicResult.getAValue35(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#35}", devValue(adHarmonicResult.getBValue35(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#35}", devValue(adHarmonicResult.getCValue35(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#43}", devValue(adHarmonicResult.getAValue43(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#43}", devValue(adHarmonicResult.getBValue43(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#43}", devValue(adHarmonicResult.getCValue43(), cBaseValue, percent));
|
||||
|
||||
dataModelMap.put("${" + index + "#" + key + "#A#50}", devValue(adHarmonicResult.getAValue50(), aBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#B#50}", devValue(adHarmonicResult.getBValue50(), bBaseValue, percent));
|
||||
dataModelMap.put("${" + index + "#" + key + "#C#50}", devValue(adHarmonicResult.getCValue50(), cBaseValue, percent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件所有表格中的占位符
|
||||
*
|
||||
* @param dataModelDocumentTemp
|
||||
* @return
|
||||
*/
|
||||
private List<String> getAllKeys(XWPFDocument dataModelDocumentTemp) {
|
||||
List<String> allMarkList = new ArrayList<>();
|
||||
List<XWPFTable> tables = dataModelDocumentTemp.getTables();
|
||||
|
||||
for (XWPFTable table : tables) {
|
||||
List<XWPFTableRow> rows = table.getRows();
|
||||
for (XWPFTableRow row : rows) {
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
for (XWPFTableCell cell : cells) {
|
||||
List<XWPFParagraph> paragraphs = cell.getParagraphs();
|
||||
for (XWPFParagraph paragraph : paragraphs) {
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
for (XWPFRun run : runs) {
|
||||
String text = run.getText(0);
|
||||
if (StrUtil.isNotBlank(text) && text.startsWith("$")) {
|
||||
allMarkList.add(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return allMarkList.stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void dealDataModelZJ(XWPFDocument baseModelDocument, DevReportParam devReportParam, PqDevVO pqDevVO) {
|
||||
List<AdBaseResult> nonHarmonicResultList = adNonHarmonicService.get(devReportParam.getScriptId(), null, devReportParam.getDevId(), "-1", devReportParam.getPlanCode());
|
||||
List<AdBaseResult> harmonicResultList = adHarmonicService.get(devReportParam.getScriptId(), null, devReportParam.getDevId(), "-1", devReportParam.getPlanCode());
|
||||
@@ -2026,93 +2085,93 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMap(DevReportParam devReportParam) {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
List<AdNonHarmonicResult> adNonHarmonicResultList = adNonHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
|
||||
Map<String, List<AdNonHarmonicResult>> monitorIdMap1 = adNonHarmonicResultList.stream()
|
||||
.sorted(Comparator.comparing(AdNonHarmonicResult::getMonitorId))
|
||||
.collect(Collectors.groupingBy(AdNonHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
Map<String, List<AdHarmonicResult>> monitorIdMap2 = adHarmonicResultList.stream()
|
||||
.sorted(Comparator.comparing(AdHarmonicResult::getMonitorId))
|
||||
.collect(Collectors.groupingBy(AdHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
String[] monitorIds = monitorIdMap1.keySet().stream().map(String::valueOf).toArray(String[]::new);
|
||||
|
||||
monitorIdMap1.get(monitorIds[0]).stream().forEach(adNonHarmonicResult -> {
|
||||
DictTree dictTree = dictTreeService.getById(adNonHarmonicResult.getAdType());
|
||||
|
||||
DetectionData detectionDataA = JSON.parseObject(adNonHarmonicResult.getAValue(), DetectionData.class);
|
||||
DetectionData detectionDataB = JSON.parseObject(adNonHarmonicResult.getBValue(), DetectionData.class);
|
||||
DetectionData detectionDataC = JSON.parseObject(adNonHarmonicResult.getCValue(), DetectionData.class);
|
||||
|
||||
DetectionData detectionDataT = JSON.parseObject(adNonHarmonicResult.getTValue(), DetectionData.class);
|
||||
// 标准值
|
||||
Double standardValue = null;
|
||||
if (ObjectUtil.isNotNull(detectionDataT)) {
|
||||
standardValue = detectionDataT.getResultData();
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Standard", detectionDataT.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Test", detectionDataT.getData());
|
||||
} else {
|
||||
standardValue = detectionDataA.getResultData();
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Standard", detectionDataA.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Test", detectionDataA.getData());
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Standard", detectionDataB.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Test", detectionDataB.getData());
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Standard", detectionDataC.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Test", detectionDataC.getData());
|
||||
}
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_Result", getResultStr(adNonHarmonicResult.getResultFlag()));
|
||||
});
|
||||
|
||||
monitorIdMap2.get(monitorIds[0]).stream().forEach(adHarmonicResult -> {
|
||||
DictTree dictTree = dictTreeService.getById(adHarmonicResult.getAdType());
|
||||
|
||||
for (int i = 2; i <= 50; i++) {
|
||||
try {
|
||||
Field fieldA = adHarmonicResult.getClass().getDeclaredField("aValue" + i);
|
||||
fieldA.setAccessible(true);
|
||||
Object a = fieldA.get(adHarmonicResult);
|
||||
|
||||
Field fieldB = adHarmonicResult.getClass().getDeclaredField("bValue" + i);
|
||||
fieldB.setAccessible(true);
|
||||
Object b = fieldB.get(adHarmonicResult);
|
||||
|
||||
Field fieldC = adHarmonicResult.getClass().getDeclaredField("cValue" + i);
|
||||
fieldC.setAccessible(true);
|
||||
Object c = fieldC.get(adHarmonicResult);
|
||||
|
||||
List<Integer> isDataList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(a) && ObjectUtil.isNotNull(b) && ObjectUtil.isNotNull(c)) {
|
||||
DetectionData detectionData = JSON.parseObject(a.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
|
||||
detectionData = JSON.parseObject(b.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
|
||||
detectionData = JSON.parseObject(c.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
}
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + i + "_Result", getResultStr(isDataList.stream().allMatch(data -> data == 1) ? 1 : (isDataList.stream().anyMatch(data -> data == 2) ? 2 : 4)));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
// @Override
|
||||
// public Map<String, Object> getMap(DevReportParam devReportParam) {
|
||||
// HashMap<String, Object> resultMap = new HashMap<>();
|
||||
// List<AdNonHarmonicResult> adNonHarmonicResultList = adNonHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
// List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
//
|
||||
// Map<String, List<AdNonHarmonicResult>> monitorIdMap1 = adNonHarmonicResultList.stream()
|
||||
// .sorted(Comparator.comparing(AdNonHarmonicResult::getMonitorId))
|
||||
// .collect(Collectors.groupingBy(AdNonHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
// Map<String, List<AdHarmonicResult>> monitorIdMap2 = adHarmonicResultList.stream()
|
||||
// .sorted(Comparator.comparing(AdHarmonicResult::getMonitorId))
|
||||
// .collect(Collectors.groupingBy(AdHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
//
|
||||
// String[] monitorIds = monitorIdMap1.keySet().stream().map(String::valueOf).toArray(String[]::new);
|
||||
//
|
||||
// monitorIdMap1.get(monitorIds[0]).stream().forEach(adNonHarmonicResult -> {
|
||||
// DictTree dictTree = dictTreeService.getById(adNonHarmonicResult.getAdType());
|
||||
//
|
||||
// DetectionData detectionDataA = JSON.parseObject(adNonHarmonicResult.getAValue(), DetectionData.class);
|
||||
// DetectionData detectionDataB = JSON.parseObject(adNonHarmonicResult.getBValue(), DetectionData.class);
|
||||
// DetectionData detectionDataC = JSON.parseObject(adNonHarmonicResult.getCValue(), DetectionData.class);
|
||||
//
|
||||
// DetectionData detectionDataT = JSON.parseObject(adNonHarmonicResult.getTValue(), DetectionData.class);
|
||||
// // 标准值
|
||||
// Double standardValue = null;
|
||||
// if (ObjectUtil.isNotNull(detectionDataT)) {
|
||||
// standardValue = detectionDataT.getResultData();
|
||||
//
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Standard", detectionDataT.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Test", detectionDataT.getData());
|
||||
// } else {
|
||||
// standardValue = detectionDataA.getResultData();
|
||||
//
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Standard", detectionDataA.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Test", detectionDataA.getData());
|
||||
//
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Standard", detectionDataB.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Test", detectionDataB.getData());
|
||||
//
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Standard", detectionDataC.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Test", detectionDataC.getData());
|
||||
// }
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_Result", getResultStr(adNonHarmonicResult.getResultFlag()));
|
||||
// });
|
||||
//
|
||||
// monitorIdMap2.get(monitorIds[0]).stream().forEach(adHarmonicResult -> {
|
||||
// DictTree dictTree = dictTreeService.getById(adHarmonicResult.getAdType());
|
||||
//
|
||||
// for (int i = 2; i <= 50; i++) {
|
||||
// try {
|
||||
// Field fieldA = adHarmonicResult.getClass().getDeclaredField("aValue" + i);
|
||||
// fieldA.setAccessible(true);
|
||||
// Object a = fieldA.get(adHarmonicResult);
|
||||
//
|
||||
// Field fieldB = adHarmonicResult.getClass().getDeclaredField("bValue" + i);
|
||||
// fieldB.setAccessible(true);
|
||||
// Object b = fieldB.get(adHarmonicResult);
|
||||
//
|
||||
// Field fieldC = adHarmonicResult.getClass().getDeclaredField("cValue" + i);
|
||||
// fieldC.setAccessible(true);
|
||||
// Object c = fieldC.get(adHarmonicResult);
|
||||
//
|
||||
// List<Integer> isDataList = new ArrayList<>();
|
||||
// if (ObjectUtil.isNotNull(a) && ObjectUtil.isNotNull(b) && ObjectUtil.isNotNull(c)) {
|
||||
// DetectionData detectionData = JSON.parseObject(a.toString(), DetectionData.class);
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Standard", detectionData.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Test", detectionData.getData());
|
||||
// isDataList.add(detectionData.getIsData());
|
||||
//
|
||||
// detectionData = JSON.parseObject(b.toString(), DetectionData.class);
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Standard", detectionData.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Test", detectionData.getData());
|
||||
// isDataList.add(detectionData.getIsData());
|
||||
//
|
||||
// detectionData = JSON.parseObject(c.toString(), DetectionData.class);
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Standard", detectionData.getResultData());
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Test", detectionData.getData());
|
||||
// isDataList.add(detectionData.getIsData());
|
||||
// }
|
||||
//
|
||||
// resultMap.putIfAbsent(dictTree.getCode() + "_" + i + "_Result", getResultStr(isDataList.stream().allMatch(data -> data == 1) ? 1 : (isDataList.stream().anyMatch(data -> data == 2) ? 2 : 4)));
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return resultMap;
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user