增加回路额定电流描述
This commit is contained in:
@@ -1167,6 +1167,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
Integer monitorNum = next.getKey();
|
||||
// 线路下的指标数据
|
||||
List<ContrastTestResult> contrastTestResults = next.getValue();
|
||||
PqMonitor pqMonitor = pqMonitorService.getByDevAndNum(pqDevVO.getId(), monitorNum);
|
||||
// 插入回路号前,先换个页
|
||||
todoInsertList.add(Docx4jUtil.createPageBreakParagraph());
|
||||
// 回路标题
|
||||
@@ -1181,7 +1182,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 根据code获取对应需要填充的内容
|
||||
List<Docx4jUtil.HeadingContent> tempContent = contentMap.get(scriptCode);
|
||||
// 需要区分下谐波类和非谐波类
|
||||
List<Object> tempList = fillContentInTemplateContrast(tempContent, factory, contrastTestResult);
|
||||
List<Object> tempList = fillContentInTemplateContrast(tempContent, factory, contrastTestResult, pqMonitor);
|
||||
todoInsertList.addAll(tempList);
|
||||
scriptIndex++;
|
||||
}
|
||||
@@ -1637,7 +1638,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<Object> fillContentInTemplateContrast(List<Docx4jUtil.HeadingContent> tempContent, ObjectFactory factory, ContrastTestResult contrastTestResult) {
|
||||
private List<Object> fillContentInTemplateContrast(List<Docx4jUtil.HeadingContent> tempContent, ObjectFactory factory, ContrastTestResult contrastTestResult, PqMonitor pqMonitor) {
|
||||
List<Object> todoInsertList = new ArrayList<>();
|
||||
Docx4jUtil.HeadingContent headingContent = tempContent.get(0);
|
||||
List<String> tableKeys = Docx4jUtil.getTableFillKeys(tempContent);
|
||||
@@ -1751,9 +1752,47 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 纵向表格暂不考虑
|
||||
}
|
||||
|
||||
// 如果存在特殊说明,在表格后添加一个段落
|
||||
StringBuilder description = new StringBuilder();
|
||||
if (contrastTestResult.getScriptCode().equalsIgnoreCase("I")) {
|
||||
// 获取该通道的额定电流
|
||||
String ct = pqMonitor.getCt();
|
||||
// 理论上ct是 xxx:xxx的格式。比如10:1,100:5
|
||||
if (ct.indexOf(":") > 0) {
|
||||
String[] ctArray = ct.split(":");
|
||||
description.append("注:当前回路额定电流为:").append(ctArray[1]).append("A。");
|
||||
}
|
||||
} else if (contrastTestResult.getScriptCode().equalsIgnoreCase("V")) {
|
||||
// 获取该通道的额定电压
|
||||
String pt = pqMonitor.getPt();
|
||||
// 理论上pt是 xxx:xxx的格式。比如380:380,10000:100
|
||||
if (pt.indexOf(":") > 0) {
|
||||
String[] ptArray = pt.split(":");
|
||||
// 电压需要特殊处理下,处理为相电压值
|
||||
String voltage = ptArray[1];
|
||||
if (voltage.equalsIgnoreCase("100")) {
|
||||
voltage = "57.74";
|
||||
} else if (voltage.equalsIgnoreCase("380")) {
|
||||
voltage = "220";
|
||||
} else {
|
||||
// 其他场景下就除以根号3
|
||||
double result = Double.parseDouble(voltage) / Math.sqrt(3);
|
||||
voltage = doubleRound(2, result);
|
||||
}
|
||||
description.append("注:当前回路额定电流为:").append(voltage).append("V。");
|
||||
}
|
||||
}
|
||||
|
||||
// 如果存在特殊说明,在表格后添加一个段落 如果有电压和电流需要把额定电压和电流标注进来 pqMonitor
|
||||
if (StrUtil.isNotBlank(contrastTestResult.getSpecialCase()) || StrUtil.isNotBlank(description.toString())) {
|
||||
P specialCaseP;
|
||||
if (StrUtil.isNotBlank(description.toString())) {
|
||||
if (StrUtil.isNotBlank(contrastTestResult.getSpecialCase())) {
|
||||
P specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, contrastTestResult.getSpecialCase());
|
||||
description.append(contrastTestResult.getSpecialCase().replace("注:", ""));
|
||||
}
|
||||
specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, description.toString());
|
||||
} else {
|
||||
specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, contrastTestResult.getSpecialCase());
|
||||
}
|
||||
todoInsertList.add(specialCaseP);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user