소스 검색

修改bug数据统计相关

傅行帆 3 년 전
부모
커밋
7fdc1c8d24

+ 5
- 1
src/main/java/com/yunzhi/marketing/base/BaseController.java 파일 보기

@@ -131,7 +131,11 @@ public class BaseController {
131 131
     public List<String> getInstitutionIds(HttpServletRequest request) {
132 132
         TaUser taUser = taUserService.getById(getUserId(request));
133 133
         List<Institution> list = iInstitutionService.getAllByUser(taUser);
134
-        return list.stream().map(Institution::getInstitutionId).collect(Collectors.toList());
134
+        List<String> institutions = list.stream().map(Institution::getInstitutionId).collect(Collectors.toList());
135
+        if (institutions.contains("01")) {
136
+            return null;
137
+        }
138
+        return institutions;
135 139
     }
136 140
 
137 141
     /**

+ 4
- 4
src/main/java/com/yunzhi/marketing/controller/StatisticalController.java 파일 보기

@@ -77,7 +77,7 @@ public class StatisticalController extends BaseController {
77 77
     public ResponseBean changeNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
78 78
                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
79 79
                                             HttpServletRequest request) {
80
-        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate);
80
+        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate,getInstitutionIds(request));
81 81
     }
82 82
 
83 83
     /**
@@ -198,7 +198,7 @@ public class StatisticalController extends BaseController {
198 198
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
199 199
                                             @RequestParam(value = "buildingId", required = false) String buildingId,
200 200
                                             HttpServletRequest request) {
201
-        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
201
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request), getInstitutionIds(request));
202 202
     }
203 203
 
204 204
     /**
@@ -228,7 +228,7 @@ public class StatisticalController extends BaseController {
228 228
     public ResponseBean selectPersonFrom(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
229 229
                                          @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
230 230
                                             HttpServletRequest request) {
231
-        return iStatisticalService.selectPersonFrom(getOrgId(request), startDate,endDate);
231
+        return iStatisticalService.selectPersonFrom(getOrgId(request), startDate,endDate,getInstitutionIds(request));
232 232
     }
233 233
 
234 234
     /**
@@ -354,7 +354,7 @@ public class StatisticalController extends BaseController {
354 354
         response.setContentType("application/octet-stream");
355 355
         response.setCharacterEncoding("utf-8");
356 356
         response.setHeader("Content-disposition", "attachment;filename=新增用户.xlsx");
357
-        ResponseBean responseBean = iStatisticalService.selectPersonFrom(getOrgId(request), startDate, endDate);
357
+        ResponseBean responseBean = iStatisticalService.selectPersonFrom(getOrgId(request), startDate, endDate,getInstitutionIds(request));
358 358
         List<List<String>> headerList = headerList(responseBean.getData());
359 359
         List<List<String>> dataList = dataList(responseBean.getData(),userType);
360 360
         EasyExcel.write(response.getOutputStream()).head(headerList).sheet("新增用户").doWrite(dataList);

+ 2
- 1
src/main/java/com/yunzhi/marketing/mapper/TaPersonIntentionRecordMapper.java 파일 보기

@@ -35,7 +35,8 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
35 35
     IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page,
36 36
                                                    @Param("orgId") Integer orgId,
37 37
                                                    @Param("buildingId") String buildingId,
38
-                                                   @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
38
+                                                   @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
39
+                                                   @Param("institutionIds") List<String> institutions);
39 40
 
40 41
     List<IntentionUser> selectExportIntentionUser(@Param("orgId") Integer orgId,@Param("buildingId") String buildingId,@Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingListByUserId);
41 42
 }

+ 3
- 3
src/main/java/com/yunzhi/marketing/service/IStatisticalService.java 파일 보기

@@ -109,7 +109,7 @@ public interface IStatisticalService {
109 109
      * @param buildingId
110 110
      * @return
111 111
      */
112
-    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
112
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutions);
113 113
 
114 114
     /**
115 115
      * 用户来源数据 首页
@@ -118,7 +118,7 @@ public interface IStatisticalService {
118 118
      * @param endDate
119 119
      * @return
120 120
      */
121
-    ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate);
121
+    ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions);
122 122
 
123 123
     /**
124 124
      * 用户来源数据统计折线图
@@ -214,7 +214,7 @@ public interface IStatisticalService {
214 214
      * @param endDate
215 215
      * @return
216 216
      */
217
-    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate);
217
+    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions);
218 218
 
219 219
     /**
220 220
      * 人员城市分布

+ 7
- 7
src/main/java/com/yunzhi/marketing/service/impl/StatisticalServiceImpl.java 파일 보기

@@ -320,11 +320,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
320 320
     }
321 321
 
322 322
     @Override
323
-    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
323
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutions) {
324 324
         ResponseBean responseBean = new ResponseBean();
325 325
 
326 326
         IPage<Map<String, Object>> pg = new Page<>(pageNum, pageSize);
327
-        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId, taPersonBuildingListByUserId);
327
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId, taPersonBuildingListByUserId,institutions);
328 328
 
329 329
         responseBean.addSuccess(page);
330 330
         return responseBean;
@@ -339,9 +339,9 @@ public class StatisticalServiceImpl implements IStatisticalService {
339 339
      * @return
340 340
      */
341 341
     @Override
342
-    public ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate) {
342
+    public ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions) {
343 343
         ResponseBean responseBean = new ResponseBean();
344
-        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId, startDate, endDate);
344
+        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId, startDate, endDate,institutions);
345 345
         QueryWrapper<TdWxDict> tdWxDictQueryWrapper = new QueryWrapper<>();
346 346
         tdWxDictQueryWrapper.groupBy("scene_type");
347 347
         List<TdWxDict> tdWxDicts = tdWxDictMapper.selectList(tdWxDictQueryWrapper);
@@ -353,7 +353,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
353 353
         });
354 354
         Map<String, Object> map = new HashMap<>();
355 355
         map.put("tdWxDicts", tdWxDicts);
356
-        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId, startDate, endDate);
356
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId, startDate, endDate,institutions);
357 357
         map.put("list", tableList);
358 358
         responseBean.addSuccess(map);
359 359
         return responseBean;
@@ -585,8 +585,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
585 585
      * @return
586 586
      */
587 587
     @Override
588
-    public ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
589
-        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectNewLinePersonFromGroupByData(orgId, startDate, endDate);
588
+    public ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions) {
589
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectNewLinePersonFromGroupByData(orgId, startDate, endDate,institutions);
590 590
         return ResponseBean.success(tableList);
591 591
     }
592 592
 

+ 1
- 1
src/main/java/com/yunzhi/marketing/statistic/controller/TsUserBehaviorStatisticController.java 파일 보기

@@ -158,6 +158,6 @@ public class TsUserBehaviorStatisticController extends BaseController {
158 158
                                            @RequestParam(value = "org", required = false) String org,
159 159
                                            HttpServletRequest request) {
160 160
         Integer orgId = StringUtils.isEmpty(org) ? getOrgId(request) : Integer.valueOf(org);
161
-        return iTsUserBehaviorStatisticService.selectUserBehavior(orgId, startDate, endDate, buildingId);
161
+        return iTsUserBehaviorStatisticService.selectUserBehavior(orgId, startDate, endDate, buildingId,getInstitutionIds(request));
162 162
     }
163 163
 }

+ 5
- 0
src/main/java/com/yunzhi/marketing/statistic/entity/TsPersonFromStatistic.java 파일 보기

@@ -66,4 +66,9 @@ public class TsPersonFromStatistic implements Serializable {
66 66
      */
67 67
     @TableField(exist = false)
68 68
     private String createTime;
69
+
70
+    /**
71
+     * 组织机构id
72
+     */
73
+    private String institutionId;
69 74
 }

+ 4
- 1
src/main/java/com/yunzhi/marketing/statistic/entity/TsUserBehaviorStatistic.java 파일 보기

@@ -60,5 +60,8 @@ public class TsUserBehaviorStatistic implements Serializable {
60 60
      */
61 61
     private LocalDateTime createDate;
62 62
 
63
-
63
+    /**
64
+     * 组织机构id
65
+     */
66
+    private String institutionId;
64 67
 }

+ 3
- 3
src/main/java/com/yunzhi/marketing/statistic/mapper/TsPersonFromStatisticMapper.java 파일 보기

@@ -21,13 +21,13 @@ public interface TsPersonFromStatisticMapper extends BaseMapper<TsPersonFromStat
21 21
 
22 22
     void insertStatisticList(List<TsPersonFromStatistic> list);
23 23
 
24
-    List<TsPersonFromStatistic> selectPersonFrom(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
24
+    List<TsPersonFromStatistic> selectPersonFrom(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
25 25
 
26 26
     List<TsPersonFromStatistic> selectPersonFromGroupByDay(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
27 27
 
28
-    List<TsPersonFromStatistic> selectPersonFromGroupByData(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
28
+    List<TsPersonFromStatistic> selectPersonFromGroupByData(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
29 29
 
30 30
     void deleteByData();
31 31
 
32
-    List<TsPersonFromStatistic> selectNewLinePersonFromGroupByData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
32
+    List<TsPersonFromStatistic> selectNewLinePersonFromGroupByData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
33 33
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/statistic/mapper/TsUserBehaviorStatisticMapper.java 파일 보기

@@ -24,5 +24,5 @@ public interface TsUserBehaviorStatisticMapper extends BaseMapper<TsUserBehavior
24 24
 
25 25
     int deleteByDate();
26 26
 
27
-    List<PersonPO>  seleBehaviorListByDate(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId);
27
+    List<PersonPO>  seleBehaviorListByDate(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId,@Param("institutionIds") List<String> institutions);
28 28
 }

+ 2
- 1
src/main/java/com/yunzhi/marketing/statistic/service/ITsUserBehaviorStatisticService.java 파일 보기

@@ -5,6 +5,7 @@ import com.yunzhi.marketing.base.ResponseBean;
5 5
 import com.yunzhi.marketing.statistic.entity.TsUserBehaviorStatistic;
6 6
 
7 7
 import java.time.LocalDate;
8
+import java.util.List;
8 9
 
9 10
 /**
10 11
  * <p>
@@ -26,5 +27,5 @@ public interface ITsUserBehaviorStatisticService extends IService<TsUserBehavior
26 27
      * @param buildingId
27 28
      * @return
28 29
      */
29
-    ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId);
30
+    ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<String> institutionIds);
30 31
 }

+ 2
- 2
src/main/java/com/yunzhi/marketing/statistic/service/impl/TsUserBehaviorStatisticServiceImpl.java 파일 보기

@@ -52,9 +52,9 @@ public class TsUserBehaviorStatisticServiceImpl extends ServiceImpl<TsUserBehavi
52 52
      * @return
53 53
      */
54 54
     @Override
55
-    public ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId) {
55
+    public ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<String> institutionIds) {
56 56
         ResponseBean responseBean = new ResponseBean();
57
-        List<PersonPO> tsUserBehaviorStatistics = tsUserBehaviorStatisticMapper.seleBehaviorListByDate(orgId, startDate, endDate, buildingId);
57
+        List<PersonPO> tsUserBehaviorStatistics = tsUserBehaviorStatisticMapper.seleBehaviorListByDate(orgId, startDate, endDate, buildingId,institutionIds);
58 58
         Map<String, Object> map = new HashMap<>();
59 59
         map.put("selectUserBehavior", tsUserBehaviorStatistics);
60 60
         responseBean.addSuccess(map);

+ 5
- 2
src/main/resources/mapper/TaPersonFromRecordMapper.xml 파일 보기

@@ -9,16 +9,19 @@
9 9
             t.event_type,
10 10
             t.org_id,
11 11
             t.create_date,
12
-            sum( IF ( p.phone IS NOT NULL OR p.tel IS NOT NULL, 1, 0 ) ) AS registered_num
12
+            sum( IF ( p.phone IS NOT NULL OR p.tel IS NOT NULL, 1, 0 ) ) AS registered_num,
13
+            b.institution_id
13 14
         FROM
14 15
             ta_person_from_record t
15 16
             LEFT JOIN ta_person p ON t.person_id = p.person_id
17
+            LEFT JOIN ta_building b on t.building_id = b.building_id
16 18
         WHERE
17 19
             t.is_first_time = 1
18 20
             AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( NOW( ), '%Y-%m-%d' )
19 21
         GROUP BY
20 22
             t.scene_type,
21 23
             t.event_type,
22
-            t.org_id
24
+            t.org_id,
25
+            b.institution_id
23 26
     </select>
24 27
 </mapper>

+ 7
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml 파일 보기

@@ -23,6 +23,7 @@
23 23
         FROM
24 24
             ta_person_intention_record tpir
25 25
             LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
26
+            Left join ta_building tb on tpir.building_id = tb.building_id
26 27
             <trim prefix="where" prefixOverrides="and | or">
27 28
                 <if test="buildingId != null and buildingId != ''">
28 29
                     tpir.building_id = #{buildingId}
@@ -37,6 +38,12 @@
37 38
                         #{personBuilding.buildingId}
38 39
                     </foreach>
39 40
                 </if>
41
+                <if test="institutionIds != null and institutionIds.size > 0">
42
+                    AND tb.institution_id in
43
+                    <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
44
+                        #{item}
45
+                    </foreach>
46
+                </if>
40 47
             </trim>
41 48
         GROUP BY
42 49
             tpir.person_id, tpir.building_id

+ 20
- 3
src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml 파일 보기

@@ -3,10 +3,10 @@
3 3
 <mapper namespace="com.yunzhi.marketing.statistic.mapper.TsPersonFromStatisticMapper">
4 4
 
5 5
     <insert id="insertStatisticList">
6
-        INSERT INTO ts_person_from_statistic(scene_type,event_type,from_num,org_id,create_date,registered_num)
6
+        INSERT INTO ts_person_from_statistic(scene_type,event_type,from_num,org_id,create_date,registered_num,institution_id)
7 7
         VALUES
8 8
         <foreach collection="list" item="item" separator=",">
9
-            (#{item.sceneType},#{item.eventType},#{item.fromNum},#{item.orgId},#{item.createDate},#{item.registeredNum})
9
+            (#{item.sceneType},#{item.eventType},#{item.fromNum},#{item.orgId},#{item.createDate},#{item.registeredNum},#{item.institutionId})
10 10
         </foreach>
11 11
     </insert>
12 12
     <delete id="deleteByData">
@@ -24,7 +24,12 @@
24 24
         <if test="startDate == null or endDate == null">
25 25
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
26 26
         </if>
27
-
27
+        <if test="institutionIds != null and institutionIds.size > 0">
28
+            AND tp.institution_id in
29
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
30
+                #{item}
31
+            </foreach>
32
+        </if>
28 33
     </select>
29 34
     <select id="selectPersonFromGroupByDay"
30 35
             resultType="com.yunzhi.marketing.statistic.entity.TsPersonFromStatistic">
@@ -63,6 +68,12 @@
63 68
         <if test="startDate == null or endDate == null">
64 69
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
65 70
         </if>
71
+        <if test="institutionIds != null and institutionIds.size > 0">
72
+            AND tp.institution_id in
73
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
74
+                #{item}
75
+            </foreach>
76
+        </if>
66 77
         GROUP BY DATE_FORMAT( tp.create_date, '%Y-%m-%d' ), tp.scene_type ORDER BY tp.create_date
67 78
         ) as tp on date.date = tp.create_time
68 79
 
@@ -93,6 +104,12 @@
93 104
         <if test="startDate == null or endDate == null">
94 105
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
95 106
         </if>
107
+        <if test="institutionIds != null and institutionIds.size > 0">
108
+            AND tp.institution_id in
109
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
110
+                #{item}
111
+            </foreach>
112
+        </if>
96 113
         GROUP BY
97 114
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' )
98 115
         ORDER BY tp.create_date

+ 32
- 21
src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml 파일 보기

@@ -7,15 +7,16 @@
7 7
 
8 8
     <select id="seleUserBehaviorList"
9 9
             resultType="com.yunzhi.marketing.statistic.entity.TsUserBehaviorStatistic">
10
-                SELECT
10
+        SELECT
11 11
             temp_date.date AS create_date,
12 12
             temp_date.type_name AS event_name,
13 13
             temp_date.type_id AS event_type,
14 14
             temp.activityCount AS behavior_num,
15 15
             temp.building_id,
16
-            temp.org_id
16
+            temp.org_id,
17
+            temp.institution_id
17 18
         FROM
18
-            (
19
+        (
19 20
         SELECT
20 21
             DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
21 22
             b.type_id,
@@ -24,26 +25,30 @@
24 25
         FROM
25 26
             sequence a,
26 27
             td_biz_event_type b
27
-            ) AS temp_date
28
-            LEFT JOIN (
29
-        SELECT
30
-            COUNT( 1 ) AS activityCount,
31
-            tpvr.event_type,
32
-            DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ) AS date,
33
-            tpvr.building_id,
34
-            tp.org_id
35
-        FROM
36
-            ta_person tp
28
+        ) AS temp_date
29
+        LEFT JOIN (
30
+            SELECT
31
+                COUNT( 1 ) AS activityCount,
32
+                tpvr.event_type,
33
+                DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ) AS date,
34
+                tpvr.building_id,
35
+                tp.org_id,
36
+                tb.institution_id
37
+            FROM
38
+                ta_person tp
37 39
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
40
+            LEFT JOIN ta_building tb on tpvr.building_id = tb.building_id
41
+            WHERE
42
+                tp.person_type IN ( 'customer', 'drift', 'estate agent' )
43
+            GROUP BY
44
+                tpvr.event_type,
45
+                DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ),
46
+                tp.org_id,
47
+                tpvr.building_id
48
+        ) AS temp ON temp_date.date = temp.date
49
+        AND temp_date.type_id = temp.event_type
38 50
         WHERE
39
-            tp.person_type IN ( 'customer', 'drift', 'estate agent' )
40
-        GROUP BY
41
-            tpvr.event_type,
42
-            DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ),
43
-            tp.org_id,
44
-            tpvr.building_id
45
-            ) AS temp ON temp_date.date = temp.date
46
-            AND temp_date.type_id = temp.event_type where temp_date.date = DATE_FORMAT( now( ), '%Y-%m-%d' )
51
+        temp_date.date = DATE_FORMAT( now( ), '%Y-%m-%d' )
47 52
     </select>
48 53
     <select id="seleBehaviorListByDate"
49 54
             resultType="com.yunzhi.marketing.po.PersonPO">
@@ -84,6 +89,12 @@
84 89
             <if test="buildingId != null and buildingId != ''">
85 90
                 and tp.building_id = #{buildingId}
86 91
             </if>
92
+            <if test="institutionIds != null and institutionIds.size > 0">
93
+                AND tp.institution_id in
94
+                <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
95
+                    #{item}
96
+                </foreach>
97
+            </if>
87 98
             GROUP BY
88 99
             DATE_FORMAT( tp.create_date, '%Y-%m-%d' ),
89 100
             tp.event_type