diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java index e2380bb..29b7b6c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java @@ -8,6 +8,7 @@ import com.ningdatech.pmapi.projectdeclared.model.vo.ReviewCheckInfoVO; import com.ningdatech.pmapi.projectdeclared.model.vo.ReviewChecklistApproveVO; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectReviewCheckListItemVO; +import com.wflow.bean.dto.FormsReviewChecklistDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -48,7 +49,7 @@ public class ReviewChecklistController { @ApiOperation(value = "查看某个项目的意见汇总", notes = "查看某个项目的意见汇总") @GetMapping("/summary-list/{projectCode}") - public List summaryList(@PathVariable String projectCode) { + public List summaryList(@PathVariable String projectCode) { return reviewChecklistManage.summaryList(projectCode); } @@ -62,7 +63,7 @@ public class ReviewChecklistController { @ApiOperation(value = "项目审查清单 审批情况", notes = "项目审查清单 审批情况") @PostMapping("/approve-list/{projectCode}") @WebLog("项目审查清单 审批情况") - public List approveList(@PathVariable String projectCode) { + public List approveList(@PathVariable String projectCode) { return reviewChecklistManage.approveList(projectCode); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java index 640efa6..db3467b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java @@ -33,6 +33,9 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; +import com.wflow.bean.dto.FormsReviewChecklistDto; +import com.wflow.bean.dto.ReviewChecklistModuleDto; +import com.wflow.bean.dto.WflowFormsDto; import com.wflow.enums.ReviewChecklistResultEnum; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -238,7 +241,7 @@ public class ReviewChecklistManage { * @param projectCode * @return */ - public List summaryList(String projectCode) { + public List summaryList(String projectCode) { List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) .eq(ReviewChecklistApprove::getProjectCode, projectCode) .orderByAsc(ReviewChecklistApprove::getCreateOn)); @@ -247,22 +250,20 @@ public class ReviewChecklistManage { } //做成map - Map> groupSubMap = approves.stream() - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); - //去重子标题 + Map> groupTitleMap = approves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); + //去重标题 Set subTitleSet = Sets.newHashSet(); - List dupSubTitle = approves.stream().filter(r -> subTitleSet.add(r.getSubTitle())).collect(Collectors.toList()); + List dupTitle = approves.stream().filter(r -> subTitleSet.add(r.getTitle())) + .collect(Collectors.toList()); - List res = dupSubTitle.stream() + List res = dupTitle.stream() .map(r -> { - ReviewChecklistApproveVO vo = BeanUtil.copyProperties(r, ReviewChecklistApproveVO.class); - if(groupSubMap.containsKey(vo.getSubTitle())){ - List reviewChecklistApproves = groupSubMap.get(vo.getSubTitle()); - StringBuffer reviewCommentsSb = new StringBuffer(); - for(ReviewChecklistApprove approve : reviewChecklistApproves){ - reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + approve.getReviewComments() + "\n"); - } - vo.setReviewComments(reviewCommentsSb.toString()); + FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); + vo.setTitle(r.getTitle()); + if(groupTitleMap.containsKey(r.getTitle())){ + List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); + vo.setModules(convertModules(reviewChecklistApproves)); } return vo; }) @@ -302,29 +303,22 @@ public class ReviewChecklistManage { } //做成map 并且还要 未通过的 - Map> groupSubMap = approves.stream() + Map> groupTitleMap = approves.stream() .filter(r -> Objects.nonNull(r.getReviewResult()) && Lists.newArrayList( ReviewChecklistResultEnum.NOT_PASS.getCode(),ReviewChecklistResultEnum.ONE_VOTE_VETO.getCode()) .contains(r.getReviewResult())) - .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); + .collect(Collectors.groupingBy(ReviewChecklistApprove::getTitle)); //去重子标题 - Set subTitleSet = Sets.newHashSet(); - List dupSubTitle = approves.stream().filter(r -> subTitleSet.add(r.getSubTitle())).collect(Collectors.toList()); + Set titleSet = Sets.newHashSet(); + List dupTitle = approves.stream().filter(r -> titleSet.add(r.getTitle())).collect(Collectors.toList()); - List res = dupSubTitle.stream() + List res = dupTitle.stream() .map(r -> { - ReviewChecklistApproveVO vo = BeanUtil.copyProperties(r, ReviewChecklistApproveVO.class); - if(groupSubMap.containsKey(vo.getSubTitle())){ - List reviewChecklistApproves = groupSubMap.get(vo.getSubTitle()); - StringBuffer reviewCommentsSb = new StringBuffer(); - if(CollUtil.isEmpty(reviewChecklistApproves)){ - vo.setReviewComments("通过"); - }else{ - for(ReviewChecklistApprove approve : reviewChecklistApproves){ - reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + approve.getReviewComments() + "\n"); - } - vo.setReviewComments(reviewCommentsSb.toString()); - } + FormsReviewChecklistDto vo = new FormsReviewChecklistDto(); + vo.setTitle(r.getTitle()); + if(groupTitleMap.containsKey(r.getTitle())){ + List reviewChecklistApproves = groupTitleMap.get(r.getTitle()); + vo.setModules(convertModulesFinal(reviewChecklistApproves)); } return vo; }) @@ -337,8 +331,83 @@ public class ReviewChecklistManage { return BizConst.OP_SUCCESS; } - public List approveList(String projectCode) { + /** + * 查询 未审批人员 + * @param projectCode + * @return + */ + public List approveList(String projectCode) { + List reviewHumans = Lists.newArrayList();; + if(BizConst.DEV.equals(active)){ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD; + }else{ + reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD; + } + Set computeHumanSet = reviewHumans.stream().collect(Collectors.toSet()); + List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) + .eq(ReviewChecklistApprove::getProjectCode, projectCode) + .orderByAsc(ReviewChecklistApprove::getCreateOn)); + if(CollUtil.isEmpty(approves)){ + return Collections.emptyList(); + } + for(ReviewChecklistApprove approve : approves){ + computeHumanSet.remove(approve.getCreateByCode()); + } + return computeHumanSet.stream().collect(Collectors.toList()); + } + + private List convertModules(List reviewChecklistApproves) { + //做成map + Map> groupSubTitleMap = reviewChecklistApproves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); + //去重子标题 + Set subSubTitleSet = Sets.newHashSet(); + List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) + .collect(Collectors.toList()); + return dupSubTitle.stream() + .map(r -> { + ReviewChecklistModuleDto vo = BeanUtil.copyProperties(r,ReviewChecklistModuleDto.class); + vo.setSubTitle(r.getSubTitle()); + if(groupSubTitleMap.containsKey(r.getSubTitle())){ + List approves = groupSubTitleMap.get(r.getSubTitle()); + StringBuffer reviewCommentsSb = new StringBuffer(); + + for(ReviewChecklistApprove approve : reviewChecklistApproves){ + reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + approve.getReviewComments() + "\n"); + } + vo.setReviewComments(reviewCommentsSb.toString()); + } + return vo; + }) + .collect(Collectors.toList()); + } - return Collections.emptyList(); + private List convertModulesFinal(List reviewChecklistApproves) { + //做成map + Map> groupSubTitleMap = reviewChecklistApproves.stream() + .collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle)); + //去重子标题 + Set subSubTitleSet = Sets.newHashSet(); + List dupSubTitle = reviewChecklistApproves.stream().filter(r -> subSubTitleSet.add(r.getSubTitle())) + .collect(Collectors.toList()); + return dupSubTitle.stream() + .map(r -> { + ReviewChecklistModuleDto vo = BeanUtil.copyProperties(r,ReviewChecklistModuleDto.class); + vo.setSubTitle(r.getSubTitle()); + if(groupSubTitleMap.containsKey(r.getSubTitle())){ + List approves = groupSubTitleMap.get(r.getSubTitle()); + StringBuffer reviewCommentsSb = new StringBuffer(); + if(CollUtil.isEmpty(approves)){ + vo.setReviewComments("通过"); + }else{ + for(ReviewChecklistApprove approve : reviewChecklistApproves){ + reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + approve.getReviewComments() + "\n"); + } + vo.setReviewComments(reviewCommentsSb.toString()); + } + } + return vo; + }) + .collect(Collectors.toList()); } }