fix(企标稽查): 79390

This commit is contained in:
yjz
2023-12-25 15:40:20 +08:00
parent 957436c2b8
commit 4bd8568a11
2 changed files with 22 additions and 6 deletions
@@ -105,7 +105,7 @@ public class EnterpriseStandardInspectVo {
/**
* 实际稽查完成日期
*/
@Excel(name = "实际稽查完成日期", width = 16, format = "yyyy-MM-dd", needMerge = true)
@Excel(name = "实际稽查完成日期", width = 18, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "实际稽查完成日期")
@@ -128,7 +128,7 @@ public class EnterpriseStandardInspectVo {
/**
* 稽查状态
*/
@Excel(name = "稽查状态", width = 15, dicCode = "inspect_status", needMerge = true)
@Excel(name = "状态", width = 15, dicCode = "inspect_status", needMerge = true)
@Dict(dicCode = "inspect_status")
@ApiModelProperty(value = "稽查状态")
private String inspectStatus;
@@ -154,6 +154,7 @@ public class EnterpriseStandardInspectVo {
@ApiModelProperty(value = "整改计划")
@ExcelCollection(name = "")
private List<EnterpriseStandardInspectRectifyPlan> enterpriseStandardInspectRectifyPlanList = Collections.emptyList();
//=================================
/**
* ids 查询用
@@ -182,4 +183,11 @@ public class EnterpriseStandardInspectVo {
@ApiModelProperty(value = "企标编号/企标名称 查询用")
@TableField(exist = false)
private String inspectNoOrName;
/**
* 勾选数据 导出用
*/
@ApiModelProperty(value = "勾选数据 导出用")
@TableField(exist = false)
private String selections;
}
@@ -86,12 +86,20 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
public void export(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo, String fileName, String sheetName) {
try {
// 获取数据
IPage<EnterpriseStandardInspectVo> enterpriseStandardInspectVoIPage = this.queryByPage(enterpriseStandardInspectVo, 1, Integer.MAX_VALUE);
List<EnterpriseStandardInspectVo> records = enterpriseStandardInspectVoIPage.getRecords();
List<EnterpriseStandardInspectVo> enterpriseStandardInspectVoList= this.queryByList(enterpriseStandardInspectVo);
if (Objects.isNull(enterpriseStandardInspectVoList)){
enterpriseStandardInspectVoList = new ArrayList<>();
}
if (StringUtils.isNotBlank(enterpriseStandardInspectVo.getSelections())){
enterpriseStandardInspectVoList = enterpriseStandardInspectVoList.stream()
.filter(v -> enterpriseStandardInspectVo.getSelections().contains(v.getId()))
.collect(Collectors.toList());
}
// 设置导出参数
ExportParams exportParams = new ExportParams(null, sheetName); // 可以为标题添加更多的配置
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EnterpriseStandardInspectVo.class, records);
String[] excludes = {"存在问题", "整改措施", "整改负责人", "整改计划完成时间", "整改实际完成时间", "整改状态"};
exportParams.setExclusions(excludes);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EnterpriseStandardInspectVo.class, enterpriseStandardInspectVoList);
// 编码文件名以兼容各种浏览器
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");