From 7cbf3dae614d093618861b356fa6d1896e4da3dc Mon Sep 17 00:00:00 2001 From: wangzhijiang Date: Sat, 6 May 2023 17:40:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=8A=B6=E6=80=81=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E5=AF=BC=E5=87=BA-=E9=A1=B9=E7=9B=AE=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E3=80=81=E9=A1=B9=E7=9B=AE=E8=BF=9B=E5=BA=A6=E6=A6=82?= =?UTF-8?q?=E8=A7=88=E5=86=85=E5=AE=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ParamsCollectManifestEOMapper.java | 2 + .../xml/ParamsCollectManifestEOMapper.xml | 3 + .../IParamsCollectManifestEOService.java | 2 + .../ParamsCollectManifestEOServiceImpl.java | 6 + .../ProjectStatusBoardController.java | 7 + ...rojectCertificationInventoryEOService.java | 21 + .../IProjectLawsInventoryEOService.java | 21 + .../service/IProjectStatusBoardService.java | 9 + ...ctCertificationInventoryEOServiceImpl.java | 260 ++++++- .../ProjectLawsInventoryEOServiceImpl.java | 356 +++++++++- .../impl/ProjectLibraryBaseServiceImpl.java | 2 +- .../impl/ProjectStatusBoardServiceImpl.java | 634 +++++++++++++++++- 12 files changed, 1310 insertions(+), 13 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectManifestEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectManifestEOMapper.java index 3d3f6db04..64eb78905 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectManifestEOMapper.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectManifestEOMapper.java @@ -35,4 +35,6 @@ public interface ParamsCollectManifestEOMapper extends BaseMapper queryByProjectId(@Param("projectId") String projectId); + + List getList(@Param("params") Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml index a64c16f48..2d9e849f9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml @@ -139,5 +139,8 @@ + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java index a7d0a23e0..5c11b45c7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java @@ -200,4 +200,6 @@ public interface IParamsCollectManifestEOService extends IService batchEditDeadline(ParamsCollectManifestVO paramsCollectManifestVO); + + List getList(Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java index 273743f88..c33192062 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java @@ -7256,4 +7256,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl getList(Map params) { + List result = this.baseMapper.getList(params); + return result; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectStatusBoardController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectStatusBoardController.java index 6d3e4570c..d2da8dcb3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectStatusBoardController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectStatusBoardController.java @@ -12,9 +12,11 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.List; import java.util.Map; @@ -81,6 +83,11 @@ public class ProjectStatusBoardController { return Result.OK(mapList); } + // 导出excel文件 + @RequestMapping(value = "/exportXls") + public void exportXls(HttpServletResponse response, HttpServletRequest request, ProjectLibraryBase projectLibraryBase) { + this.iProjectStatusBoardService.exportXls(response,request, projectLibraryBase); + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java index 8a4017306..32d7da54b 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java @@ -288,4 +288,25 @@ public interface IProjectCertificationInventoryEOService extends IService> getPartCertificationProgressStatistics(List pciEoList); + + /** + * 按照认证任务确认状态分组 + * @param pciEos + * @return + */ + Map groupByFGRwqrStatus(List pciEos); + + /** + * 按照preHomo确认状态分组 + * @param pciEos + * @return + */ + Map groupByPreHomoStatus(List pciEos); + + /** + * 根据认证进度分组 + * @param pciEos + * @return + */ + Map groupByCertificationProgress(List pciEos); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java index f4e021a17..5a1fac321 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java @@ -281,4 +281,25 @@ public interface IProjectLawsInventoryEOService extends IService> queryNotComplianList(Map params); void exportNotComplianList(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 按照法规任务确认状态分组 + * @param pliEos + * @return + */ + Map groupByFGRwqrStatus(List pliEos); + + /** + * 按照设计符合性状态分组 + * @param pliEos + * @return + */ + Map groupByDesignStatus(List pliEos); + + /** + * 按照验证符合性状态分组 + * @param pliEos + * @return + */ + Map groupByVerifyStatus(List pliEos); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectStatusBoardService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectStatusBoardService.java index 36e76b058..3194b7e20 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectStatusBoardService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectStatusBoardService.java @@ -4,6 +4,7 @@ import com.jero.modules.project.entity.ProjectLibraryBase; import com.jero.modules.project.vo.TimeNodeVO; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.List; import java.util.Map; @@ -31,4 +32,12 @@ public interface IProjectStatusBoardService { * @param req */ List> scheduleInfoList(ProjectLibraryBase projectLibraryBase, HttpServletRequest req); + + /** + * 导出excel文件 + * @param response + * @param request + * @param projectLibraryBase + */ + void exportXls(HttpServletResponse response, HttpServletRequest request, ProjectLibraryBase projectLibraryBase); } 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 f961c3e34..f7770a7c2 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 @@ -84,10 +84,7 @@ import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import java.io.*; -import java.text.Collator; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.text.*; import java.util.*; import java.util.stream.Collectors; @@ -112,6 +109,9 @@ import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServic @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl implements IProjectCertificationInventoryEOService { + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; + @Autowired private ISysUserService sysUserService; @Autowired @@ -5602,4 +5602,256 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl groupByFGRwqrStatus(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double toBeReleasedCount = 0; + double toBeVerifiedCount = 0; + double toBeConfirmedCount = 0; + double acceptCount = 0; + double refuseCount = 0; + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pciEos)){ + List toBeReleased = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeVerified = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeConfirmed = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List accept = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List refuse = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + toBeReleasedCount = toBeReleased.size(); + toBeVerifiedCount = toBeVerified.size(); + toBeConfirmedCount = toBeConfirmed.size(); + acceptCount = accept.size(); + refuseCount = refuse.size(); + + count = toBeReleasedCount + toBeVerifiedCount + toBeConfirmedCount + acceptCount + refuseCount; + // 计算百分比 + percentage = acceptCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("toBeReleased",toBeReleasedCount); + projectScheduleExportMap.put("toBeVerified",toBeVerifiedCount); + projectScheduleExportMap.put("toBeConfirmed",toBeConfirmedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByPreHomoStatus(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double acceptCount = 0; // 审查通过 + double refuseCount = 0; // 审查退回 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pciEos)){ + List notStart = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeSubmitted = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeReviewed = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List accept = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List refuse = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = notStart.size(); + toBeSubmittedCount = toBeSubmitted.size(); + toBeReviewedCount = toBeReviewed.size(); + acceptCount = accept.size(); + refuseCount = refuse.size(); + + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + acceptCount + refuseCount; + // 计算百分比 + percentage = acceptCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStartCount",notStartCount); + projectScheduleExportMap.put("toBeSubmittedCount",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewedCount",toBeReviewedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByCertificationProgress(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 待开始 + double inProgressCount = 0; // 进行中 + double testPassedCount = 0; // 实验通过 + double testFailedCount = 0; // 实验失败 + double notSubmitCount = 0; // 部件报告未上传 + double reportSubmitCount = 0; // 部件报告已上传 + double storedCount = 0; // 部件报告已入库 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + + if(CollectionUtils.isNotEmpty(pciEos)){ + // 未开始 + List notStartPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + notStartCount = (double) notStartPciEoList.size(); + + // 进行中 + List inProgressPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + inProgressCount = (double) inProgressPciEoList.size(); + + // 实验通过 + List testPassedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + testPassedCount = (double) testPassedPciEoList.size(); + + // 实验失败 + List testFailedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + testFailedCount = (double) testFailedPciEoList.size(); + + // 部件报告未提交 + List notSubmitPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + notSubmitCount = (double) notSubmitPciEoList.size(); + + // 部件报告已提交 + List reportSubmitPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + reportSubmitCount = (double) reportSubmitPciEoList.size(); + + // 部件报告已入库 + List storedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + storedCount = (double) storedPciEoList.size(); + + count = notStartCount + inProgressCount + testPassedCount + testFailedCount + testFailedCount + notSubmitCount + reportSubmitCount + storedCount; + // 计算百分比 + percentage = testPassedCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + projectScheduleExportMap.put("notStartCount",notStartCount); + projectScheduleExportMap.put("inProgressCount",inProgressCount); + projectScheduleExportMap.put("testPassedCount",testPassedCount); + projectScheduleExportMap.put("testFailedCount",testFailedCount); + projectScheduleExportMap.put("notSubmitCount",notSubmitCount); + projectScheduleExportMap.put("reportSubmitCount",reportSubmitCount); + projectScheduleExportMap.put("storedCount",storedCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java index f346ee4ed..c75184a8d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java @@ -124,10 +124,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; -import java.text.Collator; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.text.*; import java.util.List; import java.util.*; import java.util.stream.Collectors; @@ -147,6 +144,8 @@ import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServic @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl implements IProjectLawsInventoryEOService { + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; @Autowired private ProjectLibraryBaseMapper projectLibraryBaseMapper; @@ -12880,4 +12879,353 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl groupByFGRwqrStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + Map toBeReleasedMap = new HashMap<>(); + Map toBeVerifiedMap = new HashMap<>(); + Map toBeConfirmedMap = new HashMap<>(); + Map acceptMap = new HashMap<>(); + Map refuseMap = new HashMap<>(); + + double toBeReleasedCount = 0; + double toBeVerifiedCount = 0; + double toBeConfirmedCount = 0; + double acceptCount = 0; + double refuseCount = 0; + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List designToBeReleased = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeReleased = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeReleasedMap.put("designToBeReleased",designToBeReleased); + toBeReleasedMap.put("verifyToBeReleased",verifyToBeReleased); + + List designToBeVerified = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeVerified = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeVerifiedMap.put("designToBeVerified",designToBeVerified); + toBeVerifiedMap.put("verifyToBeVerified",verifyToBeVerified); + + List designToBeConfirmed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeConfirmed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeConfirmedMap.put("designToBeConfirmed",designToBeConfirmed); + toBeConfirmedMap.put("verifyToBeConfirmed",verifyToBeConfirmed); + + List designAccept = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyAccept = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + acceptMap.put("designAccept",designAccept); + acceptMap.put("verifyAccept",verifyAccept); + + List designRefuse = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyRefuse = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + refuseMap.put("designRefuse",designRefuse); + refuseMap.put("verifyRefuse",verifyRefuse); + + toBeReleasedCount = designToBeReleased.size() + verifyToBeReleased.size(); + toBeVerifiedCount = designToBeVerified.size() + verifyToBeVerified.size(); + toBeConfirmedCount = designToBeConfirmed.size() + verifyToBeConfirmed.size(); + acceptCount = designAccept.size() + verifyAccept.size(); + refuseCount = designRefuse.size() + verifyRefuse.size(); + count = toBeReleasedCount + toBeVerifiedCount + toBeConfirmedCount + acceptCount + refuseCount; + // 计算百分比 + percentage = acceptCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + result.put(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue(),toBeReleasedMap); + result.put(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue(),toBeVerifiedMap); + result.put(ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue(),toBeConfirmedMap); + result.put(ComplianceFlowStatusEnum.CONFORMITY.getValue(),acceptMap); + result.put(ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue(),refuseMap); + + projectScheduleExportMap.put("toBeReleased",toBeReleasedCount); + projectScheduleExportMap.put("toBeVerified",toBeVerifiedCount); + projectScheduleExportMap.put("toBeConfirmed",toBeConfirmedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByDesignStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double complianceCount = 0; // 符合 + double nonComplianceCount = 0; // 不符合 + double toBeTrackedCount = 0; // 待追踪 + double notInvolvedCount = 0; // 不涉及 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List designNotStart = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeSubmitted = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeReviewed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designNonCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeTracked = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designNotInvolved = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List taskTermination = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = designNotStart.size(); + toBeSubmittedCount = designToBeSubmitted.size(); + toBeReviewedCount = designToBeReviewed.size(); + complianceCount = designCompliance.size(); + nonComplianceCount = designNonCompliance.size(); + toBeTrackedCount = designToBeTracked.size(); + notInvolvedCount = designNotInvolved.size(); + taskTerminationCount = taskTermination.size(); + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + complianceCount + nonComplianceCount + toBeTrackedCount + notInvolvedCount + taskTerminationCount; + // 计算百分比 + percentage = complianceCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStart",notStartCount); + projectScheduleExportMap.put("toBeSubmitted",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewed",toBeReviewedCount); + projectScheduleExportMap.put("compliance",complianceCount); + projectScheduleExportMap.put("nonCompliance",nonComplianceCount); + projectScheduleExportMap.put("toBeTracked",toBeTrackedCount); + projectScheduleExportMap.put("notInvolved",notInvolvedCount); + projectScheduleExportMap.put("taskTermination",taskTerminationCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByVerifyStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double complianceCount = 0; // 符合 + double nonComplianceCount = 0; // 不符合 + double toBeTrackedCount = 0; // 待追踪 + double notInvolvedCount = 0; // 不涉及 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List verifyNotStart = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeSubmitted = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeReviewed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyNonCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeTracked = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyNotInvolved = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List taskTermination = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = verifyNotStart.size(); + toBeSubmittedCount = verifyToBeSubmitted.size(); + toBeReviewedCount = verifyToBeReviewed.size(); + complianceCount = verifyCompliance.size(); + nonComplianceCount = verifyNonCompliance.size(); + toBeTrackedCount = verifyToBeTracked.size(); + notInvolvedCount = verifyNotInvolved.size(); + taskTerminationCount = taskTermination.size(); + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + complianceCount + nonComplianceCount + toBeTrackedCount + notInvolvedCount + taskTerminationCount; + // 计算百分比 + percentage = complianceCount / count * 100; + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStart",notStartCount); + projectScheduleExportMap.put("toBeSubmitted",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewed",toBeReviewedCount); + projectScheduleExportMap.put("compliance",complianceCount); + projectScheduleExportMap.put("nonCompliance",nonComplianceCount); + projectScheduleExportMap.put("toBeTracked",toBeTrackedCount); + projectScheduleExportMap.put("notInvolved",notInvolvedCount); + projectScheduleExportMap.put("taskTermination",taskTerminationCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } } 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 796352687..71dd57ef4 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 @@ -1345,7 +1345,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl params, List targetMarketList, ProjectLibraryBase projectLibraryBase) { + public String getMarket(Map params, List targetMarketList, ProjectLibraryBase projectLibraryBase) { List dictModelList = new ArrayList<>(); for (String s : projectLibraryBase.getTargetMarket().split(",")) { List dictModelListTemp = targetMarketList.stream() diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java index 170c0f48e..c8bc99b02 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java @@ -1,33 +1,52 @@ package com.jero.modules.project.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.utils.IOUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.jero.common.constant.enums.CutEnum; +import com.jero.common.exception.JeroBootException; import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; -import com.jero.modules.project.entity.ConditionAssessmentEO; -import com.jero.modules.project.entity.ProjectLawsInventoryEO; -import com.jero.modules.project.entity.ProjectLibraryBase; -import com.jero.modules.project.entity.ProjectTaskInventoryEO; +import com.jero.common.util.DateUtils; +import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; +import com.jero.modules.cert.collect.entity.ParamsManifestEO; +import com.jero.modules.cert.collect.enums.CollectManifestStatisticsStateEnum; +import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; +import com.jero.modules.cert.collect.service.IParamsManifestEOService; +import com.jero.modules.project.entity.*; import com.jero.modules.project.enums.*; import com.jero.modules.project.mapper.ProjectUserPermissionMapper; import com.jero.modules.project.service.IConditionAssessmentEOService; +import com.jero.modules.project.service.IProjectCertificationInventoryEOService; +import com.jero.modules.project.service.IProjectLibraryStatisticsService; import com.jero.modules.project.service.IProjectStatusBoardService; import com.jero.modules.project.vo.TimeNodeVO; import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.enums.DicCodeEnum; import com.jero.modules.system.mapper.SysRoleMapper; import com.jero.modules.system.service.IProjectUserBrandService; import com.jero.modules.system.service.ISysUserService; import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import lombok.SneakyThrows; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; import org.apache.shiro.SecurityUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -39,6 +58,8 @@ import java.util.stream.Collectors; */ @Service public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService { + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; @Autowired private ProjectTaskPlanningServiceImpl projectTaskPlanningService; @Autowired @@ -59,6 +80,14 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService private IProjectUserBrandService projectUserBrandService; @Autowired private ISysUserService sysUserService; + @Autowired + private IProjectCertificationInventoryEOService projectCertificationInventoryEOService; + @Autowired + private IParamsManifestEOService paramsManifestEOService; + @Autowired + private IParamsCollectManifestEOService paramsCollectManifestEOService; + @Autowired + private IProjectLibraryStatisticsService projectLibraryStatisticsService; /** @@ -508,4 +537,601 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService } + @Override + public void exportXls(HttpServletResponse response, HttpServletRequest request,ProjectLibraryBase projectLibraryBase) { + String fileName = ""; + String cut = projectLibraryBase.getCut(); + OutputStream ops = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + List plbEoList = this.projectLibraryBaseService.getList(projectLibraryBase); + List dictItemList = sysDictItemServiceImpl.selectItemsByDictCode("region"); + for (ProjectLibraryBase libraryBase : plbEoList) { + targetMarket(projectLibraryBase, dictItemList, libraryBase); + } + List pliEoList = this.projectLawsInventoryEOService.list(); + List pciEoList = this.projectCertificationInventoryEOService.list(); + List ptpEoList = this.projectTaskPlanningService.list(); + List pmEoList = this.paramsManifestEOService.list(); + List pcmEoList = this.paramsCollectManifestEOService.getList(null); + + this.exportCrossProjectProgress(workbook,projectLibraryBase,plbEoList,pliEoList,pciEoList,pmEoList,pcmEoList,ptpEoList); + this.exportOverviewCrossProjectProgress(workbook,projectLibraryBase,plbEoList,pliEoList,pciEoList,pmEoList,pcmEoList,ptpEoList); + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + ops = response.getOutputStream(); + workbook.write(ops); + ops.flush(); + }catch (IOException ex){ + ex.printStackTrace(); + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + }finally { + IOUtils.closeQuietly(ops); + } + } + + /** + * 导出跨项目进度 + * @param workbook + * @param projectLibraryBase + * @param plbEoList + * @param pliEoList + * @param pciEoList + * @param pmEoList + * @param pcmEoList + * @param ptpEoList + */ + private void exportCrossProjectProgress(HSSFWorkbook workbook, + ProjectLibraryBase projectLibraryBase, + List plbEoList, + List pliEoList, + List pciEoList, + List pmEoList, + List pcmEoList, + List ptpEoList) { + String cut = projectLibraryBase.getCut(); + String sheetName = "项目进度"; + String firstTitle = "项目," + + "法规任务确认," + + "设计符合性确认," + + "验证符合性确认," + + "认证任务确认," + + "Pre-Homo确认," + + "认证进度," + + "参数收集"; + String secondTitle = "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + + "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,设计核查日期," + + "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,验证核查日期," + + "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + + "未发起,待提交,待审查,审查通过,审查退回,完成度,认证开始日期," + + "待开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库,完成度,认证提交时间," + + "未开始,收集中,已提交,已同步至上报库,完成度,认证提交时间"; + if(com.jero.modules.system.util.StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "Project Progress"; + firstTitle = "Project," + + "Confirmation of regulatory tasks," + + "Confirmation of design compliance," + + "Verification of compliance confirmation," + + "Certification task confirmation," + + "Pre Homo confirmation," + + "Certification progress," + + "Parameter collection"; + secondTitle = "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + + "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Design verification date," + + "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Verification verification date," + + "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + + "Not initiated,To be submitted,Pending review,Review passed,Review return,Completion degree,Certification start date," + + "To begin,In progress,Experiment passed,Experimental failure,Component report not submitted,Component report submitted,Component report has been stored,Completion degree,Certification submission time," + + "Not started,Collecting,Submitted,Synchronized to the upper report library,Completion degree,Certification submission time"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + + CellRangeAddress region1 = new CellRangeAddress(0, 1, 0, 0); + sheet.addMergedRegion(region1); + CellRangeAddress region6 = new CellRangeAddress(0, 0, 1, 7); + sheet.addMergedRegion(region6); + CellRangeAddress region7 = new CellRangeAddress(0, 0, 8, 17); + sheet.addMergedRegion(region7); + CellRangeAddress region8 = new CellRangeAddress(0, 0, 18, 27); + sheet.addMergedRegion(region8); + CellRangeAddress region9 = new CellRangeAddress(0, 0, 28, 34); + sheet.addMergedRegion(region9); + CellRangeAddress region10 = new CellRangeAddress(0, 0, 35, 41); + sheet.addMergedRegion(region10); + CellRangeAddress region11 = new CellRangeAddress(0, 0, 42, 50); + sheet.addMergedRegion(region11); + CellRangeAddress region12 = new CellRangeAddress(0, 0, 51, 56); + sheet.addMergedRegion(region12); + + String[] firstTitleArr = firstTitle.split(","); + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + for (int i = 0; i <= 56; i++){ + sheet.setColumnWidth(i, 4000); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 0){ + firstRowCell.setCellValue(firstTitleArr[0]); + }else if(i == 1){ + firstRowCell.setCellValue(firstTitleArr[1]); + }else if(i == 8){ + firstRowCell.setCellValue(firstTitleArr[2]); + }else if(i == 18){ + firstRowCell.setCellValue(firstTitleArr[3]); + }else if(i == 28){ + firstRowCell.setCellValue(firstTitleArr[4]); + }else if(i == 35){ + firstRowCell.setCellValue(firstTitleArr[5]); + }else if(i == 42){ + firstRowCell.setCellValue(firstTitleArr[6]); + }else if(i == 51){ + firstRowCell.setCellValue(firstTitleArr[7]); + } + if(i >= 1){ + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellValue(secondTitleArr[i-1]); + } + } + + this.exportCrossProjectProgressSetData(plbEoList, sheet,pliEoList,pciEoList,pmEoList,pcmEoList,projectLibraryBase,ptpEoList); + } + + /** + * 导出跨项目进度-设置数据 + * @param plbEoList + * @param sheet + * @param pliEoList + * @param pciEoList + * @param pmEoList + * @param pcmEoList + * @param projectLibraryBase + * @param ptpEoList + */ + private void exportCrossProjectProgressSetData(List plbEoList, + HSSFSheet sheet, + List pliEoList, + List pciEoList, + List pmEoList, + List pcmEoList, + ProjectLibraryBase projectLibraryBase, + List ptpEoList) { + int dataIndex = 2; + for (ProjectLibraryBase plbEo : plbEoList) { + Row dataRow = sheet.createRow(dataIndex); + dataRow.createCell(0).setCellValue(plbEo.getShowName()); + + List ptpEoListTemp = ptpEoList.stream().filter(ptpEo -> StringUtils.equals(ptpEo.getProjectId(), plbEo.getId())).collect(Collectors.toList()); + String legalTaskConfirmationStr = ""; + String designDeadlineStr = ""; + String verifyDeadlineStr = ""; + String attestationStartTimeStr = ""; + String certificationSubmissionStr = ""; + if(CollectionUtils.isNotEmpty(ptpEoListTemp)){ + Date legalTaskConfirmation = ptpEoListTemp.get(0).getLegalTaskConfirmation(); + if (ObjectUtils.isNotEmpty(legalTaskConfirmation)) { + legalTaskConfirmationStr = DateUtils.formatDate(legalTaskConfirmation); + } + Date designDeadline = ptpEoListTemp.get(0).getDesignDeadline(); + if (ObjectUtils.isNotEmpty(designDeadline)) { + designDeadlineStr = DateUtils.formatDate(designDeadline); + } + Date verifyDeadline = ptpEoListTemp.get(0).getVerifyDeadline(); + if (ObjectUtils.isNotEmpty(verifyDeadline)) { + verifyDeadlineStr = DateUtils.formatDate(verifyDeadline); + } + Date attestationStartTime = ptpEoListTemp.get(0).getAttestationStartTime(); + if (ObjectUtils.isNotEmpty(attestationStartTime)) { + attestationStartTimeStr = DateUtils.formatDate(attestationStartTime); + } + Date certificationSubmission = ptpEoListTemp.get(0).getCertificationSubmission(); + if (ObjectUtils.isNotEmpty(certificationSubmission)) { + certificationSubmissionStr = DateUtils.formatDate(certificationSubmission); + } + } + List pliEos = pliEoList.stream().filter(pliEo -> StringUtils.equals(pliEo.getProjectLibraryId(), plbEo.getId())).collect(Collectors.toList()); + Map fgRwqrMap = this.projectLawsInventoryEOService.groupByFGRwqrStatus(pliEos); + Map fgRwqrProjectScheduleExportMap = (Map) fgRwqrMap.get("projectScheduleExportMap"); + double fgrqqrToBeReleased = (double) fgRwqrProjectScheduleExportMap.get("toBeReleased"); + double fgrqqrToBeVerified = (double) fgRwqrProjectScheduleExportMap.get("toBeVerified"); + double fgrqqrToBeConfirmed = (double) fgRwqrProjectScheduleExportMap.get("toBeConfirmed"); + double fgrqqrAccept = (double) fgRwqrProjectScheduleExportMap.get("accept"); + double fgrqqrRefuse = (double) fgRwqrProjectScheduleExportMap.get("refuse"); + String fgrqqrPercentage = (String) fgRwqrProjectScheduleExportMap.get("percentage"); + dataRow.createCell(1).setCellValue(fgrqqrToBeReleased); + dataRow.createCell(2).setCellValue(fgrqqrToBeVerified); + dataRow.createCell(3).setCellValue(fgrqqrToBeConfirmed); + dataRow.createCell(4).setCellValue(fgrqqrAccept); + dataRow.createCell(5).setCellValue(fgrqqrRefuse); + dataRow.createCell(6).setCellValue(fgrqqrPercentage); + dataRow.createCell(7).setCellValue(legalTaskConfirmationStr); + + Map designMap = this.projectLawsInventoryEOService.groupByDesignStatus(pliEos); + Map designMapProjectScheduleExportMap = (Map) designMap.get("projectScheduleExportMap"); + double designNotStart = (double) designMapProjectScheduleExportMap.get("notStart"); + double designToBeSubmitted = (double) designMapProjectScheduleExportMap.get("toBeSubmitted"); + double designToBeReviewed = (double) designMapProjectScheduleExportMap.get("toBeReviewed"); + double designCompliance = (double) designMapProjectScheduleExportMap.get("compliance"); + double designNonCompliance = (double) designMapProjectScheduleExportMap.get("nonCompliance"); + double designToBeTracked = (double) designMapProjectScheduleExportMap.get("toBeTracked"); + double designNotInvolved = (double) designMapProjectScheduleExportMap.get("notInvolved"); + double designTaskTermination = (double) designMapProjectScheduleExportMap.get("taskTermination"); + // double designCount = (double) designMapProjectScheduleExportMap.get("count"); + String designPercentage = (String) designMapProjectScheduleExportMap.get("percentage"); + dataRow.createCell(8).setCellValue(designNotStart); + dataRow.createCell(9).setCellValue(designToBeSubmitted); + dataRow.createCell(10).setCellValue(designToBeReviewed); + dataRow.createCell(11).setCellValue(designCompliance); + dataRow.createCell(12).setCellValue(designNonCompliance); + dataRow.createCell(13).setCellValue(designToBeTracked); + dataRow.createCell(14).setCellValue(designNotInvolved); + dataRow.createCell(15).setCellValue(designTaskTermination); + dataRow.createCell(16).setCellValue(designPercentage); + dataRow.createCell(17).setCellValue(designDeadlineStr); + + Map verifyMap = this.projectLawsInventoryEOService.groupByVerifyStatus(pliEos); + Map verifyMapProjectScheduleExportMap = (Map) verifyMap.get("projectScheduleExportMap"); + double verifyNotStart = (double) verifyMapProjectScheduleExportMap.get("notStart"); + double verifyToBeSubmitted = (double) verifyMapProjectScheduleExportMap.get("toBeSubmitted"); + double verifyToBeReviewed = (double) verifyMapProjectScheduleExportMap.get("toBeReviewed"); + double verifyCompliance = (double) verifyMapProjectScheduleExportMap.get("compliance"); + double verifyNonCompliance = (double) verifyMapProjectScheduleExportMap.get("nonCompliance"); + double verifyToBeTracked = (double) verifyMapProjectScheduleExportMap.get("toBeTracked"); + double verifyNotInvolved = (double) verifyMapProjectScheduleExportMap.get("notInvolved"); + double verifyTaskTermination = (double) verifyMapProjectScheduleExportMap.get("taskTermination"); + double verifyCount = (double) verifyMapProjectScheduleExportMap.get("count"); + String verifyPercentage = (String) verifyMapProjectScheduleExportMap.get("percentage"); + dataRow.createCell(18).setCellValue(verifyNotStart); + dataRow.createCell(19).setCellValue(verifyToBeSubmitted); + dataRow.createCell(20).setCellValue(verifyToBeReviewed); + dataRow.createCell(21).setCellValue(verifyCompliance); + dataRow.createCell(22).setCellValue(verifyNonCompliance); + dataRow.createCell(23).setCellValue(verifyToBeTracked); + dataRow.createCell(24).setCellValue(verifyNotInvolved); + dataRow.createCell(25).setCellValue(verifyTaskTermination); + dataRow.createCell(26).setCellValue(verifyPercentage); + dataRow.createCell(27).setCellValue(verifyDeadlineStr); + + List pciEos = pciEoList.stream().filter(pciEo -> StringUtils.equals(pciEo.getProjectLibraryId(), plbEo.getId())).collect(Collectors.toList()); + Map rzRwqrMap = this.projectCertificationInventoryEOService.groupByFGRwqrStatus(pciEos); + Map rzRwqrProjectScheduleExportMap = (Map) rzRwqrMap.get("projectScheduleExportMap"); + double rzRqqrToBeReleased = (double) rzRwqrProjectScheduleExportMap.get("toBeReleased"); + double rzRqqrToBeVerified = (double) rzRwqrProjectScheduleExportMap.get("toBeVerified"); + double rzRqqrToBeConfirmed = (double) rzRwqrProjectScheduleExportMap.get("toBeConfirmed"); + double rzRqqrAccept = (double) rzRwqrProjectScheduleExportMap.get("accept"); + double rzRqqrRefuse = (double) rzRwqrProjectScheduleExportMap.get("refuse"); + String rzRqqrPercentage = (String) rzRwqrProjectScheduleExportMap.get("percentage"); + dataRow.createCell(28).setCellValue(rzRqqrToBeReleased); + dataRow.createCell(29).setCellValue(rzRqqrToBeVerified); + dataRow.createCell(30).setCellValue(rzRqqrToBeConfirmed); + dataRow.createCell(31).setCellValue(rzRqqrAccept); + dataRow.createCell(32).setCellValue(rzRqqrRefuse); + dataRow.createCell(33).setCellValue(rzRqqrPercentage); + dataRow.createCell(34).setCellValue(legalTaskConfirmationStr); + + Map preHomoMap = this.projectCertificationInventoryEOService.groupByPreHomoStatus(pciEos); + Map preHomoProjectScheduleExportMap = (Map) preHomoMap.get("projectScheduleExportMap"); + double preHomoNotStartCount = (double) preHomoProjectScheduleExportMap.get("notStartCount"); + double preHomoToBeSubmittedCount = (double) preHomoProjectScheduleExportMap.get("toBeSubmittedCount"); + double preHomoToBeReviewedCount = (double) preHomoProjectScheduleExportMap.get("toBeReviewedCount"); + double preHomoAccept = (double) preHomoProjectScheduleExportMap.get("accept"); + double preHomoRefuse = (double) preHomoProjectScheduleExportMap.get("refuse"); + String preHomoPercentage = (String) preHomoProjectScheduleExportMap.get("percentage"); + dataRow.createCell(35).setCellValue(preHomoNotStartCount); + dataRow.createCell(36).setCellValue(preHomoToBeSubmittedCount); + dataRow.createCell(37).setCellValue(preHomoToBeReviewedCount); + dataRow.createCell(38).setCellValue(preHomoAccept); + dataRow.createCell(39).setCellValue(preHomoRefuse); + dataRow.createCell(40).setCellValue(preHomoPercentage); + dataRow.createCell(41).setCellValue(attestationStartTimeStr); + + Map certificationProgressMap = this.projectCertificationInventoryEOService.groupByCertificationProgress(pciEos); + Map certificationProgressMapProjectScheduleExportMap = (Map) certificationProgressMap.get("projectScheduleExportMap"); + double certificationProgressNotStartCount = (double) certificationProgressMapProjectScheduleExportMap.get("notStartCount"); + double certificationProgressInProgressCount = (double) certificationProgressMapProjectScheduleExportMap.get("inProgressCount"); + double certificationProgressTestPassedCount = (double) certificationProgressMapProjectScheduleExportMap.get("testPassedCount"); + double certificationProgressTestFailedCount = (double) certificationProgressMapProjectScheduleExportMap.get("testFailedCount"); + double certificationProgressNotSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("notSubmitCount"); + double certificationProgressReportSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("reportSubmitCount"); + double certificationProgressStoredCount = (double) certificationProgressMapProjectScheduleExportMap.get("storedCount"); + // String certificationProgressCount = (String) certificationProgressMapProjectScheduleExportMap.get("count"); + String certificationProgressPercentage = (String) certificationProgressMapProjectScheduleExportMap.get("percentage"); + dataRow.createCell(42).setCellValue(certificationProgressNotStartCount); + dataRow.createCell(43).setCellValue(certificationProgressInProgressCount); + dataRow.createCell(44).setCellValue(certificationProgressTestPassedCount); + dataRow.createCell(45).setCellValue(certificationProgressTestFailedCount); + dataRow.createCell(46).setCellValue(certificationProgressNotSubmitCount); + dataRow.createCell(47).setCellValue(certificationProgressReportSubmitCount); + dataRow.createCell(48).setCellValue(certificationProgressStoredCount); + dataRow.createCell(49).setCellValue(certificationProgressPercentage); + dataRow.createCell(50).setCellValue(certificationSubmissionStr); + + + List pmEos = pmEoList.stream().filter(pmEo -> { + return StringUtils.equals(pmEo.getProjectId(), plbEo.getId()); + }).collect(Collectors.toList()); + + double notStartAmount = 0; + double collectingAmount = 0; + double submitAmount = 0; + double syncReporAmount = 0; + String parameterCollectingPercentageStr = "0"; + if(CollectionUtils.isNotEmpty(pmEos)){ + List pmEoIdList = pmEos.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + + List pcmEos = pcmEoList.stream().filter(pcmEo -> { + boolean flag = false; + for (String pmEoId : pmEoIdList) { + if (StringUtils.equals(pmEoId, pcmEo.getParamsManifestId())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + Map parameterCollectingMap = this.projectLibraryStatisticsService.getParameterCollectingStatisticsGroupByTerritory(pcmEos,null); + Map notStartMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.NOT_START.getValue()); + notStartAmount = (double) notStartMap.get("amount"); + Map collectingMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.COLLECTING.getValue()); + collectingAmount = (double) collectingMap.get("amount"); + Map submitMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SUBMIT.getValue()); + submitAmount = (double) submitMap.get("amount"); + Map syncReporMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SYNC_REPORT.getValue()); + syncReporAmount = (double) syncReporMap.get("amount"); + + double parameterCollectingCount = notStartAmount + collectingAmount + submitAmount + syncReporAmount; + double parameterCollectingPercentage = (syncReporAmount / parameterCollectingCount) * 100; + parameterCollectingPercentageStr = (parameterCollectingPercentage != 0 && (syncReporAmount !=0 )) ? df.format(parameterCollectingPercentage) : "0"; + } + dataRow.createCell(51).setCellValue(notStartAmount); + dataRow.createCell(52).setCellValue(collectingAmount); + dataRow.createCell(53).setCellValue(submitAmount); + dataRow.createCell(54).setCellValue(syncReporAmount); + dataRow.createCell(55).setCellValue(parameterCollectingPercentageStr + percentSign); + dataRow.createCell(56).setCellValue(certificationSubmissionStr); + dataIndex ++; + } + } + + /** + * 导出跨项目进度概览 + * @param workbook + * @param projectLibraryBase + * @param plbEoList + * @param pliEoList + * @param pciEoList + * @param pmEoList + * @param pcmEoList + * @param ptpEoList + */ + private void exportOverviewCrossProjectProgress(HSSFWorkbook workbook, + ProjectLibraryBase projectLibraryBase, + List plbEoList, + List pliEoList, + List pciEoList, + List pmEoList, + List pcmEoList, + List ptpEoList) { + String cut = projectLibraryBase.getCut(); + String sheetName = "项目进度概览"; + String firstTitle = "项目,R&H Studio,法规符合性管理,认证活动管理"; + String secondTitle = ",,法规任务确认,设计符合性,验证符合性,认证任务确认,Pre-Homo确认,认证参数收集,认证进度"; + if(com.jero.modules.system.util.StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "Overview of project progress"; + firstTitle = "Project,R&H Studio,Regulatory compliance management,Certification Activity Management"; + secondTitle = ",,Confirmation of regulatory tasks," + + "Design compliance," + + "Verify compliance," + + "Certification task confirmation," + + "Pre Homo confirmation," + + "Authentication parameter collection," + + "Certification progress"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + CellRangeAddress region1 = new CellRangeAddress(0, 1, 0, 0); + sheet.addMergedRegion(region1); + CellRangeAddress region2 = new CellRangeAddress(0, 1, 1, 1); + sheet.addMergedRegion(region2); + CellRangeAddress region3 = new CellRangeAddress(0, 0, 2, 4); + sheet.addMergedRegion(region3); + CellRangeAddress region4 = new CellRangeAddress(0, 0, 5, 8); + sheet.addMergedRegion(region4); + + String[] firstTitleArr = firstTitle.split(","); + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER); + for (int i = 0; i <= 8; i++){ + sheet.setColumnWidth(i, 4000); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 0){ + firstRowCell.setCellValue(firstTitleArr[0]); + }else if(i == 1){ + firstRowCell.setCellValue(firstTitleArr[1]); + }else if(i == 2){ + firstRowCell.setCellValue(firstTitleArr[2]); + }else if(i == 5){ + firstRowCell.setCellValue(firstTitleArr[3]); + } + + if(i >= 2){ + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellStyle(cellStyleTitle); + secondRowCell.setCellValue(secondTitleArr[i]); + } + } + this.exportOverviewCrossProjectProgressSetData(plbEoList, sheet,pliEoList,pciEoList,pmEoList,pcmEoList,projectLibraryBase,ptpEoList,cellStyleTitle); + } + + /** + * 导出跨项目进度概览-设置数据 + * @param plbEoList + * @param sheet + * @param pliEoList + * @param pciEoList + * @param pmEoList + * @param pcmEoList + * @param projectLibraryBase + * @param ptpEoList + * @param cellStyleTitle + */ + private void exportOverviewCrossProjectProgressSetData(List plbEoList, + HSSFSheet sheet, + List pliEoList, + List pciEoList, + List pmEoList, + List pcmEoList, + ProjectLibraryBase projectLibraryBase, + List ptpEoList, + CellStyle cellStyleTitle) { + int dataIndex = 2; + for (ProjectLibraryBase plbEo : plbEoList) { + List ptpEoListTemp = ptpEoList.stream().filter(ptpEo -> StringUtils.equals(ptpEo.getProjectId(), plbEo.getId())).collect(Collectors.toList()); + String legalTaskConfirmationStr = ""; + String designDeadlineStr = ""; + String verifyDeadlineStr = ""; + String attestationStartTimeStr = ""; + String certificationSubmissionStr = ""; + if(CollectionUtils.isNotEmpty(ptpEoListTemp)){ + Date legalTaskConfirmation = ptpEoListTemp.get(0).getLegalTaskConfirmation(); + if (ObjectUtils.isNotEmpty(legalTaskConfirmation)) { + legalTaskConfirmationStr = DateUtils.formatDate(legalTaskConfirmation); + } + Date designDeadline = ptpEoListTemp.get(0).getDesignDeadline(); + if (ObjectUtils.isNotEmpty(designDeadline)) { + designDeadlineStr = DateUtils.formatDate(designDeadline); + } + Date verifyDeadline = ptpEoListTemp.get(0).getVerifyDeadline(); + if (ObjectUtils.isNotEmpty(verifyDeadline)) { + verifyDeadlineStr = DateUtils.formatDate(verifyDeadline); + } + Date attestationStartTime = ptpEoListTemp.get(0).getAttestationStartTime(); + if (ObjectUtils.isNotEmpty(attestationStartTime)) { + attestationStartTimeStr = DateUtils.formatDate(attestationStartTime); + } + Date certificationSubmission = ptpEoListTemp.get(0).getCertificationSubmission(); + if (ObjectUtils.isNotEmpty(certificationSubmission)) { + certificationSubmissionStr = DateUtils.formatDate(certificationSubmission); + } + } + + List pliEos = pliEoList.stream().filter(pliEo -> StringUtils.equals(pliEo.getProjectLibraryId(), plbEo.getId())).collect(Collectors.toList()); + Map fgRwqrMap = this.projectLawsInventoryEOService.groupByFGRwqrStatus(pliEos); + Map fgRwqrProjectScheduleExportMap = (Map) fgRwqrMap.get("projectScheduleExportMap"); + String fgrqqrPercentage = (String) fgRwqrProjectScheduleExportMap.get("percentage"); + + Map designMap = this.projectLawsInventoryEOService.groupByDesignStatus(pliEos); + Map designMapProjectScheduleExportMap = (Map) designMap.get("projectScheduleExportMap"); + String designPercentage = (String) designMapProjectScheduleExportMap.get("percentage"); + + Map verifyMap = this.projectLawsInventoryEOService.groupByVerifyStatus(pliEos); + Map verifyMapProjectScheduleExportMap = (Map) verifyMap.get("projectScheduleExportMap"); + String verifyPercentage = (String) verifyMapProjectScheduleExportMap.get("percentage"); + + List pciEos = pciEoList.stream().filter(pciEo -> StringUtils.equals(pciEo.getProjectLibraryId(), plbEo.getId())).collect(Collectors.toList()); + Map rzRwqrMap = this.projectCertificationInventoryEOService.groupByFGRwqrStatus(pciEos); + Map rzRwqrProjectScheduleExportMap = (Map) rzRwqrMap.get("projectScheduleExportMap"); + String rzRqqrPercentage = (String) rzRwqrProjectScheduleExportMap.get("percentage"); + + Map preHomoMap = this.projectCertificationInventoryEOService.groupByPreHomoStatus(pciEos); + Map preHomoProjectScheduleExportMap = (Map) preHomoMap.get("projectScheduleExportMap"); + String preHomoPercentage = (String) preHomoProjectScheduleExportMap.get("percentage"); + + List pmEos = pmEoList.stream().filter(pmEo -> { + return StringUtils.equals(pmEo.getProjectId(), plbEo.getId()); + }).collect(Collectors.toList()); + + String parameterCollectingPercentageStr = "0" + percentSign; + if(CollectionUtils.isNotEmpty(pmEos)){ + List pmEoIdList = pmEos.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + + List pcmEos = pcmEoList.stream().filter(pcmEo -> { + boolean flag = false; + for (String pmEoId : pmEoIdList) { + if (StringUtils.equals(pmEoId, pcmEo.getParamsManifestId())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + Map parameterCollectingMap = this.projectLibraryStatisticsService.getParameterCollectingStatisticsGroupByTerritory(pcmEos,null); + Map notStartMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.NOT_START.getValue()); + double notStartAmount = (double) notStartMap.get("amount"); + Map collectingMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.COLLECTING.getValue()); + double collectingAmount = (double) collectingMap.get("amount"); + Map submitMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SUBMIT.getValue()); + double submitAmount = (double) submitMap.get("amount"); + Map syncReporMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SYNC_REPORT.getValue()); + double syncReporAmount = (double) syncReporMap.get("amount"); + + double parameterCollectingCount = notStartAmount + collectingAmount + submitAmount + syncReporAmount; + double parameterCollectingPercentage = (syncReporAmount / parameterCollectingCount) * 100; + parameterCollectingPercentageStr = (parameterCollectingPercentage != 0 && (syncReporAmount !=0 )) ? df.format(parameterCollectingPercentage) + percentSign : "0" + percentSign; + } + + Map certificationProgressMap = this.projectCertificationInventoryEOService.groupByCertificationProgress(pciEos); + Map certificationProgressMapProjectScheduleExportMap = (Map) certificationProgressMap.get("projectScheduleExportMap"); + String certificationProgressPercentage = (String) certificationProgressMapProjectScheduleExportMap.get("percentage"); + + CellRangeAddress regionCell1 = new CellRangeAddress(dataIndex, dataIndex + 1, 0, 0); + sheet.addMergedRegion(regionCell1); + CellRangeAddress regionCell2 = new CellRangeAddress(dataIndex, dataIndex + 1, 1, 1); + sheet.addMergedRegion(regionCell2); + Row dataRow = sheet.createRow(dataIndex); + Row dataRow2 = sheet.createRow(dataIndex + 1); + + for (int i = 0; i < 9; i++) { + sheet.setColumnWidth(i, 4000); + Cell dataRowCell = dataRow.createCell(i); + dataRowCell.setCellStyle(cellStyleTitle); + Cell dataRow2Cell = dataRow2.createCell(i); + dataRow2Cell.setCellStyle(cellStyleTitle); + if(i == 0){ + dataRowCell.setCellValue(plbEo.getShowName()); + }else if(i==1){ + dataRowCell.setCellValue(plbEo.getStudioEngineerName()); + }else if(i==2){ + dataRowCell.setCellValue(legalTaskConfirmationStr); + dataRow2Cell.setCellValue(fgrqqrPercentage); + }else if(i==3){ + dataRowCell.setCellValue(designDeadlineStr); + dataRow2Cell.setCellValue(designPercentage); + }else if(i==4){ + dataRowCell.setCellValue(verifyDeadlineStr); + dataRow2Cell.setCellValue(verifyPercentage); + }else if(i==5){ + dataRowCell.setCellValue(legalTaskConfirmationStr); + dataRow2Cell.setCellValue(rzRqqrPercentage); + }else if(i==6){ + dataRowCell.setCellValue(attestationStartTimeStr); + dataRow2Cell.setCellValue(preHomoPercentage); + }else if(i==7){ + dataRowCell.setCellValue(attestationStartTimeStr); + dataRow2Cell.setCellValue(parameterCollectingPercentageStr); + }else if(i==8){ + dataRowCell.setCellValue(certificationSubmissionStr); + dataRow2Cell.setCellValue(certificationProgressPercentage); + } + } + dataIndex += 2; + } + } + }