|
@@ -2,10 +2,12 @@ package com.ningdatech.pmapi.projectdeclared.manage; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
import com.google.common.collect.Sets; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
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.UserFullInfoDTO; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
|
|
import com.wflow.enums.ReviewChecklistResultEnum; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
@@ -235,11 +238,100 @@ public class ReviewChecklistManage { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public List<ReviewChecklistApproveVO> summaryList(String projectCode) { |
|
|
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) { |
|
|
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; |
|
|
return BizConst.OP_SUCCESS; |
|
|
} |
|
|
} |
|
|