Преглед изворни кода

Merge branch 'dev'

# Conflicts:
#	src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
#	src/main/resources/mapper/TaShareMapper.xml
顾绍勇 пре 5 година
родитељ
комит
7b1fd71382
100 измењених фајлова са 6459 додато и 615 уклоњено
  1. 1
    1
      pom.xml
  2. 44
    0
      src/main/java/com/huiju/estateagents/bo/request/ActivityStatisticResponseBO.java
  3. 16
    12
      src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java
  4. 3
    0
      src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java
  5. 4
    0
      src/main/java/com/huiju/estateagents/center/taUser/mapper/TaUserMapper.java
  6. 18
    3
      src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java
  7. 38
    0
      src/main/java/com/huiju/estateagents/common/ExcelUtils.java
  8. 25
    0
      src/main/java/com/huiju/estateagents/common/StringUtils.java
  9. 65
    0
      src/main/java/com/huiju/estateagents/controller/ActivityManageController.java
  10. 2
    8
      src/main/java/com/huiju/estateagents/controller/ExtendContentController.java
  11. 86
    75
      src/main/java/com/huiju/estateagents/controller/MiniAppController.java
  12. 226
    1
      src/main/java/com/huiju/estateagents/controller/StatisticalController.java
  13. 1
    6
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  14. 3
    10
      src/main/java/com/huiju/estateagents/controller/TaBuildingReportController.java
  15. 149
    0
      src/main/java/com/huiju/estateagents/controller/TaCustomerFromController.java
  16. 2
    2
      src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java
  17. 326
    233
      src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
  18. 1
    0
      src/main/java/com/huiju/estateagents/controller/TaSalesBatchController.java
  19. 1
    0
      src/main/java/com/huiju/estateagents/controller/TaSharePersonFromController.java
  20. 14
    11
      src/main/java/com/huiju/estateagents/controller/TdCityController.java
  21. 1
    0
      src/main/java/com/huiju/estateagents/controller/TdPointsRulesController.java
  22. 105
    0
      src/main/java/com/huiju/estateagents/controller/TsActivityDailyController.java
  23. 470
    0
      src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java
  24. 9
    12
      src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java
  25. 6
    0
      src/main/java/com/huiju/estateagents/drainage/entity/TaDrainage.java
  26. 8
    6
      src/main/java/com/huiju/estateagents/eContract/controller/TaCompanyController.java
  27. 23
    8
      src/main/java/com/huiju/estateagents/eContract/service/impl/TaContractServiceImpl.java
  28. 23
    5
      src/main/java/com/huiju/estateagents/eContract/service/impl/TaContractUserServiceImpl.java
  29. 8
    3
      src/main/java/com/huiju/estateagents/entity/ExtendContent.java
  30. 113
    0
      src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java
  31. 18
    0
      src/main/java/com/huiju/estateagents/entity/TaPerson.java
  32. 5
    3
      src/main/java/com/huiju/estateagents/entity/TaPersonPositon.java
  33. 23
    5
      src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java
  34. 10
    0
      src/main/java/com/huiju/estateagents/entity/TaShareCount.java
  35. 5
    0
      src/main/java/com/huiju/estateagents/entity/TaSharePersonFrom.java
  36. 97
    0
      src/main/java/com/huiju/estateagents/entity/TsActivityDaily.java
  37. 117
    0
      src/main/java/com/huiju/estateagents/entity/TsConsultantKpi.java
  38. 48
    0
      src/main/java/com/huiju/estateagents/excel/ActivityDailyExport.java
  39. 64
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ActivityDetailShareRecord.java
  40. 73
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/AddRegistNum.java
  41. 49
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java
  42. 54
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/SharePersonNum.java
  43. 51
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/StatisicAttractUser.java
  44. 79
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitNum.java
  45. 86
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitPersonNum.java
  46. 84
    0
      src/main/java/com/huiju/estateagents/excel/ConsultantKPIExport.java
  47. 94
    0
      src/main/java/com/huiju/estateagents/excel/IntentionUser.java
  48. 14
    0
      src/main/java/com/huiju/estateagents/excel/PrivateCustomerExport.java
  49. 26
    5
      src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java
  50. 61
    0
      src/main/java/com/huiju/estateagents/excel/StatsBuilding.java
  51. 59
    0
      src/main/java/com/huiju/estateagents/excel/StatsTimeBuilding.java
  52. 25
    0
      src/main/java/com/huiju/estateagents/mapper/ActivityManageMapper.java
  53. 1
    0
      src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java
  54. 89
    1
      src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java
  55. 22
    0
      src/main/java/com/huiju/estateagents/mapper/TaCustomerFromMapper.java
  56. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java
  57. 8
    0
      src/main/java/com/huiju/estateagents/mapper/TaOrgCityMapper.java
  58. 3
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonBuildingMapper.java
  59. 3
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java
  60. 11
    4
      src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java
  61. 2
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java
  62. 47
    3
      src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java
  63. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaShareMapper.java
  64. 12
    0
      src/main/java/com/huiju/estateagents/mapper/TaSharePersonFromMapper.java
  65. 64
    0
      src/main/java/com/huiju/estateagents/mapper/TsActivityDailyMapper.java
  66. 216
    0
      src/main/java/com/huiju/estateagents/mapper/TsConsultantKpiMapper.java
  67. 27
    0
      src/main/java/com/huiju/estateagents/service/IActivityManageService.java
  68. 97
    1
      src/main/java/com/huiju/estateagents/service/IStatisticalService.java
  69. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaBuildingService.java
  70. 16
    0
      src/main/java/com/huiju/estateagents/service/ITaCustomerFromService.java
  71. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaLiveActivityService.java
  72. 10
    0
      src/main/java/com/huiju/estateagents/service/ITaPersonService.java
  73. 44
    21
      src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java
  74. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaShareService.java
  75. 23
    0
      src/main/java/com/huiju/estateagents/service/ITsActivityDailyService.java
  76. 44
    0
      src/main/java/com/huiju/estateagents/service/ITsConsultantKpiService.java
  77. 12
    0
      src/main/java/com/huiju/estateagents/service/impl/ActivityManageServiceImpl.java
  78. 294
    4
      src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java
  79. 1
    4
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  80. 20
    0
      src/main/java/com/huiju/estateagents/service/impl/TaCustomerFromServiceImpl.java
  81. 2
    2
      src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java
  82. 432
    4
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  83. 216
    146
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  84. 3
    3
      src/main/java/com/huiju/estateagents/service/impl/TaShareServiceImpl.java
  85. 4
    3
      src/main/java/com/huiju/estateagents/service/impl/TaUvServiceImpl.java
  86. 1
    1
      src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java
  87. 41
    0
      src/main/java/com/huiju/estateagents/service/impl/TsActivityDailyServiceImpl.java
  88. 159
    0
      src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java
  89. 373
    0
      src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java
  90. 19
    0
      src/main/java/com/huiju/estateagents/statistic/entity/TaActivityStatistic.java
  91. 328
    0
      src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java
  92. 2
    0
      src/main/java/com/huiju/estateagents/statistic/mapper/TsPersonFromStatisticMapper.java
  93. 198
    0
      src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java
  94. 4
    2
      src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java
  95. 168
    0
      src/main/resources/mapper/ActivityManageMapper.xml
  96. 0
    1
      src/main/resources/mapper/TaBuildingDynamicMapper.xml
  97. 488
    0
      src/main/resources/mapper/TaBuildingMapper.xml
  98. 15
    0
      src/main/resources/mapper/TaCustomerFromMapper.xml
  99. 2
    1
      src/main/resources/mapper/TaLiveActivityMapper.xml
  100. 0
    0
      src/main/resources/mapper/TaOrgCity.xml

+ 1
- 1
pom.xml Прегледај датотеку

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>estateagents</artifactId>
13
-	<version>v3.5.19</version>
13
+	<version>v3.5.21</version>
14 14
 	<name>estateages</name>
15 15
 	<description>置业经纪人</description>
16 16
 

+ 44
- 0
src/main/java/com/huiju/estateagents/bo/request/ActivityStatisticResponseBO.java Прегледај датотеку

@@ -0,0 +1,44 @@
1
+package com.huiju.estateagents.bo.request;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 活动统计返回实体
7
+ *
8
+ * @author gusy
9
+ * @date 2020/4/26 13:15
10
+ */
11
+@Data
12
+public class ActivityStatisticResponseBO {
13
+
14
+    /**
15
+     * 活动分享人数
16
+     */
17
+    private Integer sharePersons;
18
+
19
+    /**
20
+     * 活动分享次数
21
+     */
22
+    private Integer shareNum;
23
+
24
+    /**
25
+     * 活动访问人数
26
+     */
27
+    private Integer visitPersons;
28
+
29
+    /**
30
+     * 活动访问次数
31
+     */
32
+    private Integer visitNum;
33
+
34
+    /**
35
+     * 分享新增用户
36
+     */
37
+    private Integer newPersons;
38
+
39
+    /**
40
+     * 分享新增客户
41
+     */
42
+    private Integer newCustomers;
43
+
44
+}

+ 16
- 12
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java Прегледај датотеку

@@ -2,33 +2,28 @@ package com.huiju.estateagents.center.taUser.controller;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
7 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 7
 import com.huiju.estateagents.base.BaseController;
9 8
 import com.huiju.estateagents.base.ResponseBean;
10 9
 import com.huiju.estateagents.center.sysUser.entity.SysToken;
11
-import com.huiju.estateagents.center.sysUser.entity.SysUser;
12 10
 import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
13 11
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
14 12
 import com.huiju.estateagents.center.taUser.entity.TaTags;
15 13
 import com.huiju.estateagents.center.taUser.entity.TaUser;
16 14
 import com.huiju.estateagents.center.taUser.entity.TaUserRole;
17
-import com.huiju.estateagents.center.taUser.service.ITaTagUserService;
18
-import com.huiju.estateagents.center.taUser.service.ITaUserAuthButtonService;
19
-import com.huiju.estateagents.center.taUser.service.ITaUserAuthMenuService;
20
-import com.huiju.estateagents.center.taUser.service.ITaUserRoleService;
21
-import com.huiju.estateagents.center.taUser.service.ITaUserService;
15
+import com.huiju.estateagents.center.taUser.service.*;
22 16
 import com.huiju.estateagents.common.CommConstant;
23 17
 import com.huiju.estateagents.common.JWTUtils;
24 18
 import com.huiju.estateagents.common.MD5Utils;
25
-import com.huiju.estateagents.common.StringUtils;
26 19
 import com.huiju.estateagents.entity.SysButtonInMenu;
27 20
 import com.huiju.estateagents.entity.SysMenu;
21
+import com.huiju.estateagents.entity.TaMiniapp;
28 22
 import com.huiju.estateagents.entity.TaPerson;
29 23
 import com.huiju.estateagents.entity.TaPersonBuilding;
30 24
 import com.huiju.estateagents.entity.TaRole;
31 25
 import com.huiju.estateagents.mapper.TaRoleMapper;
26
+import com.huiju.estateagents.service.ITaMiniappService;
32 27
 import com.huiju.estateagents.service.ITaPersonBuildingService;
33 28
 import com.huiju.estateagents.service.ITaPersonService;
34 29
 import com.huiju.estateagents.service.ITaRoleService;
@@ -38,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
38 33
 import org.springframework.web.bind.annotation.*;
39 34
 
40 35
 import javax.servlet.http.HttpServletRequest;
41
-import java.time.LocalDateTime;
42 36
 import java.util.ArrayList;
43 37
 import java.util.HashMap;
44 38
 import java.util.List;
@@ -88,6 +82,9 @@ public class TaUserController extends BaseController {
88 82
     @Autowired
89 83
     private ITaPersonService iTaPersonService;
90 84
 
85
+    @Autowired
86
+    private ITaMiniappService iTaMiniappService;
87
+
91 88
     /**
92 89
      * 分页查询列表
93 90
      * @param pageNum
@@ -294,10 +291,15 @@ public class TaUserController extends BaseController {
294 291
             List<TaRole> roles = iTaRoleService.getRolesByUser(taUser.getUserId());
295 292
             ResponseBean authMenu = iTaUserAuthMenuService.getMenuByUserId(null, null, taUser.getUserId().toString(),taUser.getOrgId());
296 293
             ResponseBean authButton = iTaUserAuthButtonService.getButtonByUserId(null, null, taUser.getUserId().toString());
294
+            QueryWrapper<TaMiniapp> taMiniappQueryWrapper = new QueryWrapper<>();
295
+            taMiniappQueryWrapper.eq("org_id", getOrgId(request));
296
+            TaMiniapp taMiniapp = iTaMiniappService.getOne(taMiniappQueryWrapper);
297
+
297 298
             taUser.setMenus((List<SysMenu>) authMenu.getData());
298 299
             taUser.setButtons((List<SysButtonInMenu>) authButton.getData());
299 300
             taUser.setRoles(roles);
300 301
             taUser.setLoginPassword("");
302
+            taUser.setMiniAppName(taMiniapp.getName());
301 303
 
302 304
             //获取所有菜单
303 305
             List<SysMenu> allMenus = (List<SysMenu>) iTaUserAuthMenuService.getAllMenu(null, null,taUser.getOrgId(), roles).getData();
@@ -361,7 +363,7 @@ public class TaUserController extends BaseController {
361 363
         Map<String, Object> result = new HashMap<>();
362 364
         result.put("token", token);
363 365
         result.put("user", taUser);
364
-    
366
+
365 367
         return ResponseBean.success(result);
366 368
     }
367 369
     
@@ -388,6 +390,7 @@ public class TaUserController extends BaseController {
388 390
                                    @RequestParam(value ="phone",required = false) String phone,
389 391
                                    @RequestParam(value ="status",required = false) Integer status,
390 392
                                    @RequestParam(value ="isConsultant",required = false) Integer isConsultant,
393
+                                   @RequestParam(value ="miniStatus",required = false) Integer miniStatus,
391 394
                                    @RequestParam(value ="buildingId",required = false) String buildingId,
392 395
                                    HttpServletRequest request){
393 396
         ResponseBean responseBean = new ResponseBean();
@@ -405,6 +408,7 @@ public class TaUserController extends BaseController {
405 408
             }else if (null != isConsultant && isConsultant == 0){
406 409
                 taUser.setIsConsultant(false);
407 410
             }
411
+            taUser.setMiniStatus(miniStatus);
408 412
 
409 413
             IPage<TaUser> result = iTaUserService.seleUserList(pg,taUser,getTaPersonBuildingListByUserId(request));
410 414
             List<TaUser> taUserList = result.getRecords();
@@ -412,8 +416,8 @@ public class TaUserController extends BaseController {
412 416
                 List<TaTags> taTagsList = iTaUserService.getTagsList(e);
413 417
                 e.setTaTagsList(taTagsList);
414 418
 
415
-                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
416
-                e.setMiniStatus(0 == person ? 0 : 1);
419
+//                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
420
+//                e.setMiniStatus(0 == person ? 0 : 1);
417 421
             });
418 422
             result.setRecords(taUserList);
419 423
             responseBean.addSuccess(result);

+ 3
- 0
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java Прегледај датотеку

@@ -232,4 +232,7 @@ public class TaUser implements Serializable {
232 232
      */
233 233
     @TableField(exist = false)
234 234
     private List<TaPerson> personIds;
235
+
236
+    @TableField(exist = false)
237
+    private String miniAppName;
235 238
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/center/taUser/mapper/TaUserMapper.java Прегледај датотеку

@@ -33,4 +33,8 @@ public interface TaUserMapper extends BaseMapper<TaUser> {
33 33
     Integer validateWeight(@Param("buildingIds") List<String> buildingIds, @Param("buildingId") String buildingId, @Param("weight") String weight, @Param("userId")Integer userId);
34 34
 
35 35
     TaUser getAdminByAppID(@Param("appid") String appID);
36
+
37
+    List<String> getBuildingIdsOf(@Param("userId") Integer userId,@Param("buildingId") String buildingId);
38
+
39
+    TaUser getUserByPerson(@Param("orgId") Integer orgId, @Param("personId") String personId);
36 40
 }

+ 18
- 3
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java Прегледај датотеку

@@ -4,7 +4,6 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 8
 import com.huiju.estateagents.base.ResponseBean;
10 9
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
@@ -25,13 +24,11 @@ import com.huiju.estateagents.entity.*;
25 24
 import com.huiju.estateagents.mapper.*;
26 25
 import com.huiju.estateagents.service.*;
27 26
 import org.apache.commons.collections.CollectionUtils;
28
-import org.apache.commons.collections.map.HashedMap;
29 27
 import org.springframework.beans.factory.annotation.Autowired;
30 28
 import org.springframework.stereotype.Service;
31 29
 
32 30
 import java.time.LocalDateTime;
33 31
 import java.util.ArrayList;
34
-import java.util.Iterator;
35 32
 import java.util.List;
36 33
 import java.util.Map;
37 34
 import java.util.stream.Collectors;
@@ -356,6 +353,24 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
356 353
             throw new Exception("未找到有效的用户信息");
357 354
         }
358 355
 
356
+        //停用
357
+        if (!isOn){
358
+            //查看是否置业顾问
359
+            if (taUser.getIsConsultant()){
360
+                taUser.setIsConsultant(false);
361
+                taUserMapper.updateById(taUser);
362
+                //小程序端调整为普通客户
363
+                QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
364
+                taPersonQueryWrapper.eq("user_id",id);
365
+                taPersonQueryWrapper.eq("org_id",taUser.getOrgId());
366
+                TaPerson taPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
367
+                if (null != taPerson){
368
+                    taPerson.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
369
+                    taPersonMapper.updateById(taPerson);
370
+                }
371
+            }
372
+        }
373
+
359 374
         Integer status = isOn ? CommConstant.STATUS_NORMAL : CommConstant.STATUS_CLOSED;
360 375
         TaUser user = new TaUser();
361 376
         user.setStatus(status);

+ 38
- 0
src/main/java/com/huiju/estateagents/common/ExcelUtils.java Прегледај датотеку

@@ -0,0 +1,38 @@
1
+package com.huiju.estateagents.common;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
6
+import com.huiju.estateagents.excel.ConsultantKPIExport;
7
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
8
+
9
+import javax.servlet.http.HttpServletResponse;
10
+import java.io.IOException;
11
+import java.lang.reflect.ParameterizedType;
12
+import java.lang.reflect.Type;
13
+import java.util.List;
14
+
15
+public class ExcelUtils {
16
+
17
+    /**
18
+     * 发送 excel 到客户端
19
+     * 暂时只支持单 sheet 页
20
+     * @param response
21
+     * @param data
22
+     * @param fileName
23
+     * @throws IOException
24
+     */
25
+    public static void flush(HttpServletResponse response, Class dataClass, List data, String fileName) throws IOException {
26
+        response.setContentType("application/octet-stream");
27
+        response.setCharacterEncoding("utf-8");
28
+        response.setHeader("Content-disposition", "attachment;filename="+StringUtils.strToUnicode(fileName)+".xlsx");
29
+
30
+//        ParameterizedType type = (ParameterizedType) data.getClass().getGenericSuperclass();
31
+//        Class dataClass = (Class) type.getActualTypeArguments()[0];
32
+
33
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), dataClass).registerWriteHandler(new CustomCellWriteHandler()).build();
34
+        WriteSheet sheet1 = EasyExcel.writerSheet("sheet1").build();
35
+        excelWriter.write(data, sheet1);
36
+        excelWriter.finish();
37
+    }
38
+}

+ 25
- 0
src/main/java/com/huiju/estateagents/common/StringUtils.java Прегледај датотеку

@@ -3,8 +3,12 @@ package com.huiju.estateagents.common;
3 3
 import java.io.UnsupportedEncodingException;
4 4
 import java.net.URLEncoder;
5 5
 import java.util.Random;
6
+import java.util.regex.Matcher;
7
+import java.util.regex.Pattern;
6 8
 
7 9
 public class StringUtils {
10
+    private static Pattern humpPattern = Pattern.compile("[A-Z]");
11
+
8 12
     public static boolean isEmpty(String str) {
9 13
         return null == str || "".equals(str.trim()) || "null".equals(str) || "undefined".equals(str);
10 14
     }
@@ -44,4 +48,25 @@ public class StringUtils {
44 48
             return str;
45 49
         }
46 50
     }
51
+
52
+    public static String humpToLine(String str) {
53
+        if (null == str || "".equals(str)) return "";
54
+
55
+        Matcher matcher = humpPattern.matcher(str);
56
+        StringBuffer sb = new StringBuffer();
57
+        while (matcher.find()) {
58
+            matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
59
+        }
60
+        matcher.appendTail(sb);
61
+        return sb.toString();
62
+    }
63
+
64
+    public static String strToUnicode(String str) {
65
+        char[] chars = str.toCharArray();
66
+        String returnStr = "";
67
+        for (int i = 0; i < chars.length; i++) {
68
+            returnStr += "\\u" + Integer.toString(chars[i], 16);
69
+        }
70
+        return returnStr;
71
+    }
47 72
 }

+ 65
- 0
src/main/java/com/huiju/estateagents/controller/ActivityManageController.java Прегледај датотеку

@@ -0,0 +1,65 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.huiju.estateagents.base.BaseController;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.service.impl.ActivityManageServiceImpl;
7
+import org.apache.commons.lang3.StringUtils;
8
+import org.slf4j.Logger;
9
+import org.slf4j.LoggerFactory;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Controller;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.ResponseBody;
15
+
16
+import javax.servlet.http.HttpServletRequest;
17
+
18
+/**
19
+ * 活动管理
20
+ *
21
+ * @author gusy
22
+ * @date 2020/4/26 10:42
23
+ */
24
+@Controller
25
+@RequestMapping("/api")
26
+public class ActivityManageController extends BaseController {
27
+
28
+    private Logger logger = LoggerFactory.getLogger(ActivityManageController.class);
29
+
30
+    @Autowired
31
+    private ActivityManageServiceImpl activityManageService;
32
+
33
+    /**
34
+     * 根据类型获取统计数据
35
+     *
36
+     * @param type 报名活动:activity、
37
+     *             H5:h5、
38
+     *             助力:help、
39
+     *             拼团:group、
40
+     *             直播:live
41
+     * @return
42
+     */
43
+    @RequestMapping(value = "/admin/activityManage/getStatisticData", method = RequestMethod.GET)
44
+    @ResponseBody
45
+    public ResponseBean getStatisticDataByType(String type, String id, HttpServletRequest request) {
46
+        logger.info("getStatisticDataByType 接收参数:type:{},id:{}", type, id);
47
+
48
+        ResponseBean responseBean = new ResponseBean();
49
+
50
+        // 校验参数
51
+        if (StringUtils.isBlank(type) || StringUtils.isBlank(id)) {
52
+            responseBean.addError("参数错误");
53
+            return responseBean;
54
+        }
55
+
56
+        try {
57
+            responseBean = activityManageService.getStatisticDataByType(type, id,getOrgId(request));
58
+            logger.info("getStatisticDataByType 返回结果:{}", JSONObject.toJSONString(responseBean));
59
+        } catch (Exception e) {
60
+            logger.error("异常:", e);
61
+            responseBean.addError(e.getMessage());
62
+        }
63
+        return responseBean;
64
+    }
65
+}

+ 2
- 8
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Прегледај датотеку

@@ -5,20 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
-import com.huiju.estateagents.center.taUser.entity.TaUser;
9
-import com.huiju.estateagents.common.CommConstant;
10
-import com.huiju.estateagents.common.MD5Utils;
11 8
 import com.huiju.estateagents.entity.*;
12 9
 import com.huiju.estateagents.service.*;
13 10
 import com.huiju.estateagents.service.impl.HelpActivityServiceImpl;
14
-import io.jsonwebtoken.lang.Collections;
15 11
 import io.swagger.annotations.Api;
16 12
 import io.swagger.annotations.ApiImplicitParam;
17 13
 import io.swagger.annotations.ApiImplicitParams;
18 14
 import io.swagger.annotations.ApiOperation;
19
-import jodd.util.StringUtil;
20 15
 import org.apache.commons.lang3.StringUtils;
21
-import org.apache.ibatis.annotations.Param;
22 16
 import org.slf4j.Logger;
23 17
 import org.slf4j.LoggerFactory;
24 18
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
26 20
 
27 21
 import javax.servlet.http.HttpServletRequest;
28 22
 import java.time.LocalDateTime;
29
-import java.util.Collection;
30 23
 import java.util.List;
31 24
 import java.util.stream.Collectors;
32 25
 
@@ -104,7 +97,7 @@ public class ExtendContentController extends BaseController {
104 97
             queryWrapper.ne("status",9);
105 98
             queryWrapper.eq(status != null, "status", status);
106 99
             queryWrapper.eq( "org_id", getOrgId(request));
107
-            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id",taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().isNull("building_id"));
100
+            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id",taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user",getUserId(request)));
108 101
             queryWrapper.orderByDesc("order_no");
109 102
             queryWrapper.orderByDesc("create_date");
110 103
             IPage<ExtendContent> result = iExtendContentService.page(pg, queryWrapper);
@@ -192,6 +185,7 @@ public class ExtendContentController extends BaseController {
192 185
         if (StringUtils.isEmpty(extendContent.getContentType())){
193 186
             extendContent.setContentType("nothing");
194 187
         }
188
+        extendContent.setCreateUser(getUserId(request));
195 189
         responseBean = iExtendContentService.extendContentAdd(extendContent);
196 190
         responseBean.addSuccess(extendContent);
197 191
         return responseBean;

+ 86
- 75
src/main/java/com/huiju/estateagents/controller/MiniAppController.java Прегледај датотеку

@@ -1,6 +1,5 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
-import cn.binarywang.wx.miniapp.api.WxMaService;
4 3
 import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
5 4
 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
6 5
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
@@ -8,22 +7,20 @@ import com.alibaba.fastjson.JSONObject;
8 7
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
9 8
 import com.huiju.estateagents.base.BaseController;
10 9
 import com.huiju.estateagents.base.ResponseBean;
11
-import com.huiju.estateagents.center.sysUser.entity.SysToken;
12 10
 import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
13 11
 import com.huiju.estateagents.center.taUser.entity.TaUser;
14 12
 import com.huiju.estateagents.center.taUser.service.ITaUserService;
15 13
 import com.huiju.estateagents.common.CommConstant;
16
-import com.huiju.estateagents.common.WxUtils;
14
+import com.huiju.estateagents.common.JWTUtils;
15
+import com.huiju.estateagents.drainage.entity.TaDrainage;
16
+import com.huiju.estateagents.drainage.service.ITaDrainageService;
17 17
 import com.huiju.estateagents.entity.*;
18 18
 import com.huiju.estateagents.event.EventBus;
19 19
 import com.huiju.estateagents.mapper.TaOrgCityMapper;
20
-import com.huiju.estateagents.mapper.TaShareMapper;
20
+import com.huiju.estateagents.mapper.TaSalesBatchMapper;
21 21
 import com.huiju.estateagents.service.*;
22
-import com.huiju.estateagents.common.JWTUtils;
23
-import com.huiju.estateagents.third.entity.TaThirdPartyMiniappConfig;
24 22
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
25 23
 import me.chanjar.weixin.common.error.WxErrorException;
26
-import net.bytebuddy.asm.Advice;
27 24
 import org.apache.commons.collections.CollectionUtils;
28 25
 import org.apache.commons.lang3.StringUtils;
29 26
 import org.apache.http.HttpStatus;
@@ -36,7 +33,6 @@ import org.springframework.web.bind.annotation.*;
36 33
 import javax.annotation.Resource;
37 34
 import javax.servlet.http.HttpServletRequest;
38 35
 import java.time.LocalDateTime;
39
-import java.util.Collections;
40 36
 import java.util.HashMap;
41 37
 import java.util.List;
42 38
 import java.util.Map;
@@ -103,6 +99,21 @@ public class MiniAppController extends BaseController {
103 99
     @Autowired
104 100
     public ITdCityService iTdCityService;
105 101
 
102
+    @Autowired
103
+    private IHelpActivityService helpActivityService;
104
+
105
+    @Autowired
106
+    private ITaShareActivityService taShareActivityService;
107
+
108
+    @Autowired
109
+    private ITaLiveActivityService taLiveActivityService;
110
+
111
+    @Autowired
112
+    private ITaDrainageService taDrainageService;
113
+
114
+    @Autowired
115
+    private TaSalesBatchMapper taSalesBatchMapper;
116
+
106 117
     /**
107 118
      * 验证接入
108 119
      */
@@ -206,6 +217,7 @@ public class MiniAppController extends BaseController {
206 217
             miniResp.put("unionid", session.getUnionid());
207 218
             miniResp.put("name", miniapp.getName());
208 219
             miniResp.put("tpls", miniAppService.getTpls(appid));
220
+            miniResp.put("fddServerHost", miniapp.getFddServerHost());
209 221
 
210 222
             // 2020年3月30日 与曹建芳讨论 去掉此规则
211 223
 //            //如果是分享进来且没有进入过小程序,给分享人发放积分
@@ -239,19 +251,19 @@ public class MiniAppController extends BaseController {
239 251
             taPerson.setMiniappId(appid);
240 252
             taPersonService.updateById(taPerson);
241 253
 
242
-            // 增加积分线程
243
-            ExecutorService threadPool = Executors.newCachedThreadPool();
244
-            threadPool.execute(() -> {
245
-//                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender) && count > 0) {
246
-                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender)) {
247
-                    // 校验是否点击过此人的分享
248
-                    boolean checkPoint = checkSharePersonFrom(from, taPerson.getPersonId(), targetId, orgId);
249
-                    if (checkPoint) {
250
-                        // 添加积分
251
-                        applicationContext.publishEvent(new EventBus(recommender, EventBus.EventType.SharePosterAll, orgId));
252
-                    }
253
-                }
254
-            });
254
+            // 增加积分线程 --- 3.5.23版本授权手机分享者增加积分,单纯分享不增加积分
255
+//            ExecutorService threadPool = Executors.newCachedThreadPool();
256
+//            threadPool.execute(() -> {
257
+////                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender) && count > 0) {
258
+//                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender)) {
259
+//                    // 校验是否点击过此人的分享
260
+//                    boolean checkPoint = checkSharePersonFrom(from, taPerson.getPersonId(), targetId, orgId);
261
+//                    if (checkPoint) {
262
+//                        // 添加积分
263
+//                        applicationContext.publishEvent(new EventBus(recommender, EventBus.EventType.SharePosterAll, orgId));
264
+//                    }
265
+//                }
266
+//            });
255 267
 
256 268
             if (StringUtils.isNotBlank(from) && StringUtils.isNotBlank(recommender) && StringUtils.isNotBlank(targetId)) {
257 269
                 TaSharePersonFrom taSharePersonFrom = new TaSharePersonFrom();
@@ -294,6 +306,26 @@ public class MiniAppController extends BaseController {
294 306
                 } else if (from.contains("building")) {
295 307
                     taSharePersonFrom.setBuildingId(targetId);
296 308
                     sharePersonFromQueryWrapper.eq("building_id", targetId);
309
+                }else if (from.contains("help")) {
310
+                    HelpActivity helpActivity = helpActivityService.getById(targetId);
311
+                    taSharePersonFrom.setBuildingId(helpActivity.getBuildingId());
312
+                    sharePersonFromQueryWrapper.eq("building_id", helpActivity.getBuildingId());
313
+                }else if (from.contains("group")) {
314
+                    TaShareActivity taShareActivity = taShareActivityService.getById(targetId);
315
+                    taSharePersonFrom.setBuildingId(taShareActivity.getBuildingId());
316
+                    sharePersonFromQueryWrapper.eq("building_id", taShareActivity.getBuildingId());
317
+                }else if (from.contains("live")) {
318
+                    TaLiveActivity liveActivity = taLiveActivityService.getById(targetId);
319
+                    taSharePersonFrom.setBuildingId(liveActivity.getBuildingId());
320
+                    sharePersonFromQueryWrapper.eq("building_id", liveActivity.getBuildingId());
321
+                }else if (from.contains("h5")) {
322
+                    TaDrainage taDrainage = taDrainageService.getById(targetId);
323
+                    taSharePersonFrom.setBuildingId(taDrainage.getBuildingId());
324
+                    sharePersonFromQueryWrapper.eq("building_id", taDrainage.getBuildingId());
325
+                }else if (from.contains("house")) {
326
+                    TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(targetId);
327
+                    taSharePersonFrom.setBuildingId(taSalesBatch.getBuildingId());
328
+                    sharePersonFromQueryWrapper.eq("building_id", taSalesBatch.getBuildingId());
297 329
                 }
298 330
                 Integer isFirstTime = taSharePersonFromService.count(sharePersonFromQueryWrapper);
299 331
                 if (isFirstTime > 0) {
@@ -462,72 +494,51 @@ public class MiniAppController extends BaseController {
462 494
             return ResponseBean.error("校验参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
463 495
         }
464 496
 
497
+        // 手机号解码
465 498
         String sessionKey = params.getString("sessionKey");
466 499
         String encryptedData = params.getString("encryptedData");
467 500
         String iv = params.getString("iv");
501
+
502
+        // 楼盘ID
468 503
         String buildingId = params.getString("buildingId");
504
+        // 场景ID
505
+        String sceneId = params.getString("sceneId");
506
+        // 访问目标
507
+        String targetType = params.getString("targetType");
508
+        // 目标ID
509
+        String targetId = params.getString("targetId");
510
+        // 目标名称
511
+        String targetName = params.getString("targetName");
512
+        // 推广用户
513
+        String promoter = params.getString("promoter");
469 514
 
470 515
         // 解密
471 516
         WxMaPhoneNumberInfo phoneNoInfo = miniAppService.getPhoneNoInfo(sessionKey, encryptedData, iv, appid);
517
+        if (null == phoneNoInfo || com.huiju.estateagents.common.StringUtils.isEmpty(phoneNoInfo.getPhoneNumber())) {
518
+            ResponseBean.error("解析用户手机号码出错", ResponseBean.ERROR_UNAVAILABLE);
519
+        }
472 520
 
473
-        // 更新用户绑定手机
474 521
         String openid = getOpenId(request);
475 522
         Integer orgId = getOrgId(request);
476
-        taPersonService.updatePersonPhone(openid, phoneNoInfo.getPhoneNumber(), buildingId, orgId);
477
-        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
478
-        if (null == taPersons || taPersons.size() != 1) {
479
-            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
480
-        }
481
-        TaPerson person = taPersons.get(0);
482
-        QueryWrapper<TaRecommendCustomer> cus = new QueryWrapper<>();
483
-        cus.eq("org_id", orgId);
484
-        cus.eq("phone", phoneNoInfo.getPhoneNumber());
485
-        cus.orderByDesc("create_date");
486
-        List<TaRecommendCustomer> customer = taRecommendCustomerService.list(cus);
487
-        if (customer.size() > 0) {
488
-            for (int i = 0; i < customer.size(); i++) {
489
-                customer.get(i).setPersonId(person.getPersonId());
490
-                customer.get(i).setPicture(person.getAvatarurl());
491
-                customer.get(i).setCountry(person.getCountry());
492
-                customer.get(i).setCity(person.getCity());
493
-                customer.get(i).setProvince(person.getProvince());
494
-            }
495
-//            TaRecommendCustomer customers = customer.get(0);
523
+        String phone = phoneNoInfo.getPhoneNumber();
496 524
 
497
-            if (!taRecommendCustomerService.updateBatchById(customer)) {
498
-                return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
499
-            }
500
-//            if(null != customers.getRecommendPerson()&&!StringUtils.isEmpty(customers.getRecommendPerson())&& StringUtils.isEmpty(person.getRecommendPerson())){
501
-//                person.setRecommendPerson(customers.getRecommendPerson());
502
-//                person.setRecommendPerson(customers.getRecommendPerson());
503
-//                TaPerson recommender = taPersonService.getById(customers.getRecommendPerson());
504
-//                if(null != recommender.getPersonType()&&!StringUtils.isEmpty(recommender.getPersonType())){
505
-//                    person.setRecommendPersonType(recommender.getPersonType());
506
-//                }
507
-//            }
508
-
509
-//            QueryWrapper<TaCustomerPerson> customerPersonQueryWrapper = new QueryWrapper<>();
510
-//            customerPersonQueryWrapper.eq("person_id",person.getPersonId());
511
-//            customerPersonQueryWrapper.eq("customer_id",customers.getCustomerId());
512
-//            List<TaCustomerPerson> list = taCustomerPersonService.list(customerPersonQueryWrapper);
513
-//            if(list.size()<=0){
514
-//                taCustomerPersonService.insertBean(person.getPersonId(),customers.getCustomerId());
515
-//            }
525
+        try {
526
+            taPersonService.authPhone(
527
+                    orgId,
528
+                    openid,
529
+                    phone,
530
+                    buildingId,
531
+                    sceneId,
532
+                    targetType,
533
+                    targetId,
534
+                    targetName,
535
+                    promoter);
536
+
537
+            return ResponseBean.success(phoneNoInfo);
538
+        } catch (Exception e) {
539
+//           e.printStackTrace();
540
+            return ResponseBean.error("授权手机失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
516 541
         }
517
-//        else{
518
-//            TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
519
-//            taRecommendCustomer.setPersonId(person.getPersonId());
520
-//            taRecommendCustomer.setPicture(person.getAvatarurl());
521
-//            taRecommendCustomer.setCountry(person.getCountry());
522
-//            taRecommendCustomer.setCity(person.getCity());
523
-//            taRecommendCustomer.setProvince(person.getProvince());
524
-//            taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
525
-//            taRecommendCustomer.setOrgId(getOrgId(request));
526
-//            taRecommendCustomer.setEntryType(CommConstant.ENTRY_VOLUNTEER);
527
-//            taRecommendCustomer.setSex(Integer.getInteger(person.getGender()));
528
-//
529
-//        }
530
-        return ResponseBean.success(phoneNoInfo);
531 542
     }
532 543
 
533 544
     /**

+ 226
- 1
src/main/java/com/huiju/estateagents/controller/StatisticalController.java Прегледај датотеку

@@ -1,14 +1,31 @@
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.entity.TdWxDict;
9
+import com.huiju.estateagents.excel.IntentionUser;
10
+import com.huiju.estateagents.excel.StatsBuilding;
11
+import com.huiju.estateagents.excel.StatsTimeBuilding;
12
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
5 13
 import com.huiju.estateagents.service.IStatisticalService;
14
+import com.huiju.estateagents.statistic.entity.TsPersonFromStatistic;
6 15
 import org.springframework.beans.factory.annotation.Autowired;
7 16
 import org.springframework.format.annotation.DateTimeFormat;
8
-import org.springframework.web.bind.annotation.*;
17
+import org.springframework.web.bind.annotation.GetMapping;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestParam;
20
+import org.springframework.web.bind.annotation.RestController;
9 21
 
10 22
 import javax.servlet.http.HttpServletRequest;
23
+import javax.servlet.http.HttpServletResponse;
24
+import java.io.IOException;
11 25
 import java.time.LocalDate;
26
+import java.util.ArrayList;
27
+import java.util.List;
28
+import java.util.Map;
12 29
 
13 30
 /**
14 31
  * 数据统计
@@ -52,6 +69,17 @@ public class StatisticalController extends BaseController {
52 69
         return iStatisticalService.selectNewsUserCount(getOrgId(request), startDate, endDate);
53 70
     }
54 71
 
72
+    /**
73
+     * 新增用户数
74
+     * @return
75
+     */
76
+    @GetMapping(value = "/admin/changeNewsUserCount")
77
+    public ResponseBean changeNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
78
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
79
+                                            HttpServletRequest request) {
80
+        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate);
81
+    }
82
+
55 83
     /**
56 84
      * 转化率 统计
57 85
      * @return
@@ -151,6 +179,16 @@ public class StatisticalController extends BaseController {
151 179
         return iStatisticalService.selectCityUser(orgId);
152 180
     }
153 181
 
182
+    /**
183
+     * 人员分布城市比例
184
+     * @return
185
+     */
186
+    @GetMapping(value = "/admin/selectCityPerson")
187
+    public ResponseBean selectCityPerson(HttpServletRequest request) {
188
+        Integer orgId = getOrgId(request);
189
+        return iStatisticalService.selectCityPerson(orgId);
190
+    }
191
+
154 192
     /**
155 193
      * 意向用户  首页
156 194
      * @return
@@ -163,6 +201,25 @@ public class StatisticalController extends BaseController {
163 201
         return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
164 202
     }
165 203
 
204
+    /**
205
+     * 意向用户 导出
206
+     * @return
207
+     */
208
+    @GetMapping(value = "/admin/exportIntentionUser")
209
+    public void getBuildingTimeTableList(@RequestParam(value = "buildingId", required = false) String buildingId,
210
+                                         HttpServletRequest request, HttpServletResponse response) throws IOException {
211
+        response.setContentType("application/octet-stream");
212
+        response.setCharacterEncoding("utf-8");
213
+        response.setHeader("Content-disposition", "attachment;filename=意向客户.xlsx");
214
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), IntentionUser.class).registerWriteHandler(new CustomCellWriteHandler()).build();
215
+        // 设置 sheet, 同一个sheet只需要设置一次
216
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
217
+        List<IntentionUser> list = iStatisticalService.getExportIntentionUser(getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
218
+        excelWriter.write(list, writeSheet);
219
+        // finish 会帮忙关闭流
220
+        excelWriter.finish();
221
+    }
222
+
166 223
     /**
167 224
      * 用户来源  首页
168 225
      * @return
@@ -184,4 +241,172 @@ public class StatisticalController extends BaseController {
184 241
                                          HttpServletRequest request) {
185 242
         return iStatisticalService.selectPersonFromGroupByDay(getOrgId(request), startDate,endDate);
186 243
     }
244
+
245
+    /**
246
+     * 项目排行统计图
247
+     * @return
248
+     */
249
+    @GetMapping(value = "/admin/stats/barList")
250
+    public ResponseBean selectBuildingBar(@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
+                                           HttpServletRequest request) {
253
+        return iStatisticalService.getStatsBarList(getOrgId(request), startDate, endDate, getTaPersonBuildingListByUserId(request));
254
+    }
255
+
256
+
257
+    /**
258
+     * 项目排行统计图
259
+     * @return
260
+     */
261
+    @GetMapping(value = "/admin/stats/tableList")
262
+    public ResponseBean selectBuildingTableList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
263
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
264
+                                                @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
+                                                @RequestParam(value = "sortField", required = false) String sortField,
268
+                                                @RequestParam(value = "sortOrder", required = false) String sortOrder,
269
+                                                HttpServletRequest request) {
270
+        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
271
+    }
272
+
273
+    /**
274
+     * 项目排行统计图
275
+     * @return
276
+     */
277
+    @GetMapping(value = "/admin/stats/buildingExport")
278
+    public void getBuildingTableList(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
279
+                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
280
+                                             @RequestParam(value = "buildingId", required = false) String buildingId,
281
+                                             HttpServletRequest request, HttpServletResponse response) throws IOException {
282
+        response.setContentType("application/octet-stream");
283
+        response.setCharacterEncoding("utf-8");
284
+        response.setHeader("Content-disposition", "attachment;filename=项目统计.xlsx");
285
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
286
+        // 设置 sheet, 同一个sheet只需要设置一次
287
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目统计").build();
288
+        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
289
+        excelWriter.write(list, writeSheet);
290
+        // finish 会帮忙关闭流
291
+        excelWriter.finish();
292
+    }
293
+
294
+    /**
295
+     * 项目排行统计图
296
+     * @return
297
+     */
298
+    @GetMapping(value = "/admin/stats/timeBarList")
299
+    public ResponseBean selectBuildingTimeBar(@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
+                                          HttpServletRequest request) {
303
+        return iStatisticalService.getStatsTimeBarList(getOrgId(request), startDate, endDate, buildingId, getTaPersonBuildingListByUserId(request));
304
+    }
305
+
306
+    /**
307
+     * 项目排行统计图
308
+     * @return
309
+     */
310
+    @GetMapping(value = "/admin/stats/timeTableList")
311
+    public ResponseBean selectBuildingTimeTableList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
312
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
313
+                                                @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
+                                                @RequestParam(value = "sortField", required = false) String sortField,
317
+                                                @RequestParam(value = "sortOrder", required = false) String sortOrder,
318
+                                                HttpServletRequest request) {
319
+        return iStatisticalService.getStatsTimeTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
320
+    }
321
+
322
+    /**
323
+     * 项目排行统计图
324
+     * @return
325
+     */
326
+    @GetMapping(value = "/admin/stats/buildingTimeExport")
327
+    public void getBuildingTimeTableList(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
328
+                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
329
+                                     @RequestParam(value = "buildingId", required = false) String buildingId,
330
+                                     HttpServletRequest request, HttpServletResponse response) throws IOException {
331
+        response.setContentType("application/octet-stream");
332
+        response.setCharacterEncoding("utf-8");
333
+        response.setHeader("Content-disposition", "attachment;filename=项目详情统计.xlsx");
334
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsTimeBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
335
+        // 设置 sheet, 同一个sheet只需要设置一次
336
+        WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
337
+        List<StatsTimeBuilding> list = iStatisticalService.getExportTimeTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
338
+        excelWriter.write(list, writeSheet);
339
+        // finish 会帮忙关闭流
340
+        excelWriter.finish();
341
+    }
342
+
343
+
344
+
345
+    /**
346
+     * 新增用户导出
347
+     * @return
348
+     */
349
+    @GetMapping(value = "/admin/exportUserStats")
350
+    public void exportUserStats(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
351
+                                         @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
352
+                                         @RequestParam(value = "userType", required = false) String userType,
353
+                                         HttpServletRequest request, HttpServletResponse response) throws IOException {
354
+        response.setContentType("application/octet-stream");
355
+        response.setCharacterEncoding("utf-8");
356
+        response.setHeader("Content-disposition", "attachment;filename=新增用户.xlsx");
357
+        ResponseBean responseBean = iStatisticalService.selectPersonFrom(getOrgId(request), startDate, endDate);
358
+        List<List<String>> headerList = headerList(responseBean.getData());
359
+        List<List<String>> dataList = dataList(responseBean.getData(),userType);
360
+        EasyExcel.write(response.getOutputStream()).head(headerList).sheet("新增用户").doWrite(dataList);
361
+    }
362
+
363
+    /**
364
+     * 构建表数据
365
+     * @param data
366
+     * @return
367
+     */
368
+    private List<List<String>> dataList(Object data,String userType) {
369
+        Map<String, Object> map = (Map<String, Object>) data;
370
+        List<TsPersonFromStatistic> list = (List<TsPersonFromStatistic>) map.get("list");
371
+        List<List<String>> dataList = new ArrayList<>();
372
+        List<TdWxDict> tdWxDicts = (List<TdWxDict>) map.get("tdWxDicts");
373
+        list.forEach(l -> {
374
+            List<String> columlist = new ArrayList<>();
375
+            columlist.add(l.getCreateTime());
376
+            tdWxDicts.forEach(e -> {
377
+                if (e.getSceneType().equals(l.getSceneType())){
378
+                    if (userType.equals("registered")){
379
+                        columlist.add(l.getRegisteredNum().toString());
380
+                    }else {
381
+                        columlist.add(l.getFromNum().toString());
382
+                    }
383
+                }else {
384
+                    columlist.add("0");
385
+                }
386
+            });
387
+            dataList.add(columlist);
388
+        });
389
+        return dataList;
390
+    }
391
+
392
+    /**
393
+     * 构造表头
394
+     * @param data
395
+     * @return
396
+     */
397
+    private List<List<String>> headerList(Object data) {
398
+        Map<String, Object> map = (Map<String, Object>) data;
399
+        List<TdWxDict> tdWxDicts = (List<TdWxDict>) map.get("tdWxDicts");
400
+        List<List<String>> headerList = new ArrayList<>();
401
+        List<String> rqHeader = new ArrayList<>();
402
+        rqHeader.add("日期");
403
+        headerList.add(rqHeader);
404
+        tdWxDicts.forEach(e -> {
405
+            List<String> header = new ArrayList<>();
406
+            header.add(e.getSceneAlias());
407
+            headerList.add(header);
408
+        });
409
+        return headerList;
410
+    }
411
+
187 412
 }

+ 1
- 6
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Прегледај датотеку

@@ -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>

+ 3
- 10
src/main/java/com/huiju/estateagents/controller/TaBuildingReportController.java Прегледај датотеку

@@ -1,25 +1,18 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
-import com.alibaba.fastjson.JSON;
4 3
 import com.alibaba.fastjson.JSONArray;
5 4
 import com.alibaba.fastjson.JSONObject;
6 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
8 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
+import com.huiju.estateagents.base.BaseController;
9 9
 import com.huiju.estateagents.base.ResponseBean;
10 10
 import com.huiju.estateagents.entity.TaBuildingReport;
11 11
 import com.huiju.estateagents.service.ITaBuildingReportService;
12 12
 import org.slf4j.Logger;
13 13
 import org.slf4j.LoggerFactory;
14 14
 import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.PathVariable;
16
-import org.springframework.web.bind.annotation.RequestBody;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RequestMethod;
19
-import org.springframework.web.bind.annotation.RequestParam;
20
-import org.springframework.web.bind.annotation.ResponseBody;
21
-import org.springframework.web.bind.annotation.RestController;
22
-import com.huiju.estateagents.base.BaseController;
15
+import org.springframework.web.bind.annotation.*;
23 16
 
24 17
 import javax.servlet.http.HttpServletRequest;
25 18
 import java.time.LocalDateTime;
@@ -52,7 +45,7 @@ public class TaBuildingReportController extends BaseController {
52 45
      */
53 46
     @RequestMapping(value="/admin/taBuildingReports",method= RequestMethod.GET)
54 47
     public ResponseBean taBuildingReportList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55
-                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
48
+                                             @RequestParam(value ="pageSize",defaultValue = "20") Integer pageSize,
56 49
                                              HttpServletRequest request){
57 50
         ResponseBean responseBean = new ResponseBean();
58 51
         try {

+ 149
- 0
src/main/java/com/huiju/estateagents/controller/TaCustomerFromController.java Прегледај датотеку

@@ -0,0 +1,149 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import org.slf4j.Logger;
9
+import org.slf4j.LoggerFactory;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RequestMethod;
15
+import org.springframework.web.bind.annotation.RequestParam;
16
+import org.springframework.web.bind.annotation.ResponseBody;
17
+import com.huiju.estateagents.service.ITaCustomerFromService;
18
+import com.huiju.estateagents.entity.TaCustomerFrom;
19
+import org.springframework.web.bind.annotation.RestController;
20
+
21
+/**
22
+ * <p>
23
+    * 客户来源  前端控制器
24
+    * </p>
25
+ *
26
+ * @author yansen
27
+ * @since 2020-04-27
28
+ */
29
+@RestController
30
+@RequestMapping("/")
31
+public class TaCustomerFromController extends BaseController {
32
+
33
+    private final Logger logger = LoggerFactory.getLogger(TaCustomerFromController.class);
34
+
35
+    @Autowired
36
+    public ITaCustomerFromService iTaCustomerFromService;
37
+
38
+
39
+    /**
40
+     * 分页查询列表
41
+     * @param pageNum
42
+     * @param pageSize
43
+     * @return
44
+     */
45
+    @RequestMapping(value="/taCustomerFrom",method= RequestMethod.GET)
46
+    public ResponseBean taCustomerFromList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48
+        ResponseBean responseBean = new ResponseBean();
49
+        try {
50
+            //使用分页插件
51
+		    IPage<TaCustomerFrom> pg = new Page<>(pageNum, pageSize);
52
+            QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.orderByDesc("create_date");
54
+
55
+            IPage<TaCustomerFrom> result = iTaCustomerFromService.page(pg, queryWrapper);
56
+            responseBean.addSuccess(result);
57
+        }catch (Exception e){
58
+            e.printStackTrace();
59
+            logger.error("taCustomerFromList -=- {}",e.toString());
60
+            responseBean.addError(e.getMessage());
61
+        }
62
+        return responseBean;
63
+    }
64
+
65
+    /**
66
+     * 保存对象
67
+     * @param taCustomerFrom 实体对象
68
+     * @return
69
+     */
70
+    @RequestMapping(value="/taCustomerFrom",method= RequestMethod.POST)
71
+    public ResponseBean taCustomerFromAdd(@RequestBody TaCustomerFrom taCustomerFrom){
72
+        ResponseBean responseBean = new ResponseBean();
73
+        try {
74
+            if (iTaCustomerFromService.save(taCustomerFrom)){
75
+                responseBean.addSuccess(taCustomerFrom);
76
+            }else {
77
+                responseBean.addError("fail");
78
+            }
79
+        }catch (Exception e){
80
+            e.printStackTrace();
81
+            logger.error("taCustomerFromAdd -=- {}",e.toString());
82
+            responseBean.addError(e.getMessage());
83
+        }
84
+        return responseBean;
85
+    }
86
+
87
+    /**
88
+     * 根据id删除对象
89
+     * @param id  实体ID
90
+     */
91
+    @ResponseBody
92
+    @RequestMapping(value="/taCustomerFrom/{id}", method= RequestMethod.DELETE)
93
+    public ResponseBean taCustomerFromDelete(@PathVariable Integer id){
94
+        ResponseBean responseBean = new ResponseBean();
95
+        try {
96
+            if(iTaCustomerFromService.removeById(id)){
97
+                responseBean.addSuccess("success");
98
+            }else {
99
+                responseBean.addError("fail");
100
+            }
101
+        }catch (Exception e){
102
+            e.printStackTrace();
103
+            logger.error("taCustomerFromDelete -=- {}",e.toString());
104
+            responseBean.addError(e.getMessage());
105
+        }
106
+        return responseBean;
107
+    }
108
+
109
+    /**
110
+     * 修改对象
111
+     * @param id  实体ID
112
+     * @param taCustomerFrom 实体对象
113
+     * @return
114
+     */
115
+    @RequestMapping(value="/taCustomerFrom/{id}",method= RequestMethod.PUT)
116
+    public ResponseBean taCustomerFromUpdate(@PathVariable Integer id,
117
+                                        @RequestBody TaCustomerFrom taCustomerFrom){
118
+        ResponseBean responseBean = new ResponseBean();
119
+        try {
120
+            if (iTaCustomerFromService.updateById(taCustomerFrom)){
121
+                responseBean.addSuccess(taCustomerFrom);
122
+            }else {
123
+                responseBean.addError("fail");
124
+            }
125
+        }catch (Exception e){
126
+            e.printStackTrace();
127
+            logger.error("taCustomerFromUpdate -=- {}",e.toString());
128
+            responseBean.addError(e.getMessage());
129
+        }
130
+        return responseBean;
131
+    }
132
+
133
+    /**
134
+     * 根据id查询对象
135
+     * @param id  实体ID
136
+     */
137
+    @RequestMapping(value="/taCustomerFrom/{id}",method= RequestMethod.GET)
138
+    public ResponseBean taCustomerFromGet(@PathVariable Integer id){
139
+        ResponseBean responseBean = new ResponseBean();
140
+        try {
141
+            responseBean.addSuccess(iTaCustomerFromService.getById(id));
142
+        }catch (Exception e){
143
+            e.printStackTrace();
144
+            logger.error("taCustomerFromDelete -=- {}",e.toString());
145
+            responseBean.addError(e.getMessage());
146
+        }
147
+        return responseBean;
148
+    }
149
+}

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java Прегледај датотеку

@@ -62,7 +62,7 @@ public class TaLiveActivityController extends BaseController {
62 62
         ResponseBean responseBean = new ResponseBean();
63 63
         try {
64 64
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, getOrgId(request),
65
-                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request));
65
+                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request));
66 66
             responseBean.addSuccess(result);
67 67
 
68 68
         } catch (Exception e) {
@@ -255,7 +255,7 @@ public class TaLiveActivityController extends BaseController {
255 255
             status = status == null ? 1 : status;
256 256
             Integer orgId = getOrgId(request);
257 257
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
258
-                    liveActivityTitle, cityId, buildingId, status, null);
258
+                    liveActivityTitle, cityId, buildingId, status, null, null);
259 259
             responseBean.addSuccess(result);
260 260
 
261 261
         } catch (Exception e) {

+ 326
- 233
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 1
- 0
src/main/java/com/huiju/estateagents/controller/TaSalesBatchController.java Прегледај датотеку

@@ -277,6 +277,7 @@ public class TaSalesBatchController extends BaseController {
277 277
             taPreselection.setStatus(taSalesBatch.getStatus());
278 278
             taPreselectionQueryWrapper.eq("org_id", getOrgId(request));
279 279
             taPreselectionQueryWrapper.eq("sales_batch_id", taSalesBatch.getSalesBatchId());
280
+            taPreselectionQueryWrapper.ne("status", CommConstant.STATUS_DELETE);
280 281
             taPreselectionService.update(taPreselection, taPreselectionQueryWrapper);
281 282
 
282 283
             QueryWrapper<TaRaise> taRaiseQueryWrapper = new QueryWrapper<>();

+ 1
- 0
src/main/java/com/huiju/estateagents/controller/TaSharePersonFromController.java Прегледај датотеку

@@ -222,6 +222,7 @@ public class TaSharePersonFromController extends BaseController {
222 222
         try {
223 223
             QueryWrapper<TdLiveDict> tdLiveDictQueryWrapper = new QueryWrapper<>();
224 224
             tdLiveDictQueryWrapper.eq("status", 1);
225
+            tdLiveDictQueryWrapper.orderByDesc("sort");
225 226
             List<TdLiveDict> tdLiveDictList = tdLiveDictService.list(tdLiveDictQueryWrapper);
226 227
             responseBean.addSuccess(tdLiveDictList);
227 228
         }catch (Exception e){

+ 14
- 11
src/main/java/com/huiju/estateagents/controller/TdCityController.java Прегледај датотеку

@@ -1,10 +1,8 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
-import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.huiju.estateagents.base.BaseController;
6 5
 import com.huiju.estateagents.base.ResponseBean;
7
-import com.huiju.estateagents.common.CommConstant;
8 6
 import com.huiju.estateagents.entity.TaMiniapp;
9 7
 import com.huiju.estateagents.entity.TaOrgCity;
10 8
 import com.huiju.estateagents.entity.TdCity;
@@ -14,14 +12,7 @@ import com.huiju.estateagents.service.ITdCityService;
14 12
 import org.slf4j.Logger;
15 13
 import org.slf4j.LoggerFactory;
16 14
 import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.web.bind.annotation.PathVariable;
18
-import org.springframework.web.bind.annotation.RequestBody;
19
-import org.springframework.web.bind.annotation.RequestMapping;
20
-import org.springframework.web.bind.annotation.RequestMethod;
21
-import org.springframework.web.bind.annotation.RequestParam;
22
-import org.springframework.web.bind.annotation.ResponseBody;
23
-import org.springframework.web.bind.annotation.RestController;
24
-import com.huiju.estateagents.base.BaseController;
15
+import org.springframework.web.bind.annotation.*;
25 16
 
26 17
 import javax.servlet.http.HttpServletRequest;
27 18
 import java.util.List;
@@ -78,6 +69,18 @@ public class TdCityController extends BaseController {
78 69
         return responseBean;
79 70
     }
80 71
 
72
+    /**
73
+     * 业务端城市
74
+     */
75
+    @RequestMapping(value = "/admin/tdCityList/tdAreaCity", method = RequestMethod.GET)
76
+    public ResponseBean adminTdAreaCityList(@RequestParam(value = "cityId", required = false) Integer cityId,
77
+                                    HttpServletRequest request) {
78
+        ResponseBean responseBean = new ResponseBean<>();
79
+        List<TaOrgCity> taOrgCityList = taOrgCityMapper.selectAdminTdAreaCityList(getOrgId(request),cityId);
80
+        responseBean.addSuccess(taOrgCityList);
81
+        return responseBean;
82
+    }
83
+
81 84
 
82 85
     /**
83 86
      * 查询列表

+ 1
- 0
src/main/java/com/huiju/estateagents/controller/TdPointsRulesController.java Прегледај датотеку

@@ -118,6 +118,7 @@ public class TdPointsRulesController extends BaseController {
118 118
             queryWrapper.eq(StringUtils.isNotBlank(buildingId),"building_id", buildingId);
119 119
             Integer orgId = getOrgId(request);
120 120
             queryWrapper.eq(orgId != null,"org_id",orgId);
121
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
121 122
             if(null != type){
122 123
                 if (CommConstant.POINTS_RULE_PLATFORM.equals(type)) {
123 124
                     queryWrapper.isNull("building_id");

+ 105
- 0
src/main/java/com/huiju/estateagents/controller/TsActivityDailyController.java Прегледај датотеку

@@ -0,0 +1,105 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.DateUtils;
9
+import com.huiju.estateagents.common.ExcelUtils;
10
+import com.huiju.estateagents.common.StringUtils;
11
+import com.huiju.estateagents.excel.ActivityDailyExport;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.*;
16
+import com.huiju.estateagents.service.ITsActivityDailyService;
17
+import com.huiju.estateagents.entity.TsActivityDaily;
18
+
19
+import javax.servlet.http.HttpServletRequest;
20
+import javax.servlet.http.HttpServletResponse;
21
+import java.io.IOException;
22
+import java.util.List;
23
+
24
+/**
25
+ * <p>
26
+    * 活动统计  前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2020-04-20
31
+ */
32
+@RestController
33
+@RequestMapping("/api/admin/stats")
34
+public class TsActivityDailyController extends BaseController {
35
+
36
+    private final Logger logger = LoggerFactory.getLogger(TsActivityDailyController.class);
37
+
38
+    @Autowired
39
+    public ITsActivityDailyService iTsActivityDailyService;
40
+
41
+    @GetMapping("/activity/detail")
42
+    public ResponseBean getActivityDetail(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
43
+                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
44
+                                          // startDate 默认格式 YYYY-MM-DD
45
+                                          @RequestParam(value ="startDate", required = false) String startDate,
46
+                                          @RequestParam(value ="endDate", required = false) String endDate,
47
+                                          @RequestParam(value ="buildingId", required = false) String buildingId,
48
+                                          @RequestParam(value ="targetType", required = false) String targetType,
49
+                                          @RequestParam(value ="targetId", required = false) String targetId,
50
+                                          @RequestParam(value ="targetName", required = false) String targetName,
51
+                                          @RequestParam(value ="asc", required = false) String asc,
52
+                                          @RequestParam(value ="desc", required = false) String desc,
53
+                                          HttpServletRequest request) {
54
+
55
+        if (null == startDate || "".equals(startDate)) {
56
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
57
+        }
58
+        if (null == endDate || "".equals(endDate)) {
59
+            endDate = DateUtils.today();
60
+        }
61
+
62
+        Integer orgId = getOrgId(request);
63
+
64
+//        IPage<TsActivityDaily> page = new Page<>(pageNum, pageSize);
65
+//        IPage<TsActivityDaily> result = iTsActivityDailyService.getActivityDetail(page, orgId, startDate, endDate, buildingId, targetType, targetId, targetName, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
66
+        List<TsActivityDaily>  result = iTsActivityDailyService.getActivityDetail(orgId, startDate, endDate, buildingId, targetType, targetId, targetName, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
67
+
68
+        return ResponseBean.success(result);
69
+    }
70
+
71
+    @PostMapping("/activity/detail")
72
+    public ResponseBean getActivityDetail(// startDate 默认格式 YYYY-MM-DD
73
+                                          @RequestParam(value ="startDate", required = false) String startDate,
74
+                                          @RequestParam(value ="endDate", required = false) String endDate,
75
+                                          @RequestParam(value ="buildingId", required = false) String buildingId,
76
+                                          @RequestParam(value ="targetType", required = false) String targetType,
77
+                                          @RequestParam(value ="targetId", required = false) String targetId,
78
+                                          @RequestParam(value ="targetName", required = false) String targetName,
79
+                                          HttpServletRequest request,
80
+                                          HttpServletResponse response) {
81
+
82
+        if (null == startDate || "".equals(startDate)) {
83
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
84
+        }
85
+        if (null == endDate || "".equals(endDate)) {
86
+            endDate = DateUtils.today();
87
+        }
88
+        if (null == targetType || "".equals(targetType) || null == targetId || "".equals(targetId)) {
89
+            return ResponseBean.error("活动类型或者ID 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
90
+        }
91
+
92
+        Integer orgId = getOrgId(request);
93
+        List<ActivityDailyExport> result = iTsActivityDailyService.getActivityExport(orgId, startDate, endDate, buildingId, targetType, targetId);
94
+
95
+        try {
96
+            ExcelUtils.flush(response, ActivityDailyExport.class, result, StringUtils.strToUnicode(targetName + "活动统计"));
97
+        } catch (IOException e) {
98
+//            e.printStackTrace();
99
+            return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
100
+        }
101
+
102
+        return null;
103
+    }
104
+
105
+}

+ 470
- 0
src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java Прегледај датотеку

@@ -0,0 +1,470 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
6
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7
+import com.baomidou.mybatisplus.core.metadata.IPage;
8
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
+import com.huiju.estateagents.base.BaseController;
10
+import com.huiju.estateagents.base.ResponseBean;
11
+import com.huiju.estateagents.center.taUser.entity.TaUser;
12
+import com.huiju.estateagents.common.DateUtils;
13
+import com.huiju.estateagents.common.ExcelUtils;
14
+import com.huiju.estateagents.common.StringUtils;
15
+import com.huiju.estateagents.entity.*;
16
+import com.huiju.estateagents.excel.ConsultantKPIExport;
17
+import com.huiju.estateagents.excel.TaActivityDynamicEnlistExport;
18
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
19
+import io.swagger.models.auth.In;
20
+import org.slf4j.Logger;
21
+import org.slf4j.LoggerFactory;
22
+import org.springframework.beans.factory.annotation.Autowired;
23
+import org.springframework.web.bind.annotation.*;
24
+import com.huiju.estateagents.service.ITsConsultantKpiService;
25
+
26
+import javax.servlet.http.HttpServletRequest;
27
+import javax.servlet.http.HttpServletResponse;
28
+import java.time.LocalDateTime;
29
+import java.util.ArrayList;
30
+import java.util.HashMap;
31
+import java.util.List;
32
+
33
+/**
34
+ * <p>
35
+ * 置业顾问KPI  前端控制器
36
+ * </p>
37
+ *
38
+ * @author yansen
39
+ * @since 2020-04-14
40
+ */
41
+@RestController
42
+@RequestMapping("/api/admin/stats")
43
+public class TsConsultantKpiController extends BaseController {
44
+
45
+    private final Logger logger = LoggerFactory.getLogger(TsConsultantKpiController.class);
46
+
47
+    @Autowired
48
+    public ITsConsultantKpiService iTsConsultantKpiService;
49
+
50
+    /**
51
+     * 分页查询列表
52
+     *
53
+     * @param pageNum
54
+     * @param pageSize
55
+     * @param startDate
56
+     * @param endDate
57
+     * @param buildingId
58
+     * @param asc
59
+     * @param desc
60
+     * @param request
61
+     * @return
62
+     */
63
+    @RequestMapping(value = "/consultant/kpi", method = RequestMethod.GET)
64
+    public ResponseBean stsConsultantKpiList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
65
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
66
+                                             // startDate 默认格式 YYYYMMDD
67
+                                             @RequestParam(value = "startDate", required = false) String startDate,
68
+                                             @RequestParam(value = "endDate", required = false) String endDate,
69
+                                             @RequestParam(value = "buildingId", required = false) String buildingId,
70
+                                             @RequestParam(value = "asc", required = false) String asc,
71
+                                             @RequestParam(value = "desc", required = false) String desc,
72
+                                             HttpServletRequest request) {
73
+        if (null == startDate || "".equals(startDate)) {
74
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
75
+        }
76
+        if (null == endDate || "".equals(endDate)) {
77
+            endDate = DateUtils.today();
78
+        }
79
+
80
+        Integer orgId = getOrgId(request);
81
+        Integer userId = getUserId(request);
82
+        try {
83
+            // 汇总明细
84
+            IPage<TsConsultantKpi> result = iTsConsultantKpiService.stsKPIDaily(pageNum, pageSize, orgId, userId, buildingId, startDate, endDate, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
85
+            // 汇总
86
+            TsConsultantKpi total = iTsConsultantKpiService.stsKPITotalByOrg(orgId, userId, buildingId, startDate, endDate);
87
+            return ResponseBean.success(new HashMap<String, Object>() {{
88
+                put("paged", result);
89
+                put("total", total);
90
+            }});
91
+        } catch (Exception e) {
92
+            logger.error("stsConsultantKpiList 异常:", e);
93
+            return ResponseBean.error("查询出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
94
+        }
95
+    }
96
+
97
+
98
+    /**
99
+     * 导出
100
+     *
101
+     * @param startDate
102
+     * @param endDate
103
+     * @param buildingId
104
+     * @param request
105
+     * @return
106
+     */
107
+    @RequestMapping(value = "/consultant/kpi", method = RequestMethod.POST)
108
+    public ResponseBean stsConsultantKpiExport(// startDate 默认格式 YYYYMMDD
109
+                                               @RequestParam(value = "startDate", required = false) String startDate,
110
+                                               @RequestParam(value = "endDate", required = false) String endDate,
111
+                                               @RequestParam(value = "buildingId", required = false) String buildingId,
112
+                                               HttpServletRequest request,
113
+                                               HttpServletResponse response
114
+    ) {
115
+        if (null == startDate || "".equals(startDate)) {
116
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
117
+        }
118
+        if (null == endDate || "".equals(endDate)) {
119
+            endDate = DateUtils.today();
120
+        }
121
+
122
+        Integer orgId = getOrgId(request);
123
+        Integer userId = getUserId(request);
124
+        try {
125
+
126
+            // 汇总明细
127
+            List<ConsultantKPIExport> result = iTsConsultantKpiService.stsKPIDailyExport(orgId, userId, buildingId, startDate, endDate);
128
+            ExcelUtils.flush(response, ConsultantKPIExport.class, result, "置业顾问KPI统计" + DateUtils.today());
129
+        } catch (Exception e) {
130
+//            e.printStackTrace();
131
+            return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
132
+        }
133
+
134
+        return null;
135
+    }
136
+
137
+    private LocalDateTime[] getLocalTimeRangeBy(String startDate, String endDate) throws Exception {
138
+        LocalDateTime startTime = null;
139
+        LocalDateTime endTime = null;
140
+
141
+        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
142
+            if (startDate.length() != 8 && endDate.length() != 8) {
143
+                throw new Exception("日期格式必须为YYYYMMDD");
144
+            }
145
+
146
+            startTime = DateUtils.day2LocalDateime(startDate.substring(0, 4) + "-" + startDate.substring(4, 6) + "-" + startDate.substring(6, 8));
147
+            endTime = DateUtils.dayToLocalDateime(endDate.substring(0, 4) + "-" + endDate.substring(4, 6) + "-" + endDate.substring(6, 8) + " 23:59:59");
148
+        }
149
+
150
+        return new LocalDateTime[]{startTime, endTime};
151
+    }
152
+
153
+    /**
154
+     * 查询置业的客户
155
+     * startDate 存在则统计新增客户, 不存在则统计所有
156
+     *
157
+     * @param pageNum
158
+     * @param pageSize
159
+     * @param buildingId
160
+     * @param userId
161
+     * @param startDate
162
+     * @param endDate
163
+     * @param request
164
+     * @return
165
+     */
166
+    @GetMapping("/consultant/customer")
167
+    public ResponseBean getConsultantCustomers(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
168
+                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
169
+                                               @RequestParam(value = "buildingId", required = false) String buildingId,
170
+                                               @RequestParam(value = "userId") String userId,
171
+                                               @RequestParam(value = "startDate", required = false) String startDate,
172
+                                               @RequestParam(value = "endDate", required = false) String endDate,
173
+                                               HttpServletRequest request
174
+    ) {
175
+        LocalDateTime[] dateRange = {null, null};
176
+        try {
177
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
178
+        } catch (Exception e) {
179
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
180
+        }
181
+
182
+        Integer orgId = getOrgId(request);
183
+        IPage<TaRecommendCustomer> page = new Page<>(pageNum, pageSize);
184
+        IPage<TaRecommendCustomer> result = iTsConsultantKpiService.getCustomerListOfConsultant(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
185
+        return ResponseBean.success(result);
186
+    }
187
+
188
+    /**
189
+     * 置业分享拓客
190
+     *
191
+     * @param pageNum
192
+     * @param pageSize
193
+     * @param buildingId
194
+     * @param userId
195
+     * @param startDate
196
+     * @param endDate
197
+     * @param request
198
+     * @return
199
+     */
200
+    @GetMapping("/consultant/share/customer")
201
+    public ResponseBean getConsultantShareCustomers(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
202
+                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
203
+                                                    @RequestParam(value = "buildingId", required = false) String buildingId,
204
+                                                    @RequestParam(value = "userId") String userId,
205
+                                                    @RequestParam(value = "startDate", required = false) String startDate,
206
+                                                    @RequestParam(value = "endDate", required = false) String endDate,
207
+                                                    HttpServletRequest request) {
208
+
209
+        LocalDateTime[] dateRange = {null, null};
210
+        try {
211
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
212
+        } catch (Exception e) {
213
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
214
+        }
215
+
216
+        Integer orgId = getOrgId(request);
217
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
218
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantShareCustomers(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
219
+        return ResponseBean.success(result);
220
+    }
221
+
222
+    /**
223
+     * 置业首页访问人数
224
+     *
225
+     * @param pageNum
226
+     * @param pageSize
227
+     * @param buildingId
228
+     * @param userId
229
+     * @param startDate
230
+     * @param endDate
231
+     * @param request
232
+     * @return
233
+     */
234
+    @GetMapping("/consultant/homepage/persons")
235
+    public ResponseBean getConsultantHomePagePersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
236
+                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
237
+                                                     @RequestParam(value = "buildingId", required = false) String buildingId,
238
+                                                     @RequestParam(value = "userId") String userId,
239
+                                                     @RequestParam(value = "startDate", required = false) String startDate,
240
+                                                     @RequestParam(value = "endDate", required = false) String endDate,
241
+                                                     HttpServletRequest request) {
242
+        LocalDateTime[] dateRange = {null, null};
243
+        try {
244
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
245
+        } catch (Exception e) {
246
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
247
+        }
248
+
249
+        Integer orgId = getOrgId(request);
250
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
251
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantHomePagePersons(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
252
+        return ResponseBean.success(result);
253
+    }
254
+
255
+    /**
256
+     * 置业首页访问次数
257
+     *
258
+     * @param pageNum
259
+     * @param pageSize
260
+     * @param buildingId
261
+     * @param userId
262
+     * @param startDate
263
+     * @param endDate
264
+     * @param request
265
+     * @return
266
+     */
267
+    @GetMapping("/consultant/homepage/times")
268
+    public ResponseBean getConsultantHomePageTimes(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
269
+                                                   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
270
+                                                   @RequestParam(value = "buildingId", required = false) String buildingId,
271
+                                                   @RequestParam(value = "userId") String userId,
272
+                                                   @RequestParam(value = "startDate", required = false) String startDate,
273
+                                                   @RequestParam(value = "endDate", required = false) String endDate,
274
+                                                   @RequestParam(value = "personId", required = false) String personId,
275
+                                                   HttpServletRequest request) {
276
+        LocalDateTime[] dateRange = {null, null};
277
+        try {
278
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
279
+        } catch (Exception e) {
280
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
281
+        }
282
+
283
+        Integer orgId = getOrgId(request);
284
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
285
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantHomePageTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1], personId);
286
+        return ResponseBean.success(result);
287
+    }
288
+
289
+    /**
290
+     * 咨询置业次数
291
+     *
292
+     * @param pageNum
293
+     * @param pageSize
294
+     * @param buildingId
295
+     * @param userId
296
+     * @param startDate
297
+     * @param endDate
298
+     * @param request
299
+     * @return
300
+     */
301
+    @GetMapping("/consultant/chat/persons")
302
+    public ResponseBean getConsultantChatPersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
303
+                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
304
+                                                 @RequestParam(value = "buildingId", required = false) String buildingId,
305
+                                                 @RequestParam(value = "userId") String userId,
306
+                                                 @RequestParam(value = "startDate", required = false) String startDate,
307
+                                                 @RequestParam(value = "endDate", required = false) String endDate,
308
+                                                 HttpServletRequest request) {
309
+        LocalDateTime[] dateRange = {null, null};
310
+        try {
311
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
312
+        } catch (Exception e) {
313
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
314
+        }
315
+
316
+        Integer orgId = getOrgId(request);
317
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
318
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantChatPersons(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
319
+        return ResponseBean.success(result);
320
+    }
321
+
322
+    /**
323
+     * 点赞详情
324
+     *
325
+     * @param pageNum
326
+     * @param pageSize
327
+     * @param buildingId
328
+     * @param userId
329
+     * @param startDate
330
+     * @param endDate
331
+     * @param request
332
+     * @return
333
+     */
334
+    @GetMapping("/consultant/favor")
335
+    public ResponseBean getConsultantFavor(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
336
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
337
+                                           @RequestParam(value = "buildingId", required = false) String buildingId,
338
+                                           @RequestParam(value = "userId") String userId,
339
+                                           @RequestParam(value = "startDate", required = false) String startDate,
340
+                                           @RequestParam(value = "endDate", required = false) String endDate,
341
+                                           HttpServletRequest request) {
342
+        LocalDateTime[] dateRange = {null, null};
343
+        try {
344
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
345
+        } catch (Exception e) {
346
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
347
+        }
348
+
349
+        Integer orgId = getOrgId(request);
350
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
351
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantFavor(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
352
+        return ResponseBean.success(result);
353
+    }
354
+
355
+    /**
356
+     * 置业分享次数
357
+     *
358
+     * @param pageNum
359
+     * @param pageSize
360
+     * @param buildingId
361
+     * @param userId
362
+     * @param startDate
363
+     * @param endDate
364
+     * @param targetType
365
+     * @param targetName
366
+     * @param request
367
+     * @return
368
+     */
369
+    @GetMapping("/consultant/share/targets")
370
+    public ResponseBean getConsultantShareTargets(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
371
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
372
+                                                  @RequestParam(value = "buildingId", required = false) String buildingId,
373
+                                                  @RequestParam(value = "userId") String userId,
374
+                                                  @RequestParam(value = "startDate", required = false) String startDate,
375
+                                                  @RequestParam(value = "endDate", required = false) String endDate,
376
+                                                  @RequestParam(value = "targetType", required = false) String targetType,
377
+                                                  @RequestParam(value = "targetName", required = false) String targetName,
378
+                                                  HttpServletRequest request) {
379
+        LocalDateTime[] dateRange = {null, null};
380
+        try {
381
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
382
+        } catch (Exception e) {
383
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
384
+        }
385
+
386
+        Integer orgId = getOrgId(request);
387
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
388
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantShareTargets(page, orgId, userId, buildingId, dateRange[0], dateRange[1], targetType, targetName);
389
+        return ResponseBean.success(result);
390
+    }
391
+
392
+    /**
393
+     * 置业分享访问人数
394
+     *
395
+     * @param pageNum
396
+     * @param pageSize
397
+     * @param buildingId
398
+     * @param userId
399
+     * @param startDate
400
+     * @param endDate
401
+     * @param request
402
+     * @return
403
+     */
404
+    @GetMapping("/consultant/share/persons")
405
+    public ResponseBean getConsultantSharePersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
406
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
407
+                                                  @RequestParam(value = "buildingId", required = false) String buildingId,
408
+                                                  @RequestParam(value = "userId") String userId,
409
+                                                  @RequestParam(value = "startDate", required = false) String startDate,
410
+                                                  @RequestParam(value = "endDate", required = false) String endDate,
411
+                                                  HttpServletRequest request) {
412
+        LocalDateTime[] dateRange = {null, null};
413
+        try {
414
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
415
+        } catch (Exception e) {
416
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
417
+        }
418
+
419
+        Integer orgId = getOrgId(request);
420
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
421
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantSharePersons(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
422
+        return ResponseBean.success(result);
423
+    }
424
+
425
+    /**
426
+     * 置业分享访问次数
427
+     *
428
+     * @param pageNum
429
+     * @param pageSize
430
+     * @param buildingId
431
+     * @param userId
432
+     * @param startDate
433
+     * @param endDate
434
+     * @param targetType
435
+     * @param targetName
436
+     * @param request
437
+     * @return
438
+     */
439
+    @GetMapping("/consultant/share/times")
440
+    public ResponseBean getConsultantShareTimes(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
441
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
442
+                                                @RequestParam(value = "buildingId", required = false) String buildingId,
443
+                                                @RequestParam(value = "userId") String userId,
444
+                                                @RequestParam(value = "startDate", required = false) String startDate,
445
+                                                @RequestParam(value = "endDate", required = false) String endDate,
446
+                                                @RequestParam(value = "targetType", required = false) String targetType,
447
+                                                @RequestParam(value = "targetName", required = false) String targetName,
448
+                                                @RequestParam(value = "userName", required = false) String userName,
449
+                                                @RequestParam(value = "personId", required = false) String personId,
450
+                                                HttpServletRequest request) {
451
+        LocalDateTime[] dateRange = {null, null};
452
+        try {
453
+            dateRange = getLocalTimeRangeBy(startDate, endDate);
454
+        } catch (Exception e) {
455
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
456
+        }
457
+
458
+        // 如果 personId 与 userName 同时存在, 以 personId 为准
459
+        if (!StringUtils.isEmpty(personId)) {
460
+            userName = null;
461
+        }
462
+
463
+        Integer orgId = getOrgId(request);
464
+        IPage<TaPerson> page = new Page<>(pageNum, pageSize);
465
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantShareTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1], targetType, targetName, userName, personId);
466
+        return ResponseBean.success(result);
467
+    }
468
+
469
+
470
+}

+ 9
- 12
src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java Прегледај датотеку

@@ -9,35 +9,26 @@ import com.huiju.estateagents.common.CommConstant;
9 9
 import com.huiju.estateagents.common.DateUtils;
10 10
 import com.huiju.estateagents.common.StringUtils;
11 11
 import com.huiju.estateagents.drainage.entity.TaDrainage;
12
-import com.huiju.estateagents.drainage.entity.TaDrainageRecord;
13 12
 import com.huiju.estateagents.drainage.service.ITaDrainageRecordService;
14 13
 import com.huiju.estateagents.drainage.service.ITaDrainageService;
15 14
 import com.huiju.estateagents.entity.ExtendContent;
16 15
 import com.huiju.estateagents.entity.TaMiniapp;
16
+import com.huiju.estateagents.entity.TaPersonBuilding;
17 17
 import com.huiju.estateagents.mapper.TaMiniappMapper;
18 18
 import com.huiju.estateagents.service.IExtendContentService;
19 19
 import com.huiju.estateagents.service.IMiniAppService;
20 20
 import com.huiju.estateagents.third.entity.TaThirdPartyMiniappConfig;
21 21
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
22
-import io.swagger.models.auth.In;
23 22
 import org.slf4j.Logger;
24 23
 import org.slf4j.LoggerFactory;
25 24
 import org.springframework.beans.factory.annotation.Autowired;
26
-import org.springframework.boot.json.YamlJsonParser;
27
-import org.springframework.web.bind.annotation.PathVariable;
28
-import org.springframework.web.bind.annotation.RequestBody;
29
-import org.springframework.web.bind.annotation.RequestMapping;
30
-import org.springframework.web.bind.annotation.RequestMethod;
31
-import org.springframework.web.bind.annotation.RequestParam;
32
-import org.springframework.web.bind.annotation.ResponseBody;
33
-import org.springframework.web.bind.annotation.RestController;
25
+import org.springframework.web.bind.annotation.*;
34 26
 
35 27
 import javax.servlet.http.HttpServletRequest;
36
-import java.text.DateFormat;
37 28
 import java.time.LocalDateTime;
38
-import java.time.format.DateTimeFormatter;
39 29
 import java.util.List;
40 30
 import java.util.UUID;
31
+import java.util.stream.Collectors;
41 32
 
42 33
 
43 34
 /**
@@ -89,6 +80,7 @@ public class TaDrainageController extends BaseController {
89 80
                                        HttpServletRequest request){
90 81
         ResponseBean responseBean = new ResponseBean();
91 82
         try {
83
+            List<TaPersonBuilding> taPersonBuildingList = getTaPersonBuildingListByUserId(request);
92 84
             //使用分页插件
93 85
 		    IPage<TaDrainage> pg = new Page<>(pageNum, pageSize);
94 86
             QueryWrapper<TaDrainage> queryWrapper = new QueryWrapper<>();
@@ -100,6 +92,7 @@ public class TaDrainageController extends BaseController {
100 92
             queryWrapper.eq(null != status,"status",status);
101 93
             queryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id",buildingId);
102 94
             queryWrapper.eq(null != drainageId,"drainage_id",drainageId);
95
+            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id",taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user",getUserId(request)));
103 96
             queryWrapper.like(!StringUtils.isEmpty(name),"name",name);
104 97
             queryWrapper.orderByDesc("create_date");
105 98
 
@@ -141,6 +134,7 @@ public class TaDrainageController extends BaseController {
141 134
             if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isAfter(LocalDateTime.now())){
142 135
                 taDrainage.setStatus(CommConstant.STATUS_NORMAL);
143 136
             }
137
+            taDrainage.setCreateUser(getUserId(request));
144 138
             if (iTaDrainageService.save(taDrainage)){
145 139
                 // 根据ORGID查询当前小程序表的miniapp_id
146 140
                 QueryWrapper<TaMiniapp> taMiniappQuery= new QueryWrapper<>();
@@ -296,6 +290,9 @@ public class TaDrainageController extends BaseController {
296 290
             queryWrapper.eq("org_id",taDrainage.getOrgId());
297 291
             queryWrapper.eq("content_type",CommConstant.EVENT_H5);
298 292
             queryWrapper.eq("target_id",taDrainage.getDrainageId());
293
+
294
+            queryWrapper.gt("status", CommConstant.STATUS_DELETE); // fix bug #6816
295
+
299 296
             List<ExtendContent> list = iExtendContentService.list(queryWrapper);
300 297
             if (null != taDrainage.getStatus() && taDrainage.getStatus().equals(CommConstant.STATUS_NORMAL)){
301 298
                 taDrainage.setStatus(CommConstant.STATUS_UNACCALIMED);

+ 6
- 0
src/main/java/com/huiju/estateagents/drainage/entity/TaDrainage.java Прегледај датотеку

@@ -61,6 +61,11 @@ public class TaDrainage implements Serializable {
61 61
      */
62 62
     private Integer enlistNum;
63 63
 
64
+    /**
65
+     * 创建人
66
+     */
67
+    private Integer createUser;
68
+
64 69
     /** 是否投放小程序 */
65 70
     private Boolean isMiniapp ;
66 71
     /** H5活动链接 */
@@ -80,4 +85,5 @@ public class TaDrainage implements Serializable {
80 85
     
81 86
     @TableField(exist = false)
82 87
     private String appSecret;
88
+
83 89
 }

+ 8
- 6
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanyController.java Прегледај датотеку

@@ -462,6 +462,8 @@ public class TaCompanyController extends BaseController {
462 462
             taContractUserQueryWrapper.eq("certified_serial_number",serialNo);
463 463
             TaContractUser taContractUser = iTaContractUserService.getOne(taContractUserQueryWrapper);
464 464
             taContractUser.setStatus(Integer.valueOf(status));
465
+            taContractUser.setAuthStatus("autoSign");
466
+            iTaContractUserService.updateById(taContractUser);
465 467
 //            //如果状态是失败的情况下就发送短信  先注释如果没问题就删除
466 468
 //            if (status.equals("1")){
467 469
 //                logger.info("发送短信");
@@ -485,8 +487,8 @@ public class TaCompanyController extends BaseController {
485 487
 //                }
486 488
 //
487 489
 //            }
488
-            taContractUser.setAuthStatus("autoSign");
489
-            iTaContractUserService.updateById(taContractUser);
490
+
491
+
490 492
         }
491 493
     }
492 494
 
@@ -589,8 +591,8 @@ public class TaCompanyController extends BaseController {
589 591
         Map<String, String[]> parameterMap = request.getParameterMap();
590 592
         if ("3000".equals(result_code)){
591 593
             TaContract taContract = iTaContractService.getById(parameterMap.get("contract_id")[0]);
592
-            taContract.setContractDownloadUrl(download_url);
593
-            taContract.setContractViewUrl(viewpdf_url);
594
+//            taContract.setContractDownloadUrl(download_url);
595
+//            taContract.setContractViewUrl(viewpdf_url);
594 596
             taContract.setStatus(CommConstant.STATUS_NORMAL);
595 597
             taContract.setCustomerTime(LocalDateTime.now());
596 598
             taContract.setReason(parameterMap.get("result_desc")[0]);
@@ -604,8 +606,8 @@ public class TaCompanyController extends BaseController {
604 606
             iTaContractService.updateById(taContract);
605 607
         }else{
606 608
             TaContract taContract = iTaContractService.getById(parameterMap.get("contract_id")[0]);
607
-            taContract.setContractDownloadUrl(download_url);
608
-            taContract.setContractViewUrl(viewpdf_url);
609
+//            taContract.setContractDownloadUrl(download_url);
610
+//            taContract.setContractViewUrl(viewpdf_url);
609 611
             //签署失败
610 612
             taContract.setStatus(2);
611 613
             taContract.setReason(parameterMap.get("result_desc")[0]);

+ 23
- 8
src/main/java/com/huiju/estateagents/eContract/service/impl/TaContractServiceImpl.java Прегледај датотеку

@@ -123,8 +123,8 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
123 123
         queryWrapper.eq("person_id",person.getPersonId());
124 124
         TaContract oldContract = taContractMapper.selectOne(queryWrapper);
125 125
         if (null != oldContract){
126
-            oldContract.setContractDownloadUrl(getFddDownServerHost(person.getMiniappId(),oldContract.getContractDownloadUrl()));
127
-            oldContract.setContractViewUrl(getFddDownServerHost(person.getMiniappId(),oldContract.getContractViewUrl()));
126
+            oldContract.setContractDownloadUrl(getFddServerHost(person.getMiniappId(),oldContract.getContractDownloadUrl()));
127
+            oldContract.setContractViewUrl(getFddServerHost(person.getMiniappId(),oldContract.getContractViewUrl()));
128 128
             return oldContract;
129 129
         }
130 130
 
@@ -163,15 +163,15 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
163 163
         req.setSign_keyword(taContractBusiness.getSignatoryKeywords());
164 164
         req.setKeyword_strategy(taContractBusiness.getSignatoryStrategy());
165 165
         req.setDoc_title(taContractBusiness.getContractTemplateName());
166
-        String autoSignResult = base.invokeExtSignAuto(req);
166
+        String autoSignResult = base.invokeExtSignAuto(req,taContractBusiness.getSignatureId());
167 167
         JSONObject autoSignResultJson = JSONObject.parseObject(autoSignResult);
168 168
         if (!autoSignResultJson.getString("code").equals("1000")){
169 169
             throw new Exception(jsonObject.getString("msg"));
170 170
         }
171 171
 
172 172
         //反更新合同地址
173
-        taContract.setContractDownloadUrl(getFddDownServerHost(person.getMiniappId(),autoSignResultJson.getString("download_url")));
174
-        taContract.setContractViewUrl(getFddDownServerHost(person.getMiniappId(),autoSignResultJson.getString("viewpdf_url")));
173
+        taContract.setContractDownloadUrl(getFddServerHost(person.getMiniappId(),autoSignResultJson.getString("download_url")));
174
+        taContract.setContractViewUrl(getFddServerHost(person.getMiniappId(),autoSignResultJson.getString("viewpdf_url")));
175 175
         taContract.setContractName(taContractBusiness.getContractTemplateName());
176 176
         //合同详情
177 177
         taContract.setCompanyName(taContractBusiness.getCompanyName());
@@ -267,7 +267,22 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
267 267
         }
268 268
 
269 269
         taContractMapper.updateById(taContract);
270
-        return signUrl;
270
+        String manualUrl = getFddServerHost(person.getMiniappId(), signUrl);
271
+        return manualUrl;
272
+    }
273
+
274
+
275
+    /**
276
+     * 替换法大大服务器地址
277
+     * @return
278
+     */
279
+    private String getFddServerHost(String miniappId,String subUrl) {
280
+        TaMiniapp taMiniapp = taMiniappMapper.selectById(miniappId);
281
+        int index = subUrl.indexOf("/");
282
+        int twoIndex = subUrl.indexOf("/",index+1);
283
+        int threeIndex = subUrl.indexOf("/",twoIndex+1);
284
+        String newUrl = StringUtils.isEmpty(taMiniapp.getFddServerHost()) ? subUrl : taMiniapp.getFddServerHost() + subUrl.substring(threeIndex);
285
+        return newUrl;
271 286
     }
272 287
 
273 288
     /**
@@ -298,8 +313,8 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
298 313
         queryWrapper.eq("company_id",taContractBusiness.getCompanyId());
299 314
         queryWrapper.eq("person_id",person.getPersonId());
300 315
         TaContract oldContract = taContractMapper.selectOne(queryWrapper);
301
-        oldContract.setContractDownloadUrl(getFddDownServerHost(person.getMiniappId(),oldContract.getContractDownloadUrl()));
302
-        oldContract.setContractViewUrl(getFddDownServerHost(person.getMiniappId(),oldContract.getContractViewUrl()));
316
+        oldContract.setContractDownloadUrl(getFddServerHost(person.getMiniappId(),oldContract.getContractDownloadUrl()));
317
+        oldContract.setContractViewUrl(getFddServerHost(person.getMiniappId(),oldContract.getContractViewUrl()));
303 318
         return oldContract;
304 319
     }
305 320
 }

+ 23
- 5
src/main/java/com/huiju/estateagents/eContract/service/impl/TaContractUserServiceImpl.java Прегледај датотеку

@@ -62,9 +62,10 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
62 62
         queryWrapper.eq("mini_openid",MD5Utils.md5(person.getMiniOpenid()));
63 63
         TaContractUser taContractUser = taContractUserMapper.selectOne(queryWrapper);
64 64
         if (null != taContractUser) {
65
-            taContractUser.setRaiseRecordId(taRaiseRecord.getRaiseRecordId());
66
-            taContractUser.setCertifiedAddress(getFddServerHost(person.getMiniappId(),taContractUser.getCertifiedAddress()));
67
-            return taContractUser;
65
+            TaContractUser firstCustomerInfo = getFirstCustomerInfo(person);
66
+            firstCustomerInfo.setRaiseRecordId(taRaiseRecord.getRaiseRecordId());
67
+            firstCustomerInfo.setCertifiedAddress(getFddDownServerHost(person.getMiniappId(),taContractUser.getCertifiedAddress()));
68
+            return firstCustomerInfo;
68 69
         }
69 70
         //没有法大大账号的先注册
70 71
         log.info("========法大大个人注册=======");
@@ -90,7 +91,8 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
90 91
         newContractUser.setOrgId(person.getOrgId());
91 92
 
92 93
         log.info("正在申请个人认证,客户编码是{}",jsonObject.getString("data"));
93
-        GetPersonVerifyUrl personverify = new GetPersonVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
94
+        log.info("appid {} , secret {}, version {} , serverhost {}",fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),getFddServerHost(person.getMiniappId(),fadadaProperties.getServeHost()));
95
+        GetPersonVerifyUrl personverify = new GetPersonVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),getFddServerHost(person.getMiniappId(),fadadaProperties.getServeHost()));
94 96
         String customer_id = jsonObject.getString("data");
95 97
         //0:三要素标准方案; 1:三要素补充方案 4 纯三要素方案;
96 98
         String verifyed_way = "4";
@@ -107,7 +109,7 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
107 109
         if (null !=data){
108 110
             String url = JSON.parseObject(data).getString("url");
109 111
             url = decode(url);
110
-            newContractUser.setCertifiedAddress(getFddServerHost(person.getMiniappId(),url));
112
+            newContractUser.setCertifiedAddress(getFddDownServerHost(person.getMiniappId(),url));
111 113
             newContractUser.setCertifiedSerialNumber(JSON.parseObject(data).getString("transactionNo"));
112 114
         }
113 115
         newContractUser.setStatus(0);
@@ -130,6 +132,22 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
130 132
         return newUrl;
131 133
     }
132 134
 
135
+    /**
136
+     * 替换法大大服务器地址
137
+     * @return
138
+     */
139
+    private String getFddDownServerHost(String miniappId,String subUrl) {
140
+        if (StringUtils.isEmpty(subUrl)){
141
+            return subUrl;
142
+        }
143
+        TaMiniapp taMiniapp = taMiniappMapper.selectById(miniappId);
144
+        int index = subUrl.indexOf("/");
145
+        int twoIndex = subUrl.indexOf("/",index+1);
146
+        int threeIndex = subUrl.indexOf("/",twoIndex+1);
147
+        String newUrl = StringUtils.isEmpty(taMiniapp.getFddDownloadHost()) ? subUrl : taMiniapp.getFddDownloadHost() + subUrl.substring(threeIndex);
148
+        return newUrl;
149
+    }
150
+
133 151
     /**
134 152
      * 去法大大处更新客户的状态
135 153
      *

+ 8
- 3
src/main/java/com/huiju/estateagents/entity/ExtendContent.java Прегледај датотеку

@@ -1,13 +1,13 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.*;
4
-
5
-import java.time.LocalDateTime;
6
-import java.io.Serializable;
7 4
 import lombok.Data;
8 5
 import lombok.EqualsAndHashCode;
9 6
 import lombok.experimental.Accessors;
10 7
 
8
+import java.io.Serializable;
9
+import java.time.LocalDateTime;
10
+
11 11
 /**
12 12
  * <p>
13 13
  * 辅助内容表 
@@ -99,6 +99,11 @@ public class ExtendContent implements Serializable {
99 99
 
100 100
     private Integer cityId;
101 101
 
102
+    /**
103
+     * 创建人id
104
+     */
105
+    private Integer createUser;
106
+
102 107
     /**
103 108
      * 排序
104 109
      */

+ 113
- 0
src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java Прегледај датотеку

@@ -0,0 +1,113 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.time.LocalDateTime;
6
+import java.io.Serializable;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+/**
12
+ * <p>
13
+ * 客户来源 
14
+ * </p>
15
+ *
16
+ * @author yansen
17
+ * @since 2020-04-27
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+public class TaCustomerFrom implements Serializable {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    /**
27
+     * 序号
28
+     */
29
+    @TableId(value = "serial_no", type = IdType.AUTO)
30
+    private Integer serialNo;
31
+
32
+    /**
33
+     * 用户ID
34
+     */
35
+    private String personId;
36
+
37
+    /**
38
+     * 客户ID
39
+     */
40
+    private String customerId;
41
+
42
+    /**
43
+     * 用户名
44
+     */
45
+    private String personName;
46
+
47
+    /**
48
+     * 目标类型
49
+     */
50
+    private String targetType;
51
+
52
+    /**
53
+     * 目标ID
54
+     */
55
+    private String targetId;
56
+
57
+    /**
58
+     * 目标名称
59
+     */
60
+    private String targetName;
61
+
62
+    /**
63
+     * 公司id
64
+     */
65
+    private Integer orgId;
66
+
67
+    /**
68
+     * 楼盘id
69
+     */
70
+    private String buildingId;
71
+
72
+    /**
73
+     * 楼盘名称
74
+     */
75
+    private String buildingName;
76
+
77
+    /**
78
+     * 分享人ID
79
+     */
80
+    private String sharePersonId;
81
+
82
+    /**
83
+     * 分享人名称
84
+     */
85
+    private String sharePersonName;
86
+
87
+    /**
88
+     * 场景ID
89
+     */
90
+    private String sceneId;
91
+
92
+    /**
93
+     * 首次进入小程序
94
+     */
95
+    private Boolean isOrgFirst;
96
+
97
+    /**
98
+     * 首次进入项目
99
+     */
100
+    private Boolean isProjectFirst;
101
+
102
+    /**
103
+     * 创建时间
104
+     */
105
+    private LocalDateTime createDate;
106
+
107
+    /**
108
+     * 备注
109
+     */
110
+    private String remark;
111
+
112
+
113
+}

+ 18
- 0
src/main/java/com/huiju/estateagents/entity/TaPerson.java Прегледај датотеку

@@ -312,4 +312,22 @@ public class TaPerson implements Serializable {
312 312
      */
313 313
     @TableField(exist = false)
314 314
     private String sceneAlias;
315
+
316
+    /**
317
+     * 访问内容类型
318
+     */
319
+    @TableField(exist = false)
320
+    private String targetType;
321
+
322
+    /**
323
+     * 访问内容ID
324
+     */
325
+    @TableField(exist = false)
326
+    private String targetId;
327
+
328
+    /**
329
+     * 访问内容名称
330
+     */
331
+    @TableField(exist = false)
332
+    private String targetName;
315 333
 }

+ 5
- 3
src/main/java/com/huiju/estateagents/entity/TaPersonPositon.java Прегледај датотеку

@@ -1,16 +1,13 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
-import com.baomidou.mybatisplus.annotation.TableField;
5 4
 import com.baomidou.mybatisplus.annotation.TableId;
6
-import com.baomidou.mybatisplus.core.metadata.IPage;
7 5
 import lombok.Data;
8 6
 import lombok.EqualsAndHashCode;
9 7
 import lombok.experimental.Accessors;
10 8
 
11 9
 import java.io.Serializable;
12 10
 import java.time.LocalDateTime;
13
-import java.util.List;
14 11
 
15 12
 /**
16 13
  * <p>
@@ -78,6 +75,11 @@ public class TaPersonPositon implements Serializable {
78 75
      */
79 76
     private String address;
80 77
 
78
+    /**
79
+     * 公司id
80
+     */
81
+    private Integer orgId;
82
+
81 83
 
82 84
     /**
83 85
      * 创建时间

+ 23
- 5
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java Прегледај датотеку

@@ -1,10 +1,5 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
-import java.time.LocalDateTime;
4
-import java.io.Serializable;
5
-import java.util.List;
6
-import java.util.Map;
7
-
8 3
 import com.alibaba.excel.annotation.ExcelProperty;
9 4
 import com.alibaba.excel.annotation.format.DateTimeFormat;
10 5
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -16,6 +11,11 @@ import lombok.Data;
16 11
 import lombok.EqualsAndHashCode;
17 12
 import lombok.experimental.Accessors;
18 13
 
14
+import java.io.Serializable;
15
+import java.time.LocalDateTime;
16
+import java.util.List;
17
+import java.util.Map;
18
+
19 19
 /**
20 20
  * <p>
21 21
  * 推荐客户表
@@ -199,9 +199,27 @@ public class TaRecommendCustomer implements Serializable {
199 199
     @TableField(exist = false)
200 200
     private String avatarurl;
201 201
 
202
+    /**
203
+     * 所属项目
204
+     */
205
+    @TableField(exist = false)
206
+    private String buildingName;
207
+
202 208
     /**
203 209
      * 来源类型
204 210
      */
205 211
     @TableField(exist = false)
206 212
     private String personFrom;
213
+
214
+    /**
215
+     * 迁移人的名称
216
+     */
217
+    @TableField(exist = false)
218
+    private String moveUserName;
219
+
220
+    /**
221
+     * 迁移人的userId
222
+     */
223
+    @TableField(exist = false)
224
+    private String moveUserId;
207 225
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/entity/TaShareCount.java Прегледај датотеку

@@ -43,11 +43,21 @@ public class TaShareCount implements Serializable {
43 43
      */
44 44
     private String tagertType;
45 45
 
46
+    /**
47
+     * 对象名称
48
+     */
49
+    private String targetName;
50
+
46 51
     /**
47 52
      * 创建时间
48 53
      */
49 54
     private LocalDateTime createDate;
50 55
 
56
+    /**
57
+     * orgId
58
+     */
59
+    private Integer orgId;
60
+
51 61
     @TableField(exist = false)
52 62
     private String shareTitle;
53 63
 

+ 5
- 0
src/main/java/com/huiju/estateagents/entity/TaSharePersonFrom.java Прегледај датотеку

@@ -56,6 +56,11 @@ public class TaSharePersonFrom implements Serializable {
56 56
      */
57 57
     private String targetId;
58 58
 
59
+    /**
60
+     * 目标名称
61
+     */
62
+    private String targetName;
63
+
59 64
     /**
60 65
      * 创建时间
61 66
      */

+ 97
- 0
src/main/java/com/huiju/estateagents/entity/TsActivityDaily.java Прегледај датотеку

@@ -0,0 +1,97 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+/**
11
+ * <p>
12
+ * 活动统计 
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2020-04-20
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+public class TsActivityDaily implements Serializable {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 序号
27
+     */
28
+    @TableId(value = "serial_no", type = IdType.AUTO)
29
+    private Integer serialNo;
30
+
31
+    /**
32
+     * 统计时间
33
+     */
34
+    private String statisDate;
35
+
36
+    /**
37
+     * 公司id
38
+     */
39
+    private Integer orgId;
40
+
41
+    /**
42
+     * 楼盘id
43
+     */
44
+    private String buildingId;
45
+
46
+    /**
47
+     * 楼盘名称
48
+     */
49
+    private String buildingName;
50
+
51
+    /**
52
+     * 活动类型
53
+     */
54
+    private String targetType;
55
+
56
+    /**
57
+     * 活动ID
58
+     */
59
+    private String targetId;
60
+
61
+    /**
62
+     * 活动名称
63
+     */
64
+    private String targetName;
65
+
66
+    /**
67
+     * 分享次数
68
+     */
69
+    private Integer shareNum;
70
+
71
+    /**
72
+     * 分享人数
73
+     */
74
+    private Integer sharePersons;
75
+
76
+    /**
77
+     * 访问次数
78
+     */
79
+    private Integer visitNum;
80
+
81
+    /**
82
+     * 访问人数
83
+     */
84
+    private Integer visitPersons;
85
+
86
+    /**
87
+     * 新增用户
88
+     */
89
+    private Integer newPersons;
90
+
91
+    /**
92
+     * 新增客户
93
+     */
94
+    private Integer newCustomers;
95
+
96
+
97
+}

+ 117
- 0
src/main/java/com/huiju/estateagents/entity/TsConsultantKpi.java Прегледај датотеку

@@ -0,0 +1,117 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+/**
12
+ * <p>
13
+ * 置业顾问KPI 
14
+ * </p>
15
+ *
16
+ * @author yansen
17
+ * @since 2020-04-14
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+public class TsConsultantKpi implements Serializable {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    /**
27
+     * 序号
28
+     */
29
+    @TableId(value = "serial_no", type = IdType.AUTO)
30
+    private Integer serialNo;
31
+
32
+    /**
33
+     * 统计日期 格式YYYYMMDD
34
+     */
35
+    private String statisDate;
36
+
37
+    /**
38
+     * 公司id
39
+     */
40
+    private Integer orgId;
41
+
42
+    /**
43
+     * 楼盘id
44
+     */
45
+    private String buildingId;
46
+
47
+    /**
48
+     * 楼盘名称
49
+     */
50
+    private String buildingName;
51
+
52
+    /**
53
+     * 置业顾问ID
54
+     */
55
+    private Integer userId;
56
+
57
+    /**
58
+     * 置业顾问名称
59
+     */
60
+    private String userName;
61
+
62
+    /**
63
+     * 置业顾问手机号
64
+     */
65
+    private String phone;
66
+
67
+    /**
68
+     * 新增客户
69
+     */
70
+    private Integer newPersons;
71
+
72
+    /**
73
+     * 分享次数
74
+     */
75
+    private Integer shareNum;
76
+
77
+    /**
78
+     * 分享访问人数
79
+     */
80
+    private Integer visitPersons;
81
+
82
+    /**
83
+     * 分享访问次数
84
+     */
85
+    private Integer visitNum;
86
+
87
+    /**
88
+     * 分享拓客
89
+     */
90
+    private Integer sharePersons;
91
+
92
+    /**
93
+     * 主页访问人数
94
+     */
95
+    private Integer homePagePersons;
96
+
97
+    /**
98
+     * 主页访问次数
99
+     */
100
+    private Integer homePageNums;
101
+
102
+    /**
103
+     * 咨询数
104
+     */
105
+    private Integer chatPersons;
106
+
107
+    /**
108
+     * 点赞数
109
+     */
110
+    private Integer favorNum;
111
+
112
+    /**
113
+     * 客户总计
114
+     */
115
+    @TableField(exist = false)
116
+    private Integer totalPersons;
117
+}

+ 48
- 0
src/main/java/com/huiju/estateagents/excel/ActivityDailyExport.java Прегледај датотеку

@@ -0,0 +1,48 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class ActivityDailyExport {
8
+
9
+    /**
10
+     * 统计时间
11
+     */
12
+    @ExcelProperty(value = "日期", index = 1)
13
+    private String statisDate;
14
+
15
+
16
+    @ExcelProperty(value = "分享标题", index = 0)
17
+    private String targetName;
18
+
19
+    /**
20
+     * 分享次数
21
+     */
22
+    @ExcelProperty(value = "分享次数", index = 3)
23
+    private Integer shareNum;
24
+
25
+    /**
26
+     * 分享人数
27
+     */
28
+    @ExcelProperty(value = "分享人数", index = 2)
29
+    private Integer sharePersons;
30
+
31
+    /**
32
+     * 访问次数
33
+     */
34
+    @ExcelProperty(value = "访问次数", index = 5)
35
+    private Integer visitNum;
36
+
37
+    /**
38
+     * 访问人数
39
+     */
40
+    @ExcelProperty(value = "访问人数", index = 4)
41
+    private Integer visitPersons;
42
+
43
+    /**
44
+     * 新增客户
45
+     */
46
+    @ExcelProperty(value = "新增注册用户", index = 6)
47
+    private Integer newCustomers;
48
+}

+ 64
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ActivityDetailShareRecord.java Прегледај датотеку

@@ -0,0 +1,64 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 ActivityDetailShareRecord {
10
+
11
+    @ExcelIgnore
12
+    private String activityId;
13
+
14
+    /**
15
+     * 活动类型
16
+     */
17
+    @ColumnWidth(15)
18
+    @ExcelProperty(value = "活动类型", index = 0)
19
+    private String activityType;
20
+
21
+    /**
22
+     * 活动名称
23
+     */
24
+    @ColumnWidth(15)
25
+    @ExcelProperty(value = "活动名称", index = 1)
26
+    private String activityName;
27
+
28
+    /**
29
+     * 分享人数
30
+     */
31
+    @ColumnWidth(15)
32
+    @ExcelProperty(value = "分享人数", index = 2)
33
+    private Integer sharePersonNum;
34
+
35
+    /**
36
+     * 分享次数
37
+     */
38
+    @ColumnWidth(15)
39
+    @ExcelProperty(value = "分享次数", index = 3)
40
+    private Integer shareNum;
41
+
42
+    /**
43
+     * 新增注册用户数
44
+     */
45
+    @ColumnWidth(15)
46
+    @ExcelProperty(value = "新增注册用户数", index = 4)
47
+    private Integer addRegistNum;
48
+
49
+    /**
50
+     * 访问人数
51
+     */
52
+    @ColumnWidth(15)
53
+    @ExcelProperty(value = "访问人数", index = 5)
54
+    private Integer visitPersonNum;
55
+
56
+    /**
57
+     * 访问次数
58
+     */
59
+    @ColumnWidth(15)
60
+    @ExcelProperty(value = "访问次数", index = 6)
61
+    private Integer visitNum;
62
+
63
+
64
+}

+ 73
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/AddRegistNum.java Прегледај датотеку

@@ -0,0 +1,73 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 AddRegistNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 来源渠道
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "来源渠道", index = 4)
42
+    private String personFrom;
43
+
44
+    /**
45
+     * 置业顾问
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "置业顾问", index = 5)
49
+    private String realtyConsultant;
50
+
51
+    /**
52
+     * 置业顾问电话
53
+     */
54
+    @ColumnWidth(15)
55
+    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+    private String realtyConsultantPhone;
57
+
58
+    /**
59
+     * 分享者
60
+     */
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "分享者", index = 7)
63
+    private String sharePersonName;
64
+
65
+    /**
66
+     * 分享者电话
67
+     */
68
+    @ColumnWidth(15)
69
+    @ExcelProperty(value = "分享者电话", index = 8)
70
+    private String sharePersonPhone;
71
+
72
+
73
+}

+ 49
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java Прегледај датотеку

@@ -0,0 +1,49 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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
+import java.time.LocalDateTime;
9
+
10
+@Data
11
+public class ShareNum {
12
+    /**
13
+     * 分享者姓名
14
+     */
15
+    @ColumnWidth(15)
16
+    @ExcelProperty(value = "分享者姓名", index = 0)
17
+    private String sharePersonName;
18
+
19
+    /**
20
+     * 分享者电话
21
+     */
22
+    @ColumnWidth(15)
23
+    @ExcelProperty(value = "分享者电话", index = 1)
24
+    private String sharePersonPhone;
25
+
26
+    /**
27
+     * 分享者类型
28
+     */
29
+    @ColumnWidth(15)
30
+    @ExcelProperty(value = "分享者类型", index = 2)
31
+    private String sharePersonType;
32
+
33
+    /**
34
+     * 分享时间
35
+     */
36
+    @ColumnWidth(15)
37
+    @ExcelProperty(value = "分享时间", index = 3)
38
+    private String shareTime;
39
+
40
+//    /**
41
+//     * 访问人数
42
+//     */
43
+//    @ColumnWidth(15)
44
+//    @ExcelProperty(value = "访问人数", index = 4)
45
+//    private Integer visitPersonNum;
46
+
47
+    @ExcelIgnore
48
+    private String sharePersonId;
49
+}

+ 54
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/SharePersonNum.java Прегледај датотеку

@@ -0,0 +1,54 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 SharePersonNum {
10
+    /**
11
+     * 分享者姓名
12
+     */
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "分享者姓名", index = 0)
15
+    private String sharePersonName;
16
+
17
+    /**
18
+     * 分享者电话
19
+     */
20
+    @ColumnWidth(15)
21
+    @ExcelProperty(value = "分享者电话", index = 1)
22
+    private String sharePersonPhone;
23
+
24
+    /**
25
+     * 分享者类型
26
+     */
27
+    @ColumnWidth(15)
28
+    @ExcelProperty(value = "分享者类型", index = 2)
29
+    private String sharePersonType;
30
+
31
+    /**
32
+     * 分享次数
33
+     */
34
+    @ColumnWidth(15)
35
+    @ExcelProperty(value = "分享次数", index = 3)
36
+    private Integer shareNum;
37
+
38
+    /**
39
+     * 访问人数
40
+     */
41
+    @ColumnWidth(15)
42
+    @ExcelProperty(value = "访问人数", index = 4)
43
+    private Integer visitPersonNum;
44
+
45
+    /**
46
+     * 访问次数
47
+     */
48
+    @ColumnWidth(15)
49
+    @ExcelProperty(value = "访问次数", index = 5)
50
+    private Integer visitNum;
51
+
52
+    @ExcelIgnore
53
+    private String personId;
54
+}

+ 51
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/StatisicAttractUser.java Прегледај датотеку

@@ -0,0 +1,51 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 StatisicAttractUser {
10
+    /**
11
+     * 日期
12
+     */
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "日期", index = 0)
15
+    private String date;
16
+
17
+    /**
18
+     * 分享人数
19
+     */
20
+    @ColumnWidth(15)
21
+    @ExcelProperty(value = "新增客户", index = 1)
22
+    private Integer sharePersonNum;
23
+
24
+    /**
25
+     * 分享次数
26
+     */
27
+    @ColumnWidth(15)
28
+    @ExcelProperty(value = "分享次数", index = 2)
29
+    private Integer shareNum;
30
+
31
+    /**
32
+     * 访问人数
33
+     */
34
+    @ColumnWidth(15)
35
+    @ExcelProperty(value = "访问人数", index = 3)
36
+    private Integer visitPersonNum;
37
+
38
+    /**
39
+     * 访问次数
40
+     */
41
+    @ColumnWidth(15)
42
+    @ExcelProperty(value = "访问次数", index = 4)
43
+    private Integer visitNum;
44
+
45
+    /**
46
+     * 新增注册用户数
47
+     */
48
+    @ColumnWidth(15)
49
+    @ExcelProperty(value = "新增注册用户数", index = 5)
50
+    private Integer addRegistNum;
51
+}

+ 79
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitNum.java Прегледај датотеку

@@ -0,0 +1,79 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 VisitNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 来源渠道
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "来源渠道", index = 4)
42
+    private String personFrom;
43
+
44
+    /**
45
+     * 置业顾问
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "置业顾问", index = 5)
49
+    private String realtyConsultant;
50
+
51
+    /**
52
+     * 置业顾问电话
53
+     */
54
+    @ColumnWidth(15)
55
+    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+    private String realtyConsultantPhone;
57
+
58
+    /**
59
+     * 分享者
60
+     */
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "分享者", index = 7)
63
+    private String sharePersonName;
64
+
65
+    /**
66
+     * 分享者电话
67
+     */
68
+    @ColumnWidth(15)
69
+    @ExcelProperty(value = "分享者电话", index = 8)
70
+    private String sharePersonPhone;
71
+
72
+    /**
73
+     * 访问时间
74
+     */
75
+    @ColumnWidth(15)
76
+    @ExcelProperty(value = "访问时间", index = 9)
77
+    private String visitDate;
78
+
79
+}

+ 86
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitPersonNum.java Прегледај датотеку

@@ -0,0 +1,86 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
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 VisitPersonNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 来源渠道
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "来源渠道", index = 4)
42
+    private String personFrom;
43
+
44
+    /**
45
+     * 置业顾问
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "置业顾问", index = 5)
49
+    private String realtyConsultant;
50
+
51
+    /**
52
+     * 置业顾问电话
53
+     */
54
+    @ColumnWidth(15)
55
+    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+    private String realtyConsultantPhone;
57
+
58
+    /**
59
+     * 推广人
60
+     */
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "推广人", index = 7)
63
+    private String sharePersonName;
64
+//    /**
65
+//     * 分享者
66
+//     */
67
+//    @ColumnWidth(15)
68
+//    @ExcelProperty(value = "分享者", index = 7)
69
+//    private String sharePersonName;
70
+//
71
+//    /**
72
+//     * 分享者电话
73
+//     */
74
+//    @ColumnWidth(15)
75
+//    @ExcelProperty(value = "分享者电话", index = 8)
76
+//    private String sharePersonPhone;
77
+
78
+    /**
79
+     * 访问次数
80
+     */
81
+    @ColumnWidth(15)
82
+    @ExcelProperty(value = "访问次数", index = 8)
83
+    private String visitNum;
84
+
85
+
86
+}

+ 84
- 0
src/main/java/com/huiju/estateagents/excel/ConsultantKPIExport.java Прегледај датотеку

@@ -0,0 +1,84 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class ConsultantKPIExport {
8
+
9
+    /**
10
+     * 楼盘名称
11
+     */
12
+    @ExcelProperty(value = "项目", index = 0)
13
+    private String buildingName;
14
+
15
+
16
+    /**
17
+     * 置业顾问名称
18
+     */
19
+    @ExcelProperty(value = "置业顾问名称", index = 1)
20
+    private String userName;
21
+
22
+    /**
23
+     * 置业顾问手机号
24
+     */
25
+    @ExcelProperty(value = "置业顾问电话", index = 2)
26
+    private String phone;
27
+
28
+    @ExcelProperty(value = "客户总计", index = 3)
29
+    private Integer totalPersons;
30
+
31
+    /**
32
+     * 新增客户
33
+     */
34
+    @ExcelProperty(value = "新增客户数", index = 4)
35
+    private Integer newPersons;
36
+
37
+    /**
38
+     * 分享次数
39
+     */
40
+    @ExcelProperty(value = "分享次数", index = 5)
41
+    private Integer shareNum;
42
+
43
+    /**
44
+     * 分享访问人数
45
+     */
46
+    @ExcelProperty(value = "访问人数", index = 6)
47
+    private Integer visitPersons;
48
+
49
+    /**
50
+     * 分享访问次数
51
+     */
52
+    @ExcelProperty(value = "访问次数", index = 7)
53
+    private Integer visitNum;
54
+
55
+    /**
56
+     * 分享拓客
57
+     */
58
+    @ExcelProperty(value = "分享拓客数", index = 8)
59
+    private Integer sharePersons;
60
+
61
+    /**
62
+     * 主页访问人数
63
+     */
64
+    @ExcelProperty(value = "访问主页人数", index = 9)
65
+    private Integer homePagePersons;
66
+
67
+    /**
68
+     * 主页访问次数
69
+     */
70
+    @ExcelProperty(value = "访问主页次数", index = 10)
71
+    private Integer homePageNums;
72
+
73
+    /**
74
+     * 咨询数
75
+     */
76
+    @ExcelProperty(value = "咨询数", index = 11)
77
+    private Integer chatPersons;
78
+
79
+    /**
80
+     * 点赞数
81
+     */
82
+    @ExcelProperty(value = "点赞数", index = 12)
83
+    private Integer favorNum;
84
+}

+ 94
- 0
src/main/java/com/huiju/estateagents/excel/IntentionUser.java Прегледај датотеку

@@ -0,0 +1,94 @@
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
+    /**
39
+     * 归属地
40
+     */
41
+    @ColumnWidth(15)
42
+    @ExcelProperty(value = "归属地", index = 4)
43
+    private String province;
44
+
45
+    /**
46
+     * 置业顾问
47
+     */
48
+    @ColumnWidth(15)
49
+    @ExcelProperty(value = "置业顾问", index = 5)
50
+    private String realtyConsultant;
51
+
52
+    /**
53
+     * 置业顾问电话
54
+     */
55
+    @ColumnWidth(15)
56
+    @ExcelProperty(value = "置业顾问电话", index = 6)
57
+    private String realtyConsultantPhone;
58
+
59
+//    /**
60
+//     * 分享者
61
+//     */
62
+//    @ColumnWidth(15)
63
+//    @ExcelProperty(value = "分享者", index = 7)
64
+//    private String sharePersonName;
65
+//
66
+//    /**
67
+//     * 分享者电话
68
+//     */
69
+//    @ColumnWidth(15)
70
+//    @ExcelProperty(value = "分享者电话", index = 8)
71
+//    private String sharePersonPhone;
72
+
73
+    /**
74
+     * 性别
75
+     */
76
+    @ColumnWidth(15)
77
+    @ExcelProperty(value = "性别", index = 7)
78
+    private String gender;
79
+
80
+    /**
81
+     * 来源
82
+     */
83
+    @ColumnWidth(15)
84
+    @ExcelProperty(value = "用户来源", index = 8)
85
+    private String personFrom;
86
+
87
+    /**
88
+     * 推广人
89
+     */
90
+    @ColumnWidth(15)
91
+    @ExcelProperty(value = "推广人", index = 9)
92
+    private String recommendPerson;
93
+
94
+}

+ 14
- 0
src/main/java/com/huiju/estateagents/excel/PrivateCustomerExport.java Прегледај датотеку

@@ -86,4 +86,18 @@ public class PrivateCustomerExport {
86 86
     @ColumnWidth(15)
87 87
     @ExcelProperty(value = "意向度(意向值)", index = 8)
88 88
     private String intention ;
89
+
90
+    /**
91
+     * 意向度
92
+     */
93
+    @ColumnWidth(15)
94
+    @ExcelProperty(value = "推广人员", index = 10)
95
+    private String sharePersonName ;
96
+
97
+    /**
98
+     * 意向度
99
+     */
100
+    @ColumnWidth(15)
101
+    @ExcelProperty(value = "积分值", index = 11)
102
+    private String points ;
89 103
 }

+ 26
- 5
src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java Прегледај датотеку

@@ -28,7 +28,7 @@ public class PublicCustomerExport {
28 28
      * 性别
29 29
      */
30 30
     @ColumnWidth(15)
31
-    @ExcelProperty(value = "性别", index = 7)
31
+    @ExcelProperty(value = "性别", index = 8)
32 32
     private String sex;
33 33
 
34 34
     /**
@@ -42,7 +42,7 @@ public class PublicCustomerExport {
42 42
      * 归属地
43 43
      */
44 44
     @ColumnWidth(15)
45
-    @ExcelProperty(value = "归属地", index = 4)
45
+    @ExcelProperty(value = "归属地", index = 5)
46 46
     private String province;
47 47
 
48 48
 //    /**
@@ -56,20 +56,41 @@ public class PublicCustomerExport {
56 56
      * 来访方式
57 57
      */
58 58
     @ColumnWidth(15)
59
-    @ExcelProperty(value = "来访方式(场景渠道)", index = 5)
59
+    @ExcelProperty(value = "来访方式(场景渠道)", index = 6)
60 60
     private String sceneType;
61 61
 
62 62
     /**
63 63
      * 意向度
64 64
      */
65 65
     @ColumnWidth(15)
66
-    @ExcelProperty(value = "意向度(意向值)", index = 6)
66
+    @ExcelProperty(value = "意向度(意向值)", index = 7)
67 67
     private String intention;
68 68
 
69 69
     /**
70 70
      * 项目名称
71 71
      */
72 72
     @ColumnWidth(15)
73
-    @ExcelProperty(value = "项目名称", index = 3)
73
+    @ExcelProperty(value = "项目名称", index = 4)
74 74
     private String buildingName;
75
+
76
+    /**
77
+     * 项目名称
78
+     */
79
+    @ColumnWidth(15)
80
+    @ExcelProperty(value = "是否归属项目", index = 3)
81
+    private String belongStatus;
82
+
83
+    /**
84
+     * 意向度
85
+     */
86
+    @ColumnWidth(15)
87
+    @ExcelProperty(value = "推广人员", index = 9)
88
+    private String sharePersonName ;
89
+
90
+    /**
91
+     * 意向度
92
+     */
93
+    @ColumnWidth(15)
94
+    @ExcelProperty(value = "积分值", index = 10)
95
+    private String points ;
75 96
 }

+ 61
- 0
src/main/java/com/huiju/estateagents/excel/StatsBuilding.java Прегледај датотеку

@@ -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
+}

+ 59
- 0
src/main/java/com/huiju/estateagents/excel/StatsTimeBuilding.java Прегледај датотеку

@@ -0,0 +1,59 @@
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 buildingName;
17
+
18
+    /**
19
+     * 日期
20
+     */
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "日期", index = 1)
23
+    private String createDate;
24
+
25
+    /**
26
+     * 新增客户 公客加私客
27
+     */
28
+    @ColumnWidth(15)
29
+    @ExcelProperty(value = "新增客户", index = 2)
30
+    private Integer khNum;
31
+
32
+    /**
33
+     * 公客
34
+     */
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "公客", index = 3)
37
+    private Integer gkNum;
38
+
39
+    /**
40
+     * 私客
41
+     */
42
+    @ColumnWidth(15)
43
+    @ExcelProperty(value = "私客", index = 4)
44
+    private Integer skNum;
45
+
46
+    /**
47
+     * 观看人数
48
+     */
49
+    @ColumnWidth(15)
50
+    @ExcelProperty(value = "访问人数", index = 5)
51
+    private Integer uvNum;
52
+
53
+    @ExcelIgnore
54
+    private String buildingId;
55
+
56
+
57
+
58
+
59
+}

+ 25
- 0
src/main/java/com/huiju/estateagents/mapper/ActivityManageMapper.java Прегледај датотеку

@@ -0,0 +1,25 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.huiju.estateagents.bo.request.ActivityStatisticResponseBO;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Component;
7
+
8
+/**
9
+ * @author gusy
10
+ * @date 2020/4/26 11:16
11
+ */
12
+@Component
13
+@Mapper
14
+public interface ActivityManageMapper {
15
+
16
+    /**
17
+     * 获取活动统计数据
18
+     *
19
+     * @return
20
+     */
21
+    ActivityStatisticResponseBO getStatisticDataByType(@Param("type") String type,
22
+                                                       @Param("id") String id,
23
+                                                       @Param("orgId") Integer orgId);
24
+
25
+}

+ 1
- 0
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java Прегледај датотеку

@@ -3,6 +3,7 @@ package com.huiju.estateagents.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.bo.request.ActivityStatisticResponseBO;
6 7
 import com.huiju.estateagents.entity.TaBuildingDynamic;
7 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
8 9
 import org.apache.ibatis.annotations.Mapper;

+ 89
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java Прегледај датотеку

@@ -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, @Param("buildingName") String buildingName);
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
 }

+ 22
- 0
src/main/java/com/huiju/estateagents/mapper/TaCustomerFromMapper.java Прегледај датотеку

@@ -0,0 +1,22 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.huiju.estateagents.entity.TaCustomerFrom;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.Map;
9
+
10
+/**
11
+ * <p>
12
+ * 客户来源  Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2020-04-27
17
+ */
18
+@Mapper
19
+public interface TaCustomerFromMapper extends BaseMapper<TaCustomerFrom> {
20
+
21
+    Map<String, Number> countPerson(@Param("orgId") Integer orgId, @Param("buildingId") String buildingId, @Param("personId") String personId);
22
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java Прегледај датотеку

@@ -30,7 +30,7 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
30 30
      */
31 31
     Boolean addVisitNum(@Param("id") String id);
32 32
 
33
-    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
33
+    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList, @Param("userId") Integer userId);
34 34
     /**
35 35
      * 批量更新直播活动状态
36 36
      *

+ 8
- 0
src/main/java/com/huiju/estateagents/mapper/TaOrgCityMapper.java Прегледај датотеку

@@ -27,4 +27,12 @@ public interface TaOrgCityMapper extends BaseMapper<TaOrgCity> {
27 27
      * @return
28 28
      */
29 29
     List<TaOrgCity> selectAdminTdCityList(Integer orgId);
30
+
31
+    /**
32
+     * 查询市下的区信息
33
+     * @param orgId
34
+     * @param cityId
35
+     * @return
36
+     */
37
+    List<TaOrgCity> selectAdminTdAreaCityList(Integer orgId, Integer cityId);
30 38
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonBuildingMapper.java Прегледај датотеку

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.huiju.estateagents.entity.TaBuilding;
4 5
 import com.huiju.estateagents.entity.TaPersonBuilding;
5 6
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 7
 import com.huiju.estateagents.entity.TaPointsExchange;
@@ -23,4 +24,6 @@ public interface TaPersonBuildingMapper extends BaseMapper<TaPersonBuilding> {
23 24
     List<TaPersonBuilding> selectListByParams(Page page, @Param("orgId")Integer orgId, @Param("buildingId") String buildingId, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate, @Param("personBuildingList")List<TaPersonBuilding> taPersonBuildingList);
24 25
 
25 26
     List<SalesExport> selectSalesList(@Param("orgId") Integer orgId,@Param("buildingId") String buildingId, @Param("startCreateDate")  String startCreateDate,@Param("endCreateDate") String endCreateDate, @Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingList);
27
+
28
+    List<TaBuilding> getBuildingsOf(@Param("personOrUser") String personOrUser);
26 29
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java Прегледај датотеку

@@ -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
 }

+ 11
- 4
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Прегледај датотеку

@@ -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,13 @@ 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);
257
+
258
+    List<Map<String, Object>> selectCityPerson(@Param("orgId") Integer orgId);
252 259
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java Прегледај датотеку

@@ -86,4 +86,6 @@ public interface TaPersonVisitRecordMapper extends BaseMapper<TaPersonVisitRecor
86 86
     List<TaPersonVisitRecord> selectData();
87 87
 
88 88
     List<TaPersonVisitRecord> selectTapersonFromShare();
89
+
90
+    Integer selectTodayVisitCount(@Param("orgId") Integer orgId,@Param("nowDate") LocalDateTime now);
89 91
 }

+ 47
- 3
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Прегледај датотеку

@@ -33,7 +33,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
33 33
 
34 34
     TaRecommendCustomer getCustomerById(@Param("customerId")String customerId);
35 35
 
36
-    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sceneType") String sceneType, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate);
36
+    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sceneType") String sceneType, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate, @Param("sharePersonName") String sharePersonName);
37 37
     IPage<TaRecommendCustomer> getRecCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
38 38
     IPage<TaRecommendCustomer> getRepCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
39 39
     IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel, @Param("orgId") Integer orgId);
@@ -49,7 +49,21 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
49 49
      * @param personBuildingList
50 50
      * @return
51 51
      */
52
-    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("consultTel") String consultTel, @Param("sceneType") String sceneType,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("buildingId") String buildingId, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate);
52
+    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page,
53
+                                          @Param("name") String name,
54
+                                          @Param("tel") String tel,
55
+                                          @Param("entryType") String entryType,
56
+                                          @Param("verifyStatus") String verifyStatus,
57
+                                          @Param("sex") Integer sex,
58
+                                          @Param("orgId") Integer orgId,
59
+                                          @Param("consultTel") String consultTel,
60
+                                          @Param("sceneType") String sceneType,
61
+                                          @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
62
+                                          @Param("buildingId") String buildingId,
63
+                                          @Param("startCreateDate") String startCreateDate,
64
+                                          @Param("endCreateDate") String endCreateDate,
65
+                                          @Param("sharePersonName") String sharePersonName,
66
+                                          @Param("belongStatus") Integer belongStatus);
53 67
 
54 68
     /**
55 69
      * 导出数据 获取推荐用户数据
@@ -119,7 +133,19 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
119 133
      * @param consultTel
120 134
      * @return
121 135
      */
122
-    List<PublicCustomerExport> getPublicCustomerExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("buildingId")String buildingId, @Param("name") String name, @Param("tel") String tel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("consultTel")String consultTel, @Param("sceneType")String sceneType,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
136
+    List<PublicCustomerExport> getPublicCustomerExportList(@Param("pageCode") Integer pageCode,
137
+                                                           @Param("pageSize") Integer pageSize,
138
+                                                           @Param("buildingId")String buildingId,
139
+                                                           @Param("name") String name,
140
+                                                           @Param("tel") String tel,
141
+                                                           @Param("entryType") String entryType,
142
+                                                           @Param("verifyStatus") String verifyStatus,
143
+                                                           @Param("sex") Integer sex,
144
+                                                           @Param("orgId") Integer orgId,
145
+                                                           @Param("consultTel")String consultTel,
146
+                                                           @Param("sceneType")String sceneType,
147
+                                                           @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
148
+                                                           @Param("belongStatus") Integer belongStatus);
123 149
 
124 150
     /**
125 151
      * 导出数据 私客总数
@@ -191,4 +217,22 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
191 217
     List<PersonIntention> getCustomerIntentions(@Param("personId")String personId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
192 218
 
193 219
     IPage<TaRecommendCustomer>getCustomersIRecommended(IPage<TaRecommendCustomer> page,@Param("customerId")String customerId,@Param("status")Integer status,@Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
220
+
221
+    IPage<TaRecommendCustomer> getCustomerListOfConsultant(IPage<TaRecommendCustomer> page,
222
+                                                           @Param("orgId") Integer orgId,
223
+                                                           @Param("userId") String userId,
224
+                                                           @Param("buildingId") String buildingId,
225
+                                                           @Param("startDate") LocalDateTime startDate,
226
+                                                           @Param("endDate") LocalDateTime endDate,
227
+                                                           @Param("personId") String personId);
228
+
229
+    /**
230
+     * 获取置业福问下的客户
231
+     * @param userId
232
+     * @param personId
233
+     * @param buildingId
234
+     * @param orgId
235
+     * @return
236
+     */
237
+    List<TaRecommendCustomer> getConsultantCustomerList(@Param("userId") Integer userId,@Param("personId") String personId,@Param("buildingId") String buildingId,@Param("orgId") Integer orgId);
194 238
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaShareMapper.java Прегледај датотеку

@@ -23,5 +23,5 @@ public interface TaShareMapper extends BaseMapper<TaShare> {
23 23
 
24 24
     List<TaShare> listLiveShare(Page page, @Param("orgId") Integer orgId, @Param("personType") String personType, @Param("shareType")String shareType, @Param("phone")String phone, @Param("liveActivityId")Integer liveActivityId);
25 25
 
26
-    List<Map<String, Object>> statTopShare(@Param("orgId") Integer orgId, @Param("targetType") String targetType, @Param("targetId") String targetId, @Param("top") Integer top);
26
+    List<Map<String, Object>> statTopShare(@Param("orgId") Integer orgId, @Param("targetType") String targetType, @Param("targetId") String targetId, @Param("top") Integer top,@Param("beginDate") String beginDate, @Param("endDate") String endDate);
27 27
 }

+ 12
- 0
src/main/java/com/huiju/estateagents/mapper/TaSharePersonFromMapper.java Прегледај датотеку

@@ -44,4 +44,16 @@ public interface TaSharePersonFromMapper extends BaseMapper<TaSharePersonFrom> {
44 44
      */
45 45
     List<TaSharePersonFrom> selectLiveActivityVisitList(Page page, @Param("orgId") Integer orgId, @Param("personType") String personType, @Param("sceneType")String sceneType, @Param("phone")String phone, @Param("liveActivityId")String liveActivityId);
46 46
 
47
+    /**
48
+     * 获取置业的最近一条分享记录
49
+     * @param orgId
50
+     * @param buildingId
51
+     * @param userId
52
+     * @param personId
53
+     * @return
54
+     */
55
+    TaSharePersonFrom getConsultantLastShare(@Param("orgId") Integer orgId,
56
+                                             @Param("buildingId") String buildingId,
57
+                                             @Param("userId") Integer userId,
58
+                                             @Param("personId") String personId);
47 59
 }

+ 64
- 0
src/main/java/com/huiju/estateagents/mapper/TsActivityDailyMapper.java Прегледај датотеку

@@ -0,0 +1,64 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TsActivityDaily;
5
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 活动统计  Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2020-04-20
19
+ */
20
+@Mapper
21
+public interface TsActivityDailyMapper extends BaseMapper<TsActivityDaily> {
22
+
23
+    /**
24
+     * 按天汇总活动统计信息
25
+     * @param orgId
26
+     * @param startDate
27
+     * @param endDate
28
+     * @param buildingId
29
+     * @param targetType
30
+     * @param targetId
31
+     * @param targetName
32
+     * @param asc
33
+     * @param desc
34
+     * @return
35
+     */
36
+    List<TsActivityDaily> getActivityDetail(@Param("orgId") Integer orgId,
37
+                                             @Param("startDate") String startDate,
38
+                                             @Param("endDate") String endDate,
39
+                                             @Param("buildingId") String buildingId,
40
+                                             @Param("targetType") String targetType,
41
+                                             @Param("targetId") String targetId,
42
+                                             @Param("targetName") String targetName,
43
+                                             @Param("asc") String asc,
44
+                                             @Param("desc") String desc);
45
+
46
+    /**
47
+     * 活动统计详情导出
48
+     * @param orgId
49
+     * @param startDate
50
+     * @param endDate
51
+     * @param buildingId
52
+     * @param targetType
53
+     * @param targetIdd
54
+     * @return
55
+     */
56
+    List<ActivityDailyExport> getActivityExport(@Param("orgId") Integer orgId,
57
+                                                @Param("startDate") String startDate,
58
+                                                @Param("endDate") String endDate,
59
+                                                @Param("buildingId") String buildingId,
60
+                                                @Param("targetType") String targetType,
61
+                                                @Param("targetId") String targetIdd);
62
+
63
+
64
+}

+ 216
- 0
src/main/java/com/huiju/estateagents/mapper/TsConsultantKpiMapper.java Прегледај датотеку

@@ -0,0 +1,216 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TaPerson;
5
+import com.huiju.estateagents.entity.TsConsultantKpi;
6
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7
+import com.huiju.estateagents.excel.ConsultantKPIExport;
8
+import org.apache.ibatis.annotations.Mapper;
9
+import org.apache.ibatis.annotations.Param;
10
+
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 置业顾问KPI  Mapper 接口
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2020-04-14
21
+ */
22
+@Mapper
23
+public interface TsConsultantKpiMapper extends BaseMapper<TsConsultantKpi> {
24
+
25
+    /**
26
+     * 置业KPI 汇总
27
+     * @param page
28
+     * @param orgId
29
+     * @param buildingIds
30
+     * @param startDate
31
+     * @param endDate
32
+     * @param asc
33
+     * @param desc
34
+     * @return
35
+     */
36
+    IPage<TsConsultantKpi> stsKPIDaily(IPage<TsConsultantKpi> page,
37
+                                       @Param("orgId") Integer orgId,
38
+                                       @Param("buildingIds") List<String> buildingIds,
39
+                                       @Param("startDate") String startDate,
40
+                                       @Param("endDate") String endDate,
41
+                                       @Param("asc") String asc,
42
+                                       @Param("desc") String desc);
43
+
44
+    TsConsultantKpi stsKPITotalByOrg(@Param("orgId") Integer orgId,
45
+                                     @Param("buildingIds") List<String> buildingIds,
46
+                                     @Param("startDate") String startDate,
47
+                                     @Param("endDate") String endDate);
48
+
49
+    List<ConsultantKPIExport> stsKPIDailyExport(@Param("orgId") Integer orgId,
50
+                                                @Param("buildingIds") List<String> buildingIds,
51
+                                                @Param("startDate") String startDate,
52
+                                                @Param("endDate") String endDate);
53
+
54
+    /**
55
+     * 统计当前时间段内的, 已经固化的置业数据的所有客户
56
+     * @param orgId
57
+     * @param buildingIds
58
+     * @param startDate
59
+     * @param endDate
60
+     * @return
61
+     */
62
+    Integer stsAllCustomersByOrg(@Param("orgId") Integer orgId,
63
+                                 @Param("buildingIds") List<String> buildingIds,
64
+                                 @Param("startDate") String startDate,
65
+                                 @Param("endDate") String endDate);
66
+
67
+
68
+    /**
69
+     * 获取置业分享拓客
70
+     * buildingId 暂时没有用到
71
+     * @param page
72
+     * @param orgId
73
+     * @param userId
74
+     * @param buildingId
75
+     * @param startDate
76
+     * @param endDate
77
+     * @return
78
+     */
79
+    IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page,
80
+                                              @Param("orgId") Integer orgId,
81
+                                              @Param("userId") String userId,
82
+                                              @Param("buildingId") String buildingId,
83
+                                              @Param("startDate") LocalDateTime startDate,
84
+                                              @Param("endDate") LocalDateTime endDate);
85
+
86
+    /**
87
+     * 置业卡片访问人数明细
88
+     * @param page
89
+     * @param orgId
90
+     * @param userId
91
+     * @param buildingId
92
+     * @param startDate
93
+     * @param endDate
94
+     * @return
95
+     */
96
+    IPage<TaPerson> getConsultantHomePagePersons(IPage<TaPerson> page,
97
+                                                 @Param("orgId") Integer orgId,
98
+                                                 @Param("userId") String userId,
99
+                                                 @Param("buildingId") String buildingId,
100
+                                                 @Param("startDate") LocalDateTime startDate,
101
+                                                 @Param("endDate") LocalDateTime endDate);
102
+
103
+    /**
104
+     * 置业卡片访问次数明细
105
+     * @param page
106
+     * @param orgId
107
+     * @param userId
108
+     * @param buildingId
109
+     * @param startDate
110
+     * @param endDate
111
+     * @return
112
+     */
113
+    IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page,
114
+                                               @Param("orgId") Integer orgId,
115
+                                               @Param("userId") String userId,
116
+                                               @Param("buildingId") String buildingId,
117
+                                               @Param("startDate") LocalDateTime startDate,
118
+                                               @Param("endDate") LocalDateTime endDate,
119
+                                               @Param("personId") String personId);
120
+
121
+    /**
122
+     * 咨询置业人员
123
+     * @param page
124
+     * @param orgId
125
+     * @param userId
126
+     * @param buildingId
127
+     * @param startDate
128
+     * @param endDate
129
+     * @return
130
+     */
131
+    IPage<TaPerson> getConsultantChatPersons(IPage<TaPerson> page,
132
+                                             @Param("orgId") Integer orgId,
133
+                                             @Param("userId") String userId,
134
+                                             @Param("buildingId") String buildingId,
135
+                                             @Param("startDate") LocalDateTime startDate,
136
+                                             @Param("endDate") LocalDateTime endDate);
137
+
138
+    /**
139
+     * 点赞详情
140
+     * @param page
141
+     * @param orgId
142
+     * @param userId
143
+     * @param buildingId
144
+     * @param startDate
145
+     * @param endDate
146
+     * @return
147
+     */
148
+    IPage<TaPerson> getConsultantFavor(IPage<TaPerson> page,
149
+                                       @Param("orgId") Integer orgId,
150
+                                       @Param("userId") String userId,
151
+                                       @Param("buildingId") String buildingId,
152
+                                       @Param("startDate") LocalDateTime startDate,
153
+                                       @Param("endDate") LocalDateTime endDate);
154
+
155
+
156
+    /**
157
+     * 置业分享记录
158
+     * @param page
159
+     * @param orgId
160
+     * @param userId
161
+     * @param buildingId
162
+     * @param startDate
163
+     * @param endDate
164
+     * @param targetType
165
+     * @param targetName
166
+     * @return
167
+     */
168
+    IPage<TaPerson> getConsultantShareTargets(IPage<TaPerson> page,
169
+                                                  @Param("orgId") Integer orgId,
170
+                                                  @Param("userId") String userId,
171
+                                                  @Param("buildingId") String buildingId,
172
+                                                  @Param("startDate") LocalDateTime startDate,
173
+                                                  @Param("endDate") LocalDateTime endDate,
174
+                                                  @Param("targetType") String targetType,
175
+                                                  @Param("targetName") String targetName);
176
+
177
+    /**
178
+     * 置业分享访问人
179
+     * @param page
180
+     * @param orgId
181
+     * @param userId
182
+     * @param buildingId
183
+     * @param startDate
184
+     * @param endDate
185
+     * @return
186
+     */
187
+    IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page,
188
+                                              @Param("orgId") Integer orgId,
189
+                                              @Param("userId") String userId,
190
+                                              @Param("buildingId") String buildingId,
191
+                                              @Param("startDate") LocalDateTime startDate,
192
+                                              @Param("endDate") LocalDateTime endDate);
193
+
194
+    /**
195
+     * 置业分享访问明细
196
+     * @param page
197
+     * @param orgId
198
+     * @param userId
199
+     * @param buildingId
200
+     * @param startDate
201
+     * @param endDate
202
+     * @param targetType
203
+     * @param targetName
204
+     * @return
205
+     */
206
+    IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page,
207
+                                            @Param("orgId") Integer orgId,
208
+                                            @Param("userId") String userId,
209
+                                            @Param("buildingId") String buildingId,
210
+                                            @Param("startDate") LocalDateTime startDate,
211
+                                            @Param("endDate") LocalDateTime endDate,
212
+                                            @Param("targetType") String targetType,
213
+                                            @Param("targetName") String targetName,
214
+                                            @Param("userName") String userName,
215
+                                            @Param("personId") String personId);
216
+}

+ 27
- 0
src/main/java/com/huiju/estateagents/service/IActivityManageService.java Прегледај датотеку

@@ -0,0 +1,27 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.huiju.estateagents.base.ResponseBean;
4
+import com.huiju.estateagents.bo.request.ActivityStatisticResponseBO;
5
+import com.huiju.estateagents.mapper.ActivityManageMapper;
6
+import com.huiju.estateagents.service.impl.ActivityManageServiceImpl;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+/**
11
+ * @author gusy
12
+ * @date 2020/4/26 11:14
13
+ */
14
+@Service
15
+public class IActivityManageService implements ActivityManageServiceImpl {
16
+
17
+    @Autowired
18
+    private ActivityManageMapper activityManageMapper;
19
+
20
+    @Override
21
+    public ResponseBean getStatisticDataByType(String type, String id,Integer orgId) {
22
+        ResponseBean responseBean = new ResponseBean();
23
+        ActivityStatisticResponseBO responseBO = activityManageMapper.getStatisticDataByType(type, id,orgId);
24
+        responseBean.addSuccess(responseBO);
25
+        return responseBean;
26
+    }
27
+}

+ 97
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java Прегледај датотеку

@@ -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,98 @@ 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);
218
+
219
+    /**
220
+     * 人员城市分布
221
+     * @param orgId
222
+     * @return
223
+     */
224
+    ResponseBean selectCityPerson(Integer orgId);
129 225
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java Прегледај датотеку

@@ -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
 

+ 16
- 0
src/main/java/com/huiju/estateagents/service/ITaCustomerFromService.java Прегледај датотеку

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.huiju.estateagents.entity.TaCustomerFrom;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 客户来源  服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2020-04-27
13
+ */
14
+public interface ITaCustomerFromService extends IService<TaCustomerFrom> {
15
+
16
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaLiveActivityService.java Прегледај датотеку

@@ -41,7 +41,7 @@ public interface ITaLiveActivityService extends IService<TaLiveActivity> {
41 41
      * @return
42 42
      */
43 43
     IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
44
-                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId);
44
+                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId);
45 45
 
46 46
     /**
47 47
      * 访问量自增

+ 10
- 0
src/main/java/com/huiju/estateagents/service/ITaPersonService.java Прегледај датотеку

@@ -110,4 +110,14 @@ public interface ITaPersonService extends IService<TaPerson> {
110 110
      * @return
111 111
      */
112 112
     Integer savePersonPosition(TaPersonPositon record);
113
+
114
+    void authPhone(Integer orgId,
115
+                   String openid,
116
+                   String phone,
117
+                   String buildingId,
118
+                   String sceneId,
119
+                   String targetType,
120
+                   String targetId,
121
+                   String targetName,
122
+                   String promoter) throws Exception;
113 123
 }

+ 44
- 21
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Прегледај датотеку

@@ -1,18 +1,16 @@
1 1
 package com.huiju.estateagents.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.service.IService;
4 5
 import com.huiju.estateagents.base.ResponseBean;
5 6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6 7
 import com.huiju.estateagents.entity.TaPerson;
7 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
8 9
 import com.huiju.estateagents.entity.TaRecommendCustomer;
9
-import com.baomidou.mybatisplus.extension.service.IService;
10 10
 import com.huiju.estateagents.excel.AgentsRecommendCustomer;
11 11
 import com.huiju.estateagents.excel.ExcelRecommendCustomer;
12 12
 import com.huiju.estateagents.excel.ReporRecommendCustomer;
13
-import io.swagger.models.auth.In;
14 13
 
15
-import java.time.LocalDateTime;
16 14
 import java.util.List;
17 15
 
18 16
 /**
@@ -31,66 +29,75 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
31 29
 
32 30
     ResponseBean updateCustByJSON(String paramStr);
33 31
 
34
-    ResponseBean recommendCust(String paramStr, String openid,Integer orgId);
32
+    ResponseBean recommendCust(String paramStr, String openid, Integer orgId);
35 33
 
36
-    ResponseBean reportCust(String paramStr, String openid,Integer orgId);
34
+    ResponseBean reportCust(String paramStr, String openid, Integer orgId);
37 35
 
38
-    IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
36
+    IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building, String personId);
39 37
 
40
-    IPage getCustomerList(Integer status,int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList,String sceneType, String startCreateDate, String endCreateDate);
38
+    IPage getCustomerList(Integer status, int pageNumber, int pageSize, String building, String name, String tel, String consultName,
39
+                          String consultTel, String entryType, String verifyStatus, Integer sex, String customerType, Integer orgId,
40
+                          List<TaPersonBuilding> taPersonBuildingList, String sceneType, String startCreateDate, String endCreateDate,
41
+                          String sharePersonName, Integer belongStatus);
41 42
 
42
-    IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
43
+    IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
43 44
 
44
-    IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
45
+    IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
45 46
 
46
-    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel, Integer orgId);
47
+    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, Integer orgId);
47 48
 
48 49
 
49
-    TaRecommendCustomer getCustomerDetail(String customerId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId);
50
+    TaRecommendCustomer getCustomerDetail(String customerId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId);
50 51
 
51
-    TaPerson getPublicCustomerDetail(String personId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId);
52
+    TaPerson getPublicCustomerDetail(String personId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId);
52 53
 
53 54
     TaRecommendCustomer getCustomerById(String customerId);
54 55
 
55
-    IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
56
+    IPage<TaRecommendCustomer> getCustomersIRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
56 57
 
57 58
     TaRecommendCustomer newByPerson(TaPerson person);
58 59
 
59 60
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60 61
 
61 62
     ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
63
+
62 64
     /**
63 65
      * 导出数据(推荐客户)
66
+     *
64 67
      * @param orgId
65 68
      * @return
66 69
      */
67
-    List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList);
70
+    List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList);
68 71
 
69 72
     /**
70 73
      * 导出数据(推荐客户) 总数
74
+     *
71 75
      * @param orgId
72 76
      * @return
73 77
      */
74
-    Integer getRecCustomerExportCount(Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
78
+    Integer getRecCustomerExportCount(Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
75 79
 
76 80
     /**
77 81
      * 导出数据(报备客户) 总数
82
+     *
78 83
      * @param orgId
79 84
      * @return
80 85
      */
81
-    Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
86
+    Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
82 87
 
83 88
     /**
84 89
      * 导出数据(报备客户)
90
+     *
85 91
      * @param orgId
86 92
      * @param pageCode
87 93
      * @param pageSize
88 94
      * @return
89 95
      */
90
-    List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList);
96
+    List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList);
91 97
 
92 98
     /**
93 99
      * 导出数据(经纪人) 总数
100
+     *
94 101
      * @param orgId
95 102
      * @return
96 103
      */
@@ -98,22 +105,25 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
98 105
 
99 106
     /**
100 107
      * 导出数据(经纪人)
108
+     *
101 109
      * @param orgId
102 110
      * @param pageCode
103 111
      * @param pageSize
104 112
      * @return
105 113
      */
106 114
     List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize);
107
-    
115
+
108 116
     /**
109 117
      * 查询我的客户人数集合
118
+     *
110 119
      * @param openid
111 120
      * @return
112 121
      */
113 122
     ResponseBean getMyCustStatistics(String openid);
114
-    
123
+
115 124
     /**
116 125
      * 分页查询我的跟进客户集合
126
+     *
117 127
      * @param pageNumber
118 128
      * @param pageSize
119 129
      * @param openid
@@ -127,17 +137,19 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
127 137
      * @return
128 138
      */
129 139
     ResponseBean getMyCustFollowOrClinch(Integer pageNumber, Integer pageSize, String openid, String type, String name, String phone, Integer status, String startReportDate, String endReportDate, String startArrivalDate, String endArrivalDate);
130
-    
140
+
131 141
     /**
132 142
      * 获取盘客工具下我的客户详情
143
+     *
133 144
      * @param customerId
134 145
      * @param openid
135 146
      * @return
136 147
      */
137 148
     ResponseBean getMyCustDetail(String customerId, String openid);
138
-    
149
+
139 150
     /**
140 151
      * 更新我的客户基本信息
152
+     *
141 153
      * @param taRecommendCustomer
142 154
      * @param openid
143 155
      * @return
@@ -146,6 +158,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
146 158
 
147 159
     /**
148 160
      * 查询置业顾问的 归属客户
161
+     *
149 162
      * @param openid
150 163
      * @param keywords
151 164
      * @param pageNumber
@@ -154,4 +167,14 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
154 167
      */
155 168
     ResponseBean getAdminMyCustList(String openid, String keywords, int pageNumber, int pageSize);
156 169
 
170
+    /**
171
+     * 获取置业顾问下
172
+     * @param userId
173
+     * @param personId
174
+     * @param buildingId
175
+     * @param orgId
176
+     * @param taPersonBuildingListByUserId
177
+     * @return
178
+     */
179
+    List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId);
157 180
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaShareService.java Прегледај датотеку

@@ -36,5 +36,5 @@ public interface ITaShareService extends IService<TaShare> {
36 36
      * @param top
37 37
      * @return
38 38
      */
39
-    List<Map<String, Object>> statTopShare(Integer orgId, String targetType, String targetId, Integer top);
39
+    List<Map<String, Object>> statTopShare(Integer orgId, String targetType, String targetId, Integer top, String beginDate, String endDate);
40 40
 }

+ 23
- 0
src/main/java/com/huiju/estateagents/service/ITsActivityDailyService.java Прегледај датотеку

@@ -0,0 +1,23 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TsActivityDaily;
5
+import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 活动统计  服务类
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2020-04-20
17
+ */
18
+public interface ITsActivityDailyService extends IService<TsActivityDaily> {
19
+
20
+    List<TsActivityDaily> getActivityDetail(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId, String targetName, String asc, String desc);
21
+
22
+    List<ActivityDailyExport> getActivityExport(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId);
23
+}

+ 44
- 0
src/main/java/com/huiju/estateagents/service/ITsConsultantKpiService.java Прегледај датотеку

@@ -0,0 +1,44 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.*;
5
+import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.estateagents.excel.ConsultantKPIExport;
7
+
8
+import java.time.LocalDateTime;
9
+import java.util.List;
10
+
11
+/**
12
+ * <p>
13
+ * 置业顾问KPI  服务类
14
+ * </p>
15
+ *
16
+ * @author yansen
17
+ * @since 2020-04-14
18
+ */
19
+public interface ITsConsultantKpiService extends IService<TsConsultantKpi> {
20
+
21
+    IPage<TsConsultantKpi> stsKPIDaily(Integer pageNum, Integer pageSize, Integer orgId, Integer userId, String buildingId, String startDate, String endDate, String asc, String desc);
22
+
23
+    TsConsultantKpi stsKPITotalByOrg(Integer orgId, Integer userId, String buildingId, String startDate, String endDate);
24
+
25
+    List<ConsultantKPIExport> stsKPIDailyExport(Integer orgId, Integer userId, String buildingId, String startDate, String endDate);
26
+
27
+    IPage<TaRecommendCustomer> getCustomerListOfConsultant(IPage<TaRecommendCustomer> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
28
+
29
+    IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
30
+
31
+    IPage<TaPerson> getConsultantHomePagePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
32
+
33
+    IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String personId);
34
+
35
+    IPage<TaPerson> getConsultantChatPersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
36
+
37
+    IPage<TaPerson> getConsultantFavor(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
38
+
39
+    IPage<TaPerson> getConsultantShareTargets(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName);
40
+
41
+    IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
42
+
43
+    IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName, String userName, String personId);
44
+}

+ 12
- 0
src/main/java/com/huiju/estateagents/service/impl/ActivityManageServiceImpl.java Прегледај датотеку

@@ -0,0 +1,12 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.huiju.estateagents.base.ResponseBean;
4
+
5
+/**
6
+ * @author gusy
7
+ * @date 2020/4/26 11:13
8
+ */
9
+public interface ActivityManageServiceImpl {
10
+
11
+    ResponseBean getStatisticDataByType(String type,String id,Integer orgId);
12
+}

+ 294
- 4
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Прегледај датотеку

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

+ 1
- 4
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Прегледај датотеку

@@ -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;

+ 20
- 0
src/main/java/com/huiju/estateagents/service/impl/TaCustomerFromServiceImpl.java Прегледај датотеку

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.huiju.estateagents.entity.TaCustomerFrom;
4
+import com.huiju.estateagents.mapper.TaCustomerFromMapper;
5
+import com.huiju.estateagents.service.ITaCustomerFromService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 客户来源  服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2020-04-27
16
+ */
17
+@Service
18
+public class TaCustomerFromServiceImpl extends ServiceImpl<TaCustomerFromMapper, TaCustomerFrom> implements ITaCustomerFromService {
19
+
20
+}

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java Прегледај датотеку

@@ -104,13 +104,13 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
104 104
 
105 105
     @Override
106 106
     public IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
107
-                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId) {
107
+                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId) {
108 108
         logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
109 109
                     "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
110 110
                 liveActivityTitle, cityId, buildingId, status);
111 111
 
112 112
         IPage<TaLiveActivity> pg = new Page<>(pageNum, pageSize);
113
-        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId,taPersonBuildingListByUserId);
113
+        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId,taPersonBuildingListByUserId, userId);
114 114
     }
115 115
 
116 116
     @Override

+ 432
- 4
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Прегледај датотеку

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
8 8
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9 9
 import com.huiju.estateagents.base.ResponseBean;
10 10
 import com.huiju.estateagents.center.taUser.entity.TaUser;
11
+import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
11 12
 import com.huiju.estateagents.center.taUser.service.ITaUserService;
12 13
 import com.huiju.estateagents.common.CommConstant;
13 14
 import com.huiju.estateagents.common.DateUtils;
@@ -18,6 +19,7 @@ import com.huiju.estateagents.event.EventBus;
18 19
 import com.huiju.estateagents.mapper.*;
19 20
 import com.huiju.estateagents.service.*;
20 21
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
22
+import lombok.extern.slf4j.Slf4j;
21 23
 import org.apache.commons.collections.CollectionUtils;
22 24
 import org.springframework.beans.factory.annotation.Autowired;
23 25
 import org.springframework.context.ApplicationContext;
@@ -39,6 +41,7 @@ import java.util.stream.Collectors;
39 41
  * @author jobob
40 42
  * @since 2019-05-10
41 43
  */
44
+@Slf4j
42 45
 @Service
43 46
 public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> implements ITaPersonService {
44 47
 
@@ -64,17 +67,26 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
64 67
     TaChatMapper taChatMapper;
65 68
 
66 69
     @Autowired
67
-    private ITaRecommendCustomerService iTaRecommendCustomerService;
70
+    TaUserMapper taUserMapper;
68 71
 
69 72
     @Autowired
70 73
     private TaSaveMapper taSaveMapper;
71 74
 
75
+    @Autowired
76
+    private TaBuildingMapper taBuildingMapper;
77
+
78
+    @Autowired
79
+    private TaCustomerFromMapper taCustomerFromMapper;
80
+
72 81
     @Autowired
73 82
     private TaActivityDynamicEnlistMapper taActivityDynamicEnlistMapper;
74 83
 
75 84
     @Autowired
76 85
     private TaBuildingDynamicMapper taBuildingDynamicMapper;
77 86
 
87
+    @Autowired
88
+    private ITaRecommendCustomerService iTaRecommendCustomerService;
89
+
78 90
     @Autowired
79 91
     private ITaPointsRecordsService pointsRecordsService;
80 92
 
@@ -86,10 +98,9 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
86 98
 
87 99
     @Autowired
88 100
     private TaShareContentService taShareContentService;
89
-    
90
-    @Autowired
91
-    private TaBuildingMapper taBuildingMapper;
92 101
 
102
+    @Autowired
103
+    private TaSharePersonFromServiceImpl taSharePersonFromService;
93 104
 
94 105
     @Resource
95 106
     private ApplicationContext applicationContext;
@@ -132,6 +143,10 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
132 143
 
133 144
             person.setAvatarurl(userInfo.getAvatarUrl());
134 145
             person.setNickname(userInfo.getNickName());
146
+            person.setGender(userInfo.getGender());
147
+            person.setProvince(userInfo.getProvince());
148
+            person.setCity(userInfo.getCity());
149
+            person.setCountry(userInfo.getCountry());
135 150
 
136 151
             //获取推荐客户表中此人的信息并更新头像和姓名
137 152
             updateTaRecommendCustomer(person);
@@ -152,6 +167,10 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
152 167
             if (StringUtils.isEmpty(e.getName()) || "匿名用户".equals(e.getName())){
153 168
                 e.setName(person.getNickname());
154 169
                 e.setPicture(person.getAvatarurl());
170
+                e.setSex(null == person.getSex() ? str2Int(person.getGender()) : person.getSex());
171
+                e.setCountry(person.getCountry());
172
+                e.setCity(person.getCity());
173
+                e.setProvince(person.getProvince());
155 174
                 taRecommendCustomerMapper.updateById(e);
156 175
             }
157 176
         });
@@ -798,6 +817,8 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
798 817
     @Override
799 818
     public void upDatePersonCityToId (String personId){
800 819
         taPersonMapper.upDatePersonCityToId(personId);
820
+
821
+
801 822
     }
802 823
 
803 824
     @Override
@@ -833,6 +854,413 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
833 854
         return taPersonMapper.savePersonPosition(record);
834 855
     }
835 856
 
857
+    /**
858
+     * 授权手机号
859
+     * @param orgId
860
+     * @param openid
861
+     * @param phone
862
+     * @param buildingId
863
+     * @param sceneId
864
+     * @param targetType
865
+     * @param targetId
866
+     * @param targetName
867
+     * @param promoter
868
+     * @throws Exception
869
+     */
870
+    @Override
871
+    public void authPhone(Integer orgId, String openid, String phone, String buildingId, String sceneId, String targetType, String targetId, String targetName, String promoter) throws Exception {
872
+        log.info("orgId={},openid={},phone={},buildingId={},sceneId={},targetType={},targetId={},targetName={},promoter={}",
873
+                orgId,openid,phone,buildingId,sceneId,targetType,targetId,targetName,promoter);
874
+        //
875
+        LocalDateTime now = LocalDateTime.now();
876
+
877
+        // 1. 更新当前人员
878
+        List<TaPerson> persons = getPersonsByOpenId(openid);
879
+        if (null == persons || persons.size() != 1) {
880
+            throw new Exception("当前人员 openid 异常");
881
+        }
882
+        TaPerson person = persons.get(0);
883
+
884
+        // 更新人员手机号
885
+        person.setPhone(phone);
886
+        person.setAuthPhoneTime(now);
887
+        if (StringUtils.isEmpty(person.getBuildingId())) {
888
+            person.setBuildingId(buildingId);
889
+        }
890
+        if (CommConstant.PERSON_ESTATE_DRIFT.equals(person.getPersonType())) {
891
+            person.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
892
+        }
893
+        updateById(person);
894
+        fixCustomerPersonId(person);
895
+
896
+        // 2. 发放积分
897
+        applicationContext.publishEvent(new EventBus(person, EventBus.EventType.SignUpAgent, orgId));
898
+
899
+        //授权手机给推广人加积分
900
+        String sharePersonId = getSharePersonFrom(person);
901
+
902
+        if (validateSceneId(sceneId) && !StringUtils.isEmpty(sharePersonId)){
903
+            applicationContext.publishEvent(new EventBus(promoter != null ? promoter : sharePersonId, EventBus.EventType.SharePosterAll, orgId));
904
+        }
905
+
906
+        // 3. 处理推广人
907
+        TaPerson recPerson = taPersonMapper.getById(promoter);
908
+        if (recPerson != null && CommConstant.STATUS_DELETE.equals(recPerson.getStatus())) {
909
+            recPerson = null;
910
+        }
911
+
912
+        TaUser taUser = null;
913
+        List<String> withBuildings = null;  // 推广人授权的楼盘
914
+        boolean isAssociated = false;       // 传入的楼盘与推广人是否有关联关系
915
+        boolean isConsultant = false;       // 是否置业顾问
916
+        if (!StringUtils.isEmpty(promoter)) {
917
+            taUser = taUserMapper.getUserByPerson(orgId, promoter);
918
+            if (null != taUser) {
919
+                isConsultant = taUser != null && taUser.getIsConsultant() != null && taUser.getIsConsultant();
920
+                List<TaPerson> userPerons = new ArrayList<>();
921
+                userPerons.add(recPerson);
922
+                taUser.setPersonIds(userPerons);
923
+
924
+                withBuildings = taUserMapper.getBuildingIdsOf(taUser.getUserId(), null);
925
+
926
+                if (null != taUser.getIsAdmin() && taUser.getIsAdmin()) {
927
+                    isAssociated = true;
928
+                } else {
929
+                    if (null != withBuildings && withBuildings.size() > 0 && !StringUtils.isEmpty(buildingId)) {
930
+                        isAssociated = withBuildings.contains(buildingId);
931
+                    }
932
+                }
933
+            }
934
+        }
935
+
936
+        // 楼盘
937
+        TaBuilding taBuilding = null;
938
+        if (!StringUtils.isEmpty(buildingId)) {
939
+            taBuilding = taBuildingMapper.selectById(buildingId);
940
+            if (taBuilding.getStatus().equals(CommConstant.STATUS_DELETE)) {
941
+                taBuilding = null;
942
+            }
943
+        }
944
+
945
+        // 没有置业, 也没楼盘
946
+        if ((recPerson == null || !isConsultant) && taBuilding == null) {
947
+            TaCustomerFrom customerFrom = new TaCustomerFrom();
948
+            customerFrom.setPersonId(person.getPersonId());
949
+            customerFrom.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
950
+            customerFrom.setTargetType(targetType);
951
+            customerFrom.setTargetId(targetId);
952
+            customerFrom.setTargetName(targetName);
953
+            customerFrom.setOrgId(orgId);
954
+            customerFrom.setSceneId(sceneId);
955
+            customerFrom.setIsOrgFirst(true);   // 授权手机号, 肯定是第一次
956
+            customerFrom.setIsProjectFirst(false);
957
+            customerFrom.setCreateDate(now);
958
+            if (null != recPerson) {
959
+                customerFrom.setSharePersonId(recPerson.getPersonId());
960
+                customerFrom.setSharePersonName(StringUtils.ifNull(recPerson.getName(), recPerson.getNickname()));
961
+            }
962
+
963
+            taCustomerFromMapper.insert(customerFrom);
964
+
965
+
966
+            TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
967
+            customer.setVerifyStatus(CommConstant.VERIFY_READY);
968
+            customer.setStatus(CommConstant.CUSTOMER_REPORT);
969
+            customer.setEntryType(CommConstant.ENTRY_INPUT);
970
+            customer.setCreateDate(now);
971
+            customer.setReportDate(now);
972
+            customer.setRecommendPerson(promoter);
973
+            taRecommendCustomerMapper.insert(customer);
974
+
975
+            return ;
976
+        }
977
+
978
+        // 3. 修正客户信息
979
+        List<TaBuilding> withBuildingList = null;
980
+        if (null != withBuildings && withBuildings.size() > 0) {
981
+            QueryWrapper<TaBuilding> queryBuilding = new QueryWrapper<>();
982
+            queryBuilding.in("building_id", withBuildings);
983
+            withBuildingList = taBuildingMapper.selectList(queryBuilding);
984
+        }
985
+        List<TaRecommendCustomer> customers = mergeCustomerByPhone(person, taUser, taBuilding, withBuildingList, isAssociated, now);
986
+        if (null == customers || customers.size() == 0) {
987
+            throw new Exception("生成客户信息异常, 请联系技术人员");
988
+        }
989
+
990
+        // 4. 客户来源, 注意不是用户来源
991
+        TaCustomerFrom customerFrom = new TaCustomerFrom();
992
+        customerFrom.setPersonId(person.getPersonId());
993
+        customerFrom.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
994
+        customerFrom.setTargetType(targetType);
995
+        customerFrom.setTargetId(targetId);
996
+        customerFrom.setTargetName(targetName);
997
+        customerFrom.setOrgId(orgId);
998
+        customerFrom.setSceneId(sceneId);
999
+        customerFrom.setIsOrgFirst(true);   // 授权手机号, 肯定是第一次
1000
+        customerFrom.setCreateDate(now);
1001
+
1002
+        if (null != taBuilding) {
1003
+            customerFrom.setBuildingId(buildingId);
1004
+            customerFrom.setBuildingName(taBuilding.getBuildingName());
1005
+            QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<TaCustomerFrom>();
1006
+            queryWrapper.eq("person_id", person.getPersonId());
1007
+            queryWrapper.eq("org_id", orgId);
1008
+            queryWrapper.eq("building_id", buildingId);
1009
+            if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
1010
+                customerFrom.setIsProjectFirst(true);
1011
+            }
1012
+
1013
+            for (TaRecommendCustomer cust : customers) {
1014
+                if (buildingId.equals(cust.getBuildingId())) {
1015
+                    customerFrom.setCustomerId(cust.getCustomerId());
1016
+                }
1017
+            }
1018
+        } else if (isConsultant && null != withBuildingList && withBuildingList.size() > 0) {
1019
+            // 没有楼盘则使用置业授权的楼盘
1020
+            customerFrom.setBuildingId(withBuildingList.get(0).getBuildingId());
1021
+            customerFrom.setBuildingName(withBuildingList.get(0).getBuildingName());
1022
+        }
1023
+        if (null != recPerson) {
1024
+            customerFrom.setSharePersonId(recPerson.getPersonId());
1025
+            customerFrom.setSharePersonName(StringUtils.ifNull(recPerson.getName(), recPerson.getNickname()));
1026
+        }
1027
+
1028
+        taCustomerFromMapper.insert(customerFrom);
1029
+    }
1030
+
1031
+    private String getSharePersonFrom(TaPerson person){
1032
+        QueryWrapper<TaSharePersonFrom> taSharePersonFromQueryWrapper = new QueryWrapper<>();
1033
+        taSharePersonFromQueryWrapper.eq("person_id", person.getPersonId());
1034
+        taSharePersonFromQueryWrapper.eq("is_first_time", CommConstant.STATUS_NORMAL);
1035
+        taSharePersonFromQueryWrapper.eq("status", 1);
1036
+        List<TaSharePersonFrom> taSharePersonFroms = taSharePersonFromService.list(taSharePersonFromQueryWrapper);
1037
+        if (CollectionUtils.isEmpty(taSharePersonFroms)){
1038
+            return null;
1039
+        }
1040
+
1041
+        TaSharePersonFrom taSharePersonFrom = taSharePersonFroms.get(0);
1042
+        if (CommConstant.PERSON_REALTY_CONSULTANT.equals(taSharePersonFrom.getSharePersonType())){
1043
+            QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
1044
+            taPersonQueryWrapper.eq("user_id" , taSharePersonFrom.getSharePerson());
1045
+            taPersonQueryWrapper.eq("status" , CommConstant.STATUS_NORMAL);
1046
+            TaPerson taPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
1047
+            return taPerson.getPersonId();
1048
+        }
1049
+        return taSharePersonFrom.getSharePerson();
1050
+    }
1051
+
1052
+    public boolean validateSceneId(String sceneId){
1053
+        if ("1047".equals(sceneId) || "1048".equals(sceneId) || "1007".equals(sceneId)){
1054
+            return true;
1055
+        }
1056
+        return false;
1057
+    }
1058
+
1059
+    private void fixCustomerPersonId(TaPerson person) {
1060
+        // 先更新之前的数据, 有一种可能的情况, 客户是推荐的,之前未进入过小程序
1061
+        // 后面所有的查询就可以不需要 phone , 改用 person_id 了
1062
+        QueryWrapper<TaRecommendCustomer> q1 = new QueryWrapper<>();
1063
+        q1.eq("org_id", person.getOrgId());
1064
+        q1.eq("phone", person.getPhone());
1065
+        q1.isNull("person_id");
1066
+        List<TaRecommendCustomer> customers = taRecommendCustomerMapper.selectList(q1);
1067
+        if (null != customers) {
1068
+            for (int i = 0; i < customers.size(); i++) {
1069
+                TaRecommendCustomer cust = customers.get(i);
1070
+                cust = copyByPerosn(person, cust);
1071
+                taRecommendCustomerMapper.updateById(cust);
1072
+            }
1073
+        }
1074
+    }
1075
+
1076
+
1077
+    /**
1078
+     * 此处逻辑按照复杂流程处理
1079
+     * 除了新增客户外,还有修正原有数据的目的
1080
+     * @param person
1081
+     * @param taUser
1082
+     * @param building
1083
+     * @param withBuildings
1084
+     * @param isAssociated
1085
+     * @param now
1086
+     * @return
1087
+     * @throws Exception
1088
+     */
1089
+    private List<TaRecommendCustomer> mergeCustomerByPhone(TaPerson person, TaUser taUser, TaBuilding building, List<TaBuilding> withBuildings, boolean isAssociated, LocalDateTime now) throws Exception {
1090
+
1091
+        /**
1092
+         * 新增客户流程
1093
+         * 1. 推广人是置业, 楼盘跟置业关联 => return 新增一条客户
1094
+         * 2. 有楼盘  => 新增一条项目公客  continue
1095
+         * 3. 有推广人 => 更新为私客, 或者新增一条公客 continue
1096
+         * 4. return
1097
+         */
1098
+
1099
+        TaPerson recPerson = null;
1100
+        if (null != taUser) {
1101
+            recPerson = taUser.getPersonIds().get(0);
1102
+        }
1103
+        // 推广人是否置业
1104
+        boolean isConsultant = taUser != null && taUser.getIsConsultant() != null && taUser.getIsConsultant();
1105
+        // 置业授权的楼盘
1106
+        TaBuilding taBuilding = null != withBuildings ? withBuildings.get(0) : null;
1107
+
1108
+        // 1. 如果置业跟楼盘是关联的
1109
+        if (isAssociated) {
1110
+            // 查询是否已经存在记录
1111
+            QueryWrapper<TaRecommendCustomer> q2 = new QueryWrapper<>();
1112
+            q2.eq("org_id", person.getOrgId());
1113
+            q2.eq("building_id", building.getBuildingId());
1114
+            q2.eq("person_id", person.getPersonId());
1115
+            List<TaRecommendCustomer> existsRows = taRecommendCustomerMapper.selectList(q2);
1116
+
1117
+            if (null == existsRows || existsRows.size() < 1) {
1118
+                TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
1119
+                customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
1120
+                customer.setStatus(CommConstant.CUSTOMER_REPORT);
1121
+                customer.setEntryType(CommConstant.ENTRY_INPUT);
1122
+                customer.setCreateDate(now);
1123
+                customer.setReportDate(now);
1124
+                customer.setRecommendPerson(recPerson.getPersonId());
1125
+                customer.setRealtyConsultant(taUser.getUserId().toString());
1126
+                customer.setBuildingId(building.getBuildingId());
1127
+                customer.setIntention(building.getBuildingName());
1128
+                taRecommendCustomerMapper.insert(customer);
1129
+
1130
+                return new ArrayList<TaRecommendCustomer>(){{
1131
+                    add(customer);
1132
+                }};
1133
+            }
1134
+        }
1135
+
1136
+        // 2. 有楼盘
1137
+        if (null != building) {
1138
+            // 查询是否已经存在记录
1139
+            QueryWrapper<TaRecommendCustomer> q3 = new QueryWrapper<>();
1140
+            q3.eq("org_id", person.getOrgId());
1141
+            q3.eq("building_id", building.getBuildingId());
1142
+            q3.eq("person_id", person.getPersonId());
1143
+            List<TaRecommendCustomer> existsRows = taRecommendCustomerMapper.selectList(q3);
1144
+
1145
+            if (null == existsRows || existsRows.size() < 1) {
1146
+                TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
1147
+                customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
1148
+                customer.setStatus(CommConstant.CUSTOMER_REPORT);
1149
+                customer.setEntryType(CommConstant.ENTRY_INPUT);
1150
+                customer.setCreateDate(now);
1151
+                customer.setReportDate(now);
1152
+                customer.setBuildingId(building.getBuildingId());
1153
+                customer.setIntention(building.getBuildingName());
1154
+                taRecommendCustomerMapper.insert(customer);
1155
+            }
1156
+        }
1157
+
1158
+        // 3. 有推广人
1159
+        if (null != recPerson) {
1160
+            if (isConsultant) {
1161
+                // 如果是置业, 需要验证是否置业所在项目的客户
1162
+                if (null != taBuilding) {
1163
+                    // 查询是否已经存在记录
1164
+                    // 客户是以项目为纬度的, 因此验证查询不能加置业的条件
1165
+                    QueryWrapper<TaRecommendCustomer> q4 = new QueryWrapper<>();
1166
+                    q4.eq("org_id", person.getOrgId());
1167
+                    q4.eq("building_id", taBuilding.getBuildingId());
1168
+                    q4.eq("person_id", person.getPersonId());
1169
+                    List<TaRecommendCustomer> existsRows = taRecommendCustomerMapper.selectList(q4);
1170
+
1171
+                    if (null == existsRows || existsRows.size() < 1) {
1172
+                        TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
1173
+                        customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
1174
+                        customer.setStatus(CommConstant.CUSTOMER_REPORT);
1175
+                        customer.setEntryType(CommConstant.ENTRY_INPUT);
1176
+                        customer.setCreateDate(now);
1177
+                        customer.setReportDate(now);
1178
+                        customer.setRecommendPerson(recPerson.getPersonId());
1179
+                        customer.setRealtyConsultant(taUser.getUserId().toString());
1180
+                        customer.setBuildingId(taBuilding.getBuildingId());
1181
+                        customer.setIntention(taBuilding.getBuildingName());
1182
+                        taRecommendCustomerMapper.insert(customer);
1183
+                    } else {
1184
+                        // 如果存在项目公客, 把公客绑定为置业的私客
1185
+                        for (int i = 0; i < existsRows.size(); i ++) {
1186
+                            TaRecommendCustomer cust = existsRows.get(0);
1187
+                            if (StringUtils.isEmpty(cust.getRealtyConsultant())) {
1188
+                                cust.setRealtyConsultant(taUser.getUserId().toString());
1189
+                                cust.setReportDate(now);    // 这个更新会覆盖原来的真实时间
1190
+                                taRecommendCustomerMapper.updateById(cust);
1191
+                                break;
1192
+                            }
1193
+                        }
1194
+                    }
1195
+                }
1196
+            }
1197
+
1198
+            // 如果不是置业, 那么就是普通人推荐
1199
+            // 如果置业没有绑定项目, 则认为置业是以普通人身份推荐
1200
+            // 新增一个公客
1201
+            if (!isConsultant || null == taBuilding) {
1202
+                // 查询是否已经存在记录
1203
+                QueryWrapper<TaRecommendCustomer> q5 = new QueryWrapper<>();
1204
+                q5.eq("org_id", person.getOrgId());
1205
+                q5.eq("person_id", person.getPersonId());
1206
+                List<TaRecommendCustomer> existsRows = taRecommendCustomerMapper.selectList(q5);
1207
+
1208
+                if (null == existsRows || existsRows.size() < 1) {
1209
+                    TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
1210
+                    customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
1211
+                    customer.setStatus(CommConstant.CUSTOMER_REPORT);
1212
+                    customer.setEntryType(CommConstant.ENTRY_INPUT);
1213
+                    customer.setCreateDate(now);
1214
+                    customer.setReportDate(now);
1215
+                    customer.setRecommendPerson(recPerson.getPersonId());
1216
+                    taRecommendCustomerMapper.insert(customer);
1217
+                }
1218
+            }
1219
+        }
1220
+
1221
+        // 返回当前人作为客户的数据
1222
+        QueryWrapper<TaRecommendCustomer> query = new QueryWrapper<>();
1223
+        query.eq("org_id", person.getOrgId());
1224
+        query.eq("person_id", person.getPersonId());
1225
+
1226
+        List<String> buildingIds = new ArrayList<>();
1227
+        if (null != building) {
1228
+            buildingIds.add(building.getBuildingId());
1229
+        }
1230
+        if (null != taBuilding) {
1231
+            buildingIds.add(taBuilding.getBuildingId());
1232
+        }
1233
+
1234
+        query.in(buildingIds.size() > 0,"building_id", buildingIds);
1235
+        query.orderByAsc("create_date");
1236
+        return taRecommendCustomerMapper.selectList(query);
1237
+    }
1238
+
1239
+    private TaRecommendCustomer copyByPerosn(TaPerson person, TaRecommendCustomer cust) {
1240
+        cust.setPersonId(person.getPersonId());
1241
+        cust.setName(StringUtils.ifNull(person.getName(), person.getNickname()));
1242
+        cust.setSex(null == person.getSex() ? str2Int(person.getGender()) : person.getSex());
1243
+        cust.setPhone(StringUtils.ifNull(person.getPhone(), person.getTel()));
1244
+        cust.setPicture(StringUtils.ifNull(person.getAvatarurl(), person.getPhoto()));
1245
+        cust.setCountry(person.getCountry());
1246
+        cust.setCity(person.getCity());
1247
+        cust.setProvince(person.getProvince());
1248
+        cust.setOrgId(person.getOrgId());
1249
+
1250
+        return cust;
1251
+    }
1252
+
1253
+    private Integer str2Int(String str) {
1254
+        if (null == str) {
1255
+            return null;
1256
+        }
1257
+
1258
+        try {
1259
+            return Integer.valueOf(str);
1260
+        } catch (Exception e) {
1261
+            return 0;
1262
+        }
1263
+    }
836 1264
 
837 1265
     public String codeGenerator (){
838 1266
         double r = Math.random();

+ 216
- 146
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Прегледај датотеку

@@ -64,7 +64,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
64 64
 
65 65
     @Autowired
66 66
     private TdCityMapper cityMapper;
67
-    
67
+
68 68
     @Autowired
69 69
     private TaCustomerFollowUpRecordMapper customerFollowUpRecordMapper;
70 70
 
@@ -98,6 +98,12 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
98 98
     @Autowired
99 99
     private TdWxDictMapper tdWxDictMapper;
100 100
 
101
+    @Autowired
102
+    private TaCustomerFromMapper taCustomerFromMapper;
103
+
104
+    @Autowired
105
+    private TaSharePersonFromMapper taSharePersonFromMapper;
106
+
101 107
     @Override
102 108
     public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
103 109
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
@@ -142,6 +148,21 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
142 148
         return ResponseBean.success(result);
143 149
     }
144 150
 
151
+    /**
152
+     * 获取置业顾问下
153
+     *
154
+     * @param userId
155
+     * @param personId
156
+     * @param buildingId
157
+     * @param orgId
158
+     * @param taPersonBuildingListByUserId
159
+     * @return
160
+     */
161
+    @Override
162
+    public List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
163
+        return taRecommendCustomerMapper.getConsultantCustomerList(userId,personId,buildingId,orgId);
164
+    }
165
+
145 166
     @Override
146 167
     public ResponseBean getCustDetail(String id) {
147 168
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);
@@ -211,7 +232,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
211 232
     }
212 233
 
213 234
     @Override
214
-    public synchronized ResponseBean recommendCust(String paramStr, String openid,Integer orgId) {
235
+    public synchronized ResponseBean recommendCust(String paramStr, String openid, Integer orgId) {
215 236
         JSONObject params = JSONObject.parseObject(paramStr);
216 237
         if (null == params) {
217 238
             return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
@@ -227,8 +248,17 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
227 248
             return ResponseBean.error(checkResult, ResponseBean.ERROR_MISSING_PARAMS);
228 249
         }
229 250
 
230
-        TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
251
+        // 报备有 10 天有效期
252
+        QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
253
+        queryWrapper.eq("phone", params.getString("phone"));
254
+        queryWrapper.eq("building_id", params.getString("intention"));
255
+        queryWrapper.in("verify_status", CommConstant.VERIFY_AGREE, CommConstant.VERIFY_READY);
256
+        List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
257
+        if (null != result && result.size() > 0) {
258
+            return ResponseBean.error("当前客户已被推荐, 不能再次推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
259
+        }
231 260
 
261
+        TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
232 262
         taRecommendCustomer.setName(params.getString("name"));
233 263
         taRecommendCustomer.setPicture(params.getString("picture"));
234 264
         taRecommendCustomer.setPhone(params.getString("phone"));
@@ -242,11 +272,11 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
242 272
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
243 273
         taRecommendCustomer.setReportDate(LocalDateTime.now());
244 274
         taRecommendCustomer.setOrgId(orgId);
245
-       QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
246
-       personQueryWrapper.eq("org_id",orgId);
247
-       personQueryWrapper.eq("phone",params.getString("phone"));
275
+        QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
276
+        personQueryWrapper.eq("org_id", orgId);
277
+        personQueryWrapper.eq("phone", params.getString("phone"));
248 278
         TaPerson currentPerson = taPersonMapper.selectOne(personQueryWrapper);
249
-        if(null != currentPerson){
279
+        if (null != currentPerson) {
250 280
             taRecommendCustomer.setPersonId(currentPerson.getPersonId());
251 281
         }
252 282
 
@@ -271,24 +301,14 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
271 301
 
272 302
         String status = params.getString("status");
273 303
         int statusInt = 0;
274
-        if (StringUtils.isEmpty(status)){
304
+        if (StringUtils.isEmpty(status)) {
275 305
             taRecommendCustomer.setStatus(statusInt);
276
-        }else{
306
+        } else {
277 307
             taRecommendCustomer.setStatus(Integer.parseInt(status));
278 308
         }
279 309
 
280 310
         taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
281 311
 
282
-        // 报备有 10 天有效期
283
-        QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
284
-        queryWrapper.eq("phone", taRecommendCustomer.getPhone());
285
-        queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
286
-        queryWrapper.in("verify_status",CommConstant.VERIFY_AGREE,CommConstant.VERIFY_READY);
287
-        List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
288
-        if (null != result && result.size() > 0) {
289
-            return ResponseBean.error("当前客户已被推荐, 不能再次推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
290
-        }
291
-
292 312
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
293 313
         if (row < 1) {
294 314
             return ResponseBean.error("推荐客户失败", ResponseBean.ERROR_UNAVAILABLE);
@@ -305,9 +325,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
305 325
     }
306 326
 
307 327
 
308
-
309 328
     @Override
310
-    public ResponseBean reportCust(String paramStr, String openid,Integer orgId) {
329
+    public ResponseBean reportCust(String paramStr, String openid, Integer orgId) {
311 330
         JSONObject params = JSONObject.parseObject(paramStr);
312 331
         if (null == params) {
313 332
             return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
@@ -361,12 +380,12 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
361 380
 //        taRecommendCustomer.setDescribe(params.getString("describe"));
362 381
         taRecommendCustomer.setRealtyConsultant(consultantUser.getUserId().toString());
363 382
         //如果没有传building_id的情况构造building_id
364
-        if (StringUtils.isEmpty(params.getString("buildingId")) && !StringUtils.isEmpty(params.getString("realtyConsultant"))){
383
+        if (StringUtils.isEmpty(params.getString("buildingId")) && !StringUtils.isEmpty(params.getString("realtyConsultant"))) {
365 384
             QueryWrapper<TaPersonBuilding> taPersonBuildingQueryWrapper = new QueryWrapper<>();
366 385
             taPersonBuildingQueryWrapper.eq("person_id", consultantPerson.getPersonId()).or().eq("user_id", consultantUser.getUserId());
367 386
             List<TaPersonBuilding> taPersonBuildingList = taPersonBuildingMapper.selectList(taPersonBuildingQueryWrapper);
368
-            if (taPersonBuildingList.size() > 0){
369
-                params.put("buildingId",taPersonBuildingList.get(0).getBuildingId());
387
+            if (taPersonBuildingList.size() > 0) {
388
+                params.put("buildingId", taPersonBuildingList.get(0).getBuildingId());
370 389
             }
371 390
         }
372 391
         taRecommendCustomer.setBuildingId(params.getString("buildingId"));
@@ -393,11 +412,11 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
393 412
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
394 413
         taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
395 414
         QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
396
-        personQueryWrapper.eq("org_id",orgId);
397
-        personQueryWrapper.eq("phone",params.getString("phone"));
415
+        personQueryWrapper.eq("org_id", orgId);
416
+        personQueryWrapper.eq("phone", params.getString("phone"));
398 417
         TaPerson currentPerson = taPersonMapper.selectOne(personQueryWrapper);
399
-        if(null != currentPerson){
400
-            if (currentPerson.getPersonType().equals(CommConstant.PERSON_REALTY_CONSULTANT)){
418
+        if (null != currentPerson) {
419
+            if (currentPerson.getPersonType().equals(CommConstant.PERSON_REALTY_CONSULTANT)) {
401 420
                 return ResponseBean.error("置业顾问不可以绑定置业顾问", ResponseBean.ERROR_ILLEGAL_PARAMS);
402 421
             }
403 422
             taRecommendCustomer.setPersonId(currentPerson.getPersonId());
@@ -410,38 +429,91 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
410 429
 //        taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
411 430
         taRecommendCustomer.setRecommendPerson(params.getString("realtyConsultant"));
412 431
 
432
+        // 插入客户来源逻辑, 防止下面 if 里面的 return
433
+        // 首次报备的客户, 写入客户来源表
434
+        TaCustomerFrom customerFrom = null;
435
+        if (!StringUtils.isEmpty(taRecommendCustomer.getBuildingId())) {
436
+            Map<String, Number> counter = taCustomerFromMapper.countPerson(taRecommendCustomer.getOrgId(), taRecommendCustomer.getBuildingId(), taRecommendCustomer.getPersonId());
437
+            boolean orgFirst = counter.get("orgCount").longValue() < 1;
438
+            boolean projectFirst = counter.get("projectCount").longValue() < 1;
439
+            if (projectFirst) {
440
+                TaBuilding taBuilding = taBuildingMapper.selectById(taRecommendCustomer.getBuildingId());
441
+
442
+                customerFrom = new TaCustomerFrom();
443
+                customerFrom.setPersonId(taRecommendCustomer.getPersonId());
444
+                customerFrom.setCustomerId(taRecommendCustomer.getCustomerId());
445
+                customerFrom.setPersonName(taRecommendCustomer.getName());
446
+                customerFrom.setOrgId(taRecommendCustomer.getOrgId());
447
+//              customerFrom.setSceneId(sceneId);
448
+                customerFrom.setIsOrgFirst(orgFirst);
449
+                QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<TaCustomerFrom>();
450
+                queryWrapper.eq("person_id", taRecommendCustomer.getPersonId());
451
+                queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
452
+                queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
453
+                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1) {
454
+                    customerFrom.setIsProjectFirst(true);
455
+                }
456
+                customerFrom.setCreateDate(LocalDateTime.now());
457
+                customerFrom.setBuildingId(taRecommendCustomer.getBuildingId());
458
+                customerFrom.setBuildingName(taBuilding.getBuildingName());
459
+                customerFrom.setSharePersonId(consultantPerson.getPersonId());
460
+                customerFrom.setSharePersonName(consultantUser.getUserName());
461
+
462
+                // 半小时内如果有当前人员的分享记录
463
+                // 那么就认为当前客户是通过分享进入的
464
+                TaSharePersonFrom personShare = taSharePersonFromMapper.getConsultantLastShare(taRecommendCustomer.getOrgId(),
465
+                        taRecommendCustomer.getBuildingId(),
466
+                        consultantUser.getUserId(),
467
+                        taRecommendCustomer.getPersonId());
468
+                if (null != personShare) {
469
+                    // 强制转换 targetType
470
+                    String targetType = personShare.getTargetType().replace("_share", "").replace("dynamic", "activity");
471
+                    customerFrom.setTargetType(targetType);
472
+                    customerFrom.setTargetId(personShare.getTargetId());
473
+                    customerFrom.setTargetName(personShare.getTargetName());
474
+                }
475
+
476
+                taCustomerFromMapper.insert(customerFrom);
477
+            }
478
+        }
479
+
480
+
413 481
         // 报备有 10 天有效期
414 482
         QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
415 483
         queryWrapper.eq("phone", taRecommendCustomer.getPhone());
416
-        queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
484
+        queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
417 485
         queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
418
-        queryWrapper.in("verify_status",CommConstant.VERIFY_AGREE,CommConstant.VERIFY_READY);
486
+        queryWrapper.in("verify_status", CommConstant.VERIFY_AGREE, CommConstant.VERIFY_READY);
419 487
         List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
420 488
         if (null != result && result.size() > 0) {
421 489
             String conName = "";
422 490
             TaPerson conPerson = taPersonMapper.selectById(result.get(0).getRealtyConsultant());
423
-            if (null != conPerson){
424
-                if(null != consultantPerson && consultantPerson.getPersonId().equals(conPerson.getPersonId())){
425
-                   return  ResponseBean.success("bound");
491
+            if (null != conPerson) {
492
+                if (null != consultantPerson && consultantPerson.getPersonId().equals(conPerson.getPersonId())) {
493
+                    return ResponseBean.success("bound");
426 494
                 }
427 495
                 conName = conPerson.getName();
428
-            }else {
496
+            } else {
429 497
                 TaUser conUser = userService.getById(result.get(0).getRealtyConsultant());
430
-                if(null != conUser){
431
-                    if(consultantUser.getUserId().equals(conUser.getUserId())){
498
+                if (null != conUser) {
499
+                    if (consultantUser.getUserId().equals(conUser.getUserId())) {
432 500
                         return ResponseBean.success("bound");
433 501
                     }
434 502
                     conName = conUser.getUserName();
435 503
 
436 504
                 }
437 505
             }
438
-            return ResponseBean.error("您在当前项目的置业顾问是:"+conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
506
+            return ResponseBean.error("您在当前项目的置业顾问是:" + conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
439 507
         }
440 508
 
441 509
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
442 510
         if (row < 1) {
443 511
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);
444 512
         }
513
+        if (null != customerFrom) {
514
+            customerFrom.setCustomerId(taRecommendCustomer.getCustomerId());
515
+            taCustomerFromMapper.updateById(customerFrom);
516
+        }
445 517
 
446 518
         // 找到销售经理,并推送消息
447 519
 //        TaPerson saleMan = taPersonMapper.getSalesExecutive();
@@ -471,106 +543,104 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
471 543
     }
472 544
 
473 545
 
474
-
475
-
476 546
     List<TaPerson> getPersonsByOpenId(String openid) {
477 547
         return taPersonMapper.getPersonByOpenId(openid);
478 548
     }
479 549
 
480 550
     @Override
481
-    public IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize,String building,String personId){
482
-        QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
551
+    public IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building, String personId) {
552
+        QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
483 553
 //        queryWrapper.eq("building_id",building);
484
-        queryWrapper.eq("realty_consultant",personId);
554
+        queryWrapper.eq("realty_consultant", personId);
485 555
         queryWrapper.gt("status", CommConstant.MESSAGE_UNREAD);
486
-        IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
487
-        return taRecommendCustomerMapper.selectPage(page,queryWrapper);
556
+        IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
557
+        return taRecommendCustomerMapper.selectPage(page, queryWrapper);
488 558
     }
489 559
 
490 560
     @Override
491
-    public IPage getCustomerList(Integer status,int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList,String sceneType, String startCreateDate, String endCreateDate){
561
+    public IPage getCustomerList(Integer status, int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, String customerType, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, String sceneType, String startCreateDate, String endCreateDate, String sharePersonName, Integer belongStatus) {
492 562
 
493 563
         if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
494 564
             // 公客
495
-            IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
565
+            IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
496 566
             // 公客就不用 buildingId 进行查询
497
-            return taRecommendCustomerMapper.getPublicCustomerList(page,name, tel,  entryType, verifyStatus, sex, orgId,consultTel,sceneType, taPersonBuildingList,building, startCreateDate, endCreateDate);
567
+            return taRecommendCustomerMapper.getPublicCustomerList(page, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, taPersonBuildingList, building, startCreateDate, endCreateDate, sharePersonName, belongStatus);
498 568
         } else {
499 569
             // 私客
500
-            IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
501
-            return taRecommendCustomerMapper.getCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,taPersonBuildingList,sceneType, startCreateDate, endCreateDate);
570
+            IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
571
+            return taRecommendCustomerMapper.getCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, status, taPersonBuildingList, sceneType, startCreateDate, endCreateDate, sharePersonName);
502 572
         }
503 573
 
504 574
     }
505 575
 
506 576
     @Override
507
-    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel, Integer orgId){
508
-        IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
509
-        return taRecommendCustomerMapper.getIndependentAgents(page,name,tel, orgId);
577
+    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, Integer orgId) {
578
+        IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
579
+        return taRecommendCustomerMapper.getIndependentAgents(page, name, tel, orgId);
510 580
     }
511 581
 
512 582
     @Override
513
-    public IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList){
514
-        IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
515
-        return taRecommendCustomerMapper.getRecCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex, orgId,taPersonBuildingList);
583
+    public IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
584
+        IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
585
+        return taRecommendCustomerMapper.getRecCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, taPersonBuildingList);
516 586
     }
517 587
 
518 588
 
519 589
     @Override
520
-    public IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList){
521
-        IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
522
-        return taRecommendCustomerMapper.getRepCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex, orgId,taPersonBuildingList);
590
+    public IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
591
+        IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
592
+        return taRecommendCustomerMapper.getRepCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, taPersonBuildingList);
523 593
     }
524 594
 
525 595
     @Override
526
-    public TaRecommendCustomer getCustomerById(String customerId){
596
+    public TaRecommendCustomer getCustomerById(String customerId) {
527 597
         return taRecommendCustomerMapper.getCustomerById(customerId);
528 598
     }
529 599
 
530 600
 
531 601
     @Override
532
-    public TaRecommendCustomer getCustomerDetail(String customerId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId){
602
+    public TaRecommendCustomer getCustomerDetail(String customerId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId) {
533 603
         String personId = taRecommendCustomerMapper.getCustomerById(customerId).getPersonId();
534
-        TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.getCustomerDetail(customerId,personId);
604
+        TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.getCustomerDetail(customerId, personId);
535 605
         TaPerson person = taPersonMapper.selectById(personId);
536
-        if(!StringUtils.isEmpty(personId)){
537
-            IPage<TaPersonVisitRecord>page = new Page<>(pageNumber,pageSize);
538
-            IPage<TaPersonVisitRecord> taPersonVisitRecordIPage = taPersonVisitRecordMapper.visitRecordByPersonId(page,personId,taPersonBuildingList,buildingId);
606
+        if (!StringUtils.isEmpty(personId)) {
607
+            IPage<TaPersonVisitRecord> page = new Page<>(pageNumber, pageSize);
608
+            IPage<TaPersonVisitRecord> taPersonVisitRecordIPage = taPersonVisitRecordMapper.visitRecordByPersonId(page, personId, taPersonBuildingList, buildingId);
539 609
             List<TaPersonVisitRecord> records = taPersonVisitRecordIPage.getRecords();
540 610
             records.forEach(e -> {
541 611
                 //获取活动标题
542
-                if ("activity".equals(e.getEventType()) && null != e.getTargetId()){
612
+                if ("activity".equals(e.getEventType()) && null != e.getTargetId()) {
543 613
                     TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
544
-                    if (null != taBuildingDynamic){
614
+                    if (null != taBuildingDynamic) {
545 615
                         e.setActivityName(taBuildingDynamic.getTitle());
546 616
                     }
547 617
 
548 618
                 }
549 619
                 //获取拼团标题
550
-                if ("group".equals(e.getEventType()) && null != e.getTargetId()){
620
+                if ("group".equals(e.getEventType()) && null != e.getTargetId()) {
551 621
                     TaShareActivity taShareActivity = taShareActivityMapper.selectById(e.getTargetId());
552
-                    if (null != taShareActivity){
622
+                    if (null != taShareActivity) {
553 623
                         e.setActivityName(taShareActivity.getActivityName());
554 624
                     }
555 625
                 }
556 626
                 //获取助力标题
557
-                if ("help".equals(e.getEventType()) && null != e.getTargetId()){
627
+                if ("help".equals(e.getEventType()) && null != e.getTargetId()) {
558 628
                     HelpActivity helpActivity = helpActivityMapper.selectById(e.getTargetId());
559
-                    if (null != helpActivity){
629
+                    if (null != helpActivity) {
560 630
                         e.setActivityName(helpActivity.getTitle());
561 631
                     }
562 632
                 }
563 633
                 //获取咨询标题
564
-                if ("news".equals(e.getEventType()) && null != e.getTargetId()){
634
+                if ("news".equals(e.getEventType()) && null != e.getTargetId()) {
565 635
                     TaNews taNews = taNewsMapper.selectById(e.getTargetId());
566
-                    if (null != taNews){
636
+                    if (null != taNews) {
567 637
                         e.setActivityName(taNews.getNewsName());
568 638
                     }
569 639
                 }
570 640
                 //获取H5活动标题
571
-                if ("h5".equals(e.getEventType()) && null != e.getTargetId()){
641
+                if ("h5".equals(e.getEventType()) && null != e.getTargetId()) {
572 642
                     TaDrainage taDrainage = taDrainageMapper.selectById(e.getTargetId());
573
-                    if (null != taDrainage){
643
+                    if (null != taDrainage) {
574 644
                         e.setActivityName(taDrainage.getName());
575 645
                     }
576 646
                 }
@@ -578,19 +648,19 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
578 648
             taPersonVisitRecordIPage.setRecords(records);
579 649
             taRecommendCustomer.setVisitRecords(taPersonVisitRecordIPage);
580 650
             taRecommendCustomer.setVisitTimes(taPersonVisitRecordIPage.getRecords().size());
581
-            taRecommendCustomer.setIntentions(taRecommendCustomerMapper.getCustomerIntentions(personId,taPersonBuildingList));
651
+            taRecommendCustomer.setIntentions(taRecommendCustomerMapper.getCustomerIntentions(personId, taPersonBuildingList));
582 652
         }
583
-        if(!StringUtils.isEmpty(taRecommendCustomer.getRealtyConsultant())){
584
-            TaPerson consultant =  taPersonMapper.getById(taRecommendCustomer.getRealtyConsultant());
653
+        if (!StringUtils.isEmpty(taRecommendCustomer.getRealtyConsultant())) {
654
+            TaPerson consultant = taPersonMapper.getById(taRecommendCustomer.getRealtyConsultant());
585 655
             TaUser user = new TaUser();
586
-            if(null == consultant){
656
+            if (null == consultant) {
587 657
                 user = userService.getById(taRecommendCustomer.getRealtyConsultant());
588
-            }else {
658
+            } else {
589 659
                 user = userService.getById(consultant.getUserId());
590 660
             }
591
-            if (null != user){
661
+            if (null != user) {
592 662
                 List<String> projects = taPersonMapper.getUserProjects(user.getUserId());
593
-                if (projects.size()>0){
663
+                if (projects.size() > 0) {
594 664
                     user.setProjects(projects);
595 665
                 }
596 666
                 taRecommendCustomer.setConsultant(user);
@@ -598,26 +668,26 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
598 668
         }
599 669
         //构造来源类型
600 670
         taRecommendCustomer.setPersonFrom("");
601
-        if (null != person){
602
-            Map<String,String>geoInfo = new HashMap<>();
603
-            geoInfo.put("provience",person.getProvince());
604
-            geoInfo.put("country",person.getCountry());
671
+        if (null != person) {
672
+            Map<String, String> geoInfo = new HashMap<>();
673
+            geoInfo.put("provience", person.getProvince());
674
+            geoInfo.put("country", person.getCountry());
605 675
             TdCity city = cityMapper.selectById(person.getCity());
606
-            if(null!=city){
607
-                geoInfo.put("city",city.getName());
608
-            }else {
609
-                geoInfo.put("city","未知");
676
+            if (null != city) {
677
+                geoInfo.put("city", city.getName());
678
+            } else {
679
+                geoInfo.put("city", "未知");
610 680
             }
611 681
             taRecommendCustomer.setGeoInfo(geoInfo);
612 682
 
613 683
             QueryWrapper<TaPersonFromRecord> queryWrapper = new QueryWrapper<>();
614
-            queryWrapper.eq("org_id",person.getOrgId());
615
-            queryWrapper.eq("person_id",person.getPersonId());
616
-            queryWrapper.eq("is_first_time",1);
684
+            queryWrapper.eq("org_id", person.getOrgId());
685
+            queryWrapper.eq("person_id", person.getPersonId());
686
+            queryWrapper.eq("is_first_time", 1);
617 687
             List<TaPersonFromRecord> taPersonFromRecords = taPersonFromRecordMapper.selectList(queryWrapper);
618
-            if (taPersonFromRecords.size() > 0){
688
+            if (taPersonFromRecords.size() > 0) {
619 689
                 QueryWrapper<TdWxDict> tdWxDictQueryWrapper = new QueryWrapper<>();
620
-                tdWxDictQueryWrapper.eq("scene_id",taPersonFromRecords.get(0).getSceneId());
690
+                tdWxDictQueryWrapper.eq("scene_id", taPersonFromRecords.get(0).getSceneId());
621 691
                 TdWxDict tdWxDict = tdWxDictMapper.selectOne(tdWxDictQueryWrapper);
622 692
                 taRecommendCustomer.setPersonFrom(null != tdWxDict ? tdWxDict.getSceneAlias() : "");
623 693
             }
@@ -627,46 +697,46 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
627 697
     }
628 698
 
629 699
     @Override
630
-    public TaPerson getPublicCustomerDetail(String personId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId){
700
+    public TaPerson getPublicCustomerDetail(String personId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId) {
631 701
         TaPerson taPerson = taPersonMapper.getById(personId);
632
-        if(!StringUtils.isEmpty(personId)){
633
-            IPage<TaPersonVisitRecord>page = new Page<>(pageNumber,pageSize);
634
-            IPage<TaPersonVisitRecord> taPersonVisitRecordIPage = taPersonVisitRecordMapper.visitRecordByPersonId(page,personId,taPersonBuildingList,buildingId);
702
+        if (!StringUtils.isEmpty(personId)) {
703
+            IPage<TaPersonVisitRecord> page = new Page<>(pageNumber, pageSize);
704
+            IPage<TaPersonVisitRecord> taPersonVisitRecordIPage = taPersonVisitRecordMapper.visitRecordByPersonId(page, personId, taPersonBuildingList, buildingId);
635 705
             List<TaPersonVisitRecord> records = taPersonVisitRecordIPage.getRecords();
636 706
             records.forEach(e -> {
637 707
                 //获取活动标题
638
-                if ("activity".equals(e.getEventType()) && null != e.getTargetId()){
708
+                if ("activity".equals(e.getEventType()) && null != e.getTargetId()) {
639 709
                     TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
640
-                    if (null != taBuildingDynamic){
710
+                    if (null != taBuildingDynamic) {
641 711
                         e.setActivityName(taBuildingDynamic.getTitle());
642 712
                     }
643 713
 
644 714
                 }
645 715
                 //获取拼团标题
646
-                if ("group".equals(e.getEventType()) && null != e.getTargetId()){
716
+                if ("group".equals(e.getEventType()) && null != e.getTargetId()) {
647 717
                     TaShareActivity taShareActivity = taShareActivityMapper.selectById(e.getTargetId());
648
-                    if (null != taShareActivity){
718
+                    if (null != taShareActivity) {
649 719
                         e.setActivityName(taShareActivity.getActivityName());
650 720
                     }
651 721
                 }
652 722
                 //获取助力标题
653
-                if ("help".equals(e.getEventType()) && null != e.getTargetId()){
723
+                if ("help".equals(e.getEventType()) && null != e.getTargetId()) {
654 724
                     HelpActivity helpActivity = helpActivityMapper.selectById(e.getTargetId());
655
-                    if (null != helpActivity){
725
+                    if (null != helpActivity) {
656 726
                         e.setActivityName(helpActivity.getTitle());
657 727
                     }
658 728
                 }
659 729
                 //获取咨询标题
660
-                if ("news".equals(e.getEventType()) && null != e.getTargetId()){
730
+                if ("news".equals(e.getEventType()) && null != e.getTargetId()) {
661 731
                     TaNews taNews = taNewsMapper.selectById(e.getTargetId());
662
-                    if (null != taNews){
732
+                    if (null != taNews) {
663 733
                         e.setActivityName(taNews.getNewsName());
664 734
                     }
665 735
                 }
666 736
                 //获取H5活动标题
667
-                if ("h5".equals(e.getEventType()) && null != e.getTargetId()){
737
+                if ("h5".equals(e.getEventType()) && null != e.getTargetId()) {
668 738
                     TaDrainage taDrainage = taDrainageMapper.selectById(e.getTargetId());
669
-                    if (null != taDrainage){
739
+                    if (null != taDrainage) {
670 740
                         e.setActivityName(taDrainage.getName());
671 741
                     }
672 742
                 }
@@ -674,25 +744,25 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
674 744
             taPersonVisitRecordIPage.setRecords(records);
675 745
             taPerson.setVisitRecords(taPersonVisitRecordIPage);
676 746
             taPerson.setVisitTimes(taPersonVisitRecordIPage.getRecords().size());
677
-            taPerson.setIntentions(taRecommendCustomerMapper.getCustomerIntentions(personId,taPersonBuildingList));
747
+            taPerson.setIntentions(taRecommendCustomerMapper.getCustomerIntentions(personId, taPersonBuildingList));
678 748
             taPerson.setDuration(taPersonVisitRecordMapper.getDurationByPersonId(personId));
679 749
             taPerson.setVisitTime(taPersonVisitRecordMapper.getFirstVisitTimeByPersonId(personId));
680 750
             TdCity city = cityMapper.selectById(taPerson.getCity());
681
-            if(null != city){
751
+            if (null != city) {
682 752
                 taPerson.setCity(city.getName());
683 753
             }
684 754
 
685 755
             //构造来源类型
686 756
             taPerson.setPersonFrom("");
687
-            if (null != taPerson){
757
+            if (null != taPerson) {
688 758
                 QueryWrapper<TaPersonFromRecord> queryWrapper = new QueryWrapper<>();
689
-                queryWrapper.eq("org_id",taPerson.getOrgId());
690
-                queryWrapper.eq("person_id",taPerson.getPersonId());
691
-                queryWrapper.eq("is_first_time",1);
759
+                queryWrapper.eq("org_id", taPerson.getOrgId());
760
+                queryWrapper.eq("person_id", taPerson.getPersonId());
761
+                queryWrapper.eq("is_first_time", 1);
692 762
                 List<TaPersonFromRecord> taPersonFromRecords = taPersonFromRecordMapper.selectList(queryWrapper);
693
-                if (taPersonFromRecords.size() > 0){
763
+                if (taPersonFromRecords.size() > 0) {
694 764
                     QueryWrapper<TdWxDict> tdWxDictQueryWrapper = new QueryWrapper<>();
695
-                    tdWxDictQueryWrapper.eq("scene_id",taPersonFromRecords.get(0).getSceneId());
765
+                    tdWxDictQueryWrapper.eq("scene_id", taPersonFromRecords.get(0).getSceneId());
696 766
                     TdWxDict tdWxDict = tdWxDictMapper.selectOne(tdWxDictQueryWrapper);
697 767
                     taPerson.setPersonFrom(null != tdWxDict ? tdWxDict.getSceneAlias() : "");
698 768
                 }
@@ -702,17 +772,17 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
702 772
     }
703 773
 
704 774
     @Override
705
-    public IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,Integer orgId,List<TaPersonBuilding> taPersonBuildingList){
775
+    public IPage<TaRecommendCustomer> getCustomersIRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
706 776
 
707
-        QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
777
+        QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
708 778
         // todo
709 779
         // 此处可能不是 person_id 而是 recommend_person
710
-        IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
780
+        IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
711 781
 //        queryWrapper.eq("recommend_person",customerId);
712 782
 ////        queryWrapper.eq("building_id",building);
713 783
 //        queryWrapper.eq("status", CommConstant.VERIFY_AGREE);
714 784
 //        queryWrapper.eq("org_id", orgId);
715
-        return taRecommendCustomerMapper.getCustomersIRecommended(page,customerId,CommConstant.STATUS_NORMAL,orgId,taPersonBuildingList);
785
+        return taRecommendCustomerMapper.getCustomersIRecommended(page, customerId, CommConstant.STATUS_NORMAL, orgId, taPersonBuildingList);
716 786
     }
717 787
 
718 788
     @Override
@@ -754,8 +824,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
754 824
 
755 825
     @Override
756 826
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
757
-        if (CollectionUtils.isNotEmpty(taUser.getPersonIds())){
758
-            for (TaPerson taPerson : taUser.getPersonIds()){
827
+        if (CollectionUtils.isNotEmpty(taUser.getPersonIds())) {
828
+            for (TaPerson taPerson : taUser.getPersonIds()) {
759 829
                 consultantAssist(taUser, taPerson.getPersonId(), orgId);
760 830
             }
761 831
         }
@@ -834,24 +904,24 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
834 904
 
835 905
 
836 906
     @Override
837
-    public List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList) {
838
-        return taRecommendCustomerMapper.getRecCustomerExport(orgId, pageCode, pageSize,taPersonBuildingList);
907
+    public List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList) {
908
+        return taRecommendCustomerMapper.getRecCustomerExport(orgId, pageCode, pageSize, taPersonBuildingList);
839 909
     }
840 910
 
841 911
     @Override
842
-    public Integer getRecCustomerExportCount(Integer orgId,List<TaPersonBuilding> taPersonBuildingList) {
843
-        return taRecommendCustomerMapper.getRecCustomerExportCount(orgId,taPersonBuildingList);
912
+    public Integer getRecCustomerExportCount(Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
913
+        return taRecommendCustomerMapper.getRecCustomerExportCount(orgId, taPersonBuildingList);
844 914
     }
845 915
 
846 916
 
847 917
     @Override
848
-    public Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex,Integer orgId,List<TaPersonBuilding> taPersonBuildingList) {
849
-        return taRecommendCustomerMapper.getRepCustomerReportCount(building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,taPersonBuildingList);
918
+    public Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
919
+        return taRecommendCustomerMapper.getRepCustomerReportCount(building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, taPersonBuildingList);
850 920
     }
851 921
 
852 922
     @Override
853
-    public List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList) {
854
-        return taRecommendCustomerMapper.getRepCustomerReportExport(building, name, tel, consultName, consultTel, entryType,verifyStatus,sex, orgId, pageCode, pageSize,taPersonBuildingList);
923
+    public List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList) {
924
+        return taRecommendCustomerMapper.getRepCustomerReportExport(building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, pageCode, pageSize, taPersonBuildingList);
855 925
     }
856 926
 
857 927
 
@@ -864,7 +934,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
864 934
     public List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize) {
865 935
         return taRecommendCustomerMapper.getIndependentAgentsExport(orgId, pageCode, pageSize);
866 936
     }
867
-    
937
+
868 938
     /**
869 939
      * 查询我的客户人数集合
870 940
      *
@@ -877,12 +947,12 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
877 947
         if (null == taPersons || taPersons.size() != 1) {
878 948
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
879 949
         }
880
-    
950
+
881 951
         TaPerson taPerson = taPersons.get(0);
882
-        Map<String,Object> map = taRecommendCustomerMapper.getMyCustStatistics(taPerson.getPersonId(),taPerson.getUserId(),taPerson.getOrgId());
952
+        Map<String, Object> map = taRecommendCustomerMapper.getMyCustStatistics(taPerson.getPersonId(), taPerson.getUserId(), taPerson.getOrgId());
883 953
         return ResponseBean.success(map);
884 954
     }
885
-    
955
+
886 956
     /**
887 957
      * 分页查询我的跟进客户集合
888 958
      *
@@ -904,18 +974,18 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
904 974
         if (null == taPersons || taPersons.size() != 1) {
905 975
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
906 976
         }
907
-    
977
+
908 978
         TaPerson taPerson = taPersons.get(0);
909
-        
979
+
910 980
         IPage<TaRecommendCustomer> page = new Page<>();
911 981
         page.setCurrent(pageNumber);
912 982
         page.setSize(pageSize);
913
-        
983
+
914 984
         //分页获取跟进客户status != 4的为跟进客户, status = 4的为成交客户 根据type区分  follow 跟进  clinch 成交
915
-        IPage<TaRecommendCustomer> result = taRecommendCustomerMapper.getMyCustFollowOrClinch(page, taPerson.getPersonId(),taPerson.getUserId(),taPerson.getOrgId(), type,name,phone,status,startReportDate,endReportDate,startArrivalDate,endArrivalDate);
985
+        IPage<TaRecommendCustomer> result = taRecommendCustomerMapper.getMyCustFollowOrClinch(page, taPerson.getPersonId(), taPerson.getUserId(), taPerson.getOrgId(), type, name, phone, status, startReportDate, endReportDate, startArrivalDate, endArrivalDate);
916 986
         return ResponseBean.success(result);
917 987
     }
918
-    
988
+
919 989
     /**
920 990
      * 获取盘客工具下我的客户详情
921 991
      *
@@ -929,14 +999,14 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
929 999
         if (null == taPersons || taPersons.size() != 1) {
930 1000
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
931 1001
         }
932
-    
1002
+
933 1003
         TaPerson taPerson = taPersons.get(0);
934 1004
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.getMyCustDetailById(customerId);
935 1005
         //添加跟进行为
936
-        addCustomerFpllowUp(taPerson,taRecommendCustomer,"查看客户详情");
1006
+        addCustomerFpllowUp(taPerson, taRecommendCustomer, "查看客户详情");
937 1007
         return ResponseBean.success(taRecommendCustomer);
938 1008
     }
939
-    
1009
+
940 1010
     /**
941 1011
      * 更新我的客户基本信息
942 1012
      *
@@ -950,16 +1020,16 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
950 1020
         if (null == taPersons || taPersons.size() != 1) {
951 1021
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
952 1022
         }
953
-    
1023
+
954 1024
         TaPerson taPerson = taPersons.get(0);
955 1025
         taRecommendCustomerMapper.updateById(taRecommendCustomer);
956 1026
         //添加跟进行为
957
-        addCustomerFpllowUp(taPerson,taRecommendCustomer,"编辑客户信息");
1027
+        addCustomerFpllowUp(taPerson, taRecommendCustomer, "编辑客户信息");
958 1028
         return ResponseBean.success(taRecommendCustomer);
959 1029
     }
960
-    
1030
+
961 1031
     //添加跟进行为
962
-    private void addCustomerFpllowUp(TaPerson taPerson,TaRecommendCustomer taRecommendCustomer,String recordType) {
1032
+    private void addCustomerFpllowUp(TaPerson taPerson, TaRecommendCustomer taRecommendCustomer, String recordType) {
963 1033
         TaCustomerFollowUpRecord taCustomerFollowUpRecord = new TaCustomerFollowUpRecord();
964 1034
         taCustomerFollowUpRecord.setOrgId(taPerson.getOrgId());
965 1035
         taCustomerFollowUpRecord.setCreateDate(LocalDateTime.now());

+ 3
- 3
src/main/java/com/huiju/estateagents/service/impl/TaShareServiceImpl.java Прегледај датотеку

@@ -71,7 +71,6 @@ public class TaShareServiceImpl extends ServiceImpl<TaShareMapper, TaShare> impl
71 71
             taBuildingDynamicQuery.eq("dynamic_id",id);
72 72
             TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectOne(taBuildingDynamicQuery);
73 73
             taBuildingDynamicMapper.updateById( taBuildingDynamic.setShareNum(taBuildingDynamic.getShareNum() == null ? 1:taBuildingDynamic.getShareNum()+1));
74
-//            return ResponseBean.success("成功");
75 74
         }
76 75
 
77 76
         TaShareCount taShareCount = new TaShareCount();
@@ -79,6 +78,7 @@ public class TaShareServiceImpl extends ServiceImpl<TaShareMapper, TaShare> impl
79 78
         taShareCount.setCreateDate(LocalDateTime.now());
80 79
         taShareCount.setPersonId(taPerson.getPersonId());
81 80
         taShareCount.setTagertType(typeOf);
81
+        taShareCount.setOrgId(taPerson.getOrgId());
82 82
         int countRow = taShareCountMapper.insert(taShareCount);
83 83
         if (countRow < 1) {
84 84
             return ResponseBean.error("分享增加失败", ResponseBean.ERROR_UNAVAILABLE);
@@ -215,8 +215,8 @@ public class TaShareServiceImpl extends ServiceImpl<TaShareMapper, TaShare> impl
215 215
     }
216 216
 
217 217
     @Override
218
-    public List<Map<String, Object>> statTopShare(Integer orgId, String targetType, String targetId, Integer top) {
219
-        return taShareMapper.statTopShare(orgId, targetType, targetId, top);
218
+    public List<Map<String, Object>> statTopShare(Integer orgId, String targetType, String targetId, Integer top, String beginDate, String endDate) {
219
+        return taShareMapper.statTopShare(orgId, targetType, targetId, top, beginDate, endDate);
220 220
     }
221 221
 
222 222
     List<TaPerson> getPersonsByOpenId(String openid) {

+ 4
- 3
src/main/java/com/huiju/estateagents/service/impl/TaUvServiceImpl.java Прегледај датотеку

@@ -44,6 +44,10 @@ public class TaUvServiceImpl extends ServiceImpl<TaUvMapper, TaUv> implements IT
44 44
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
45 45
         }
46 46
 
47
+        if (typeOf.equals(CommConstant.FAVOR_PROJECT)) {
48
+            buildingMapper.setFieldNum(id,"pv_num",1);
49
+        }
50
+
47 51
         TaPerson taPerson = persons.get(0);
48 52
 
49 53
         QueryWrapper<TaUv> queryWrapper = new QueryWrapper<>();
@@ -83,9 +87,6 @@ public class TaUvServiceImpl extends ServiceImpl<TaUvMapper, TaUv> implements IT
83 87
         if (typeOf.equals(CommConstant.FAVOR_CONSULTANT)) {
84 88
             taPersonMapper.setFieldIncrement(id,"hot_num", 1);
85 89
         }
86
-        if (typeOf.equals(CommConstant.FAVOR_PROJECT)) {
87
-            buildingMapper.setFieldNum(id,"pv_num",1);
88
-        }
89 90
 
90 91
         return ResponseBean.success("");
91 92
     }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java Прегледај датотеку

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.huiju.estateagents.common.CommConstant;
7 7
 import com.huiju.estateagents.entity.TaPersonPositon;
8 8
 import com.huiju.estateagents.entity.TdCity;
9
-import com.huiju.estateagents.mapper.TaOrgCityMapper;
10 9
 import com.huiju.estateagents.mapper.TdCityMapper;
11 10
 import com.huiju.estateagents.service.ITdCityService;
12 11
 import org.apache.commons.lang3.StringUtils;
@@ -91,6 +90,7 @@ public class TdCityServiceImpl extends ServiceImpl<TdCityMapper, TdCity> impleme
91 90
                         record.setDistrict(addressComponent.getString("district"));
92 91
                         record.setAddress(address);
93 92
                         record.setCreateTime(LocalDateTime.now());
93
+                        record.setOrgId(orgId);
94 94
                         Integer positionResult = taPersonService.savePersonPosition(record);
95 95
                         logger.info("保存用户位置信息返回:{}", positionResult);
96 96
                     } catch (Exception e) {

+ 41
- 0
src/main/java/com/huiju/estateagents/service/impl/TsActivityDailyServiceImpl.java Прегледај датотеку

@@ -0,0 +1,41 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.common.StringUtils;
5
+import com.huiju.estateagents.entity.TsActivityDaily;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+import com.huiju.estateagents.mapper.TsActivityDailyMapper;
8
+import com.huiju.estateagents.service.ITsActivityDailyService;
9
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.util.List;
14
+
15
+/**
16
+ * <p>
17
+ * 活动统计  服务实现类
18
+ * </p>
19
+ *
20
+ * @author yansen
21
+ * @since 2020-04-20
22
+ */
23
+@Service
24
+public class TsActivityDailyServiceImpl extends ServiceImpl<TsActivityDailyMapper, TsActivityDaily> implements ITsActivityDailyService {
25
+    @Autowired
26
+    private TsActivityDailyMapper tsActivityDailyMapper;
27
+
28
+    @Override
29
+    public List<TsActivityDaily> getActivityDetail(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId, String targetName, String asc, String desc) {
30
+        if (StringUtils.isEmpty(asc) && StringUtils.isEmpty(desc)) {
31
+            asc = "statis_date";
32
+        }
33
+
34
+        return tsActivityDailyMapper.getActivityDetail(orgId, startDate, endDate, buildingId, targetType, targetId, targetName, asc, desc);
35
+    }
36
+
37
+    @Override
38
+    public List<ActivityDailyExport> getActivityExport(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId) {
39
+        return tsActivityDailyMapper.getActivityExport(orgId, startDate, endDate, buildingId, targetType, targetId);
40
+    }
41
+}

+ 159
- 0
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java Прегледај датотеку

@@ -0,0 +1,159 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.center.taUser.entity.TaUser;
7
+import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
8
+import com.huiju.estateagents.common.StringUtils;
9
+import com.huiju.estateagents.entity.*;
10
+import com.huiju.estateagents.excel.ConsultantKPIExport;
11
+import com.huiju.estateagents.mapper.TaPersonMapper;
12
+import com.huiju.estateagents.mapper.TaRecommendCustomerMapper;
13
+import com.huiju.estateagents.mapper.TsConsultantKpiMapper;
14
+import com.huiju.estateagents.service.ITsConsultantKpiService;
15
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.stereotype.Service;
18
+
19
+import java.time.LocalDateTime;
20
+import java.util.ArrayList;
21
+import java.util.List;
22
+
23
+/**
24
+ * <p>
25
+ * 置业顾问KPI  服务实现类
26
+ * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2020-04-14
30
+ */
31
+@Service
32
+public class TsConsultantKpiServiceImpl extends ServiceImpl<TsConsultantKpiMapper, TsConsultantKpi> implements ITsConsultantKpiService {
33
+    @Autowired
34
+    TsConsultantKpiMapper tsConsultantKpiMapper;
35
+
36
+    @Autowired
37
+    TaUserMapper taUserMapper;
38
+
39
+    @Autowired
40
+    TaRecommendCustomerMapper taRecommendCustomerMapper;
41
+    
42
+    @Autowired
43
+    private TaPersonMapper taPersonMapper;
44
+
45
+    /**
46
+     * 获取用户授权楼盘
47
+     * 如果 buildingId 参数存在, 则校验参数是否在授权范围内
48
+     *
49
+     * @param userId
50
+     * @param buildingId
51
+     * @return List 长度 0 代表未授权楼盘, null 代表管理员, 不校验楼盘授权
52
+     */
53
+    public List<String> getBuildingListOf(Integer userId, String buildingId) {
54
+        List<String> unAuthrized = new ArrayList<String>() {{
55
+            add("*");   // 构造SQL  building_id in ('*') , 目的是为了阻止检索到数据
56
+        }};
57
+
58
+        TaUser taUser = taUserMapper.selectById(userId);
59
+        if (taUser == null) {
60
+            return unAuthrized;
61
+        }
62
+
63
+        if (null != taUser.getIsAdmin() && taUser.getIsAdmin()) {
64
+            if (!StringUtils.isEmpty(buildingId)) {
65
+                return new ArrayList<String>() {{
66
+                    add(buildingId);
67
+                }};
68
+            }
69
+            return null;
70
+        }
71
+
72
+        List<String> buildings = taUserMapper.getBuildingIdsOf(userId, buildingId);
73
+        return null == buildings || buildings.size() == 0 ? unAuthrized : buildings;
74
+    }
75
+
76
+    @Override
77
+    public IPage<TsConsultantKpi> stsKPIDaily(Integer pageNum, Integer pageSize, Integer orgId, Integer userId, String buildingId, String startDate, String endDate, String asc, String desc) {
78
+        if (StringUtils.isEmpty(asc) && StringUtils.isEmpty(desc)) {
79
+            desc = "new_persons";
80
+        }
81
+
82
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
83
+        IPage<TsConsultantKpi> page = new Page<>(pageNum, pageSize);
84
+        return tsConsultantKpiMapper.stsKPIDaily(page, orgId, buildingIds, startDate, endDate, asc, desc);
85
+    }
86
+
87
+    @Override
88
+    public TsConsultantKpi stsKPITotalByOrg(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
89
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
90
+
91
+        // 合计数据, 但是不包含 客户总计 列
92
+        TsConsultantKpi result = tsConsultantKpiMapper.stsKPITotalByOrg(orgId, buildingIds, startDate, endDate);
93
+
94
+        // 统计当前时间段内的已经固化的置业的客户
95
+        Integer totalPersons = tsConsultantKpiMapper.stsAllCustomersByOrg(orgId, buildingIds, startDate, endDate);
96
+        result.setTotalPersons(totalPersons);
97
+
98
+        return result;
99
+    }
100
+
101
+    @Override
102
+    public List<ConsultantKPIExport> stsKPIDailyExport(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
103
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
104
+        return tsConsultantKpiMapper.stsKPIDailyExport(orgId, buildingIds, startDate, endDate);
105
+    }
106
+
107
+    @Override
108
+    public IPage<TaRecommendCustomer> getCustomerListOfConsultant(IPage<TaRecommendCustomer> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
109
+        String personId = null;
110
+        TaPerson taPerson = taPersonMapper.selectOne(new QueryWrapper<TaPerson>().eq("user_id", userId).eq("org_id", orgId));
111
+        if (null != taPerson){
112
+            personId = taPerson.getPersonId();
113
+        }
114
+        return taRecommendCustomerMapper.getCustomerListOfConsultant(page, orgId, userId, buildingId, startDate, endDate, personId);
115
+    }
116
+
117
+    @Override
118
+    public IPage<TaPerson> getConsultantShareCustomers(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
119
+        return tsConsultantKpiMapper.getConsultantShareCustomers(page, orgId, userId, buildingId, startDate, endDate);
120
+    }
121
+
122
+    @Override
123
+    public IPage<TaPerson> getConsultantHomePagePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
124
+        return tsConsultantKpiMapper.getConsultantHomePagePersons(page, orgId, userId, buildingId, startDate, endDate);
125
+    }
126
+
127
+    @Override
128
+    public IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String personId) {
129
+        return tsConsultantKpiMapper.getConsultantHomePageTimes(page, orgId, userId, buildingId, startDate, endDate, personId);
130
+    }
131
+
132
+    @Override
133
+    public IPage<TaPerson> getConsultantChatPersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
134
+        // buildingId 在聊天表不存在, 因此没有用到这个字段
135
+        return tsConsultantKpiMapper.getConsultantChatPersons(page, orgId, userId, buildingId, startDate, endDate);
136
+    }
137
+
138
+    @Override
139
+    public IPage<TaPerson> getConsultantFavor(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
140
+        // buildingId 在点赞表不存在, 因此没有用到这个字段
141
+        return tsConsultantKpiMapper.getConsultantFavor(page, orgId, userId, buildingId, startDate, endDate);
142
+    }
143
+
144
+    @Override
145
+    public IPage<TaPerson> getConsultantShareTargets(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName) {
146
+        return tsConsultantKpiMapper.getConsultantShareTargets(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName);
147
+    }
148
+
149
+    @Override
150
+    public IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
151
+        return tsConsultantKpiMapper.getConsultantSharePersons(page, orgId, userId, buildingId, startDate, endDate);
152
+    }
153
+
154
+    @Override
155
+    public IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName, String userName, String personId) {
156
+        return tsConsultantKpiMapper.getConsultantShareTimes(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName, userName, personId);
157
+    }
158
+
159
+}

+ 373
- 0
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java Прегледај датотеку

@@ -0,0 +1,373 @@
1
+package com.huiju.estateagents.statistic.controller;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.excel.ActivityStatistics.*;
9
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
10
+import com.huiju.estateagents.statistic.service.impl.TaActivityStaticServiceImpl;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.format.annotation.DateTimeFormat;
13
+import org.springframework.web.bind.annotation.GetMapping;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestParam;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import javax.servlet.http.HttpServletRequest;
19
+import javax.servlet.http.HttpServletResponse;
20
+import java.io.IOException;
21
+import java.time.LocalDate;
22
+import java.time.LocalDateTime;
23
+import java.util.List;
24
+
25
+@RestController
26
+@RequestMapping("/api")
27
+public class ActivityStatisticController extends BaseController {
28
+
29
+    @Autowired
30
+    private TaActivityStaticServiceImpl taActivityStaticService;
31
+
32
+    @GetMapping(value = "/admin/activityStatistical/total")
33
+    public ResponseBean indexStatistical(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
34
+                                         @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
35
+                                         @RequestParam(value = "buildingId", required = false)String buildingId,
36
+                                         @RequestParam(value = "targetType", required = false)String targetType,
37
+                                         HttpServletRequest request) {
38
+        return taActivityStaticService.activityStatistical(startDate, endDate, buildingId, targetType, getOrgId(request), getTaPersonBuildingListByUserId(request), getUserId(request));
39
+    }
40
+
41
+    /**
42
+     * 活动趋势人数
43
+     * @return
44
+     */
45
+    @GetMapping(value = "/admin/activityStatistical/selectAllActivityUser")
46
+    public ResponseBean selectNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
47
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
48
+                                            @RequestParam(value = "buildingId", required = false)String buildingId,
49
+                                            @RequestParam(value = "targetType", required = false)String targetType,
50
+                                            HttpServletRequest request) {
51
+        return taActivityStaticService.selectAllActivityUser(getOrgId(request), startDate, endDate, buildingId, targetType, getTaPersonBuildingListByUserId(request), getUserId(request));
52
+    }
53
+
54
+    /**
55
+     * 活动表格统计人数
56
+     * @return
57
+     */
58
+    @GetMapping(value = "/admin/activityStatistical/selectTableData")
59
+    public ResponseBean selectTableData(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
60
+                                            @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
61
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
62
+                                            @RequestParam(value = "buildingId", required = false)String buildingId,
63
+                                            @RequestParam(value = "targetType", required = false)String targetType,
64
+                                            @RequestParam(value = "sort", required = false)String sort,
65
+                                            @RequestParam(value = "colKey", required = false)String colKey,
66
+                                            HttpServletRequest request) {
67
+        return taActivityStaticService.selectTableData(pageNum, pageSize, getOrgId(request), startDate, endDate, buildingId, targetType, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
68
+    }
69
+
70
+    /**
71
+     * 活动表格统计人数导出
72
+     * @return
73
+     */
74
+    @GetMapping(value = "/admin/activityStatistical/tableDataExport")
75
+    public void selectTableDataExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
76
+                                        @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
77
+                                        @RequestParam(value = "buildingId", required = false)String buildingId,
78
+                                        @RequestParam(value = "targetType", required = false)String targetType,
79
+                                        @RequestParam(value = "sort", required = false)String sort,
80
+                                        @RequestParam(value = "colKey", required = false)String colKey,
81
+                                        HttpServletRequest request, HttpServletResponse response) throws IOException {
82
+        response.setContentType("application/octet-stream");
83
+        response.setCharacterEncoding("utf-8");
84
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
85
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatisicAttractUser.class).registerWriteHandler(new CustomCellWriteHandler()).build();
86
+        // 设置 sheet, 同一个sheet只需要设置一次
87
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
88
+        List<StatisicAttractUser> data = taActivityStaticService.selectExportTableData(getOrgId(request), startDate, endDate, buildingId, targetType, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
89
+        excelWriter.write(data, writeSheet);
90
+        // finish 会帮忙关闭流
91
+        excelWriter.finish();
92
+    }
93
+
94
+    /**
95
+     * 活动表格统计人数
96
+     * @return
97
+     */
98
+    @GetMapping(value = "/admin/activityStatistical/activityStatisDetail")
99
+    public ResponseBean selectActivityStatisDetail(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
100
+                                        @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
101
+                                        @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
102
+                                        @RequestParam(value = "buildingId", required = false)String buildingId,
103
+                                        @RequestParam(value = "targetType", required = false)String targetType,
104
+                                        @RequestParam(value = "activityName", required = false)String activityName,
105
+                                        @RequestParam(value = "sort", required = false)String sort,
106
+                                        @RequestParam(value = "colKey", required = false)String colKey,
107
+                                        HttpServletRequest request) {
108
+        return taActivityStaticService.selectActivityStatisDetail(pageNum, pageSize, getOrgId(request), startDate, endDate, buildingId, targetType, activityName, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
109
+    }
110
+
111
+    /**
112
+     * 活动表格统计人数导出
113
+     * @return
114
+     */
115
+    @GetMapping(value = "/admin/activityStatistical/activityDetailTableDataExport")
116
+    public void activityDetailTableDataExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
117
+                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
118
+                                @RequestParam(value = "buildingId", required = false)String buildingId,
119
+                                @RequestParam(value = "targetType", required = false)String targetType,
120
+                                @RequestParam(value = "activityName", required = false)String activityName,
121
+                                @RequestParam(value = "sort", required = false)String sort,
122
+                                @RequestParam(value = "colKey", required = false)String colKey,
123
+                                HttpServletRequest request, HttpServletResponse response) throws IOException {
124
+        response.setContentType("application/octet-stream");
125
+        response.setCharacterEncoding("utf-8");
126
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
127
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ActivityDetailShareRecord.class).registerWriteHandler(new CustomCellWriteHandler()).build();
128
+        // 设置 sheet, 同一个sheet只需要设置一次
129
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
130
+        List<ActivityDetailShareRecord> data = taActivityStaticService.selectActivityStatisDetailExport(getOrgId(request), startDate, endDate, buildingId, targetType, activityName, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
131
+        excelWriter.write(data, writeSheet);
132
+        // finish 会帮忙关闭流
133
+        excelWriter.finish();
134
+    }
135
+
136
+    /**
137
+     * 分享人数统计
138
+     * @return
139
+     */
140
+    @GetMapping(value = "/admin/activityStatistical/selectActivitySharePersonNum")
141
+    public ResponseBean selectActivitySharePersonNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
142
+                                                   @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
143
+                                                   @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
144
+                                                   @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
145
+                                                   @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
146
+                                                   @RequestParam(value = "sharePersonPhone", required = false)String sharePersonPhone,
147
+                                                   @RequestParam(value = "activityId", required = false)String activityId,
148
+                                                   @RequestParam(value = "activityType", required = false)String activityType,
149
+                                                   @RequestParam(value = "sort", required = false)String sort,
150
+                                                   @RequestParam(value = "colKey", required = false)String colKey,
151
+                                                   @RequestParam(value = "buildingId", required = false)String buildingId,
152
+                                                   HttpServletRequest request) {
153
+        return taActivityStaticService.selectActivitySharePersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePersonPhone, activityId, activityType, buildingId, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
154
+    }
155
+
156
+    /**
157
+     * 分享人数统计导出
158
+     * @return
159
+     */
160
+    @GetMapping(value = "/admin/activityStatistical/activitySharePersonNumExport")
161
+    public void selectActivitySharePersonNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
162
+                                             @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
163
+                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
164
+                                             @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
165
+                                             @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
166
+                                             @RequestParam(value = "sharePhone", required = false)String sharePhone,
167
+                                             @RequestParam(value = "activityId", required = false)String activityId,
168
+                                             @RequestParam(value = "activityType", required = false)String activityType,
169
+                                             @RequestParam(value = "sort", required = false)String sort,
170
+                                             @RequestParam(value = "colKey", required = false)String colKey,
171
+                                             @RequestParam(value = "buildingId", required = false)String buildingId,
172
+                                             HttpServletRequest request, HttpServletResponse response) throws IOException {
173
+        response.setContentType("application/octet-stream");
174
+        response.setCharacterEncoding("utf-8");
175
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
176
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), SharePersonNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
177
+        // 设置 sheet, 同一个sheet只需要设置一次
178
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
179
+        List<SharePersonNum> data = taActivityStaticService.selectActivitySharePersonNumExport(getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, buildingId, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
180
+        excelWriter.write(data, writeSheet);
181
+        // finish 会帮忙关闭流
182
+        excelWriter.finish();
183
+    }
184
+
185
+    /**
186
+     * 分享次数统计
187
+     * @return
188
+     */
189
+    @GetMapping(value = "/admin/activityStatistical/selectActivityShareNum")
190
+    public ResponseBean selectActivityShareNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
191
+                                                     @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
192
+                                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
193
+                                                     @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
194
+                                                     @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
195
+                                                     @RequestParam(value = "sharePersonPhone", required = false)String sharePersonPhone,
196
+                                                     @RequestParam(value = "activityId", required = false)String activityId,
197
+                                                     @RequestParam(value = "activityType", required = false)String activityType,
198
+                                                     @RequestParam(value = "personId", required = false)String personId,
199
+                                                     @RequestParam(value = "buildingId", required = false)String buildingId,
200
+                                                     @RequestParam(value = "sort", required = false)String sort,
201
+                                                     @RequestParam(value = "colKey", required = false)String colKey,
202
+                                                     HttpServletRequest request) {
203
+        return taActivityStaticService.selectActivityShareNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePersonPhone, activityId, activityType, personId, buildingId, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
204
+    }
205
+
206
+    /**
207
+     * 分享次数统计导出
208
+     * @return
209
+     */
210
+    @GetMapping(value = "/admin/activityStatistical/selectActivityShareNumExport")
211
+    public void selectActivityShareNumExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
212
+                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
213
+                                             @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
214
+                                             @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
215
+                                             @RequestParam(value = "sharePhone", required = false)String sharePhone,
216
+                                             @RequestParam(value = "activityId", required = false)String activityId,
217
+                                             @RequestParam(value = "activityType", required = false)String activityType,
218
+                                             @RequestParam(value = "personId", required = false)String personId,
219
+                                             @RequestParam(value = "buildingId", required = false)String buildingId,
220
+                                             @RequestParam(value = "sort", required = false)String sort,
221
+                                             @RequestParam(value = "colKey", required = false)String colKey,
222
+                                             HttpServletRequest request, HttpServletResponse response) throws IOException {
223
+        response.setContentType("application/octet-stream");
224
+        response.setCharacterEncoding("utf-8");
225
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
226
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ShareNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
227
+        // 设置 sheet, 同一个sheet只需要设置一次
228
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
229
+        List<ShareNum> data = taActivityStaticService.selectActivityShareNumExport(getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, buildingId, sort, colKey, getTaPersonBuildingListByUserId(request), getUserId(request));
230
+        excelWriter.write(data, writeSheet);
231
+        // finish 会帮忙关闭流
232
+        excelWriter.finish();
233
+    }
234
+
235
+    /**
236
+     * 注册人数统计
237
+     * @return
238
+     */
239
+    @GetMapping(value = "/admin/activityStatistical/selectActivityAddRegistNum")
240
+    public ResponseBean selectActivityAddRegistNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
241
+                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
242
+                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
243
+                                               @RequestParam(value = "personFrom", required = false)String personFrom,
244
+                                               @RequestParam(value = "activityId", required = false)String activityId,
245
+                                               @RequestParam(value = "activityType", required = false)String activityType,
246
+                                               @RequestParam(value = "buildingId", required = false)String buildingId,
247
+                                               @RequestParam(value = "province", required = false)String province,
248
+                                               HttpServletRequest request) {
249
+        return taActivityStaticService.selectActivityAddRegistNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, province, getTaPersonBuildingListByUserId(request), getUserId(request));
250
+    }
251
+
252
+    /**
253
+     * 注册人数导出
254
+     * @return
255
+     */
256
+    @GetMapping(value = "/admin/activityStatistical/selectActivityAddRegistNumExport")
257
+    public void selectActivityAddRegistNumExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
258
+                                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
259
+                                                               @RequestParam(value = "personFrom", required = false)String personFrom,
260
+                                                               @RequestParam(value = "activityId", required = false)String activityId,
261
+                                                               @RequestParam(value = "activityType", required = false)String activityType,
262
+                                                               @RequestParam(value = "buildingId", required = false)String buildingId,
263
+                                                               @RequestParam(value = "province", required = false)String province,
264
+                                                               HttpServletRequest request, HttpServletResponse response) throws IOException {
265
+        response.setContentType("application/octet-stream");
266
+        response.setCharacterEncoding("utf-8");
267
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
268
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddRegistNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
269
+        // 设置 sheet, 同一个sheet只需要设置一次
270
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
271
+        List<AddRegistNum> data = taActivityStaticService.selectActivityAddRegistNumExport(getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, province, getTaPersonBuildingListByUserId(request), getUserId(request));
272
+        excelWriter.write(data, writeSheet);
273
+        // finish 会帮忙关闭流
274
+        excelWriter.finish();
275
+    }
276
+
277
+    /**
278
+     * 访问次数统计
279
+     * @return
280
+     */
281
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitNum")
282
+    public ResponseBean selectActivityVisitNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
283
+                                                   @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
284
+                                                   @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
285
+                                                   @RequestParam(value = "personFrom", required = false)String personFrom,
286
+                                                   @RequestParam(value = "province", required = false)String province,
287
+                                                   @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
288
+                                                   @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
289
+                                                   @RequestParam(value = "activityId", required = false)String activityId,
290
+                                                   @RequestParam(value = "activityType", required = false)String activityType,
291
+                                                   @RequestParam(value = "personId", required = false)String personId,
292
+                                                   @RequestParam(value = "buildingId", required = false)String buildingId,
293
+                                                   HttpServletRequest request) {
294
+        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId, buildingId);
295
+    }
296
+
297
+    /**
298
+     * 访问次数统计
299
+     * @return
300
+     */
301
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitNumExport")
302
+    public void selectActivityVisitNum(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
303
+                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
304
+                                               @RequestParam(value = "personFrom", required = false)String personFrom,
305
+                                               @RequestParam(value = "province", required = false)String province,
306
+                                               @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
307
+                                               @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
308
+                                               @RequestParam(value = "activityId", required = false)String activityId,
309
+                                               @RequestParam(value = "activityType", required = false)String activityType,
310
+                                               @RequestParam(value = "personId", required = false)String personId,
311
+                                               @RequestParam(value = "buildingId", required = false)String buildingId,
312
+                                               HttpServletRequest request, HttpServletResponse response) throws IOException {
313
+        response.setContentType("application/octet-stream");
314
+        response.setCharacterEncoding("utf-8");
315
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
316
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), VisitNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
317
+        // 设置 sheet, 同一个sheet只需要设置一次
318
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
319
+        List<VisitNum> data = taActivityStaticService.selectActivityVisitNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId, buildingId);
320
+        excelWriter.write(data, writeSheet);
321
+        // finish 会帮忙关闭流
322
+        excelWriter.finish();
323
+    }
324
+
325
+    /**
326
+     * 访问人数统计
327
+     * @return
328
+     */
329
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitPersonNum")
330
+    public ResponseBean selectActivityVisitPersonNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
331
+                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
332
+                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
333
+                                               @RequestParam(value = "personFrom", required = false)String personFrom,
334
+                                               @RequestParam(value = "province", required = false)String province,
335
+                                               @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
336
+                                               @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
337
+                                               @RequestParam(value = "personId", required = false)String personId,
338
+                                               @RequestParam(value = "activityId", required = false)String activityId,
339
+                                               @RequestParam(value = "activityType", required = false)String activityType,
340
+                                               @RequestParam(value = "buildingId", required = false)String buildingId,
341
+                                               HttpServletRequest request) {
342
+        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId);
343
+    }
344
+
345
+    /**
346
+     * 访问人数统计导出
347
+     * @return
348
+     */
349
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitPersonNumExport")
350
+    public void selectActivityVisitPersonNumExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
351
+                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
352
+                                       @RequestParam(value = "personFrom", required = false)String personFrom,
353
+                                       @RequestParam(value = "province", required = false)String province,
354
+                                       @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
355
+                                       @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
356
+                                       @RequestParam(value = "personId", required = false)String personId,
357
+                                       @RequestParam(value = "activityId", required = false)String activityId,
358
+                                       @RequestParam(value = "activityType", required = false)String activityType,
359
+                                       @RequestParam(value = "buildingId", required = false)String buildingId,
360
+                                       HttpServletRequest request, HttpServletResponse response) throws IOException {
361
+        response.setContentType("application/octet-stream");
362
+        response.setCharacterEncoding("utf-8");
363
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
364
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), VisitPersonNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
365
+        // 设置 sheet, 同一个sheet只需要设置一次
366
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
367
+        List<VisitPersonNum> data = taActivityStaticService.selectActivityVisitPersonNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId);
368
+        excelWriter.write(data, writeSheet);
369
+        // finish 会帮忙关闭流
370
+        excelWriter.finish();
371
+    }
372
+
373
+}

+ 19
- 0
src/main/java/com/huiju/estateagents/statistic/entity/TaActivityStatistic.java Прегледај датотеку

@@ -0,0 +1,19 @@
1
+package com.huiju.estateagents.statistic.entity;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import lombok.Data;
5
+
6
+import java.time.LocalDateTime;
7
+
8
+@Data
9
+public class TaActivityStatistic {
10
+
11
+    private String buildingId;
12
+
13
+    private String targetType;
14
+
15
+    private LocalDateTime startDate;
16
+
17
+    private LocalDateTime endDate;
18
+
19
+}

+ 328
- 0
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java Прегледај датотеку

@@ -0,0 +1,328 @@
1
+package com.huiju.estateagents.statistic.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TaPersonBuilding;
5
+import com.huiju.estateagents.excel.ActivityStatistics.*;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.time.LocalDate;
10
+import java.time.LocalDateTime;
11
+import java.util.List;
12
+import java.util.Map;
13
+
14
+@Mapper
15
+public interface TaActicityStaticMapper {
16
+
17
+    Integer selectSharePersonNum(
18
+            @Param("startDate") LocalDateTime startDate,
19
+            @Param("endDate") LocalDateTime endDate,
20
+            @Param("buildingId") String buildingId,
21
+            @Param("targetType") String targetType,
22
+            @Param("orgId") Integer orgId,
23
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
24
+            @Param("userId") Integer userId);
25
+
26
+    Integer selectShareNum(@Param("startDate") LocalDateTime startDate,
27
+                           @Param("endDate") LocalDateTime endDate,
28
+                           @Param("buildingId") String buildingId,
29
+                           @Param("targetType") String targetType,
30
+                           @Param("orgId") Integer orgId,
31
+                           @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
32
+                           @Param("userId") Integer userId);
33
+
34
+    Integer selectVisitPersonNum(@Param("startDate") LocalDateTime startDate,
35
+                                 @Param("endDate") LocalDateTime endDate,
36
+                                 @Param("buildingId") String buildingId,
37
+                                 @Param("targetType") String targetType,
38
+                                 @Param("orgId") Integer orgId,
39
+                                 @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
40
+                                 @Param("userId") Integer userId);
41
+
42
+    Integer selectVisitNum(@Param("startDate") LocalDateTime startDate,
43
+                           @Param("endDate") LocalDateTime endDate,
44
+                           @Param("buildingId") String buildingId,
45
+                           @Param("targetType") String targetType,
46
+                           @Param("orgId") Integer orgId,
47
+                           @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
48
+                           @Param("userId") Integer userId);
49
+
50
+    List<Map<String, Object>> selectShareCount(@Param("orgId") Integer orgId,
51
+                                               @Param("startDate") LocalDateTime startDate,
52
+                                               @Param("endDate") LocalDateTime endDate,
53
+                                               @Param("buildingId") String buildingId,
54
+                                               @Param("targetType") String targetType,
55
+                                               @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
56
+                                               @Param("userId") Integer userId );
57
+
58
+    List<Map<String, Object>> selectSharePersonCount(@Param("orgId") Integer orgId,
59
+                                                     @Param("startDate") LocalDateTime startDate,
60
+                                                     @Param("endDate") LocalDateTime endDate,
61
+                                                     @Param("buildingId") String buildingId,
62
+                                                     @Param("targetType") String targetType,
63
+                                                     @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
64
+                                                     @Param("userId") Integer userId);
65
+
66
+    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId,
67
+                                               @Param("startDate") LocalDateTime startDate,
68
+                                               @Param("endDate") LocalDateTime endDate,
69
+                                               @Param("buildingId") String buildingId,
70
+                                               @Param("targetType") String targetType,
71
+                                               @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
72
+
73
+    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId,
74
+                                                     @Param("startDate") LocalDateTime startDate,
75
+                                                     @Param("endDate") LocalDateTime endDate,
76
+                                                     @Param("buildingId") String buildingId,
77
+                                                     @Param("targetType") String targetType,
78
+                                                     @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
79
+
80
+    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId,
81
+                                                   @Param("startDate") LocalDateTime startDate,
82
+                                                   @Param("endDate") LocalDateTime endDate,
83
+                                                   @Param("buildingId") String buildingId,
84
+                                                   @Param("targetType") String targetType,
85
+                                                   @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
86
+
87
+    IPage<StatisicAttractUser> selectTableData(
88
+            IPage<StatisicAttractUser> attractUserIPage,
89
+            @Param("orgId") Integer orgId,
90
+            @Param("startDate") LocalDateTime startDate,
91
+            @Param("endDate") LocalDateTime endDate,
92
+            @Param("buildingId") String buildingId,
93
+            @Param("targetType") String targetType,
94
+            @Param("sortType") String sortType,
95
+            @Param("colKey") String colKey,
96
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
97
+            @Param("userId") Integer userId );
98
+
99
+    List<StatisicAttractUser> selectExportTableData(
100
+            @Param("orgId") Integer orgId,
101
+            @Param("startDate") LocalDateTime startDate,
102
+            @Param("endDate") LocalDateTime endDate,
103
+            @Param("buildingId") String buildingId,
104
+            @Param("targetType") String targetType,
105
+            @Param("sortType") String sortType,
106
+            @Param("colKey") String colKey,
107
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
108
+            @Param("userId") Integer userId );
109
+
110
+    IPage<ActivityDetailShareRecord> selectActivityStatisDetail(
111
+            IPage<ActivityDetailShareRecord> attractUserIPage,
112
+            @Param("orgId") Integer orgId,
113
+            @Param("startDate") LocalDateTime startDate,
114
+            @Param("endDate") LocalDateTime endDate,
115
+            @Param("buildingId") String buildingId,
116
+            @Param("targetType") String targetType,
117
+            @Param("activityName") String activityName,
118
+            @Param("sortType") String sortType,
119
+            @Param("colKey") String colKey,
120
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
121
+            @Param("userId") Integer userId
122
+    );
123
+
124
+    List<ActivityDetailShareRecord> selectActivityStatisDetailExport(
125
+            @Param("orgId") Integer orgId,
126
+            @Param("startDate") LocalDate startDate,
127
+            @Param("endDate") LocalDate endDate,
128
+            @Param("buildingId") String buildingId,
129
+            @Param("targetType") String targetType,
130
+            @Param("activityName") String activityName,
131
+            @Param("sortType") String sortType,
132
+            @Param("colKey") String colKey,
133
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
134
+            @Param("userId") Integer userId
135
+    );
136
+
137
+    IPage<SharePersonNum> selectActivitySharePersonNum(
138
+            IPage<SharePersonNum> iPage,
139
+            @Param("orgId") Integer orgId,
140
+            @Param("startDate") LocalDateTime startDate,
141
+            @Param("endDate") LocalDateTime endDate,
142
+            @Param("sharePersonType") String sharePersonType,
143
+            @Param("sharePersonName") String sharePersonName,
144
+            @Param("sharePhone") String sharePhone,
145
+            @Param("activityId") String activityId,
146
+            @Param("activityType") String activityType,
147
+            @Param("buildingId") String buildingId,
148
+            @Param("sort") String sort,
149
+            @Param("colKey") String colKey,
150
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
151
+            @Param("userId") Integer userId
152
+    );
153
+
154
+    List<SharePersonNum> selectActivitySharePersonNumExport(
155
+            @Param("orgId") Integer orgId,
156
+            @Param("startDate") LocalDateTime startDate,
157
+            @Param("endDate") LocalDateTime endDate,
158
+            @Param("sharePersonType") String sharePersonType,
159
+            @Param("sharePersonName") String sharePersonName,
160
+            @Param("sharePhone") String sharePhone,
161
+            @Param("activityId") String activityId,
162
+            @Param("activityType") String activityType,
163
+            @Param("buildingId") String buildingId,
164
+            @Param("sort") String sort,
165
+            @Param("colKey") String colKey,
166
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
167
+            @Param("userId") Integer userId
168
+    );
169
+
170
+    IPage<ShareNum> selectActivityShareNum(
171
+            IPage<ShareNum> iPage,
172
+            @Param("orgId") Integer orgId,
173
+            @Param("startDate") LocalDateTime startDate,
174
+            @Param("endDate") LocalDateTime endDate,
175
+            @Param("sharePersonType") String sharePersonType,
176
+            @Param("sharePersonName") String sharePersonName,
177
+            @Param("sharePhone") String sharePhone,
178
+            @Param("activityId") String activityId,
179
+            @Param("activityType") String activityType,
180
+            @Param("personId") String personId,
181
+            @Param("buildingId") String buildingId,
182
+            @Param("sort") String sort,
183
+            @Param("colKey") String colKey,
184
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
185
+            @Param("userId") Integer userId
186
+    );
187
+
188
+    List<ShareNum> selectActivityShareNumExport(
189
+            @Param("orgId") Integer orgId,
190
+            @Param("startDate") LocalDateTime startDate,
191
+            @Param("endDate") LocalDateTime endDate,
192
+            @Param("sharePersonType") String sharePersonType,
193
+            @Param("sharePersonName") String sharePersonName,
194
+            @Param("sharePhone") String sharePhone,
195
+            @Param("activityId") String activityId,
196
+            @Param("activityType") String activityType,
197
+            @Param("personId") String personId,
198
+            @Param("buildingId") String buildingId,
199
+            @Param("sort") String sort,
200
+            @Param("colKey") String colKey,
201
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
202
+            @Param("userId") Integer userId
203
+    );
204
+
205
+    IPage<AddRegistNum> selectActivityAddRegistNum(
206
+            IPage<AddRegistNum> iPage,
207
+            @Param("orgId") Integer orgId,
208
+            @Param("startDate") LocalDateTime startDate,
209
+            @Param("endDate") LocalDateTime endDate,
210
+            @Param("personFrom") String personFrom,
211
+            @Param("activityId") String activityId,
212
+            @Param("activityType") String activityType,
213
+            @Param("buildingId") String buildingId,
214
+            @Param("province") String province,
215
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
216
+            @Param("userId") Integer userId
217
+    );
218
+
219
+    List<AddRegistNum> selectActivityAddRegistNumExport(
220
+            @Param("orgId") Integer orgId,
221
+            @Param("startDate") LocalDateTime startDate,
222
+            @Param("endDate") LocalDateTime endDate,
223
+            @Param("personFrom") String personFrom,
224
+            @Param("activityId") String activityId,
225
+            @Param("activityType") String activityType,
226
+            @Param("buildingId") String buildingId,
227
+            @Param("province") String province,
228
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
229
+            @Param("userId") Integer userId
230
+    );
231
+
232
+    IPage<VisitNum> selectActivityVisitNum(
233
+            IPage<VisitNum> iPage,
234
+            @Param("orgId") Integer orgId,
235
+            @Param("startDate") LocalDateTime startDate,
236
+            @Param("endDate") LocalDateTime endDate,
237
+            @Param("personFrom") String personFrom,
238
+            @Param("province") String province,
239
+            @Param("realtyConsultant") String realtyConsultant,
240
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
241
+            @Param("activityId") String activityId,
242
+            @Param("activityType") String activityType,
243
+            @Param("buildingId") String buildingId
244
+    );
245
+
246
+    List<VisitNum> selectActivityVisitNumExport(
247
+            @Param("orgId") Integer orgId,
248
+            @Param("startDate") LocalDateTime startDate,
249
+            @Param("endDate") LocalDateTime endDate,
250
+            @Param("personFrom") String personFrom,
251
+            @Param("province") String province,
252
+            @Param("realtyConsultant") String realtyConsultant,
253
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
254
+            @Param("activityId") String activityId,
255
+            @Param("activityType") String activityType,
256
+            @Param("buildingId") String buildingId
257
+    );
258
+
259
+    IPage<VisitPersonNum> selectActivityVisitPersonNum(
260
+            IPage<VisitPersonNum> iPage,
261
+            @Param("orgId") Integer orgId,
262
+            @Param("startDate") LocalDateTime startDate,
263
+            @Param("endDate") LocalDateTime endDate,
264
+            @Param("personFrom") String personFrom,
265
+            @Param("province") String province,
266
+            @Param("realtyConsultant") String realtyConsultant,
267
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
268
+            @Param("activityId") String activityId,
269
+            @Param("activityType") String activityType,
270
+            @Param("buildingId") String buildingId
271
+    );
272
+
273
+    List<VisitPersonNum> selectActivityVisitPersonNumExport(
274
+            @Param("orgId") Integer orgId,
275
+            @Param("startDate") LocalDateTime startDate,
276
+            @Param("endDate") LocalDateTime endDate,
277
+            @Param("personFrom") String personFrom,
278
+            @Param("province") String province,
279
+            @Param("realtyConsultant") String realtyConsultant,
280
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
281
+            @Param("activityId") String activityId,
282
+            @Param("activityType") String activityType,
283
+            @Param("buildingId") String buildingId
284
+    );
285
+
286
+    IPage<VisitPersonNum> selectActivityVisitPersonNumByPersonId(
287
+            IPage<VisitPersonNum> iPage,
288
+            @Param("orgId") Integer orgId,
289
+            @Param("startDate") LocalDateTime startDate,
290
+            @Param("endDate") LocalDateTime endDate,
291
+            @Param("personId") String personId,
292
+            @Param("activityId") String activityId,
293
+            @Param("activityType") String activityType,
294
+            @Param("buildingId") String buildingId
295
+    );
296
+
297
+    List<VisitPersonNum> selectActivityVisitPersonNumExportByPersonId(
298
+            @Param("orgId") Integer orgId,
299
+            @Param("startDate") LocalDateTime startDate,
300
+            @Param("endDate") LocalDateTime endDate,
301
+            @Param("personId") String personId,
302
+            @Param("activityId") String activityId,
303
+            @Param("activityType") String activityType,
304
+            @Param("buildingId") String buildingId
305
+    );
306
+
307
+    IPage<VisitNum> selectActivityVisitNumByPersonId(
308
+            IPage<VisitNum> iPage,
309
+            @Param("orgId") Integer orgId,
310
+            @Param("startDate") LocalDateTime startDate,
311
+            @Param("endDate") LocalDateTime endDate,
312
+            @Param("personId") String personId,
313
+            @Param("activityId") String activityId,
314
+            @Param("activityType") String activityType,
315
+            @Param("buildingId") String buildingId
316
+    );
317
+
318
+    List<VisitNum> selectActivityVisitNumExportByPersonId(
319
+            @Param("orgId") Integer orgId,
320
+            @Param("startDate") LocalDateTime startDate,
321
+            @Param("endDate") LocalDateTime endDate,
322
+            @Param("personId") String personId,
323
+            @Param("activityId") String activityId,
324
+            @Param("activityType") String activityType,
325
+            @Param("buildingId") String buildingId
326
+    );
327
+
328
+}

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/mapper/TsPersonFromStatisticMapper.java Прегледај датотеку

@@ -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
 }

+ 198
- 0
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java Прегледај датотеку

@@ -0,0 +1,198 @@
1
+package com.huiju.estateagents.statistic.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.StringUtils;
7
+import com.huiju.estateagents.entity.TaPersonBuilding;
8
+import com.huiju.estateagents.excel.ActivityStatistics.*;
9
+import com.huiju.estateagents.statistic.mapper.TaActicityStaticMapper;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.time.LocalDate;
14
+import java.time.LocalDateTime;
15
+import java.time.LocalTime;
16
+import java.util.ArrayList;
17
+import java.util.HashMap;
18
+import java.util.List;
19
+import java.util.Map;
20
+
21
+@Service
22
+public class TaActivityStaticServiceImpl {
23
+    @Autowired
24
+    private TaActicityStaticMapper taActicityStaticMapper;
25
+
26
+    public ResponseBean activityStatistical(LocalDate startDate, LocalDate endDate, String building, String targetType, Integer orgId, List<TaPersonBuilding> taPersonBuildings, Integer userId){
27
+
28
+        ResponseBean responseBean = new ResponseBean();
29
+        Map<String, Object> map = new HashMap<>();
30
+
31
+        Integer sharePersonNum = taActicityStaticMapper.selectSharePersonNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), building, targetType, orgId, taPersonBuildings, userId);
32
+
33
+        Integer shareNum = taActicityStaticMapper.selectShareNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), building, targetType, orgId, taPersonBuildings, userId);
34
+
35
+        Integer visitPersonNum = taActicityStaticMapper.selectVisitPersonNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), building, targetType, orgId, taPersonBuildings, userId);
36
+
37
+        Integer visitNum = taActicityStaticMapper.selectVisitNum(LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), building, targetType, orgId, taPersonBuildings, userId);
38
+
39
+        map.put("sharePersonNum", sharePersonNum);
40
+        map.put("shareNum", shareNum);
41
+        map.put("visitPersonNum", visitPersonNum);
42
+        map.put("visitNum", visitNum);
43
+
44
+        responseBean.addSuccess(map);
45
+
46
+        return responseBean;
47
+    }
48
+
49
+    public ResponseBean selectAllActivityUser(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, List<TaPersonBuilding> taPersonBuildings, Integer userId){
50
+        ResponseBean responseBean = new ResponseBean();
51
+
52
+        // 新增用户数
53
+        List<Map<String, Object>> selectShareCount = taActicityStaticMapper.selectShareCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
54
+        List<Map<String, Object>> selectSharePersonCount = taActicityStaticMapper.selectSharePersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
55
+        List<Map<String, Object>> selectVisitCount = taActicityStaticMapper.selectVisitCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
56
+        List<Map<String, Object>> selectVisitPersonCount = taActicityStaticMapper.selectVisitPersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
57
+        List<Map<String, Object>> selectAddRegistCount = taActicityStaticMapper.selectAddRegistCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
58
+
59
+
60
+        for (Map<String, Object> ssc : selectShareCount){
61
+            //如果时间相等,那么原来子查询的数据塞到统一的数据处理map中
62
+            for (Map<String, Object> sspc : selectSharePersonCount){
63
+                if (sspc.get("date").equals(ssc.get("date"))){
64
+                    ssc.put("sharePersonCount", sspc.get("sharePersonCount"));
65
+                }
66
+                continue;
67
+            }
68
+            for (Map<String, Object> svc : selectVisitCount){
69
+                if (svc.get("date").equals(ssc.get("date"))){
70
+                    ssc.put("visitCount", svc.get("visitCount"));
71
+                }
72
+                continue;
73
+            }
74
+            for (Map<String, Object> svpc : selectVisitPersonCount){
75
+                if (svpc.get("date").equals(ssc.get("date"))){
76
+                    ssc.put("visitPersonCount", svpc.get("visitPersonCount"));
77
+                }
78
+                continue;
79
+            }
80
+            for (Map<String, Object> sarc : selectAddRegistCount){
81
+                if (sarc.get("date").equals(ssc.get("date"))){
82
+                    ssc.put("addregistCount", sarc.get("addregistCount"));
83
+                }
84
+                continue;
85
+            }
86
+        }
87
+
88
+        Map<String, Object> map = new HashMap<>();
89
+        map.put("selectAllActivityUser", selectShareCount);
90
+        responseBean.addSuccess(map);
91
+        return responseBean;
92
+    }
93
+
94
+    public ResponseBean selectTableData(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
95
+        IPage<StatisicAttractUser> iPage = new Page<>(pageNum, pageSize);
96
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
97
+        IPage<StatisicAttractUser> data = taActicityStaticMapper.selectTableData(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, sortType, colKey, taPersonBuildings, userId);
98
+        return ResponseBean.success(data);
99
+    }
100
+
101
+    public List<StatisicAttractUser> selectExportTableData(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
102
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
103
+        return taActicityStaticMapper.selectExportTableData(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, sortType, colKey, taPersonBuildings, userId);
104
+    }
105
+
106
+    public ResponseBean selectActivityStatisDetail(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String activityName, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
107
+        IPage<ActivityDetailShareRecord> iPage = new Page<>(pageNum, pageSize);
108
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
109
+        IPage<ActivityDetailShareRecord> data = taActicityStaticMapper.selectActivityStatisDetail(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, activityName, sortType, colKey, taPersonBuildings, userId);
110
+        return ResponseBean.success(data);
111
+    }
112
+
113
+    public List<ActivityDetailShareRecord> selectActivityStatisDetailExport(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, String targetType, String activityName, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
114
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
115
+        return taActicityStaticMapper.selectActivityStatisDetailExport(orgId, startDate, endDate, buildingId, targetType, activityName, sortType, colKey, taPersonBuildings, userId);
116
+    }
117
+
118
+    public ResponseBean selectActivitySharePersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String buildingId, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
119
+        IPage<SharePersonNum> iPage = new Page<>(pageNum, pageSize);
120
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
121
+
122
+        IPage<SharePersonNum> data = taActicityStaticMapper.selectActivitySharePersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, buildingId, sortType, colKey, taPersonBuildings, userId);
123
+        return ResponseBean.success(data);
124
+    }
125
+
126
+    public List<SharePersonNum> selectActivitySharePersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String buildingId, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
127
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
128
+        return taActicityStaticMapper.selectActivitySharePersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, buildingId, sortType, colKey, taPersonBuildings, userId);
129
+    }
130
+
131
+    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 buildingId, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
132
+        IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
133
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
134
+
135
+        IPage<ShareNum> data = taActicityStaticMapper.selectActivityShareNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, buildingId, sortType, colKey, taPersonBuildings, userId);
136
+        return ResponseBean.success(data);
137
+    }
138
+
139
+    public List<ShareNum> selectActivityShareNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String personId, String buildingId, String sort, String colKey, List<TaPersonBuilding> taPersonBuildings, Integer userId){
140
+        String sortType = "ascend".equals(sort) ? "asc" : "desc";
141
+        return taActicityStaticMapper.selectActivityShareNumExport( orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, buildingId, sortType, colKey, taPersonBuildings, userId);
142
+    }
143
+
144
+    public ResponseBean selectActivityAddRegistNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, String province, List<TaPersonBuilding> taPersonBuildings, Integer userId){
145
+        IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
146
+        IPage<AddRegistNum> data = taActicityStaticMapper.selectActivityAddRegistNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, province, taPersonBuildings, userId);
147
+        return ResponseBean.success(data);
148
+    }
149
+
150
+    public List<AddRegistNum> selectActivityAddRegistNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, String province, List<TaPersonBuilding> taPersonBuildings, Integer userId){
151
+        return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, province, taPersonBuildings, userId);
152
+    }
153
+
154
+    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, String buildingId){
155
+        IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
156
+        IPage<VisitNum> data;
157
+        if (StringUtils.isEmpty(personId)){
158
+            data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
159
+        }else{
160
+            data = taActicityStaticMapper.selectActivityVisitNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
161
+        }
162
+
163
+        return ResponseBean.success(data);
164
+    }
165
+
166
+    public List<VisitNum> selectActivityVisitNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String personId, String buildingId){
167
+        List<VisitNum> list = new ArrayList<>();
168
+        if (StringUtils.isEmpty(personId)){
169
+            list = taActicityStaticMapper.selectActivityVisitNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
170
+        }else{
171
+            list = taActicityStaticMapper.selectActivityVisitNumExportByPersonId(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
172
+        }
173
+        return list;
174
+    }
175
+
176
+    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 buildingId, String personId){
177
+        IPage<VisitPersonNum> iPage = new Page<>(pageNum, pageSize);
178
+        IPage<VisitPersonNum> data;
179
+        if (StringUtils.isEmpty(personId)){
180
+            data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
181
+        }else{
182
+            data = taActicityStaticMapper.selectActivityVisitPersonNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
183
+        }
184
+
185
+        return ResponseBean.success(data);
186
+    }
187
+
188
+    public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String buildingId, String personId){
189
+        List<VisitPersonNum> list = new ArrayList<>();
190
+        if (StringUtils.isEmpty(personId)){
191
+            list = taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
192
+        }else{
193
+            list = taActicityStaticMapper.selectActivityVisitPersonNumExportByPersonId(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
194
+        }
195
+        return list;
196
+    }
197
+
198
+}

+ 4
- 2
src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java Прегледај датотеку

@@ -224,7 +224,9 @@ public class TaThirdPartyMiniappConfigController extends BaseController {
224 224
     public ResponseBean genQRcode(
225 225
             @RequestParam (required = false) String h5Id,
226 226
             @RequestParam (required = false) String personId,
227
-            @RequestParam (required = false, defaultValue = "10") Integer top
227
+            @RequestParam (required = false, defaultValue = "10") Integer top,
228
+            @RequestParam (required = false) String beginDate,
229
+            @RequestParam (required = false) String endDate
228 230
     ) {
229 231
         // 暂时没有任何校验
230 232
         QueryWrapper<TaThirdPartyMiniappConfig> queryWrapper = new QueryWrapper<>();
@@ -234,7 +236,7 @@ public class TaThirdPartyMiniappConfigController extends BaseController {
234 236
 
235 237
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(queryWrapper);
236 238
 
237
-        List<Map<String, Object>> res = taShareService.statTopShare(taThirdPartyMiniappConfig.getOrgId(), "h5_share", h5Id, top);
239
+        List<Map<String, Object>> res = taShareService.statTopShare(taThirdPartyMiniappConfig.getOrgId(), "h5_share", h5Id, top, beginDate, endDate);
238 240
         return ResponseBean.success(res);
239 241
     }
240 242
 }

+ 168
- 0
src/main/resources/mapper/ActivityManageMapper.xml Прегледај датотеку

@@ -0,0 +1,168 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.mapper.ActivityManageMapper">
4
+
5
+    <select id = "getStatisticDataByType" resultType="com.huiju.estateagents.bo.request.ActivityStatisticResponseBO">
6
+      select
7
+        -- 活动分享人数
8
+        (SELECT count(DISTINCT b.person_id) FROM ta_share_count b
9
+        WHERE b.org_id = a.org_id
10
+            <choose>
11
+                <when test=" type == 'live'">
12
+                    AND b.tagert_type like concat('%',a.target_type,'%')
13
+                </when>
14
+                <otherwise>
15
+                    AND b.tagert_type = a.target_type
16
+                </otherwise>
17
+            </choose>
18
+            AND b.be_share = a.target_id
19
+        ) as share_persons,
20
+
21
+        -- 活动分享次数
22
+        (SELECT count(*) FROM ta_share_count c
23
+        WHERE c.org_id = a.org_id
24
+            <choose>
25
+                <when test=" type == 'live'">
26
+                    AND c.tagert_type like concat('%',a.target_type,'%')
27
+                </when>
28
+                <otherwise>
29
+                    AND c.tagert_type = a.target_type
30
+                </otherwise>
31
+            </choose>
32
+            AND c.be_share = a.target_id
33
+        ) as share_num,
34
+
35
+        -- 活动访问人数
36
+        (select count( DISTINCT d.person_id ) from ta_person_visit_record d
37
+        WHERE d.org_id = a.org_id
38
+            AND if(d.target_type is null ,d.event_type = a.target_type, d.target_type = REPLACE(a.target_type, 'activity', 'dynamic'))
39
+            AND d.target_id = a.target_id
40
+            AND d.`event` = 'detail'
41
+        ) as visit_persons,
42
+
43
+        -- 活动访问次数
44
+        (select count(*) from ta_person_visit_record e
45
+        WHERE e.org_id = a.org_id
46
+            AND if(e.target_type is null ,e.event_type = a.target_type, e.target_type = REPLACE(a.target_type, 'activity', 'dynamic'))
47
+            AND e.target_id = a.target_id
48
+            AND e.`event` = 'detail'
49
+        ) as visit_num,
50
+
51
+        -- 分享新增用户
52
+        (select count(*) from ta_share_person_from f
53
+        where	f.org_id = a.org_id
54
+        <choose>
55
+            <when test=" type == 'live'">
56
+                AND f.target_type = concat('%',REPLACE(a.target_type, 'activity', 'dynamic'), '_share%')
57
+            </when>
58
+            <otherwise>
59
+                AND f.target_type = concat(REPLACE(a.target_type, 'activity', 'dynamic'), '_share')
60
+            </otherwise>
61
+        </choose>
62
+        AND f.target_id = a.target_id
63
+        AND f.`status` > 0
64
+        AND f.is_first_time = 1
65
+        ) as new_persons,
66
+
67
+        -- 分享新增客户
68
+        (select count(*) from ta_share_person_from g
69
+        inner join ta_person h on h.person_id = g.person_id
70
+        where	g.org_id = a.org_id
71
+        <choose>
72
+            <when test=" type == 'live'">
73
+                AND g.target_type = concat('%',REPLACE(a.target_type, 'activity', 'dynamic'), '_share%')
74
+            </when>
75
+            <otherwise>
76
+                AND g.target_type = concat(REPLACE(a.target_type, 'activity', 'dynamic'), '_share')
77
+            </otherwise>
78
+        </choose>
79
+        AND g.target_id = a.target_id
80
+        AND g.`status` > 0
81
+        AND g.is_first_time = 1
82
+        AND h.phone is not null
83
+        ) as new_customers
84
+
85
+        from (
86
+            <if test=" type == 'activity' ">
87
+                SELECT
88
+                    t.org_id,
89
+                    t.building_id,
90
+                    s.building_name,
91
+                    t.dynamic_id AS target_id,
92
+                    t.title AS target_name,
93
+                    'activity' AS target_type
94
+                FROM
95
+                    ta_building_dynamic t
96
+                LEFT JOIN ta_building s ON s.building_id = t.building_id
97
+                WHERE
98
+                   t.dynamic_id = #{id}
99
+                  AND t.org_id = #{orgId}
100
+            </if>
101
+
102
+            <if test=" type == 'h5' " >
103
+                    SELECT
104
+                    t.org_id,
105
+                    t.building_id,
106
+                    s.building_name,
107
+                    t.drainage_id AS target_id,
108
+                    t.`name` AS target_name,
109
+                    'h5' AS target_type
110
+                FROM
111
+                  ta_drainage t
112
+                LEFT JOIN ta_building s ON s.building_id = t.building_id
113
+                WHERE
114
+                  t.drainage_id = #{id}
115
+                  AND t.org_id = #{orgId}
116
+            </if>
117
+
118
+            <if test=" type == 'help' ">
119
+                SELECT
120
+                    t.org_id,
121
+                    t.building_id,
122
+                    s.building_name,
123
+                    t.help_activity_id AS target_id,
124
+                    t.title AS target_name,
125
+                    'help' AS target_type
126
+                FROM
127
+                    ta_help_activity t
128
+                LEFT JOIN ta_building s ON s.building_id = t.building_id
129
+                WHERE
130
+                    t.help_activity_id = #{id}
131
+                    AND t.org_id = #{orgId}
132
+            </if>
133
+
134
+            <if test=" type == 'group' ">
135
+                SELECT
136
+                    t.org_id,
137
+                    t.building_id,
138
+                    s.building_name,
139
+                    t.group_activity_id AS target_id,
140
+                    t.activity_name AS target_name,
141
+                    'group' AS target_type
142
+                FROM
143
+                    ta_share_activity t
144
+                LEFT JOIN ta_building s ON s.building_id = t.building_id
145
+                WHERE
146
+                    t.group_activity_id = #{id}
147
+                    AND t.org_id = #{orgId}
148
+            </if>
149
+
150
+            <if test=" type == 'live' ">
151
+                SELECT
152
+                    t.org_id,
153
+                    t.building_id,
154
+                    s.building_name,
155
+                    t.live_activity_id AS target_id,
156
+                    t.live_activity_title AS target_name,
157
+                    'live' AS target_type
158
+                FROM
159
+                    ta_live_activity t
160
+                LEFT JOIN ta_building s ON s.building_id = t.building_id
161
+                WHERE
162
+                    t.live_activity_id = #{id}
163
+                    AND t.org_id = #{orgId}
164
+            </if>
165
+        ) a
166
+    </select>
167
+
168
+</mapper>

+ 0
- 1
src/main/resources/mapper/TaBuildingDynamicMapper.xml Прегледај датотеку

@@ -190,5 +190,4 @@
190 190
         from ta_building_dynamic
191 191
         where org_id = #{orgId}
192 192
     </select>
193
-
194 193
 </mapper>

+ 488
- 0
src/main/resources/mapper/TaBuildingMapper.xml Прегледај датотеку

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

+ 15
- 0
src/main/resources/mapper/TaCustomerFromMapper.xml Прегледај датотеку

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.mapper.TaCustomerFromMapper">
4
+
5
+    <select id="countPerson" resultType="java.util.HashMap">
6
+        SELECT
7
+            count( 1 ) AS orgCount,
8
+            IFNULL( sum( IF ( t.building_id = #{buildingId}, 1, 0 ) ), 0 ) AS projectCount
9
+        FROM
10
+            ta_customer_from t
11
+        WHERE
12
+            t.org_id = #{orgId}
13
+        AND t.person_id = #{personId}
14
+    </select>
15
+</mapper>

+ 2
- 1
src/main/resources/mapper/TaLiveActivityMapper.xml Прегледај датотеку

@@ -40,10 +40,11 @@
40 40
          and t.building_id = #{buildingId}
41 41
     </if>
42 42
     <if test="personBuildingList != null and personBuildingList.size > 0">
43
-        AND t.building_id in
43
+        AND (t.building_id in
44 44
         <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
45 45
             #{personBuilding.buildingId}
46 46
         </foreach>
47
+        or t.create_user = #{userId})
47 48
     </if>
48 49
         order by t.weight desc
49 50
     </select>

+ 0
- 0
src/main/resources/mapper/TaOrgCity.xml Прегледај датотеку


Неке датотеке нису приказане због велике количине промена