feat: scc流程分发列表导出
This commit is contained in:
+32
@@ -6,15 +6,21 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.modules.laws.utils.ExcelExportUtilPro;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -68,6 +74,7 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
* 条款号
|
||||
*/
|
||||
@ApiModelProperty(value = "条款号")
|
||||
@Excel(name = "条款号", width = 15, orderNum = "1")
|
||||
private String termNumber;
|
||||
|
||||
/**
|
||||
@@ -80,12 +87,14 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
* 条款内容
|
||||
*/
|
||||
@ApiModelProperty(value = "条款内容")
|
||||
@Excel(name = "条款内容", width = 15, orderNum = "2")
|
||||
private String termContent;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ApiModelProperty(value = "车型")
|
||||
@Excel(name = "车型", width = 15, orderNum = "3")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
@@ -93,6 +102,7 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "车型状态")
|
||||
@Dict(dicCode = "model_status")
|
||||
@Excel(name = "车型", width = 15, dicCode = "model_status", orderNum = "4")
|
||||
private String modelStatus;
|
||||
|
||||
/**
|
||||
@@ -100,6 +110,7 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "评估人")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Excel(name = "评估人", width = 15, orderNum = "6", dictTable = "sys_user", dicCode = "id", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
private String assessor;
|
||||
|
||||
/**
|
||||
@@ -107,6 +118,7 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "合规评估结果")
|
||||
@Dict(dicCode = "evaluation_result")
|
||||
@Excel(name = "评估结果", width = 15, orderNum = "8", dictTable = "sys_user", dicCode = "evaluation_result")
|
||||
private String result;
|
||||
|
||||
/**
|
||||
@@ -132,12 +144,14 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
* 整改方案
|
||||
*/
|
||||
@ApiModelProperty(value = "整改方案")
|
||||
@Excel(name = "整改方案", width = 15, orderNum = "10")
|
||||
private String correctionSolution;
|
||||
|
||||
/**
|
||||
* 不满足要求的现状
|
||||
*/
|
||||
@ApiModelProperty(value = "不满足要求的现状")
|
||||
@Excel(name = "不满足要求的现状", width = 15, orderNum = "9")
|
||||
private String unsatisfiedRequire;
|
||||
|
||||
/**
|
||||
@@ -145,30 +159,35 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "整改周期")
|
||||
@Dict(dicCode = "correction_period")
|
||||
@Excel(name = "整改方案", width = 15, orderNum = "11", dicCode = "correction_period")
|
||||
private String correctionPeriod;
|
||||
|
||||
/**
|
||||
* 整改费用
|
||||
*/
|
||||
@ApiModelProperty(value = "整改费用")
|
||||
@Excel(name = "整改费用", width = 15, orderNum = "12")
|
||||
private String correctionCost;
|
||||
|
||||
/**
|
||||
* 与其他项目共用性
|
||||
*/
|
||||
@ApiModelProperty(value = "与其他项目共用性")
|
||||
@Excel(name = "与其他项目共用性", width = 15, orderNum = "13")
|
||||
private String commonality;
|
||||
|
||||
/**
|
||||
* 共用后本项目所需费用
|
||||
*/
|
||||
@ApiModelProperty(value = "共用后本项目所需费用")
|
||||
@Excel(name = "共用后本项目所需费用", width = 15, orderNum = "14")
|
||||
private String commonalityCost;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
@Excel(name = "备注", width = 15, orderNum = "15")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
@@ -176,6 +195,7 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "责任部门")
|
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Excel(name = "责任部门", width = 15, orderNum = "5", dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
private String authDept;
|
||||
|
||||
/**
|
||||
@@ -202,6 +222,18 @@ public class ProcessStandardComplianceCheckDetail implements Serializable {
|
||||
@ApiModelProperty(value = "分发批次唯一Id")
|
||||
private String batchId;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
@ApiModelProperty(value = "附件")
|
||||
@ExcelCollection(name = "", orderNum = "16")
|
||||
@TableField(exist = false)
|
||||
private List<ExcelExportUtilPro.FileDetails> fileList = Collections.emptyList();
|
||||
|
||||
public List<String> obtainFileIds() {
|
||||
return material != null ? Arrays.asList(material.split(",")) : Collections.emptyList();
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+44
-34
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.FileUtils;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.common.util.ZipUtil;
|
||||
import com.jero.modules.activiti.common.ActivitiCommon;
|
||||
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
@@ -34,6 +36,7 @@ import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
|
||||
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import com.jero.modules.laws.utils.ExcelExportUtilPro;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
@@ -41,14 +44,18 @@ import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.util.SysWaterMarkUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -57,6 +64,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
@@ -72,6 +80,7 @@ import static com.jero.modules.activiti.process.standardComplianceCheck.common.P
|
||||
* @createDate 2024-07-04 10:21:21
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<ProcessStandardComplianceCheckMapper, ProcessStandardComplianceCheck>
|
||||
implements IProcessStandardComplianceCheckService {
|
||||
|
||||
@@ -98,7 +107,7 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
@Resource
|
||||
private DocumentSplitMapper documentSplitMapper;
|
||||
@Resource
|
||||
private SysWaterMarkUtil sysWaterMarkUtil;
|
||||
private ExcelExportUtilPro excelExportUtilPro;
|
||||
|
||||
@Value("${jero.path.exportExcelTempPath}")
|
||||
private String exportExcelTempPath;
|
||||
@@ -425,40 +434,41 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
public void exportXlsDistribute(String taskId, HttpServletResponse response) {
|
||||
ProcessInfoVO<ProcessSccVO> handleData = this.getHandleData(taskId);
|
||||
List<ProcessStandardComplianceCheckDetail> detailInfoList = handleData.getBusinessInfoDTO().getDetailInfoList();
|
||||
String fileName = "";
|
||||
String fileName = "123";
|
||||
String url = exportExcelTempPath.replace(EXPORT_EXCEL_TEMP, fileName);
|
||||
File file = new File(url);
|
||||
// if (!file.exists()) {
|
||||
// boolean mkdirs = file.mkdirs();
|
||||
// log.info("创建临时目录:{}", mkdirs);
|
||||
// }
|
||||
// try (FileOutputStream fos = new FileOutputStream(url + File.separator + fileName + ".xls")){
|
||||
// // 获取数据
|
||||
//
|
||||
//
|
||||
// this.settleDocuments(url, records);
|
||||
//
|
||||
// // 生成excel
|
||||
// ExportParams exportParams = new ExportParams();
|
||||
// exportParams.setType(ExcelType.HSSF);
|
||||
// // 复制一份数据
|
||||
// List<LawsEvaluationNotMetLibrary> newRecordsExport = new ArrayList<>(records);
|
||||
// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, LawsEvaluationNotMetLibrary.class, records);
|
||||
// // 生成超链接
|
||||
// generateHyperlink(newRecordsExport, workbook);
|
||||
// // 导出excel
|
||||
// workbook.write(fos);
|
||||
// // 生成并导出zip
|
||||
// ZipUtil.toZip(url, response.getOutputStream(), response, true);
|
||||
// } catch (Exception e) {
|
||||
// log.error("导出excel异常", e);
|
||||
// throw new JeroBootException("导出excel异常", e);
|
||||
// } finally {
|
||||
// // 删除文件
|
||||
// if (new File(url).exists()) {
|
||||
// FileUtils.deleteFolders(url);
|
||||
// }
|
||||
// }
|
||||
if (!file.exists()) {
|
||||
boolean mkdirs = file.mkdirs();
|
||||
log.info("创建临时目录:{}", mkdirs);
|
||||
}
|
||||
try (FileOutputStream fos = new FileOutputStream(url + File.separator + fileName + ".xls")){
|
||||
// 获取数据
|
||||
excelExportUtilPro.settleDocuments(url, detailInfoList,
|
||||
ProcessStandardComplianceCheckDetail::obtainFileIds,
|
||||
ProcessStandardComplianceCheckDetail::setFileList);
|
||||
// 生成excel
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.HSSF);
|
||||
// 复制一份数据
|
||||
List<ProcessStandardComplianceCheckDetail> newRecordsExport = new ArrayList<>(detailInfoList);
|
||||
Workbook workbook = ExcelExportUtil
|
||||
.exportExcel(exportParams, ProcessStandardComplianceCheckDetail.class, detailInfoList);
|
||||
// 生成超链接
|
||||
excelExportUtilPro.generateHyperlink(newRecordsExport, workbook,
|
||||
ProcessStandardComplianceCheckDetail::getFileList, 12);
|
||||
// 导出excel
|
||||
workbook.write(fos);
|
||||
// 生成并导出zip
|
||||
ZipUtil.toZip(url, response.getOutputStream(), response, true);
|
||||
} catch (Exception e) {
|
||||
log.error("导出excel异常", e);
|
||||
throw new JeroBootException("导出excel异常", e);
|
||||
} finally {
|
||||
// 删除文件
|
||||
if (new File(url).exists()) {
|
||||
FileUtils.deleteFolders(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-77
@@ -116,7 +116,7 @@ public class LawsEvaluationNotMetLibraryServiceImpl extends ServiceImpl<LawsEval
|
||||
List<LawsEvaluationNotMetLibrary> newRecordsExport = new ArrayList<>(records);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, LawsEvaluationNotMetLibrary.class, records);
|
||||
// 生成超链接
|
||||
excelExportUtilPro.generateHyperlink(newRecordsExport, workbook, LawsEvaluationNotMetLibrary::getFileList, 12);
|
||||
excelExportUtilPro.generateHyperlink(newRecordsExport, workbook, LawsEvaluationNotMetLibrary::getFileList, 15);
|
||||
// 导出excel
|
||||
workbook.write(fos);
|
||||
// 生成并导出zip
|
||||
@@ -132,82 +132,6 @@ public class LawsEvaluationNotMetLibraryServiceImpl extends ServiceImpl<LawsEval
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// private static void generateHyperlink(List<LawsEvaluationNotMetLibrary> vos, Workbook workbook) {
|
||||
// Sheet sheet = workbook.getSheetAt(0);
|
||||
// // 设置字体颜色、下划线
|
||||
// CellStyle cellStyle = workbook.createCellStyle();
|
||||
// Font font = workbook.createFont();
|
||||
// font.setColor(IndexedColors.BLUE.getIndex());
|
||||
// font.setUnderline(Font.U_SINGLE);
|
||||
// cellStyle.setFont(font);
|
||||
// cellStyle.setWrapText(true);
|
||||
// int i = 1;
|
||||
// for (LawsEvaluationNotMetLibrary vo : vos) {
|
||||
// if (!Objects.isNull(vo.getFile()) && !vo.getFileList().isEmpty()) {
|
||||
// for (NotMetFile notMetFile : vo.getFileList()) {
|
||||
// Row row = sheet.getRow(i);
|
||||
// Cell cell = row.getCell(12);
|
||||
// cell.setCellFormula("HYPERLINK(\"" + notMetFile.getFileName() + "\", \"" + notMetFile.getFileName() + "\")");
|
||||
// cell.setCellStyle(cellStyle);
|
||||
// i += 1;
|
||||
// }
|
||||
// } else {
|
||||
// i += 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void settleDocuments(String url, List<LawsEvaluationNotMetLibrary> excelVos) throws
|
||||
// IOException {
|
||||
// for (LawsEvaluationNotMetLibrary vo : excelVos) {
|
||||
// // 查询文件
|
||||
// if (StringUtils.isNotBlank(vo.getFile())) {
|
||||
// List<String> fileIdList = Arrays.asList(vo.getFile().split(","));
|
||||
// List<OSSFile> ossFileList = ossFileService.listByIds(fileIdList);
|
||||
// if (!ossFileList.isEmpty()) {
|
||||
// // 赋值
|
||||
// List<NotMetFile> notMetFileList = com.jero.common.util.BeanCopyUtils.copyBeanList(ossFileList, NotMetFile.class);
|
||||
// vo.setFileList(notMetFileList);
|
||||
// // 写出文件
|
||||
// for (OSSFile ossFile : ossFileList) {
|
||||
// InputStream inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), ossFile.getUrl());
|
||||
// // pdf加水印
|
||||
// if (StringUtils.endsWithIgnoreCase(ossFile.getFileName(), ".pdf")) {
|
||||
// inputStream = sysWaterMarkUtil.addWatermarkToPdf(inputStream);
|
||||
// }
|
||||
// // 导出文件
|
||||
// String filePath = url + File.separator + ossFile.getFileName();
|
||||
// writeToLocal(filePath, inputStream);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 将InputStream写入本地文件
|
||||
// *
|
||||
// * @param filePath
|
||||
// * @param input
|
||||
// * @throws IOException
|
||||
// */
|
||||
// public void writeToLocal(String filePath, InputStream input)
|
||||
// throws IOException {
|
||||
// int index;
|
||||
// byte[] bytes = new byte[1024];
|
||||
// try (FileOutputStream downloadFile = new FileOutputStream(filePath)) {
|
||||
// while ((index = input.read(bytes)) != -1) {
|
||||
// downloadFile.write(bytes, 0, index);
|
||||
// downloadFile.flush();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("将InputStream写入本地失败:{}", e.getMessage());
|
||||
// } finally {
|
||||
// input.close();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user