Browse Source

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

魏超 5 years ago
parent
commit
3f36f6e223

+ 12
- 5
src/main/java/com/huiju/estateagents/excel/StatsTimeBuilding.java View File

@@ -8,39 +8,46 @@ import lombok.Data;
8 8
 @Data
9 9
 public class StatsTimeBuilding {
10 10
 
11
+    /**
12
+     * 项目名称
13
+     */
14
+    @ColumnWidth(15)
15
+    @ExcelProperty(value = "项目名称", index = 0)
16
+    private String buildingName;
17
+
11 18
     /**
12 19
      * 日期
13 20
      */
14 21
     @ColumnWidth(15)
15
-    @ExcelProperty(value = "日期", index = 0)
22
+    @ExcelProperty(value = "日期", index = 1)
16 23
     private String createDate;
17 24
 
18 25
     /**
19 26
      * 新增客户 公客加私客
20 27
      */
21 28
     @ColumnWidth(15)
22
-    @ExcelProperty(value = "新增客户", index = 1)
29
+    @ExcelProperty(value = "新增客户", index = 2)
23 30
     private Integer khNum;
24 31
 
25 32
     /**
26 33
      * 公客
27 34
      */
28 35
     @ColumnWidth(15)
29
-    @ExcelProperty(value = "公客", index = 2)
36
+    @ExcelProperty(value = "公客", index = 3)
30 37
     private Integer gkNum;
31 38
 
32 39
     /**
33 40
      * 私客
34 41
      */
35 42
     @ColumnWidth(15)
36
-    @ExcelProperty(value = "私客", index = 3)
43
+    @ExcelProperty(value = "私客", index = 4)
37 44
     private Integer skNum;
38 45
 
39 46
     /**
40 47
      * 观看人数
41 48
      */
42 49
     @ColumnWidth(15)
43
-    @ExcelProperty(value = "访问人数", index = 4)
50
+    @ExcelProperty(value = "访问人数", index = 5)
44 51
     private Integer uvNum;
45 52
 
46 53
     @ExcelIgnore

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

@@ -167,7 +167,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
167 167
      * @param buildingId
168 168
      * @return
169 169
      */
170
-    List<StatsTimeBuilding> getStatsTimeBarList(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("buildingId") String buildingId);
170
+    List<StatsTimeBuilding> getStatsTimeBarList(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("buildingId") String buildingId, @Param("buildingName") String buildingName);
171 171
 
172 172
     /**
173 173
      * 获取详情数据表格

+ 5
- 2
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.common.CommConstant;
8
+import com.huiju.estateagents.entity.TaBuilding;
8 9
 import com.huiju.estateagents.entity.TaPersonBuilding;
9 10
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
10 11
 import com.huiju.estateagents.entity.TdWxDict;
@@ -493,7 +494,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
493 494
     @Override
494 495
     public ResponseBean getStatsTimeBarList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
495 496
         Map<String,Object> map = new HashMap<>();
496
-        List<StatsTimeBuilding> list = taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId);
497
+        TaBuilding taBuilding = taBuildingMapper.selectById(buildingId);
498
+        List<StatsTimeBuilding> list = taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId,taBuilding.getBuildingName());
497 499
         //日期维度
498 500
         List<String> timeList = list.stream().map(StatsTimeBuilding::getCreateDate).collect(Collectors.toList());
499 501
         //公客维度
@@ -552,7 +554,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
552 554
      */
553 555
     @Override
554 556
     public List<StatsTimeBuilding> getExportTimeTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
555
-        return taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId);
557
+        TaBuilding taBuilding = taBuildingMapper.selectById(buildingId);
558
+        return taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId,taBuilding.getBuildingName());
556 559
     }
557 560
 
558 561
     /**

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

@@ -567,6 +567,7 @@
567 567
     </select>
568 568
     <select id="getStatsTimeBarList" resultType="com.huiju.estateagents.excel.StatsTimeBuilding">
569 569
         SELECT
570
+            #{buildingName} as building_name,
570 571
             t.date as create_date,
571 572
             IFNULL( s.sk_num, 0 ) AS sk_num,
572 573
             IFNULL( g.gk_num, 0 ) AS gk_num,
@@ -646,6 +647,7 @@
646 647
             GROUP BY
647 648
                 DATE_FORMAT( create_date, '%Y-%m-%d' )
648 649
         ) u ON t.date = u.create_date
650
+        ORDER BY create_date
649 651
     </select>
650 652
     <select id="getStatsTimeTableList" resultType="com.huiju.estateagents.excel.StatsTimeBuilding">
651 653
         SELECT

+ 14
- 5
src/main/resources/mapper/TsConsultantKpiMapper.xml View File

@@ -158,6 +158,10 @@
158 158
         INNER JOIN ta_person t ON t.person_id = e.person_id
159 159
         WHERE e.org_id = #{orgId}
160 160
         AND e.share_person = #{userId}
161
+        AND (
162
+            e.target_type IN ( 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share', 'poster' )
163
+            or ( e.target_type = 'share' and e.target_id = 'index' )
164
+        )m
161 165
         AND e.create_date BETWEEN #{startDate} and #{endDate}
162 166
         <!-- building_id 字段数据不全
163 167
         <if test="buildingId != null and buildingId !=''">
@@ -167,6 +171,7 @@
167 171
         AND e.is_first_time = 1
168 172
 
169 173
         AND t.phone is not null
174
+        AND t.person_type != 'Realty Consultant'
170 175
 
171 176
 <!--        为了与存储过程一致 -->
172 177
 <!--        AND t.`status` = 1-->
@@ -177,7 +182,7 @@
177 182
         SELECT
178 183
             t.*,
179 184
             count( * ) as visit_times,
180
-            MAX(f.visit_time) as visit_time
185
+            f.visit_time as visit_time
181 186
         FROM
182 187
             ta_person t
183 188
         INNER JOIN ta_person_visit_record f ON f.org_id = #{orgId} AND f.person_id = t.person_id
@@ -195,8 +200,8 @@
195 200
 
196 201
 <!--        为了与存储过程一致 -->
197 202
 <!--            AND s.`status` = 1-->
198
-        GROUP BY t.person_id, DATE_FORMAT(t.create_date, '%Y%m%d')
199
-        ORDER BY t.create_date DESC
203
+        GROUP BY t.person_id, DATE_FORMAT(f.visit_time, '%Y%m%d')
204
+        ORDER BY f.visit_time DESC
200 205
     </select>
201 206
 
202 207
     <select id="getConsultantHomePageTimes" resultType="com.huiju.estateagents.entity.TaPerson">
@@ -229,7 +234,7 @@
229 234
     <select id="getConsultantChatPersons" resultType="com.huiju.estateagents.entity.TaPerson">
230 235
         SELECT
231 236
             t.*,
232
-            max( h.create_date ) AS visit_time
237
+            h.create_date AS visit_time
233 238
         FROM
234 239
             ta_person t
235 240
         INNER JOIN ta_chat h ON h.send_person = t.person_id
@@ -311,12 +316,16 @@
311 316
         SELECT
312 317
             t.*,
313 318
             count(*) as visit_times,
314
-            max(e.create_date) as visit_time
319
+            e.create_date as visit_time
315 320
         FROM ta_share_person_from e
316 321
         INNER JOIN ta_person t ON t.person_id = e.person_id
317 322
         WHERE e.org_id = #{orgId}
318 323
             AND e.share_person = #{userId}
319 324
             AND e.create_date BETWEEN #{startDate} and #{endDate}
325
+            AND (
326
+                e.target_type IN ( 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share', 'poster' )
327
+                OR ( e.target_type = 'share' AND e.target_id = 'index' )
328
+            )
320 329
             <!-- building_id 字段数据不全
321 330
             <if test="buildingId != null and buildingId !=''">
322 331
                 AND e.building_id = #{buildingId}