Quellcode durchsuchen

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

张延森 vor 5 Jahren
Ursprung
Commit
61b706d7b7

+ 143
- 1
src/main/java/com/huiju/estateagents/controller/StatisticalController.java Datei anzeigen

@@ -1,14 +1,27 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
3 6
 import com.huiju.estateagents.base.BaseController;
4 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.excel.IntentionUser;
9
+import com.huiju.estateagents.excel.StatsBuilding;
10
+import com.huiju.estateagents.excel.StatsTimeBuilding;
11
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
5 12
 import com.huiju.estateagents.service.IStatisticalService;
6 13
 import org.springframework.beans.factory.annotation.Autowired;
7 14
 import org.springframework.format.annotation.DateTimeFormat;
8
-import org.springframework.web.bind.annotation.*;
15
+import org.springframework.web.bind.annotation.GetMapping;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.RestController;
9 19
 
10 20
 import javax.servlet.http.HttpServletRequest;
21
+import javax.servlet.http.HttpServletResponse;
22
+import java.io.IOException;
11 23
 import java.time.LocalDate;
24
+import java.util.List;
12 25
 
13 26
 /**
14 27
  * 数据统计
@@ -52,6 +65,17 @@ public class StatisticalController extends BaseController {
52 65
         return iStatisticalService.selectNewsUserCount(getOrgId(request), startDate, endDate);
53 66
     }
54 67
 
68
+    /**
69
+     * 新增用户数
70
+     * @return
71
+     */
72
+    @GetMapping(value = "/admin/changeNewsUserCount")
73
+    public ResponseBean changeNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
74
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
75
+                                            HttpServletRequest request) {
76
+        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate);
77
+    }
78
+
55 79
     /**
56 80
      * 转化率 统计
57 81
      * @return
@@ -163,6 +187,25 @@ public class StatisticalController extends BaseController {
163 187
         return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
164 188
     }
165 189
 
190
+    /**
191
+     * 意向用户 导出
192
+     * @return
193
+     */
194
+    @GetMapping(value = "/admin/exportIntentionUser")
195
+    public void getBuildingTimeTableList(@RequestParam(value = "buildingId", required = false) String buildingId,
196
+                                         HttpServletRequest request, HttpServletResponse response) throws IOException {
197
+        response.setContentType("application/octet-stream");
198
+        response.setCharacterEncoding("utf-8");
199
+        response.setHeader("Content-disposition", "attachment;filename=意向客户.xlsx");
200
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), IntentionUser.class).registerWriteHandler(new CustomCellWriteHandler()).build();
201
+        // 设置 sheet, 同一个sheet只需要设置一次
202
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
203
+        List<IntentionUser> list = iStatisticalService.getExportIntentionUser(getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
204
+        excelWriter.write(list, writeSheet);
205
+        // finish 会帮忙关闭流
206
+        excelWriter.finish();
207
+    }
208
+
166 209
     /**
167 210
      * 用户来源  首页
168 211
      * @return
@@ -184,4 +227,103 @@ public class StatisticalController extends BaseController {
184 227
                                          HttpServletRequest request) {
185 228
         return iStatisticalService.selectPersonFromGroupByDay(getOrgId(request), startDate,endDate);
186 229
     }
230
+
231
+    /**
232
+     * 项目排行统计图
233
+     * @return
234
+     */
235
+    @GetMapping(value = "/admin/stats/barList")
236
+    public ResponseBean selectBuildingBar(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
237
+                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
238
+                                           HttpServletRequest request) {
239
+        return iStatisticalService.getStatsBarList(getOrgId(request), startDate, endDate, getTaPersonBuildingListByUserId(request));
240
+    }
241
+
242
+
243
+    /**
244
+     * 项目排行统计图
245
+     * @return
246
+     */
247
+    @GetMapping(value = "/admin/stats/tableList")
248
+    public ResponseBean selectBuildingTableList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
249
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
250
+                                                @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
251
+                                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
252
+                                                @RequestParam(value = "buildingId", required = false) String buildingId,
253
+                                                @RequestParam(value = "sortField", required = false) String sortField,
254
+                                                @RequestParam(value = "sortOrder", required = false) String sortOrder,
255
+                                                HttpServletRequest request) {
256
+        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
257
+    }
258
+
259
+    /**
260
+     * 项目排行统计图
261
+     * @return
262
+     */
263
+    @GetMapping(value = "/admin/stats/buildingExport")
264
+    public void getBuildingTableList(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
265
+                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
266
+                                             @RequestParam(value = "buildingId", required = false) String buildingId,
267
+                                             HttpServletRequest request, HttpServletResponse response) throws IOException {
268
+        response.setContentType("application/octet-stream");
269
+        response.setCharacterEncoding("utf-8");
270
+        response.setHeader("Content-disposition", "attachment;filename=项目统计.xlsx");
271
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
272
+        // 设置 sheet, 同一个sheet只需要设置一次
273
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目统计").build();
274
+        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
275
+        excelWriter.write(list, writeSheet);
276
+        // finish 会帮忙关闭流
277
+        excelWriter.finish();
278
+    }
279
+
280
+    /**
281
+     * 项目排行统计图
282
+     * @return
283
+     */
284
+    @GetMapping(value = "/admin/stats/timeBarList")
285
+    public ResponseBean selectBuildingTimeBar(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
286
+                                          @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
287
+                                          @RequestParam(value = "buildingId", required = false) String buildingId,
288
+                                          HttpServletRequest request) {
289
+        return iStatisticalService.getStatsTimeBarList(getOrgId(request), startDate, endDate, buildingId, getTaPersonBuildingListByUserId(request));
290
+    }
291
+
292
+    /**
293
+     * 项目排行统计图
294
+     * @return
295
+     */
296
+    @GetMapping(value = "/admin/stats/timeTableList")
297
+    public ResponseBean selectBuildingTimeTableList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
298
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
299
+                                                @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
300
+                                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
301
+                                                @RequestParam(value = "buildingId", required = false) String buildingId,
302
+                                                @RequestParam(value = "sortField", required = false) String sortField,
303
+                                                @RequestParam(value = "sortOrder", required = false) String sortOrder,
304
+                                                HttpServletRequest request) {
305
+        return iStatisticalService.getStatsTimeTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
306
+    }
307
+
308
+    /**
309
+     * 项目排行统计图
310
+     * @return
311
+     */
312
+    @GetMapping(value = "/admin/stats/buildingTimeExport")
313
+    public void getBuildingTimeTableList(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
314
+                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
315
+                                     @RequestParam(value = "buildingId", required = false) String buildingId,
316
+                                     HttpServletRequest request, HttpServletResponse response) throws IOException {
317
+        response.setContentType("application/octet-stream");
318
+        response.setCharacterEncoding("utf-8");
319
+        response.setHeader("Content-disposition", "attachment;filename=项目详情统计.xlsx");
320
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsTimeBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
321
+        // 设置 sheet, 同一个sheet只需要设置一次
322
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
323
+        List<StatsTimeBuilding> list = iStatisticalService.getExportTimeTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
324
+        excelWriter.write(list, writeSheet);
325
+        // finish 会帮忙关闭流
326
+        excelWriter.finish();
327
+    }
328
+
187 329
 }

+ 1
- 6
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Datei anzeigen

@@ -2,9 +2,9 @@ package com.huiju.estateagents.controller;
2 2
 
3 3
 
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.huiju.estateagents.base.BaseController;
5 6
 import com.huiju.estateagents.base.ResponseBean;
6 7
 import com.huiju.estateagents.common.CommConstant;
7
-import com.huiju.estateagents.common.JWTUtils;
8 8
 import com.huiju.estateagents.common.StringUtils;
9 9
 import com.huiju.estateagents.entity.TaBuilding;
10 10
 import com.huiju.estateagents.entity.TaOrg;
@@ -14,24 +14,19 @@ import com.huiju.estateagents.mapper.TaOrgMapper;
14 14
 import com.huiju.estateagents.service.ITaBuildingService;
15 15
 import com.huiju.estateagents.service.ITaPersonService;
16 16
 import com.huiju.estateagents.service.ITaSaveService;
17
-import com.huiju.estateagents.service.ITdCityService;
18 17
 import io.swagger.annotations.Api;
19 18
 import io.swagger.annotations.ApiImplicitParam;
20 19
 import io.swagger.annotations.ApiImplicitParams;
21 20
 import io.swagger.annotations.ApiOperation;
22
-import org.apache.ibatis.annotations.Param;
23 21
 import org.springframework.beans.factory.annotation.Autowired;
24 22
 import org.springframework.format.annotation.DateTimeFormat;
25 23
 import org.springframework.web.bind.annotation.*;
26 24
 
27
-import com.huiju.estateagents.base.BaseController;
28
-
29 25
 import javax.servlet.http.HttpServletRequest;
30 26
 import javax.servlet.http.HttpSession;
31 27
 import java.time.LocalDateTime;
32 28
 import java.util.ArrayList;
33 29
 import java.util.List;
34
-import java.util.Map;
35 30
 
36 31
 /**
37 32
  * <p>

+ 38
- 0
src/main/java/com/huiju/estateagents/excel/IntentionUser.java Datei anzeigen

@@ -0,0 +1,38 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class IntentionUser {
9
+
10
+    /**
11
+     * 用户姓名
12
+     */
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "用户姓名", index = 0)
15
+    private String personName;
16
+
17
+    /**
18
+     * 手机号
19
+     */
20
+    @ColumnWidth(15)
21
+    @ExcelProperty(value = "手机号", index = 1)
22
+    private String phone;
23
+
24
+    /**
25
+     * 意向楼盘
26
+     */
27
+    @ColumnWidth(15)
28
+    @ExcelProperty(value = "意向楼盘", index = 2)
29
+    private String buildingName;
30
+
31
+    /**
32
+     * 意向值
33
+     */
34
+    @ColumnWidth(15)
35
+    @ExcelProperty(value = "意向值", index = 3)
36
+    private Integer intention;
37
+
38
+}

+ 61
- 0
src/main/java/com/huiju/estateagents/excel/StatsBuilding.java Datei anzeigen

@@ -0,0 +1,61 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelIgnore;
4
+import com.alibaba.excel.annotation.ExcelProperty;
5
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
6
+import lombok.Data;
7
+
8
+@Data
9
+public class StatsBuilding {
10
+
11
+    /**
12
+     * 项目名称
13
+     */
14
+    @ColumnWidth(15)
15
+    @ExcelProperty(value = "项目名称", index = 0)
16
+    private String buildingName;
17
+
18
+    /**
19
+     * 新增客户 公客加私客
20
+     */
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "新增客户", index = 1)
23
+    private Integer khNum;
24
+
25
+    /**
26
+     * 公客
27
+     */
28
+    @ColumnWidth(15)
29
+    @ExcelProperty(value = "公客", index = 2)
30
+    private Integer gkNum;
31
+
32
+    /**
33
+     * 私客
34
+     */
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "私客", index = 3)
37
+    private Integer skNum;
38
+
39
+    /**
40
+     * 观看人数
41
+     */
42
+    @ColumnWidth(15)
43
+    @ExcelProperty(value = "访问人数", index = 4)
44
+    private Integer uvNum;
45
+
46
+    /**
47
+     * 观看次数
48
+     */
49
+    @ColumnWidth(15)
50
+    @ExcelProperty(value = "访问次数", index = 5)
51
+    private Integer pvNum;
52
+
53
+
54
+    @ExcelIgnore
55
+    private String buildingId;
56
+
57
+
58
+
59
+
60
+
61
+}

+ 52
- 0
src/main/java/com/huiju/estateagents/excel/StatsTimeBuilding.java Datei anzeigen

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

+ 89
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java Datei anzeigen

@@ -1,13 +1,16 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.huiju.estateagents.entity.TaBuilding;
5
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.huiju.estateagents.entity.TaPersonBuilding;
7
+import com.huiju.estateagents.excel.StatsBuilding;
8
+import com.huiju.estateagents.excel.StatsTimeBuilding;
7 9
 import org.apache.ibatis.annotations.Mapper;
8 10
 import org.apache.ibatis.annotations.Param;
9 11
 import org.apache.ibatis.annotations.Update;
10 12
 
13
+import java.time.LocalDate;
11 14
 import java.time.LocalDateTime;
12 15
 import java.util.List;
13 16
 import java.util.Map;
@@ -93,4 +96,89 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
93 96
     int countNumByHeavy(@Param("heavy") Integer heavy, @Param("dynamicId") String dynamicId);
94 97
 
95 98
     List<TaBuilding> selectMainBuildings(@Param("cityId") String cityId, @Param("orgId") Integer orgId);
99
+
100
+    /**
101
+     * 获取公客统计图数据
102
+     * @param orgId
103
+     * @param startDate
104
+     * @param endDate
105
+     * @param personBuildingList
106
+     * @return
107
+     */
108
+    List<Map<String, Object>> getGkBarData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
109
+
110
+    /**
111
+     * 获取私客统计图数据
112
+     * @param orgId
113
+     * @param startDate
114
+     * @param endDate
115
+     * @param personBuildingList
116
+     * @return
117
+     */
118
+    List<Map<String, Object>> getSkBarData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
119
+
120
+    /**
121
+     * 项目访问人数排行折线图获取
122
+     * @param orgId
123
+     * @param startDate
124
+     * @param endDate
125
+     * @param personBuildingList
126
+     * @return
127
+     */
128
+    List<Map<String, Object>> getWgBarData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
129
+
130
+    /**
131
+     * 项目访问次数排行折线图获取
132
+     * @param orgId
133
+     * @param startDate
134
+     * @param endDate
135
+     * @param personBuildingList
136
+     * @return
137
+     */
138
+    List<Map<String, Object>> getFwBarData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
139
+
140
+    /**
141
+     * 获取项目统计列表数据
142
+     * @param orgId
143
+     * @param startDate
144
+     * @param endDate
145
+     * @param buildingId
146
+     * @param personBuildingList
147
+     * @return
148
+     */
149
+    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sortField") String sortField,@Param("orderType") String orderType);
150
+
151
+    /**
152
+     * 获取导出的数据
153
+     * @param orgId
154
+     * @param startDate
155
+     * @param endDate
156
+     * @param buildingId
157
+     * @param personBuildingList
158
+     * @return
159
+     */
160
+    List<StatsBuilding> getExportTableList(@Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
161
+
162
+    /**
163
+     * 获取单独building的折线图数据
164
+     * @param orgId
165
+     * @param startDate
166
+     * @param endDate
167
+     * @param buildingId
168
+     * @return
169
+     */
170
+    List<StatsTimeBuilding> getStatsTimeBarList(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("buildingId") String buildingId);
171
+
172
+    /**
173
+     * 获取详情数据表格
174
+     * @param pg
175
+     * @param orgId
176
+     * @param startDate
177
+     * @param endDate
178
+     * @param buildingId
179
+     * @param sortField
180
+     * @param orderType
181
+     * @return
182
+     */
183
+    IPage<StatsTimeBuilding> getStatsTimeTableList(IPage<StatsTimeBuilding> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("buildingId") String buildingId,@Param("sortField") String sortField,@Param("orderType") String orderType);
96 184
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java Datei anzeigen

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.huiju.estateagents.entity.TaPersonBuilding;
7 7
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
8
+import com.huiju.estateagents.excel.IntentionUser;
8 9
 import org.apache.ibatis.annotations.Mapper;
9 10
 import org.apache.ibatis.annotations.Param;
10 11
 
@@ -35,4 +36,6 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
35 36
                                                    @Param("orgId") Integer orgId,
36 37
                                                    @Param("buildingId") String buildingId,
37 38
                                                    @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
39
+
40
+    List<IntentionUser> selectExportIntentionUser(@Param("orgId") Integer orgId,@Param("buildingId") String buildingId,@Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingListByUserId);
38 41
 }

+ 9
- 4
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Datei anzeigen

@@ -1,17 +1,15 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.huiju.estateagents.entity.TaChannel;
5 6
 import com.huiju.estateagents.entity.TaPerson;
6
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7 7
 import com.huiju.estateagents.entity.TaPersonPositon;
8 8
 import com.huiju.estateagents.po.PersonPO;
9
-import io.swagger.models.auth.In;
10 9
 import org.apache.ibatis.annotations.*;
11 10
 
12
-import java.io.Serializable;
13 11
 import java.time.LocalDate;
14
-import java.util.Date;
12
+import java.time.LocalDateTime;
15 13
 import java.util.List;
16 14
 import java.util.Map;
17 15
 
@@ -249,4 +247,11 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
249 247
      * @return
250 248
      */
251 249
     Integer savePersonPosition(TaPersonPositon record);
250
+
251
+    /**
252
+     * 今日新增人数
253
+     * @param orgId
254
+     * @return
255
+     */
256
+    Integer selectTodayRecentlyCount(@Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate);
252 257
 }

+ 90
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java Datei anzeigen

@@ -2,9 +2,11 @@ package com.huiju.estateagents.service;
2 2
 
3 3
 import com.huiju.estateagents.base.ResponseBean;
4 4
 import com.huiju.estateagents.entity.TaPersonBuilding;
5
+import com.huiju.estateagents.excel.IntentionUser;
6
+import com.huiju.estateagents.excel.StatsBuilding;
7
+import com.huiju.estateagents.excel.StatsTimeBuilding;
5 8
 
6 9
 import java.time.LocalDate;
7
-import java.util.Date;
8 10
 import java.util.List;
9 11
 
10 12
 /**
@@ -126,4 +128,91 @@ public interface IStatisticalService {
126 128
      * @return
127 129
      */
128 130
     ResponseBean selectPersonFromGroupByDay(Integer orgId, LocalDate startDate, LocalDate endDate);
131
+
132
+    /**
133
+     * 获取楼盘的折线图统计
134
+     * @param orgId
135
+     * @param startDate
136
+     * @param endDate
137
+     * @param taPersonBuildingListByUserId
138
+     * @return
139
+     */
140
+    ResponseBean getStatsBarList(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> taPersonBuildingListByUserId);
141
+
142
+    /**
143
+     * 获取楼盘统计所有数据
144
+     * @param orgId
145
+     * @param startDate
146
+     * @param endDate
147
+     * @param buildingId
148
+     * @param taPersonBuildingListByUserId
149
+     * @return
150
+     */
151
+    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,String sortField,String sortOrder);
152
+
153
+    /**
154
+     * 获取需要导出的数据
155
+     * @param orgId
156
+     * @param startDate
157
+     * @param endDate
158
+     * @param buildingId
159
+     * @param taPersonBuildingListByUserId
160
+     * @return
161
+     */
162
+    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
163
+
164
+    /**
165
+     * 按时间获取此楼盘的数据折线图
166
+     * @param orgId
167
+     * @param startDate
168
+     * @param endDate
169
+     * @param buildingId
170
+     * @param taPersonBuildingListByUserId
171
+     * @return
172
+     */
173
+    ResponseBean getStatsTimeBarList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
174
+
175
+    /**
176
+     * 分页统计楼盘详情数据
177
+     * @param pageNum
178
+     * @param pageSize
179
+     * @param orgId
180
+     * @param startDate
181
+     * @param endDate
182
+     * @param buildingId
183
+     * @param taPersonBuildingListByUserId
184
+     * @param sortField
185
+     * @param sortOrder
186
+     * @return
187
+     */
188
+    ResponseBean getStatsTimeTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId, String sortField, String sortOrder);
189
+
190
+    /**
191
+     * 项目详情统计
192
+     * @param orgId
193
+     * @param startDate
194
+     * @param endDate
195
+     * @param buildingId
196
+     * @param taPersonBuildingListByUserId
197
+     * @return
198
+     */
199
+    List<StatsTimeBuilding> getExportTimeTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
200
+
201
+    /**
202
+     * 意向客户导出
203
+     * @param orgId
204
+     * @param buildingId
205
+     * @param taPersonBuildingListByUserId
206
+     * @return
207
+     */
208
+    List<IntentionUser> getExportIntentionUser(Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
209
+
210
+    /**
211
+     * 新调整--新增用户
212
+     * @param orgId
213
+     * @param startDate
214
+     * @param endDate
215
+     * @return
216
+     */
217
+    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate);
129 218
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java Datei anzeigen

@@ -1,8 +1,8 @@
1 1
 package com.huiju.estateagents.service;
2 2
 
3
+import com.baomidou.mybatisplus.extension.service.IService;
3 4
 import com.huiju.estateagents.base.ResponseBean;
4 5
 import com.huiju.estateagents.entity.TaBuilding;
5
-import com.baomidou.mybatisplus.extension.service.IService;
6 6
 import com.huiju.estateagents.entity.TaPerson;
7 7
 import com.huiju.estateagents.entity.TaPersonBuilding;
8 8
 

+ 265
- 4
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Datei anzeigen

@@ -8,7 +8,9 @@ import com.huiju.estateagents.common.CommConstant;
8 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
9 9
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
10 10
 import com.huiju.estateagents.entity.TdWxDict;
11
-import com.huiju.estateagents.exception.EstaException;
11
+import com.huiju.estateagents.excel.IntentionUser;
12
+import com.huiju.estateagents.excel.StatsBuilding;
13
+import com.huiju.estateagents.excel.StatsTimeBuilding;
12 14
 import com.huiju.estateagents.mapper.*;
13 15
 import com.huiju.estateagents.po.PersonPO;
14 16
 import com.huiju.estateagents.service.IStatisticalService;
@@ -22,7 +24,10 @@ import java.time.LocalDate;
22 24
 import java.time.LocalDateTime;
23 25
 import java.time.format.DateTimeFormatter;
24 26
 import java.time.temporal.ChronoUnit;
25
-import java.util.*;
27
+import java.util.ArrayList;
28
+import java.util.HashMap;
29
+import java.util.List;
30
+import java.util.Map;
26 31
 import java.util.stream.Collectors;
27 32
 import java.util.stream.Stream;
28 33
 
@@ -71,8 +76,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
71 76
         // 注册数
72 77
         Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId);
73 78
 
74
-        // 最近七天
75
-        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
79
+        // 最近七天--> 调整为今日新增
80
+        Integer selectRecentlyCount = taPersonMapper.selectTodayRecentlyCount(orgId, LocalDateTime.now());
76 81
 
77 82
         // -------  用户来源 end ------------
78 83
 
@@ -402,4 +407,260 @@ public class StatisticalServiceImpl implements IStatisticalService {
402 407
         });
403 408
         return dataList;
404 409
     }
410
+
411
+    /**
412
+     * 获取楼盘的折线图统计
413
+     *
414
+     * @param orgId
415
+     * @param startDate
416
+     * @param endDate
417
+     * @param personBuildingList
418
+     * @return
419
+     */
420
+    @Override
421
+    public ResponseBean getStatsBarList(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> personBuildingList) {
422
+        Map<String,Object> map = new HashMap<>();
423
+        //项目公客排行折线图获取
424
+        Map<String,Object> gkBarMap = getGkBarData(orgId,startDate,endDate,personBuildingList);
425
+        map.put("gkBarMap",gkBarMap);
426
+
427
+        //项目私客排行折线图获取
428
+        Map<String,Object> skBarMap = getSkBarData(orgId,startDate,endDate,personBuildingList);
429
+        map.put("skBarMap",skBarMap);
430
+
431
+        //项目访问人数排行折线图获取
432
+        Map<String,Object> wgBarMap = getWgBarData(orgId,startDate,endDate,personBuildingList);
433
+        map.put("wgBarMap",wgBarMap);
434
+
435
+        //项目访问次数排行折线图获取
436
+        Map<String,Object> fwBarMap = getFwBarData(orgId,startDate,endDate,personBuildingList);
437
+        map.put("fwBarMap",fwBarMap);
438
+
439
+        return ResponseBean.success(map);
440
+    }
441
+
442
+    /**
443
+     * 获取楼盘统计所有数据
444
+     *
445
+     * @param orgId
446
+     * @param startDate
447
+     * @param endDate
448
+     * @param buildingId
449
+     * @param personBuildingList
450
+     * @return
451
+     */
452
+    @Override
453
+    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,String sortField,String sortOrder) {
454
+        String orderType = "asc";
455
+        if ("descend".equals(sortOrder)){
456
+            orderType = "desc";
457
+        }else if ("ascend".equals(sortOrder)){
458
+            orderType = "asc";
459
+        }
460
+        IPage<StatsBuilding> pg = new Page<>(pageNum, pageSize);
461
+        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList,sortField,orderType);
462
+        return ResponseBean.success(page);
463
+    }
464
+
465
+    /**
466
+     * 获取需要导出的数据
467
+     *
468
+     * @param orgId
469
+     * @param startDate
470
+     * @param endDate
471
+     * @param buildingId
472
+     * @param personBuildingList
473
+     * @return
474
+     */
475
+    @Override
476
+    public List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList) {
477
+        return taBuildingMapper.getExportTableList(orgId, startDate, endDate, buildingId, personBuildingList);
478
+    }
479
+
480
+    /**
481
+     * 按时间获取此楼盘的数据折线图
482
+     *
483
+     * @param orgId
484
+     * @param startDate
485
+     * @param endDate
486
+     * @param buildingId
487
+     * @param taPersonBuildingListByUserId
488
+     * @return
489
+     */
490
+    @Override
491
+    public ResponseBean getStatsTimeBarList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
492
+        Map<String,Object> map = new HashMap<>();
493
+        List<StatsTimeBuilding> list = taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId);
494
+        //日期维度
495
+        List<String> timeList = list.stream().map(StatsTimeBuilding::getCreateDate).collect(Collectors.toList());
496
+        //公客维度
497
+        List<Integer> gkList = list.stream().map(StatsTimeBuilding::getGkNum).collect(Collectors.toList());
498
+        //私客维度
499
+        List<Integer> skList = list.stream().map(StatsTimeBuilding::getSkNum).collect(Collectors.toList());
500
+        //新增客户维度
501
+        List<Integer> khList = list.stream().map(StatsTimeBuilding::getKhNum).collect(Collectors.toList());
502
+        //访问人数维度
503
+        List<Integer> uvList = list.stream().map(StatsTimeBuilding::getUvNum).collect(Collectors.toList());
504
+        map.put("list",list);
505
+        map.put("timeList",timeList);
506
+        map.put("gkList",gkList);
507
+        map.put("skList",skList);
508
+        map.put("khList",khList);
509
+        map.put("uvList",uvList);
510
+        return ResponseBean.success(map);
511
+    }
512
+
513
+    /**
514
+     * 分页统计楼盘详情数据
515
+     *
516
+     * @param pageNum
517
+     * @param pageSize
518
+     * @param orgId
519
+     * @param startDate
520
+     * @param endDate
521
+     * @param buildingId
522
+     * @param taPersonBuildingListByUserId
523
+     * @param sortField
524
+     * @param sortOrder
525
+     * @return
526
+     */
527
+    @Override
528
+    public ResponseBean getStatsTimeTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId, String sortField, String sortOrder) {
529
+        String orderType = "asc";
530
+        if ("descend".equals(sortOrder)){
531
+            orderType = "desc";
532
+        }else if ("ascend".equals(sortOrder)){
533
+            orderType = "asc";
534
+        }
535
+        IPage<StatsTimeBuilding> pg = new Page<>(pageNum, pageSize);
536
+        IPage<StatsTimeBuilding> page = taBuildingMapper.getStatsTimeTableList(pg, orgId, startDate, endDate, buildingId,sortField,orderType);
537
+        return ResponseBean.success(page);
538
+    }
539
+
540
+    /**
541
+     * 项目详情统计
542
+     *
543
+     * @param orgId
544
+     * @param startDate
545
+     * @param endDate
546
+     * @param buildingId
547
+     * @param taPersonBuildingListByUserId
548
+     * @return
549
+     */
550
+    @Override
551
+    public List<StatsTimeBuilding> getExportTimeTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
552
+        return taBuildingMapper.getStatsTimeBarList(orgId,startDate,endDate,buildingId);
553
+    }
554
+
555
+    /**
556
+     * 意向客户导出
557
+     *
558
+     * @param orgId
559
+     * @param buildingId
560
+     * @param taPersonBuildingListByUserId
561
+     * @return
562
+     */
563
+    @Override
564
+    public List<IntentionUser> getExportIntentionUser(Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
565
+        return taPersonIntentionRecordMapper.selectExportIntentionUser(orgId, buildingId, taPersonBuildingListByUserId);
566
+    }
567
+
568
+    /**
569
+     * 新调整--新增用户
570
+     *
571
+     * @param orgId
572
+     * @param startDate
573
+     * @param endDate
574
+     * @return
575
+     */
576
+    @Override
577
+    public ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
578
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectNewLinePersonFromGroupByData(orgId, startDate, endDate);
579
+        return ResponseBean.success(tableList);
580
+    }
581
+
582
+    /**
583
+     * 项目公客排行折线图获取
584
+     * @param orgId
585
+     * @param startDate
586
+     * @param endDate
587
+     * @param personBuildingList
588
+     * @return
589
+     */
590
+    private Map<String, Object> getGkBarData(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> personBuildingList) {
591
+        Map<String,Object> map = new HashMap<>();
592
+        List<Map<String, Object>> gkBarData = taBuildingMapper.getGkBarData(orgId, startDate, endDate, personBuildingList);
593
+        if (gkBarData.size() > 0){
594
+            map.put("data",gkBarData);
595
+            List<Object> buildingNameList = gkBarData.stream().map(x -> x.get("buildingName")).collect(Collectors.toList());
596
+            map.put("buildingNameList",buildingNameList);
597
+            List<Object> gkNumList = gkBarData.stream().map(x -> x.get("gkNum")).collect(Collectors.toList());
598
+            map.put("numList",gkNumList);
599
+        }
600
+        return map;
601
+    }
602
+
603
+    /**
604
+     * 项目私客排行折线图获取
605
+     * @param orgId
606
+     * @param startDate
607
+     * @param endDate
608
+     * @param personBuildingList
609
+     * @return
610
+     */
611
+    private Map<String, Object> getSkBarData(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> personBuildingList) {
612
+        Map<String,Object> map = new HashMap<>();
613
+        List<Map<String, Object>> skBarData = taBuildingMapper.getSkBarData(orgId, startDate, endDate, personBuildingList);
614
+        if (skBarData.size() > 0){
615
+            map.put("data",skBarData);
616
+            List<Object> buildingNameList = skBarData.stream().map(x -> x.get("buildingName")).collect(Collectors.toList());
617
+            map.put("buildingNameList",buildingNameList);
618
+            List<Object> gkNumList = skBarData.stream().map(x -> x.get("skNum")).collect(Collectors.toList());
619
+            map.put("numList",gkNumList);
620
+        }
621
+        return map;
622
+    }
623
+
624
+
625
+    /**
626
+     * 项目访问人数排行折线图获取
627
+     * @param orgId
628
+     * @param startDate
629
+     * @param endDate
630
+     * @param personBuildingList
631
+     * @return
632
+     */
633
+    private Map<String, Object> getWgBarData(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> personBuildingList) {
634
+        Map<String,Object> map = new HashMap<>();
635
+        List<Map<String, Object>> wgBarData = taBuildingMapper.getWgBarData(orgId, startDate, endDate, personBuildingList);
636
+        if (wgBarData.size() > 0){
637
+            map.put("data",wgBarData);
638
+            List<Object> buildingNameList = wgBarData.stream().map(x -> x.get("buildingName")).collect(Collectors.toList());
639
+            map.put("buildingNameList",buildingNameList);
640
+            List<Object> gkNumList = wgBarData.stream().map(x -> x.get("wgNum")).collect(Collectors.toList());
641
+            map.put("numList",gkNumList);
642
+        }
643
+        return map;
644
+    }
645
+
646
+    /**
647
+     * 项目访问次数排行折线图获取
648
+     * @param orgId
649
+     * @param startDate
650
+     * @param endDate
651
+     * @param personBuildingList
652
+     * @return
653
+     */
654
+    private Map<String, Object> getFwBarData(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> personBuildingList) {
655
+        Map<String,Object> map = new HashMap<>();
656
+        List<Map<String, Object>> fwBarData = taBuildingMapper.getFwBarData(orgId, startDate, endDate, personBuildingList);
657
+        if (fwBarData.size() > 0){
658
+            map.put("data",fwBarData);
659
+            List<Object> buildingNameList = fwBarData.stream().map(x -> x.get("buildingName")).collect(Collectors.toList());
660
+            map.put("buildingNameList",buildingNameList);
661
+            List<Object> gkNumList = fwBarData.stream().map(x -> x.get("pvNum")).collect(Collectors.toList());
662
+            map.put("numList",gkNumList);
663
+        }
664
+        return map;
665
+    }
405 666
 }

+ 1
- 4
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Datei anzeigen

@@ -6,18 +6,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7 7
 import com.baomidou.mybatisplus.core.metadata.IPage;
8 8
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
-import com.google.common.collect.Lists;
9
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10 10
 import com.huiju.estateagents.base.ResponseBean;
11 11
 import com.huiju.estateagents.center.taUser.entity.TaUser;
12 12
 import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
13 13
 import com.huiju.estateagents.common.CommConstant;
14
-import com.huiju.estateagents.common.DateUtils;
15 14
 import com.huiju.estateagents.common.StringUtils;
16 15
 import com.huiju.estateagents.entity.*;
17 16
 import com.huiju.estateagents.mapper.*;
18 17
 import com.huiju.estateagents.service.*;
19
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
20
-import javafx.scene.control.Tab;
21 18
 import org.apache.commons.collections.CollectionUtils;
22 19
 import org.springframework.beans.factory.annotation.Autowired;
23 20
 import org.springframework.stereotype.Service;

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/mapper/TsPersonFromStatisticMapper.java Datei anzeigen

@@ -28,4 +28,6 @@ public interface TsPersonFromStatisticMapper extends BaseMapper<TsPersonFromStat
28 28
     List<TsPersonFromStatistic> selectPersonFromGroupByData(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
29 29
 
30 30
     void deleteByData();
31
+
32
+    List<TsPersonFromStatistic> selectNewLinePersonFromGroupByData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
31 33
 }

+ 474
- 0
src/main/resources/mapper/TaBuildingMapper.xml Datei anzeigen

@@ -257,4 +257,478 @@
257 257
         ORDER BY t.order_no desc
258 258
     </select>
259 259
 
260
+    <select id="getGkBarData" resultType="java.util.Map">
261
+        SELECT
262
+            count( * ) AS gk_num,
263
+            bb.building_id,
264
+            bb.create_date,
265
+            bb.building_name
266
+        FROM
267
+        (
268
+            SELECT
269
+                b.*,
270
+                d.building_name
271
+            FROM
272
+                ta_person b
273
+            LEFT JOIN ta_building d ON b.building_id = d.building_id
274
+            WHERE
275
+                b.STATUS > 0
276
+                AND b.org_id = #{orgId}
277
+                AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
278
+                AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = #{orgId} AND person_id IS NOT NULL AND person_id != '' )
279
+                <if test="personBuildingList != null and personBuildingList.size > 0">
280
+                    AND b.building_id in
281
+                    <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
282
+                        #{personBuilding.buildingId}
283
+                    </foreach>
284
+                </if>
285
+                <if test="startDate != null">
286
+                    and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
287
+                </if>
288
+                <if test="endDate != null">
289
+                    and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
290
+                </if>
291
+                and b.building_id is not null
292
+            GROUP BY
293
+            b.person_id
294
+        ) bb
295
+        GROUP BY
296
+            bb.building_id
297
+        order by gk_num desc
298
+        limit 6
299
+    </select>
300
+
301
+    <select id="getSkBarData" resultType="java.util.Map">
302
+        SELECT
303
+            count( * ) AS sk_num,
304
+            a.building_id,
305
+            d.building_name
306
+        FROM
307
+            ta_recommend_customer a
308
+        LEFT JOIN ta_building d ON a.building_id = d.building_id
309
+        WHERE
310
+            a.STATUS > 0
311
+            AND a.verify_status = 1
312
+            AND a.realty_consultant IS NOT NULL
313
+            AND a.realty_consultant != ''
314
+            AND a.org_id = #{orgId}
315
+            <if test="personBuildingList != null and personBuildingList.size > 0">
316
+                AND a.building_id in
317
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
318
+                    #{personBuilding.buildingId}
319
+                </foreach>
320
+            </if>
321
+            <if test="startDate != null">
322
+                and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
323
+            </if>
324
+            <if test="endDate != null">
325
+                and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
326
+            </if>
327
+        GROUP BY
328
+        a.building_id
329
+        ORDER BY
330
+        sk_num DESC
331
+        LIMIT 6
332
+    </select>
333
+
334
+    <select id="getWgBarData" resultType="java.util.Map">
335
+        SELECT
336
+            count( * ) AS wg_num,
337
+            a.be_uv AS building_id,
338
+            a.create_date,
339
+            d.building_name
340
+        FROM
341
+            ta_uv a
342
+        LEFT JOIN ta_building d ON a.be_uv = d.building_id
343
+        LEFT JOIN ta_person p ON a.person_id = p.person_id
344
+        WHERE
345
+            a.tagert_type = 'project'
346
+            and p.org_id = #{orgId}
347
+            and a.be_uv != "undefined"
348
+            <if test="personBuildingList != null and personBuildingList.size > 0">
349
+                AND a.be_uv in
350
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
351
+                    #{personBuilding.buildingId}
352
+                </foreach>
353
+            </if>
354
+            <if test="startDate != null">
355
+                and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
356
+            </if>
357
+            <if test="endDate != null">
358
+                and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
359
+            </if>
360
+        GROUP BY
361
+            a.be_uv
362
+        ORDER BY
363
+            wg_num DESC
364
+        LIMIT 6
365
+    </select>
366
+
367
+    <select id="getFwBarData" resultType="java.util.Map">
368
+        SELECT
369
+            t.pv_num,
370
+            t.building_id,
371
+            t.building_name
372
+        FROM
373
+            ta_building t
374
+        WHERE
375
+            t.org_id = #{orgId}
376
+        <if test="personBuildingList != null and personBuildingList.size > 0">
377
+            AND a.be_uv in
378
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
379
+                #{personBuilding.buildingId}
380
+            </foreach>
381
+        </if>
382
+        ORDER BY
383
+        pv_num DESC
384
+        LIMIT 6
385
+    </select>
386
+
387
+    <select id="getStatsTableList" resultType="com.huiju.estateagents.excel.StatsBuilding">
388
+        SELECT
389
+            t.building_id,
390
+            t.building_name,
391
+            IFNULL( t.pv_num, 0 ) AS pv_num,
392
+            IFNULL( uu.uv_num, 0 ) AS uv_num,
393
+            IFNULL( aa.sk_num, 0 ) AS sk_num,
394
+            IFNULL( bbb.gk_num, 0 ) AS gk_num,
395
+            IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
396
+        FROM
397
+            ta_building t
398
+        LEFT JOIN (
399
+            SELECT
400
+                count( * ) AS sk_num,
401
+                a.building_id
402
+            FROM
403
+                ta_recommend_customer a
404
+            WHERE
405
+                a.STATUS > 0
406
+                AND a.verify_status = 1
407
+                AND a.realty_consultant IS NOT NULL
408
+                AND a.realty_consultant != ''
409
+                AND a.org_id = #{orgId}
410
+                <if test="startDate != null">
411
+                    and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
412
+                </if>
413
+                <if test="endDate != null">
414
+                    and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
415
+                </if>
416
+            GROUP BY
417
+                a.building_id
418
+        ) aa ON aa.building_id = t.building_id
419
+        LEFT JOIN (
420
+            SELECT
421
+                count( * ) AS gk_num,
422
+                bb.building_id
423
+            FROM
424
+            (
425
+                SELECT
426
+                    b.*
427
+                FROM
428
+                    ta_person b
429
+                WHERE
430
+                    b.STATUS > 0
431
+                    AND b.org_id = #{orgId}
432
+                    AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
433
+                    AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
434
+                    <if test="startDate != null">
435
+                        and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
436
+                    </if>
437
+                    <if test="endDate != null">
438
+                        and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
439
+                    </if>
440
+                GROUP BY
441
+                    b.person_id
442
+            ) bb
443
+            GROUP BY
444
+                bb.building_id
445
+        ) bbb ON bbb.building_id = t.building_id
446
+        LEFT JOIN (
447
+            SELECT
448
+                count( * ) AS uv_num,
449
+                u.be_uv AS building_id
450
+            FROM
451
+                ta_uv u
452
+            WHERE
453
+                u.tagert_type = 'project'
454
+            <if test="startDate != null">
455
+                and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
456
+            </if>
457
+            <if test="endDate != null">
458
+                and  TO_DAYS(u.create_date) &lt;= TO_DAYS(#{endDate})
459
+            </if>
460
+            GROUP BY
461
+                u.be_uv
462
+        ) uu ON uu.building_id = t.building_id
463
+        WHERE
464
+        t.org_id = #{orgId}
465
+        <if test="personBuildingList != null and personBuildingList.size > 0">
466
+            AND t.building_id in
467
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
468
+                #{personBuilding.buildingId}
469
+            </foreach>
470
+        </if>
471
+        <if test="buildingId != null and buildingId != '' ">
472
+            AND t.building_id = #{buildingId}
473
+        </if>
474
+        <if test="sortField != null and sortField != ''">
475
+            ORDER BY ${sortField} ${orderType}
476
+        </if>
477
+    </select>
478
+    <select id="getExportTableList" resultType="com.huiju.estateagents.excel.StatsBuilding">
479
+        SELECT
480
+        t.building_id,
481
+        t.building_name,
482
+        IFNULL( t.pv_num, 0 ) AS pv_num,
483
+        IFNULL( uu.uv_num, 0 ) AS uv_num,
484
+        IFNULL( aa.sk_num, 0 ) AS sk_num,
485
+        IFNULL( bbb.gk_num, 0 ) AS gk_num,
486
+        IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
487
+        FROM
488
+        ta_building t
489
+        LEFT JOIN (
490
+        SELECT
491
+        count( * ) AS sk_num,
492
+        a.building_id
493
+        FROM
494
+        ta_recommend_customer a
495
+        WHERE
496
+        a.STATUS > 0
497
+        AND a.verify_status = 1
498
+        AND a.realty_consultant IS NOT NULL
499
+        AND a.realty_consultant != ''
500
+        AND a.org_id = #{orgId}
501
+        <if test="startDate != null">
502
+            and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
503
+        </if>
504
+        <if test="endDate != null">
505
+            and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
506
+        </if>
507
+        GROUP BY
508
+        a.building_id
509
+        ) aa ON aa.building_id = t.building_id
510
+        LEFT JOIN (
511
+        SELECT
512
+        count( * ) AS gk_num,
513
+        bb.building_id
514
+        FROM
515
+        (
516
+        SELECT
517
+        b.*
518
+        FROM
519
+        ta_person b
520
+        WHERE
521
+        b.STATUS > 0
522
+        AND b.org_id = #{orgId}
523
+        AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
524
+        AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
525
+        <if test="startDate != null">
526
+            and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
527
+        </if>
528
+        <if test="endDate != null">
529
+            and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
530
+        </if>
531
+        GROUP BY
532
+        b.person_id
533
+        ) bb
534
+        GROUP BY
535
+        bb.building_id
536
+        ) bbb ON bbb.building_id = t.building_id
537
+        LEFT JOIN (
538
+        SELECT
539
+        count( * ) AS uv_num,
540
+        u.be_uv AS building_id
541
+        FROM
542
+        ta_uv u
543
+        WHERE
544
+        u.tagert_type = 'project'
545
+        <if test="startDate != null">
546
+            and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
547
+        </if>
548
+        <if test="endDate != null">
549
+            and  TO_DAYS(u.create_date) &lt;= TO_DAYS(#{endDate})
550
+        </if>
551
+        GROUP BY
552
+        u.be_uv
553
+        ) uu ON uu.building_id = t.building_id
554
+        WHERE
555
+        t.org_id = #{orgId}
556
+        <if test="personBuildingList != null and personBuildingList.size > 0">
557
+            AND t.building_id in
558
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
559
+                #{personBuilding.buildingId}
560
+            </foreach>
561
+        </if>
562
+        <if test="buildingId != null and buildingId != '' ">
563
+            AND t.building_id = #{buildingId}
564
+        </if>
565
+    </select>
566
+    <select id="getStatsTimeBarList" resultType="com.huiju.estateagents.excel.StatsTimeBuilding">
567
+        SELECT
568
+            t.date as create_date,
569
+            IFNULL( s.sk_num, 0 ) AS sk_num,
570
+            IFNULL( g.gk_num, 0 ) AS gk_num,
571
+            IFNULL( u.uv_num, 0 ) AS uv_num,
572
+            IFNULL( s.sk_num, 0 ) + IFNULL( g.gk_num, 0 ) AS kh_num
573
+        FROM
574
+        (
575
+            SELECT
576
+            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
577
+            FROM
578
+            sequence a
579
+            WHERE
580
+            a.rownum &lt;= datediff( #{endDate}, #{startDate} )
581
+        ) t
582
+        LEFT JOIN (
583
+            SELECT
584
+                count( * ) AS sk_num,
585
+                a.building_id,
586
+                DATE_FORMAT( a.create_date, '%Y-%m-%d' ) AS create_date
587
+            FROM
588
+                ta_recommend_customer a
589
+            WHERE
590
+                a.STATUS > 0
591
+                AND a.verify_status = 1
592
+                AND a.realty_consultant IS NOT NULL
593
+                AND a.realty_consultant != ''
594
+                AND a.org_id = #{orgId}
595
+                AND a.building_id = #{buildingId}
596
+                <if test="startDate != null">
597
+                    and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
598
+                </if>
599
+                <if test="endDate != null">
600
+                    and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
601
+                </if>
602
+            GROUP BY
603
+                DATE_FORMAT( a.create_date, '%Y-%m-%d' )
604
+        ) s ON t.date = s.create_date
605
+        LEFT JOIN (
606
+            SELECT
607
+                count( * ) AS gk_num,
608
+                b.building_id,
609
+                DATE_FORMAT( b.create_date, '%Y-%m-%d' ) AS create_date
610
+            FROM
611
+                ta_person b
612
+            WHERE
613
+                b.STATUS > 0
614
+                AND b.org_id = #{orgId}
615
+                AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
616
+                AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
617
+                AND b.building_id = #{buildingId}
618
+                <if test="startDate != null">
619
+                    and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
620
+                </if>
621
+                <if test="endDate != null">
622
+                    and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
623
+                </if>
624
+            GROUP BY
625
+                b.person_id,
626
+                DATE_FORMAT( b.create_date, '%Y-%m-%d' )
627
+        ) g ON t.date = g.create_date
628
+        LEFT JOIN (
629
+            SELECT
630
+                count( * ) AS uv_num,
631
+                be_uv AS building_id,
632
+                DATE_FORMAT( create_date, '%Y-%m-%d' ) AS create_date
633
+            FROM
634
+                ta_uv
635
+            WHERE
636
+                tagert_type = 'project'
637
+                AND be_uv = #{buildingId}
638
+                <if test="startDate != null">
639
+                    and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
640
+                </if>
641
+                <if test="endDate != null">
642
+                    and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
643
+                </if>
644
+            GROUP BY
645
+                DATE_FORMAT( create_date, '%Y-%m-%d' )
646
+        ) u ON t.date = u.create_date
647
+    </select>
648
+    <select id="getStatsTimeTableList" resultType="com.huiju.estateagents.excel.StatsTimeBuilding">
649
+        SELECT
650
+        t.date as create_date,
651
+        IFNULL( s.sk_num, 0 ) AS sk_num,
652
+        IFNULL( g.gk_num, 0 ) AS gk_num,
653
+        IFNULL( u.uv_num, 0 ) AS uv_num,
654
+        IFNULL( s.sk_num, 0 ) + IFNULL( g.gk_num, 0 ) AS kh_num
655
+        FROM
656
+        (
657
+        SELECT
658
+        DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
659
+        FROM
660
+        sequence a
661
+        WHERE
662
+        a.rownum &lt;= datediff( #{endDate}, #{startDate} )
663
+        ) t
664
+        LEFT JOIN (
665
+        SELECT
666
+        count( * ) AS sk_num,
667
+        a.building_id,
668
+        DATE_FORMAT( a.create_date, '%Y-%m-%d' ) AS create_date
669
+        FROM
670
+        ta_recommend_customer a
671
+        WHERE
672
+        a.STATUS > 0
673
+        AND a.verify_status = 1
674
+        AND a.realty_consultant IS NOT NULL
675
+        AND a.realty_consultant != ''
676
+        AND a.org_id = #{orgId}
677
+        AND a.building_id = #{buildingId}
678
+        <if test="startDate != null">
679
+            and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
680
+        </if>
681
+        <if test="endDate != null">
682
+            and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
683
+        </if>
684
+        GROUP BY
685
+        DATE_FORMAT( a.create_date, '%Y-%m-%d' )
686
+        ) s ON t.date = s.create_date
687
+        LEFT JOIN (
688
+        SELECT
689
+        count( * ) AS gk_num,
690
+        b.building_id,
691
+        DATE_FORMAT( b.create_date, '%Y-%m-%d' ) AS create_date
692
+        FROM
693
+        ta_person b
694
+        WHERE
695
+        b.STATUS > 0
696
+        AND b.org_id = #{orgId}
697
+        AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
698
+        AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
699
+        AND b.building_id = #{buildingId}
700
+        <if test="startDate != null">
701
+            and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
702
+        </if>
703
+        <if test="endDate != null">
704
+            and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
705
+        </if>
706
+        GROUP BY
707
+        b.person_id,
708
+        DATE_FORMAT( b.create_date, '%Y-%m-%d' )
709
+        ) g ON t.date = g.create_date
710
+        LEFT JOIN (
711
+        SELECT
712
+        count( * ) AS uv_num,
713
+        be_uv AS building_id,
714
+        DATE_FORMAT( create_date, '%Y-%m-%d' ) AS create_date
715
+        FROM
716
+        ta_uv
717
+        WHERE
718
+        tagert_type = 'project'
719
+        AND be_uv = #{buildingId}
720
+        <if test="startDate != null">
721
+            and  TO_DAYS(create_date) >= TO_DAYS(#{startDate})
722
+        </if>
723
+        <if test="endDate != null">
724
+            and  TO_DAYS(create_date) &lt;= TO_DAYS(#{endDate})
725
+        </if>
726
+        GROUP BY
727
+        DATE_FORMAT( create_date, '%Y-%m-%d' )
728
+        ) u ON t.date = u.create_date
729
+        <if test="sortField != null and sortField != ''">
730
+            ORDER BY ${sortField} ${orderType}
731
+        </if>
732
+    </select>
733
+
260 734
 </mapper>

+ 28
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml Datei anzeigen

@@ -42,4 +42,32 @@
42 42
             tpir.person_id, tpir.building_id
43 43
         ORDER BY SUM(tpir.intention) DESC
44 44
     </select>
45
+    <select id="selectExportIntentionUser" resultType="com.huiju.estateagents.excel.IntentionUser">
46
+        SELECT
47
+        tpir.person_name as  person_name,
48
+        tp.phone as phone,
49
+        tpir.building_name as building_name,
50
+        SUM(tpir.intention) as intention
51
+        FROM
52
+        ta_person_intention_record tpir
53
+        LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
54
+        <trim prefix="where" prefixOverrides="and | or">
55
+            <if test="buildingId != null and buildingId != ''">
56
+                tpir.building_id = #{buildingId}
57
+            </if>
58
+            <if test="orgId != null">
59
+                AND tpir.org_id = #{orgId}
60
+                AND tp.org_id = #{orgId}
61
+            </if>
62
+            <if test="personBuildingList != null and personBuildingList.size > 0">
63
+                AND tpir.building_id in
64
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
65
+                    #{personBuilding.buildingId}
66
+                </foreach>
67
+            </if>
68
+        </trim>
69
+        GROUP BY
70
+        tpir.person_id, tpir.building_id
71
+        ORDER BY SUM(tpir.intention) DESC
72
+    </select>
45 73
 </mapper>

+ 9
- 0
src/main/resources/mapper/TaPersonMapper.xml Datei anzeigen

@@ -605,6 +605,15 @@ FROM
605 605
             </if>
606 606
                 GROUP BY t.person_id) d
607 607
     </select>
608
+    <select id="selectTodayRecentlyCount" resultType="java.lang.Integer">
609
+        SELECT
610
+            COUNT(1) as activity_count
611
+        FROM
612
+        ta_person tp
613
+        where tp.org_id = #{orgId} AND
614
+        tp.person_type IN ('customer','drift','estate agent')
615
+        AND DATE_FORMAT(tp.create_date,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
616
+    </select>
608 617
 
609 618
     <insert id="savePersonPosition" parameterType="com.huiju.estateagents.entity.TaPersonPositon">
610 619
         insert into ta_person_position

+ 23
- 0
src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml Datei anzeigen

@@ -66,4 +66,27 @@
66 66
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' ),
67 67
         tp.scene_type
68 68
     </select>
69
+    <select id="selectNewLinePersonFromGroupByData"
70
+            resultType="com.huiju.estateagents.statistic.entity.TsPersonFromStatistic">
71
+        SELECT
72
+        sum( tp.from_num ) AS from_num,
73
+        sum( tp.registered_num ) AS registered_num,
74
+        DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) AS create_time,
75
+        tp.scene_type
76
+        FROM
77
+        ts_person_from_statistic tp
78
+        WHERE
79
+        tp.org_id = #{orgId}
80
+        and tp.scene_type != ''
81
+        and tp.scene_type is not null
82
+        <if test="startDate != null or endDate != null">
83
+            AND  DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN #{startDate} and #{endDate}
84
+        </if>
85
+        <if test="startDate == null or endDate == null">
86
+            AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
87
+        </if>
88
+        GROUP BY
89
+        DATE_FORMAT( tp.create_date, '%Y-%m-%d' )
90
+        ORDER BY tp.create_date
91
+    </select>
69 92
 </mapper>