From fd7143732def1542efb17bd2cc161095b7ffcde0 Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Wed, 28 Sep 2022 11:43:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=95=E8=A7=84=E6=8A=80=E6=9C=AF=E8=AF=84?= =?UTF-8?q?=E4=BC=B0=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=B8=A6=E6=A0=87=E5=87=86?= =?UTF-8?q?=E6=8B=86=E8=A7=A3=E5=8D=95=E6=83=85=E5=86=B5=E8=AF=84=E4=BC=B0?= =?UTF-8?q?=EF=BC=8C=E5=A4=84=E7=90=86=E8=AF=84=E4=BC=B0=E4=BA=BA=E6=B2=A1?= =?UTF-8?q?=E5=A1=AB=E6=95=B0=E6=8D=AE=E6=83=85=E5=86=B5=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...wsTechnologyEvaluationResultEOService.java | 1 + ...aluationComplianceResultEOServiceImpl.java | 82 +++++++++++++++---- 2 files changed, 67 insertions(+), 16 deletions(-) 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 d7d1d0f89..2feb8e00b 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 @@ -1,6 +1,7 @@ package com.jero.modules.lawsTechnologyEvaluation.service; import com.alibaba.fastjson.JSONObject; +import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO; import com.baomidou.mybatisplus.extension.service.IService; 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 160afc9b7..cc0ed5c10 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 @@ -11,14 +11,17 @@ 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.LawsTechnologyEvaluationFlowDetailEO; 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.ILawsTechnologyEvaluationFlowDetailEOService; 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.entity.SysUser; +import com.jero.modules.system.service.ISysUserService; import com.jero.modules.system.util.PDFUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.hssf.usermodel.HSSFSheet; @@ -32,10 +35,7 @@ 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.*; import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -60,6 +60,10 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi private ILawsTechnologyEvaluationResultEOService evaluationResultEOService; @Autowired private IOSSFileService iOSSFileService; + @Autowired + private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetailEOService; + @Autowired + private ISysUserService sysUserService; /** * 保存 @@ -136,8 +140,8 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi } List complianceResultEOList = this.baseMapper.selectList(queryWrapper); + this.disposeData(complianceResultEOList,cut,lawsTechnologyEvaluationComplianceResultEO); if(CollectionUtils.isNotEmpty(complianceResultEOList)){ - this.disposeData(complianceResultEOList,cut); List complianceResultIdList = complianceResultEOList.stream().map(LawsTechnologyEvaluationComplianceResultEO::getId).distinct().collect(Collectors.toList()); QueryWrapper evaluationResultEOQueryWrapper = new QueryWrapper<>(); evaluationResultEOQueryWrapper.lambda().in(LawsTechnologyEvaluationResultEO::getComplianceResultId,complianceResultIdList); @@ -174,7 +178,7 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi lawsTechnologyEvaluationComplianceResultEO.setIds(ids); } List exportData = this.queryList(lawsTechnologyEvaluationComplianceResultEO, request, cut); - this.disposeData(exportData,cut); + this.disposeData(exportData,cut,lawsTechnologyEvaluationComplianceResultEO); String title = ""; String bottomTitle = ""; @@ -224,23 +228,28 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi cell.setCellValue(titleArr[j]); } + int complianceResultNameRow = 1; //获取这个评估人填写的评估结果 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()); + 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()); + } } + complianceResultNameRow += evaluationResultListSize; } //把符合性结果设置进excel表格中。 - Row bottomRow = sheet.createRow(evaluationResultListSize + 1); + Row bottomRow = sheet.createRow(complianceResultNameRow); Cell bottomRowFirstCell = bottomRow.createCell(0); bottomRowFirstCell.setCellStyle(titleCellStyle); - bottomRowFirstCell.setCellValue(bottomTitle + " " + exportData.get(i).getComplianceResultName()); + String complianceResultName = org.apache.commons.lang3.StringUtils.isNotEmpty(exportData.get(i).getComplianceResultName()) ? exportData.get(i).getComplianceResultName() : ""; + bottomRowFirstCell.setCellValue(bottomTitle + " " + complianceResultName); } } @@ -316,7 +325,7 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi } } - public void disposeData(List datas,String cut){ + public void disposeData(List datas,String cut,LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO){ if(CollectionUtils.isNotEmpty(datas)){ for (LawsTechnologyEvaluationComplianceResultEO data : datas) { if(!StringUtils.isEmpty(data.getComplianceResult())){ @@ -324,6 +333,47 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi } } } + //获取当前法规技术评估下面的所有评估人 + QueryWrapper flowDetailQueryWrap = new QueryWrapper<>(); + flowDetailQueryWrap.lambda().eq(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId,lawsTechnologyEvaluationComplianceResultEO.getLawsTechnologyEvaluationId()); + List flowDetailEOList = this.lawsTechnologyEvaluationFlowDetailEOService.list(flowDetailQueryWrap); + List evaluatorUserList = null; + if(CollectionUtils.isNotEmpty(flowDetailEOList)){ + List evaluatorIdList = flowDetailEOList.stream().map(LawsTechnologyEvaluationFlowDetailEO::getEvaluatorId).distinct().collect(Collectors.toList()); + evaluatorUserList = this.sysUserService.querySysUserListByIdList(evaluatorIdList); + } + //处理评估人没有填写任何评估结果的情况 + if(CollectionUtils.isEmpty(datas)){ + if (CollectionUtils.isNotEmpty(evaluatorUserList)) { + for (SysUser evaluatorUser : evaluatorUserList) { + LawsTechnologyEvaluationComplianceResultEO resultEO = new LawsTechnologyEvaluationComplianceResultEO(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + resultEO.setId(uuid); + resultEO.setCreateBy(evaluatorUser.getUsername()); + datas.add(resultEO); + } + } + }else { + List evaluatorUsers = evaluatorUserList.stream().filter(evaluatorUser -> { + boolean flag = true; + for (LawsTechnologyEvaluationComplianceResultEO data : datas) { + if(org.apache.commons.lang3.StringUtils.equals(evaluatorUser.getUsername(),data.getCreateBy())){ + flag = false; + break; + } + } + return flag; + }).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(evaluatorUsers)){ + for (SysUser evaluatorUser : evaluatorUsers) { + LawsTechnologyEvaluationComplianceResultEO resultEO = new LawsTechnologyEvaluationComplianceResultEO(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + resultEO.setId(uuid); + resultEO.setCreateBy(evaluatorUser.getUsername()); + datas.add(resultEO); + } + } + } } }