1.浙江无线报表修改
This commit is contained in:
@@ -46,6 +46,9 @@ public class ReportTemplateDTO {
|
|||||||
*/
|
*/
|
||||||
private String resourceId;
|
private String resourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识指标是否越限 0.否 1.是
|
||||||
|
*/
|
||||||
private Integer overLimitFlag;
|
private Integer overLimitFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.njcn.harmonic.mapper.ExcelRptTempMapper;
|
|||||||
import com.njcn.harmonic.pojo.dto.ReportTemplateDTO;
|
import com.njcn.harmonic.pojo.dto.ReportTemplateDTO;
|
||||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||||
import com.njcn.harmonic.pojo.param.ReportTemplateParam;
|
import com.njcn.harmonic.pojo.param.ReportTemplateParam;
|
||||||
|
import com.njcn.harmonic.utils.DataChangeUtil;
|
||||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
@@ -103,11 +104,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final CommonService commonService;
|
|
||||||
|
|
||||||
private final DeviceUnitClient deviceUnitClient;
|
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final DeptFeignClient deptFeignClient;
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
private final InfluxDbUtils influxDbUtils;
|
||||||
@@ -566,7 +564,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sql.append(StrPool.C_SPACE);
|
sql.append(StrPool.C_SPACE);
|
||||||
String temS = data.get(0).getResourceId().replace("r_stat_data", "day").replace("_d","");
|
String temS = data.get(0).getResourceId().replace("r_stat_data", "day").replace("_d", "");
|
||||||
sql.append(InfluxDbSqlConstant.FROM).append(temS);
|
sql.append(InfluxDbSqlConstant.FROM).append(temS);
|
||||||
|
|
||||||
sql.append(InfluxDbSqlConstant.WHERE)
|
sql.append(InfluxDbSqlConstant.WHERE)
|
||||||
@@ -617,7 +615,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
List<Map<String, Object>> mapList = influxDbUtils.getMapResult(sql.toString());
|
List<Map<String, Object>> mapList = influxDbUtils.getMapResult(sql.toString());
|
||||||
long b = System.currentTimeMillis();
|
long b = System.currentTimeMillis();
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
System.out.println("当前sql执行了:"+(b-a)+"ms");
|
System.out.println("当前sql执行了:" + (b - a) + "ms");
|
||||||
if (CollUtil.isEmpty(mapList)) {
|
if (CollUtil.isEmpty(mapList)) {
|
||||||
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
@@ -819,11 +817,10 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
|
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
|
||||||
|
//定义一个线程集合
|
||||||
List<Future<?>> futures = new ArrayList<>();
|
List<Future<?>> futures = new ArrayList<>();
|
||||||
|
|
||||||
long begin = System.currentTimeMillis();
|
long begin = System.currentTimeMillis();
|
||||||
|
|
||||||
//根据content,获取v值并进行处理
|
|
||||||
//指标
|
//指标
|
||||||
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
||||||
//限值
|
//限值
|
||||||
@@ -838,10 +835,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long temEnd = System.currentTimeMillis();
|
long temEnd = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
//处理指标是否合格
|
//处理指标是否合格
|
||||||
reportLimitList = new LinkedHashSet<>(reportLimitList).stream().sorted(Comparator.comparing(ReportTemplateDTO::getItemName)).collect(Collectors.toList());
|
reportLimitList = new LinkedHashSet<>(reportLimitList).stream().sorted(Comparator.comparing(ReportTemplateDTO::getItemName)).collect(Collectors.toList());
|
||||||
Map<String, Float> limitMap = overLimitDeal(reportLimitList, reportSearchParam);
|
Map<String, Float> limitMap = overLimitDeal(reportLimitList, reportSearchParam);
|
||||||
@@ -860,6 +855,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
classMap.forEach((classKey, templateValue) -> {
|
classMap.forEach((classKey, templateValue) -> {
|
||||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||||
|
//每张表开启一个独立线程查询
|
||||||
futures.add(executorService.submit(() -> {
|
futures.add(executorService.submit(() -> {
|
||||||
//avg.max,min,cp95
|
//avg.max,min,cp95
|
||||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||||
@@ -884,7 +880,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 等待所有任务完成
|
// 等待所有任务完成
|
||||||
for (Future<?> future : futures) {
|
for (Future<?> future : futures) {
|
||||||
try {
|
try {
|
||||||
@@ -894,7 +889,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//处理指标最终判定合格还是不合格
|
//处理指标最终判定合格还是不合格
|
||||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||||
|
|
||||||
@@ -912,11 +906,12 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//1、根据itemName分组
|
//1、根据itemName分组
|
||||||
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
||||||
//处理台账信息
|
//处理台账信息
|
||||||
Map<String, String> terminalMap = null;
|
Map<String, String> finalTerminalMap;
|
||||||
if (CollUtil.isNotEmpty(terminalList)) {
|
if (CollUtil.isNotEmpty(terminalList)) {
|
||||||
terminalMap = commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData();
|
finalTerminalMap = commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData();
|
||||||
|
}else {
|
||||||
|
finalTerminalMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
Map<String, String> finalTerminalMap = terminalMap;
|
|
||||||
|
|
||||||
|
|
||||||
//2、把itemName的value赋给v和m
|
//2、把itemName的value赋给v和m
|
||||||
@@ -978,7 +973,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
if (nowDate.isAfter(localDate)) {
|
if (nowDate.isAfter(localDate)) {
|
||||||
son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + reportSearchParam.getEndTime() + localTime);
|
son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + reportSearchParam.getEndTime() + localTime);
|
||||||
} else {
|
} else {
|
||||||
localTime =" "+ LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
||||||
son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + nowDate + localTime);
|
son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + nowDate + localTime);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1168,6 +1163,11 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DictData pqdDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.PQD.getCode(), DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
||||||
|
List<EleEpdPqd> eleEpdPqdList = eleEpdMapper.selectList(new LambdaQueryWrapper<EleEpdPqd>().eq(EleEpdPqd::getDataType, pqdDic.getId()).isNotNull(EleEpdPqd::getPrimaryFormula));
|
||||||
|
Map<String, List<EleEpdPqd>> pqdMap = eleEpdPqdList.stream().filter(item -> StrUtil.isNotBlank(item.getPrimaryFormula())).collect(Collectors.groupingBy(EleEpdPqd::getName));
|
||||||
|
|
||||||
//处理指标是否合格
|
//处理指标是否合格
|
||||||
reportLimitList = new LinkedHashSet<>(reportLimitList)
|
reportLimitList = new LinkedHashSet<>(reportLimitList)
|
||||||
.stream()
|
.stream()
|
||||||
@@ -1178,15 +1178,16 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//存放限值指标的map
|
//存放限值指标的map
|
||||||
Map<String, ReportTemplateDTO> limitTargetMapX = reportLimitList.stream().collect(Collectors.toMap(ReportTemplateDTO::getItemName, Function.identity()));
|
Map<String, ReportTemplateDTO> limitTargetMapX = reportLimitList.stream().collect(Collectors.toMap(ReportTemplateDTO::getItemName, Function.identity()));
|
||||||
|
|
||||||
List<ReportTemplateDTO> endList = new ArrayList<>();
|
|
||||||
if (CollUtil.isNotEmpty(reportTemplateDTOList)) {
|
|
||||||
|
|
||||||
//组装最后监测点条件
|
//组装最后监测点条件
|
||||||
List<WlRecord> wlRecordList = wlRecordFeignClient.getWlAssByWlId(reportSearchParam.getLineId()).getData();
|
List<WlRecord> temList = wlRecordFeignClient.getWlAssByWlId(reportSearchParam.getLineId()).getData();
|
||||||
|
List<WlRecord> wlRecordList = temList.stream().filter(it -> it.getType() == 1).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(wlRecordList)) {
|
if (CollUtil.isEmpty(wlRecordList)) {
|
||||||
throw new BusinessException("当前测试项无测试数据");
|
throw new BusinessException("当前测试项无测试数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ReportTemplateDTO> endList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(reportTemplateDTOList)) {
|
||||||
|
|
||||||
//开始组织sql
|
//开始组织sql
|
||||||
reportTemplateDTOList = new LinkedHashSet<>(reportTemplateDTOList)
|
reportTemplateDTOList = new LinkedHashSet<>(reportTemplateDTOList)
|
||||||
.stream()
|
.stream()
|
||||||
@@ -1208,13 +1209,13 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList);
|
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList);
|
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList);
|
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList);
|
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1228,7 +1229,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
System.out.println("查询数据库花费时间" + (dealEnd - deal) / 1000 + "S");
|
System.out.println("查询数据库花费时间" + (dealEnd - deal) / 1000 + "S");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(endList)) {
|
if (CollUtil.isNotEmpty(endList)) {
|
||||||
long jie = System.currentTimeMillis();
|
long jie = System.currentTimeMillis();
|
||||||
//数据单位信息
|
//数据单位信息
|
||||||
@@ -1237,33 +1237,46 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//1、根据itemName分组
|
//1、根据itemName分组
|
||||||
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
Map<String, List<ReportTemplateDTO>> assMap = endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
||||||
//处理台账信息
|
//处理台账信息
|
||||||
/*Map<String, String> terminalMap = null;
|
Map<String, String> finalTerminalMap;
|
||||||
if (CollUtil.isNotEmpty(terminalList)) {
|
if (CollUtil.isNotEmpty(terminalList)) {
|
||||||
terminalMap = commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData();
|
if(Objects.nonNull(reportSearchParam.getCustomType()) && reportSearchParam.getCustomType() == 1){
|
||||||
}
|
WlRecord wlRecordMain = temList.stream().filter(it -> it.getType() == 0).collect(Collectors.toList()).get(0);
|
||||||
Map<String, String> finalTerminalMap = terminalMap;*/
|
finalTerminalMap = new HashMap<>();
|
||||||
|
finalTerminalMap.put("lineName",wlRecordMain.getItemName());
|
||||||
|
//finalTerminalMap.put("statis_time",wlRecordMain.getStartTime()+"_"+wlRecordMain.getEndTime());
|
||||||
|
finalTerminalMap.put("pt",wlRecordMain.getCt().toString());
|
||||||
|
finalTerminalMap.put("ct",wlRecordMain.getPt().toString());
|
||||||
|
|
||||||
|
finalTerminalMap.put("Standard_Capacity",wlRecordMain.getCapacitySi().toString());
|
||||||
|
finalTerminalMap.put("Short_Capacity",wlRecordMain.getCapacitySscmin().toString());
|
||||||
|
finalTerminalMap.put("Deal_Capacity",wlRecordMain.getCapacitySi().toString());
|
||||||
|
finalTerminalMap.put("Dev_Capacity",wlRecordMain.getCapacitySt().toString());
|
||||||
|
}else {
|
||||||
|
finalTerminalMap = commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
finalTerminalMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
//2、把itemName的value赋给v和m
|
//2、把itemName的value赋给v和m
|
||||||
dealExcelResult(jsonArray, assMap, unit);
|
dealExcelResult(jsonArray, assMap, unit,finalTerminalMap);
|
||||||
long jieEnd = System.currentTimeMillis();
|
long jieEnd = System.currentTimeMillis();
|
||||||
|
|
||||||
System.out.println("组装信息耗时 " + (jieEnd - jie) / 1000 + "S");
|
System.out.println("组装信息耗时 " + (jieEnd - jie) / 1000 + "S");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long daochu = System.currentTimeMillis();
|
long daochu = System.currentTimeMillis();
|
||||||
//导出自定义报表
|
//导出自定义报表
|
||||||
downReport(jsonArray, response);
|
downReport(jsonArray, response);
|
||||||
long daochuEnd = System.currentTimeMillis();
|
long daochuEnd = System.currentTimeMillis();
|
||||||
System.out.println("导出耗时 " + (daochuEnd - daochu) / 1000 + "S");
|
System.out.println("导出耗时 " + (daochuEnd - daochu) / 1000 + "S");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void assSqlZhejiang(List<ReportTemplateDTO> data, StringBuilder
|
private void assSqlZhejiang(List<ReportTemplateDTO> data, StringBuilder
|
||||||
sql, List<ReportTemplateDTO> endList, String method, ReportSearchParam
|
sql, List<ReportTemplateDTO> endList, String method, ReportSearchParam reportSearchParam, Map<String, ReportTemplateDTO> limitMap, Map<String, Float> overLimitMap, Map<String,
|
||||||
reportSearchParam, Map<String, ReportTemplateDTO> limitMap, Map<String, Float> overLimitMap, Map<String, ReportTemplateDTO> assNoPassMap, List<WlRecord> wlRecordList) {
|
ReportTemplateDTO> assNoPassMap, List<WlRecord> wlRecordList, Map<String, List<EleEpdPqd>> pqdMap) {
|
||||||
|
|
||||||
//sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
//sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
||||||
//cp95函数特殊处理 PERCENTILE(field_key, N)
|
//cp95函数特殊处理 PERCENTILE(field_key, N)
|
||||||
if (InfluxDbSqlConstant.PERCENTILE.equals(method)) {
|
if (InfluxDbSqlConstant.PERCENTILE.equals(method)) {
|
||||||
@@ -1336,6 +1349,23 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
List<Map<String, Object>> temMapList = influxDbUtils.getMapResult(temSql.toString());
|
List<Map<String, Object>> temMapList = influxDbUtils.getMapResult(temSql.toString());
|
||||||
if (CollUtil.isNotEmpty(temMapList)) {
|
if (CollUtil.isNotEmpty(temMapList)) {
|
||||||
|
Map<String, Object> tem = temMapList.get(0);
|
||||||
|
//需要吧测点为二次值的转换为一次值
|
||||||
|
if (wlRecord.getDataLevel().equals("Secondary")) {
|
||||||
|
for (Map.Entry<String, Object> entry : tem.entrySet()) {
|
||||||
|
if (Objects.nonNull(entry.getValue()) && !entry.getKey().equals("time")) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
double val = (double) entry.getValue();
|
||||||
|
String zi = key.substring(0, key.indexOf("#"));
|
||||||
|
if (pqdMap.containsKey(zi)) {
|
||||||
|
EleEpdPqd eleEpdPqd = pqdMap.get(zi).get(0);
|
||||||
|
double vRes = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), val / 1000, (double) wlRecord.getPt(), (double) wlRecord.getCt());
|
||||||
|
entry.setValue(vRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
allList.add(temMapList.get(0));
|
allList.add(temMapList.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1344,12 +1374,12 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
if (resultMap.isEmpty()) {
|
if (resultMap.isEmpty()) {
|
||||||
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
//遍历模板对查询出来的数据进行赋值
|
||||||
for (ReportTemplateDTO item : data) {
|
for (ReportTemplateDTO item : data) {
|
||||||
if (resultMap.containsKey(item.getItemName())) {
|
if (resultMap.containsKey(item.getItemName())) {
|
||||||
double v = (Double) resultMap.get(item.getItemName());
|
double v = (Double) resultMap.get(item.getItemName());
|
||||||
item.setValue(String.format("%.3f", v));
|
item.setValue(String.format("%.3f", v));
|
||||||
|
|
||||||
|
|
||||||
if (overLimitMap.containsKey(item.getLimitName())) {
|
if (overLimitMap.containsKey(item.getLimitName())) {
|
||||||
Float tagVal = overLimitMap.get(item.getLimitName());
|
Float tagVal = overLimitMap.get(item.getLimitName());
|
||||||
if (v > tagVal) {
|
if (v > tagVal) {
|
||||||
@@ -1384,6 +1414,12 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对多测点数据进行计算求出一组数据
|
||||||
|
* @param method
|
||||||
|
* @param allList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private Map<String, Object> dealResultMap(String method, List<Map<String, Object>> allList) {
|
private Map<String, Object> dealResultMap(String method, List<Map<String, Object>> allList) {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
// 遍历列表中的每个Map
|
// 遍历列表中的每个Map
|
||||||
@@ -1450,7 +1486,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
|
|
||||||
private void dealExcelResult(JSONArray
|
private void dealExcelResult(JSONArray
|
||||||
jsonArray, Map<String, List<ReportTemplateDTO>> assMap, Map<String, String> unit) {
|
jsonArray, Map<String, List<ReportTemplateDTO>> assMap, Map<String, String> unit,Map<String,String> finalTerminalMap) {
|
||||||
jsonArray.forEach(item -> {
|
jsonArray.forEach(item -> {
|
||||||
JSONObject jsonObject = (JSONObject) item;
|
JSONObject jsonObject = (JSONObject) item;
|
||||||
JSONArray itemArr = (JSONArray) jsonObject.get("celldata");
|
JSONArray itemArr = (JSONArray) jsonObject.get("celldata");
|
||||||
@@ -1491,18 +1527,18 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
son.set("fc", "#990000");
|
son.set("fc", "#990000");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /*else if (v.charAt(0) == '&') {
|
} else if (v.charAt(0) == '&') {
|
||||||
//结论
|
//结论
|
||||||
String tem = v.replace("&", "");
|
String tem = v.replace("&", "");
|
||||||
if (Objects.nonNull(finalTerminalMap)) {
|
if (Objects.nonNull(finalTerminalMap)) {
|
||||||
if ("statis_time".equals(tem)) {
|
if ("statis_time".equals(tem)) {
|
||||||
son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + reportSearchParam.getEndTime() + InfluxDbSqlConstant.END_TIME);
|
// son.set("v", reportSearchParam.getStartTime() + InfluxDbSqlConstant.START_TIME + "_" + reportSearchParam.getEndTime() + InfluxDbSqlConstant.END_TIME);
|
||||||
} else {
|
} else {
|
||||||
//台账信息
|
//台账信息
|
||||||
son.set("v", finalTerminalMap.getOrDefault(tem, "/"));
|
son.set("v", finalTerminalMap.getOrDefault(tem, "/"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/ else if (v.charAt(0) == '@' && v.contains("#")) {
|
} else if (v.charAt(0) == '@' && v.contains("#")) {
|
||||||
//解决数据单位问题 @指标#类型@
|
//解决数据单位问题 @指标#类型@
|
||||||
String replace = v.replace("@", "");
|
String replace = v.replace("@", "");
|
||||||
son.set("v", unit.getOrDefault(replace, "/"));
|
son.set("v", unit.getOrDefault(replace, "/"));
|
||||||
|
|||||||
Reference in New Issue
Block a user