楼下报告调整

This commit is contained in:
2025-02-24 11:02:59 +08:00
parent 496c7a7908
commit 837ea9e369

View File

@@ -3,6 +3,7 @@ package com.njcn.gather.report.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -31,6 +32,7 @@ import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.type.pojo.po.DevType;
import com.njcn.gather.type.service.IDevTypeService;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
@@ -191,7 +193,8 @@ public class ReportServiceImpl implements IReportService {
// 获取设备型号
baseModelMap.put("${devType}", devType.getName());
// 调试人员todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死
baseModelMap.put("${userName}", "管理员");
String userName = RequestUtil.getUserName();
baseModelMap.put("${userName}", userName);
// 调试日期
if (pqDevVO.getCheckTime() != null) {
baseModelMap.put("${testDate}", DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
@@ -351,7 +354,7 @@ public class ReportServiceImpl implements IReportService {
singleNonHarmParam.setSort(testItemIndex);
fillMapValueT(singleNonHarmParam, dataModelMap, "FREQ55");
// 谐波电压,少了基波 todo...
// 谐波电压
testItemIndex = 10;
pqScriptCheckDataService = "cce92410f1902897a61f644d875f2216";
// 获取数据
@@ -359,7 +362,7 @@ public class ReportServiceImpl implements IReportService {
singleNonHarmParam.setSort(testItemIndex);
fillMapValueHarm(singleNonHarmParam, dataModelMap, "Uha", "Uhb", "Uhc", 57.74, 100);
// 谐波电电流,少了基波 todo...
// 谐波电电流
testItemIndex = 11;
pqScriptCheckDataService = "3e5e384d38485ca4242152fba336de1d";
// 获取数据
@@ -409,42 +412,58 @@ public class ReportServiceImpl implements IReportService {
// 要处理 2 5 7 11 23 35 43 50
// 基波
dataModelMap.put("${" + aSymbol + "1}", devValue(adHarmonicResult.getAValue1(), 1, 1));
dataModelMap.put("${" + bSymbol + "1}", devValue(adHarmonicResult.getBValue1(), 1, 1));
dataModelMap.put("${" + cSymbol + "1}", devValue(adHarmonicResult.getCValue1(), 1, 1));
String aBase = devValue(adHarmonicResult.getAValue1(), 1, 1);
String bBase = devValue(adHarmonicResult.getBValue1(), 1, 1);
String cBase = devValue(adHarmonicResult.getCValue1(), 1, 1);
dataModelMap.put("${" + aSymbol + "1}", aBase);
dataModelMap.put("${" + bSymbol + "1}", bBase);
dataModelMap.put("${" + cSymbol + "1}", cBase);
double aBaseValue = baseValue;
double bBaseValue = baseValue;
double cBaseValue = baseValue;
dataModelMap.put("${" + aSymbol + "2}", devValue(adHarmonicResult.getAValue2(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "2}", devValue(adHarmonicResult.getBValue2(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "2}", devValue(adHarmonicResult.getCValue2(), baseValue, percent));
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("${" + aSymbol + "2}", devValue(adHarmonicResult.getAValue2(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "2}", devValue(adHarmonicResult.getBValue2(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "2}", devValue(adHarmonicResult.getCValue2(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "5}", devValue(adHarmonicResult.getAValue5(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "5}", devValue(adHarmonicResult.getBValue5(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "5}", devValue(adHarmonicResult.getCValue5(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "5}", devValue(adHarmonicResult.getAValue5(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "5}", devValue(adHarmonicResult.getBValue5(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "5}", devValue(adHarmonicResult.getCValue5(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "7}", devValue(adHarmonicResult.getAValue7(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "7}", devValue(adHarmonicResult.getBValue7(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "7}", devValue(adHarmonicResult.getCValue7(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "7}", devValue(adHarmonicResult.getAValue7(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "7}", devValue(adHarmonicResult.getBValue7(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "7}", devValue(adHarmonicResult.getCValue7(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "11}", devValue(adHarmonicResult.getAValue11(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "11}", devValue(adHarmonicResult.getBValue11(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "11}", devValue(adHarmonicResult.getCValue11(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "11}", devValue(adHarmonicResult.getAValue11(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "11}", devValue(adHarmonicResult.getBValue11(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "11}", devValue(adHarmonicResult.getCValue11(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "23}", devValue(adHarmonicResult.getAValue23(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "23}", devValue(adHarmonicResult.getBValue23(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "23}", devValue(adHarmonicResult.getCValue23(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "23}", devValue(adHarmonicResult.getAValue23(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "23}", devValue(adHarmonicResult.getBValue23(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "23}", devValue(adHarmonicResult.getCValue23(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "35}", devValue(adHarmonicResult.getAValue35(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "35}", devValue(adHarmonicResult.getBValue35(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "35}", devValue(adHarmonicResult.getCValue35(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "35}", devValue(adHarmonicResult.getAValue35(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "35}", devValue(adHarmonicResult.getBValue35(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "35}", devValue(adHarmonicResult.getCValue35(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "43}", devValue(adHarmonicResult.getAValue43(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "43}", devValue(adHarmonicResult.getBValue43(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "43}", devValue(adHarmonicResult.getCValue43(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "43}", devValue(adHarmonicResult.getAValue43(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "43}", devValue(adHarmonicResult.getBValue43(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "43}", devValue(adHarmonicResult.getCValue43(), cBaseValue, percent));
dataModelMap.put("${" + aSymbol + "50}", devValue(adHarmonicResult.getAValue50(), baseValue, percent));
dataModelMap.put("${" + bSymbol + "50}", devValue(adHarmonicResult.getBValue50(), baseValue, percent));
dataModelMap.put("${" + cSymbol + "50}", devValue(adHarmonicResult.getCValue50(), baseValue, percent));
dataModelMap.put("${" + aSymbol + "50}", devValue(adHarmonicResult.getAValue50(), aBaseValue, percent));
dataModelMap.put("${" + bSymbol + "50}", devValue(adHarmonicResult.getBValue50(), bBaseValue, percent));
dataModelMap.put("${" + cSymbol + "50}", devValue(adHarmonicResult.getCValue50(), cBaseValue, percent));
}
@@ -455,7 +474,7 @@ public class ReportServiceImpl implements IReportService {
if (Objects.nonNull(tempA) && Objects.nonNull(tempA.getData())) {
return doubleRound(4, (tempA.getData() / percent) * baseValue);
}
return "/";
return StrPool.SLASH;
}