@@ -74,6 +74,7 @@ import java.nio.file.Files;
import java.nio.file.Path ;
import java.nio.file.Path ;
import java.nio.file.Paths ;
import java.nio.file.Paths ;
import java.util.* ;
import java.util.* ;
import java.util.regex.Pattern ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
import java.util.stream.Stream ;
import java.util.stream.Stream ;
@@ -94,6 +95,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
@Value ( " ${report.reportDir:D: \\ report} " )
@Value ( " ${report.reportDir:D: \\ report} " )
private String reportPath ;
private String reportPath ;
private final String RED = " FF0000 " ;
private final String BLACK = " 000000 " ;
private final IPqDevService iPqDevService ;
private final IPqDevService iPqDevService ;
private final IDictDataService dictDataService ;
private final IDictDataService dictDataService ;
@@ -134,8 +138,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
pqReportVO . setBaseFileVO ( baseFileVo ) ;
pqReportVO . setBaseFileVO ( baseFileVo ) ;
PqReportVO . FileVO detailFileVo = new PqReportVO . FileVO ( ) ;
PqReportVO . FileVO detailFileVo = new PqReportVO . FileVO ( ) ;
detailFileVo . setName ( pqReport . getBase Path ( ) . substring ( pqReport . getBase Path ( ) . lastIndexOf ( File . separator ) + 1 ) ) ;
detailFileVo . setName ( pqReport . getDetail Path ( ) . substring ( pqReport . getDetail Path ( ) . lastIndexOf ( File . separator ) + 1 ) ) ;
detailFileVo . setUrl ( pqReport . getBase Path ( ) ) ;
detailFileVo . setUrl ( pqReport . getDetail Path ( ) ) ;
pqReportVO . setDetailFileVO ( detailFileVo ) ;
pqReportVO . setDetailFileVO ( detailFileVo ) ;
return pqReportVO ;
return pqReportVO ;
@@ -770,7 +774,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
}
/**
/**
* 获取map。 key为 检测大项code_大项ID , value为大 检测项下的所有index。
* 获取map。 key为 检测大项code_大项ID , value为检测大 项下的所有index。
*
*
* @param list
* @param list
*/
*/
@@ -810,21 +814,23 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
run . setFontFamily ( " 宋体 " ) ;
run . setFontFamily ( " 宋体 " ) ;
run . setBold ( true ) ;
run . setBold ( true ) ;
run . setFontSize ( 12 ) ;
run . setFontSize ( 12 ) ;
String s = key . split ( " _ " ) [ 0 ] ;
String msg = DicDataEnum . getMessageByCode ( s ) ;
if ( isHarm ) {
if ( isHarm ) {
run . setText ( key . split ( " _ " ) [ 0 ] + " 测量准确度(最大允许误差:± " + radius . split ( " _ " ) [ 1 ] + " ) " ) ;
run . setText ( msg + " 测量准确度(最大允许误差:± " + radius . split ( " _ " ) [ 1 ] + " ) " ) ;
} else {
} else {
run . setText ( key . split ( " _ " ) [ 0 ] + " 测量准确度(最大允许误差:± " + radius + " ) " ) ;
run . setText ( msg + " 测量准确度(最大允许误差:± " + radius + " ) " ) ;
}
}
XWPFTable table = g enerateTableHeaderZJ ( baseModelDocument , DicDataEnum . getEnumByCode ( key . split ( " _ " ) [ 0 ] ) ) ;
DicDataEnum enumByCode = DicDataEnum . getEnumByCode ( key . split ( " _ " ) [ 0 ] ) ;
XWPFTable table = generateTableHeaderZJ ( baseModelDocument , enumByCode ) ;
// 填写数据
// for (RawResultDataVO rawResultDataVO : radiusMap.get(radius)) {
//
// }
paragraph = baseModelDocument . createParagraph ( ) ;
// 生成表体
generateTableBodyZJ ( table , radiusMap . get ( radius ) , enumByCode ) ;
}
}
}
}
/**
/**
* 获取同一个检测大项下不同的误差范围,及其检测结果
* 获取同一个检测大项下不同的误差范围,及其检测结果
*
*
@@ -883,207 +889,207 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
switch ( checkItem ) {
switch ( checkItem ) {
case FREQ : // 用于 频率
case FREQ : // 用于 频率
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值( HZ) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 给定值( HZ) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值( HZ) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 测试值( HZ) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差( HZ) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 误差( HZ) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 25.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case V : // 用于 电压
case V : // 用于 电压
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值( V) " , " 15.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 给定值( V) " , " 15.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值( V) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值( V) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case I : // 用于 电流
case I : // 用于 电流
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值( A) " , " 15.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 给定值( A) " , " 15.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case IMBV : // 用于 负序电压不平衡度、负序电流不平衡度
case IMBV : // 用于 负序电压不平衡度、负序电流不平衡度
case IMBA :
case IMBA :
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值(%) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 给定值(%) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值(%) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 测试值(%) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 25.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 25.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 25.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case F : // 用于 短时闪变
case F : // 用于 短时闪变
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值 " , " 15.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 给定值 " , " 15.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值 " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值 " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 10.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 15.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case HV : // 用于 谐波电压
case HV : // 用于 谐波电压
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 谐波次数 " , " 7.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 谐波次数 " , " 7.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 谐波电压给定值(%) " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 谐波电压给定值(%) " , " 10.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 8.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 8.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case HI : // 用于 谐波电流
case HI : // 用于 谐波电流
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 谐波次数 " , " 8.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 谐波次数 " , " 8.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 谐波电流给定值( A) " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 谐波电流给定值( A) " , " 10.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case HSV : // 用于 间谐波电压
case HSV : // 用于 间谐波电压
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 间谐波次数 " , " 8.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 间谐波次数 " , " 8.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 间谐波电压给定值(%) " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 间谐波电压给定值(%) " , " 10.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case HSI : // 用于 间谐波电流
case HSI : // 用于 间谐波电流
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 间谐波次数 " , " 8.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 间谐波次数 " , " 8.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 间谐波电流给定值( A) " , " 10.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 间谐波电流给定值( A) " , " 10.0% " , 2 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 测试值( A) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 ) ) ;
row . add ( new CellEntity ( " 误差(%) " , " 12.5% " , 1 , 3 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 ) ) ;
row . add ( new CellEntity ( " 结论 " , " 7.0% " , 2 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 8.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 10.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L1 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L2 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " L3 " , " 12.5% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 7.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
case VOLTAGE : // 用于 电压暂降、暂升及短时中断
case VOLTAGE : // 用于 电压暂降、暂升及短时中断
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 给定值 " , " 16.0% " , 1 , 2 ) ) ;
row . add ( new CellEntity ( " 给定值 " , " 16.0% " , 1 , 2 , BLACK )) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 测试值 " , " 16.0% " , 1 , 2 ) ) ;
row . add ( new CellEntity ( " 测试值 " , " 16.0% " , 1 , 2 , BLACK )) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 误差 " , " 16.0% " , 1 , 2 ) ) ;
row . add ( new CellEntity ( " 误差 " , " 16.0% " , 1 , 2 , BLACK )) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " " , " 16.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
row = new ArrayList < > ( ) ;
row = new ArrayList < > ( ) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 特征幅值(%) " , " 16.0% " , 1 , 1 , BLACK )) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 ) ) ;
row . add ( new CellEntity ( " 持续时间( ms) " , " 16.0% " , 1 , 1 , BLACK )) ;
rows . add ( row ) ;
rows . add ( row ) ;
break ;
break ;
default :
default :
@@ -1091,17 +1097,32 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
}
return generateTableHeader ( doc , rows ) ;
return generateTable ( doc , rows , true );
}
}
/**
/**
* 动态生成表格头部
* 根据数据生成表体部分
*
* @param table
* @param rawResultDataVOS
* @param enumByCode
* @return
*/
private XWPFTable generateTableBodyZJ ( XWPFTable table , List < RawResultDataVO > rawResultDataVOS , DicDataEnum enumByCode ) {
// 组装数据
List < List < CellEntity > > rows = getTableBodyDataZJ ( rawResultDataVOS , enumByCode ) ;
return table ;
}
/**
* 动态生成表格
*
*
* @param doc
* @param doc
* @param rows 表头数据
* @param rows 表头数据
* @param isHeader 是否是表头
* @return 生成的表格
* @return 生成的表格
*/
*/
private XWPFTable generateTableHeader ( XWPFDocument doc , List < List < CellEntity > > rows ) {
private XWPFTable generateTable ( XWPFDocument doc , List < List < CellEntity > > rows , boolean isHeader ) {
XWPFTable table = doc . createTable ( rows . size ( ) , rows . get ( 0 ) . size ( ) ) ;
XWPFTable table = doc . createTable ( rows . size ( ) , rows . get ( 0 ) . size ( ) ) ;
table . setTableAlignment ( TableRowAlign . CENTER ) ;
table . setTableAlignment ( TableRowAlign . CENTER ) ;
table . setWidth ( " 100% " ) ;
table . setWidth ( " 100% " ) ;
@@ -1116,9 +1137,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
for ( int j = 0 ; j < rows . get ( i ) . size ( ) ; j + + ) {
for ( int j = 0 ; j < rows . get ( i ) . size ( ) ; j + + ) {
CellEntity cellEntity = rows . get ( i ) . get ( j ) ;
CellEntity cellEntity = rows . get ( i ) . get ( j ) ;
row . getCell ( j ) . setText ( cellEntity . getCellValue ( ) ) ;
row . getCell ( j ) . setWidth ( cellEntity . getWidth ( ) ) ;
row . getCell ( j ) . setWidth ( cellEntity . getWidth ( ) ) ;
setHeaderCellStyle ( row . getCell ( j ) ) ;
if ( isHeader ) {
setCommonCellStyle ( row . getCell ( j ) , cellEntity , true ) ;
} else {
setCommonCellStyle ( row . getCell ( j ) , cellEntity , false ) ;
}
if ( cellEntity . getColSpan ( ) > 1 ) {
if ( cellEntity . getColSpan ( ) > 1 ) {
mergeCellsHorizontal ( table , i , j , j + cellEntity . getColSpan ( ) - 1 ) ;
mergeCellsHorizontal ( table , i , j , j + cellEntity . getColSpan ( ) - 1 ) ;
@@ -1131,6 +1155,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
return table ;
return table ;
}
}
/**
* 获取表体数据
*
* @param resultDataVOList
* @param checkItem
* @return
*/
private List < List < CellEntity > > getTableBodyDataZJ ( List < RawResultDataVO > resultDataVOList , DicDataEnum checkItem ) {
List < List < CellEntity > > rows = new ArrayList < > ( ) ;
List < CellEntity > row = null ;
switch ( checkItem ) {
case FREQ :
for ( RawResultDataVO resultDataVO : resultDataVOList ) {
row = new ArrayList < > ( ) ;
RawResultDataVO . DetectionData dataT = resultDataVO . getDataT ( ) ;
row . add ( new CellEntity ( dataT . getResultData ( ) + " " , " 25.0% " , 1 , 1 , BLACK ) ) ;
row . add ( new CellEntity ( dataT . getData ( ) + " " , " 25.0% " , 1 , 1 , BLACK ) ) ;
row . add ( new CellEntity ( dataT . getRadius ( ) + " " , " 25.0% " , 1 , 1 , BLACK ) ) ;
row . add ( new CellEntity ( getResultStr ( resultDataVO . getIsData ( ) ) + " " , " 25.0% " , 1 , 1 , resultDataVO . getIsData ( ) = = 1 ? BLACK : RED ) ) ;
rows . add ( row ) ;
}
break ;
default :
break ;
}
return rows ;
}
public CTTcPr getTcPr ( XWPFTableCell cell ) {
public CTTcPr getTcPr ( XWPFTableCell cell ) {
return cell . getCTTc ( ) . isSetTcPr ( ) ? cell . getCTTc ( ) . getTcPr ( ) : cell . getCTTc ( ) . addNewTcPr ( ) ;
return cell . getCTTc ( ) . isSetTcPr ( ) ? cell . getCTTc ( ) . getTcPr ( ) : cell . getCTTc ( ) . addNewTcPr ( ) ;
}
}
@@ -1177,23 +1229,28 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
}
}
}
public void setHeader CellStyle ( XWPFTableCell cell ) {
public void setCommon CellStyle ( XWPFTableCell cell , CellEntity cellEntity , boolean isBold ) {
cell . setVerticalAlignment ( XWPFTableCell . XWPFVertAlign . CENTER ) ;
cell . setVerticalAlignment ( XWPFTableCell . XWPFVertAlign . CENTER ) ;
XWPFParagraph xwpfParagraph = cell . getParagraphs ( ) . get ( 0 ) ;
XWPFParagraph xwpfParagraph = cell . getParagraphs ( ) . get ( 0 ) ;
xwpfParagraph . setAlignment ( ParagraphAlignment . CENTER ) ;
xwpfParagraph . setAlignment ( ParagraphAlignment . CENTER ) ;
// System.out.println("Paragraph text: " + xwpfParagraph.getText()) ;
List < XWPFRun > runs = xwpfParagraph . getRuns ( ) ;
// List< XWPFRun> runs = xwpfParagraph.getRuns() ;
XWPFRun run = null ;
// runs.get(0).setBold(true);
if ( runs . isEmpty ( ) ) {
// runs.get(0).setFontSize(10) ;
run = xwpfParagraph . createRun ( ) ;
// String text = runs.get(0).getText(0);
} else {
// if (StrUtil.isNotBlank(text) && Pattern.matches("^[A-Za-z0-9]+$", text)) {
run = runs . get ( 0 ) ;
// runs.get(0).setFontFamily("Arial");
}
// } else {
run . setText ( cellEntity . getCellValue ( ) ) ;
// runs.get(0).setFontFamily("宋体") ;
run . setBold ( isBold ) ;
// }
run . setFontSize ( 10 ) ;
String text = run . getText ( 0 ) ;
if ( StrUtil . isNotBlank ( text ) & & Pattern . matches ( " ^[A-Za-z0-9]+$ " , text ) ) {
run . setFontFamily ( " Arial " ) ;
} else {
run . setFontFamily ( " 宋体 " ) ;
}
}
}
private void specialDealVoltage ( Map < String , String > dataModelMap , String symbol ) {
private void specialDealVoltage ( Map < String , String > dataModelMap , String symbol ) {
String value = dataModelMap . get ( symbol ) ;
String value = dataModelMap . get ( symbol ) ;
if ( Objects . nonNull ( value ) & & ! value . equals ( " / " ) ) {
if ( Objects . nonNull ( value ) & & ! value . equals ( " / " ) ) {
@@ -1407,4 +1464,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
throw new BusinessException ( ReportResponseEnum . REPORT_REPEATED ) ;
throw new BusinessException ( ReportResponseEnum . REPORT_REPEATED ) ;
}
}
}
}
private String getResultStr ( Integer isData ) {
if ( isData = = 1 ) {
return " 合格 " ;
}
if ( isData = = 2 ) {
return " 不合格 " ;
}
return " / " ;
}
}
}