张延森 5 years ago
parent
commit
bde1a2171f

+ 38
- 28
src/main/java/com/huiju/estateagents/controller/StatisticalController.java View File

1
 package com.huiju.estateagents.controller;
1
 package com.huiju.estateagents.controller;
2
 
2
 
3
+import com.huiju.estateagents.base.BaseController;
3
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.service.IStatisticalService;
5
 import com.huiju.estateagents.service.IStatisticalService;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.format.annotation.DateTimeFormat;
7
 import org.springframework.format.annotation.DateTimeFormat;
7
 import org.springframework.web.bind.annotation.*;
8
 import org.springframework.web.bind.annotation.*;
8
 
9
 
10
+import javax.servlet.http.HttpServletRequest;
9
 import java.time.LocalDate;
11
 import java.time.LocalDate;
10
-import java.util.Date;
11
 
12
 
12
 /**
13
 /**
13
  * 数据统计
14
  * 数据统计
14
  */
15
  */
15
 @RestController
16
 @RestController
16
 @RequestMapping("/api")
17
 @RequestMapping("/api")
17
-public class StatisticalController {
18
+public class StatisticalController extends BaseController {
18
 
19
 
19
     @Autowired
20
     @Autowired
20
     private IStatisticalService iStatisticalService;
21
     private IStatisticalService iStatisticalService;
24
      * @return
25
      * @return
25
      */
26
      */
26
     @GetMapping(value = "/admin/indexStatistical")
27
     @GetMapping(value = "/admin/indexStatistical")
27
-    public ResponseBean indexStatistical() {
28
-        return iStatisticalService.indexStatistical();
28
+    public ResponseBean indexStatistical(HttpServletRequest request) {
29
+        return iStatisticalService.indexStatistical(getOrgId(request));
29
     }
30
     }
30
 
31
 
31
     /**
32
     /**
35
     @GetMapping(value = "/admin/selectActiveUserCount")
36
     @GetMapping(value = "/admin/selectActiveUserCount")
36
     public ResponseBean selectActiveUserCount(@RequestParam String dateType,
37
     public ResponseBean selectActiveUserCount(@RequestParam String dateType,
37
                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
38
                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
38
-                                              @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
39
-        return iStatisticalService.selectActiveUserCount(dateType, startDate,endDate);
39
+                                              @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
40
+                                              HttpServletRequest request) {
41
+        return iStatisticalService.selectActiveUserCount(getOrgId(request), dateType, startDate,endDate);
40
     }
42
     }
41
 
43
 
42
     /**
44
     /**
45
      */
47
      */
46
     @GetMapping(value = "/admin/selectNewsUserCount")
48
     @GetMapping(value = "/admin/selectNewsUserCount")
47
     public ResponseBean selectNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
49
     public ResponseBean selectNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
48
-                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
49
-        return iStatisticalService.selectNewsUserCount(startDate, endDate);
50
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
51
+                                            HttpServletRequest request) {
52
+        return iStatisticalService.selectNewsUserCount(getOrgId(request), startDate, endDate);
50
     }
53
     }
51
 
54
 
52
     /**
55
     /**
54
      * @return
57
      * @return
55
      */
58
      */
56
     @GetMapping(value = "/admin/selectConversion")
59
     @GetMapping(value = "/admin/selectConversion")
57
-    public ResponseBean selectConversion(@RequestParam("conversion") String conversion) {
58
-        return iStatisticalService.selectConversion(conversion);
60
+    public ResponseBean selectConversion(@RequestParam("conversion") String conversion,
61
+                                         HttpServletRequest request) {
62
+        return iStatisticalService.selectConversion(getOrgId(request), conversion);
59
     }
63
     }
60
 
64
 
61
     /**
65
     /**
70
                                            @RequestParam(value = "buildingId", required = false) String buildingId,
74
                                            @RequestParam(value = "buildingId", required = false) String buildingId,
71
                                            @RequestParam(value = "eventType", required = false) String eventType,
75
                                            @RequestParam(value = "eventType", required = false) String eventType,
72
                                            @RequestParam(value = "event", required = false) String event,
76
                                            @RequestParam(value = "event", required = false) String event,
73
-                                           @RequestParam(value = "activity", required = false) String activity) {
74
-        return iStatisticalService.selectUserBehavior(pageNum, pageSize, startDate, endDate, buildingId, eventType, event, activity);
77
+                                           @RequestParam(value = "activity", required = false) String activity,
78
+                                           HttpServletRequest request) {
79
+        return iStatisticalService.selectUserBehavior(pageNum, pageSize, getOrgId(request), startDate, endDate, buildingId, eventType, event, activity);
75
     }
80
     }
76
 
81
 
77
     /**
82
     /**
80
      */
85
      */
81
     @GetMapping(value = "/admin/selectEventAll")
86
     @GetMapping(value = "/admin/selectEventAll")
82
     public ResponseBean selectEventAll(@RequestParam(required = false) String event,
87
     public ResponseBean selectEventAll(@RequestParam(required = false) String event,
83
-                                              @RequestParam(required = false) String personId) {
84
-        return iStatisticalService.selectEventAll(event, personId);
88
+                                       @RequestParam(required = false) String personId,
89
+                                       HttpServletRequest request) {
90
+        return iStatisticalService.selectEventAll(getOrgId(request), event, personId);
85
     }
91
     }
86
 
92
 
87
 
93
 
91
      */
97
      */
92
     @GetMapping(value = "/admin/selectUserResource")
98
     @GetMapping(value = "/admin/selectUserResource")
93
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
99
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
94
-                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
95
-        return iStatisticalService.selectUserResource(startDate, endDate);
100
+                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
101
+                                           HttpServletRequest request) {
102
+        return iStatisticalService.selectUserResource(getOrgId(request), startDate, endDate);
96
     }
103
     }
97
 
104
 
98
 
105
 
101
      * @return
108
      * @return
102
      */
109
      */
103
     @GetMapping(value = "/admin/selectUserCount")
110
     @GetMapping(value = "/admin/selectUserCount")
104
-    public ResponseBean selectUserResource() {
105
-        return iStatisticalService.selectUserCount();
111
+    public ResponseBean selectUserResource(HttpServletRequest request) {
112
+        return iStatisticalService.selectUserCount(getOrgId(request));
106
     }
113
     }
107
 
114
 
108
     /**
115
     /**
110
      * @return
117
      * @return
111
      */
118
      */
112
     @GetMapping(value = "/admin/selectRegisteredCount")
119
     @GetMapping(value = "/admin/selectRegisteredCount")
113
-    public ResponseBean selectRegisteredCount() {
114
-        return iStatisticalService.selectRegisteredCount();
120
+    public ResponseBean selectRegisteredCount(HttpServletRequest request) {
121
+        return iStatisticalService.selectRegisteredCount(getOrgId(request));
115
     }
122
     }
116
 
123
 
117
     /**
124
     /**
120
      */
127
      */
121
     @GetMapping(value = "/admin/selectRecentlyCount")
128
     @GetMapping(value = "/admin/selectRecentlyCount")
122
     public ResponseBean selectRecentlyCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
129
     public ResponseBean selectRecentlyCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
123
-                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate) {
124
-        return iStatisticalService.selectRecentlyCount(startDate, endDate);
130
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
131
+                                            HttpServletRequest request) {
132
+        return iStatisticalService.selectRecentlyCount(getOrgId(request), startDate, endDate);
125
     }
133
     }
126
 
134
 
127
     /**
135
     /**
129
      * @return
137
      * @return
130
      */
138
      */
131
     @GetMapping(value = "/admin/selectSexUser")
139
     @GetMapping(value = "/admin/selectSexUser")
132
-    public ResponseBean selectSexUser() {
133
-        return iStatisticalService.selectSexUser();
140
+    public ResponseBean selectSexUser(HttpServletRequest request) {
141
+        return iStatisticalService.selectSexUser(getOrgId(request));
134
     }
142
     }
135
 
143
 
136
     /**
144
     /**
138
      * @return
146
      * @return
139
      */
147
      */
140
     @GetMapping(value = "/admin/selectCityUser")
148
     @GetMapping(value = "/admin/selectCityUser")
141
-    public ResponseBean selectCityUser() {
142
-        return iStatisticalService.selectCityUser();
149
+    public ResponseBean selectCityUser(HttpServletRequest request) {
150
+        Integer orgId = getOrgId(request);
151
+        return iStatisticalService.selectCityUser(orgId);
143
     }
152
     }
144
 
153
 
145
     /**
154
     /**
149
     @GetMapping(value = "/admin/selectIntentionUser")
158
     @GetMapping(value = "/admin/selectIntentionUser")
150
     public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
159
     public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
151
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
160
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
152
-                                            @RequestParam(value = "buildingId", required = false) String buildingId) {
153
-        return iStatisticalService.selectIntentionUser(pageNum, pageSize, buildingId);
161
+                                            @RequestParam(value = "buildingId", required = false) String buildingId,
162
+                                            HttpServletRequest request) {
163
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId);
154
     }
164
     }
155
 
165
 
156
 }
166
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java View File

63
      * 转化率 活动收藏 / 活动分享
63
      * 转化率 活动收藏 / 活动分享
64
      * @return
64
      * @return
65
      */
65
      */
66
-    Map<String, Object> selectBuildingDynamicStatistical(@Param("saveOrShare") String saveOrShare);
66
+    Map<String, Object> selectBuildingDynamicStatistical(@Param("orgId") Integer orgId, @Param("saveOrShare") String saveOrShare);
67
 
67
 
68
     /**
68
     /**
69
      * 转化率 活动报名
69
      * 转化率 活动报名
70
      * @return
70
      * @return
71
      */
71
      */
72
-    Map<String, Object> selectBuildingDynamicEnlistStatistical();
72
+    Map<String, Object> selectBuildingDynamicEnlistStatistical(@Param("orgId") Integer orgId);
73
 }
73
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java View File

54
      * 转化率 项目收藏 / 项目分享
54
      * 转化率 项目收藏 / 项目分享
55
      * @return
55
      * @return
56
      */
56
      */
57
-    Map<String, Object> selectBuildingStatistical(@Param("saveOrShare") String saveOrShare);
57
+    Map<String, Object> selectBuildingStatistical(@Param("orgId")Integer orgId, @Param("saveOrShare") String saveOrShare);
58
 
58
 
59
     /**
59
     /**
60
      * 查询楼盘
60
      * 查询楼盘

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java View File

33
      * 转化率 咨迅收藏 / 咨迅分享
33
      * 转化率 咨迅收藏 / 咨迅分享
34
      * @return
34
      * @return
35
      */
35
      */
36
-    Map<String, Object> selectNewsStatistical(@Param("saveOrShare") String saveOrShare);
36
+    Map<String, Object> selectNewsStatistical(@Param("orgId") Integer orgId, @Param("saveOrShare") String saveOrShare);
37
 
37
 
38
 }
38
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java View File

29
      * @param buildingId
29
      * @param buildingId
30
      * @return
30
      * @return
31
      */
31
      */
32
-    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("buildingId") String buildingId);
32
+    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("orgId") Integer orgId, @Param("buildingId") String buildingId);
33
 }
33
 }

+ 29
- 19
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java View File

56
      * @return
56
      * @return
57
      */
57
      */
58
     @ResultType(Integer.class)
58
     @ResultType(Integer.class)
59
-    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType}")
60
-    Integer selectUserCount(@Param("personType") String personType);
59
+    @Select("select count(1) from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType}")
60
+    Integer selectUserCount(@Param("org") Integer orgId, @Param("personType") String personType);
61
 
61
 
62
     /**
62
     /**
63
      * 总注册数
63
      * 总注册数
65
      * @return
65
      * @return
66
      */
66
      */
67
     @ResultType(Integer.class)
67
     @ResultType(Integer.class)
68
-    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType} and phone is not null")
69
-    Integer selectRegisteredCount(@Param("personType") String personType);
68
+    @Select("select count(1) from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType} and phone is not null")
69
+    Integer selectRegisteredCount(@Param("org") Integer orgId, @Param("personType") String personType);
70
 
70
 
71
     /**
71
     /**
72
      * 根据时间段查询
72
      * 根据时间段查询
73
      * @param personType
73
      * @param personType
74
      * @return
74
      * @return
75
      */
75
      */
76
-    Integer selectRecentlyCount(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
76
+    Integer selectRecentlyCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
77
 
77
 
78
     //---------- 用户总数 end ------------
78
     //---------- 用户总数 end ------------
79
 
79
 
84
      * @param endDate
84
      * @param endDate
85
      * @return
85
      * @return
86
      */
86
      */
87
-    List<PersonPO> selectUserBehavior(@Param("personType") String personType,
87
+    List<PersonPO> selectUserBehavior(@Param("org") Integer orgId,
88
+                                      @Param("personType") String personType,
88
                                       @Param("startDate")LocalDate startDate,
89
                                       @Param("startDate")LocalDate startDate,
89
                                       @Param("endDate")LocalDate endDate,
90
                                       @Param("endDate")LocalDate endDate,
90
                                       @Param("buildingId") String buildingId,
91
                                       @Param("buildingId") String buildingId,
98
      * @param dateType
99
      * @param dateType
99
      * @return
100
      * @return
100
      */
101
      */
101
-    List<Map<String, Object>> selectActiveUserCount(@Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
102
+    List<Map<String, Object>> selectActiveUserCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
102
 
103
 
103
     /**
104
     /**
104
      * 新增用户数
105
      * 新增用户数
107
      * @param endDate
108
      * @param endDate
108
      * @return
109
      * @return
109
      */
110
      */
110
-    List<Map<String, Object>> selectNewsUserCount(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
111
+    List<Map<String, Object>> selectNewsUserCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
111
 
112
 
112
     /**
113
     /**
113
      * 性别比例
114
      * 性别比例
117
      * @param personType
118
      * @param personType
118
      * @return
119
      * @return
119
      */
120
      */
120
-    @Select("select count(1) as sex_count from ta_person where ifnull(person_type, '') != #{personType} and gender = #{gender}")
121
-    Integer selectSexUser(@Param("personType") String personType, @Param("gender") Integer gender);
121
+    @Select("select count(1) as sex_count from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType} and gender = #{gender}")
122
+    Integer selectSexUser(@Param("org") Integer orgId, @Param("personType") String personType, @Param("gender") Integer gender);
122
 
123
 
123
 
124
 
124
     /**
125
     /**
128
      */
129
      */
129
     @ResultType(Map.class)
130
     @ResultType(Map.class)
130
     @Select("SELECT " +
131
     @Select("SELECT " +
131
-            "ifnull(b.NAME, '其他') AS city, " +
132
-            "count(a.person_id) AS city_count " +
133
-            " FROM" +
134
-            " ta_person a" +
135
-            " LEFT JOIN ( select t.*, s.pinyin as province from td_city t JOIN td_city s on t.parentid = s.id) b ON a.city = b.pinyin and a.province = b.province where ifnull(a.person_type, '') != #{personType} and a.city is not null GROUP BY a.city")
136
-    List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
132
+            " 	a.city as city, " +
133
+            "	b.shortname AS name, " +
134
+            "	b.lng, " +
135
+            "	b.lat, " +
136
+            "	count(a.person_id) AS cityCount " +
137
+            "FROM " +
138
+            "	ta_person a " +
139
+            "inner JOIN td_city b " +
140
+            "on a.city = b.id " +
141
+            "WHERE " +
142
+            "   a.org_id = #{org} " +
143
+            "	AND ifnull(a.person_type, '') != #{personType} " +
144
+            "GROUP BY " +
145
+            "	a.city ")
146
+    List<Map<String, Object>> selectCityUser(@Param("org") Integer orgId, @Param("personType") String personType);
137
 
147
 
138
 
148
 
139
     // ------------- 用户来源 start ------------
149
     // ------------- 用户来源 start ------------
143
      * @param recommendPersonType
153
      * @param recommendPersonType
144
      * @return
154
      * @return
145
      */
155
      */
146
-    Integer selectUserSourcePie(@Param("recommendPersonType") String recommendPersonType, @Param("personType") String personType);
156
+    Integer selectUserSourcePie(@Param("org") Integer orgId, @Param("recommendPersonType") String recommendPersonType, @Param("personType") String personType);
147
 
157
 
148
     /**
158
     /**
149
      * 用户来源 柱状
159
      * 用户来源 柱状
150
      * @return
160
      * @return
151
      */
161
      */
152
-    List<Map<String, Object>> selectUserSourceColumnar(@Param("personType") String personType, @Param("startDate") LocalDate startDate, @Param("endDate")LocalDate endDate);
162
+    List<Map<String, Object>> selectUserSourceColumnar(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate") LocalDate startDate, @Param("endDate")LocalDate endDate);
153
 
163
 
154
     /**
164
     /**
155
      * 用户来源 数据列表
165
      * 用户来源 数据列表
156
      */
166
      */
157
-    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
167
+    List<Map<String,Object>> selectUserSourceData(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
158
 
168
 
159
     // ------------- 用户来源 end ------------
169
     // ------------- 用户来源 end ------------
160
 
170
 

+ 13
- 12
src/main/java/com/huiju/estateagents/service/IStatisticalService.java View File

14
      * 首页统计总数
14
      * 首页统计总数
15
      * @return
15
      * @return
16
      */
16
      */
17
-    ResponseBean indexStatistical();
17
+    ResponseBean indexStatistical(Integer orgId);
18
 
18
 
19
     // ----------------   用户统计 start --------------
19
     // ----------------   用户统计 start --------------
20
     /**
20
     /**
21
      * 用户总数
21
      * 用户总数
22
      * @return
22
      * @return
23
      */
23
      */
24
-    ResponseBean selectUserCount();
24
+    ResponseBean selectUserCount(Integer orgId);
25
 
25
 
26
     /**
26
     /**
27
      * 注册数
27
      * 注册数
28
      * @return
28
      * @return
29
      */
29
      */
30
-    ResponseBean selectRegisteredCount();
30
+    ResponseBean selectRegisteredCount(Integer orgId);
31
 
31
 
32
     /**
32
     /**
33
      * 用户最近七天
33
      * 用户最近七天
34
      * @return
34
      * @return
35
      */
35
      */
36
-    ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate);
36
+    ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate);
37
 
37
 
38
     // ----------------   用户统计 end --------------
38
     // ----------------   用户统计 end --------------
39
 
39
 
41
      * 性别比例
41
      * 性别比例
42
      * @return
42
      * @return
43
      */
43
      */
44
-    ResponseBean selectSexUser();
44
+    ResponseBean selectSexUser(Integer orgId);
45
 
45
 
46
     /**
46
     /**
47
      * 城市比例
47
      * 城市比例
48
      * @return
48
      * @return
49
      */
49
      */
50
-    ResponseBean selectCityUser();
50
+    ResponseBean selectCityUser(Integer orgId);
51
 
51
 
52
     /**
52
     /**
53
      * 活跃用户数
53
      * 活跃用户数
54
      * @return
54
      * @return
55
      */
55
      */
56
-    ResponseBean selectActiveUserCount(String dateType, LocalDate startDate, LocalDate endDate);
56
+    ResponseBean selectActiveUserCount(Integer orgId, String dateType, LocalDate startDate, LocalDate endDate);
57
 
57
 
58
     /**
58
     /**
59
      * 新增用户数
59
      * 新增用户数
61
      * @param endDate
61
      * @param endDate
62
      * @return
62
      * @return
63
      */
63
      */
64
-    ResponseBean selectNewsUserCount(LocalDate startDate,LocalDate endDate);
64
+    ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate,LocalDate endDate);
65
 
65
 
66
     /**
66
     /**
67
      * 用户行为
67
      * 用户行为
71
      */
71
      */
72
     ResponseBean selectUserBehavior(Integer pageNum,
72
     ResponseBean selectUserBehavior(Integer pageNum,
73
                                     Integer pageSize,
73
                                     Integer pageSize,
74
+                                    Integer orgId,
74
                                     LocalDate startDate,
75
                                     LocalDate startDate,
75
                                     LocalDate endDate,
76
                                     LocalDate endDate,
76
                                     String buildingId,
77
                                     String buildingId,
84
      * @param personId
85
      * @param personId
85
      * @return
86
      * @return
86
      */
87
      */
87
-    ResponseBean selectEventAll(String event, String personId);
88
+    ResponseBean selectEventAll(Integer orgId, String event, String personId);
88
 
89
 
89
     /**
90
     /**
90
      * 转换率 统计
91
      * 转换率 统计
91
      * @param conversion
92
      * @param conversion
92
      * @return
93
      * @return
93
      */
94
      */
94
-    ResponseBean selectConversion(String conversion);
95
+    ResponseBean selectConversion(Integer orgId, String conversion);
95
 
96
 
96
     /**
97
     /**
97
      * 用户来源 首页
98
      * 用户来源 首页
98
      * @return
99
      * @return
99
      */
100
      */
100
-    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate);
101
+    ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate);
101
 
102
 
102
     /**
103
     /**
103
      * 意向用户 首页
104
      * 意向用户 首页
104
      * @param buildingId
105
      * @param buildingId
105
      * @return
106
      * @return
106
      */
107
      */
107
-    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId);
108
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId);
108
 }
109
 }

+ 51
- 50
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java View File

46
 
46
 
47
 
47
 
48
     @Override
48
     @Override
49
-    public ResponseBean indexStatistical() {
49
+    public ResponseBean indexStatistical(Integer orgId) {
50
 
50
 
51
         ResponseBean responseBean = new ResponseBean();
51
         ResponseBean responseBean = new ResponseBean();
52
         Map<String,Object> map = new HashMap<>();
52
         Map<String,Object> map = new HashMap<>();
53
 
53
 
54
         // 总用户数
54
         // 总用户数
55
-        Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
55
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
56
 
56
 
57
         // 注册数
57
         // 注册数
58
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
58
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
59
 
59
 
60
         // 最近七天
60
         // 最近七天
61
-        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
61
+        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
62
 
62
 
63
         // 用户行为
63
         // 用户行为
64
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null, null, null, null, null);
64
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null, null, null, null, null);
65
 
65
 
66
         // 用户活跃数
66
         // 用户活跃数
67
-        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
67
+        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
68
 
68
 
69
         // 新增用户数
69
         // 新增用户数
70
-        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
70
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
71
 
71
 
72
         // 性别比例
72
         // 性别比例
73
         // 1 男 2 女
73
         // 1 男 2 女
74
-        Integer selectSexMale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
75
-        Integer selectSexFemale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
74
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
75
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
76
         Map<String, Object> selectSexMaleMap = new HashMap<>();
76
         Map<String, Object> selectSexMaleMap = new HashMap<>();
77
         selectSexMaleMap.put("name", "男");
77
         selectSexMaleMap.put("name", "男");
78
         selectSexMaleMap.put("value", selectSexMale);
78
         selectSexMaleMap.put("value", selectSexMale);
84
         selectSexUser.add(selectSexFemaleMap);
84
         selectSexUser.add(selectSexFemaleMap);
85
 
85
 
86
         // 城市比例
86
         // 城市比例
87
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
87
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
88
 
88
 
89
         // 转化率, 当前 默认项目收藏
89
         // 转化率, 当前 默认项目收藏
90
-        Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical("save");
90
+        Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical(orgId, "save");
91
 
91
 
92
         // -------  用户来源 start ------------
92
         // -------  用户来源 start ------------
93
 
93
 
94
         // 用户来源 柱状
94
         // 用户来源 柱状
95
-        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
95
+        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
96
 
96
 
97
         // 用户来源 饼状
97
         // 用户来源 饼状
98
         // 来源置业顾问, 来源全民经纪人,自由进入
98
         // 来源置业顾问, 来源全民经纪人,自由进入
99
-        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
100
-        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
101
-        Integer person_null = taPersonMapper.selectUserSourcePie(null, CommConstant.PERSON_REALTY_CONSULTANT);
99
+        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
100
+        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
101
+        Integer person_null = taPersonMapper.selectUserSourcePie(orgId, null, CommConstant.PERSON_REALTY_CONSULTANT);
102
         Map<String, Object> pieMap = new HashMap<>();
102
         Map<String, Object> pieMap = new HashMap<>();
103
         pieMap.put("person_realty_consultant", person_realty_consultant);
103
         pieMap.put("person_realty_consultant", person_realty_consultant);
104
         pieMap.put("person_estate_agent", person_estate_agent);
104
         pieMap.put("person_estate_agent", person_estate_agent);
127
     }
127
     }
128
 
128
 
129
     @Override
129
     @Override
130
-    public ResponseBean selectActiveUserCount(String dateType, LocalDate startDate, LocalDate endDate) {
130
+    public ResponseBean selectActiveUserCount(Integer orgId, String dateType, LocalDate startDate, LocalDate endDate) {
131
         ResponseBean responseBean = new ResponseBean();
131
         ResponseBean responseBean = new ResponseBean();
132
 
132
 
133
         String type = null;
133
         String type = null;
142
         }
142
         }
143
 
143
 
144
         // 用户活跃数
144
         // 用户活跃数
145
-        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, type, null, null);
145
+        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, type, null, null);
146
         Map<String, Object> map = new HashMap<>();
146
         Map<String, Object> map = new HashMap<>();
147
         map.put("selectActiveUserCount", selectActiveUserCount);
147
         map.put("selectActiveUserCount", selectActiveUserCount);
148
         responseBean.addSuccess(map);
148
         responseBean.addSuccess(map);
150
     }
150
     }
151
 
151
 
152
     @Override
152
     @Override
153
-    public ResponseBean selectNewsUserCount(LocalDate startDate, LocalDate endDate) {
153
+    public ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
154
         ResponseBean responseBean = new ResponseBean();
154
         ResponseBean responseBean = new ResponseBean();
155
 
155
 
156
         // 新增用户数
156
         // 新增用户数
157
-        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
157
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
158
 
158
 
159
         Map<String, Object> map = new HashMap<>();
159
         Map<String, Object> map = new HashMap<>();
160
         map.put("selectNewsUserCount", selectNewsUserCount);
160
         map.put("selectNewsUserCount", selectNewsUserCount);
165
     @Override
165
     @Override
166
     public ResponseBean selectUserBehavior(Integer pageNum,
166
     public ResponseBean selectUserBehavior(Integer pageNum,
167
                                            Integer pageSize,
167
                                            Integer pageSize,
168
+                                           Integer orgId,
168
                                            LocalDate startDate,
169
                                            LocalDate startDate,
169
                                            LocalDate endDate,
170
                                            LocalDate endDate,
170
                                            String buildingId,
171
                                            String buildingId,
174
         ResponseBean responseBean = new ResponseBean();
175
         ResponseBean responseBean = new ResponseBean();
175
 
176
 
176
         // 用户行为
177
         // 用户行为
177
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
178
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
178
 
179
 
179
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180
         IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
181
         IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
187
     }
188
     }
188
 
189
 
189
     @Override
190
     @Override
190
-    public ResponseBean selectEventAll(String event, String personId) {
191
+    public ResponseBean selectEventAll(Integer orgId, String event, String personId) {
191
         ResponseBean responseBean = new ResponseBean();
192
         ResponseBean responseBean = new ResponseBean();
192
 
193
 
193
         List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
194
         List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
196
     }
197
     }
197
 
198
 
198
     @Override
199
     @Override
199
-    public ResponseBean selectConversion(String conversion) {
200
+    public ResponseBean selectConversion(Integer orgId, String conversion) {
200
         ResponseBean responseBean = new ResponseBean();
201
         ResponseBean responseBean = new ResponseBean();
201
         Map<String, Object> result = new HashMap<>();
202
         Map<String, Object> result = new HashMap<>();
202
 
203
 
203
         switch (conversion) {
204
         switch (conversion) {
204
             case CommConstant.BUILDING_SAVE:
205
             case CommConstant.BUILDING_SAVE:
205
-                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical("save");
206
+                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical(orgId, "save");
206
                 result.put("data_count", selectBuildingStatisticalSave);
207
                 result.put("data_count", selectBuildingStatisticalSave);
207
                 break;
208
                 break;
208
             case CommConstant.BUILDING_SHARE:
209
             case CommConstant.BUILDING_SHARE:
209
-                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical("share");
210
+                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical(orgId,"share");
210
                 result.put("data_count", selectBuildingStatisticalShare);
211
                 result.put("data_count", selectBuildingStatisticalShare);
211
                 break;
212
                 break;
212
             case CommConstant.ACTIVITY_SAVE:
213
             case CommConstant.ACTIVITY_SAVE:
213
-                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical("save");
214
+                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "save");
214
                 result.put("data_count", selectBuildingDynamicStatisticalSave);
215
                 result.put("data_count", selectBuildingDynamicStatisticalSave);
215
                 break;
216
                 break;
216
             case CommConstant.ACTIVITY_SHARE:
217
             case CommConstant.ACTIVITY_SHARE:
217
-                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical("share");
218
+                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "share");
218
                 result.put("data_count", selectBuildingDynamicStatisticalShare);
219
                 result.put("data_count", selectBuildingDynamicStatisticalShare);
219
                 break;
220
                 break;
220
             case CommConstant.NEWS_SAVE:
221
             case CommConstant.NEWS_SAVE:
221
-                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical("save");
222
+                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical(orgId, "save");
222
                 result.put("data_count", selectNewsStatisticalSave);
223
                 result.put("data_count", selectNewsStatisticalSave);
223
                 break;
224
                 break;
224
 
225
 
225
             case CommConstant.NEWS_SHARE:
226
             case CommConstant.NEWS_SHARE:
226
-                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical("share");
227
+                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical(orgId, "share");
227
                 result.put("data_count", selectNewsStatisticalShare);
228
                 result.put("data_count", selectNewsStatisticalShare);
228
                 break;
229
                 break;
229
 
230
 
230
             case CommConstant.ACTIVITY_SIGN:
231
             case CommConstant.ACTIVITY_SIGN:
231
-                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical();
232
+                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical(orgId);
232
                 result.put("data_count", selectBuildingDynamicEnlistStatistical);
233
                 result.put("data_count", selectBuildingDynamicEnlistStatistical);
233
                 break;
234
                 break;
234
 
235
 
235
             case CommConstant.AUTHORIZATION_PHONE:
236
             case CommConstant.AUTHORIZATION_PHONE:
236
                 // 总用户数
237
                 // 总用户数
237
-                Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
238
+                Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
238
 
239
 
239
                 // 注册数
240
                 // 注册数
240
-                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
241
+                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
241
                 Map<String, Object> userMap = new HashMap<>();
242
                 Map<String, Object> userMap = new HashMap<>();
242
                 userMap.put("pvNum", selectUserCount);
243
                 userMap.put("pvNum", selectUserCount);
243
                 userMap.put("registeredCount", selectRegisteredCount);
244
                 userMap.put("registeredCount", selectRegisteredCount);
251
 
252
 
252
 
253
 
253
     @Override
254
     @Override
254
-    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate) {
255
+    public ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate) {
255
         ResponseBean responseBean = new ResponseBean();
256
         ResponseBean responseBean = new ResponseBean();
256
         // 用户来源 柱状
257
         // 用户来源 柱状
257
-        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
258
+        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
258
 
259
 
259
         // 用户来源饼状
260
         // 用户来源饼状
260
         // 来源置业顾问, 来源全民经纪人,自由进入
261
         // 来源置业顾问, 来源全民经纪人,自由进入
261
-        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
262
-        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
263
-        Integer person_null = taPersonMapper.selectUserSourcePie(null, CommConstant.PERSON_REALTY_CONSULTANT);
262
+        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
263
+        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
264
+        Integer person_null = taPersonMapper.selectUserSourcePie(orgId, null, CommConstant.PERSON_REALTY_CONSULTANT);
264
         Map<String, Object> map = new HashMap<>();
265
         Map<String, Object> map = new HashMap<>();
265
         map.put("person_realty_consultant", person_realty_consultant);
266
         map.put("person_realty_consultant", person_realty_consultant);
266
         map.put("person_estate_agent", person_estate_agent);
267
         map.put("person_estate_agent", person_estate_agent);
267
         map.put("person_null", person_null);
268
         map.put("person_null", person_null);
268
 
269
 
269
         // 用户来源 数据列表
270
         // 用户来源 数据列表
270
-        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
271
+        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(orgId, CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
271
 
272
 
272
         Map<String, Object> result = new HashMap<>();
273
         Map<String, Object> result = new HashMap<>();
273
         result.put("columnar", mapList);
274
         result.put("columnar", mapList);
280
 
281
 
281
 
282
 
282
     @Override
283
     @Override
283
-    public ResponseBean selectUserCount() {
284
+    public ResponseBean selectUserCount(Integer orgId) {
284
         ResponseBean responseBean = new ResponseBean();
285
         ResponseBean responseBean = new ResponseBean();
285
         // 总用户数
286
         // 总用户数
286
-        Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
287
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
287
         Map<String, Object> map = new HashMap<>();
288
         Map<String, Object> map = new HashMap<>();
288
         map.put("selectUserCount", selectUserCount);
289
         map.put("selectUserCount", selectUserCount);
289
         responseBean.addSuccess(map);
290
         responseBean.addSuccess(map);
291
     }
292
     }
292
 
293
 
293
     @Override
294
     @Override
294
-    public ResponseBean selectRegisteredCount() {
295
+    public ResponseBean selectRegisteredCount(Integer orgId) {
295
         ResponseBean responseBean = new ResponseBean();
296
         ResponseBean responseBean = new ResponseBean();
296
         // 注册数
297
         // 注册数
297
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
298
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
298
         Map<String, Object> map = new HashMap<>();
299
         Map<String, Object> map = new HashMap<>();
299
         map.put("selectRegisteredCount", selectRegisteredCount);
300
         map.put("selectRegisteredCount", selectRegisteredCount);
300
         responseBean.addSuccess(map);
301
         responseBean.addSuccess(map);
302
     }
303
     }
303
 
304
 
304
     @Override
305
     @Override
305
-    public ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate) {
306
+    public ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
306
         ResponseBean responseBean = new ResponseBean();
307
         ResponseBean responseBean = new ResponseBean();
307
         // 最近七天
308
         // 最近七天
308
-        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
309
+        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
309
         Map<String, Object> map = new HashMap<>();
310
         Map<String, Object> map = new HashMap<>();
310
         map.put("selectRecentlyCount", selectRecentlyCount);
311
         map.put("selectRecentlyCount", selectRecentlyCount);
311
         responseBean.addSuccess(map);
312
         responseBean.addSuccess(map);
313
     }
314
     }
314
 
315
 
315
     @Override
316
     @Override
316
-    public ResponseBean selectSexUser() {
317
+    public ResponseBean selectSexUser(Integer orgId) {
317
         ResponseBean responseBean = new ResponseBean();
318
         ResponseBean responseBean = new ResponseBean();
318
 
319
 
319
         // 性别比例
320
         // 性别比例
320
         // 1 男 2 女
321
         // 1 男 2 女
321
-        Integer selectSexMale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
322
-        Integer selectSexFemale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
322
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
323
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
323
         Map<String, Object> selectSexMaleMap = new HashMap<>();
324
         Map<String, Object> selectSexMaleMap = new HashMap<>();
324
         selectSexMaleMap.put("name", "男");
325
         selectSexMaleMap.put("name", "男");
325
         selectSexMaleMap.put("value", selectSexMale);
326
         selectSexMaleMap.put("value", selectSexMale);
337
     }
338
     }
338
 
339
 
339
     @Override
340
     @Override
340
-    public ResponseBean selectCityUser() {
341
+    public ResponseBean selectCityUser(Integer orgId) {
341
         ResponseBean responseBean = new ResponseBean();
342
         ResponseBean responseBean = new ResponseBean();
342
 
343
 
343
         // 城市比例
344
         // 城市比例
344
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
345
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
345
         Map<String, Object> map = new HashMap<>();
346
         Map<String, Object> map = new HashMap<>();
346
         map.put("selectCityUser", selectCityUser);
347
         map.put("selectCityUser", selectCityUser);
347
         responseBean.addSuccess(map);
348
         responseBean.addSuccess(map);
349
     }
350
     }
350
 
351
 
351
     @Override
352
     @Override
352
-    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId) {
353
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId) {
353
         ResponseBean responseBean = new ResponseBean();
354
         ResponseBean responseBean = new ResponseBean();
354
 
355
 
355
         IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
356
         IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
356
-        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, buildingId);
357
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId);
357
 
358
 
358
         responseBean.addSuccess(page);
359
         responseBean.addSuccess(page);
359
         return responseBean;
360
         return responseBean;

+ 2
- 0
src/main/resources/mapper/TaBuildingDynamicMapper.xml View File

108
                 sum(share_num) as shareNum
108
                 sum(share_num) as shareNum
109
             </if>
109
             </if>
110
             from ta_building_dynamic
110
             from ta_building_dynamic
111
+        where org_id = #{orgId}
111
     </select>
112
     </select>
112
 
113
 
113
     <select id="selectBuildingDynamicEnlistStatistical" resultType="map">
114
     <select id="selectBuildingDynamicEnlistStatistical" resultType="map">
115
         sum(pv_num) as pvNum,
116
         sum(pv_num) as pvNum,
116
         IFNULL(sum(enlist_num),0) as enlistNum
117
         IFNULL(sum(enlist_num),0) as enlistNum
117
         from ta_building_dynamic
118
         from ta_building_dynamic
119
+        where org_id = #{orgId}
118
     </select>
120
     </select>
119
 
121
 
120
 </mapper>
122
 </mapper>

+ 1
- 0
src/main/resources/mapper/TaBuildingMapper.xml View File

82
               IFNULL(sum(share_num),0) as shareNum
82
               IFNULL(sum(share_num),0) as shareNum
83
           </if>
83
           </if>
84
         from ta_building
84
         from ta_building
85
+        where org_id = ${orgId}
85
     </select>
86
     </select>
86
 
87
 
87
     <select id="selectBuildingPage" resultType="com.huiju.estateagents.entity.TaBuilding">
88
     <select id="selectBuildingPage" resultType="com.huiju.estateagents.entity.TaBuilding">

+ 1
- 0
src/main/resources/mapper/TaNewsMapper.xml View File

13
             sum(share_num) as shareNum
13
             sum(share_num) as shareNum
14
         </if>
14
         </if>
15
         from ta_news
15
         from ta_news
16
+        where org_id = #{orgId}
16
     </select>
17
     </select>
17
 
18
 
18
 </mapper>
19
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml View File

22
             SUM(tpir.intention) as intention
22
             SUM(tpir.intention) as intention
23
         FROM
23
         FROM
24
             ta_person_intention_record tpir
24
             ta_person_intention_record tpir
25
-            LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
25
+            LEFT JOIN ta_person tp on tpir.person_id = tp.person_id AND tp.org_id = #{orgId}
26
             <where>
26
             <where>
27
                 <if test="buildingId != null and buildingId != ''">
27
                 <if test="buildingId != null and buildingId != ''">
28
                     tpir.building_id = #{buildingId}
28
                     tpir.building_id = #{buildingId}

+ 12
- 6
src/main/resources/mapper/TaPersonMapper.xml View File

150
             COUNT(1) as activity_count
150
             COUNT(1) as activity_count
151
         FROM
151
         FROM
152
         ta_person tp
152
         ta_person tp
153
-        where ifnull(tp.person_type, '') != #{personType}
153
+        where tp.org_id = #{org} AND
154
+          ifnull(tp.person_type, '') != #{personType}
154
 
155
 
155
         <if test="startDate != null or endDate != null">
156
         <if test="startDate != null or endDate != null">
156
             AND  tp.create_date BETWEEN #{startDate} and #{endDate}
157
             AND  tp.create_date BETWEEN #{startDate} and #{endDate}
189
             FROM
190
             FROM
190
               ta_person tp
191
               ta_person tp
191
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
192
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
192
-            where ifnull(tp.person_type, '') != #{personType}
193
+            where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
193
             <if test="buildingId != null and buildingId != ''">
194
             <if test="buildingId != null and buildingId != ''">
194
                 and tpvr.building_id = #{buildingId}
195
                 and tpvr.building_id = #{buildingId}
195
             </if>
196
             </if>
247
              LEFT JOIN
248
              LEFT JOIN
248
             ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
249
             ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
249
             ON tp.person_id = tpvr.person_id
250
             ON tp.person_id = tpvr.person_id
250
-             where ifnull(tp.person_type, '') != #{personType}
251
+             where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
251
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
252
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
252
         ) AS temp ON
253
         ) AS temp ON
253
         <if test="dateType == 'month'.toString()">
254
         <if test="dateType == 'month'.toString()">
328
                     tp.create_date as create_date
329
                     tp.create_date as create_date
329
                 FROM
330
                 FROM
330
                  ta_person tp
331
                  ta_person tp
331
-                where ifnull(tp.person_type, '') != #{personType}
332
+                where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
332
                 <if test="startDate != null or endDate != null">
333
                 <if test="startDate != null or endDate != null">
333
                     AND tp.create_date BETWEEN #{startDate} and #{endDate}
334
                     AND tp.create_date BETWEEN #{startDate} and #{endDate}
334
                 </if>
335
                 </if>
348
     <select id="selectUserSourcePie" resultType="integer">
349
     <select id="selectUserSourcePie" resultType="integer">
349
         select count(1)
350
         select count(1)
350
         FROM ta_person
351
         FROM ta_person
351
-        WHERE ifnull(person_type, '') != #{personType}
352
+        WHERE org_id = #{org} AND
353
+          ifnull(person_type, '') != #{personType}
352
         <if test="recommendPersonType != null and recommendPersonType != ''">
354
         <if test="recommendPersonType != null and recommendPersonType != ''">
353
             and recommend_person_type = #{recommendPersonType}
355
             and recommend_person_type = #{recommendPersonType}
354
         </if>
356
         </if>
364
             LEFT JOIN td_person_from tpfs
366
             LEFT JOIN td_person_from tpfs
365
             ON tps.from_code = tpfs.from_code
367
             ON tps.from_code = tpfs.from_code
366
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
368
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
369
+            AND tps.org_id = #{org}
367
             and ifnull(tps.person_type, '') != #{personType}
370
             and ifnull(tps.person_type, '') != #{personType}
368
             <if test="startDate != null or endDate != null">
371
             <if test="startDate != null or endDate != null">
369
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
372
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
379
             LEFT JOIN td_person_from tpfs
382
             LEFT JOIN td_person_from tpfs
380
             ON tps.from_code = tpfs.from_code
383
             ON tps.from_code = tpfs.from_code
381
             WHERE tpfs.from_code = tpf.from_code
384
             WHERE tpfs.from_code = tpf.from_code
385
+            AND tps.org_id = #{org}
382
             and ifnull(tps.person_type, '') != #{personType}
386
             and ifnull(tps.person_type, '') != #{personType}
383
             <if test="startDate != null or endDate != null">
387
             <if test="startDate != null or endDate != null">
384
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
388
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
391
         FROM td_person_from tpf
395
         FROM td_person_from tpf
392
         LEFT JOIN ta_person tp
396
         LEFT JOIN ta_person tp
393
         ON tp.from_code = tpf.from_code
397
         ON tp.from_code = tpf.from_code
394
-        where ifnull(tp.person_type, '') != #{personType}
398
+        where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
395
         GROUP BY tpf.from_code
399
         GROUP BY tpf.from_code
396
     </select>
400
     </select>
397
 
401
 
434
             LEFT JOIN td_person_from tpfs
438
             LEFT JOIN td_person_from tpfs
435
             ON tps.from_code = tpfs.from_code
439
             ON tps.from_code = tpfs.from_code
436
             WHERE tpfs.from_code = tps.from_code
440
             WHERE tpfs.from_code = tps.from_code
441
+            AND tps.org_id = #{org}
437
             and ifnull(tps.person_type, '') != 'Realty Consultant'
442
             and ifnull(tps.person_type, '') != 'Realty Consultant'
438
             AND tps.create_date BETWEEN #{startDate} AND #{endDate}
443
             AND tps.create_date BETWEEN #{startDate} AND #{endDate}
439
 
444
 
451
             LEFT JOIN td_person_from tpfs
456
             LEFT JOIN td_person_from tpfs
452
             ON tps.from_code = tpfs.from_code
457
             ON tps.from_code = tpfs.from_code
453
             WHERE tpfs.from_code = tps.from_code
458
             WHERE tpfs.from_code = tps.from_code
459
+                AND tps.org_id = #{org}
454
                 and ifnull(tps.person_type, '') != 'Realty Consultant'
460
                 and ifnull(tps.person_type, '') != 'Realty Consultant'
455
                 AND tps.create_date BETWEEN #{startDate} AND #{endDate}
461
                 AND tps.create_date BETWEEN #{startDate} AND #{endDate}
456
                 and tps.phone is not null
462
                 and tps.phone is not null