Преглед на файлове

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

胡轶钦 преди 5 години
родител
ревизия
72de2ad224

+ 2
- 3
src/main/java/com/huiju/estateagents/controller/StatisticalController.java Целия файл

@@ -86,9 +86,8 @@ public class StatisticalController {
86 86
      */
87 87
     @GetMapping(value = "/admin/selectUserResource")
88 88
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
89
-                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
90
-                                           @RequestParam(value = "registeredType", required = false) String registeredType) {
91
-        return iStatisticalService.selectUserResource(startDate, endDate, registeredType);
89
+                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
90
+        return iStatisticalService.selectUserResource(startDate, endDate);
92 91
     }
93 92
 
94 93
 

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Целия файл

@@ -145,7 +145,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
145 145
     /**
146 146
      * 用户来源 数据列表
147 147
      */
148
-    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate, @Param("registeredType") String registeredType);
148
+    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
149 149
 
150 150
     // ------------- 用户来源 end ------------
151 151
 

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java Целия файл

@@ -90,7 +90,7 @@ public interface IStatisticalService {
90 90
      * 用户来源 首页
91 91
      * @return
92 92
      */
93
-    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate, String registeredType);
93
+    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate);
94 94
 
95 95
     /**
96 96
      * 意向用户 首页

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Целия файл

@@ -244,7 +244,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
244 244
 
245 245
 
246 246
     @Override
247
-    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate, String registeredType) {
247
+    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate) {
248 248
         ResponseBean responseBean = new ResponseBean();
249 249
         // 用户来源 柱状
250 250
         List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
@@ -260,7 +260,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
260 260
         map.put("person_null", person_null);
261 261
 
262 262
         // 用户来源 数据列表
263
-        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate, registeredType);
263
+        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
264 264
 
265 265
         Map<String, Object> result = new HashMap<>();
266 266
         result.put("columnar", mapList);

+ 34
- 16
src/main/resources/mapper/TaPersonMapper.xml Целия файл

@@ -366,29 +366,32 @@ FROM
366 366
     </select>
367 367
 
368 368
     <select id="selectUserSourceData" resultType="map">
369
+
369 370
         select
370 371
             temp_date.date AS date,
371 372
             temp_date.from_name as from_name,
372 373
             temp_date.from_code as from_code,
373 374
             IFNULL(user_count.count, 0) as count,
375
+            IFNULL(registered_count.count,0) as registered,
374 376
             user_count.create_date as create_date
375 377
         FROM
376 378
         (
377 379
             SELECT
378
-                DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
379
-                tempf.from_name as from_name,
380
-                tempf.from_code as from_code
380
+            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
381
+            tempf.from_name as from_name,
382
+            tempf.from_code as from_code
381 383
             FROM
382
-                sequence a
383
-                ,
384
-                td_person_from tempf
384
+            sequence a
385
+            ,
386
+            td_person_from tempf
385 387
             WHERE
386
-            <if test="startDate == null or endDate == null">
387
-                a.rownum <![CDATA[ <= ]]> 7
388
-            </if>
389
-            <if test="startDate != null or endDate != null">
390
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
391
-            </if>
388
+
389
+                <if test="startDate == null or endDate == null">
390
+                    a.rownum <![CDATA[ <= ]]> 7
391
+                </if>
392
+                <if test="startDate != null or endDate != null">
393
+                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
394
+                </if>
392 395
 
393 396
         ) AS temp_date
394 397
 
@@ -403,13 +406,28 @@ FROM
403 406
             LEFT JOIN td_person_from tpfs
404 407
             ON tps.from_code = tpfs.from_code
405 408
             WHERE tpfs.from_code = tps.from_code
406
-            and ifnull(tps.person_type, '') != #{personType}
407
-            <if test="registeredType == 'registered' and registeredType != ''">
408
-                and tps.phone is not null
409
-            </if>
409
+            and ifnull(tps.person_type, '') != 'Realty Consultant'
410
+
410 411
             GROUP BY tpfs.from_code
411 412
         ) as user_count
412 413
         ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') =  temp_date.date and temp_date.from_code = user_count.from_code
414
+        LEFT JOIN
415
+        (
416
+            SELECT
417
+                ifnull(COUNT(1), 0) as count,
418
+                tps.create_date as create_date,
419
+                tpfs.from_code as from_code,
420
+                tpfs.from_name as from_name
421
+            FROM ta_person tps
422
+            LEFT JOIN td_person_from tpfs
423
+            ON tps.from_code = tpfs.from_code
424
+            WHERE tpfs.from_code = tps.from_code
425
+                and ifnull(tps.person_type, '') != 'Realty Consultant'
426
+                and tps.phone is not null
427
+            GROUP BY tpfs.from_code
428
+        ) as registered_count
429
+        ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') =  temp_date.date and temp_date.from_code = registered_count.from_code
430
+        order by temp_date.date DESC
413 431
     </select>
414 432
 
415 433
 </mapper>