浏览代码

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

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

+ 2
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java 查看文件

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

+ 1
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/SharePersonNum.java 查看文件

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

+ 7
- 3
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java 查看文件

190
                                                      @RequestParam(value = "sharePhone", required = false)String sharePhone,
190
                                                      @RequestParam(value = "sharePhone", required = false)String sharePhone,
191
                                                      @RequestParam(value = "activityId", required = false)String activityId,
191
                                                      @RequestParam(value = "activityId", required = false)String activityId,
192
                                                      @RequestParam(value = "activityType", required = false)String activityType,
192
                                                      @RequestParam(value = "activityType", required = false)String activityType,
193
+                                                     @RequestParam(value = "personId", required = false)String personId,
193
                                                      @RequestParam(value = "sort", required = false)String sort,
194
                                                      @RequestParam(value = "sort", required = false)String sort,
194
                                                      @RequestParam(value = "colKey", required = false)String colKey,
195
                                                      @RequestParam(value = "colKey", required = false)String colKey,
195
                                                      HttpServletRequest request) {
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
                                                    @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
272
                                                    @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
272
                                                    @RequestParam(value = "activityId", required = false)String activityId,
273
                                                    @RequestParam(value = "activityId", required = false)String activityId,
273
                                                    @RequestParam(value = "activityType", required = false)String activityType,
274
                                                    @RequestParam(value = "activityType", required = false)String activityType,
275
+                                                   @RequestParam(value = "personId", required = false)String personId,
274
                                                    HttpServletRequest request) {
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
                                                @RequestParam(value = "province", required = false)String province,
313
                                                @RequestParam(value = "province", required = false)String province,
312
                                                @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
314
                                                @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
313
                                                @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
315
                                                @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
316
+                                               @RequestParam(value = "personId", required = false)String personId,
314
                                                @RequestParam(value = "activityId", required = false)String activityId,
317
                                                @RequestParam(value = "activityId", required = false)String activityId,
315
                                                @RequestParam(value = "activityType", required = false)String activityType,
318
                                                @RequestParam(value = "activityType", required = false)String activityType,
316
                                                HttpServletRequest request) {
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
         // finish 会帮忙关闭流
343
         // finish 会帮忙关闭流
341
         excelWriter.finish();
344
         excelWriter.finish();
342
     }
345
     }
346
+
343
 }
347
 }

+ 36
- 15
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java 查看文件

12
 
12
 
13
 @Mapper
13
 @Mapper
14
 public interface TaActicityStaticMapper {
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
     IPage<StatisicAttractUser> selectTableData(
33
     IPage<StatisicAttractUser> selectTableData(
34
             IPage<StatisicAttractUser> attractUserIPage,
34
             IPage<StatisicAttractUser> attractUserIPage,
35
             @Param("orgId") Integer orgId,
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
             @Param("buildingId") String buildingId,
38
             @Param("buildingId") String buildingId,
39
             @Param("targetType") String targetType,
39
             @Param("targetType") String targetType,
40
             @Param("sortType") String sortType,
40
             @Param("sortType") String sortType,
42
 
42
 
43
     List<StatisicAttractUser> selectExportTableData(
43
     List<StatisicAttractUser> selectExportTableData(
44
             @Param("orgId") Integer orgId,
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
             @Param("buildingId") String buildingId,
47
             @Param("buildingId") String buildingId,
48
             @Param("targetType") String targetType,
48
             @Param("targetType") String targetType,
49
             @Param("sortType") String sortType,
49
             @Param("sortType") String sortType,
52
     IPage<ActivityDetailShareRecord> selectActivityStatisDetail(
52
     IPage<ActivityDetailShareRecord> selectActivityStatisDetail(
53
             IPage<ActivityDetailShareRecord> attractUserIPage,
53
             IPage<ActivityDetailShareRecord> attractUserIPage,
54
             @Param("orgId") Integer orgId,
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
             @Param("buildingId") String buildingId,
57
             @Param("buildingId") String buildingId,
58
             @Param("targetType") String targetType,
58
             @Param("targetType") String targetType,
59
             @Param("activityName") String activityName,
59
             @Param("activityName") String activityName,
107
             @Param("sharePhone") String sharePhone,
107
             @Param("sharePhone") String sharePhone,
108
             @Param("activityId") String activityId,
108
             @Param("activityId") String activityId,
109
             @Param("activityType") String activityType,
109
             @Param("activityType") String activityType,
110
+            @Param("personId") String personId,
110
             @Param("sort") String sort,
111
             @Param("sort") String sort,
111
             @Param("colKey") String colKey
112
             @Param("colKey") String colKey
112
     );
113
     );
185
             @Param("realtyConsultantPhone") String realtyConsultantPhone
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 查看文件

3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.StringUtils;
6
 import com.huiju.estateagents.excel.ActivityStatistics.*;
7
 import com.huiju.estateagents.excel.ActivityStatistics.*;
7
 import com.huiju.estateagents.statistic.mapper.TaActicityStaticMapper;
8
 import com.huiju.estateagents.statistic.mapper.TaActicityStaticMapper;
8
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
25
         ResponseBean responseBean = new ResponseBean();
26
         ResponseBean responseBean = new ResponseBean();
26
         Map<String, Object> map = new HashMap<>();
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
         map.put("sharePersonNum", sharePersonNum);
37
         map.put("sharePersonNum", sharePersonNum);
37
         map.put("shareNum", shareNum);
38
         map.put("shareNum", shareNum);
47
         ResponseBean responseBean = new ResponseBean();
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
         for (Map<String, Object> ssc : selectShareCount){
58
         for (Map<String, Object> ssc : selectShareCount){
91
     public ResponseBean selectTableData(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
92
     public ResponseBean selectTableData(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
92
         IPage<StatisicAttractUser> iPage = new Page<>(pageNum, pageSize);
93
         IPage<StatisicAttractUser> iPage = new Page<>(pageNum, pageSize);
93
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
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
         return ResponseBean.success(data);
96
         return ResponseBean.success(data);
96
     }
97
     }
97
 
98
 
98
     public List<StatisicAttractUser> selectExportTableData(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
99
     public List<StatisicAttractUser> selectExportTableData(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey){
99
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
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
     public ResponseBean selectActivityStatisDetail(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String activityName, String sort, String colKey){
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
         IPage<ActivityDetailShareRecord> iPage = new Page<>(pageNum, pageSize);
105
         IPage<ActivityDetailShareRecord> iPage = new Page<>(pageNum, pageSize);
105
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
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
         return ResponseBean.success(data);
108
         return ResponseBean.success(data);
108
     }
109
     }
109
 
110
 
125
         return taActicityStaticMapper.selectActivitySharePersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
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
         IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
130
         IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
130
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
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
         return ResponseBean.success(data);
134
         return ResponseBean.success(data);
134
     }
135
     }
135
 
136
 
148
         return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom);
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
         IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
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
         return ResponseBean.success(data);
161
         return ResponseBean.success(data);
155
     }
162
     }
156
 
163
 
158
         return taActicityStaticMapper.selectActivityVisitNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
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
         IPage<VisitPersonNum> iPage = new Page<>(pageNum, pageSize);
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
         return ResponseBean.success(data);
177
         return ResponseBean.success(data);
165
     }
178
     }
166
 
179
 
167
     public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
180
     public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
168
         return taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
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 查看文件

126
             and t.tagert_type = #{targetType}
126
             and t.tagert_type = #{targetType}
127
         </if>
127
         </if>
128
         <if test="startDate != null ">
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
         </if>
130
         </if>
131
         <if test="endDate != null ">
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
         </if>
133
         </if>
134
         <if test="startDate == null or endDate == null ">
134
         <if test="startDate == null or endDate == null ">
135
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
135
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
182
                     and t.tagert_type = #{targetType}
182
                     and t.tagert_type = #{targetType}
183
                 </if>
183
                 </if>
184
                 <if test="startDate != null ">
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
                 </if>
186
                 </if>
187
                 <if test="endDate != null ">
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
                 </if>
189
                 </if>
190
                 <if test="startDate == null or endDate == null ">
190
                 <if test="startDate == null or endDate == null ">
191
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
191
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
232
             and t.target_type =  #{targetType}
232
             and t.target_type =  #{targetType}
233
         </if>
233
         </if>
234
         <if test="startDate != null">
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
         </if>
236
         </if>
237
         <if test="endDate != null">
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
         </if>
239
         </if>
240
         <if test="startDate == null or endDate == null ">
240
         <if test="startDate == null or endDate == null ">
241
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
241
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
267
         </trim>
267
         </trim>
268
         ) AS temp_date
268
         ) AS temp_date
269
         LEFT JOIN (
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
         ) AS visit_person_count_table
297
         ) AS visit_person_count_table
296
         group by date order by date
298
         group by date order by date
297
     </select>
299
     </select>
331
             and t.target_type =  #{targetType}
333
             and t.target_type =  #{targetType}
332
         </if>
334
         </if>
333
         <if test="startDate != null ">
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
         </if>
337
         </if>
336
         <if test="endDate != null ">
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
         </if>
340
         </if>
339
         <if test="startDate == null or endDate == null">
341
         <if test="startDate == null or endDate == null">
340
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
342
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
382
             and t.tagert_type = #{targetType}
384
             and t.tagert_type = #{targetType}
383
         </if>
385
         </if>
384
         <if test="startDate != null ">
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
         </if>
388
         </if>
387
         <if test="endDate != null ">
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
         </if>
391
         </if>
390
         <if test="startDate == null or endDate == null ">
392
         <if test="startDate == null or endDate == null ">
391
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
393
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
413
                     and t.tagert_type = #{targetType}
415
                     and t.tagert_type = #{targetType}
414
                 </if>
416
                 </if>
415
                 <if test="startDate != null ">
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
                 </if>
419
                 </if>
418
                 <if test="endDate != null ">
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
                 </if>
422
                 </if>
421
                 <if test="startDate == null or endDate == null ">
423
                 <if test="startDate == null or endDate == null ">
422
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
424
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
423
                 </if>
425
                 </if>
424
-                GROUP BY t.person_id
426
+                GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
425
             ) as temp1
427
             ) as temp1
426
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
428
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
427
         LEFT JOIN (
429
         LEFT JOIN (
439
             and t.target_type =  #{targetType}
441
             and t.target_type =  #{targetType}
440
         </if>
442
         </if>
441
         <if test="startDate != null">
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
         </if>
445
         </if>
444
         <if test="endDate != null">
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
         </if>
448
         </if>
447
         <if test="startDate == null or endDate == null ">
449
         <if test="startDate == null or endDate == null ">
448
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
450
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
466
                 and t.target_type =  #{targetType}
468
                 and t.target_type =  #{targetType}
467
             </if>
469
             </if>
468
             <if test="startDate != null">
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
             </if>
472
             </if>
471
             <if test="endDate != null">
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
             </if>
475
             </if>
474
             <if test="startDate == null or endDate == null">
476
             <if test="startDate == null or endDate == null">
475
                 AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
477
                 AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
495
                 and t.target_type =  #{targetType}
497
                 and t.target_type =  #{targetType}
496
             </if>
498
             </if>
497
             <if test="startDate != null ">
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
             </if>
501
             </if>
500
             <if test="endDate != null ">
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
             </if>
504
             </if>
503
             <if test="startDate == null or endDate == null">
505
             <if test="startDate == null or endDate == null">
504
                 AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
506
                 AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
513
         <if test="colKey != null and colKey != ''">
515
         <if test="colKey != null and colKey != ''">
514
             ORDER BY  ${colKey} ${sortType}
516
             ORDER BY  ${colKey} ${sortType}
515
         </if>
517
         </if>
516
-
517
     </select>
518
     </select>
518
     <select id="selectExportTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
519
     <select id="selectExportTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
519
         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
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
             and t.tagert_type = #{targetType}
551
             and t.tagert_type = #{targetType}
551
         </if>
552
         </if>
552
         <if test="startDate != null ">
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
         </if>
555
         </if>
555
         <if test="endDate != null ">
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
         </if>
558
         </if>
558
         <if test="startDate == null or endDate == null ">
559
         <if test="startDate == null or endDate == null ">
559
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
560
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
581
             and t.tagert_type = #{targetType}
582
             and t.tagert_type = #{targetType}
582
         </if>
583
         </if>
583
         <if test="startDate != null ">
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
         </if>
586
         </if>
586
         <if test="endDate != null ">
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
         </if>
589
         </if>
589
         <if test="startDate == null or endDate == null ">
590
         <if test="startDate == null or endDate == null ">
590
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
591
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
591
         </if>
592
         </if>
592
-        GROUP BY t.person_id
593
+        GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
593
         ) as temp1
594
         ) as temp1
594
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
595
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
595
         LEFT JOIN (
596
         LEFT JOIN (
607
             and t.target_type =  #{targetType}
608
             and t.target_type =  #{targetType}
608
         </if>
609
         </if>
609
         <if test="startDate != null">
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
         </if>
612
         </if>
612
         <if test="endDate != null">
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
         </if>
615
         </if>
615
         <if test="startDate == null or endDate == null ">
616
         <if test="startDate == null or endDate == null ">
616
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
617
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
634
             and t.target_type =  #{targetType}
635
             and t.target_type =  #{targetType}
635
         </if>
636
         </if>
636
         <if test="startDate != null">
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
         </if>
639
         </if>
639
         <if test="endDate != null">
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
         </if>
642
         </if>
642
         <if test="startDate == null or endDate == null">
643
         <if test="startDate == null or endDate == null">
643
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
644
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
663
             and t.target_type =  #{targetType}
664
             and t.target_type =  #{targetType}
664
         </if>
665
         </if>
665
         <if test="startDate != null ">
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
         </if>
668
         </if>
668
         <if test="endDate != null ">
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
         </if>
671
         </if>
671
         <if test="startDate == null or endDate == null">
672
         <if test="startDate == null or endDate == null">
672
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
673
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
746
                     and a.tagert_type = #{targetType}
747
                     and a.tagert_type = #{targetType}
747
                 </if>
748
                 </if>
748
                 <if test="startDate != null ">
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
                 </if>
751
                 </if>
751
                 <if test="endDate != null ">
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
                 </if>
754
                 </if>
754
                 <if test="startDate == null or endDate == null ">
755
                 <if test="startDate == null or endDate == null ">
755
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
756
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
765
                     and a.tagert_type = #{targetType}
766
                     and a.tagert_type = #{targetType}
766
                 </if>
767
                 </if>
767
                 <if test="startDate != null ">
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
                 </if>
770
                 </if>
770
                 <if test="endDate != null ">
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
                 </if>
773
                 </if>
773
                 <if test="startDate == null or endDate == null ">
774
                 <if test="startDate == null or endDate == null ">
774
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
775
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
781
             select * from (
782
             select * from (
782
                 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
                 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
                 <if test="targetType != null and targetType != ''">
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
                 </if>
786
                 </if>
786
                 <if test="startDate != null">
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
                 </if>
789
                 </if>
789
                 <if test="endDate != null">
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
                 </if>
792
                 </if>
792
                 <if test="startDate == null or endDate == null ">
793
                 <if test="startDate == null or endDate == null ">
793
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
794
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
800
             select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type  from (
801
             select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type  from (
801
                 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
                 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
                 <if test="targetType != null and targetType != ''">
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
                 </if>
805
                 </if>
805
                 <if test="startDate != null">
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
                 </if>
808
                 </if>
808
                 <if test="endDate != null">
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
                 </if>
811
                 </if>
811
                 <if test="startDate == null or endDate == null ">
812
                 <if test="startDate == null or endDate == null ">
812
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
813
                     AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
823
                     and a.target_type =  #{targetType}
824
                     and a.target_type =  #{targetType}
824
                 </if>
825
                 </if>
825
                 <if test="startDate != null ">
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
                 </if>
828
                 </if>
828
                 <if test="endDate != null ">
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
                 </if>
831
                 </if>
831
                 <if test="startDate == null or endDate == null">
832
                 <if test="startDate == null or endDate == null">
832
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
833
                     AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1000
                ifnull(shareNum, 0) as shareNum,
1001
                ifnull(shareNum, 0) as shareNum,
1001
                ifnull(visitNum, 0) as visitNum,
1002
                ifnull(visitNum, 0) as visitNum,
1002
                ifnull(visitPersonNum, 0) as visitPersonNum,
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
             SELECT t.*, f.nickname, f.tel, f.person_type
1007
             SELECT t.*, f.nickname, f.tel, f.person_type
1005
             FROM ta_share_count t
1008
             FROM ta_share_count t
1006
             LEFT JOIN ta_help_activity a
1009
             LEFT JOIN ta_help_activity a
1059
 
1062
 
1060
         left join (
1063
         left join (
1061
             select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
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
             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' )
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
             and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1070
             and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1064
         ) as visitNum on visitNum.person_id = person.person_id
1071
         ) as visitNum on visitNum.person_id = person.person_id
1066
         left join (
1073
         left join (
1067
             select count(1) as visitPersonNum, visitNum.share_person as person_id From (
1074
             select count(1) as visitPersonNum, visitNum.share_person as person_id From (
1068
                 select count(1), t.share_person From ta_share_person_from t
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
                 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' )
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
                 and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1081
                 and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
1071
                 group by  t.person_id, t.share_person
1082
                 group by  t.person_id, t.share_person
1138
 
1149
 
1139
         left join (
1150
         left join (
1140
         select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
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
         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' )
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
         and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1157
         and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by  t.share_person
1143
         ) as visitNum on visitNum.person_id = person.person_id
1158
         ) as visitNum on visitNum.person_id = person.person_id
1144
 
1159
 
1145
         left join (
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
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1171
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1153
         <if test="colKey == null or colKey == ''">
1172
         <if test="colKey == null or colKey == ''">
1154
             order by person.create_date desc
1173
             order by person.create_date desc
1189
             and t.org_id = #{orgId}
1208
             and t.org_id = #{orgId}
1190
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
1209
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
1191
             and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
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
         ) as person
1214
         ) as person
1193
         LEFT JOIN (
1215
         LEFT JOIN (
1194
             SELECT count(*) as visitPersonNum,t.share_person as person_id
1216
             SELECT count(*) as visitPersonNum,t.share_person as person_id
1195
             FROM ta_share_person_from t
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
         ) as visitPersonNum
1228
         ) as visitPersonNum
1198
         ON visitPersonNum.person_id = person.person_id order by person.create_date desc
1229
         ON visitPersonNum.person_id = person.person_id order by person.create_date desc
1199
     </select>
1230
     </select>
1427
         'group',
1458
         'group',
1428
         'h5'
1459
         'h5'
1429
         )
1460
         )
1430
-        AND t.org_id = 84
1461
+        AND t.org_id = #{orgId}
1431
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1462
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1432
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1463
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1433
         <if test="activityId != null and activityId != ''">
1464
         <if test="activityId != null and activityId != ''">
1488
         'group',
1519
         'group',
1489
         'h5'
1520
         'h5'
1490
         )
1521
         )
1491
-        AND t.org_id = 84
1522
+        AND t.org_id = #{orgId}
1492
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1523
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1493
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1524
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1494
         GROUP BY
1525
         GROUP BY
1516
         </where>
1547
         </where>
1517
         order by t.create_date desc
1548
         order by t.create_date desc
1518
     </select>
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
 </mapper>
1612
 </mapper>