소스 검색

评审清单

master
PoffyZhang 1 년 전
부모
커밋
4123653c86
4개의 변경된 파일102개의 추가작업 그리고 1개의 파일을 삭제
  1. +93
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectReviewCheckListItemVO.java

+ 93
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java 파일 보기

@@ -2,10 +2,12 @@ package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
@@ -30,6 +32,7 @@ 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.enums.ReviewChecklistResultEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -235,11 +238,100 @@ public class ReviewChecklistManage {
* @return
*/
public List<ReviewChecklistApproveVO> summaryList(String projectCode) {
List<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.eq(ReviewChecklistApprove::getProjectCode, projectCode)
.orderByAsc(ReviewChecklistApprove::getCreateOn));
if(CollUtil.isEmpty(approves)){
return Collections.emptyList();
}

//做成map
Map<String, List<ReviewChecklistApprove>> groupSubMap = approves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle));
//去重子标题
Set<String> subTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> dupSubTitle = approves.stream().filter(r -> subTitleSet.add(r.getSubTitle())).collect(Collectors.toList());

return Collections.emptyList();
List<ReviewChecklistApproveVO> res = dupSubTitle.stream()
.map(r -> {
ReviewChecklistApproveVO vo = BeanUtil.copyProperties(r, ReviewChecklistApproveVO.class);
if(groupSubMap.containsKey(vo.getSubTitle())){
List<ReviewChecklistApprove> 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());
}
return vo;
})
.collect(Collectors.toList());

return res;
}

public String summary(String projectCode) {
//修改到 项目里去
Project project = projectService.getProjectByCode(projectCode);
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在");
VUtils.isTrue(Objects.nonNull(project.getReviewCheckFinish()) && project.getReviewCheckFinish())
.throwMessage("项目的审查清单已经合并过了!");

List<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.eq(ReviewChecklistApprove::getProjectCode, projectCode)
.orderByAsc(ReviewChecklistApprove::getCreateOn));
if(CollUtil.isEmpty(approves)){
throw new BizException("该项目 未被七大审查人 审批!");
}

List<String> reviewHumans = Lists.newArrayList();;
if(BizConst.DEV.equals(active)){
reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZYD;
}else{
reviewHumans = DeclaredProjectContant.ReviewChecklist.REVIEW_HUMANS_ZZD;
}
Set<String> computeHumanSet = reviewHumans.stream().collect(Collectors.toSet());
for(ReviewChecklistApprove approve : approves){
if(computeHumanSet.contains(approve.getCreateByCode())){
computeHumanSet.remove(approve.getCreateByCode());
}
}
if(CollUtil.isNotEmpty(computeHumanSet)){
throw new BizException("此项目的审查清单 未被七大审核人 审批完!");
}

//做成map 并且还要 未通过的
Map<String, List<ReviewChecklistApprove>> groupSubMap = 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));
//去重子标题
Set<String> subTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> dupSubTitle = approves.stream().filter(r -> subTitleSet.add(r.getSubTitle())).collect(Collectors.toList());

List<ReviewChecklistApproveVO> res = dupSubTitle.stream()
.map(r -> {
ReviewChecklistApproveVO vo = BeanUtil.copyProperties(r, ReviewChecklistApproveVO.class);
if(groupSubMap.containsKey(vo.getSubTitle())){
List<ReviewChecklistApprove> reviewChecklistApproves = groupSubMap.get(vo.getSubTitle());
StringBuffer reviewCommentsSb = new StringBuffer();
if(CollUtil.isEmpty(reviewChecklistApproves)){
vo.setReviewComments(reviewCommentsSb.toString());
}else{
for(ReviewChecklistApprove approve : reviewChecklistApproves){
reviewCommentsSb.append(approve.getCreateBy() + StrPool.COLON + approve.getReviewComments() + "\n");
}
vo.setReviewComments(reviewCommentsSb.toString());
}
}
return vo;
})
.collect(Collectors.toList());
//修改 并且 已经合并
project.setReviewChecklist(JSON.toJSONString(res));
project.setReviewCheckFinish(Boolean.TRUE);
projectService.updateById(project);

return BizConst.OP_SUCCESS;
}


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java 파일 보기

@@ -561,4 +561,7 @@ public class Project implements Serializable {

@ApiModelProperty("评审清单")
private String reviewChecklist;

@ApiModelProperty("是否开启评审清单")
private Boolean reviewCheckFinish;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java 파일 보기

@@ -543,4 +543,7 @@ public class ProjectDetailVO {

@ApiModelProperty("评审清单")
private String reviewChecklist;

@ApiModelProperty("是否开启评审清单")
private Boolean reviewCheckFinish;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectReviewCheckListItemVO.java 파일 보기

@@ -116,6 +116,9 @@ public class ProjectReviewCheckListItemVO {
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime planAcceptanceTime;

@ApiModelProperty("是否开启评审清单")
private Boolean reviewCheckFinish;

public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {
Optional.ofNullable(ProjectTypeNewEnum.getDesc(this.projectType))


불러오는 중...
취소
저장