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