浏览代码

新需求

傅行帆 5 年前
父节点
当前提交
fc6317693e

+ 15
- 0
src/main/java/com/huiju/estateagents/controller/StatisticalController.java 查看文件

@@ -195,4 +195,19 @@ public class StatisticalController extends BaseController {
195 195
                                            HttpServletRequest request) {
196 196
         return iStatisticalService.getStatsBarList(getOrgId(request), startDate, endDate, getTaPersonBuildingListByUserId(request));
197 197
     }
198
+
199
+
200
+    /**
201
+     * 项目排行统计图
202
+     * @return
203
+     */
204
+    @GetMapping(value = "/admin/stats/tableList")
205
+    public ResponseBean selectBuildingTableList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
206
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
207
+                                                @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
208
+                                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
209
+                                                @RequestParam(value = "buildingId", required = false) String buildingId,
210
+                                                HttpServletRequest request) {
211
+        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
212
+    }
198 213
 }

+ 37
- 0
src/main/java/com/huiju/estateagents/excel/StatsBuilding.java 查看文件

@@ -0,0 +1,37 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class StatsBuilding {
7
+
8
+    /**
9
+     * 项目名称
10
+     */
11
+    private String buildingName;
12
+
13
+    /**
14
+     * 观看次数
15
+     */
16
+    private Integer pvNum;
17
+
18
+    /**
19
+     * 观看人数
20
+     */
21
+    private Integer uvNum;
22
+
23
+    /**
24
+     * 私客
25
+     */
26
+    private Integer skNum;
27
+
28
+    /**
29
+     * 公客
30
+     */
31
+    private Integer gkNum;
32
+
33
+    /**
34
+     * 新增客户 公客加私客
35
+     */
36
+    private Integer khNum;
37
+}

+ 14
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

@@ -1,9 +1,10 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.huiju.estateagents.entity.TaBuilding;
5
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.huiju.estateagents.entity.TaPersonBuilding;
7
+import com.huiju.estateagents.excel.StatsBuilding;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
9 10
 import org.apache.ibatis.annotations.Update;
@@ -134,4 +135,16 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
134 135
      * @return
135 136
      */
136 137
     List<Map<String, Object>> getFwBarData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
138
+
139
+    /**
140
+     * 获取项目统计列表数据
141
+     * @param orgId
142
+     * @param startDate
143
+     * @param endDate
144
+     * @param buildingId
145
+     * @param personBuildingList
146
+     * @return
147
+     */
148
+    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
149
+
137 150
 }

+ 11
- 0
src/main/java/com/huiju/estateagents/service/IStatisticalService.java 查看文件

@@ -135,4 +135,15 @@ public interface IStatisticalService {
135 135
      * @return
136 136
      */
137 137
     ResponseBean getStatsBarList(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> taPersonBuildingListByUserId);
138
+
139
+    /**
140
+     * 获取楼盘统计所有数据
141
+     * @param orgId
142
+     * @param startDate
143
+     * @param endDate
144
+     * @param buildingId
145
+     * @param taPersonBuildingListByUserId
146
+     * @return
147
+     */
148
+    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
138 149
 }

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

@@ -8,6 +8,7 @@ import com.huiju.estateagents.common.CommConstant;
8 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
9 9
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
10 10
 import com.huiju.estateagents.entity.TdWxDict;
11
+import com.huiju.estateagents.excel.StatsBuilding;
11 12
 import com.huiju.estateagents.mapper.*;
12 13
 import com.huiju.estateagents.po.PersonPO;
13 14
 import com.huiju.estateagents.service.IStatisticalService;
@@ -435,6 +436,23 @@ public class StatisticalServiceImpl implements IStatisticalService {
435 436
         return ResponseBean.success(map);
436 437
     }
437 438
 
439
+    /**
440
+     * 获取楼盘统计所有数据
441
+     *
442
+     * @param orgId
443
+     * @param startDate
444
+     * @param endDate
445
+     * @param buildingId
446
+     * @param personBuildingList
447
+     * @return
448
+     */
449
+    @Override
450
+    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList) {
451
+        IPage<StatsBuilding> pg = new Page<>(pageNum, pageSize);
452
+        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList);
453
+        return ResponseBean.success(page);
454
+    }
455
+
438 456
     /**
439 457
      * 项目公客排行折线图获取
440 458
      * @param orgId

+ 62
- 0
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

@@ -384,4 +384,66 @@
384 384
         LIMIT 6
385 385
     </select>
386 386
 
387
+    <select id="getStatsTableList" resultType="com.huiju.estateagents.excel.StatsBuilding">
388
+        SELECT
389
+            t.building_id,
390
+            t.building_name,
391
+            IFNULL( t.pv_num, 0 ) AS pv_num,
392
+            IFNULL( uu.uv_num, 0 ) AS uv_num,
393
+            IFNULL( aa.sk_num, 0 ) AS sk_num,
394
+            IFNULL( bbb.gk_num, 0 ) AS gk_num,
395
+            IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
396
+        FROM
397
+            ta_building t
398
+        LEFT JOIN (
399
+            SELECT
400
+                count( * ) AS sk_num,
401
+                a.building_id
402
+            FROM
403
+                ta_recommend_customer a
404
+            WHERE
405
+                a.STATUS > 0
406
+                AND a.verify_status = 1
407
+                AND a.realty_consultant IS NOT NULL
408
+                AND a.realty_consultant != ''
409
+                AND a.org_id = #{orgId}
410
+            GROUP BY
411
+                a.building_id
412
+        ) aa ON aa.building_id = t.building_id
413
+        LEFT JOIN (
414
+            SELECT
415
+                count( * ) AS gk_num,
416
+                bb.building_id
417
+            FROM
418
+            (
419
+                SELECT
420
+                    b.*
421
+                FROM
422
+                    ta_person b
423
+                WHERE
424
+                    b.STATUS > 0
425
+                    AND b.org_id = #{orgId}
426
+                    AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
427
+                    AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
428
+                GROUP BY
429
+                    b.person_id
430
+            ) bb
431
+            GROUP BY
432
+                bb.building_id
433
+        ) bbb ON bbb.building_id = t.building_id
434
+        LEFT JOIN (
435
+            SELECT
436
+                count( * ) AS uv_num,
437
+                u.be_uv AS building_id
438
+            FROM
439
+                ta_uv u
440
+            WHERE
441
+                u.tagert_type = 'project'
442
+            GROUP BY
443
+                u.be_uv
444
+        ) uu ON uu.building_id = t.building_id
445
+        WHERE
446
+        t.org_id = #{orgId}
447
+    </select>
448
+
387 449
 </mapper>