瀏覽代碼

报表bug 修复

傅行帆 3 年之前
父節點
當前提交
5550d24d72

+ 1
- 1
src/main/java/com/yunzhi/marketing/controller/StatisticalController.java 查看文件

@@ -285,7 +285,7 @@ public class StatisticalController extends BaseController {
285 285
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
286 286
         // 设置 sheet, 同一个sheet只需要设置一次
287 287
         WriteSheet writeSheet = EasyExcel.writerSheet("项目统计").build();
288
-        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
288
+        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),getInstitutionIds(request));
289 289
         excelWriter.write(list, writeSheet);
290 290
         // finish 会帮忙关闭流
291 291
         excelWriter.finish();

+ 2
- 2
src/main/java/com/yunzhi/marketing/excel/StatsBuilding.java 查看文件

@@ -47,8 +47,8 @@ public class StatsBuilding {
47 47
      * 观看次数
48 48
      */
49 49
     @ColumnWidth(15)
50
-    @ExcelProperty(value = "访问次数", index = 5)
51
-    private Integer pvNum;
50
+    @ExcelProperty(value = "成交量", index = 5)
51
+    private Integer cjNum;
52 52
 
53 53
 
54 54
     @ExcelIgnore

+ 1
- 1
src/main/java/com/yunzhi/marketing/mapper/TaBuildingMapper.java 查看文件

@@ -164,7 +164,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
164 164
      * @param personBuildingList
165 165
      * @return
166 166
      */
167
-    List<StatsBuilding> getExportTableList(@Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
167
+    List<StatsBuilding> getExportTableList(@Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("institutionIds") List<String> institutionIds);
168 168
 
169 169
     /**
170 170
      * 获取单独building的折线图数据

+ 1
- 1
src/main/java/com/yunzhi/marketing/service/IStatisticalService.java 查看文件

@@ -159,7 +159,7 @@ public interface IStatisticalService {
159 159
      * @param taPersonBuildingListByUserId
160 160
      * @return
161 161
      */
162
-    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
162
+    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutionIds);
163 163
 
164 164
     /**
165 165
      * 按时间获取此楼盘的数据折线图

+ 2
- 2
src/main/java/com/yunzhi/marketing/service/impl/StatisticalServiceImpl.java 查看文件

@@ -482,8 +482,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
482 482
      * @return
483 483
      */
484 484
     @Override
485
-    public List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList) {
486
-        return taBuildingMapper.getExportTableList(orgId, startDate, endDate, buildingId, personBuildingList);
485
+    public List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,List<String> institutionIds) {
486
+        return taBuildingMapper.getExportTableList(orgId, startDate, endDate, buildingId, personBuildingList,institutionIds);
487 487
     }
488 488
 
489 489
     /**

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

@@ -458,6 +458,7 @@
458 458
             IFNULL( uu.uv_num, 0 ) AS uv_num,
459 459
             IFNULL( aa.sk_num, 0 ) AS sk_num,
460 460
             IFNULL( bbb.gk_num, 0 ) AS gk_num,
461
+            IFNULL( s.cj_num, 0 ) AS cj_num,
461 462
             IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
462 463
         FROM
463 464
             ta_building t
@@ -528,6 +529,18 @@
528 529
             GROUP BY
529 530
                 u.be_uv
530 531
         ) uu ON uu.building_id = t.building_id
532
+        LEFT JOIN (
533
+            SELECT count( * ) AS cj_num,
534
+                building_id
535
+            FROM
536
+                xlk_customer_signatory WHERE type = 'signatory' AND org_id = #{orgId}
537
+        <if test="startDate != null">
538
+            and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
539
+        </if>
540
+        <if test="endDate != null">
541
+            and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
542
+        </if>
543
+        GROUP BY building_id ) s ON s.building_id = t.building_id
531 544
         WHERE
532 545
         t.org_id = #{orgId}
533 546
         <if test="personBuildingList != null and personBuildingList.size > 0">
@@ -557,6 +570,7 @@
557 570
         IFNULL( uu.uv_num, 0 ) AS uv_num,
558 571
         IFNULL( aa.sk_num, 0 ) AS sk_num,
559 572
         IFNULL( bbb.gk_num, 0 ) AS gk_num,
573
+        IFNULL( s.cj_num, 0 ) AS cj_num,
560 574
         IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
561 575
         FROM
562 576
         ta_building t
@@ -627,6 +641,18 @@
627 641
         GROUP BY
628 642
         u.be_uv
629 643
         ) uu ON uu.building_id = t.building_id
644
+        LEFT JOIN (
645
+        SELECT count( * ) AS cj_num,
646
+        building_id
647
+        FROM
648
+        xlk_customer_signatory WHERE type = 'signatory' AND org_id = #{orgId}
649
+        <if test="startDate != null">
650
+            and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
651
+        </if>
652
+        <if test="endDate != null">
653
+            and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
654
+        </if>
655
+        GROUP BY building_id ) s ON s.building_id = t.building_id
630 656
         WHERE
631 657
         t.org_id = #{orgId}
632 658
         <if test="personBuildingList != null and personBuildingList.size > 0">
@@ -635,6 +661,12 @@
635 661
                 #{personBuilding.buildingId}
636 662
             </foreach>
637 663
         </if>
664
+        <if test="institutionIds != null and institutionIds.size > 0">
665
+            AND t.institution_id in
666
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
667
+                #{item}
668
+            </foreach>
669
+        </if>
638 670
         <if test="buildingId != null and buildingId != '' ">
639 671
             AND t.building_id = #{buildingId}
640 672
         </if>