魏超 5 anni fa
parent
commit
b854a595e3

+ 2
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java Vedi File

@@ -42,4 +42,6 @@ public class ShareNum {
42 42
     @ColumnWidth(15)
43 43
     @ExcelProperty(value = "访问人数", index = 4)
44 44
     private Integer visitPersonNum;
45
+
46
+    private String sharePersonId;
45 47
 }

+ 1
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/SharePersonNum.java Vedi File

@@ -48,4 +48,5 @@ public class SharePersonNum {
48 48
     @ExcelProperty(value = "访问次数", index = 5)
49 49
     private Integer visitNum;
50 50
 
51
+    private String personId;
51 52
 }

+ 7
- 3
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java Vedi File

@@ -190,10 +190,11 @@ public class ActivityStatisticController extends BaseController {
190 190
                                                      @RequestParam(value = "sharePhone", required = false)String sharePhone,
191 191
                                                      @RequestParam(value = "activityId", required = false)String activityId,
192 192
                                                      @RequestParam(value = "activityType", required = false)String activityType,
193
+                                                     @RequestParam(value = "personId", required = false)String personId,
193 194
                                                      @RequestParam(value = "sort", required = false)String sort,
194 195
                                                      @RequestParam(value = "colKey", required = false)String colKey,
195 196
                                                      HttpServletRequest request) {
196
-        return taActivityStaticService.selectActivityShareNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, sort, colKey);
197
+        return taActivityStaticService.selectActivityShareNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, sort, colKey);
197 198
     }
198 199
 
199 200
     /**
@@ -271,8 +272,9 @@ public class ActivityStatisticController extends BaseController {
271 272
                                                    @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
272 273
                                                    @RequestParam(value = "activityId", required = false)String activityId,
273 274
                                                    @RequestParam(value = "activityType", required = false)String activityType,
275
+                                                   @RequestParam(value = "personId", required = false)String personId,
274 276
                                                    HttpServletRequest request) {
275
-        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType);
277
+        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId);
276 278
     }
277 279
 
278 280
     /**
@@ -311,10 +313,11 @@ public class ActivityStatisticController extends BaseController {
311 313
                                                @RequestParam(value = "province", required = false)String province,
312 314
                                                @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
313 315
                                                @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
316
+                                               @RequestParam(value = "personId", required = false)String personId,
314 317
                                                @RequestParam(value = "activityId", required = false)String activityId,
315 318
                                                @RequestParam(value = "activityType", required = false)String activityType,
316 319
                                                HttpServletRequest request) {
317
-        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType);
320
+        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId);
318 321
     }
319 322
 
320 323
     /**
@@ -340,4 +343,5 @@ public class ActivityStatisticController extends BaseController {
340 343
         // finish 会帮忙关闭流
341 344
         excelWriter.finish();
342 345
     }
346
+
343 347
 }

+ 36
- 15
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java Vedi File

@@ -12,29 +12,29 @@ import java.util.Map;
12 12
 
13 13
 @Mapper
14 14
 public interface TaActicityStaticMapper {
15
-    Integer selectSharePersonNum(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
15
+    Integer selectSharePersonNum(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
16 16
 
17
-    Integer selectShareNum(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
17
+    Integer selectShareNum(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
18 18
 
19
-    Integer selectVisitPersonNum(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
19
+    Integer selectVisitPersonNum(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
20 20
 
21
-    Integer selectVisitNum(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
21
+    Integer selectVisitNum(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType, @Param("orgId") Integer orgId);
22 22
 
23
-    List<Map<String, Object>> selectShareCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
23
+    List<Map<String, Object>> selectShareCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
24 24
 
25
-    List<Map<String, Object>> selectSharePersonCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
25
+    List<Map<String, Object>> selectSharePersonCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
26 26
 
27
-    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
27
+    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
28 28
 
29
-    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
29
+    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
30 30
 
31
-    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
31
+    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
32 32
 
33 33
     IPage<StatisicAttractUser> selectTableData(
34 34
             IPage<StatisicAttractUser> attractUserIPage,
35 35
             @Param("orgId") Integer orgId,
36
-            @Param("startDate") LocalDate startDate,
37
-            @Param("endDate") LocalDate endDate,
36
+            @Param("startDate") LocalDateTime startDate,
37
+            @Param("endDate") LocalDateTime endDate,
38 38
             @Param("buildingId") String buildingId,
39 39
             @Param("targetType") String targetType,
40 40
             @Param("sortType") String sortType,
@@ -42,8 +42,8 @@ public interface TaActicityStaticMapper {
42 42
 
43 43
     List<StatisicAttractUser> selectExportTableData(
44 44
             @Param("orgId") Integer orgId,
45
-            @Param("startDate") LocalDate startDate,
46
-            @Param("endDate") LocalDate endDate,
45
+            @Param("startDate") LocalDateTime startDate,
46
+            @Param("endDate") LocalDateTime endDate,
47 47
             @Param("buildingId") String buildingId,
48 48
             @Param("targetType") String targetType,
49 49
             @Param("sortType") String sortType,
@@ -52,8 +52,8 @@ public interface TaActicityStaticMapper {
52 52
     IPage<ActivityDetailShareRecord> selectActivityStatisDetail(
53 53
             IPage<ActivityDetailShareRecord> attractUserIPage,
54 54
             @Param("orgId") Integer orgId,
55
-            @Param("startDate") LocalDate startDate,
56
-            @Param("endDate") LocalDate endDate,
55
+            @Param("startDate") LocalDateTime startDate,
56
+            @Param("endDate") LocalDateTime endDate,
57 57
             @Param("buildingId") String buildingId,
58 58
             @Param("targetType") String targetType,
59 59
             @Param("activityName") String activityName,
@@ -107,6 +107,7 @@ public interface TaActicityStaticMapper {
107 107
             @Param("sharePhone") String sharePhone,
108 108
             @Param("activityId") String activityId,
109 109
             @Param("activityType") String activityType,
110
+            @Param("personId") String personId,
110 111
             @Param("sort") String sort,
111 112
             @Param("colKey") String colKey
112 113
     );
@@ -185,4 +186,24 @@ public interface TaActicityStaticMapper {
185 186
             @Param("realtyConsultantPhone") String realtyConsultantPhone
186 187
     );
187 188
 
189
+    IPage<VisitPersonNum> selectActivityVisitPersonNumByPersonId(
190
+            IPage<VisitPersonNum> iPage,
191
+            @Param("orgId") Integer orgId,
192
+            @Param("startDate") LocalDateTime startDate,
193
+            @Param("endDate") LocalDateTime endDate,
194
+            @Param("personId") String personId,
195
+            @Param("activityId") String activityId,
196
+            @Param("activityType") String activityType
197
+    );
198
+
199
+    IPage<VisitNum> selectActivityVisitNumByPersonId(
200
+            IPage<VisitNum> iPage,
201
+            @Param("orgId") Integer orgId,
202
+            @Param("startDate") LocalDateTime startDate,
203
+            @Param("endDate") LocalDateTime endDate,
204
+            @Param("personId") String personId,
205
+            @Param("activityId") String activityId,
206
+            @Param("activityType") String activityType
207
+    );
208
+
188 209
 }

+ 32
- 18
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java Vedi File

@@ -3,6 +3,7 @@ package com.huiju.estateagents.statistic.service.impl;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.StringUtils;
6 7
 import com.huiju.estateagents.excel.ActivityStatistics.*;
7 8
 import com.huiju.estateagents.statistic.mapper.TaActicityStaticMapper;
8 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,13 +26,13 @@ public class TaActivityStaticServiceImpl {
25 26
         ResponseBean responseBean = new ResponseBean();
26 27
         Map<String, Object> map = new HashMap<>();
27 28
 
28
-        Integer sharePersonNum = taActicityStaticMapper.selectSharePersonNum(startDate, endDate, buidling, targetType, orgId);
29
+        Integer sharePersonNum = taActicityStaticMapper.selectSharePersonNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), buidling, targetType, orgId);
29 30
 
30
-        Integer shareNum = taActicityStaticMapper.selectShareNum(startDate, endDate, buidling, targetType, orgId);
31
+        Integer shareNum = taActicityStaticMapper.selectShareNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), buidling, targetType, orgId);
31 32
 
32
-        Integer visitPersonNum = taActicityStaticMapper.selectVisitPersonNum(startDate, endDate, buidling, targetType, orgId);
33
+        Integer visitPersonNum = taActicityStaticMapper.selectVisitPersonNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), buidling, targetType, orgId);
33 34
 
34
-        Integer visitNum = taActicityStaticMapper.selectVisitNum(startDate, endDate, buidling, targetType, orgId);
35
+        Integer visitNum = taActicityStaticMapper.selectVisitNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), buidling, targetType, orgId);
35 36
 
36 37
         map.put("sharePersonNum", sharePersonNum);
37 38
         map.put("shareNum", shareNum);
@@ -47,11 +48,11 @@ public class TaActivityStaticServiceImpl {
47 48
         ResponseBean responseBean = new ResponseBean();
48 49
 
49 50
         // 新增用户数
50
-        List<Map<String, Object>> selectShareCount = taActicityStaticMapper.selectShareCount(orgId, startDate, endDate, buildingId, targetType);
51
-        List<Map<String, Object>> selectSharePersonCount = taActicityStaticMapper.selectSharePersonCount(orgId, startDate, endDate, buildingId, targetType);
52
-        List<Map<String, Object>> selectVisitCount = taActicityStaticMapper.selectVisitCount(orgId, startDate, endDate, buildingId, targetType);
53
-        List<Map<String, Object>> selectVisitPersonCount = taActicityStaticMapper.selectVisitPersonCount(orgId, startDate, endDate, buildingId, targetType);
54
-        List<Map<String, Object>> selectAddRegistCount = taActicityStaticMapper.selectAddRegistCount(orgId, startDate, endDate, buildingId, targetType);
51
+        List<Map<String, Object>> selectShareCount = taActicityStaticMapper.selectShareCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
52
+        List<Map<String, Object>> selectSharePersonCount = taActicityStaticMapper.selectSharePersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
53
+        List<Map<String, Object>> selectVisitCount = taActicityStaticMapper.selectVisitCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
54
+        List<Map<String, Object>> selectVisitPersonCount = taActicityStaticMapper.selectVisitPersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
55
+        List<Map<String, Object>> selectAddRegistCount = taActicityStaticMapper.selectAddRegistCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
55 56
 
56 57
 
57 58
         for (Map<String, Object> ssc : selectShareCount){
@@ -91,19 +92,19 @@ public class TaActivityStaticServiceImpl {
91 92
     public ResponseBean selectTableData(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
92 93
         IPage<StatisicAttractUser> iPage = new Page<>(pageNum, pageSize);
93 94
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
94
-        IPage<StatisicAttractUser> data = taActicityStaticMapper.selectTableData(iPage, orgId, startDate, endDate, buildingId, targetType, sortType, colKey);
95
+        IPage<StatisicAttractUser> data = taActicityStaticMapper.selectTableData(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, sortType, colKey);
95 96
         return ResponseBean.success(data);
96 97
     }
97 98
 
98 99
     public List<StatisicAttractUser> selectExportTableData(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
99 100
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
100
-        return taActicityStaticMapper.selectExportTableData(orgId, startDate, endDate, buildingId, targetType, sortType, colKey);
101
+        return taActicityStaticMapper.selectExportTableData(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, sortType, colKey);
101 102
     }
102 103
 
103 104
     public ResponseBean selectActivityStatisDetail(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String activityName, String sort, String colKey){
104 105
         IPage<ActivityDetailShareRecord> iPage = new Page<>(pageNum, pageSize);
105 106
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
106
-        IPage<ActivityDetailShareRecord> data = taActicityStaticMapper.selectActivityStatisDetail(iPage, orgId, startDate, endDate, buildingId, targetType, activityName, sortType, colKey);
107
+        IPage<ActivityDetailShareRecord> data = taActicityStaticMapper.selectActivityStatisDetail(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, activityName, sortType, colKey);
107 108
         return ResponseBean.success(data);
108 109
     }
109 110
 
@@ -125,11 +126,11 @@ public class TaActivityStaticServiceImpl {
125 126
         return taActicityStaticMapper.selectActivitySharePersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
126 127
     }
127 128
 
128
-    public ResponseBean selectActivityShareNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String sort, String colKey){
129
+    public ResponseBean selectActivityShareNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String personId, String sort, String colKey){
129 130
         IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
130 131
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
131 132
 
132
-        IPage<ShareNum> data = taActicityStaticMapper.selectActivityShareNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, sortType, colKey);
133
+        IPage<ShareNum> data = taActicityStaticMapper.selectActivityShareNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, sortType, colKey);
133 134
         return ResponseBean.success(data);
134 135
     }
135 136
 
@@ -148,9 +149,15 @@ public class TaActivityStaticServiceImpl {
148 149
         return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom);
149 150
     }
150 151
 
151
-    public ResponseBean selectActivityVisitNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType){
152
+    public ResponseBean selectActivityVisitNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String personId){
152 153
         IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
153
-        IPage<VisitNum> data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
154
+        IPage<VisitNum> data;
155
+        if (StringUtils.isEmpty(personId)){
156
+            data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
157
+        }else{
158
+            data = taActicityStaticMapper.selectActivityVisitNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType);
159
+        }
160
+
154 161
         return ResponseBean.success(data);
155 162
     }
156 163
 
@@ -158,13 +165,20 @@ public class TaActivityStaticServiceImpl {
158 165
         return taActicityStaticMapper.selectActivityVisitNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
159 166
     }
160 167
 
161
-    public ResponseBean selectActivityVisitPersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType){
168
+    public ResponseBean selectActivityVisitPersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String personId){
162 169
         IPage<VisitPersonNum> iPage = new Page<>(pageNum, pageSize);
163
-        IPage<VisitPersonNum> data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
170
+        IPage<VisitPersonNum> data;
171
+        if (StringUtils.isEmpty(personId)){
172
+            data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
173
+        }else{
174
+            data = taActicityStaticMapper.selectActivityVisitPersonNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType);
175
+        }
176
+
164 177
         return ResponseBean.success(data);
165 178
     }
166 179
 
167 180
     public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
168 181
         return taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
169 182
     }
183
+
170 184
 }

+ 170
- 78
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Vedi File

@@ -126,10 +126,10 @@
126 126
             and t.tagert_type = #{targetType}
127 127
         </if>
128 128
         <if test="startDate != null ">
129
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
129
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
130 130
         </if>
131 131
         <if test="endDate != null ">
132
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
132
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
133 133
         </if>
134 134
         <if test="startDate == null or endDate == null ">
135 135
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -182,10 +182,10 @@
182 182
                     and t.tagert_type = #{targetType}
183 183
                 </if>
184 184
                 <if test="startDate != null ">
185
-                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
185
+                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
186 186
                 </if>
187 187
                 <if test="endDate != null ">
188
-                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
188
+                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
189 189
                 </if>
190 190
                 <if test="startDate == null or endDate == null ">
191 191
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -232,10 +232,10 @@
232 232
             and t.target_type =  #{targetType}
233 233
         </if>
234 234
         <if test="startDate != null">
235
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
235
+            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
236 236
         </if>
237 237
         <if test="endDate != null">
238
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
238
+            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
239 239
         </if>
240 240
         <if test="startDate == null or endDate == null ">
241 241
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -267,31 +267,33 @@
267 267
         </trim>
268 268
         ) AS temp_date
269 269
         LEFT JOIN (
270
-        SELECT
271
-        COUNT( 1 ) AS user_count,
272
-        t.visit_time AS create_date
273
-        FROM
274
-        ta_person_visit_record t
275
-        WHERE
276
-        t.`event` = 'detail'  and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
277
-        <if test="buildingId != null and buildingId != ''">
278
-            and t.building_id =  #{buildingId}
279
-        </if>
280
-        <if test="targetType != null and targetType != ''">
281
-            and t.target_type =  #{targetType}
282
-        </if>
283
-        <if test="startDate != null">
284
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
285
-        </if>
286
-        <if test="endDate != null">
287
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
288
-        </if>
289
-        <if test="startDate == null or endDate == null">
290
-            AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
291
-        </if>
292
-        GROUP BY
293
-        DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) , person_id
294
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
270
+            select  count(*) AS user_count , visitPersonCount.* from (
271
+            SELECT
272
+            t.visit_time AS create_date,
273
+            t.person_id
274
+            FROM
275
+            ta_person_visit_record t
276
+            WHERE
277
+            t.`event` = 'detail'  and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
278
+            <if test="buildingId != null and buildingId != ''">
279
+                and t.building_id =  #{buildingId}
280
+            </if>
281
+            <if test="targetType != null and targetType != ''">
282
+                and t.target_type =  #{targetType}
283
+            </if>
284
+            <if test="startDate != null">
285
+                and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
286
+            </if>
287
+            <if test="endDate != null">
288
+                and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
289
+            </if>
290
+            <if test="startDate == null or endDate == null">
291
+                AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
292
+            </if>
293
+            GROUP BY
294
+            DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
295
+            person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
296
+            ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
295 297
         ) AS visit_person_count_table
296 298
         group by date order by date
297 299
     </select>
@@ -331,10 +333,10 @@
331 333
             and t.target_type =  #{targetType}
332 334
         </if>
333 335
         <if test="startDate != null ">
334
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
336
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
335 337
         </if>
336 338
         <if test="endDate != null ">
337
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
339
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
338 340
         </if>
339 341
         <if test="startDate == null or endDate == null">
340 342
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -382,10 +384,10 @@
382 384
             and t.tagert_type = #{targetType}
383 385
         </if>
384 386
         <if test="startDate != null ">
385
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
387
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
386 388
         </if>
387 389
         <if test="endDate != null ">
388
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
390
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
389 391
         </if>
390 392
         <if test="startDate == null or endDate == null ">
391 393
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -413,15 +415,15 @@
413 415
                     and t.tagert_type = #{targetType}
414 416
                 </if>
415 417
                 <if test="startDate != null ">
416
-                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
418
+                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
417 419
                 </if>
418 420
                 <if test="endDate != null ">
419
-                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
421
+                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
420 422
                 </if>
421 423
                 <if test="startDate == null or endDate == null ">
422 424
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
423 425
                 </if>
424
-                GROUP BY t.person_id
426
+                GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
425 427
             ) as temp1
426 428
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
427 429
         LEFT JOIN (
@@ -439,10 +441,10 @@
439 441
             and t.target_type =  #{targetType}
440 442
         </if>
441 443
         <if test="startDate != null">
442
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
444
+            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
443 445
         </if>
444 446
         <if test="endDate != null">
445
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
447
+            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
446 448
         </if>
447 449
         <if test="startDate == null or endDate == null ">
448 450
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -466,10 +468,10 @@
466 468
                 and t.target_type =  #{targetType}
467 469
             </if>
468 470
             <if test="startDate != null">
469
-                and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
471
+                and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
470 472
             </if>
471 473
             <if test="endDate != null">
472
-                and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
474
+                and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
473 475
             </if>
474 476
             <if test="startDate == null or endDate == null">
475 477
                 AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -495,10 +497,10 @@
495 497
                 and t.target_type =  #{targetType}
496 498
             </if>
497 499
             <if test="startDate != null ">
498
-                and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
500
+                and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
499 501
             </if>
500 502
             <if test="endDate != null ">
501
-                and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
503
+                and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
502 504
             </if>
503 505
             <if test="startDate == null or endDate == null">
504 506
                 AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -513,7 +515,6 @@
513 515
         <if test="colKey != null and colKey != ''">
514 516
             ORDER BY  ${colKey} ${sortType}
515 517
         </if>
516
-
517 518
     </select>
518 519
     <select id="selectExportTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
519 520
         SELECT date, ifnull(shareNum ,0) as shareNum, ifnull(sharePersonNum, 0) as sharePersonNum, ifnull(visitNum, 0) as visitNum, ifnull(visitPersonNum, 0) as visitPersonNum, ifnull(addRegistNum,0) as addRegistNum
@@ -550,10 +551,10 @@
550 551
             and t.tagert_type = #{targetType}
551 552
         </if>
552 553
         <if test="startDate != null ">
553
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
554
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
554 555
         </if>
555 556
         <if test="endDate != null ">
556
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
557
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
557 558
         </if>
558 559
         <if test="startDate == null or endDate == null ">
559 560
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -581,15 +582,15 @@
581 582
             and t.tagert_type = #{targetType}
582 583
         </if>
583 584
         <if test="startDate != null ">
584
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
585
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
585 586
         </if>
586 587
         <if test="endDate != null ">
587
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
588
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
588 589
         </if>
589 590
         <if test="startDate == null or endDate == null ">
590 591
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
591 592
         </if>
592
-        GROUP BY t.person_id
593
+        GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
593 594
         ) as temp1
594 595
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
595 596
         LEFT JOIN (
@@ -607,10 +608,10 @@
607 608
             and t.target_type =  #{targetType}
608 609
         </if>
609 610
         <if test="startDate != null">
610
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
611
+            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
611 612
         </if>
612 613
         <if test="endDate != null">
613
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
614
+            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
614 615
         </if>
615 616
         <if test="startDate == null or endDate == null ">
616 617
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -634,10 +635,10 @@
634 635
             and t.target_type =  #{targetType}
635 636
         </if>
636 637
         <if test="startDate != null">
637
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
638
+            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
638 639
         </if>
639 640
         <if test="endDate != null">
640
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
641
+            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
641 642
         </if>
642 643
         <if test="startDate == null or endDate == null">
643 644
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -663,10 +664,10 @@
663 664
             and t.target_type =  #{targetType}
664 665
         </if>
665 666
         <if test="startDate != null ">
666
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
667
+            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
667 668
         </if>
668 669
         <if test="endDate != null ">
669
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
670
+            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
670 671
         </if>
671 672
         <if test="startDate == null or endDate == null">
672 673
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -746,10 +747,10 @@
746 747
                     and a.tagert_type = #{targetType}
747 748
                 </if>
748 749
                 <if test="startDate != null ">
749
-                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
750
+                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
750 751
                 </if>
751 752
                 <if test="endDate != null ">
752
-                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
753
+                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
753 754
                 </if>
754 755
                 <if test="startDate == null or endDate == null ">
755 756
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -765,10 +766,10 @@
765 766
                     and a.tagert_type = #{targetType}
766 767
                 </if>
767 768
                 <if test="startDate != null ">
768
-                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
769
+                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
769 770
                 </if>
770 771
                 <if test="endDate != null ">
771
-                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
772
+                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
772 773
                 </if>
773 774
                 <if test="startDate == null or endDate == null ">
774 775
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -781,13 +782,13 @@
781 782
             select * from (
782 783
                 select count(*) as visitNum, a.target_id, a.event_type From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
783 784
                 <if test="targetType != null and targetType != ''">
784
-                    and a.target_type =  #{targetType}
785
+                    and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType} end)
785 786
                 </if>
786 787
                 <if test="startDate != null">
787
-                    and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
788
+                    and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
788 789
                 </if>
789 790
                 <if test="endDate != null">
790
-                    and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
791
+                    and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
791 792
                 </if>
792 793
                 <if test="startDate == null or endDate == null ">
793 794
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -800,13 +801,13 @@
800 801
             select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type  from (
801 802
                 select  a.* From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
802 803
                 <if test="targetType != null and targetType != ''">
803
-                    and a.target_type =  #{targetType}
804
+                    and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType} end)
804 805
                 </if>
805 806
                 <if test="startDate != null">
806
-                    and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
807
+                    and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
807 808
                 </if>
808 809
                 <if test="endDate != null">
809
-                    and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
810
+                    and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
810 811
                 </if>
811 812
                 <if test="startDate == null or endDate == null ">
812 813
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -823,10 +824,10 @@
823 824
                     and a.target_type =  #{targetType}
824 825
                 </if>
825 826
                 <if test="startDate != null ">
826
-                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
827
+                    and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
827 828
                 </if>
828 829
                 <if test="endDate != null ">
829
-                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
830
+                    and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
830 831
                 </if>
831 832
                 <if test="startDate == null or endDate == null">
832 833
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
@@ -1000,7 +1001,9 @@
1000 1001
                ifnull(shareNum, 0) as shareNum,
1001 1002
                ifnull(visitNum, 0) as visitNum,
1002 1003
                ifnull(visitPersonNum, 0) as visitPersonNum,
1003
-            person.person_type as sharePersonType from (
1004
+            person.person_type as sharePersonType,
1005
+            person.person_id
1006
+            from (
1004 1007
             SELECT t.*, f.nickname, f.tel, f.person_type
1005 1008
             FROM ta_share_count t
1006 1009
             LEFT JOIN ta_help_activity a
@@ -1059,6 +1062,10 @@
1059 1062
 
1060 1063
         left join (
1061 1064
             select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
1065
+            left join
1066
+            (
1067
+            select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
1068
+            ) as a on t.share_person = a.person_id or t.share_person = a.user_id
1062 1069
             where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1063 1070
             and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1064 1071
         ) as visitNum on visitNum.person_id = person.person_id
@@ -1066,6 +1073,10 @@
1066 1073
         left join (
1067 1074
             select count(1) as visitPersonNum, visitNum.share_person as person_id From (
1068 1075
                 select count(1), t.share_person From ta_share_person_from t
1076
+                left join
1077
+                (
1078
+                select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
1079
+                ) as a on t.share_person = a.person_id or t.share_person = a.user_id
1069 1080
                 where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1070 1081
                 and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1071 1082
                 group by  t.person_id, t.share_person
@@ -1138,17 +1149,25 @@
1138 1149
 
1139 1150
         left join (
1140 1151
         select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
1152
+        left join
1153
+        (
1154
+        select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
1155
+        ) as a on t.share_person = a.person_id or t.share_person = a.user_id
1141 1156
         where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1142 1157
         and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1143 1158
         ) as visitNum on visitNum.person_id = person.person_id
1144 1159
 
1145 1160
         left join (
1146
-        select count(1) as visitPersonNum, visitNum.share_person as person_id From (
1147
-        select count(1), t.share_person From ta_share_person_from t
1148
-        where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1149
-        and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1150
-        group by  t.person_id, t.share_person
1151
-        ) as visitNum group by visitNum.share_person
1161
+            select count(1) as visitPersonNum, visitNum.share_person as person_id From (
1162
+                select count(1), t.share_person From ta_share_person_from t
1163
+                left join
1164
+                (
1165
+                    select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
1166
+                ) as a on t.share_person = a.person_id or t.share_person = a.user_id
1167
+                where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1168
+                and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1169
+                group by  t.person_id, t.share_person
1170
+            ) as visitNum group by visitNum.share_person
1152 1171
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1153 1172
         <if test="colKey == null or colKey == ''">
1154 1173
             order by person.create_date desc
@@ -1189,11 +1208,23 @@
1189 1208
             and t.org_id = #{orgId}
1190 1209
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
1191 1210
             and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1211
+            <if test="personId != null and personId != ''">
1212
+                and t.person_id = #{personId}
1213
+            </if>
1192 1214
         ) as person
1193 1215
         LEFT JOIN (
1194 1216
             SELECT count(*) as visitPersonNum,t.share_person as person_id
1195 1217
             FROM ta_share_person_from t
1196
-            where  t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId} group by t.person_id
1218
+            where  t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
1219
+            <if test="personId != null and personId != ''">
1220
+                and t.share_person = #{personId}
1221
+            </if>
1222
+            <if test="startDate != null ">
1223
+                and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1224
+            </if>
1225
+            <if test="endDate != null ">
1226
+                and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1227
+            </if>
1197 1228
         ) as visitPersonNum
1198 1229
         ON visitPersonNum.person_id = person.person_id order by person.create_date desc
1199 1230
     </select>
@@ -1427,7 +1458,7 @@
1427 1458
         'group',
1428 1459
         'h5'
1429 1460
         )
1430
-        AND t.org_id = 84
1461
+        AND t.org_id = #{orgId}
1431 1462
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1432 1463
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1433 1464
         <if test="activityId != null and activityId != ''">
@@ -1488,7 +1519,7 @@
1488 1519
         'group',
1489 1520
         'h5'
1490 1521
         )
1491
-        AND t.org_id = 84
1522
+        AND t.org_id = #{orgId}
1492 1523
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1493 1524
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1494 1525
         GROUP BY
@@ -1516,5 +1547,66 @@
1516 1547
         </where>
1517 1548
         order by t.create_date desc
1518 1549
     </select>
1550
+    <select id="selectActivityVisitPersonNumByPersonId" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum">
1551
+        select
1552
+        a.nickname, a.phone,
1553
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1554
+        a.province,
1555
+        b1.scene_name as personFrom,
1556
+        d.name as realtyConsultant,
1557
+        d.phone as realtyConsultantPhone,
1558
+        t.create_date as visitDate,
1559
+        t.visitNum
1560
+        From (
1561
+            SELECT count(1) as visitNum, t.person_id, t.create_date
1562
+            FROM ta_share_person_from t
1563
+            LEFT JOIN (
1564
+            SELECT a.person_id, b.user_id
1565
+            FROM ta_person a
1566
+            LEFT JOIN ta_user b
1567
+            ON a.user_id = b.user_id
1568
+            WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
1569
+            WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1570
+            and t.share_person = #{personId} group by t.person_id
1571
+        ) as t
1572
+
1573
+        left join ta_person a on  t.person_id = a.person_id
1574
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1575
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
1576
+        left join (
1577
+        select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1578
+        left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1579
+        ) as d on t.person_id = d.person_id
1580
+    </select>
1581
+
1582
+    <select id="selectActivityVisitNumByPersonId" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
1583
+        select
1584
+        a.nickname, a.phone,
1585
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1586
+        a.province,
1587
+        b1.scene_name as personFrom,
1588
+        d.name as realtyConsultant,
1589
+        d.phone as realtyConsultantPhone,
1590
+        t.create_date as visitDate
1591
+        From (
1592
+        SELECT t.person_id, t.create_date
1593
+        FROM ta_share_person_from t
1594
+        LEFT JOIN (
1595
+        SELECT a.person_id, b.user_id
1596
+        FROM ta_person a
1597
+        LEFT JOIN ta_user b
1598
+        ON a.user_id = b.user_id
1599
+        WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
1600
+        WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1601
+        and t.share_person = #{personId}
1602
+        ) as t
1519 1603
 
1604
+        left join ta_person a on  t.person_id = a.person_id
1605
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1606
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
1607
+        left join (
1608
+        select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1609
+        left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1610
+        ) as d on t.person_id = d.person_id
1611
+    </select>
1520 1612
 </mapper>