diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/FileUtils.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/FileUtils.java new file mode 100644 index 000000000..749f1f6d0 --- /dev/null +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/FileUtils.java @@ -0,0 +1,34 @@ +package com.jero.common.util; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +public class FileUtils { + /** + * 复制文件 + * @param in + * @param newFile + * @throws IOException + */ + public static void copyFile(InputStream in, String newFile) throws IOException { + File file2 = new File(newFile); + if (!file2.exists()) { + file2.createNewFile(); + } + try (FileOutputStream ou = new FileOutputStream(newFile);) { + byte[] bs = new byte[1024]; + int count = 0; + while ((count = in.read(bs, 0, bs.length)) != -1) { + ou.write(bs, 0, count); + } + ou.flush(); + } catch (IOException e) { + e.printStackTrace(); + throw new IOException("复制文件失败!"); + } finally { + in.close(); + } + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/controller/LawsTechnologyEvaluationComplianceResultEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/controller/LawsTechnologyEvaluationComplianceResultEOController.java index 4d2b69ace..391cad286 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/controller/LawsTechnologyEvaluationComplianceResultEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/controller/LawsTechnologyEvaluationComplianceResultEOController.java @@ -2,11 +2,13 @@ package com.jero.modules.lawsTechnologyEvaluation.controller; import java.util.Arrays; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.jero.common.api.vo.Result; import com.jero.common.system.query.QueryGenerator; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO; +import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationComplianceResultEOService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -157,6 +159,20 @@ public class LawsTechnologyEvaluationComplianceResultEOController extends JeroCo return super.exportXls(request, lawsTechnologyEvaluationComplianceResultEO, LawsTechnologyEvaluationComplianceResultEO.class, "法规技术评估-评估人反馈-符合性结果表"); } + /** + * 导出zip压缩包,带文件。 + * @param response + * @param request + * @param lawsTechnologyEvaluationComplianceResultEO + * @param params + */ + @RequestMapping(value = "/exportZip") + public void exportZip(HttpServletResponse response,HttpServletRequest request, + LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO, + @RequestParam Map params) { + this.lawsTechnologyEvaluationComplianceResultEOService.exportZip(response,request, lawsTechnologyEvaluationComplianceResultEO,params); + } + /** * 通过excel导入数据 * diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationComplianceResultEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationComplianceResultEO.java index 870313dd1..2b3e8c3ad 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationComplianceResultEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationComplianceResultEO.java @@ -34,6 +34,8 @@ public class LawsTechnologyEvaluationComplianceResultEO implements Serializable @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "主键") private java.lang.String id; + @TableField(exist = false) + private java.lang.String ids; /**创建人*/ @ApiModelProperty(value = "创建人") @@ -68,6 +70,8 @@ public class LawsTechnologyEvaluationComplianceResultEO implements Serializable @Excel(name = "符合性结果", width = 15) @ApiModelProperty(value = "符合性结果") private java.lang.String complianceResult; + @TableField(exist = false) + private java.lang.String complianceResultName; /**流程实例id*/ @Excel(name = "流程实例id", width = 15) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationResultEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationResultEO.java index 36f1b37b9..af4611933 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationResultEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/entity/LawsTechnologyEvaluationResultEO.java @@ -2,6 +2,7 @@ package com.jero.modules.lawsTechnologyEvaluation.entity; import java.io.Serializable; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -80,6 +81,8 @@ public class LawsTechnologyEvaluationResultEO implements Serializable { @Excel(name = "附件", width = 15) @ApiModelProperty(value = "附件") private java.lang.String accessoryFile; + @TableField(exist = false) + private java.lang.String accessoryFileName; /**提出时间*/ @Excel(name = "提出时间", width = 15, format = "yyyy-MM-dd") diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationComplianceResultEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationComplianceResultEOService.java index 335fc9905..6d3895958 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationComplianceResultEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationComplianceResultEOService.java @@ -2,9 +2,12 @@ package com.jero.modules.lawsTechnologyEvaluation.service; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO; import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; /** * @Description: 法规技术评估-评估人反馈-符合性结果表 @@ -62,4 +65,8 @@ public interface ILawsTechnologyEvaluationComplianceResultEOService extends ISer List queryList(LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO, HttpServletRequest req, String cut); + + void exportZip(HttpServletResponse response, HttpServletRequest request, + LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO, + Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationResultEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationResultEOService.java index 72ccf5561..d7d1d0f89 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationResultEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/ILawsTechnologyEvaluationResultEOService.java @@ -76,4 +76,6 @@ public interface ILawsTechnologyEvaluationResultEOService extends IService datas, String cut); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationComplianceResultEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationComplianceResultEOServiceImpl.java index c95b3d3b2..5040fe749 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationComplianceResultEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationComplianceResultEOServiceImpl.java @@ -1,18 +1,41 @@ package com.jero.modules.lawsTechnologyEvaluation.service.impl; +import cn.hutool.core.util.ZipUtil; import com.alibaba.druid.util.StringUtils; +import com.aliyuncs.utils.IOUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.exception.JeroBootException; import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.FileUtils; +import com.jero.common.util.oss.CosBootUtil; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO; +import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationItemResultEO; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO; +import com.jero.modules.lawsTechnologyEvaluation.enums.ComplianceResultEnum; import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationComplianceResultEOMapper; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationComplianceResultEOService; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationResultEOService; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.system.util.PDFUtils; import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.shiro.SecurityUtils; +import org.aspectj.util.FileUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; + +import java.io.*; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; import java.util.Date; +import java.util.Map; import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -20,6 +43,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * @Description: 法规技术评估-评估人反馈-符合性结果表 @@ -30,8 +54,12 @@ import javax.servlet.http.HttpServletRequest; @Service @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends ServiceImpl implements ILawsTechnologyEvaluationComplianceResultEOService { + @Value(value = "${jero.path.upload}") + private String uploadpath; @Autowired private ILawsTechnologyEvaluationResultEOService evaluationResultEOService; + @Autowired + private IOSSFileService iOSSFileService; /** * 保存 @@ -103,6 +131,9 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi HttpServletRequest req, String cut) { QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(lawsTechnologyEvaluationComplianceResultEO, req.getParameterMap()); + if(org.apache.commons.lang3.StringUtils.isNotEmpty(lawsTechnologyEvaluationComplianceResultEO.getIds())){ + queryWrapper.lambda().in(LawsTechnologyEvaluationComplianceResultEO::getId,lawsTechnologyEvaluationComplianceResultEO.getIds().split(",")); + } List complianceResultEOList = this.baseMapper.selectList(queryWrapper); if(CollectionUtils.isNotEmpty(complianceResultEOList)){ @@ -111,6 +142,7 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi QueryWrapper evaluationResultEOQueryWrapper = new QueryWrapper<>(); evaluationResultEOQueryWrapper.lambda().in(LawsTechnologyEvaluationResultEO::getComplianceResultId,complianceResultIdList); List evaluationResultEOList = this.evaluationResultEOService.list(evaluationResultEOQueryWrapper); + this.evaluationResultEOService.disposeData(evaluationResultEOList,cut); if(CollectionUtils.isNotEmpty(evaluationResultEOList)){ for (LawsTechnologyEvaluationComplianceResultEO complianceResultEO : complianceResultEOList) { @@ -129,4 +161,174 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi } return complianceResultEOList; } + + + @Override + public void exportZip(HttpServletResponse response, HttpServletRequest request, + LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO, + Map params) { + String ids = (String)params.get("ids"); + String cut = (String)params.get("cut"); + + if(!StringUtils.isEmpty(ids)){ + lawsTechnologyEvaluationComplianceResultEO.setIds(ids); + } + List exportData = this.queryList(lawsTechnologyEvaluationComplianceResultEO, request, cut); + this.disposeData(exportData,cut); + + String title = ""; + String bottomTitle = ""; + String fileName = ""; + if(org.apache.commons.lang3.StringUtils.equals(cut, CutEnum.CN.getValue())){ + title = "相关章节,问题说明,附件"; + bottomTitle = "符合性结果:"; + fileName = "评估结果 " + ".xlsx"; + }else if(org.apache.commons.lang3.StringUtils.equals(cut,CutEnum.EN.getValue())){ + title = "Related section,Problem description,Accessory"; + bottomTitle = "Compliance results:"; + fileName = "Evaluation results " + ".xlsx"; + } + + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + + String path = uploadpath + "/tempZip/itemEvaluationResults/" + System.currentTimeMillis(); + + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + + //设置导出数据 + if(CollectionUtils.isNotEmpty(exportData)) { + int size = exportData.size(); + for (int i = 0; i < exportData.size(); i++){ + //使用评估人的名字命名sheet页 + HSSFSheet sheet = workbook.createSheet(exportData.get(i).getCreateBy()); + + CellStyle titleCellStyle = workbook.createCellStyle(); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + titleCellStyle.setWrapText(true);//自动换行 + + Row firstRow = sheet.createRow(0); + + //创建表头 + String[] titleArr = title.split(","); + for (int j=0; j<=3; j++){ + sheet.setColumnWidth(j,4000); + Cell cell = firstRow.createCell(j); + cell.setCellStyle(titleCellStyle); + cell.setCellValue(titleArr[j]); + } + + //获取这个评估人填写的评估结果 + List lawsTechnologyEvaluationResultEOList = exportData.get(i).getLawsTechnologyEvaluationResultEOList(); + int evaluationResultListSize = lawsTechnologyEvaluationResultEOList.size(); + if(CollectionUtils.isNotEmpty(lawsTechnologyEvaluationResultEOList)){ + for (int dataIndex = 0; dataIndex < lawsTechnologyEvaluationResultEOList.size(); dataIndex++) { + Row dataRow = sheet.createRow(dataIndex + 1); + dataRow.createCell(0).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getRelatedSection()); + dataRow.createCell(1).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getIssueOrSuggest()); + dataRow.createCell(2).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getAccessoryFileName()); + } + } + + //把符合性结果设置进excel表格中。 + Row bottomRow = sheet.createRow(evaluationResultListSize + 1); + Cell bottomRowFirstCell = bottomRow.getCell(0); + bottomRowFirstCell.setCellStyle(titleCellStyle); + bottomRowFirstCell.setCellValue(bottomTitle); + + Cell bottomRowSecondCell = bottomRow.getCell(1); + bottomRowSecondCell.setCellValue(exportData.get(i).getComplianceResultName()); + } + + + } + + + File fileTemp = new File(path); + if (fileTemp.exists()) { + fileTemp.delete(); + } + fileTemp.mkdirs(); + //excel + OutputStream excelOS = new FileOutputStream(path + File.separator + fileName); + workbook.write(excelOS); + excelOS.flush(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + for (LawsTechnologyEvaluationComplianceResultEO data : exportData) { + List evaluationResultEOList = data.getLawsTechnologyEvaluationResultEOList(); + if(CollectionUtils.isNotEmpty(evaluationResultEOList)){ + for (LawsTechnologyEvaluationResultEO lawsTechnologyEvaluationResultEO : evaluationResultEOList) { + String accessoryFile = lawsTechnologyEvaluationResultEO.getAccessoryFile(); + + List fileInfosList = iOSSFileService.getFileInfos(accessoryFile); + if (fileInfosList.size() != 0) { + for (OSSFile ossFile : fileInfosList) { + String url = ossFile.getUrl(); + //判断文件是否存在 + if(org.apache.commons.lang3.StringUtils.isNotBlank(url)){ + //判断文件是否存在 + boolean b = CosBootUtil.doesObjectExist(url); + if(b){ + InputStream download = CosBootUtil.download(url); + if(url.endsWith(".pdf") || url.endsWith(".PDF")){ + String currentTime = sdf.format(new Date()); + String waterContent = loginUser.getUsername() + " " + currentTime; + File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent); + download = new FileInputStream(newFile.getPath()); + } + //复制文件 + FileUtils.copyFile(download, path + File.separator + ossFile.getFileName()); + } + } + } + } + } + } + + } + ZipUtil.zip(path, path + ".zip"); + //文件 + FileInputStream fis = new FileInputStream(path + ".zip"); + os = response.getOutputStream(); + + int len = 0; + while ((len = fis.read()) != -1) { + os.write(len); + } + os.flush(); + fis.close(); + excelOS.close(); + + }catch (IOException ex){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + }finally { + IOUtils.closeQuietly(os); + File file = new File(path); + FileUtil.deleteContents(file); + File fileTemp = new File(path + ".zip"); + FileUtil.deleteContents(fileTemp); + } + } + + public void disposeData(List datas,String cut){ + if(CollectionUtils.isNotEmpty(datas)){ + for (LawsTechnologyEvaluationComplianceResultEO data : datas) { + if(!StringUtils.isEmpty(data.getComplianceResult())){ + data.setComplianceResultName(ComplianceResultEnum.getTextByValue(data.getComplianceResult(),cut)); + } + } + } + + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationItemResultEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationItemResultEOServiceImpl.java index cb1314e10..1369b2036 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationItemResultEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationItemResultEOServiceImpl.java @@ -10,6 +10,7 @@ import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.FileUtils; import com.jero.common.util.oss.CosBootUtil; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationItemResultEO; import com.jero.modules.lawsTechnologyEvaluation.enums.ComplianceResultEnum; @@ -310,7 +311,7 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent); download = new FileInputStream(newFile.getPath()); } - copyFile(download, path + File.separator + ossFile.getFileName()); + FileUtils.copyFile(download, path + File.separator + ossFile.getFileName()); } } } @@ -344,26 +345,6 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl } } - public static void copyFile(InputStream in, String newFile) throws IOException { - File file2 = new File(newFile); - if (!file2.exists()) { - file2.createNewFile(); - } - try (FileOutputStream ou = new FileOutputStream(newFile);) { - byte[] bs = new byte[1024]; - int count = 0; - while ((count = in.read(bs, 0, bs.length)) != -1) { - ou.write(bs, 0, count); - } - ou.flush(); - } catch (IOException e) { - e.printStackTrace(); - throw new IOException("复制文件失败!"); - } finally { - in.close(); - } - } - public String disposeDate(Date date){ String result = ""; try { diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationResultEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationResultEOServiceImpl.java index fa773e1ad..6d35252bd 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationResultEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsTechnologyEvaluation/service/impl/LawsTechnologyEvaluationResultEOServiceImpl.java @@ -9,6 +9,9 @@ import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluation import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationResultEOMapper; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationComplianceResultEOService; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationResultEOService; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; +import me.zhyd.oauth.utils.StringUtils; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -17,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Date; import java.util.UUID; +import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Propagation; @@ -36,6 +40,8 @@ public class LawsTechnologyEvaluationResultEOServiceImpl extends ServiceImpl datas, String cut) { + if(CollectionUtils.isNotEmpty(datas)){ + for (LawsTechnologyEvaluationResultEO data : datas) { + if(StringUtils.isNotEmpty(data.getAccessoryFile())){ + List accessoryFileList = iOSSFileService.getFileInfos(data.getAccessoryFile()); + String accessoryFileName = accessoryFileList.stream().map(OSSFile::getFileName).collect(Collectors.joining(",")); + data.setAccessoryFileName(accessoryFileName); + } + } + } + } }