Merge remote-tracking branch 'origin/dev_1.0.0' into dev_1.0.0
commit
81440497f2
@ -0,0 +1,28 @@
|
|||||||
|
package com.supervision.knowsub.controller.homepage;
|
||||||
|
|
||||||
|
import com.supervision.knowsub.entity.vo.homepage.MyKnowledgeStatisticsResVO;
|
||||||
|
import com.supervision.knowsub.service.HomepageService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "首页")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("homepage")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class HomepageController {
|
||||||
|
|
||||||
|
private final HomepageService homepageService;
|
||||||
|
|
||||||
|
@Operation(summary = "查询我的知识")
|
||||||
|
@GetMapping("queryMyKnowledge")
|
||||||
|
public MyKnowledgeStatisticsResVO queryMyKnowledgeStatistics(){
|
||||||
|
return homepageService.queryMyKnowledgeStatistics();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.supervision.knowsub.entity.vo.homepage;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MyKnowledgeStatisticsResVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "最近登录时间")
|
||||||
|
private LocalDateTime lastLoginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全量知识(所有的非草稿的知识,以及自己的草稿)
|
||||||
|
*/
|
||||||
|
@Schema(description = "全量知识(所有已通过的知识,以及自己提报的未通过的知识)")
|
||||||
|
private Long knowledgeCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待审批
|
||||||
|
*/
|
||||||
|
@Schema(description = "待审批")
|
||||||
|
private Long waitProcessCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
*/
|
||||||
|
@Schema(description = "审批通过")
|
||||||
|
private Long passProcessCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驳回
|
||||||
|
*/
|
||||||
|
@Schema(description = "驳回")
|
||||||
|
private Long rejectProcessCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已失效
|
||||||
|
*/
|
||||||
|
@Schema(description = "已失效")
|
||||||
|
private Long invalidProcessCount;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.supervision.knowsub.service;
|
||||||
|
|
||||||
|
import com.supervision.knowsub.entity.vo.homepage.MyKnowledgeStatisticsResVO;
|
||||||
|
|
||||||
|
public interface HomepageService {
|
||||||
|
|
||||||
|
MyKnowledgeStatisticsResVO queryMyKnowledgeStatistics();
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
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.StatusEnum;
|
||||||
|
import com.supervision.knowsub.exception.BusinessException;
|
||||||
|
import com.supervision.knowsub.model.Knowledge;
|
||||||
|
import com.supervision.knowsub.model.SystemUser;
|
||||||
|
import com.supervision.knowsub.service.HomepageService;
|
||||||
|
import com.supervision.knowsub.service.KnowledgeService;
|
||||||
|
import com.supervision.knowsub.service.SystemUserService;
|
||||||
|
import com.supervision.knowsub.util.UserUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class HomepageServiceImpl implements HomepageService {
|
||||||
|
|
||||||
|
private final KnowledgeService knowledgeService;
|
||||||
|
|
||||||
|
private final SystemUserService systemUserService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyKnowledgeStatisticsResVO queryMyKnowledgeStatistics() {
|
||||||
|
UserInfo user = UserUtil.getUser();
|
||||||
|
SystemUser systemUser = systemUserService.getOptById(user.getId()).orElseThrow(() -> new BusinessException("未找到用户"));
|
||||||
|
MyKnowledgeStatisticsResVO resVO = new MyKnowledgeStatisticsResVO();
|
||||||
|
resVO.setUserName(user.getUsername());
|
||||||
|
resVO.setLastLoginTime(systemUser.getRecentLoginTime());
|
||||||
|
// 首先查询所有通过
|
||||||
|
Long passTotalCount = knowledgeService.lambdaQuery().eq(Knowledge::getStatus, StatusEnum.PASS.getStatus()).count();
|
||||||
|
// 然后找到属于自己的知识的草稿
|
||||||
|
Long count1 = knowledgeService.lambdaQuery().ne(Knowledge::getStatus, StatusEnum.PASS.getStatus())
|
||||||
|
.eq(Knowledge::getDraftBelongUserId, user.getId()).count();
|
||||||
|
// resVO.setKnowledgeCount();
|
||||||
|
// resVO.setWaitProcessCount();
|
||||||
|
// resVO.setPassProcessCount();
|
||||||
|
// resVO.setRejectProcessCount();
|
||||||
|
// resVO.setInvalidProcessCount();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue