Browse Source

评审清单

tags/24080901
PoffyZhang 1 year ago
parent
commit
7897eaf0a7
2 changed files with 105 additions and 35 deletions
  1. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java
  2. +102
    -33
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java

+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ReviewChecklistController.java View File

@@ -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<ReviewChecklistApproveVO> summaryList(@PathVariable String projectCode) {
public List<FormsReviewChecklistDto> 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<ReviewCheckInfoVO> approveList(@PathVariable String projectCode) {
public List<String> approveList(@PathVariable String projectCode) {
return reviewChecklistManage.approveList(projectCode);
}
}

+ 102
- 33
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewChecklistManage.java View File

@@ -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<ReviewChecklistApproveVO> summaryList(String projectCode) {
public List<FormsReviewChecklistDto> summaryList(String projectCode) {
List<ReviewChecklistApprove> approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class)
.eq(ReviewChecklistApprove::getProjectCode, projectCode)
.orderByAsc(ReviewChecklistApprove::getCreateOn));
@@ -247,22 +250,20 @@ public class ReviewChecklistManage {
}

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

List<ReviewChecklistApproveVO> res = dupSubTitle.stream()
List<FormsReviewChecklistDto> res = dupTitle.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());
FormsReviewChecklistDto vo = new FormsReviewChecklistDto();
vo.setTitle(r.getTitle());
if(groupTitleMap.containsKey(r.getTitle())){
List<ReviewChecklistApprove> reviewChecklistApproves = groupTitleMap.get(r.getTitle());
vo.setModules(convertModules(reviewChecklistApproves));
}
return vo;
})
@@ -302,29 +303,22 @@ public class ReviewChecklistManage {
}

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

List<ReviewChecklistApproveVO> res = dupSubTitle.stream()
List<FormsReviewChecklistDto> res = dupTitle.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("通过");
}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<ReviewChecklistApprove> reviewChecklistApproves = groupTitleMap.get(r.getTitle());
vo.setModules(convertModulesFinal(reviewChecklistApproves));
}
return vo;
})
@@ -337,8 +331,83 @@ public class ReviewChecklistManage {
return BizConst.OP_SUCCESS;
}

public List<ReviewCheckInfoVO> approveList(String projectCode) {
/**
* 查询 未审批人员
* @param projectCode
* @return
*/
public List<String> approveList(String projectCode) {
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());
List<ReviewChecklistApprove> 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<ReviewChecklistModuleDto> convertModules(List<ReviewChecklistApprove> reviewChecklistApproves) {
//做成map
Map<String, List<ReviewChecklistApprove>> groupSubTitleMap = reviewChecklistApproves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle));
//去重子标题
Set<String> subSubTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> 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<ReviewChecklistApprove> 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<ReviewChecklistModuleDto> convertModulesFinal(List<ReviewChecklistApprove> reviewChecklistApproves) {
//做成map
Map<String, List<ReviewChecklistApprove>> groupSubTitleMap = reviewChecklistApproves.stream()
.collect(Collectors.groupingBy(ReviewChecklistApprove::getSubTitle));
//去重子标题
Set<String> subSubTitleSet = Sets.newHashSet();
List<ReviewChecklistApprove> 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<ReviewChecklistApprove> 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());
}
}

Loading…
Cancel
Save