| | |
| | | return projectMapper.selectList(new QueryWrapper<MesPdProjectDO>().lambda().eq(MesPdProjectDO::getProductCode,productCode).eq(MesPdProjectDO::getStatus, MesPdProjectStatusEnum.ARCHIVE.getStatus())); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, Integer> getPendingAuditCountMap(Collection<Long> projectIds) { |
| | | if (CollUtil.isEmpty(projectIds)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | // 1. 批量查出这些项目下的所有资料 |
| | | List<MesPdDocumentDO> documents = documentService.getDocumentListByProjectIds(projectIds); |
| | | if (CollUtil.isEmpty(documents)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | // 2. 资料ID -> 项目ID |
| | | Map<Long, Long> documentProjectIdMap = convertMap(documents, MesPdDocumentDO::getId, MesPdDocumentDO::getProjectId); |
| | | // 3. 批量查出所有待审核记录(auditStatus=0) |
| | | List<MesPdDocumentAuditDO> pendingAudits = |
| | | documentAuditMapper.selectPendingAuditListByDocumentIds(documentProjectIdMap.keySet()); |
| | | // 4. 按项目统计待审核文件数 |
| | | Map<Long, Integer> result = new HashMap<>(); |
| | | for (MesPdDocumentAuditDO audit : pendingAudits) { |
| | | Long projectId = documentProjectIdMap.get(audit.getDocumentId()); |
| | | if (projectId != null) { |
| | | result.merge(projectId, 1, Integer::sum); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private void validateProjectInitiate(MesPdProjectDO project) { |
| | | if (!MesPdProjectStatusEnum.INITIATE.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_INITIATE); |