fix(自定义对比): 模块功能完善
This commit is contained in:
+57
-28
@@ -183,43 +183,66 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
|||||||
}
|
}
|
||||||
saveOrUpdate(lawsCustomCompareInfo);
|
saveOrUpdate(lawsCustomCompareInfo);
|
||||||
|
|
||||||
// 处理自定义对比_标准 关联表
|
// 自定义对比_标准 旧数据
|
||||||
// 删除数据
|
List<LawsCustomCompareInfoStandard> oldData = lawsCustomCompareInfoStandardService.list(
|
||||||
lawsCustomCompareInfoStandardService.remove(
|
|
||||||
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
|
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
|
||||||
.eq(LawsCustomCompareInfoStandard::getInfoId, lawsCustomCompareInfo.getId()));
|
.eq(LawsCustomCompareInfoStandard::getInfoId, lawsCustomCompareInfo.getId()));
|
||||||
// 更新数据
|
|
||||||
|
// 自定义对比_标准 处理数据
|
||||||
StandardVO standardVO = new StandardVO();
|
StandardVO standardVO = new StandardVO();
|
||||||
standardVO.setStandardNumbers(standardSaveVO.getStandardNumber());
|
standardVO.setStandardNumbers(standardSaveVO.getStandardNumber());
|
||||||
|
// 查询勾选标准
|
||||||
List<StandardVO> standardVOS = queryStandardList(standardVO);
|
List<StandardVO> standardVOS = queryStandardList(standardVO);
|
||||||
|
// 数据拷贝
|
||||||
List<LawsCustomCompareInfoStandard> lawsCustomCompareInfoStandards = BeanCopyUtils.copyBeanList(standardVOS, LawsCustomCompareInfoStandard.class);
|
List<LawsCustomCompareInfoStandard> lawsCustomCompareInfoStandards = BeanCopyUtils.copyBeanList(standardVOS, LawsCustomCompareInfoStandard.class);
|
||||||
|
|
||||||
|
// 收集数据id集合
|
||||||
|
List<String> infoStandardIdList = new ArrayList<>();
|
||||||
|
// 收集标准id集合
|
||||||
|
List<String> standardIdList = new ArrayList<>();
|
||||||
for (LawsCustomCompareInfoStandard lawsCustomCompareInfoStandard : lawsCustomCompareInfoStandards) {
|
for (LawsCustomCompareInfoStandard lawsCustomCompareInfoStandard : lawsCustomCompareInfoStandards) {
|
||||||
String standardId = lawsCustomCompareInfoStandard.getId();
|
String standardId = lawsCustomCompareInfoStandard.getId();
|
||||||
String snowflakeId = String.valueOf(SnowflakeUtils.snowflake());
|
String snowflakeId = String.valueOf(SnowflakeUtils.snowflake());
|
||||||
// 自定义对比单元格数据更新
|
// 是否已存在此标准 存在更新,不存在新增
|
||||||
lawsCustomCompareCellService.update(
|
Optional<LawsCustomCompareInfoStandard> optional = oldData.stream().filter(v -> v.getStandardId().equals(lawsCustomCompareInfoStandard.getId())).findFirst();
|
||||||
new LambdaUpdateWrapper<LawsCustomCompareCell>()
|
if (optional.isPresent()){
|
||||||
.eq(LawsCustomCompareCell::getInfoId, lawsCustomCompareInfo.getId())
|
lawsCustomCompareInfoStandard.setId(optional.get().getId());
|
||||||
.eq(LawsCustomCompareCell::getStandardId, lawsCustomCompareInfoStandard.getId())
|
}else {
|
||||||
.set(LawsCustomCompareCell::getStandardId, snowflakeId));
|
lawsCustomCompareInfoStandard.setId(snowflakeId);
|
||||||
|
}
|
||||||
lawsCustomCompareInfoStandard.setId(snowflakeId);
|
infoStandardIdList.add(lawsCustomCompareInfoStandard.getId());
|
||||||
lawsCustomCompareInfoStandard.setInfoId(lawsCustomCompareInfo.getId());
|
lawsCustomCompareInfoStandard.setInfoId(lawsCustomCompareInfo.getId());
|
||||||
lawsCustomCompareInfoStandard.setStandardId(standardId);
|
lawsCustomCompareInfoStandard.setStandardId(standardId);
|
||||||
|
standardIdList.add(standardId);
|
||||||
lawsCustomCompareInfoStandard.setCreateBy("");
|
lawsCustomCompareInfoStandard.setCreateBy("");
|
||||||
lawsCustomCompareInfoStandard.setCreateTime(null);
|
lawsCustomCompareInfoStandard.setCreateTime(null);
|
||||||
lawsCustomCompareInfoStandard.setUpdateBy("");
|
lawsCustomCompareInfoStandard.setUpdateBy("");
|
||||||
lawsCustomCompareInfoStandard.setUpdateTime(null);
|
lawsCustomCompareInfoStandard.setUpdateTime(null);
|
||||||
lawsCustomCompareInfoStandardService.save(lawsCustomCompareInfoStandard);
|
lawsCustomCompareInfoStandardService.saveOrUpdate(lawsCustomCompareInfoStandard);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自定义对比单元格 删除
|
// 删除旧数据
|
||||||
String ids = standardVOS.stream().map(StandardVO::getId).collect(Collectors.joining(","));
|
if (standardVOS.isEmpty()){
|
||||||
lawsCustomCompareCellService.remove(
|
// 自定义对比_标准 删除
|
||||||
new LambdaUpdateWrapper<LawsCustomCompareCell>()
|
lawsCustomCompareInfoStandardService.remove(
|
||||||
.eq(LawsCustomCompareCell::getInfoId, lawsCustomCompareInfo.getId())
|
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
|
||||||
.notIn(LawsCustomCompareCell::getStandardId, ids));
|
.eq(LawsCustomCompareInfoStandard::getInfoId, lawsCustomCompareInfo.getId()));
|
||||||
|
// 自定义对比单元格 删除
|
||||||
|
lawsCustomCompareCellService.remove(
|
||||||
|
new LambdaUpdateWrapper<LawsCustomCompareCell>()
|
||||||
|
.eq(LawsCustomCompareCell::getInfoId, lawsCustomCompareInfo.getId()));
|
||||||
|
}else {
|
||||||
|
// 自定义对比_标准 删除
|
||||||
|
lawsCustomCompareInfoStandardService.remove(
|
||||||
|
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
|
||||||
|
.eq(LawsCustomCompareInfoStandard::getInfoId, lawsCustomCompareInfo.getId())
|
||||||
|
.notIn(LawsCustomCompareInfoStandard::getId, infoStandardIdList));
|
||||||
|
// 自定义对比单元格 删除
|
||||||
|
lawsCustomCompareCellService.remove(
|
||||||
|
new LambdaUpdateWrapper<LawsCustomCompareCell>()
|
||||||
|
.eq(LawsCustomCompareCell::getInfoId, lawsCustomCompareInfo.getId())
|
||||||
|
.notIn(LawsCustomCompareCell::getStandardId, standardIdList));
|
||||||
|
}
|
||||||
return lawsCustomCompareInfo.getId();
|
return lawsCustomCompareInfo.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,10 +560,13 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
|||||||
indexCell.setCellStyle(cellStyle);
|
indexCell.setCellStyle(cellStyle);
|
||||||
// 特点数量
|
// 特点数量
|
||||||
int featureSize = featureList.size();
|
int featureSize = featureList.size();
|
||||||
// 合并单元格(参数说明:起始行,结束行,起始列,结束列)
|
// 只有一个单元格则不合并
|
||||||
CellRangeAddress region = new CellRangeAddress(1, 1, index.get() + nextMergeFirst.get(), index.get() + featureSize - 1 + nextMergeFirst.get());
|
if ((index.get() + nextMergeFirst.get()) != (index.get() + featureSize - 1 + nextMergeFirst.get())){
|
||||||
nextMergeFirst.set(featureSize - 1);
|
// 合并单元格(参数说明:起始行,结束行,起始列,结束列)
|
||||||
sheet.addMergedRegionUnsafe(region);
|
CellRangeAddress region = new CellRangeAddress(1, 1, index.get() + nextMergeFirst.get(), index.get() + featureSize - 1 + nextMergeFirst.get());
|
||||||
|
sheet.addMergedRegionUnsafe(region);
|
||||||
|
nextMergeFirst.set(featureSize - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,10 +595,13 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
|||||||
Cell indexCell = headerRow.createCell(index.get() + nextMergeFirst.get());
|
Cell indexCell = headerRow.createCell(index.get() + nextMergeFirst.get());
|
||||||
indexCell.setCellValue(k);
|
indexCell.setCellValue(k);
|
||||||
indexCell.setCellStyle(cellStyle);
|
indexCell.setCellStyle(cellStyle);
|
||||||
// 合并单元格(参数说明:起始行,结束行,起始列,结束列)
|
// 只有一个单元格则不合并
|
||||||
CellRangeAddress region = new CellRangeAddress(0, 0, index.get() + nextMergeFirst.get(), index.get() + nextMergeFirst.get() + merge - 1);
|
if ((index.get() + nextMergeFirst.get()) != (index.get() + nextMergeFirst.get() + merge - 1)){
|
||||||
nextMergeFirst.set(merge - 1);
|
// 合并单元格(参数说明:起始行,结束行,起始列,结束列)
|
||||||
sheet.addMergedRegion(region);
|
CellRangeAddress region = new CellRangeAddress(0, 0, index.get() + nextMergeFirst.get(), index.get() + nextMergeFirst.get() + merge - 1);
|
||||||
|
sheet.addMergedRegion(region);
|
||||||
|
nextMergeFirst.set(merge - 1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user