This commit is contained in:
wangzhijiang
2022-05-20 10:29:24 +08:00
parent 99e4b27ed9
commit f4e9eb5553
@@ -16,9 +16,11 @@ import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectTaskInventoryEOMapper;
import com.jero.modules.project.service.IConditionAssessmentEOService;
import com.jero.modules.project.service.IProjectLibraryBaseService;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.mapper.SysDictItemMapper;
import com.jero.modules.system.mapper.SysUserMapper;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -68,6 +70,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
@Autowired
private IConditionAssessmentEOService conditionAssessmentEOService;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
/**
* 保存
*
@@ -321,7 +326,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(org.apache.commons.lang3.StringUtils.isEmpty(projectLibraryId)){
throw new JeroBootException("项目库id不能为空!");
}
String cut = (String) params.get("cut");
Map<String,Object> result = new HashMap<>();
QueryWrapper<ProjectLawsInventoryEO> lawsInventoryEOQueryWrapper = new QueryWrapper<>();
@@ -334,30 +339,35 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){
params.put("projectLawsInventoryIdList",projectLawsInventoryIdList);
List<Map<String, Object>> conditionAssessmentMapList = this.conditionAssessmentEOService.getProjectStatusAssessStatisticsGroupByTerritory(params);
result.put("conditionAssessmentMapList",conditionAssessmentMapList);
disposeData(conditionAssessmentMapList,cut);
result.put("dataList",conditionAssessmentMapList);
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_LISTING_TO_CONFIRM_STATISTICS.getValue(),operatorType)){
//清单确认 状态
String inventoryAffirmStatus = (String) params.get("inventoryAffirmStatus");
List<Map<String,Object>> listingToConfirmList = this.projectLawsInventoryEOMapper.getListingToConfirmStatisticsGroupByTerritory(projectLibraryId,inventoryAffirmStatus);
result.put("listingToConfirmList",listingToConfirmList);
disposeData(listingToConfirmList,cut);
result.put("dataList",listingToConfirmList);
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){
//任务确认 状态
String taskAffirmStatus = (String) params.get("taskAffirmStatus");
List<Map<String,Object>> taskToConfirmList = this.projectLawsInventoryEOMapper.getTaskToConfirmStatisticsGroupByTerritory(projectLibraryId,taskAffirmStatus);
result.put("taskToConfirmList",taskToConfirmList);
disposeData(taskToConfirmList,cut);
result.put("dataList",taskToConfirmList);
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){
//设计符合性 流程任务状态
String designFlowTaskStatus = (String) params.get("designFlowTaskStatus");
if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){
List<Map<String,Object>> designComplianceList = this.projectTaskInventoryEOMapper.getDesignComplianceStatisticeGroupByTerritory(projectLawsInventoryIdList,designFlowTaskStatus);
result.put("designComplianceList",designComplianceList);
disposeData(designComplianceList,cut);
result.put("dataList",designComplianceList);
}
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){
//prehomo确认 流程任务状态
String prehomoFlowTaskStatus = (String) params.get("prehomoFlowTaskStatus");
if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){
List<Map<String,Object>> prehomoList = this.projectTaskInventoryEOMapper.getPrehomoStatisticeGroupByTerritory(projectLawsInventoryIdList,prehomoFlowTaskStatus);
result.put("prehomoList",prehomoList);
disposeData(prehomoList,cut);
result.put("dataList",prehomoList);
}
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){
//验证符合性 流程任务状态
@@ -365,7 +375,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){
List<Map<String,Object>> verifyComplianceList = this.projectTaskInventoryEOMapper.getVerifyComplianceStatisticeGroupByTerritory(projectLawsInventoryIdList,verifyFlowTaskStatus);
result.put("verifyComplianceList",verifyComplianceList);
disposeData(verifyComplianceList,cut);
result.put("dataList",verifyComplianceList);
}
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){
//认证进度 流程任务状态
@@ -373,7 +384,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){
List<Map<String,Object>> certificationProgressList = this.projectTaskInventoryEOMapper.getCertificationProgressStatisticsGroupByTerritory(projectLawsInventoryIdList,certificationProgress);
result.put("certificationProgressList",certificationProgressList);
disposeData(certificationProgressList,cut);
result.put("dataList",certificationProgressList);
}
}
return result;
@@ -458,23 +470,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
public void createSheetData(HSSFSheet sheet,Map<String, Object> projectDetailsStatisticsGroupByTerritory, Map<String, Object> params){
List<Map<String,Object>> exportData = new ArrayList<>();
String operatorType = (String) params.get("operatorType");
if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("conditionAssessmentMapList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_LISTING_TO_CONFIRM_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("listingToConfirmList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("taskToConfirmList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("designComplianceList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("prehomoList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("verifyComplianceList");
}else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("certificationProgressList");
}
exportData = (List<Map<String, Object>>) projectDetailsStatisticsGroupByTerritory.get("dataList");
int rowIndex = 1;
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
Row dataRow = sheet.createRow(rowIndex);
@@ -483,6 +479,25 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
rowIndex ++;
}
}
/**
* 处理 根据领域统计的数据
* @param datas
* @param cut
*/
public void disposeData(List<Map<String,Object>> datas,String cut){
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsByDictCode("duty_territory");
if(CollectionUtils.isNotEmpty(datas)){
for (Map<String, Object> data : datas) {
List<SysDictItem> dutyTerritory = dictItemList.stream().filter(dict -> StringUtils.equals(dict.getItemValue(), data.get("dutyTerritory").toString())).collect(Collectors.toList());
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
data.put("",dutyTerritory.get(0).getItemText());
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
data.put("",dutyTerritory.get(0).getEnName());
}
}
}
}
}