魏熙美 5 年前
父节点
当前提交
de15cf9b5d

+ 8
- 11
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java 查看文件

@@ -52,21 +52,19 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
52 52
 
53 53
     /**
54 54
      * 总用户数
55
-     * @param personType
56 55
      * @return
57 56
      */
58 57
     @ResultType(Integer.class)
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);
58
+    @Select("select count(1) from ta_person where org_id = #{org} AND person_type IN ('customer','drift','estate agent')")
59
+    Integer selectUserCount(@Param("org") Integer orgId);
61 60
 
62 61
     /**
63 62
      * 总注册数
64
-     * @param personType
65 63
      * @return
66 64
      */
67 65
     @ResultType(Integer.class)
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);
66
+    @Select("select count(1) from ta_person where org_id = #{org} AND person_type IN ('customer','drift','estate agent') and phone is not null")
67
+    Integer selectRegisteredCount(@Param("org") Integer orgId);
70 68
 
71 69
     /**
72 70
      * 根据时间段查询
@@ -115,11 +113,10 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
115 113
      *
116 114
      *  据说 1 男  2 女
117 115
      *
118
-     * @param personType
119 116
      * @return
120 117
      */
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);
118
+    @Select("select count(1) as sex_count from ta_person where org_id = #{org} AND person_type IN ('customer','drift','estate agent')  and gender = #{gender}")
119
+    Integer selectSexUser(@Param("org") Integer orgId, @Param("gender") Integer gender);
123 120
 
124 121
 
125 122
     /**
@@ -140,10 +137,10 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
140 137
             "on a.city = b.id " +
141 138
             "WHERE " +
142 139
             "   a.org_id = #{org} " +
143
-            "	AND ifnull(a.person_type, '') != #{personType} " +
140
+            "	AND a.person_type IN ('customer','drift','estate agent')  " +
144 141
             "GROUP BY " +
145 142
             "	a.city ")
146
-    List<Map<String, Object>> selectCityUser(@Param("org") Integer orgId, @Param("personType") String personType);
143
+    List<Map<String, Object>> selectCityUser(@Param("org") Integer orgId);
147 144
 
148 145
 
149 146
     // ------------- 用户来源 start ------------

+ 12
- 12
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java 查看文件

@@ -52,10 +52,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
52 52
         Map<String,Object> map = new HashMap<>();
53 53
 
54 54
         // 总用户数
55
-        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
55
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId);
56 56
 
57 57
         // 注册数
58
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
58
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId);
59 59
 
60 60
         // 最近七天
61 61
         Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
@@ -71,8 +71,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
71 71
 
72 72
         // 性别比例
73 73
         // 1 男 2 女
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);
74
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.SEX_MALE);
75
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.SEX_FEMALE);
76 76
         Map<String, Object> selectSexMaleMap = new HashMap<>();
77 77
         selectSexMaleMap.put("name", "男");
78 78
         selectSexMaleMap.put("value", selectSexMale);
@@ -84,7 +84,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
84 84
         selectSexUser.add(selectSexFemaleMap);
85 85
 
86 86
         // 城市比例
87
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
87
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId);
88 88
 
89 89
         // 转化率, 当前 默认项目收藏
90 90
         Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical(orgId, "save");
@@ -235,10 +235,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
235 235
 
236 236
             case CommConstant.AUTHORIZATION_PHONE:
237 237
                 // 总用户数
238
-                Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
238
+                Integer selectUserCount = taPersonMapper.selectUserCount(orgId);
239 239
 
240 240
                 // 注册数
241
-                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
241
+                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId);
242 242
                 Map<String, Object> userMap = new HashMap<>();
243 243
                 userMap.put("pvNum", selectUserCount);
244 244
                 userMap.put("registeredCount", selectRegisteredCount);
@@ -284,7 +284,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
284 284
     public ResponseBean selectUserCount(Integer orgId) {
285 285
         ResponseBean responseBean = new ResponseBean();
286 286
         // 总用户数
287
-        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
287
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId);
288 288
         Map<String, Object> map = new HashMap<>();
289 289
         map.put("selectUserCount", selectUserCount);
290 290
         responseBean.addSuccess(map);
@@ -295,7 +295,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
295 295
     public ResponseBean selectRegisteredCount(Integer orgId) {
296 296
         ResponseBean responseBean = new ResponseBean();
297 297
         // 注册数
298
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
298
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId);
299 299
         Map<String, Object> map = new HashMap<>();
300 300
         map.put("selectRegisteredCount", selectRegisteredCount);
301 301
         responseBean.addSuccess(map);
@@ -319,8 +319,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
319 319
 
320 320
         // 性别比例
321 321
         // 1 男 2 女
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);
322
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.SEX_MALE);
323
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.SEX_FEMALE);
324 324
         Map<String, Object> selectSexMaleMap = new HashMap<>();
325 325
         selectSexMaleMap.put("name", "男");
326 326
         selectSexMaleMap.put("value", selectSexMale);
@@ -342,7 +342,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
342 342
         ResponseBean responseBean = new ResponseBean();
343 343
 
344 344
         // 城市比例
345
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
345
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId);
346 346
         Map<String, Object> map = new HashMap<>();
347 347
         map.put("selectCityUser", selectCityUser);
348 348
         responseBean.addSuccess(map);

+ 11
- 12
src/main/resources/mapper/TaPersonMapper.xml 查看文件

@@ -157,7 +157,7 @@ FROM
157 157
         FROM
158 158
         ta_person tp
159 159
         where tp.org_id = #{org} AND
160
-          ifnull(tp.person_type, '') != #{personType}
160
+        tp.person_type IN ('customer','drift','estate agent')
161 161
 
162 162
         <if test="startDate != null or endDate != null">
163 163
             AND  tp.create_date BETWEEN #{startDate} and #{endDate}
@@ -196,7 +196,7 @@ FROM
196 196
             FROM
197 197
               ta_person tp
198 198
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
199
-            where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
199
+            where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
200 200
             <if test="buildingId != null and buildingId != ''">
201 201
                 and tpvr.building_id = #{buildingId}
202 202
             </if>
@@ -254,7 +254,7 @@ FROM
254 254
              LEFT JOIN
255 255
             ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
256 256
             ON tp.person_id = tpvr.person_id
257
-             where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
257
+             where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
258 258
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
259 259
         ) AS temp ON
260 260
         <if test="dateType == 'month'.toString()">
@@ -297,7 +297,7 @@ FROM
297 297
                         tp.create_date as create_date
298 298
                     FROM
299 299
                       ta_person tp
300
-                    where ifnull(tp.person_type, '') != #{personType} and tp.org_id = #{orgId}
300
+                    where tp.person_type IN ('customer','drift','estate agent') and tp.org_id = #{orgId}
301 301
                     and tp.phone is NOT NULL
302 302
                     <if test="startDate != null or endDate != null">
303 303
                         AND tp.create_date BETWEEN #{startDate} and #{endDate}
@@ -335,7 +335,7 @@ FROM
335 335
                     tp.create_date as create_date
336 336
                 FROM
337 337
                  ta_person tp
338
-                where ifnull(tp.person_type, '') != #{personType} and tp.org_id = #{orgId}
338
+                where tp.person_type IN ('customer','drift','estate agent') and tp.org_id = #{orgId}
339 339
                 <if test="startDate != null or endDate != null">
340 340
                     AND tp.create_date BETWEEN #{startDate} and #{endDate}
341 341
                 </if>
@@ -355,8 +355,7 @@ FROM
355 355
     <select id="selectUserSourcePie" resultType="integer">
356 356
         select count(1)
357 357
         FROM ta_person
358
-        WHERE org_id = #{org} AND
359
-          ifnull(person_type, '') != #{personType}
358
+        WHERE org_id = #{org} AND person_type IN ('customer','drift','estate agent')
360 359
         <if test="recommendPersonType != null and recommendPersonType != ''">
361 360
             and recommend_person_type = #{recommendPersonType}
362 361
         </if>
@@ -373,7 +372,7 @@ FROM
373 372
             ON tps.from_code = tpfs.from_code
374 373
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
375 374
             AND tps.org_id = #{org}
376
-            and ifnull(tps.person_type, '') != #{personType}
375
+            and tps.person_type IN ('customer','drift','estate agent')
377 376
             <if test="startDate != null or endDate != null">
378 377
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
379 378
             </if>
@@ -389,7 +388,7 @@ FROM
389 388
             ON tps.from_code = tpfs.from_code
390 389
             WHERE tpfs.from_code = tpf.from_code
391 390
             AND tps.org_id = #{org}
392
-            and ifnull(tps.person_type, '') != #{personType}
391
+            and tps.person_type IN ('customer','drift','estate agent')
393 392
             <if test="startDate != null or endDate != null">
394 393
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
395 394
             </if>
@@ -401,7 +400,7 @@ FROM
401 400
         FROM td_person_from tpf
402 401
         LEFT JOIN ta_person tp
403 402
         ON tp.from_code = tpf.from_code
404
-        where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
403
+        where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
405 404
         GROUP BY tpf.from_code
406 405
     </select>
407 406
 
@@ -445,7 +444,7 @@ FROM
445 444
             ON tps.from_code = tpfs.from_code
446 445
             WHERE tpfs.from_code = tps.from_code
447 446
             AND tps.org_id = #{org}
448
-            and ifnull(tps.person_type, '') != 'Realty Consultant'
447
+            and tps.person_type IN ('customer','drift','estate agent')
449 448
             AND tps.create_date BETWEEN #{startDate} AND #{endDate}
450 449
 
451 450
             GROUP BY tpfs.from_code
@@ -463,7 +462,7 @@ FROM
463 462
             ON tps.from_code = tpfs.from_code
464 463
             WHERE tpfs.from_code = tps.from_code
465 464
                 AND tps.org_id = #{org}
466
-                and ifnull(tps.person_type, '') != 'Realty Consultant'
465
+                and tps.person_type IN ('customer','drift','estate agent')
467 466
                 AND tps.create_date BETWEEN #{startDate} AND #{endDate}
468 467
                 and tps.phone is not null
469 468
             GROUP BY tpfs.from_code