fix(自定义对比): 78403
This commit is contained in:
+29
-2
@@ -446,7 +446,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
|
||||
if (i == 2){
|
||||
// 特点列
|
||||
createFeatureColumn(standardVOS, featureList, indexRow, indexCell, cellStyle);
|
||||
createFeatureColumn(standardVOS, featureList, indexRow, indexCell, cellStyle, sheet);
|
||||
}else {
|
||||
// 普通列
|
||||
/**
|
||||
@@ -467,10 +467,14 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
&& Objects.equals(standardVO.getId(), v.getStandardId())
|
||||
&& Objects.equals(compareList.get(finalI - 3).getId(), v.getCompareItemId()))
|
||||
.findFirst();
|
||||
int finalIndex = index;
|
||||
cellOptional.ifPresent(v -> {
|
||||
cell.setCellValue(v.getContent());
|
||||
// 处理文件
|
||||
writeFile(v);
|
||||
// 对比分析结果
|
||||
int allSize = featureList.size() * standardVOS.size();
|
||||
setCompareResult(finalIndex, allSize, indexRow, compareList, cellStyle, finalI);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -478,6 +482,18 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
}
|
||||
}
|
||||
|
||||
private void setCompareResult(int finalIndex, int allSize, Row indexRow, List<LawsCustomCompareInventory> compareList, CellStyle cellStyle, int finalI) {
|
||||
// 最后一列
|
||||
if (finalIndex == allSize){
|
||||
// 对比分析结果
|
||||
Cell cellEnd = indexRow.createCell(finalIndex + 1);
|
||||
cellEnd.setCellStyle(cellStyle);
|
||||
if (StringUtils.isNotBlank(compareList.get(finalI - 3).getCompareResult())){
|
||||
cellEnd.setCellValue(compareList.get(finalI - 3).getCompareResult());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeFile(LawsCustomCompareCell v) {
|
||||
if (StringUtils.isNotBlank(v.getFileId())){
|
||||
OSSFile ossFile = iossFileService.getById(v.getFileId());
|
||||
@@ -528,7 +544,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
* }
|
||||
*/
|
||||
|
||||
private static void createFeatureColumn(List<StandardVO> standardVOS, List<LawsCustomCompareInventory> featureList, Row indexRow, Cell indexCell, CellStyle cellStyle) {
|
||||
private static void createFeatureColumn(List<StandardVO> standardVOS, List<LawsCustomCompareInventory> featureList, Row indexRow, Cell indexCell, CellStyle cellStyle, XSSFSheet sheet) {
|
||||
indexCell.setCellValue("特点/对比项");
|
||||
// 计算列数量
|
||||
int index = 0;
|
||||
@@ -539,6 +555,17 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
Cell cell = indexRow.createCell(index);
|
||||
cell.setCellValue(lawsCustomCompareInventory.getCellTitle());
|
||||
cell.setCellStyle(cellStyle);
|
||||
|
||||
// 对比分析结果
|
||||
if (index == featureList.size() * standardVOS.size()){
|
||||
Row row = sheet.getRow(0);
|
||||
Cell cellEnd = row.createCell(index + 1);
|
||||
cellEnd.setCellStyle(cellStyle);
|
||||
cellEnd.setCellValue("对比分析结果");
|
||||
// 合并单元格
|
||||
CellRangeAddress region = new CellRangeAddress(0, 2, index + 1, index + 1);
|
||||
sheet.addMergedRegionUnsafe(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user