法规技术评估,没有带标准拆解单情况评估,处理评估人没填数据情况展示数据。

This commit is contained in:
wangzhijiang
2022-09-28 11:43:14 +08:00
parent e910f24bcc
commit fd7143732d
2 changed files with 67 additions and 16 deletions
@@ -1,6 +1,7 @@
package com.jero.modules.lawsTechnologyEvaluation.service; package com.jero.modules.lawsTechnologyEvaluation.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@@ -11,14 +11,17 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.FileUtils; import com.jero.common.util.FileUtils;
import com.jero.common.util.oss.CosBootUtil; import com.jero.common.util.oss.CosBootUtil;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO; 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.entity.LawsTechnologyEvaluationResultEO;
import com.jero.modules.lawsTechnologyEvaluation.enums.ComplianceResultEnum; import com.jero.modules.lawsTechnologyEvaluation.enums.ComplianceResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationComplianceResultEOMapper; import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationComplianceResultEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationComplianceResultEOService; 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.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationResultEOService;
import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService; 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 com.jero.modules.system.util.PDFUtils;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -32,10 +35,7 @@ import org.springframework.stereotype.Service;
import java.io.*; import java.io.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -60,6 +60,10 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
private ILawsTechnologyEvaluationResultEOService evaluationResultEOService; private ILawsTechnologyEvaluationResultEOService evaluationResultEOService;
@Autowired @Autowired
private IOSSFileService iOSSFileService; private IOSSFileService iOSSFileService;
@Autowired
private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetailEOService;
@Autowired
private ISysUserService sysUserService;
/** /**
* 保存 * 保存
@@ -136,8 +140,8 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
} }
List<LawsTechnologyEvaluationComplianceResultEO> complianceResultEOList = this.baseMapper.selectList(queryWrapper); List<LawsTechnologyEvaluationComplianceResultEO> complianceResultEOList = this.baseMapper.selectList(queryWrapper);
this.disposeData(complianceResultEOList,cut,lawsTechnologyEvaluationComplianceResultEO);
if(CollectionUtils.isNotEmpty(complianceResultEOList)){ if(CollectionUtils.isNotEmpty(complianceResultEOList)){
this.disposeData(complianceResultEOList,cut);
List<String> complianceResultIdList = complianceResultEOList.stream().map(LawsTechnologyEvaluationComplianceResultEO::getId).distinct().collect(Collectors.toList()); List<String> complianceResultIdList = complianceResultEOList.stream().map(LawsTechnologyEvaluationComplianceResultEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<LawsTechnologyEvaluationResultEO> evaluationResultEOQueryWrapper = new QueryWrapper<>(); QueryWrapper<LawsTechnologyEvaluationResultEO> evaluationResultEOQueryWrapper = new QueryWrapper<>();
evaluationResultEOQueryWrapper.lambda().in(LawsTechnologyEvaluationResultEO::getComplianceResultId,complianceResultIdList); evaluationResultEOQueryWrapper.lambda().in(LawsTechnologyEvaluationResultEO::getComplianceResultId,complianceResultIdList);
@@ -174,7 +178,7 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
lawsTechnologyEvaluationComplianceResultEO.setIds(ids); lawsTechnologyEvaluationComplianceResultEO.setIds(ids);
} }
List<LawsTechnologyEvaluationComplianceResultEO> exportData = this.queryList(lawsTechnologyEvaluationComplianceResultEO, request, cut); List<LawsTechnologyEvaluationComplianceResultEO> exportData = this.queryList(lawsTechnologyEvaluationComplianceResultEO, request, cut);
this.disposeData(exportData,cut); this.disposeData(exportData,cut,lawsTechnologyEvaluationComplianceResultEO);
String title = ""; String title = "";
String bottomTitle = ""; String bottomTitle = "";
@@ -224,23 +228,28 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
cell.setCellValue(titleArr[j]); cell.setCellValue(titleArr[j]);
} }
int complianceResultNameRow = 1;
//获取这个评估人填写的评估结果 //获取这个评估人填写的评估结果
List<LawsTechnologyEvaluationResultEO> lawsTechnologyEvaluationResultEOList = exportData.get(i).getLawsTechnologyEvaluationResultEOList(); List<LawsTechnologyEvaluationResultEO> lawsTechnologyEvaluationResultEOList = exportData.get(i).getLawsTechnologyEvaluationResultEOList();
int evaluationResultListSize = lawsTechnologyEvaluationResultEOList.size();
if(CollectionUtils.isNotEmpty(lawsTechnologyEvaluationResultEOList)){ if(CollectionUtils.isNotEmpty(lawsTechnologyEvaluationResultEOList)){
for (int dataIndex = 0; dataIndex < lawsTechnologyEvaluationResultEOList.size(); dataIndex++) { int evaluationResultListSize = lawsTechnologyEvaluationResultEOList.size();
Row dataRow = sheet.createRow(dataIndex + 1); if(CollectionUtils.isNotEmpty(lawsTechnologyEvaluationResultEOList)){
dataRow.createCell(0).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getRelatedSection()); for (int dataIndex = 0; dataIndex < lawsTechnologyEvaluationResultEOList.size(); dataIndex++) {
dataRow.createCell(1).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getIssueOrSuggest()); Row dataRow = sheet.createRow(dataIndex + 1);
dataRow.createCell(2).setCellValue(lawsTechnologyEvaluationResultEOList.get(dataIndex).getAccessoryFileName()); 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表格中。 //把符合性结果设置进excel表格中。
Row bottomRow = sheet.createRow(evaluationResultListSize + 1); Row bottomRow = sheet.createRow(complianceResultNameRow);
Cell bottomRowFirstCell = bottomRow.createCell(0); Cell bottomRowFirstCell = bottomRow.createCell(0);
bottomRowFirstCell.setCellStyle(titleCellStyle); 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<LawsTechnologyEvaluationComplianceResultEO> datas,String cut){ public void disposeData(List<LawsTechnologyEvaluationComplianceResultEO> datas,String cut,LawsTechnologyEvaluationComplianceResultEO lawsTechnologyEvaluationComplianceResultEO){
if(CollectionUtils.isNotEmpty(datas)){ if(CollectionUtils.isNotEmpty(datas)){
for (LawsTechnologyEvaluationComplianceResultEO data : datas) { for (LawsTechnologyEvaluationComplianceResultEO data : datas) {
if(!StringUtils.isEmpty(data.getComplianceResult())){ if(!StringUtils.isEmpty(data.getComplianceResult())){
@@ -324,6 +333,47 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
} }
} }
} }
//获取当前法规技术评估下面的所有评估人
QueryWrapper<LawsTechnologyEvaluationFlowDetailEO> flowDetailQueryWrap = new QueryWrapper<>();
flowDetailQueryWrap.lambda().eq(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId,lawsTechnologyEvaluationComplianceResultEO.getLawsTechnologyEvaluationId());
List<LawsTechnologyEvaluationFlowDetailEO> flowDetailEOList = this.lawsTechnologyEvaluationFlowDetailEOService.list(flowDetailQueryWrap);
List<SysUser> evaluatorUserList = null;
if(CollectionUtils.isNotEmpty(flowDetailEOList)){
List<String> 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<SysUser> 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);
}
}
}
} }
} }