|
@@ -0,0 +1,67 @@
|
|
|
+package com.redxun.knowledge.analysis.service;
|
|
|
+
|
|
|
+import com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo;
|
|
|
+import com.redxun.knowledge.analysis.entity.vo.MapCompanyVo;
|
|
|
+import com.redxun.knowledge.analysis.mapper.AnalysisSynthesizeMapper;
|
|
|
+import com.redxun.knowledge.utils.DateUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 文件名: AnalysisSynthesizeServiceImpl
|
|
|
+ * 作者: zizg
|
|
|
+ * 时间: 2023/3/27
|
|
|
+ * 描述:
|
|
|
+ * 修改人:
|
|
|
+ * 修改时间:
|
|
|
+ * 修改内容:
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class AnalysisSynthesizeServiceImpl {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AnalysisSynthesizeMapper analysisSynthesizeMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 各板块访问量分布
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> moduleUserVisits(String type) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ List<AlbumDetailVisitsVo> moduleUserVisitsVo = new ArrayList<>();
|
|
|
+ if ("total".equals(type)){
|
|
|
+ moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserVisits(null,null);
|
|
|
+ } else if ("year".equals(type)) {
|
|
|
+ moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserVisits(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
|
+ } 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);
|
|
|
+ moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserVisits(firstOfMonth, lastOfMonth);
|
|
|
+ }
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
+ moduleUserVisitsVo.forEach(e -> {
|
|
|
+ if (e.getName().equals("搜索服务")){
|
|
|
+ result.put("search",e.getValue());
|
|
|
+ result.put("searchPercentage",e.getPercentage());
|
|
|
+ } else if (e.getName().equals("知识仓库")){
|
|
|
+ result.put("knowledge",e.getValue());
|
|
|
+ result.put("knowledgePercentage",e.getPercentage());
|
|
|
+ } else if (e.getName().equals("知识地图")){
|
|
|
+ result.put("map",e.getValue());
|
|
|
+ result.put("mapPercentage",e.getPercentage());
|
|
|
+ } else if (e.getName().equals("知识专辑")){
|
|
|
+ result.put("album",e.getValue());
|
|
|
+ result.put("albumPercentage",e.getPercentage());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+}
|