|
@@ -1,5 +1,6 @@
|
|
package com.redxun.knowledge.analysis.service;
|
|
package com.redxun.knowledge.analysis.service;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.redxun.common.tool.StringUtils;
|
|
import com.redxun.common.tool.StringUtils;
|
|
import com.redxun.knowledge.analysis.entity.consts.PlatformConst;
|
|
import com.redxun.knowledge.analysis.entity.consts.PlatformConst;
|
|
import com.redxun.knowledge.analysis.entity.vo.*;
|
|
import com.redxun.knowledge.analysis.entity.vo.*;
|
|
@@ -147,20 +148,25 @@ public class AnalysisCommonServiceImpl {
|
|
Calendar calendar = Calendar.getInstance();
|
|
Calendar calendar = Calendar.getInstance();
|
|
int year = calendar.get(Calendar.YEAR);
|
|
int year = calendar.get(Calendar.YEAR);
|
|
//查询出结果
|
|
//查询出结果
|
|
- List<Integer> count = new ArrayList<>();
|
|
|
|
|
|
+ List<String> collection = new ArrayList<>();
|
|
if (type.equals("total")) {
|
|
if (type.equals("total")) {
|
|
- count = analysisCommonMapper.knowledgeTypeVisitProportion(null, null);
|
|
|
|
|
|
+ collection = analysisCommonMapper.knowledgeTypeVisitProportion(null, null);
|
|
} else if (type.equals("year")) {
|
|
} else if (type.equals("year")) {
|
|
- count = analysisCommonMapper.knowledgeTypeVisitProportion(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
|
|
|
+ collection = analysisCommonMapper.knowledgeTypeVisitProportion(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
} else if (type.equals("month")) {
|
|
} else if (type.equals("month")) {
|
|
int month = calendar.get(Calendar.MONTH);
|
|
int month = calendar.get(Calendar.MONTH);
|
|
String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
- count = analysisCommonMapper.knowledgeTypeVisitProportion(firstOfMonth, lastOfMonth);
|
|
|
|
|
|
+ collection = analysisCommonMapper.knowledgeTypeVisitProportion(firstOfMonth, lastOfMonth);
|
|
} else {
|
|
} else {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+ //json解析
|
|
|
|
+ List<Integer> count = collection.parallelStream().map(e -> {
|
|
|
|
+ KnowledgeTypeParse knowledgeTypeParse = JSON.parseObject(e, KnowledgeTypeParse.class);
|
|
|
|
+ return knowledgeTypeParse.getType();
|
|
|
|
+ }).collect(Collectors.toList());
|
|
//文档知识和维基知识查看数量
|
|
//文档知识和维基知识查看数量
|
|
int archive = (int) count.stream().filter(e -> e == 1).count();
|
|
int archive = (int) count.stream().filter(e -> e == 1).count();
|
|
int wiki = (int) count.stream().filter(e -> e == 2).count();
|
|
int wiki = (int) count.stream().filter(e -> e == 2).count();
|