|
@@ -104,6 +104,54 @@ public class KnowledgeApproveServiceImpl extends SuperServiceImpl<KnowledgeAppro
|
|
|
Map<String, Object> params = PageHelper.constructParams(filter);
|
|
|
//查询出全部记录
|
|
|
List<KnowledgeApprovalListVo> allKnowledgeApprove = knowledgeApproveMapper.findAllKnowledgeApprove(filter.getParams(), params);
|
|
|
+ //数据处理
|
|
|
+ String userNo = userService.queryLoginUsername();
|
|
|
+ List<KnowledgeApprovalListVo> collectList = this.allApproveList(allKnowledgeApprove);
|
|
|
+ //查询知识管理员
|
|
|
+ List<String> knowledgeManager = knowledgeApproveMapper.findKnowledgeManager();
|
|
|
+ String user = userService.queryLoginUser();
|
|
|
+ //如果是知识管理员,展示全部 不是 查看自己能审核的记录
|
|
|
+ if(!knowledgeManager.contains(user) && !"admin".equals(userNo)){
|
|
|
+ //只查看当前登陆人能审核的记录(isAudit=0)
|
|
|
+ collectList = collectList.stream().filter(e -> e.getIsAudit() == 0 && (e.getApprovalStatus() == 1 || e.getApprovalStatus() == 3)).collect(Collectors.toList());
|
|
|
+ log.info("能审核的数量 -> {}",collectList.size());
|
|
|
+ }
|
|
|
+ //如果是admin,全部能审核
|
|
|
+ if ("admin".equals(userNo)){
|
|
|
+ collectList.forEach(e -> e.setIsAudit(0));
|
|
|
+ }
|
|
|
+ //数据分页
|
|
|
+ Page pages = PageListUtils.getPages(filter.getPage().getCurrent(), filter.getPage().getSize(), collectList);
|
|
|
+ List<KnowledgeApprovalListVo> collect = pages.getRecords();
|
|
|
+ //组织架构信息解析
|
|
|
+ collect.forEach(e -> {
|
|
|
+ String categoryId = e.getCategoryId();
|
|
|
+ KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(categoryId);
|
|
|
+ e.setKnowledgeCategoryAdminVo(knowledgeCategoryAdminVo);
|
|
|
+ if (StringUtils.isNotEmpty(e.getOrganizationId())){
|
|
|
+ OrganizationDto organizationDto = JSON.parseObject(e.getOrganizationId(), OrganizationDto.class);
|
|
|
+ e.setOrganizationIds(organizationDto);
|
|
|
+ }
|
|
|
+ //处理默认节点有两个领导的情况(默认节点默认在第一位,sort=1)
|
|
|
+ String[] split = e.getApproverId().split(",");
|
|
|
+ if (split.length > 1){
|
|
|
+ String approverNameTager = Arrays.stream(split).map(h -> userService.queryByUsername(h).getFullName()).collect(Collectors.joining(","));
|
|
|
+ e.setApproverName(approverNameTager);
|
|
|
+ }
|
|
|
+ // 判断是否有代理人,有,approverName赋值代理人
|
|
|
+ if (hasTager(e)){
|
|
|
+ e.setApproverName(userService.queryByUsername(e.getApproverId()).getFullName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return pages;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 未分页前全部审核记录
|
|
|
+ * @param allKnowledgeApprove
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<KnowledgeApprovalListVo> allApproveList(List<KnowledgeApprovalListVo> allKnowledgeApprove){
|
|
|
// 根据知识Id进行数据分组
|
|
|
Map<String, List<KnowledgeApprovalListVo>> result =
|
|
|
allKnowledgeApprove.stream().collect(Collectors.groupingBy(KnowledgeApprovalListVo::getKnowledgerId));
|
|
@@ -169,43 +217,7 @@ public class KnowledgeApproveServiceImpl extends SuperServiceImpl<KnowledgeAppro
|
|
|
e.setIsAudit(0);
|
|
|
}
|
|
|
});
|
|
|
- //查询知识管理员
|
|
|
- List<String> knowledgeManager = knowledgeApproveMapper.findKnowledgeManager();
|
|
|
- String user = userService.queryLoginUser();
|
|
|
- //如果是知识管理员,展示全部 不是 查看自己能审核的记录
|
|
|
- if(!knowledgeManager.contains(user) && !"admin".equals(userNo)){
|
|
|
- //只查看当前登陆人能审核的记录(isAudit=0)
|
|
|
- collectList = collectList.stream().filter(e -> e.getIsAudit() == 0 && (e.getApprovalStatus() == 1 || e.getApprovalStatus() == 3)).collect(Collectors.toList());
|
|
|
- log.info("能审核的数量 -> {}",collectList.size());
|
|
|
- }
|
|
|
- //如果是admin,全部能审核
|
|
|
- if ("admin".equals(userNo)){
|
|
|
- collectList.forEach(e -> e.setIsAudit(0));
|
|
|
- }
|
|
|
- //数据分页
|
|
|
- Page pages = PageListUtils.getPages(filter.getPage().getCurrent(), filter.getPage().getSize(), collectList);
|
|
|
- List<KnowledgeApprovalListVo> collect = pages.getRecords();
|
|
|
- //组织架构信息解析
|
|
|
- collect.forEach(e -> {
|
|
|
- String categoryId = e.getCategoryId();
|
|
|
- KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(categoryId);
|
|
|
- e.setKnowledgeCategoryAdminVo(knowledgeCategoryAdminVo);
|
|
|
- if (StringUtils.isNotEmpty(e.getOrganizationId())){
|
|
|
- OrganizationDto organizationDto = JSON.parseObject(e.getOrganizationId(), OrganizationDto.class);
|
|
|
- e.setOrganizationIds(organizationDto);
|
|
|
- }
|
|
|
- //处理默认节点有两个领导的情况(默认节点默认在第一位,sort=1)
|
|
|
- String[] split = e.getApproverId().split(",");
|
|
|
- if (split.length > 1){
|
|
|
- String approverNameTager = Arrays.stream(split).map(h -> userService.queryByUsername(h).getFullName()).collect(Collectors.joining(","));
|
|
|
- e.setApproverName(approverNameTager);
|
|
|
- }
|
|
|
- // 判断是否有代理人,有,approverName赋值代理人
|
|
|
- if (hasTager(e)){
|
|
|
- e.setApproverName(userService.queryByUsername(e.getApproverId()).getFullName());
|
|
|
- }
|
|
|
- });
|
|
|
- return pages;
|
|
|
+ return collectList;
|
|
|
}
|
|
|
|
|
|
|