|
@@ -9,6 +9,7 @@ import com.redxun.knowledge.analysis.entity.dao.KnowledgeDao;
|
|
|
import com.redxun.knowledge.analysis.entity.vo.*;
|
|
|
import com.redxun.knowledge.analysis.mapper.AnalysisCommonMapper;
|
|
|
import com.redxun.knowledge.analysis.mapper.PvLogMapper;
|
|
|
+import com.redxun.knowledge.common.UserService;
|
|
|
import com.redxun.knowledge.utils.DateUtils;
|
|
|
|
|
|
import com.redxun.knowledge.utils.PageListUtils;
|
|
@@ -39,6 +40,9 @@ public class AnalysisCommonServiceImpl {
|
|
|
@Autowired
|
|
|
private PvLogMapper pvLogMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
/**
|
|
|
* 各模块整体数量统计:知识仓库(知识总数量);知识地图(地图总数量);知识专辑(专辑总数量)
|
|
|
*
|
|
@@ -222,7 +226,7 @@ public class AnalysisCommonServiceImpl {
|
|
|
}
|
|
|
List<KnowledgeCompanyVo> result = count.parallelStream().map(e -> {
|
|
|
KnowledgeCompanyVo knowledgeCompanyVo = new KnowledgeCompanyVo();
|
|
|
- knowledgeCompanyVo.setCompany(e.getCompanyId());
|
|
|
+ knowledgeCompanyVo.setOrganization(e.getCompanyId());
|
|
|
e.getCounts().forEach(c -> {
|
|
|
if (c.containsKey("type") && c.get("type").intValue() == 1) {
|
|
|
knowledgeCompanyVo.setArchive(c.get("count").intValue());
|
|
@@ -277,4 +281,57 @@ public class AnalysisCommonServiceImpl {
|
|
|
}
|
|
|
return PageListUtils.getPages(queryData.getPageNo(),queryData.getPageSize(),result);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 组织创建知识数量(新)
|
|
|
+ * @param type
|
|
|
+ * @param organizationId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public KnowledgeCompanyVo organizationKnowledge(String type, String organizationId) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ List<KnowledgeDao> count = new ArrayList<>();
|
|
|
+ if (("total").equals(type)) {
|
|
|
+ count = analysisCommonMapper.organizationVisit(null, null,organizationId);
|
|
|
+ } else if ("year".equals(type)) {
|
|
|
+ count = analysisCommonMapper.organizationVisit(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)),organizationId);
|
|
|
+ } else if ("month".equals(type)) {
|
|
|
+ int month = calendar.get(Calendar.MONTH);
|
|
|
+ String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
|
+ String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
|
+ count = analysisCommonMapper.organizationVisit(firstOfMonth, lastOfMonth,organizationId);
|
|
|
+ }
|
|
|
+
|
|
|
+ KnowledgeCompanyVo knowledgeCompanyVo = new KnowledgeCompanyVo();
|
|
|
+ count.parallelStream().forEach(e -> e.getCounts().forEach(c -> {
|
|
|
+ if (c.containsKey("type") && c.get("type").intValue() == 1) {
|
|
|
+ knowledgeCompanyVo.setArchive(c.get("count").intValue());
|
|
|
+ }
|
|
|
+ if (c.containsKey("type") && c.get("type").intValue() == 2) {
|
|
|
+ knowledgeCompanyVo.setWiki(c.get("count").intValue());
|
|
|
+ }
|
|
|
+ }));
|
|
|
+
|
|
|
+ String deptPath = pvLogMapper.findAllDeptIdByDeptId(organizationId);
|
|
|
+ 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(">"));
|
|
|
+ knowledgeCompanyVo.setOrganization(first + ">...>" + end);
|
|
|
+ } else {
|
|
|
+ String organization = Arrays.stream(split).map(e -> userService.findDeptByDeptId(e).getName()).collect(Collectors.joining(">"));
|
|
|
+ knowledgeCompanyVo.setOrganization(organization);
|
|
|
+ }
|
|
|
+ if (knowledgeCompanyVo.getArchive() == null){
|
|
|
+ knowledgeCompanyVo.setArchive(0);
|
|
|
+ }
|
|
|
+ if (knowledgeCompanyVo.getWiki() == null){
|
|
|
+ knowledgeCompanyVo.setWiki(0);
|
|
|
+ }
|
|
|
+ knowledgeCompanyVo.setTotal(knowledgeCompanyVo.getArchive() + knowledgeCompanyVo.getWiki());
|
|
|
+ return knowledgeCompanyVo;
|
|
|
+ }
|
|
|
}
|