Просмотр исходного кода

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents

胡轶钦 5 лет назад
Родитель
Сommit
2c03dec6a7
27 измененных файлов: 382 добавлений и 28 удалений
  1. 52
    4
      src/main/java/com/huiju/estateagents/controller/StatisticalController.java
  2. 1
    1
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  3. 1
    4
      src/main/java/com/huiju/estateagents/controller/TaPersonIntentionRecordController.java
  4. 2
    2
      src/main/java/com/huiju/estateagents/controller/TaSaveController.java
  5. 12
    0
      src/main/java/com/huiju/estateagents/entity/TaPersonIntentionRecord.java
  6. 9
    1
      src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java
  7. 8
    0
      src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java
  8. 9
    0
      src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java
  9. 4
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java
  10. 15
    4
      src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java
  11. 18
    1
      src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java
  12. 33
    0
      src/main/java/com/huiju/estateagents/service/IStatisticalService.java
  13. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaBuildingDynamicService.java
  14. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaBuildingService.java
  15. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaNewsService.java
  16. 4
    0
      src/main/java/com/huiju/estateagents/service/ITaPersonIntentionRecordService.java
  17. 69
    1
      src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java
  18. 1
    1
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java
  19. 2
    2
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  20. 2
    2
      src/main/java/com/huiju/estateagents/service/impl/TaNewsServiceImpl.java
  21. 13
    0
      src/main/java/com/huiju/estateagents/service/impl/TaPersonIntentionRecordServiceImpl.java
  22. 12
    0
      src/main/resources/mapper/TaBuildingDynamicMapper.xml
  23. 12
    0
      src/main/resources/mapper/TaBuildingMapper.xml
  24. 13
    0
      src/main/resources/mapper/TaNewsMapper.xml
  25. 11
    0
      src/main/resources/mapper/TaPersonIntentionRecordMapper.xml
  26. 65
    2
      src/main/resources/mapper/TaPersonMapper.xml
  27. 11
    0
      src/main/resources/mapper/TaPersonVisitRecordMapper.xml

+ 52
- 4
src/main/java/com/huiju/estateagents/controller/StatisticalController.java Просмотреть файл

3
 import com.huiju.estateagents.base.ResponseBean;
3
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.service.IStatisticalService;
4
 import com.huiju.estateagents.service.IStatisticalService;
5
 import org.springframework.beans.factory.annotation.Autowired;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
-import org.springframework.web.bind.annotation.GetMapping;
7
-import org.springframework.web.bind.annotation.RequestMapping;
8
-import org.springframework.web.bind.annotation.RequestMethod;
9
-import org.springframework.web.bind.annotation.RestController;
6
+import org.springframework.web.bind.annotation.*;
7
+
8
+import java.util.Date;
10
 
9
 
11
 /**
10
 /**
12
  * 数据统计
11
  * 数据统计
27
         return iStatisticalService.indexStatistical();
26
         return iStatisticalService.indexStatistical();
28
     }
27
     }
29
 
28
 
29
+    /**
30
+     * 活跃用户数
31
+     * @return
32
+     */
33
+    @GetMapping(value = "/selectActiveUserCount")
34
+    public ResponseBean selectActiveUserCount(@RequestParam String dateType) {
35
+        return iStatisticalService.selectActiveUserCount(dateType);
36
+    }
37
+
38
+    /**
39
+     * 活跃用户数
40
+     * @return
41
+     */
42
+    @GetMapping(value = "/selectNewsUserCount")
43
+    public ResponseBean selectNewsUserCount(@RequestParam(required = false) Date startDate,
44
+                                            @RequestParam(required = false) Date endDate) {
45
+        return iStatisticalService.selectNewsUserCount(startDate, endDate);
46
+    }
47
+
48
+    /**
49
+     * 用户行为
50
+     * @return
51
+     */
52
+    @GetMapping(value = "/selectUserBehavior")
53
+    public ResponseBean selectUserBehavior(@RequestParam(required = false) Date startDate,
54
+                                            @RequestParam(required = false) Date endDate) {
55
+        return iStatisticalService.selectUserBehavior(startDate, endDate);
56
+    }
57
+
58
+
59
+    /**
60
+     * 行为分析的 列表
61
+     * @return
62
+     */
63
+    @GetMapping(value = "/selectUserBehaviorAll")
64
+    public ResponseBean selectUserBehaviorAll(@RequestParam(required = false) Integer pageNum,
65
+                                           @RequestParam(required = false) Integer pageCode) {
66
+        return iStatisticalService.selectUserBehaviorAll(pageNum, pageCode);
67
+    }
68
+
69
+    /**
70
+     * 行为分析的 具体数据列表
71
+     * @return
72
+     */
73
+    @GetMapping(value = "/selectEventAll")
74
+    public ResponseBean selectEventAll(@RequestParam(required = false) String event,
75
+                                              @RequestParam(required = false) Integer personId) {
76
+        return iStatisticalService.selectEventAll(event, personId);
77
+    }
30
 
78
 
31
 }
79
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Просмотреть файл

171
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
171
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
172
         }
172
         }
173
 
173
 
174
-        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets,cityId);
174
+        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId);
175
     }
175
     }
176
 
176
 
177
     /**
177
     /**

+ 1
- 4
src/main/java/com/huiju/estateagents/controller/TaPersonIntentionRecordController.java Просмотреть файл

49
         try {
49
         try {
50
             //使用分页插件
50
             //使用分页插件
51
 		    IPage<TaPersonIntentionRecord> pg = new Page<>(pageNum, pageSize);
51
 		    IPage<TaPersonIntentionRecord> pg = new Page<>(pageNum, pageSize);
52
-            QueryWrapper<TaPersonIntentionRecord> queryWrapper = new QueryWrapper<>();
53
-            queryWrapper.orderByDesc("create_date");
54
 
52
 
55
-            IPage<TaPersonIntentionRecord> result = iTaPersonIntentionRecordService.page(pg, queryWrapper);
56
-            responseBean.addSuccess(result);
53
+            responseBean = iTaPersonIntentionRecordService.selectAll(pg);
57
         }catch (Exception e){
54
         }catch (Exception e){
58
             logger.error("taPersonIntentionRecordList -=- {}",e.toString());
55
             logger.error("taPersonIntentionRecordList -=- {}",e.toString());
59
             responseBean.addError(e.getMessage());
56
             responseBean.addError(e.getMessage());

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaSaveController.java Просмотреть файл

26
     private ITaSaveService iTaSaveService;
26
     private ITaSaveService iTaSaveService;
27
 
27
 
28
     /**
28
     /**
29
-     * 点赞
29
+     * 收藏
30
      * @param typeOf
30
      * @param typeOf
31
      * @param id
31
      * @param id
32
      * @param request
32
      * @param request
40
     }
40
     }
41
 
41
 
42
     /**
42
     /**
43
-     * 取消
43
+     * 取消收藏
44
      * @param typeOf
44
      * @param typeOf
45
      * @param id
45
      * @param id
46
      * @param request
46
      * @param request

+ 12
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonIntentionRecord.java Просмотреть файл

1
 package com.huiju.estateagents.entity;
1
 package com.huiju.estateagents.entity;
2
 
2
 
3
 import com.baomidou.mybatisplus.annotation.IdType;
3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import java.time.LocalDateTime;
6
 import java.time.LocalDateTime;
6
 import java.io.Serializable;
7
 import java.io.Serializable;
84
      */
85
      */
85
     private Integer orgId;
86
     private Integer orgId;
86
 
87
 
88
+    /**
89
+     * 手机号
90
+     */
91
+    @TableField(exist = false)
92
+    private String phone;
93
+
94
+    /**
95
+     * 意向值总和
96
+     */
97
+    @TableField(exist = false)
98
+    private Integer intentionCount;
87
 
99
 
88
 }
100
 }

+ 9
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java Просмотреть файл

8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Update;
9
 import org.apache.ibatis.annotations.Update;
10
 
10
 
11
+import java.util.Map;
12
+
11
 /**
13
 /**
12
  * <p>
14
  * <p>
13
  * 项目动态表 Mapper 接口
15
  * 项目动态表 Mapper 接口
24
      * @param page
26
      * @param page
25
      * @return
27
      * @return
26
      */
28
      */
27
-    IPage<TaBuildingDynamic> buildingDynamicList(Page page, @Param("name") String name, @Param("buildingId") String buildingId,@Param("cityId") int cityId);
29
+    IPage<TaBuildingDynamic> buildingDynamicList(Page page, @Param("name") String name, @Param("buildingId") String buildingId,@Param("cityId") Integer cityId);
28
 
30
 
29
     /**
31
     /**
30
      * 详情
32
      * 详情
55
     void setFieldNum(@Param("newsId") String newsId, @Param("field") String field, @Param("increment") int increment);
57
     void setFieldNum(@Param("newsId") String newsId, @Param("field") String field, @Param("increment") int increment);
56
 
58
 
57
     void updateTaBuildingDynamic(@Param("dynamicId") String dynamicId, @Param("sum") String sum);
59
     void updateTaBuildingDynamic(@Param("dynamicId") String dynamicId, @Param("sum") String sum);
60
+
61
+    /**
62
+     * 转化率 活动收藏 / 活动分享
63
+     * @return
64
+     */
65
+    Map<String, Object> selectBuildingDynamicStatistical(String saveOrShare);
58
 }
66
 }

+ 8
- 0
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java Просмотреть файл

6
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
+import org.apache.ibatis.annotations.Select;
9
 import org.apache.ibatis.annotations.Update;
10
 import org.apache.ibatis.annotations.Update;
10
 
11
 
11
 import java.util.List;
12
 import java.util.List;
13
+import java.util.Map;
12
 
14
 
13
 /**
15
 /**
14
  * <p>
16
  * <p>
38
      * @return
40
      * @return
39
      */
41
      */
40
     TaBuilding selectBuilding(@Param("buildingId") String buildingId);
42
     TaBuilding selectBuilding(@Param("buildingId") String buildingId);
43
+
44
+    /**
45
+     * 转化率 项目收藏 / 项目分享
46
+     * @return
47
+     */
48
+    Map<String, Object> selectBuildingStatistical(String saveOrShare);
41
 }
49
 }

+ 9
- 0
src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java Просмотреть файл

6
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 import org.apache.ibatis.annotations.Update;
7
 import org.apache.ibatis.annotations.Update;
8
 
8
 
9
+import java.util.Map;
10
+
9
 /**
11
 /**
10
  * <p>
12
  * <p>
11
  * 资讯表  Mapper 接口
13
  * 资讯表  Mapper 接口
26
     @Update("UPDATE ta_news  SET ${field} = IFNULL(${field}, 0) + #{increment}  WHERE news_id = #{newsId}")
28
     @Update("UPDATE ta_news  SET ${field} = IFNULL(${field}, 0) + #{increment}  WHERE news_id = #{newsId}")
27
     void setFieldNum(@Param("newsId") String newsId, @Param("field") String field, @Param("increment") Integer increment);
29
     void setFieldNum(@Param("newsId") String newsId, @Param("field") String field, @Param("increment") Integer increment);
28
 
30
 
31
+
32
+    /**
33
+     * 转化率 咨迅收藏 / 咨迅分享
34
+     * @return
35
+     */
36
+    Map<String, Object> selectNewsStatistical(String saveOrShare);
37
+
29
 }
38
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java Просмотреть файл

2
 
2
 
3
 
3
 
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
6
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
6
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
7
 
8
 
16
 @Mapper
17
 @Mapper
17
 public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntentionRecord> {
18
 public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntentionRecord> {
18
 
19
 
20
+
21
+    IPage<TaPersonIntentionRecord> selectAll(IPage<TaPersonIntentionRecord> page);
22
+
19
 }
23
 }

+ 15
- 4
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Просмотреть файл

92
      */
92
      */
93
     List<Map<String, Object>> selectActiveUserCount(@Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
93
     List<Map<String, Object>> selectActiveUserCount(@Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
94
 
94
 
95
+    /**
96
+     * 新增用户数
97
+     * @param personType
98
+     * @param startDate
99
+     * @param endDate
100
+     * @return
101
+     */
102
+    List<Map<String, Object>> selectNewsUserCount(@Param("personType") String personType, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
95
 
103
 
96
     /**
104
     /**
97
      * 性别比例
105
      * 性别比例
102
     List<Map<String, Object>> selectSexUser(@Param("personType") String personType);
110
     List<Map<String, Object>> selectSexUser(@Param("personType") String personType);
103
 
111
 
104
 
112
 
105
-
106
-
107
-
108
-
113
+    /**
114
+     * 城市比例
115
+     * @param personType
116
+     * @return
117
+     */
118
+    @Select("select city, count(1) from ta_person where person_type = #{personType} GROUP BY city")
119
+    List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
109
 
120
 
110
 
121
 
111
 }
122
 }

+ 18
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java Просмотреть файл

7
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
7
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
8
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
9
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
10
+import org.apache.ibatis.annotations.Select;
10
 
11
 
11
 import java.util.List;
12
 import java.util.List;
12
 
13
 
20
  */
21
  */
21
 @Mapper
22
 @Mapper
22
 public interface TaPersonVisitRecordMapper extends BaseMapper<TaPersonVisitRecord> {
23
 public interface TaPersonVisitRecordMapper extends BaseMapper<TaPersonVisitRecord> {
23
-    List<TaPersonVisitRecord>visitRecordByPersonId(@Param("personId") String personId);
24
 
24
 
25
+    List<TaPersonVisitRecord> visitRecordByPersonId(@Param("personId") String personId);
26
+
27
+    /**
28
+     * 行为分析的 列表
29
+     * @param page
30
+     * @return
31
+     */
32
+    IPage<TaPersonVisitRecord> selectAll(IPage<TaPersonVisitRecord> page);
33
+
34
+
35
+    /**
36
+     * 行为分析的 具体数据
37
+     *
38
+     * @return
39
+     */
40
+    @Select("select * from ta_person_visit_record where event = #{event} and person_id = #{personId}")
41
+    List<TaPersonVisitRecord> selectEventAll(@Param("event") String event, @Param("personId") Integer personId);
25
 
42
 
26
 }
43
 }

+ 33
- 0
src/main/java/com/huiju/estateagents/service/IStatisticalService.java Просмотреть файл

2
 
2
 
3
 import com.huiju.estateagents.base.ResponseBean;
3
 import com.huiju.estateagents.base.ResponseBean;
4
 
4
 
5
+import java.util.Date;
6
+
5
 /**
7
 /**
6
  * 数据统计 接口
8
  * 数据统计 接口
7
  */
9
  */
19
      */
21
      */
20
     ResponseBean selectActiveUserCount(String dateType);
22
     ResponseBean selectActiveUserCount(String dateType);
21
 
23
 
24
+    /**
25
+     * 新增用户数
26
+     * @param startDate
27
+     * @param endDate
28
+     * @return
29
+     */
30
+    ResponseBean selectNewsUserCount(Date startDate,Date endDate);
31
+
32
+    /**
33
+     * 用户行为
34
+     * @param startDate
35
+     * @param endDate
36
+     * @return
37
+     */
38
+    ResponseBean selectUserBehavior(Date startDate,Date endDate);
39
+
40
+    /**
41
+     * 行为分析的 列表
42
+     * @param pageNum
43
+     * @param pageCode
44
+     * @return
45
+     */
46
+    ResponseBean selectUserBehaviorAll(Integer pageNum, Integer pageCode);
47
+
48
+    /**
49
+     * 行为分析的 具体数据列表
50
+     * @param event
51
+     * @param personId
52
+     * @return
53
+     */
54
+    ResponseBean selectEventAll(String event, Integer personId);
22
 }
55
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingDynamicService.java Просмотреть файл

22
      * 项目动态管理列表
22
      * 项目动态管理列表
23
      * @return
23
      * @return
24
      */
24
      */
25
-    ResponseBean iBuildingDynamicList(Integer pageNum, Integer pageSize, String name, String buildingId,int cityId);
25
+    ResponseBean iBuildingDynamicList(Integer pageNum, Integer pageSize, String name, String buildingId,Integer cityId);
26
 
26
 
27
     /**
27
     /**
28
      * 项目详情
28
      * 项目详情

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java Просмотреть файл

107
      * @param pageSize
107
      * @param pageSize
108
      * @param name
108
      * @param name
109
      */
109
      */
110
-    ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,int cityId);
110
+    ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId);
111
 
111
 
112
     /**
112
     /**
113
      * 微信小程序 楼盘列表
113
      * 微信小程序 楼盘列表

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaNewsService.java Просмотреть файл

70
      */
70
      */
71
     ResponseBean wxTaPvNum(Integer id);
71
     ResponseBean wxTaPvNum(Integer id);
72
 
72
 
73
-    IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,int cityId);
73
+    IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,Integer cityId);
74
 }
74
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/service/ITaPersonIntentionRecordService.java Просмотреть файл

1
 package com.huiju.estateagents.service;
1
 package com.huiju.estateagents.service;
2
 
2
 
3
 
3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
7
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
6
 
8
 
7
 /**
9
 /**
14
  */
16
  */
15
 public interface ITaPersonIntentionRecordService extends IService<TaPersonIntentionRecord> {
17
 public interface ITaPersonIntentionRecordService extends IService<TaPersonIntentionRecord> {
16
 
18
 
19
+
20
+    ResponseBean selectAll(IPage<TaPersonIntentionRecord> pg);
17
 }
21
 }

+ 69
- 1
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Просмотреть файл

1
 package com.huiju.estateagents.service.impl;
1
 package com.huiju.estateagents.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.common.CommConstant;
6
 import com.huiju.estateagents.common.CommConstant;
7
+import com.huiju.estateagents.entity.TaPersonVisitRecord;
5
 import com.huiju.estateagents.exception.EstaException;
8
 import com.huiju.estateagents.exception.EstaException;
9
+import com.huiju.estateagents.mapper.TaBuildingMapper;
6
 import com.huiju.estateagents.mapper.TaPersonMapper;
10
 import com.huiju.estateagents.mapper.TaPersonMapper;
11
+import com.huiju.estateagents.mapper.TaPersonVisitRecordMapper;
7
 import com.huiju.estateagents.po.PersonPO;
12
 import com.huiju.estateagents.po.PersonPO;
8
 import com.huiju.estateagents.service.IStatisticalService;
13
 import com.huiju.estateagents.service.IStatisticalService;
9
 import lombok.extern.slf4j.Slf4j;
14
 import lombok.extern.slf4j.Slf4j;
11
 import org.springframework.stereotype.Service;
16
 import org.springframework.stereotype.Service;
12
 
17
 
13
 import java.time.LocalDateTime;
18
 import java.time.LocalDateTime;
19
+import java.util.Date;
14
 import java.util.HashMap;
20
 import java.util.HashMap;
15
 import java.util.List;
21
 import java.util.List;
16
 import java.util.Map;
22
 import java.util.Map;
25
     @Autowired
31
     @Autowired
26
     private TaPersonMapper taPersonMapper;
32
     private TaPersonMapper taPersonMapper;
27
 
33
 
34
+    @Autowired
35
+    private TaBuildingMapper taBuildingMapper;
36
+
37
+
38
+    @Autowired
39
+    private TaPersonVisitRecordMapper taPersonVisitRecordMapper;
28
 
40
 
29
     @Override
41
     @Override
30
     public ResponseBean indexStatistical() {
42
     public ResponseBean indexStatistical() {
44
         // 用户行为
56
         // 用户行为
45
         List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
57
         List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
46
 
58
 
47
-        // 用户活跃数 / 新增用户数
59
+        // 用户活跃数
48
         List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
60
         List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
49
 
61
 
62
+        // 新增用户数
63
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
64
+
50
         // 性别比例
65
         // 性别比例
51
         List<Map<String, Object>> selectSexUser = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT);
66
         List<Map<String, Object>> selectSexUser = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT);
52
 
67
 
68
+        // 城市比例
69
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
70
+
71
+        // 转化率, 当前 默认项目收藏
72
+        Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical("save");
73
+
53
         map.put("selectUserCount", selectUserCount);
74
         map.put("selectUserCount", selectUserCount);
54
         map.put("selectRegisteredCount", selectRegisteredCount);
75
         map.put("selectRegisteredCount", selectRegisteredCount);
55
         map.put("selectRecentlyCount", selectRecentlyCount);
76
         map.put("selectRecentlyCount", selectRecentlyCount);
56
         map.put("selectUserBehavior", selectUserBehavior);
77
         map.put("selectUserBehavior", selectUserBehavior);
57
         map.put("selectActiveUserCount", selectActiveUserCount);
78
         map.put("selectActiveUserCount", selectActiveUserCount);
79
+        map.put("selectNewsUserCount", selectNewsUserCount);
58
         map.put("selectSexUser", selectSexUser);
80
         map.put("selectSexUser", selectSexUser);
81
+        map.put("selectCityUser", selectCityUser);
82
+        map.put("selectBuildingStatistical", selectBuildingStatistical);
59
 
83
 
60
         responseBean.addSuccess(map);
84
         responseBean.addSuccess(map);
61
 
85
 
84
         responseBean.addSuccess(map);
108
         responseBean.addSuccess(map);
85
         return responseBean;
109
         return responseBean;
86
     }
110
     }
111
+
112
+    @Override
113
+    public ResponseBean selectNewsUserCount(Date startDate, Date endDate) {
114
+        ResponseBean responseBean = new ResponseBean();
115
+
116
+        // 新增用户数
117
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
118
+
119
+        Map<String, Object> map = new HashMap<>();
120
+        map.put("selectNewsUserCount", selectNewsUserCount);
121
+        responseBean.addSuccess(map);
122
+        return responseBean;
123
+    }
124
+
125
+    @Override
126
+    public ResponseBean selectUserBehavior(Date startDate, Date endDate) {
127
+        ResponseBean responseBean = new ResponseBean();
128
+
129
+        // 用户行为
130
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
131
+
132
+        Map<String, Object> map = new HashMap<>();
133
+        map.put("selectUserBehavior", selectUserBehavior);
134
+        responseBean.addSuccess(map);
135
+        return responseBean;
136
+    }
137
+
138
+    @Override
139
+    public ResponseBean selectUserBehaviorAll(Integer pageNum, Integer pageSize) {
140
+        ResponseBean responseBean = new ResponseBean();
141
+        IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
142
+        IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page);
143
+        responseBean.addSuccess(visitRecordIPage);
144
+        return responseBean;
145
+    }
146
+
147
+    @Override
148
+    public ResponseBean selectEventAll(String event, Integer personId) {
149
+        ResponseBean responseBean = new ResponseBean();
150
+
151
+        List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
152
+        responseBean.addSuccess(taPersonVisitRecords);
153
+        return responseBean;
154
+    }
87
 }
155
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java Просмотреть файл

64
         binder.registerCustomEditor(Date.class, editor);
64
         binder.registerCustomEditor(Date.class, editor);
65
     }
65
     }
66
     @Override
66
     @Override
67
-    public ResponseBean iBuildingDynamicList(Integer pageNum, Integer pageSize, String name, String buildingId,int cityId) {
67
+    public ResponseBean iBuildingDynamicList(Integer pageNum, Integer pageSize, String name, String buildingId,Integer cityId) {
68
         Page<TaBuildingDynamic> page = new Page<>();
68
         Page<TaBuildingDynamic> page = new Page<>();
69
         page.setSize(pageSize == null ? 10 : pageSize);
69
         page.setSize(pageSize == null ? 10 : pageSize);
70
         page.setCurrent(pageNum == null ? 1 : pageNum);
70
         page.setCurrent(pageNum == null ? 1 : pageNum);

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Просмотреть файл

311
     }
311
     }
312
 
312
 
313
     @Override
313
     @Override
314
-    public ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,int cityId) {
314
+    public ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId) {
315
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
315
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
316
 
316
 
317
         QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
317
         QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
318
         buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
318
         buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
319
         buildingQueryWrapper.eq("status", 1);
319
         buildingQueryWrapper.eq("status", 1);
320
-        buildingQueryWrapper.eq(cityId != 0,"city_id",cityId);
320
+        buildingQueryWrapper.eq(null != cityId && cityId != 0,"city_id", cityId);
321
         buildingQueryWrapper.in(null != targets && targets.size() > 0, "building_id", targets);
321
         buildingQueryWrapper.in(null != targets && targets.size() > 0, "building_id", targets);
322
 //        buildingQueryWrapper.like(null != name && !"".equals(name.trim()), "name", name);
322
 //        buildingQueryWrapper.like(null != name && !"".equals(name.trim()), "name", name);
323
         buildingQueryWrapper.orderByAsc("order_no");
323
         buildingQueryWrapper.orderByAsc("order_no");

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaNewsServiceImpl.java Просмотреть файл

182
     }
182
     }
183
 
183
 
184
     @Override
184
     @Override
185
-    public IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,int cityId) {
185
+    public IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,Integer cityId) {
186
         IPage<TaNews> page = new Page<>(pageNum, pageSize);
186
         IPage<TaNews> page = new Page<>(pageNum, pageSize);
187
 
187
 
188
         QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
188
         QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
189
         taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
189
         taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
190
         taNewsQueryWrapper.in(null != targets && targets.size() > 0, "news_id", targets);
190
         taNewsQueryWrapper.in(null != targets && targets.size() > 0, "news_id", targets);
191
-        taNewsQueryWrapper.eq(cityId != 0,"city_id",cityId);
191
+        taNewsQueryWrapper.eq(null != cityId && cityId != 0,"city_id",cityId);
192
         taNewsQueryWrapper.eq("status", 1);
192
         taNewsQueryWrapper.eq("status", 1);
193
         taNewsQueryWrapper.orderByDesc("create_date");
193
         taNewsQueryWrapper.orderByDesc("create_date");
194
         IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
194
         IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);

+ 13
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPersonIntentionRecordServiceImpl.java Просмотреть файл

1
 package com.huiju.estateagents.service.impl;
1
 package com.huiju.estateagents.service.impl;
2
 
2
 
3
 
3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
7
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
6
 import com.huiju.estateagents.mapper.TaPersonIntentionRecordMapper;
8
 import com.huiju.estateagents.mapper.TaPersonIntentionRecordMapper;
7
 import com.huiju.estateagents.service.ITaPersonIntentionRecordService;
9
 import com.huiju.estateagents.service.ITaPersonIntentionRecordService;
10
+import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
9
 
12
 
10
 /**
13
 /**
18
 @Service
21
 @Service
19
 public class TaPersonIntentionRecordServiceImpl extends ServiceImpl<TaPersonIntentionRecordMapper, TaPersonIntentionRecord> implements ITaPersonIntentionRecordService {
22
 public class TaPersonIntentionRecordServiceImpl extends ServiceImpl<TaPersonIntentionRecordMapper, TaPersonIntentionRecord> implements ITaPersonIntentionRecordService {
20
 
23
 
24
+    @Autowired
25
+    private TaPersonIntentionRecordMapper taPersonIntentionRecordMapper;
26
+
27
+    @Override
28
+    public ResponseBean selectAll(IPage<TaPersonIntentionRecord> pg) {
29
+        ResponseBean responseBean = new ResponseBean();
30
+        IPage<TaPersonIntentionRecord> taPersonIntentionRecordIPage = taPersonIntentionRecordMapper.selectAll(pg);
31
+        responseBean.addSuccess(taPersonIntentionRecordIPage);
32
+        return responseBean;
33
+    }
21
 }
34
 }

+ 12
- 0
src/main/resources/mapper/TaBuildingDynamicMapper.xml Просмотреть файл

86
 	      dynamic_id = #{dynamicId}
86
 	      dynamic_id = #{dynamicId}
87
     </select>
87
     </select>
88
 
88
 
89
+    <select id="selectBuildingDynamicStatistical" resultType="map">
90
+            select
91
+            sum(pv_num) as pvNum,
92
+            <if test="saveOrShare === 'save'">
93
+                sum(save_num) as saveNum
94
+            </if>
95
+            <if test="saveOrShare === 'share'">
96
+                sum(share_num) as shareNum
97
+            </if>
98
+            from ta_building_dynamic
99
+    </select>
100
+
89
 </mapper>
101
 </mapper>

+ 12
- 0
src/main/resources/mapper/TaBuildingMapper.xml Просмотреть файл

25
          where building_id = #{buildingId}
25
          where building_id = #{buildingId}
26
     </select>
26
     </select>
27
 
27
 
28
+    <select id="selectBuildingStatistical" resultType="map">
29
+        select
30
+          sum(pv_num) as pvNum,
31
+          <if test="saveOrShare === 'save'">
32
+              sum(save_num) as saveNum
33
+          </if>
34
+          <if test="saveOrShare === 'share'">
35
+              sum(share_num) as shareNum
36
+          </if>
37
+        from ta_building
38
+    </select>
39
+
28
 </mapper>
40
 </mapper>

+ 13
- 0
src/main/resources/mapper/TaNewsMapper.xml Просмотреть файл

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaNewsMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaNewsMapper">
4
 
4
 
5
+
6
+    <select id="selectNewsStatistical" resultType="map" >
7
+        select
8
+        sum(pv_num) as pvNum,
9
+        <if test="saveOrShare === 'save'">
10
+            sum(save_num) as saveNum
11
+        </if>
12
+        <if test="saveOrShare === 'share'">
13
+            sum(share_num) as shareNum
14
+        </if>
15
+        from ta_news
16
+    </select>
17
+
5
 </mapper>
18
 </mapper>

+ 11
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml Просмотреть файл

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaPersonIntentionRecordMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaPersonIntentionRecordMapper">
4
 
4
 
5
+    <select id="selectAll" resultType="com.huiju.estateagents.entity.TaPersonIntentionRecord">
6
+        SELECT
7
+            *,
8
+            tp.phone as phone,
9
+            SUM(tpir.intention) as intentionCount
10
+        FROM
11
+            ta_person_intention_record tpir
12
+            LEFT JOIN ta_person tp ON tpir.person_id = tp.person_id
13
+            GROUP BY tpir.person_id
14
+    </select>
15
+
5
 </mapper>
16
 </mapper>

+ 65
- 2
src/main/resources/mapper/TaPersonMapper.xml Просмотреть файл

195
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
195
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
196
             where tp.person_type = #{personType}
196
             where tp.person_type = #{personType}
197
             GROUP BY tpvr.activity
197
             GROUP BY tpvr.activity
198
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
198
+        ) AS temp ON temp_date.date = DATE_FORMAT( temp.visitTime , '%Y-%m-%d' )
199
     </select>
199
     </select>
200
 
200
 
201
     <select id="selectActiveUserCount" resultType="map">
201
     <select id="selectActiveUserCount" resultType="map">
229
                 tpvr.visit_time AS visit_time
229
                 tpvr.visit_time AS visit_time
230
             FROM
230
             FROM
231
                ta_person tp
231
                ta_person tp
232
-            where tp.person_type = #{personType}
233
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
232
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
233
+             where tp.person_type = #{personType}
234
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
234
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
235
     </select>
235
     </select>
236
 
236
 
237
+    <select id="selectNewsUserCount" >
238
+        SELECT
239
+        consultant_count_table.date as date,
240
+        consultant_count_table.consultant_count as consultant_count,
241
+        user_count_table.user_count as user_count
242
+        FROM
243
+        (
244
+            SELECT
245
+              *
246
+            FROM
247
+            (
248
+                SELECT
249
+                DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
250
+                FROM
251
+                sequence a
252
+                WHERE
253
+                <if test="startDate == null or endDate == null">
254
+                    a.rownum <![CDATA[ <= ]]> 7
255
+                </if>
256
+                <if test="startDate != null or endDate != null">
257
+                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
258
+                </if>
259
+            ) AS temp_date
260
+            LEFT JOIN (
261
+                SELECT
262
+                COUNT(1) as consultant_count,
263
+                tpvr.visit_time AS visit_time
264
+                FROM
265
+                ta_person tp
266
+                INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
267
+                where tp.person_type = 'Realty Consultant'
268
+            ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
269
+        ) as consultant_count_table
270
+        ,
271
+        (SELECT
272
+        *
273
+        FROM
274
+        (
275
+            SELECT
276
+            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
277
+            FROM
278
+            sequence a
279
+            WHERE
280
+            <if test="startDate == null or endDate == null">
281
+                a.rownum <![CDATA[ <= ]]> 7
282
+            </if>
283
+            <if test="startDate != null or endDate != null">
284
+                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
285
+            </if>
286
+        ) AS temp_date
287
+        LEFT JOIN (
288
+            SELECT
289
+            COUNT(1) as user_count,
290
+            tpvr.visit_time AS visit_time
291
+            FROM
292
+            ta_person tp
293
+            INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
294
+        ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
295
+
296
+        ) as user_count_table
297
+        GROUP BY date
298
+    </select>
299
+
237
 </mapper>
300
 </mapper>

+ 11
- 0
src/main/resources/mapper/TaPersonVisitRecordMapper.xml Просмотреть файл

6
         where person_id = #{personId}
6
         where person_id = #{personId}
7
     </select>
7
     </select>
8
 
8
 
9
+    <select id="selectAll">
10
+        SELECT
11
+            tpvr.*,
12
+            tp.name,
13
+            COUNT(1) as accessCount
14
+        FROM
15
+            ta_person_visit_record tpvr
16
+            LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
17
+        GROUP BY tpvr.person_id, tpvr.event
18
+    </select>
19
+
9
 </mapper>
20
 </mapper>