|
@@ -10,19 +10,25 @@ import com.ningdatech.file.entity.vo.result.AttachFileVo; |
|
|
import com.ningdatech.file.service.FileService; |
|
|
import com.ningdatech.file.service.FileService; |
|
|
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; |
|
|
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; |
|
|
import com.ningdatech.pmapi.expert.model.entity.ExpertReview; |
|
|
import com.ningdatech.pmapi.expert.model.entity.ExpertReview; |
|
|
|
|
|
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; |
|
|
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; |
|
|
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; |
|
|
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; |
|
|
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; |
|
|
|
|
|
import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO; |
|
|
|
|
|
import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; |
|
|
import com.ningdatech.pmapi.expert.service.IExpertReviewService; |
|
|
import com.ningdatech.pmapi.expert.service.IExpertReviewService; |
|
|
|
|
|
import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.domain.Meeting; |
|
|
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; |
|
|
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.service.IMeetingService; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import static com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO.ReviewDetailByTypeVO; |
|
|
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED; |
|
|
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -41,6 +47,9 @@ public class ExpertReviewManage { |
|
|
private final DistributedLock distributedLock; |
|
|
private final DistributedLock distributedLock; |
|
|
private final IMeetingExpertService meetingExpertService; |
|
|
private final IMeetingExpertService meetingExpertService; |
|
|
private final FileService fileService; |
|
|
private final FileService fileService; |
|
|
|
|
|
private final IMeetingInnerProjectService meetingInnerProjectService; |
|
|
|
|
|
private final IMeetingService meetingService; |
|
|
|
|
|
private final IReviewTemplateSettingsService templateSettingsService; |
|
|
|
|
|
|
|
|
private static final String EXPERT_REVIEW_KEY = "expert_review:"; |
|
|
private static final String EXPERT_REVIEW_KEY = "expert_review:"; |
|
|
|
|
|
|
|
@@ -142,4 +151,51 @@ public class ExpertReviewManage { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ProjectReviewDetailVO projectExpertReviewDetail(Long projectId) { |
|
|
|
|
|
ProjectReviewDetailVO detail = new ProjectReviewDetailVO(); |
|
|
|
|
|
List<Long> meetingIds = meetingInnerProjectService.listMeetingIdByProjectId(projectId); |
|
|
|
|
|
if (meetingIds.isEmpty()) { |
|
|
|
|
|
return detail; |
|
|
|
|
|
} |
|
|
|
|
|
List<Meeting> meetings = meetingService.listByIds(meetingIds); |
|
|
|
|
|
Collection<Long> tmpMeetingIds = meetings.stream() |
|
|
|
|
|
.collect(Collectors.groupingBy(Meeting::getType, |
|
|
|
|
|
Collectors.collectingAndThen(Collectors.toList(), w -> { |
|
|
|
|
|
w.sort(Comparator.comparing(Meeting::getCreateOn)); |
|
|
|
|
|
return w.get(w.size() - 1).getId(); |
|
|
|
|
|
}))).values(); |
|
|
|
|
|
LambdaQueryWrapper<ExpertReview> erQuery = Wrappers.lambdaQuery(ExpertReview.class) |
|
|
|
|
|
.in(ExpertReview::getMeetingId, tmpMeetingIds) |
|
|
|
|
|
.eq(ExpertReview::getProjectId, projectId) |
|
|
|
|
|
.orderByDesc(ExpertReview::getCreateOn); |
|
|
|
|
|
List<ExpertReview> expertReviews = expertReviewService.list(erQuery); |
|
|
|
|
|
if (expertReviews.isEmpty()) { |
|
|
|
|
|
return detail; |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> templateIds = CollUtils.fieldList(expertReviews, ExpertReview::getTemplateId); |
|
|
|
|
|
List<ReviewTemplateSettings> templates = templateSettingsService.listByIds(templateIds); |
|
|
|
|
|
Map<Long, ReviewTemplateVO> templateMap = CollUtils.listToMap(templates, |
|
|
|
|
|
ReviewTemplateSettings::getId, |
|
|
|
|
|
ReviewTemplateSettingsManage::buildTemplateDetail); |
|
|
|
|
|
detail.setTemplates(templateMap.values()); |
|
|
|
|
|
Map<Integer, ReviewDetailByTypeVO> map = new HashMap<>(8); |
|
|
|
|
|
expertReviews.forEach(review -> { |
|
|
|
|
|
ReviewTemplateVO template = templateMap.get(review.getTemplateId()); |
|
|
|
|
|
ReviewDetailByTypeVO reviewDetailByType = map.computeIfAbsent(template.getTemplateType(), k -> { |
|
|
|
|
|
ReviewDetailByTypeVO tmpReviewDetail = new ReviewDetailByTypeVO(); |
|
|
|
|
|
tmpReviewDetail.setReviewType(k); |
|
|
|
|
|
tmpReviewDetail.setTeamMemberReviews(new ArrayList<>()); |
|
|
|
|
|
return tmpReviewDetail; |
|
|
|
|
|
}); |
|
|
|
|
|
ExpertReviewDetailVO tmpReview = buildExpertReviewDetail(review); |
|
|
|
|
|
if (review.getIsFinal()) { |
|
|
|
|
|
reviewDetailByType.setFinalReview(tmpReview); |
|
|
|
|
|
} else { |
|
|
|
|
|
reviewDetailByType.getTeamMemberReviews().add(tmpReview); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
detail.setReviews(map.values()); |
|
|
|
|
|
return detail; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |