diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java index 548ac6a32..64790607f 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java @@ -40,6 +40,9 @@ public enum OperatorTypeEnum { QUERY_CERTIFICATION_PROGRESS_STATISTICS("查询认证进度统计","queryCertificationProgressStatistics"), QUERY_FG_TASK_TO_CONFIRM_STATISTICS("查询法规任务确认统计","queryFGTaskToConfirmStatistics"), QUERY_RZ_TASK_TO_CONFIRM_STATISTICS("查询认证任务确认统计","queryRZTaskToConfirmStatistics"), + QUERY_CERTIFICATION_PROGRESS_STATISTICS_ALL("查询认证进度统计-全部","queryCertificationProgressStatisticsAll"), + QUERY_CERTIFICATION_PROGRESS_STATISTICS_CAR("查询认证进度统计-整车","queryCertificationProgressStatisticsCar"), + QUERY_CERTIFICATION_PROGRESS_STATISTICS_PART("查询认证进度统计-零部件","queryCertificationProgressStatisticsPart"), ADD_LAWS_OPINION_GATHER("添加法规意见收集数据","addLawsOpinionGather"), UPDATE_LAWS_OPINION_GATHER_GATHER_RESULT("更新法规意见收集数据收集结果","updateLawsOpinionGatherGatherResult"), diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLawsInventoryEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLawsInventoryEOMapper.xml index f106f4482..6d2dc3451 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLawsInventoryEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLawsInventoryEOMapper.xml @@ -115,7 +115,8 @@ duty_territory as "dutyTerritory", flow_status as "flowStatus", regulation_owner_id as "regulationOwnerId", - duty_id as "dutyId" + duty_id as "dutyId", + stand_id as "standId" from ( SELECT id, @@ -126,7 +127,8 @@ design_flow_status as flow_status, regulation_owner_id, design_duty_id as duty_id, - project_library_id + project_library_id, + stand_id FROM project_laws_inventory WHERE @@ -145,7 +147,8 @@ verify_flow_status as flow_status, regulation_owner_id, verify_duty_id as duty_id, - project_library_id + project_library_id, + stand_id FROM project_laws_inventory WHERE @@ -158,10 +161,10 @@ order by temp.${params.orderByField} - + asc - + desc diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java index 66059e1bd..0c23387e8 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java @@ -1,5 +1,6 @@ package com.jero.modules.project.service; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.entity.ProjectLawsInventoryEO; import java.util.List; @@ -32,4 +33,44 @@ public interface IProjectLibraryStatisticsService { * @return */ Map getVerifyComplianceStatisticeGroupByTerritory(List datas, Map params); + + /** + * 获取认证清单-任务确认统计信息-根据责任领域分组 + * @param datas + * @param params + * @return + */ + Map getRZTaskToConfirmStatisticsGroupByTerritory(List datas, Map params); + + /** + * 获取认证清单-Pre-Homo统计信息-根据责任领域分组 + * @param datas + * @param params + * @return + */ + Map getPrehomoStatisticeGroupByTerritory(List datas, Map params); + + /** + * 获取认证清单-全部-认证进度统计信息-根据责任领域分组 + * @param datas + * @param params + * @return + */ + Map getAllCertificationProgressStatisticsGroupByTerritory(List datas, Map params); + + /** + * 获取认证清单-整车-认证进度统计信息-根据责任领域分组 + * @param datas + * @param params + * @return + */ + Map getCarCertificationProgressStatisticsGroupByTerritory(List datas, Map params); + + /** + * 获取认证清单-零部件-认证进度统计信息-根据责任领域分组 + * @param datas + * @param params + * @return + */ + Map getPartCertificationProgressStatisticsGroupByTerritory(List datas, Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index e7085fffc..f961c3e34 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -2812,21 +2812,21 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl { boolean flag = ( - StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) ); return flag; }).count(); // 部件报告已提交 reportSubmitCount = (int) pciEoList.stream().filter(pciEo -> { boolean flag = ( - StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) ); return flag; }).count(); // 部件报告已入库 storedCount = (int) pciEoList.stream().filter(pciEo -> { boolean flag = ( - StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) ); return flag; }).count(); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java index a0dfbaf18..3fac21149 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java @@ -50,6 +50,8 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.Row; import org.apache.shiro.SecurityUtils; import org.jetbrains.annotations.NotNull; @@ -1734,6 +1736,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl result = new HashMap<>(); + List> dataList = new ArrayList<>(); QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); @@ -1758,10 +1761,10 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl pliEoMap = new HashMap<>(); - Map> firstLevelDutyTerritoryMap = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); - if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMap)){ + Map> firstLevelDutyTerritoryMapFG = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMapFG)){ // 根据责任领域组装法规清单数据,后续计算使用 - for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMap.entrySet()) { + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMapFG.entrySet()) { String key = firstLevelMap.getKey(); List dutyTerritoryList = firstLevelMap.getValue(); if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ @@ -1786,92 +1789,191 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl projectLawsInventoryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList()); - if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ - if(ObjectUtils.isNotEmpty(pliEoMap)){ - - List> dataList = new ArrayList<>(); - for (Map.Entry pliMap : pliEoMap.entrySet()) { - String key = pliMap.getKey(); - JSONObject json = (JSONObject) pliMap.getValue(); - List pliEoList = (List) json.get("pliEoList"); - Map dataMaps = this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList,params); - Map dataMap = (Map) dataMaps.get(status); - double amount = (double) dataMap.get("amount"); - if(amount != 0){ - dataMap.put("dutyTerritoryName",key); - dataList.add(dataMap); - } - } - result.put("dataList",dataList); + for (Map.Entry pliMap : pliEoMap.entrySet()) { + String key = pliMap.getKey(); + JSONObject json = (JSONObject) pliMap.getValue(); + List pliEoList = (List) json.get("pliEoList"); + Map dataMaps = new HashMap<>(); + if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList,params); } - }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){ - params.put("projectLawsInventoryIdList",projectLawsInventoryIdList); - List> conditionAssessmentMapList = this.conditionAssessmentEOService.getProjectStatusAssessStatisticsGroupByTerritory(params); - 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> listingToConfirmList = this.projectLawsInventoryEOMapper.getListingToConfirmStatisticsGroupByTerritory(projectLibraryId,inventoryAffirmStatus); - 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> taskToConfirmList = this.projectLawsInventoryEOMapper.getTaskToConfirmStatisticsGroupByTerritory(projectLibraryId,taskAffirmStatus); - disposeData(taskToConfirmList,cut); - result.put("dataList",taskToConfirmList); - }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ - //设计符合性 - List> dataList = new ArrayList<>(); - for (Map.Entry pliMap : pliEoMap.entrySet()) { - String key = pliMap.getKey(); - JSONObject json = (JSONObject) pliMap.getValue(); - List pliEoList = (List) json.get("pliEoList"); - Map dataMaps = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList,params); - Map dataMap = (Map) dataMaps.get(status); - double amount = (double) dataMap.get("amount"); - if(amount != 0){ - dataMap.put("dutyTerritoryName",key); - dataList.add(dataMap); - } + if(ObjectUtils.isEmpty(dataMaps)){ + continue; } - result.put("dataList",dataList); - }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ - //prehomo确认 流程任务状态 - String prehomoFlowTaskStatus = (String) params.get("prehomoFlowTaskStatus"); - if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ - List> prehomoList = this.projectTaskInventoryEOMapper.getPrehomoStatisticeGroupByTerritory(projectLawsInventoryIdList,prehomoFlowTaskStatus); - disposeData(prehomoList,cut); - result.put("dataList",prehomoList); - } - }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ - //验证符合性 流程任务状态 - List> dataList = new ArrayList<>(); - for (Map.Entry pliMap : pliEoMap.entrySet()) { - String key = pliMap.getKey(); - JSONObject json = (JSONObject) pliMap.getValue(); - List pliEoList = (List) json.get("pliEoList"); - Map dataMaps = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList,params); - Map dataMap = (Map) dataMaps.get(status); - double amount = (double) dataMap.get("amount"); - if(amount != 0){ - dataMap.put("dutyTerritoryName",key); - dataList.add(dataMap); - } - } - result.put("dataList",dataList); - }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){ - //认证进度 流程任务状态 - String certificationProgress = (String) params.get("certificationProgress"); - - if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ - List> certificationProgressList = this.projectTaskInventoryEOMapper.getCertificationProgressStatisticsGroupByTerritory(projectLawsInventoryIdList,certificationProgress); - disposeData(certificationProgressList,cut); - result.put("dataList",certificationProgressList); + Map dataMap = (Map) dataMaps.get(status); + double amount = (double) dataMap.get("amount"); + if(amount != 0){ + dataMap.put("dutyTerritoryName",key); + dataList.add(dataMap); } } + if(CollectionUtils.isNotEmpty(dataList)){ + result.put("dataList",dataList); + return result; + } +// if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ +// if(ObjectUtils.isNotEmpty(pliEoMap)){ +// +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// } +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){ +// params.put("projectLawsInventoryIdList",projectLawsInventoryIdList); +// List> conditionAssessmentMapList = this.conditionAssessmentEOService.getProjectStatusAssessStatisticsGroupByTerritory(params); +// 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> listingToConfirmList = this.projectLawsInventoryEOMapper.getListingToConfirmStatisticsGroupByTerritory(projectLibraryId,inventoryAffirmStatus); +// 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> taskToConfirmList = this.projectLawsInventoryEOMapper.getTaskToConfirmStatisticsGroupByTerritory(projectLibraryId,taskAffirmStatus); +// disposeData(taskToConfirmList,cut); +// result.put("dataList",taskToConfirmList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ +// //设计符合性 +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ +// //prehomo确认 流程任务状态 +// String prehomoFlowTaskStatus = (String) params.get("prehomoFlowTaskStatus"); +// if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ +// List> prehomoList = this.projectTaskInventoryEOMapper.getPrehomoStatisticeGroupByTerritory(projectLawsInventoryIdList,prehomoFlowTaskStatus); +// disposeData(prehomoList,cut); +// result.put("dataList",prehomoList); +// } +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ +// //验证符合性 流程任务状态 +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){ +// //认证进度 流程任务状态 +// String certificationProgress = (String) params.get("certificationProgress"); +// +// if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ +// List> certificationProgressList = this.projectTaskInventoryEOMapper.getCertificationProgressStatisticsGroupByTerritory(projectLawsInventoryIdList,certificationProgress); +// disposeData(certificationProgressList,cut); +// result.put("dataList",certificationProgressList); +// } +// } + } + + Map pciEoMap = new HashMap<>(); + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + List projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(pciQueryWrap); + String pciDutyTerritoryStr = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(pciDutyTerritoryStr)) { + List pciDutyTerritoryList = Arrays.asList(pciDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pliDutyTerritory : pciDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pliDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + Map> firstLevelDutyTerritoryMapRZ = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMapRZ)){ + // 根据责任领域组装法规清单数据,后续计算使用 + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMapRZ.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pciEoList = projectCertificationInventoryEOList.stream().filter(pciEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pciEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + JSONObject json = new JSONObject(); + json.put("dutyTerritoryList",dutyTerritoryList); + json.put("pciEoList",pciEoList); + pciEoMap.put(key,json); + } + } + if (CollectionUtils.isNotEmpty(projectCertificationInventoryEOList) && ObjectUtils.isNotEmpty(pciEoMap)) { + for (Map.Entry pciMap : pciEoMap.entrySet()) { + String key = pciMap.getKey(); + JSONObject json = (JSONObject) pciMap.getValue(); + List pciEoList = (List) json.get("pciEoList"); + Map dataMaps = new HashMap<>(); + if(StringUtils.equals(OperatorTypeEnum.QUERY_RZ_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getRZTaskToConfirmStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getPrehomoStatisticeGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_ALL.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getAllCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_CAR.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getCarCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_PART.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getPartCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + } + if(ObjectUtils.isEmpty(dataMaps)){ + continue; + } + Map dataMap = (Map) dataMaps.get(status); + double amount = (double) dataMap.get("amount"); + if(amount != 0){ + dataMap.put("dutyTerritoryName",key); + dataList.add(dataMap); + } + } + result.put("dataList",dataList); } return result; } @@ -1884,8 +1986,25 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl projectDetailsStatisticsGroupByTerritory, Map params){ - List> exportData = new ArrayList<>(); - exportData = (List>) projectDetailsStatisticsGroupByTerritory.get("dataList"); + public void createSheetData(HSSFSheet sheet,Map exportDataMap, Map params){ + List> exportDataList = (List>) exportDataMap.get("dataList"); int rowIndex = 1; - for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { + for (int dataIndex = 0; dataIndex < exportDataList.size(); dataIndex++) { Row dataRow = sheet.createRow(rowIndex); - dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("dutyTerritoryName").toString()); - dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("amount").toString()); + dataRow.createCell(0).setCellValue(exportDataList.get(dataIndex).get("dutyTerritoryName").toString()); + dataRow.createCell(1).setCellValue(String.valueOf(Math.round((Double) exportDataList.get(dataIndex).get("amount")))); + dataRow.createCell(2).setCellValue(exportDataList.get(dataIndex).get("percentage").toString()); rowIndex ++; } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java index d263a4e5c..60973d5a7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java @@ -1,6 +1,9 @@ package com.jero.modules.project.service.impl; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.enums.CertificationInventoryFlowStatusEnum; +import com.jero.modules.project.enums.CertificationProgressEnum; import com.jero.modules.project.enums.ComplianceFlowStatusEnum; import com.jero.modules.project.enums.TaskAffirmStatusEnum; import com.jero.modules.project.service.IProjectCertificationInventoryEOService; @@ -12,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.DecimalFormat; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,6 +23,8 @@ import java.util.stream.Collectors; @Service public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStatisticsService { + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; @Autowired private IProjectLawsInventoryEOService projectLawsInventoryEOService; @Autowired @@ -30,7 +34,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati public Map getFGTaskToConfirmStatisticsGroupByTerritory(List datas, Map params) { Map result = new HashMap<>(); if(CollectionUtils.isNotEmpty(datas)){ - DecimalFormat df = new DecimalFormat("#.00"); String status = (String) params.get("status"); Map notStartedMap = new HashMap<>(); @@ -59,7 +62,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double notStartedPercentage = (notStartedComplianceFlowCount / (datas.size() * 2)) * 100; String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; notStartedMap.put("amount",notStartedComplianceFlowCount); - notStartedMap.put("percentage",notStartedPercentageStr + "%"); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); // 待确认 List toConfirmDesignPliEoList = datas.stream().filter(data -> { @@ -78,7 +81,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double toConfirmPercentage = (toConfirmComplianceFlowCount / (datas.size() * 2)) * 100; String toConfirmPercentageStr = toConfirmPercentage != 0 ? df.format(toConfirmPercentage) : "0"; toConfirmMap.put("amount",toConfirmComplianceFlowCount); - toConfirmMap.put("percentage",toConfirmPercentageStr + "%"); + toConfirmMap.put("percentage",toConfirmPercentageStr + percentSign); // 接受 List acceptedDesignPliEoList = datas.stream().filter(data -> { @@ -107,7 +110,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double acceptedPercentage = (acceptedComplianceFlowCount / (datas.size() * 2)) * 100; String acceptedPercentageStr = acceptedPercentage != 0 ? df.format(acceptedPercentage) : "0"; acceptedMap.put("amount",acceptedComplianceFlowCount); - acceptedMap.put("percentage",acceptedPercentageStr + "%"); + acceptedMap.put("percentage",acceptedPercentageStr + percentSign); // 拒绝 List rejectedDesignPliEoList = datas.stream().filter(data -> { @@ -126,7 +129,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double rejectedPercentage = (rejectedComplianceFlowCount / (datas.size() * 2)) * 100; String rejectedPercentageStr = rejectedPercentage != 0 ? df.format(rejectedPercentage) : "0"; rejectedMap.put("amount",rejectedComplianceFlowCount); - rejectedMap.put("percentage",rejectedPercentageStr + "%"); + rejectedMap.put("percentage",rejectedPercentageStr + percentSign); result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); @@ -145,7 +148,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati Map complianceMap = new HashMap<>(); Map nonComplianceMap = new HashMap<>(); - DecimalFormat df = new DecimalFormat("#.00"); // 未发起 List notStartedDesignPliEoList = datas.stream().filter(data -> { boolean flag = ( @@ -161,7 +163,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double notStartedPercentage = (notStartedComplianceFlowCount / (datas.size())) * 100; String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; notStartedMap.put("amount",notStartedComplianceFlowCount); - notStartedMap.put("percentage",notStartedPercentageStr + "%"); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); // 待确认 List toConfirmDesignPliEoList = datas.stream().filter(data -> { @@ -176,7 +178,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double toConfirmPercentage = (toConfirmComplianceFlowCount / (datas.size())) * 100; String toConfirmPercentageStr = toConfirmPercentage != 0 ? df.format(toConfirmPercentage) : "0"; toConfirmMap.put("amount",toConfirmComplianceFlowCount); - toConfirmMap.put("percentage",toConfirmPercentageStr + "%"); + toConfirmMap.put("percentage",toConfirmPercentageStr + percentSign); // 符合 List complianceDesignPliEoList = datas.stream().filter(data -> { @@ -189,7 +191,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double compliancePercentage = (complianceFlowCount / (datas.size())) * 100; String compliancePercentageStr = compliancePercentage != 0 ? df.format(compliancePercentage) : "0"; complianceMap.put("amount",complianceFlowCount); - complianceMap.put("percentage",compliancePercentageStr + "%"); + complianceMap.put("percentage",compliancePercentageStr + percentSign); // 不符合 List nonComplianceDesignPliEoList = datas.stream().filter(data -> { @@ -202,7 +204,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double nonCompliancePercentage = (nonComplianceComplianceFlowCount / (datas.size())) * 100; String nonCompliancePercentageStr = nonCompliancePercentage != 0 ? df.format(nonCompliancePercentage) : "0"; nonComplianceMap.put("amount",nonComplianceComplianceFlowCount); - nonComplianceMap.put("percentage",nonCompliancePercentageStr + "%"); + nonComplianceMap.put("percentage",nonCompliancePercentageStr + percentSign); result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); @@ -220,8 +222,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati Map toConfirmMap = new HashMap<>(); Map complianceMap = new HashMap<>(); Map nonComplianceMap = new HashMap<>(); - - DecimalFormat df = new DecimalFormat("#.00"); // 未发起 List notStartedVerifyPliEoList = datas.stream().filter(data -> { boolean flag = ( @@ -237,7 +237,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double notStartedPercentage = (notStartedComplianceFlowCount / (datas.size())) * 100; String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; notStartedMap.put("amount",notStartedComplianceFlowCount); - notStartedMap.put("percentage",notStartedPercentageStr + "%"); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); // 待确认 List toConfirmVerifyPliEoList = datas.stream().filter(data -> { @@ -252,7 +252,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double toConfirmPercentage = (toConfirmComplianceFlowCount / (datas.size())) * 100; String toConfirmPercentageStr = toConfirmPercentage != 0 ? df.format(toConfirmPercentage) : "0"; toConfirmMap.put("amount",toConfirmComplianceFlowCount); - toConfirmMap.put("percentage",toConfirmPercentageStr + "%"); + toConfirmMap.put("percentage",toConfirmPercentageStr + percentSign); // 符合 List complianceVerifyPliEoList = datas.stream().filter(data -> { @@ -265,7 +265,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double compliancePercentage = (complianceFlowCount / (datas.size())) * 100; String compliancePercentageStr = compliancePercentage != 0 ? df.format(compliancePercentage) : "0"; complianceMap.put("amount",complianceFlowCount); - complianceMap.put("percentage",compliancePercentageStr + "%"); + complianceMap.put("percentage",compliancePercentageStr + percentSign); // 不符合 List nonComplianceVerifyPliEoList = datas.stream().filter(data -> { @@ -278,7 +278,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati double nonCompliancePercentage = (nonComplianceComplianceFlowCount / (datas.size())) * 100; String nonCompliancePercentageStr = nonCompliancePercentage != 0 ? df.format(nonCompliancePercentage) : "0"; nonComplianceMap.put("amount",nonComplianceComplianceFlowCount); - nonComplianceMap.put("percentage",nonCompliancePercentageStr + "%"); + nonComplianceMap.put("percentage",nonCompliancePercentageStr + percentSign); result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); @@ -287,4 +287,350 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati } return result; } + + @Override + public Map getRZTaskToConfirmStatisticsGroupByTerritory(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + // 未发起 + List notStartedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + double notStartedCount = (double) notStartedPciEoList.size(); + double notStartedPercentage = (notStartedCount / (datas.size())) * 100; + String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; + notStartedMap.put("amount",notStartedCount); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); + + // 待确认 + List toConfirmPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double toConfirmCount = (double) toConfirmPciEoList.size(); + double toConfirmPercentage = (toConfirmCount / (datas.size())) * 100; + String toConfirmPercentageStr = toConfirmPercentage != 0 ? df.format(toConfirmPercentage) : "0"; + toConfirmMap.put("amount",toConfirmCount); + toConfirmMap.put("percentage",toConfirmPercentageStr + percentSign); + + // 接受 + List acceptedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double acceptedCount = (double) acceptedPciEoList.size(); + double acceptedPercentage = (acceptedCount / (datas.size())) * 100; + String acceptedPercentageStr = acceptedPercentage != 0 ? df.format(acceptedPercentage) : "0"; + acceptedMap.put("amount",acceptedCount); + acceptedMap.put("percentage",acceptedPercentageStr + percentSign); + + // 拒绝 + List rejectedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double rejectedCount = (double) rejectedPciEoList.size(); + double rejectedPercentage = (rejectedCount / (datas.size())) * 100; + String rejectedPercentageStr = rejectedPercentage != 0 ? df.format(rejectedPercentage) : "0"; + rejectedMap.put("amount",rejectedCount); + rejectedMap.put("percentage",rejectedPercentageStr + percentSign); + + result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); + result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); + result.put(TaskAffirmStatusEnum.ACCEPTED.getValue(),acceptedMap); + result.put(TaskAffirmStatusEnum.REJECTED.getValue(),rejectedMap); + } + return result; + } + + @Override + public Map getPrehomoStatisticeGroupByTerritory(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + DecimalFormat df = new DecimalFormat("#.00"); + + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + // 未发起 + List notStartedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + double notStartedCount = (double) notStartedPciEoList.size(); + double notStartedPercentage = (notStartedCount / (datas.size())) * 100; + String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; + notStartedMap.put("amount",notStartedCount); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); + + // 待确认 + List toConfirmPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double toConfirmCount = (double) toConfirmPciEoList.size(); + double toConfirmPercentage = (toConfirmCount / (datas.size())) * 100; + String toConfirmPercentageStr = toConfirmPercentage != 0 ? df.format(toConfirmPercentage) : "0"; + toConfirmMap.put("amount",toConfirmCount); + toConfirmMap.put("percentage",toConfirmPercentageStr + percentSign); + + // 审查通过 + List acceptedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double acceptedCount = (double) acceptedPciEoList.size(); + double acceptedPercentage = (acceptedCount / (datas.size())) * 100; + String acceptedPercentageStr = acceptedPercentage != 0 ? df.format(acceptedPercentage) : "0"; + acceptedMap.put("amount",acceptedCount); + acceptedMap.put("percentage",acceptedPercentageStr + percentSign); + + // 审查退回 + List rejectedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double rejectedCount = (double) rejectedPciEoList.size(); + double rejectedPercentage = (rejectedCount / (datas.size())) * 100; + String rejectedPercentageStr = rejectedPercentage != 0 ? df.format(rejectedPercentage) : "0"; + rejectedMap.put("amount",rejectedCount); + rejectedMap.put("percentage",rejectedPercentageStr + percentSign); + + result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); + result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); + result.put(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue(),acceptedMap); + result.put(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue(),rejectedMap); + } + return result; + } + + @Override + public Map getAllCertificationProgressStatisticsGroupByTerritory(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notStartedMap = new HashMap<>(); + Map inProgressMap = new HashMap<>(); + Map testPassedMap = new HashMap<>(); + Map testFailedMap = new HashMap<>(); + + // 未开始 + List notStartedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(), CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double notStartedCount = (double) notStartedPciEoList.size(); + double notStartedPercentage = (notStartedCount / (datas.size())) * 100; + String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; + notStartedMap.put("amount",notStartedCount); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); + + // 进行中 + List inProgressPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double inProgressCount = (double) inProgressPciEoList.size(); + double inProgressPercentage = (inProgressCount / (datas.size())) * 100; + String inProgressPercentageStr = inProgressPercentage != 0 ? df.format(inProgressPercentage) : "0"; + inProgressMap.put("amount",inProgressCount); + inProgressMap.put("percentage",inProgressPercentageStr + percentSign); + + // 实验通过 + List testPassedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testPassedCount = (double) testPassedPciEoList.size(); + double testPassedPercentage = (testPassedCount / (datas.size())) * 100; + String testPassedPercentageStr = testPassedPercentage != 0 ? df.format(testPassedPercentage) : "0"; + testPassedMap.put("amount",testPassedCount); + testPassedMap.put("percentage",testPassedPercentageStr + percentSign); + + // 实验失败 + List testFailedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testFailedCount = (double) testFailedPciEoList.size(); + double testFailedPercentage = (testFailedCount / (datas.size())) * 100; + String testFailedPercentageStr = testFailedPercentage != 0 ? df.format(testFailedPercentage) : "0"; + testFailedMap.put("amount",testFailedCount); + testFailedMap.put("percentage",testFailedPercentageStr + percentSign); + + result.put(CertificationProgressEnum.NOT_START.getValue(),notStartedMap); + result.put(CertificationProgressEnum.IN_PROGRESS.getValue(),inProgressMap); + result.put(CertificationProgressEnum.TEST_PASSED.getValue(),testPassedMap); + result.put(CertificationProgressEnum.TEST_FAILED.getValue(),testFailedMap); + } + return result; + } + + @Override + public Map getCarCertificationProgressStatisticsGroupByTerritory(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notStartedMap = new HashMap<>(); + Map inProgressMap = new HashMap<>(); + Map testPassedMap = new HashMap<>(); + Map testFailedMap = new HashMap<>(); + + // 未开始 + List notStartedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double notStartedCount = (double) notStartedPciEoList.size(); + double notStartedPercentage = (notStartedCount / (datas.size())) * 100; + String notStartedPercentageStr = notStartedPercentage != 0 ? df.format(notStartedPercentage) : "0"; + notStartedMap.put("amount",notStartedCount); + notStartedMap.put("percentage",notStartedPercentageStr + percentSign); + + // 进行中 + List inProgressPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double inProgressCount = (double) inProgressPciEoList.size(); + double inProgressPercentage = (inProgressCount / (datas.size())) * 100; + String inProgressPercentageStr = inProgressPercentage != 0 ? df.format(inProgressPercentage) : "0"; + inProgressMap.put("amount",inProgressCount); + inProgressMap.put("percentage",inProgressPercentageStr + percentSign); + + // 实验通过 + List testPassedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testPassedCount = (double) testPassedPciEoList.size(); + double testPassedPercentage = (testPassedCount / (datas.size())) * 100; + String testPassedPercentageStr = testPassedPercentage != 0 ? df.format(testPassedPercentage) : "0"; + testPassedMap.put("amount",testPassedCount); + testPassedMap.put("percentage",testPassedPercentageStr + percentSign); + + // 实验失败 + List testFailedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testFailedCount = (double) testFailedPciEoList.size(); + double testFailedPercentage = (testFailedCount / (datas.size())) * 100; + String testFailedPercentageStr = testFailedPercentage != 0 ? df.format(testFailedPercentage) : "0"; + testFailedMap.put("amount",testFailedCount); + testFailedMap.put("percentage",testFailedPercentageStr + percentSign); + + result.put(CertificationProgressEnum.NOT_START.getValue(),notStartedMap); + result.put(CertificationProgressEnum.IN_PROGRESS.getValue(),inProgressMap); + result.put(CertificationProgressEnum.TEST_PASSED.getValue(),testPassedMap); + result.put(CertificationProgressEnum.TEST_FAILED.getValue(),testFailedMap); + } + return result; + } + + @Override + public Map getPartCertificationProgressStatisticsGroupByTerritory(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notSubmitMap = new HashMap<>(); + Map reportSubmitMap = new HashMap<>(); + Map storedMap = new HashMap<>(); + + // 部件报告未提交 + List notSubmitPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double notSubmitCount = (double) notSubmitPciEoList.size(); + double notSubmitPercentage = (notSubmitCount / (datas.size())) * 100; + String notSubmitPercentageStr = notSubmitPercentage != 0 ? df.format(notSubmitPercentage) : "0"; + notSubmitMap.put("amount",notSubmitCount); + notSubmitMap.put("percentage",notSubmitPercentageStr + percentSign); + + // 部件报告已提交 + List reportSubmitPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double reportSubmitCount = (double) reportSubmitPciEoList.size(); + double reportSubmitPercentage = (reportSubmitCount / (datas.size())) * 100; + String reportSubmitPercentageStr = reportSubmitPercentage != 0 ? df.format(reportSubmitPercentage) : "0"; + reportSubmitMap.put("amount",reportSubmitCount); + reportSubmitMap.put("percentage",reportSubmitPercentageStr + percentSign); + + // 部件报告已入库 + List storedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double storedCount = (double) storedPciEoList.size(); + double storedPercentage = (storedCount / (datas.size())) * 100; + String storedPercentageStr = storedPercentage != 0 ? df.format(storedPercentage) : "0"; + storedMap.put("amount",storedCount); + storedMap.put("percentage",storedPercentageStr + percentSign); + + result.put(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue(),notSubmitMap); + result.put(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue(),reportSubmitMap); + result.put(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue(),storedMap); + } + return result; + } }