fix(自定义对比): 78404、78403

This commit is contained in:
yjz
2023-11-14 15:23:04 +08:00
parent 70a7ddb2a5
commit 160dc54d45
5 changed files with 19 additions and 9 deletions
@@ -22,6 +22,9 @@ public class LawsCustomCompareInfo extends BaseEntity {
/**是否公开(1:是,0:否)*/ /**是否公开(1:是,0:否)*/
@ApiModelProperty(value = "是否公开(1:是,0:否)") @ApiModelProperty(value = "是否公开(1:是,0:否)")
private String isShow; private String isShow;
/**是否公开(1:是,0:否)*/
@ApiModelProperty(value = "是否隐藏表格(1:是 0:否)")
private String hiddenTable;
/**操作人*/ /**操作人*/
@ApiModelProperty(value = "操作人") @ApiModelProperty(value = "操作人")
@TableField(exist = false) @TableField(exist = false)
@@ -28,6 +28,7 @@
where s1.del_flag = 0 and s1.info_id = i.id where s1.del_flag = 0 and s1.info_id = i.id
) referenceCountry, ) referenceCountry,
is_show, is_show,
hidden_table,
u.username username, u.username username,
u.realname realname, u.realname realname,
concat(u.realname, '(', u.username, ')') author, concat(u.realname, '(', u.username, ')') author,
@@ -384,13 +384,13 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
createTableSecondRow(sheet, standardVOS, featureList, cellStyle); createTableSecondRow(sheet, standardVOS, featureList, cellStyle);
// 创建单元格内容 // 创建单元格内容
createTableCellContent(sheet, standardVOS, featureList, compareList, list, cellStyle); createTableCellContent(sheet, standardVOS, featureList, compareList, list, cellStyle);
String exportPath = exportExcelTempPath.replace("exportExcelTemp", "清单详情");
// excel临时保存到本地并在同级创建文件夹 // excel临时保存到本地并在同级创建文件夹
generateExcel(workbook, fileName); generateExcel(workbook, fileName, exportPath);
// 生成zip文件返回文件流 // 生成zip文件返回文件流
ZipUtil.toZip(exportExcelTempPath, response.getOutputStream(), response, true); ZipUtil.toZip(exportPath, response.getOutputStream(), response, true);
//删除指定文件夹 //删除指定文件夹
FileUtils.deleteFolders(exportExcelTempPath); FileUtils.deleteFolders(exportPath);
}catch (Exception e){ }catch (Exception e){
log.error(e.getMessage()); log.error(e.getMessage());
throw new JeroBootException("导出失败!"); throw new JeroBootException("导出失败!");
@@ -554,7 +554,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
// 计算第二行文字内容和需要合并的单元格 // 计算第二行文字内容和需要合并的单元格
// 下标 // 下标
AtomicInteger index = new AtomicInteger(); AtomicInteger index = new AtomicInteger();
// // 计算下次合并单元格起始 // 计算下次合并单元格起始
AtomicInteger nextMergeFirst = new AtomicInteger(); AtomicInteger nextMergeFirst = new AtomicInteger();
for (StandardVO standardVO : standardVOS) { for (StandardVO standardVO : standardVOS) {
index.addAndGet(1); index.addAndGet(1);
@@ -569,7 +569,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
// 合并单元格(参数说明:起始行,结束行,起始列,结束列) // 合并单元格(参数说明:起始行,结束行,起始列,结束列)
CellRangeAddress region = new CellRangeAddress(1, 1, index.get() + nextMergeFirst.get(), index.get() + featureSize - 1 + nextMergeFirst.get()); CellRangeAddress region = new CellRangeAddress(1, 1, index.get() + nextMergeFirst.get(), index.get() + featureSize - 1 + nextMergeFirst.get());
sheet.addMergedRegionUnsafe(region); sheet.addMergedRegionUnsafe(region);
nextMergeFirst.set(featureSize - 1); nextMergeFirst.set(nextMergeFirst.get() + featureSize - 1);
} }
} }
} }
@@ -610,14 +610,14 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
} }
private void generateExcel(Workbook workbook, String fileName) throws IOException { private void generateExcel(Workbook workbook, String fileName, String exportPath) throws IOException {
File saveFile = new File(exportExcelTempPath); File saveFile = new File(exportPath);
// 导出路径 没有则创建 // 导出路径 没有则创建
if (!saveFile.exists()) { if (!saveFile.exists()) {
saveFile.mkdirs(); saveFile.mkdirs();
} }
// 生成excel文件路径 // 生成excel文件路径
String excelPath = exportExcelTempPath + File.separator + fileName; String excelPath = exportPath + File.separator + fileName;
// 写出excel文件 // 写出excel文件
try (FileOutputStream fos = new FileOutputStream(excelPath)){ try (FileOutputStream fos = new FileOutputStream(excelPath)){
workbook.write(fos); workbook.write(fos);
@@ -33,6 +33,10 @@ public class LawsCustomCompareInfoVO {
@ApiModelProperty(value = "是否公开(1:是,0:否)") @ApiModelProperty(value = "是否公开(1:是,0:否)")
@Dict(dicCode = "yn") @Dict(dicCode = "yn")
private String isShow; private String isShow;
/**是否公开(1:是,0:否)*/
@ApiModelProperty(value = "是否隐藏表格(1:是 0:否)")
@Dict(dicCode = "yn")
private String hiddenTable;
/**操作人*/ /**操作人*/
@ApiModelProperty(value = "操作人") @ApiModelProperty(value = "操作人")
private String createBy; private String createBy;
@@ -1,5 +1,6 @@
package com.jero.modules.laws.customcompare.vo; package com.jero.modules.laws.customcompare.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -32,6 +33,7 @@ public class StandardVO {
private String countryOrRegion; private String countryOrRegion;
/**发布日期*/ /**发布日期*/
@ApiModelProperty(value = "发布日期") @ApiModelProperty(value = "发布日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date releaseDate; private Date releaseDate;
/**标准类型(1:国内,2:海外,3:企业)*/ /**标准类型(1:国内,2:海外,3:企业)*/
@ApiModelProperty(value = "标准类型(1:国内,2:海外,3:企业)") @ApiModelProperty(value = "标准类型(1:国内,2:海外,3:企业)")