Quellcode durchsuchen

作者:张哲
时间:2023/03/29
类型:开发
描述:里程碑(3) 用户访问量统计

zizg vor 2 Jahren
Ursprung
Commit
96653b6883

+ 25 - 24
src/main/java/com/redxun/knowledge/analysis/controller/AnalysisCommonController.java

@@ -57,7 +57,7 @@ public class AnalysisCommonController {
 
     @ApiOperation("PC 获取搜索服务访问量分布柱状图数据")
     @GetMapping("searchVisitHistogram")
-    public JsonResult searchVisitHistogram(){
+    public JsonResult searchVisitHistogram() {
         SearchVisitHistogramVo searchVisitHistogramVo = analysisCommonService.searchVisitHistogram();
         return JsonResult.getSuccessResult(searchVisitHistogramVo);
     }
@@ -78,7 +78,7 @@ public class AnalysisCommonController {
 
     @ApiOperation("知识类型访问量分布")
     @GetMapping("knowledgeTypeVisitProportion")
-    public JsonResult knowledgeTypeVisitProportion(@RequestParam("type") String type){
+    public JsonResult knowledgeTypeVisitProportion(@RequestParam("type") String type) {
         Map<String, Object> result = analysisCommonService.knowledgeTypeVisitProportion(type);
         return JsonResult.getSuccessResult(result);
     }
@@ -86,14 +86,14 @@ public class AnalysisCommonController {
     @ApiOperation("各一级分类知识创建数量")
     @GetMapping("level1KnowledgeHistogram")
     public JsonResult level1KnowledgeHistogram(@RequestParam("type") String type,
-                                               @RequestParam(value = "sort",required = false) String sort){
-        List<KnowledgeCategoryVo> knowledgeCategoryVoList = analysisCommonService.level1KnowledgeHistogram(type,sort);
+                                               @RequestParam(value = "sort", required = false) String sort) {
+        List<KnowledgeCategoryVo> knowledgeCategoryVoList = analysisCommonService.level1KnowledgeHistogram(type, sort);
         return JsonResult.getSuccessResult(knowledgeCategoryVoList);
     }
 
     @ApiOperation("组织创建知识数量")
     @PostMapping("organizationKnowledges")
-    public JsonPageResult organizationKnowledges(@RequestBody QueryData queryData){
+    public JsonPageResult organizationKnowledges(@RequestBody QueryData queryData) {
         JsonPageResult jsonResult = JsonPageResult.getSuccess("");
         IPage knowledgeCompanyVoList = analysisCommonService.organizationKnowledges(queryData);
         jsonResult.setPageData(knowledgeCompanyVoList);
@@ -102,7 +102,7 @@ public class AnalysisCommonController {
 
     @ApiOperation("专辑创建总量")
     @GetMapping("albumAmount")
-    public JsonResult albumAmount(@RequestParam("type") String type){
+    public JsonResult albumAmount(@RequestParam("type") String type) {
         CreateCountTotal result = analysisAlbumService.albumAmount(type);
         return JsonResult.getSuccessResult(result);
     }
@@ -110,22 +110,22 @@ public class AnalysisCommonController {
     @ApiOperation("专辑详情Top访问量(pv)统计")
     @GetMapping("albumDetailVisits")
     public JsonResult albumDetailVisits(@RequestParam("type") String type,
-                                        @RequestParam(value = "tops",required = false,defaultValue = "10") Integer tops){
-        List<AlbumDetailVisitsVo> result = analysisAlbumService.albumDetailVisits(type,tops);
+                                        @RequestParam(value = "tops", required = false, defaultValue = "10") Integer tops) {
+        List<AlbumDetailVisitsVo> result = analysisAlbumService.albumDetailVisits(type, tops);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("各一级分类专辑创建数量")
     @GetMapping("level1AlbumHistogram")
     public JsonResult level1AlbumHistogram(@RequestParam("type") String type,
-                                           @RequestParam(value = "sort",required = false) String sort){
-        List<AlbumCategoryVo> result = analysisAlbumService.level1AlbumHistogram(type,sort);
+                                           @RequestParam(value = "sort", required = false) String sort) {
+        List<AlbumCategoryVo> result = analysisAlbumService.level1AlbumHistogram(type, sort);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("组织创建和访问专辑数量")
     @PostMapping("organizationAlbums")
-    public JsonPageResult organizationAlbums(@RequestBody QueryData queryData){
+    public JsonPageResult organizationAlbums(@RequestBody QueryData queryData) {
         JsonPageResult jsonResult = JsonPageResult.getSuccess("");
         IPage result = analysisAlbumService.organizationAlbums(queryData);
         jsonResult.setPageData(result);
@@ -134,28 +134,28 @@ public class AnalysisCommonController {
 
     @ApiOperation("地图创建总量")
     @GetMapping("mapAmount")
-    public JsonResult mapAmount(@RequestParam("type") String type){
+    public JsonResult mapAmount(@RequestParam("type") String type) {
         CreateCountTotal result = analysisMapService.mapAmount(type);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("各类型地图创建数量")
     @GetMapping("typeMapPie")
-    public JsonResult typeMapPie(@RequestParam("type") String type){
+    public JsonResult typeMapPie(@RequestParam("type") String type) {
         List<MapTypeCountVo> result = analysisMapService.typeMapPie(type);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("地图页面访问量")
     @GetMapping("mapPageHistogram")
-    public JsonResult mapPageHistogram(@RequestParam("type") String type){
+    public JsonResult mapPageHistogram(@RequestParam("type") String type) {
         List<MapPagePvVo> result = analysisMapService.mapPageHistogram(type);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("组织创建和访问地图数量")
     @PostMapping("organizationMaps")
-    public JsonPageResult organizationMaps(@RequestBody QueryData queryData){
+    public JsonPageResult organizationMaps(@RequestBody QueryData queryData) {
         JsonPageResult jsonResult = JsonPageResult.getSuccess("");
         IPage result = analysisMapService.organizationMaps(queryData);
         jsonResult.setPageData(result);
@@ -164,14 +164,14 @@ public class AnalysisCommonController {
 
     @ApiOperation("各业务系统分布")
     @GetMapping("searchSystemDetailVisits")
-    public JsonResult searchSystemDetailVisits(@RequestParam("type") String type){
+    public JsonResult searchSystemDetailVisits(@RequestParam("type") String type) {
         List<SystemDetailVisitsVo> result = analysisSearchService.searchSystemDetailVisits(type);
         return JsonResult.getSuccessResult(result);
     }
 
     @ApiOperation("组织访问量")
     @PostMapping("organizationSearchs")
-    public JsonResult organizationSearchs(@RequestBody QueryData queryData){
+    public JsonResult organizationSearchs(@RequestBody QueryData queryData) {
         Map<String, List> result = analysisSearchService.organizationSearchs(queryData);
         return JsonResult.getSuccessResult(result);
     }
@@ -179,27 +179,28 @@ public class AnalysisCommonController {
     @ApiOperation("用户访问总量")
     @GetMapping("totalUserVisits")
     public JsonResult totalUserVisits(@RequestParam("module") String module,
-                                      @RequestParam("type") String type){
-      return null;
+                                      @RequestParam("type") String type) {
+        CreateUserView createUserView = analysisSynthesizeService.totalUserVisits(module,type);
+        return JsonResult.getSuccessResult(createUserView);
     }
 
     @ApiOperation("各板块访问量分布")
     @GetMapping("moduleUserVisits")
-    public JsonResult moduleUserVisits(@RequestParam("type") String type){
-        Map<String,Object> map = analysisSynthesizeService.moduleUserVisits(type);
+    public JsonResult moduleUserVisits(@RequestParam("type") String type) {
+        Map<String, Object> map = analysisSynthesizeService.moduleUserVisits(type);
         return JsonResult.getSuccessResult(map);
     }
 
     @ApiOperation("各板块访问量分布(UV)")
     @GetMapping("moduleUserUniqueVisits")
-    public JsonResult moduleUserUniqueVisits(@RequestParam("type") String type){
-        Map<String,Object> map = analysisSynthesizeService.moduleUserUniqueVisits(type);
+    public JsonResult moduleUserUniqueVisits(@RequestParam("type") String type) {
+        Map<String, Object> map = analysisSynthesizeService.moduleUserUniqueVisits(type);
         return JsonResult.getSuccessResult(map);
     }
 
     @ApiOperation("组织访问量")
     @PostMapping("organizationVisits")
-    public JsonPageResult organizationVisits(@RequestBody QueryData queryData){
+    public JsonPageResult organizationVisits(@RequestBody QueryData queryData) {
         JsonPageResult jsonResult = JsonPageResult.getSuccess("");
         IPage result = analysisSynthesizeService.organizationVisits(queryData);
         jsonResult.setPageData(result);

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

@@ -18,5 +18,5 @@ public class CreateCountLabel implements Serializable {
 
     private String name;
 
-    private String value;
+    private Integer value;
 }

+ 28 - 0
src/main/java/com/redxun/knowledge/analysis/entity/vo/CreateUserView.java

@@ -0,0 +1,28 @@
+package com.redxun.knowledge.analysis.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 文件名: CreateUserView
+ * 作者: zizg
+ * 时间: 2023/3/29
+ * 描述:
+ * 修改人:
+ * 修改时间:
+ * 修改内容:
+ */
+@ApiModel("用户访问总量")
+@Data
+public class CreateUserView implements Serializable {
+
+    @ApiModelProperty("访问总量")
+    private Integer total;
+
+    @ApiModelProperty("标签取值列表")
+    private List<CreateUserViewLabel> lables;
+}

+ 32 - 0
src/main/java/com/redxun/knowledge/analysis/entity/vo/CreateUserViewLabel.java

@@ -0,0 +1,32 @@
+package com.redxun.knowledge.analysis.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.checkerframework.checker.units.qual.A;
+
+import java.io.Serializable;
+
+/**
+ * 文件名: CreateUserViewLabel
+ * 作者: zizg
+ * 时间: 2023/3/29
+ * 描述:
+ * 修改人:
+ * 修改时间:
+ * 修改内容:
+ */
+@ApiModel("标签取值列表")
+@Data
+public class CreateUserViewLabel implements Serializable {
+
+    @ApiModelProperty("标签名称")
+    private String name;
+
+    @ApiModelProperty("唯一访问数量")
+    private Integer uv;
+
+    @ApiModelProperty("页面访问数量")
+    private Integer pv;
+
+}

+ 10 - 0
src/main/java/com/redxun/knowledge/analysis/mapper/AnalysisSynthesizeMapper.java

@@ -1,6 +1,7 @@
 package com.redxun.knowledge.analysis.mapper;
 
 import com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo;
+import com.redxun.knowledge.analysis.entity.vo.CreateUserViewLabel;
 import com.redxun.knowledge.analysis.entity.vo.SynthesizeCompanyVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -43,4 +44,13 @@ public interface AnalysisSynthesizeMapper {
      * @return
      */
     List<AlbumDetailVisitsVo> moduleUserUniqueVisits(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+
+    /**
+     * 用户访问总量
+     * @param firstDay
+     * @param lastDay
+     * @param module
+     * @return
+     */
+    List<CreateUserViewLabel> totalUserVisits(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay,@Param("module") String module);
 }

+ 1 - 1
src/main/java/com/redxun/knowledge/analysis/service/AnalysisAlbumServiceImpl.java

@@ -63,7 +63,7 @@ public class AnalysisAlbumServiceImpl {
             String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
             createCountLabel = analysisAlbumMapper.albumAmount(firstOfMonth, lastOfMonth);
         }
-        int sum = createCountLabel.stream().mapToInt(e -> Integer.parseInt(e.getValue())).sum();
+        int sum = createCountLabel.stream().mapToInt(CreateCountLabel::getValue).sum();
         createCountTotal.setTotal(sum);
         createCountTotal.setLables(createCountLabel);
         return createCountTotal;

+ 1 - 1
src/main/java/com/redxun/knowledge/analysis/service/AnalysisMapServiceImpl.java

@@ -62,7 +62,7 @@ public class AnalysisMapServiceImpl {
             String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
             createCountLabel = analysisMapMapper.mapAmount(firstOfMonth, lastOfMonth);
         }
-        int sum = createCountLabel.stream().mapToInt(e -> Integer.parseInt(e.getValue())).sum();
+        int sum = createCountLabel.stream().mapToInt(CreateCountLabel::getValue).sum();
         createCountTotal.setTotal(sum);
         createCountTotal.setLables(createCountLabel);
         return createCountTotal;

+ 82 - 41
src/main/java/com/redxun/knowledge/analysis/service/AnalysisSynthesizeServiceImpl.java

@@ -3,9 +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.vo.AlbumDetailVisitsVo;
-import com.redxun.knowledge.analysis.entity.vo.MapCompanyVo;
-import com.redxun.knowledge.analysis.entity.vo.SynthesizeCompanyVo;
+import com.redxun.knowledge.analysis.entity.vo.*;
 import com.redxun.knowledge.analysis.mapper.AnalysisSynthesizeMapper;
 import com.redxun.knowledge.common.UserService;
 import com.redxun.knowledge.utils.DateUtils;
@@ -38,15 +36,16 @@ public class AnalysisSynthesizeServiceImpl {
 
     /**
      * 各板块访问量分布
+     *
      * @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);
+        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)));
@@ -58,18 +57,18 @@ public class AnalysisSynthesizeServiceImpl {
         }
         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());
+            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;
@@ -77,51 +76,53 @@ public class AnalysisSynthesizeServiceImpl {
 
     /**
      * 组织访问量
+     *
      * @param queryData
      * @return
      */
     public IPage organizationVisits(QueryData queryData) {
         //获取排序规则
         String sort = queryData.getSortField();
-        if (sort != null){
+        if (sort != null) {
             sort = sort + queryData.getSortOrder();
         }
         Calendar calendar = Calendar.getInstance();
         int year = calendar.get(Calendar.YEAR);
-        List<SynthesizeCompanyVo> result =  new ArrayList<>();
-        if ("total".equals(queryData.getParams().get("type"))){
-            result = analysisSynthesizeMapper.organizationVisits(null,null,sort);
+        List<SynthesizeCompanyVo> result = new ArrayList<>();
+        if ("total".equals(queryData.getParams().get("type"))) {
+            result = analysisSynthesizeMapper.organizationVisits(null, null, sort);
         } else if ("year".equals(queryData.getParams().get("type"))) {
             result = analysisSynthesizeMapper.organizationVisits(DateUtils.format(DateUtils.getFirstOfYear(year)),
-                    DateUtils.format(DateUtils.getLastOfYear(year)),sort);
+                    DateUtils.format(DateUtils.getLastOfYear(year)), sort);
         } else if ("month".equals(queryData.getParams().get("type"))) {
             int month = calendar.get(Calendar.MONTH);
             String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
             String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
-            result = analysisSynthesizeMapper.organizationVisits(firstOfMonth, lastOfMonth,sort);
+            result = analysisSynthesizeMapper.organizationVisits(firstOfMonth, lastOfMonth, sort);
         }
         String tops = queryData.getParams().get("tops");
-        if(StringUtils.isNotEmpty(tops)){
+        if (StringUtils.isNotEmpty(tops)) {
             result = result.stream().limit(Long.parseLong(tops)).collect(Collectors.toList());
         } else {
             result = result.stream().limit(10).collect(Collectors.toList());
         }
         //公司名称赋值
         result.forEach(e -> e.setCompany(userService.findDeptByDeptId(e.getCompany()).getName()));
-        return PageListUtils.getPages(queryData.getPageNo(),queryData.getPageSize(),result);
+        return PageListUtils.getPages(queryData.getPageNo(), queryData.getPageSize(), result);
     }
 
     /**
      * 各板块访问量分布(UV)
+     *
      * @param type
      * @return
      */
     public Map<String, Object> moduleUserUniqueVisits(String type) {
         Calendar calendar = Calendar.getInstance();
         int year = calendar.get(Calendar.YEAR);
-        List<AlbumDetailVisitsVo> moduleUserVisitsVo =  new ArrayList<>();
-        if ("total".equals(type)){
-            moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserUniqueVisits(null,null);
+        List<AlbumDetailVisitsVo> moduleUserVisitsVo = new ArrayList<>();
+        if ("total".equals(type)) {
+            moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserUniqueVisits(null, null);
         } else if ("year".equals(type)) {
             moduleUserVisitsVo = analysisSynthesizeMapper.moduleUserUniqueVisits(DateUtils.format(DateUtils.getFirstOfYear(year)),
                     DateUtils.format(DateUtils.getLastOfYear(year)));
@@ -133,20 +134,60 @@ public class AnalysisSynthesizeServiceImpl {
         }
         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());
+            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;
     }
+
+    /**
+     * 用户访问总量
+     *
+     * @param module
+     * @param type
+     * @return
+     */
+    public CreateUserView totalUserVisits(String module, String type) {
+        if ("total".equals(module)){
+            module = null;
+        } else if ("knowledge".equals(module)){
+            module = "知识仓库";
+        } else if ("album".equals(module)){
+            module = "知识专辑";
+        } else if ("map".equals(module)){
+            module = "知识地图";
+        } else if ("search".equals(module)){
+            module = "搜索服务";
+        }
+        CreateUserView createUserView = new CreateUserView();
+        List<CreateUserViewLabel> createUserViewLabel = new ArrayList<>();
+        Calendar calendar = Calendar.getInstance();
+        int year = calendar.get(Calendar.YEAR);
+        if (("total").equals(type)) {
+            createUserViewLabel = analysisSynthesizeMapper.totalUserVisits(null, null, module);
+        } else if ("year".equals(type)) {
+            createUserViewLabel = analysisSynthesizeMapper.totalUserVisits(DateUtils.format(DateUtils.getFirstOfYear(year)),
+                    DateUtils.format(DateUtils.getLastOfYear(year)), module);
+        } 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);
+            createUserViewLabel = analysisSynthesizeMapper.totalUserVisits(firstOfMonth, lastOfMonth, module);
+        }
+        int sum = createUserViewLabel.stream().mapToInt(e -> e.getPv() + e.getUv()).sum();
+        createUserView.setTotal(sum);
+        createUserView.setLables(createUserViewLabel);
+        return createUserView;
+    }
 }

+ 51 - 2
src/main/resources/mapper/knowledge/analysis/AnalysisSynthesizeMapper.xml

@@ -16,7 +16,8 @@
 
     <select id="organizationVisits" resultType="com.redxun.knowledge.analysis.entity.vo.SynthesizeCompanyVo">
         select
-        companyId as company,NVL(total.total, 0) as total,NVL(knowledge.knowledge, 0) as knowledge,NVL(map.map, 0) as map,
+        companyId as company,NVL(total.total, 0) as total,NVL(knowledge.knowledge, 0) as knowledge,NVL(map.map, 0) as
+        map,
         NVL(album.album, 0) as album,NVL(search.search, 0) as search
         from (
         (select COMPANY_ID as companyId, count(*) total
@@ -116,7 +117,8 @@
         select MODULE as name, count (*) as value, round(count (*) / sum (count (*)) over (), 2) percentage from (
         select distinct
         module, sub_module, user_id, company_id, page, platform, ussd, company_id_,
-        create_dep_id_, tenant_id_, create_by_, to_char(create_time_,'yyyy-mm-dd') as createTime, update_by_, update_time_
+        create_dep_id_, tenant_id_, create_by_, to_char(create_time_,'yyyy-mm-dd') as createTime, update_by_,
+        to_char(update_time_,'yyyy-mm-dd') as updateTime
         from KM_PV_LOG)
         <where>
             <if test="firstDay != null and lastDay != null">
@@ -126,4 +128,51 @@
         </where>
         group by MODULE
     </select>
+
+    <select id="totalUserVisits" resultType="com.redxun.knowledge.analysis.entity.vo.CreateUserViewLabel">
+        select
+        <if test="firstDay == null and lastDay == null">
+            concat(concat(substr(to_char(CREATE_TIME_,'yyyy-mm'),1,instr(to_char(CREATE_TIME_,'yyyy-mm'),'-',-1) -
+            1),'年'),
+            concat(ltrim(SUBSTR( to_char(CREATE_TIME_,'yyyy-mm'), INSTR( to_char(CREATE_TIME_,'yyyy-mm'), '-', 1 ) + 1
+            ),'0'),'月')) name
+        </if>
+        <if test="firstDay != null and lastDay != null">
+            concat(ltrim(to_char(CREATE_TIME_,'mm'),'0'),'月') name
+        </if>
+        ,count(*) pv,(select count (*) from (
+        select distinct
+        module, sub_module, user_id, company_id, page, platform, ussd, company_id_,
+        create_dep_id_, tenant_id_, create_by_, to_char(create_time_,'yyyy-mm-dd') as createTime, update_by_,
+        to_char(update_time_,'yyyy-mm-dd') as updateTime
+        from KM_PV_LOG
+        <where>
+            <if test="module != null">
+                MODULE = #{module}
+            </if>
+            <if test="firstDay != null and lastDay != null">
+                and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
+                and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
+            </if>
+        </where>
+        )) uv
+        from KM_PV_LOG
+        <where>
+            <if test="module != null">
+                MODULE = #{module}
+            </if>
+            <if test="firstDay != null and lastDay != null">
+                and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
+                and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
+            </if>
+        </where>
+        <if test="firstDay == null and lastDay == null">
+            group by to_char(CREATE_TIME_,'yyyy-mm')
+            order by to_char(CREATE_TIME_,'yyyy-mm')
+        </if>
+        <if test="firstDay != null and lastDay != null">
+            group by to_char(CREATE_TIME_,'mm')
+            order by to_char(CREATE_TIME_,'mm')
+        </if>
+    </select>
 </mapper>