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); + } + } + } } }