소스 검색

作者:张哲
时间:2023/03/27
类型:开发
描述:里程碑(3) 搜索统计-返回值结构修改

zizg 1 년 전
부모
커밋
fdbbfd7615

+ 11 - 6
src/main/java/com/redxun/knowledge/analysis/controller/AnalysisCommonController.java

@@ -165,17 +165,22 @@ public class AnalysisCommonController {
     @ApiOperation("各业务系统分布")
     @GetMapping("searchSystemDetailVisits")
     public JsonResult searchSystemDetailVisits(@RequestParam("type") String type){
-        Map<String,Double> result = analysisSearchService.searchSystemDetailVisits(type);
+        List<SystemDetailVisitsVo> result = analysisSearchService.searchSystemDetailVisits(type);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("组织访问量")
     @PostMapping("organizationSearchs")
-    public JsonPageResult organizationSearchs(@RequestBody QueryData queryData){
-        JsonPageResult jsonResult = JsonPageResult.getSuccess("");
-        IPage result = analysisSearchService.organizationSearchs(queryData);
-        jsonResult.setPageData(result);
-        return jsonResult;
+    public JsonResult organizationSearchs(@RequestBody QueryData queryData){
+        Map<String, List> result = analysisSearchService.organizationSearchs(queryData);
+        return JsonResult.getSuccessResult(result);
+    }
+
+    @ApiOperation("用户访问总量")
+    @GetMapping("totalUserVisits")
+    public JsonResult totalUserVisits(@RequestParam("module") String module,
+                                      @RequestParam("type") String type){
+      return null;
     }
 
     @ApiOperation("各板块访问量分布")

+ 31 - 0
src/main/java/com/redxun/knowledge/analysis/entity/consts/ComanyColumnsConst.java

@@ -0,0 +1,31 @@
+package com.redxun.knowledge.analysis.entity.consts;
+
+import com.redxun.knowledge.analysis.entity.vo.CompanyColumns;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 文件名: ComanyColumnsConst
+ * 作者: zizg
+ * 时间: 2023/3/28
+ * 描述:
+ * 修改人:
+ * 修改时间:
+ * 修改内容:
+ */
+public class ComanyColumnsConst {
+
+    public static List<CompanyColumns> companyColumnsList(){
+        List<CompanyColumns> list = new ArrayList<>();
+        list.add(new CompanyColumns("公司名称","company",""));
+        list.add(new CompanyColumns("访问总量","total","total"));
+        list.add(new CompanyColumns("知识管理系统","zs","zs"));
+        list.add(new CompanyColumns("EIP系统","eip","eip"));
+        list.add(new CompanyColumns("DCC管理系统","dcc","dcc"));
+        list.add(new CompanyColumns("工作管理系统","gz","gz"));
+        list.add(new CompanyColumns("平展系统","pz","pz"));
+        list.add(new CompanyColumns("网盘系统","wp","wp"));
+        return list;
+    }
+}

+ 34 - 0
src/main/java/com/redxun/knowledge/analysis/entity/vo/CompanyColumns.java

@@ -0,0 +1,34 @@
+package com.redxun.knowledge.analysis.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 文件名: CompanyColumns
+ * 作者: zizg
+ * 时间: 2023/3/28
+ * 描述:
+ * 修改人:
+ * 修改时间:
+ * 修改内容:
+ */
+@Data
+public class CompanyColumns implements Serializable {
+
+    public CompanyColumns(){
+
+    }
+
+    public CompanyColumns(String title, String dataIndex, String sortFiled) {
+        this.title = title;
+        this.dataIndex = dataIndex;
+        this.sortFiled = sortFiled;
+    }
+
+    private String title;
+
+    private String dataIndex;
+
+    private String sortFiled;
+}

+ 1 - 1
src/main/java/com/redxun/knowledge/analysis/entity/vo/SystemDetailVisitsVo.java

@@ -16,7 +16,7 @@ import java.io.Serializable;
 @Data
 public class SystemDetailVisitsVo implements Serializable {
 
-    private String platform;
+    private String label;
 
     private Double percentage;
 

+ 8 - 5
src/main/java/com/redxun/knowledge/analysis/service/AnalysisSearchServiceImpl.java

@@ -3,6 +3,7 @@ package com.redxun.knowledge.analysis.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.redxun.common.base.entity.QueryData;
 import com.redxun.common.tool.StringUtils;
+import com.redxun.knowledge.analysis.entity.consts.ComanyColumnsConst;
 import com.redxun.knowledge.analysis.entity.enums.SystemDetailVisitsEnum;
 import com.redxun.knowledge.analysis.entity.vo.SystemCompanyVo;
 import com.redxun.knowledge.analysis.entity.vo.SystemDetailVisitsVo;
@@ -41,7 +42,7 @@ public class AnalysisSearchServiceImpl {
      * @param type
      * @return
      */
-    public Map<String, Double> searchSystemDetailVisits(String type) {
+    public List<SystemDetailVisitsVo> searchSystemDetailVisits(String type) {
         Map<String, Double> map = new HashMap<>();
         Calendar calendar = Calendar.getInstance();
         int year = calendar.get(Calendar.YEAR);
@@ -57,8 +58,7 @@ public class AnalysisSearchServiceImpl {
             String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
             result = analysisSearchMapper.searchSystemDetailVisits(firstOfMonth, lastOfMonth);
         }
-        result.forEach(e -> map.put(SystemDetailVisitsEnum.getMessage(e.getPlatform()),e.getPercentage()));
-        return map;
+        return result;
     }
 
     /**
@@ -66,7 +66,7 @@ public class AnalysisSearchServiceImpl {
      * @param queryData
      * @return
      */
-    public IPage organizationSearchs(QueryData queryData) {
+    public Map<String,List> organizationSearchs(QueryData queryData) {
         //获取排序规则
         String sort = queryData.getSortField();
         if (sort != null){
@@ -94,6 +94,9 @@ public class AnalysisSearchServiceImpl {
         }
         //公司名称赋值
         result.forEach(e -> e.setCompany(userService.findDeptByDeptId(e.getCompany()).getName()));
-        return PageListUtils.getPages(queryData.getPageNo(),queryData.getPageSize(),result);
+        Map<String,List> mapList = new LinkedHashMap<>();
+        mapList.put("columns",ComanyColumnsConst.companyColumnsList());
+        mapList.put("rows",result);
+        return mapList;
     }
 }

+ 1 - 1
src/main/resources/mapper/knowledge/analysis/AnalysisSearchMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.redxun.knowledge.analysis.mapper.AnalysisSearchMapper">
 
     <select id="searchSystemDetailVisits" resultType="com.redxun.knowledge.analysis.entity.vo.SystemDetailVisitsVo">
-        select PLATFORM ,round(count(*) / sum(count(*)) over (),2) as percentage from KM_PV_LOG
+        select PLATFORM as label,round(count(*) / sum(count(*)) over (),2) as percentage from KM_PV_LOG
         <where>
             <if test="firstDay != null and lastDay != null">
                 TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}