fix: 法规复合型评估库导出
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@ public class LawsConformityAssessmentLibrary implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "多选用字段,逗号拼接")
|
@ApiModelProperty(value = "多选用字段,逗号拼接")
|
||||||
private String ids;
|
private String selections;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-2
@@ -95,7 +95,7 @@ public class LawsConformityAssessmentLibraryExportVO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 评估结果
|
* 评估结果
|
||||||
*/
|
*/
|
||||||
@Excel(name = "评估结果")
|
@Excel(name = "评估结果", dicCode = "evaluation_result")
|
||||||
@ApiModelProperty(value = "评估结果")
|
@ApiModelProperty(value = "评估结果")
|
||||||
private String result;
|
private String result;
|
||||||
|
|
||||||
@@ -158,8 +158,8 @@ public class LawsConformityAssessmentLibraryExportVO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 佐证材料
|
* 佐证材料
|
||||||
*/
|
*/
|
||||||
@ExcelCollection(name = "佐证材料")
|
|
||||||
@ApiModelProperty(value = "佐证材料")
|
@ApiModelProperty(value = "佐证材料")
|
||||||
|
@ExcelCollection(name = "")
|
||||||
private List<MaterialFile> materialFileList = Collections.emptyList();
|
private List<MaterialFile> materialFileList = Collections.emptyList();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-5
@@ -2,6 +2,7 @@ package com.jero.modules.assessmentLibrary.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
@@ -78,8 +79,8 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
if (StringUtils.isNotBlank(lawsConformityAssessmentLibrary.getApplicableMarket())) {
|
if (StringUtils.isNotBlank(lawsConformityAssessmentLibrary.getApplicableMarket())) {
|
||||||
queryWrapper.in("d.applicable_market", Arrays.asList(lawsConformityAssessmentLibrary.getApplicableMarket().split(",")));
|
queryWrapper.in("d.applicable_market", Arrays.asList(lawsConformityAssessmentLibrary.getApplicableMarket().split(",")));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(lawsConformityAssessmentLibrary.getIds())) {
|
if (StringUtils.isNotBlank(lawsConformityAssessmentLibrary.getSelections())) {
|
||||||
queryWrapper.in("cs.id", Arrays.asList(lawsConformityAssessmentLibrary.getIds().split(",")));
|
queryWrapper.in("cs.id", Arrays.asList(lawsConformityAssessmentLibrary.getSelections().split(",")));
|
||||||
}
|
}
|
||||||
queryWrapper.between(lawsConformityAssessmentLibrary.getValuationTime() != null,
|
queryWrapper.between(lawsConformityAssessmentLibrary.getValuationTime() != null,
|
||||||
"valuation_time", lawsConformityAssessmentLibrary.getStartValuationTime(), lawsConformityAssessmentLibrary.getEndValuationTime());
|
"valuation_time", lawsConformityAssessmentLibrary.getStartValuationTime(), lawsConformityAssessmentLibrary.getEndValuationTime());
|
||||||
@@ -134,6 +135,9 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
records.forEach(item -> {
|
records.forEach(item -> {
|
||||||
List<LawsConformityAssessmentLibraryDetail> lawsConformityAssessmentLibraryDetails = allDetailMap.get(item.getId());
|
List<LawsConformityAssessmentLibraryDetail> lawsConformityAssessmentLibraryDetails = allDetailMap.get(item.getId());
|
||||||
List<LawsConformityAssessmentLibraryExportVO> vos = BeanCopyUtils.copyBeanList(lawsConformityAssessmentLibraryDetails, LawsConformityAssessmentLibraryExportVO.class);
|
List<LawsConformityAssessmentLibraryExportVO> vos = BeanCopyUtils.copyBeanList(lawsConformityAssessmentLibraryDetails, LawsConformityAssessmentLibraryExportVO.class);
|
||||||
|
if (CollectionUtils.isEmpty(vos)) {
|
||||||
|
vos.add(new LawsConformityAssessmentLibraryExportVO());
|
||||||
|
}
|
||||||
vos.forEach(e -> {
|
vos.forEach(e -> {
|
||||||
e.setStandardNumber(item.getStandardNumber());
|
e.setStandardNumber(item.getStandardNumber());
|
||||||
e.setStandardName(item.getStandardName());
|
e.setStandardName(item.getStandardName());
|
||||||
@@ -148,9 +152,11 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
// 生成excel
|
// 生成excel
|
||||||
ExportParams exportParams = new ExportParams();
|
ExportParams exportParams = new ExportParams();
|
||||||
exportParams.setType(ExcelType.HSSF);
|
exportParams.setType(ExcelType.HSSF);
|
||||||
|
// 复制一份数据
|
||||||
|
List<LawsConformityAssessmentLibraryExportVO> newRecordsExport = new ArrayList<>(recordsExport);
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, LawsConformityAssessmentLibraryExportVO.class, recordsExport);
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, LawsConformityAssessmentLibraryExportVO.class, recordsExport);
|
||||||
// 生成超链接
|
// 生成超链接
|
||||||
generateHyperlink(recordsExport, workbook);
|
generateHyperlink(newRecordsExport, workbook);
|
||||||
// 导出excel
|
// 导出excel
|
||||||
workbook.write(fos);
|
workbook.write(fos);
|
||||||
// 生成并导出zip
|
// 生成并导出zip
|
||||||
@@ -180,8 +186,7 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
if (!Objects.isNull(vo.getMaterial()) && !vo.getMaterialFileList().isEmpty()) {
|
if (!Objects.isNull(vo.getMaterial()) && !vo.getMaterialFileList().isEmpty()) {
|
||||||
for (MaterialFile materialFile : vo.getMaterialFileList()) {
|
for (MaterialFile materialFile : vo.getMaterialFileList()) {
|
||||||
Row row = sheet.getRow(i);
|
Row row = sheet.getRow(i);
|
||||||
Cell cell = row.getCell(6);
|
Cell cell = row.getCell(18);
|
||||||
// 设置超链接 HYPERLINK("https://www.baidu.com", "百度")
|
|
||||||
cell.setCellFormula("HYPERLINK(\"" + materialFile.getFileName() + "\", \"" + materialFile.getFileName() + "\")");
|
cell.setCellFormula("HYPERLINK(\"" + materialFile.getFileName() + "\", \"" + materialFile.getFileName() + "\")");
|
||||||
cell.setCellStyle(cellStyle);
|
cell.setCellStyle(cellStyle);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user