|
|
|
@ -3,6 +3,7 @@ package com.supervision.knowsub.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.supervision.knowsub.domain.UserInfo;
|
|
|
|
|
import com.supervision.knowsub.entity.vo.homepage.MyKnowledgeStatisticsResVO;
|
|
|
|
|
import com.supervision.knowsub.enums.RoleTypeEnum;
|
|
|
|
|
import com.supervision.knowsub.enums.StatusEnum;
|
|
|
|
|
import com.supervision.knowsub.exception.BusinessException;
|
|
|
|
|
import com.supervision.knowsub.model.Knowledge;
|
|
|
|
@ -14,6 +15,8 @@ import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -65,9 +68,9 @@ public class HomepageServiceImpl implements HomepageService {
|
|
|
|
|
resVO.setUserName(user.getUsername());
|
|
|
|
|
resVO.setLastLoginTime(systemUser.getRecentLoginTime());
|
|
|
|
|
// 首先查询用户是否有审批的权限,
|
|
|
|
|
Integer isConfigProcess = systemFlowRuleService.queryUserIsConfigProcess(user.getId());
|
|
|
|
|
List<Integer> roleTypeList = user.getRoleTypeList();
|
|
|
|
|
// 如果用户有审批权限,则以审批人的视角
|
|
|
|
|
if (0 < isConfigProcess) {
|
|
|
|
|
if (roleTypeList.contains(RoleTypeEnum.KNOWLEDGE_APPROVAL.getRoleType())) {
|
|
|
|
|
// 全量知识,所有审批通过的
|
|
|
|
|
resVO.setKnowledgeCount(knowledgeService.lambdaQuery().eq(Knowledge::getStatus, StatusEnum.PASS.getStatus()).count());
|
|
|
|
|
// 待审批
|
|
|
|
@ -80,7 +83,7 @@ public class HomepageServiceImpl implements HomepageService {
|
|
|
|
|
resVO.setInvalidProcessCount(knowledgeFlowRecordService.queryPassProcessCountByUser(user.getId(), null, null));
|
|
|
|
|
}
|
|
|
|
|
// 没有被配置审批权限,则以报送人员视角进行统计
|
|
|
|
|
else {
|
|
|
|
|
else if (roleTypeList.contains(RoleTypeEnum.KNOWLEDGE_SUBMIT.getRoleType())){
|
|
|
|
|
// 首先查询所有通过
|
|
|
|
|
Long passTotalCount = knowledgeService.lambdaQuery().eq(Knowledge::getStatus, StatusEnum.PASS.getStatus()).count();
|
|
|
|
|
// 然后找到属于自己的知识的草稿
|
|
|
|
@ -93,6 +96,7 @@ public class HomepageServiceImpl implements HomepageService {
|
|
|
|
|
resVO.setInvalidProcessCount(knowledgeSubmitRecordService.queryKnowledgeSubmitStatusCount(user.getId(), StatusEnum.INVALID.getStatus()));
|
|
|
|
|
resVO.setPassProcessCount(knowledgeSubmitRecordService.queryKnowledgeSubmitStatusCount(user.getId(), StatusEnum.PASS.getStatus()));
|
|
|
|
|
}
|
|
|
|
|
// 没有任何角色权限,数据全部显示为0
|
|
|
|
|
return resVO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|