|
@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
@@ -426,13 +427,42 @@ public class AnalysisCommonServiceImpl {
|
|
|
* 员工的知识上传数和专辑评论数
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> knowledgeSumAndYelpSumByLogin() {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- String userId = userService.queryLoginUser();
|
|
|
- //知识上传量
|
|
|
- Integer knowledgeSum = analysisCommonMapper.knowledgeSum(userId);
|
|
|
- //专辑点评量
|
|
|
- Integer yelpSum = analysisCommonMapper.yelpSum(userId);
|
|
|
+ public Map<String, Object> knowledgeSumAndYelpSumByLogin(String beginTime,String endTime,String userId) {
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
+ Integer knowledgeSum = 0;
|
|
|
+ Integer yelpSum = 0;
|
|
|
+ if (StringUtils.isEmpty(userId)){
|
|
|
+ userId = userService.queryLoginUser();
|
|
|
+ }
|
|
|
+ //获取当前年
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ if (StringUtils.isNotEmpty(beginTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ knowledgeSum = analysisCommonMapper.knowledgeSum(userId,beginTime,endTime);
|
|
|
+ //专辑点评量
|
|
|
+ yelpSum = analysisCommonMapper.yelpSum(userId,beginTime,endTime);
|
|
|
+ } else {
|
|
|
+ //知识上传量
|
|
|
+ knowledgeSum = analysisCommonMapper.knowledgeSum(userId,DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
|
+ //专辑点评量
|
|
|
+ yelpSum = analysisCommonMapper.yelpSum(userId,DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
|
+ }
|
|
|
+ String deptPath = pvLogMapper.findAllDeptIdByDeptId(userService.queryUser(userId).getDeptId());
|
|
|
+ if (StringUtils.isNotEmpty(deptPath)) {
|
|
|
+ deptPath = deptPath.substring(deptPath.indexOf(".") + 1);
|
|
|
+ String[] split = deptPath.split("\\.");
|
|
|
+ if (split.length > 6) {
|
|
|
+ String first = Arrays.stream(split).limit(3).map(e -> userService.findDeptByDeptId(e).getName()).collect(Collectors.joining(">"));
|
|
|
+ String end = Arrays.stream(split).skip(split.length - 3).map(e -> userService.findDeptByDeptId(e).getName()).collect(Collectors.joining(">"));
|
|
|
+ map.put("organization",first + ">...>" + end);
|
|
|
+ } else {
|
|
|
+ String organization = Arrays.stream(split).map(e -> userService.findDeptByDeptId(e).getName()).collect(Collectors.joining(">"));
|
|
|
+ map.put("organization",organization);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("totalSum",knowledgeSum + yelpSum);
|
|
|
map.put("knowledgeSum",knowledgeSum);
|
|
|
map.put("yelpSum",yelpSum);
|
|
|
return map;
|
|
@@ -441,20 +471,39 @@ public class AnalysisCommonServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 展示员工知识上传数和专辑评论数列表
|
|
|
- * @param queryData
|
|
|
+ * @param beginTime
|
|
|
+ * @param endTime
|
|
|
+ * @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public IPage knowledgeSumAndYelpSumList(QueryData queryData) {
|
|
|
- String sort = null;
|
|
|
- //获取排序规则
|
|
|
- if (StringUtils.isNotEmpty( queryData.getSortField())){
|
|
|
- sort = queryData.getSortField();
|
|
|
- if (StringUtils.isNotEmpty(sort)) {
|
|
|
- sort = sort + queryData.getSortOrder();
|
|
|
- }
|
|
|
+ public List<KnowledgeSumAndYelpSumListVo> knowledgeSumAndYelpSumList(Integer type, String beginTime, String endTime) {
|
|
|
+ List<KnowledgeSumAndYelpSumListVo> result = new ArrayList<>();
|
|
|
+ int pageNo;
|
|
|
+ int pageSize;
|
|
|
+ if (type == 1){
|
|
|
+ //取排行前3数据
|
|
|
+ pageNo = 1;
|
|
|
+ pageSize = 3;
|
|
|
+ } else if (type == 2){
|
|
|
+ //取前15个,跨过3个
|
|
|
+ pageNo = 4;
|
|
|
+ pageSize = 15;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("参数不正确");
|
|
|
+ }
|
|
|
+ //获取当前年
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ if (StringUtils.isNotEmpty(beginTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ result = analysisCommonMapper.knowledgeSumAndYelpSumList(beginTime,endTime,pageNo,pageSize);
|
|
|
+ } else {
|
|
|
+ result = analysisCommonMapper.knowledgeSumAndYelpSumList(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)),pageNo,pageSize);
|
|
|
}
|
|
|
- IPage page = new Page(queryData.getPageNo(),queryData.getPageSize());
|
|
|
- IPage result = analysisCommonMapper.knowledgeSumAndYelpSumList(page,sort);
|
|
|
+ result.forEach(e -> {
|
|
|
+ e.setDeptId(userService.queryUser(e.getUserId()).getDeptId());
|
|
|
+ e.setDeptName(userService.queryUser(e.getUserId()).getDeptName());
|
|
|
+ });
|
|
|
return result;
|
|
|
}
|
|
|
}
|