dingxin hace 5 años
padre
commit
2bea420930
Se han modificado 21 ficheros con 244 adiciones y 180 borrados
  1. 38
    28
      src/main/java/com/huiju/estateagents/controller/StatisticalController.java
  2. 16
    16
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  3. 21
    5
      src/main/java/com/huiju/estateagents/controller/TaPersonController.java
  4. 5
    5
      src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
  5. 10
    3
      src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java
  6. 2
    2
      src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java
  7. 2
    2
      src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java
  8. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaBuildingProjectTypeMapper.java
  9. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java
  10. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java
  11. 29
    19
      src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java
  12. 13
    12
      src/main/java/com/huiju/estateagents/service/IStatisticalService.java
  13. 5
    5
      src/main/java/com/huiju/estateagents/service/ITaBuildingService.java
  14. 51
    50
      src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java
  15. 30
    22
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  16. 2
    0
      src/main/resources/mapper/TaBuildingDynamicMapper.xml
  17. 2
    0
      src/main/resources/mapper/TaBuildingMapper.xml
  18. 1
    1
      src/main/resources/mapper/TaBuildingProjectTypeMapper.xml
  19. 1
    0
      src/main/resources/mapper/TaNewsMapper.xml
  20. 1
    1
      src/main/resources/mapper/TaPersonIntentionRecordMapper.xml
  21. 12
    6
      src/main/resources/mapper/TaPersonMapper.xml

+ 38
- 28
src/main/java/com/huiju/estateagents/controller/StatisticalController.java Ver fichero

@@ -1,20 +1,21 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
+import com.huiju.estateagents.base.BaseController;
3 4
 import com.huiju.estateagents.base.ResponseBean;
4 5
 import com.huiju.estateagents.service.IStatisticalService;
5 6
 import org.springframework.beans.factory.annotation.Autowired;
6 7
 import org.springframework.format.annotation.DateTimeFormat;
7 8
 import org.springframework.web.bind.annotation.*;
8 9
 
10
+import javax.servlet.http.HttpServletRequest;
9 11
 import java.time.LocalDate;
10
-import java.util.Date;
11 12
 
12 13
 /**
13 14
  * 数据统计
14 15
  */
15 16
 @RestController
16 17
 @RequestMapping("/api")
17
-public class StatisticalController {
18
+public class StatisticalController extends BaseController {
18 19
 
19 20
     @Autowired
20 21
     private IStatisticalService iStatisticalService;
@@ -24,8 +25,8 @@ public class StatisticalController {
24 25
      * @return
25 26
      */
26 27
     @GetMapping(value = "/admin/indexStatistical")
27
-    public ResponseBean indexStatistical() {
28
-        return iStatisticalService.indexStatistical();
28
+    public ResponseBean indexStatistical(HttpServletRequest request) {
29
+        return iStatisticalService.indexStatistical(getOrgId(request));
29 30
     }
30 31
 
31 32
     /**
@@ -35,8 +36,9 @@ public class StatisticalController {
35 36
     @GetMapping(value = "/admin/selectActiveUserCount")
36 37
     public ResponseBean selectActiveUserCount(@RequestParam String dateType,
37 38
                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
38
-                                              @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
39
-        return iStatisticalService.selectActiveUserCount(dateType, startDate,endDate);
39
+                                              @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
40
+                                              HttpServletRequest request) {
41
+        return iStatisticalService.selectActiveUserCount(getOrgId(request), dateType, startDate,endDate);
40 42
     }
41 43
 
42 44
     /**
@@ -45,8 +47,9 @@ public class StatisticalController {
45 47
      */
46 48
     @GetMapping(value = "/admin/selectNewsUserCount")
47 49
     public ResponseBean selectNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
48
-                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
49
-        return iStatisticalService.selectNewsUserCount(startDate, endDate);
50
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
51
+                                            HttpServletRequest request) {
52
+        return iStatisticalService.selectNewsUserCount(getOrgId(request), startDate, endDate);
50 53
     }
51 54
 
52 55
     /**
@@ -54,8 +57,9 @@ public class StatisticalController {
54 57
      * @return
55 58
      */
56 59
     @GetMapping(value = "/admin/selectConversion")
57
-    public ResponseBean selectConversion(@RequestParam("conversion") String conversion) {
58
-        return iStatisticalService.selectConversion(conversion);
60
+    public ResponseBean selectConversion(@RequestParam("conversion") String conversion,
61
+                                         HttpServletRequest request) {
62
+        return iStatisticalService.selectConversion(getOrgId(request), conversion);
59 63
     }
60 64
 
61 65
     /**
@@ -70,8 +74,9 @@ public class StatisticalController {
70 74
                                            @RequestParam(value = "buildingId", required = false) String buildingId,
71 75
                                            @RequestParam(value = "eventType", required = false) String eventType,
72 76
                                            @RequestParam(value = "event", required = false) String event,
73
-                                           @RequestParam(value = "activity", required = false) String activity) {
74
-        return iStatisticalService.selectUserBehavior(pageNum, pageSize, startDate, endDate, buildingId, eventType, event, activity);
77
+                                           @RequestParam(value = "activity", required = false) String activity,
78
+                                           HttpServletRequest request) {
79
+        return iStatisticalService.selectUserBehavior(pageNum, pageSize, getOrgId(request), startDate, endDate, buildingId, eventType, event, activity);
75 80
     }
76 81
 
77 82
     /**
@@ -80,8 +85,9 @@ public class StatisticalController {
80 85
      */
81 86
     @GetMapping(value = "/admin/selectEventAll")
82 87
     public ResponseBean selectEventAll(@RequestParam(required = false) String event,
83
-                                              @RequestParam(required = false) String personId) {
84
-        return iStatisticalService.selectEventAll(event, personId);
88
+                                       @RequestParam(required = false) String personId,
89
+                                       HttpServletRequest request) {
90
+        return iStatisticalService.selectEventAll(getOrgId(request), event, personId);
85 91
     }
86 92
 
87 93
 
@@ -91,8 +97,9 @@ public class StatisticalController {
91 97
      */
92 98
     @GetMapping(value = "/admin/selectUserResource")
93 99
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
94
-                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
95
-        return iStatisticalService.selectUserResource(startDate, endDate);
100
+                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
101
+                                           HttpServletRequest request) {
102
+        return iStatisticalService.selectUserResource(getOrgId(request), startDate, endDate);
96 103
     }
97 104
 
98 105
 
@@ -101,8 +108,8 @@ public class StatisticalController {
101 108
      * @return
102 109
      */
103 110
     @GetMapping(value = "/admin/selectUserCount")
104
-    public ResponseBean selectUserResource() {
105
-        return iStatisticalService.selectUserCount();
111
+    public ResponseBean selectUserResource(HttpServletRequest request) {
112
+        return iStatisticalService.selectUserCount(getOrgId(request));
106 113
     }
107 114
 
108 115
     /**
@@ -110,8 +117,8 @@ public class StatisticalController {
110 117
      * @return
111 118
      */
112 119
     @GetMapping(value = "/admin/selectRegisteredCount")
113
-    public ResponseBean selectRegisteredCount() {
114
-        return iStatisticalService.selectRegisteredCount();
120
+    public ResponseBean selectRegisteredCount(HttpServletRequest request) {
121
+        return iStatisticalService.selectRegisteredCount(getOrgId(request));
115 122
     }
116 123
 
117 124
     /**
@@ -120,8 +127,9 @@ public class StatisticalController {
120 127
      */
121 128
     @GetMapping(value = "/admin/selectRecentlyCount")
122 129
     public ResponseBean selectRecentlyCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
123
-                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate) {
124
-        return iStatisticalService.selectRecentlyCount(startDate, endDate);
130
+                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
131
+                                            HttpServletRequest request) {
132
+        return iStatisticalService.selectRecentlyCount(getOrgId(request), startDate, endDate);
125 133
     }
126 134
 
127 135
     /**
@@ -129,8 +137,8 @@ public class StatisticalController {
129 137
      * @return
130 138
      */
131 139
     @GetMapping(value = "/admin/selectSexUser")
132
-    public ResponseBean selectSexUser() {
133
-        return iStatisticalService.selectSexUser();
140
+    public ResponseBean selectSexUser(HttpServletRequest request) {
141
+        return iStatisticalService.selectSexUser(getOrgId(request));
134 142
     }
135 143
 
136 144
     /**
@@ -138,8 +146,9 @@ public class StatisticalController {
138 146
      * @return
139 147
      */
140 148
     @GetMapping(value = "/admin/selectCityUser")
141
-    public ResponseBean selectCityUser() {
142
-        return iStatisticalService.selectCityUser();
149
+    public ResponseBean selectCityUser(HttpServletRequest request) {
150
+        Integer orgId = getOrgId(request);
151
+        return iStatisticalService.selectCityUser(orgId);
143 152
     }
144 153
 
145 154
     /**
@@ -149,8 +158,9 @@ public class StatisticalController {
149 158
     @GetMapping(value = "/admin/selectIntentionUser")
150 159
     public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
151 160
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
152
-                                            @RequestParam(value = "buildingId", required = false) String buildingId) {
153
-        return iStatisticalService.selectIntentionUser(pageNum, pageSize, buildingId);
161
+                                            @RequestParam(value = "buildingId", required = false) String buildingId,
162
+                                            HttpServletRequest request) {
163
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId);
154 164
     }
155 165
 
156 166
 }

+ 16
- 16
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Ver fichero

@@ -75,8 +75,8 @@ public class TaBuildingController extends BaseController {
75 75
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
76 76
                                      @RequestParam(value = "cityId",required = false)Integer cityId,
77 77
                                      @RequestParam(value = "isMain",required = false)Integer isMain,
78
-                                     @RequestParam(value = "orgId",required = false)Integer orgId){
79
-        return taBuildingService.buildingList(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain, orgId);
78
+                                     HttpServletRequest request){
79
+        return taBuildingService.buildingList(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain, getOrgId(request));
80 80
     }
81 81
 
82 82
     /**
@@ -96,9 +96,9 @@ public class TaBuildingController extends BaseController {
96 96
                                      @RequestParam(value = "buildingStatus",required = false)String buildingStatus,
97 97
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
98 98
                                      @RequestParam(value = "cityId",required = false)Integer cityId,
99
-                                     @RequestParam(value = "isMain",required = false)Integer isMain,HttpServletRequest request){
100
-        Map map = JWTUtils.getUserIdAndOrgId(request);
101
-        return taBuildingService.buildingListSelect(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain,Integer.valueOf(map.get("orgId").toString()));
99
+                                     @RequestParam(value = "isMain",required = false)Integer isMain,
100
+                                           HttpServletRequest request){
101
+        return taBuildingService.buildingListSelect(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain,getOrgId(request));
102 102
     }
103 103
 
104 104
     /**
@@ -107,8 +107,8 @@ public class TaBuildingController extends BaseController {
107 107
      * @return
108 108
      */
109 109
     @PutMapping("/admin/building/update")
110
-    public ResponseBean buildingUpdate(@RequestBody String parameter){
111
-        return taBuildingService.buildingUpdate(parameter);
110
+    public ResponseBean buildingUpdate(@RequestBody String parameter, HttpServletRequest request){
111
+        return taBuildingService.buildingUpdate(parameter, getOrgId(request));
112 112
     }
113 113
 
114 114
     /**
@@ -117,8 +117,8 @@ public class TaBuildingController extends BaseController {
117 117
      * @return
118 118
      */
119 119
     @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
120
-    public ResponseBean buildingAdd(@RequestBody String parameter){
121
-        return taBuildingService.buildingAdd(parameter);
120
+    public ResponseBean buildingAdd(@RequestBody String parameter, HttpServletRequest request){
121
+        return taBuildingService.buildingAdd(parameter, getOrgId(request));
122 122
     }
123 123
 
124 124
     /**
@@ -127,19 +127,19 @@ public class TaBuildingController extends BaseController {
127 127
      * @return
128 128
      */
129 129
     @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
130
-    public ResponseBean buildingUpdateStatus(@RequestBody String parameter){
131
-        return taBuildingService.buildingUpdateStatus(parameter);
130
+    public ResponseBean buildingUpdateStatus(@RequestBody String parameter, HttpServletRequest request){
131
+        return taBuildingService.buildingUpdateStatus(parameter, getOrgId(request));
132 132
     }
133 133
 
134 134
     /**
135 135
      * 楼盘删除
136 136
      * @param id
137
-     * @param session
137
+     * @param request
138 138
      * @return
139 139
      */
140 140
     @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
141
-    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpSession session){
142
-        return taBuildingService.buildingdelete(id);
141
+    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpServletRequest request){
142
+        return taBuildingService.buildingdelete(id, getOrgId(request));
143 143
     }
144 144
 
145 145
     /**
@@ -284,8 +284,8 @@ public class TaBuildingController extends BaseController {
284 284
      * 查询当前所有项目
285 285
      */
286 286
     @RequestMapping(value = "/admin/buildingAll", method = RequestMethod.GET)
287
-    public  ResponseBean buildingAll(){
288
-        ResponseBean taBuilding= taBuildingService.buildingAll();
287
+    public  ResponseBean buildingAll(HttpServletRequest request){
288
+        ResponseBean taBuilding= taBuildingService.buildingAll(getOrgId(request));
289 289
         return taBuilding;
290 290
     }
291 291
 }

+ 21
- 5
src/main/java/com/huiju/estateagents/controller/TaPersonController.java Ver fichero

@@ -416,13 +416,27 @@ public class TaPersonController extends BaseController {
416 416
         return taPersonService.editConsultant(id, paramStr);
417 417
     }
418 418
 
419
-    @PutMapping("/wx/editConsultant/{id}")
420
-    public ResponseBean editWxConsultant(@PathVariable String id, @RequestBody TaPerson taPerson) {
419
+    @PutMapping("/wx/editPerson")
420
+    public ResponseBean editWxConsultant(@RequestParam(required = false)String name,@RequestParam(required = false)String avatar,@RequestParam(required = false)String phone,HttpServletRequest request) {
421 421
         ResponseBean responseBean = new ResponseBean();
422
+        String openid = JWTUtils.getSubject(request);
423
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
424
+        if (null == taPersons || taPersons.size() != 1) {
425
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
426
+        }
427
+        TaPerson person = taPersons.get(0);
428
+        if (!StringUtils.isEmpty(name)){
429
+            person.setName(name);
430
+        }
431
+        if (!StringUtils.isEmpty(avatar)){
432
+            person.setAvatarurl(avatar);
433
+        }
434
+        if (!StringUtils.isEmpty(phone)){
435
+            person.setTel(phone);
436
+        }
422 437
         try{
423
-            taPerson.setPersonId(id);
424
-            if(taPersonService.updateById(taPerson)){
425
-                responseBean.addSuccess(taPerson);
438
+            if(taPersonService.updateById(person)){
439
+                responseBean.addSuccess(person);
426 440
             }else {
427 441
                 responseBean.addError("fail");
428 442
             }
@@ -563,6 +577,7 @@ public class TaPersonController extends BaseController {
563 577
 
564 578
         return ResponseBean.success(taPerson);
565 579
     }
580
+
566 581
     
567 582
     /**
568 583
      * 微信添加人员添加城市
@@ -594,4 +609,5 @@ public class TaPersonController extends BaseController {
594 609
         responseBean.addError("未找到城市");
595 610
         return responseBean;
596 611
     }
612
+
597 613
 }

+ 5
- 5
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Ver fichero

@@ -336,11 +336,11 @@ public class TaRecommendCustomerController extends BaseController {
336 336
      * @param taRecommendCustomer 实体对象
337 337
      * @return
338 338
      */
339
-    @RequestMapping(value="/wx/customer/recommend/edit/{id}",method= RequestMethod.PUT)
340
-    public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String id,
339
+    @RequestMapping(value="/wx/customer/recommend/edit/{customerId}",method= RequestMethod.PUT)
340
+    public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String customerId,
341 341
                                         @RequestBody TaRecommendCustomer taRecommendCustomer){
342 342
         ResponseBean responseBean = new ResponseBean();
343
-        taRecommendCustomer.setCustomerId(id);
343
+        taRecommendCustomer.setCustomerId(customerId);
344 344
         try {
345 345
             if (taRecommendCustomerService.updateById(taRecommendCustomer)){
346 346
                 responseBean.addSuccess(taRecommendCustomer);
@@ -399,8 +399,8 @@ public class TaRecommendCustomerController extends BaseController {
399 399
 //        return responseBean;
400 400
 //    }
401 401
 
402
-    @RequestMapping(value = "/wx/customer/recommend/get/{id}", method = RequestMethod.GET)
403
-    public ResponseBean getSingleCustomer(@PathVariable(value = "id") String customerId) {
402
+    @RequestMapping(value = "/wx/customer/recommend/get/{customerId}", method = RequestMethod.GET)
403
+    public ResponseBean getSingleCustomer(@PathVariable(value = "customerId") String customerId) {
404 404
         ResponseBean responseBean = new ResponseBean();
405 405
         try {
406 406
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));

+ 10
- 3
src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java Ver fichero

@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
18 18
 import org.springframework.web.bind.annotation.RestController;
19 19
 import com.huiju.estateagents.base.BaseController;
20 20
 
21
+import javax.servlet.http.HttpServletRequest;
22
+
21 23
 /**
22 24
  * <p>
23 25
     * 项目类型字典表  前端控制器
@@ -44,7 +46,8 @@ public class TdBuildingTypeController extends BaseController {
44 46
      */
45 47
     @RequestMapping(value="/admin/tdBuildingType",method= RequestMethod.GET)
46 48
     public ResponseBean tdBuildingTypeList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
-                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
49
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
50
+                                           HttpServletRequest request){
48 51
         ResponseBean responseBean = new ResponseBean();
49 52
         try {
50 53
             //使用分页插件
@@ -52,6 +55,7 @@ public class TdBuildingTypeController extends BaseController {
52 55
             QueryWrapper<TdBuildingType> queryWrapper = new QueryWrapper<>();
53 56
             queryWrapper.eq("status", 1);
54 57
             queryWrapper.orderByDesc("create_date");
58
+            queryWrapper.eq("org_id", getOrgId(request));
55 59
 
56 60
             IPage<TdBuildingType> result = iTdBuildingTypeService.page(pg, queryWrapper);
57 61
             responseBean.addSuccess(result);
@@ -95,9 +99,10 @@ public class TdBuildingTypeController extends BaseController {
95 99
      * @return
96 100
      */
97 101
     @RequestMapping(value="/admin/tdBuildingType",method= RequestMethod.POST)
98
-    public ResponseBean tdBuildingTypeAdd(@RequestBody TdBuildingType tdBuildingType){
102
+    public ResponseBean tdBuildingTypeAdd(@RequestBody TdBuildingType tdBuildingType, HttpServletRequest request){
99 103
         ResponseBean responseBean = new ResponseBean();
100 104
         try {
105
+            tdBuildingType.setOrgId(getOrgId(request));
101 106
             if (iTdBuildingTypeService.save(tdBuildingType)){
102 107
                 responseBean.addSuccess(tdBuildingType);
103 108
             }else {
@@ -139,9 +144,11 @@ public class TdBuildingTypeController extends BaseController {
139 144
      */
140 145
     @RequestMapping(value="/admin/tdBuildingType/{id}",method= RequestMethod.PUT)
141 146
     public ResponseBean tdBuildingTypeUpdate(@PathVariable Integer id,
142
-                                        @RequestBody TdBuildingType tdBuildingType){
147
+                                        @RequestBody TdBuildingType tdBuildingType,
148
+                                             HttpServletRequest request){
143 149
         ResponseBean responseBean = new ResponseBean();
144 150
         try {
151
+            tdBuildingType.setOrgId(getOrgId(request));
145 152
             if (iTdBuildingTypeService.updateById(tdBuildingType)){
146 153
                 responseBean.addSuccess(tdBuildingType);
147 154
             }else {

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java Ver fichero

@@ -63,11 +63,11 @@ public interface TaBuildingDynamicMapper extends BaseMapper<TaBuildingDynamic> {
63 63
      * 转化率 活动收藏 / 活动分享
64 64
      * @return
65 65
      */
66
-    Map<String, Object> selectBuildingDynamicStatistical(@Param("saveOrShare") String saveOrShare);
66
+    Map<String, Object> selectBuildingDynamicStatistical(@Param("orgId") Integer orgId, @Param("saveOrShare") String saveOrShare);
67 67
 
68 68
     /**
69 69
      * 转化率 活动报名
70 70
      * @return
71 71
      */
72
-    Map<String, Object> selectBuildingDynamicEnlistStatistical();
72
+    Map<String, Object> selectBuildingDynamicEnlistStatistical(@Param("orgId") Integer orgId);
73 73
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java Ver fichero

@@ -41,7 +41,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
41 41
     @Update("UPDATE ta_building  SET ${field} = IFNULL(${field}, 0) + #{increment}  WHERE building_id = #{buildingId}")
42 42
     void setFieldNum(@Param("buildingId") String buildingId, @Param("field") String field, @Param("increment") int increment);
43 43
 
44
-    List<TaBuilding> buildingAll();
44
+    List<TaBuilding> buildingAll(@Param("orgId") Integer orgId);
45 45
 
46 46
     /**
47 47
      * 查询当前楼盘
@@ -54,7 +54,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
54 54
      * 转化率 项目收藏 / 项目分享
55 55
      * @return
56 56
      */
57
-    Map<String, Object> selectBuildingStatistical(@Param("saveOrShare") String saveOrShare);
57
+    Map<String, Object> selectBuildingStatistical(@Param("orgId")Integer orgId, @Param("saveOrShare") String saveOrShare);
58 58
 
59 59
     /**
60 60
      * 查询楼盘

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingProjectTypeMapper.java Ver fichero

@@ -32,5 +32,5 @@ public interface TaBuildingProjectTypeMapper extends BaseMapper<TaBuildingProjec
32 32
      * 批量添加
33 33
      * @param list
34 34
      */
35
-    void insertBuildingProjectTypeBatch(@Param("list") List list);
35
+    void insertBuildingProjectTypeBatch(@Param("list") List list, @Param("buildingId") String buildingId);
36 36
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java Ver fichero

@@ -33,6 +33,6 @@ public interface TaNewsMapper extends BaseMapper<TaNews> {
33 33
      * 转化率 咨迅收藏 / 咨迅分享
34 34
      * @return
35 35
      */
36
-    Map<String, Object> selectNewsStatistical(@Param("saveOrShare") String saveOrShare);
36
+    Map<String, Object> selectNewsStatistical(@Param("orgId") Integer orgId, @Param("saveOrShare") String saveOrShare);
37 37
 
38 38
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java Ver fichero

@@ -29,5 +29,5 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
29 29
      * @param buildingId
30 30
      * @return
31 31
      */
32
-    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("buildingId") String buildingId);
32
+    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("orgId") Integer orgId, @Param("buildingId") String buildingId);
33 33
 }

+ 29
- 19
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Ver fichero

@@ -56,8 +56,8 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
56 56
      * @return
57 57
      */
58 58
     @ResultType(Integer.class)
59
-    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType}")
60
-    Integer selectUserCount(@Param("personType") String personType);
59
+    @Select("select count(1) from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType}")
60
+    Integer selectUserCount(@Param("org") Integer orgId, @Param("personType") String personType);
61 61
 
62 62
     /**
63 63
      * 总注册数
@@ -65,15 +65,15 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
65 65
      * @return
66 66
      */
67 67
     @ResultType(Integer.class)
68
-    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType} and phone is not null")
69
-    Integer selectRegisteredCount(@Param("personType") String personType);
68
+    @Select("select count(1) from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType} and phone is not null")
69
+    Integer selectRegisteredCount(@Param("org") Integer orgId, @Param("personType") String personType);
70 70
 
71 71
     /**
72 72
      * 根据时间段查询
73 73
      * @param personType
74 74
      * @return
75 75
      */
76
-    Integer selectRecentlyCount(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
76
+    Integer selectRecentlyCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
77 77
 
78 78
     //---------- 用户总数 end ------------
79 79
 
@@ -84,7 +84,8 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
84 84
      * @param endDate
85 85
      * @return
86 86
      */
87
-    List<PersonPO> selectUserBehavior(@Param("personType") String personType,
87
+    List<PersonPO> selectUserBehavior(@Param("org") Integer orgId,
88
+                                      @Param("personType") String personType,
88 89
                                       @Param("startDate")LocalDate startDate,
89 90
                                       @Param("endDate")LocalDate endDate,
90 91
                                       @Param("buildingId") String buildingId,
@@ -98,7 +99,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
98 99
      * @param dateType
99 100
      * @return
100 101
      */
101
-    List<Map<String, Object>> selectActiveUserCount(@Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
102
+    List<Map<String, Object>> selectActiveUserCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("dateType") String dateType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
102 103
 
103 104
     /**
104 105
      * 新增用户数
@@ -107,7 +108,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
107 108
      * @param endDate
108 109
      * @return
109 110
      */
110
-    List<Map<String, Object>> selectNewsUserCount(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
111
+    List<Map<String, Object>> selectNewsUserCount(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
111 112
 
112 113
     /**
113 114
      * 性别比例
@@ -117,8 +118,8 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
117 118
      * @param personType
118 119
      * @return
119 120
      */
120
-    @Select("select count(1) as sex_count from ta_person where ifnull(person_type, '') != #{personType} and gender = #{gender}")
121
-    Integer selectSexUser(@Param("personType") String personType, @Param("gender") Integer gender);
121
+    @Select("select count(1) as sex_count from ta_person where org_id = #{org} AND ifnull(person_type, '') != #{personType} and gender = #{gender}")
122
+    Integer selectSexUser(@Param("org") Integer orgId, @Param("personType") String personType, @Param("gender") Integer gender);
122 123
 
123 124
 
124 125
     /**
@@ -128,12 +129,21 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
128 129
      */
129 130
     @ResultType(Map.class)
130 131
     @Select("SELECT " +
131
-            "ifnull(b.NAME, '其他') AS city, " +
132
-            "count(a.person_id) AS city_count " +
133
-            " FROM" +
134
-            " ta_person a" +
135
-            " LEFT JOIN ( select t.*, s.pinyin as province from td_city t JOIN td_city s on t.parentid = s.id) b ON a.city = b.pinyin and a.province = b.province where ifnull(a.person_type, '') != #{personType} and a.city is not null GROUP BY a.city")
136
-    List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
132
+            " 	a.city as city, " +
133
+            "	b.shortname AS name, " +
134
+            "	b.lng, " +
135
+            "	b.lat, " +
136
+            "	count(a.person_id) AS cityCount " +
137
+            "FROM " +
138
+            "	ta_person a " +
139
+            "inner JOIN td_city b " +
140
+            "on a.city = b.id " +
141
+            "WHERE " +
142
+            "   a.org_id = #{org} " +
143
+            "	AND ifnull(a.person_type, '') != #{personType} " +
144
+            "GROUP BY " +
145
+            "	a.city ")
146
+    List<Map<String, Object>> selectCityUser(@Param("org") Integer orgId, @Param("personType") String personType);
137 147
 
138 148
 
139 149
     // ------------- 用户来源 start ------------
@@ -143,18 +153,18 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
143 153
      * @param recommendPersonType
144 154
      * @return
145 155
      */
146
-    Integer selectUserSourcePie(@Param("recommendPersonType") String recommendPersonType, @Param("personType") String personType);
156
+    Integer selectUserSourcePie(@Param("org") Integer orgId, @Param("recommendPersonType") String recommendPersonType, @Param("personType") String personType);
147 157
 
148 158
     /**
149 159
      * 用户来源 柱状
150 160
      * @return
151 161
      */
152
-    List<Map<String, Object>> selectUserSourceColumnar(@Param("personType") String personType, @Param("startDate") LocalDate startDate, @Param("endDate")LocalDate endDate);
162
+    List<Map<String, Object>> selectUserSourceColumnar(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate") LocalDate startDate, @Param("endDate")LocalDate endDate);
153 163
 
154 164
     /**
155 165
      * 用户来源 数据列表
156 166
      */
157
-    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
167
+    List<Map<String,Object>> selectUserSourceData(@Param("org") Integer orgId, @Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
158 168
 
159 169
     // ------------- 用户来源 end ------------
160 170
 

+ 13
- 12
src/main/java/com/huiju/estateagents/service/IStatisticalService.java Ver fichero

@@ -14,26 +14,26 @@ public interface IStatisticalService {
14 14
      * 首页统计总数
15 15
      * @return
16 16
      */
17
-    ResponseBean indexStatistical();
17
+    ResponseBean indexStatistical(Integer orgId);
18 18
 
19 19
     // ----------------   用户统计 start --------------
20 20
     /**
21 21
      * 用户总数
22 22
      * @return
23 23
      */
24
-    ResponseBean selectUserCount();
24
+    ResponseBean selectUserCount(Integer orgId);
25 25
 
26 26
     /**
27 27
      * 注册数
28 28
      * @return
29 29
      */
30
-    ResponseBean selectRegisteredCount();
30
+    ResponseBean selectRegisteredCount(Integer orgId);
31 31
 
32 32
     /**
33 33
      * 用户最近七天
34 34
      * @return
35 35
      */
36
-    ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate);
36
+    ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate);
37 37
 
38 38
     // ----------------   用户统计 end --------------
39 39
 
@@ -41,19 +41,19 @@ public interface IStatisticalService {
41 41
      * 性别比例
42 42
      * @return
43 43
      */
44
-    ResponseBean selectSexUser();
44
+    ResponseBean selectSexUser(Integer orgId);
45 45
 
46 46
     /**
47 47
      * 城市比例
48 48
      * @return
49 49
      */
50
-    ResponseBean selectCityUser();
50
+    ResponseBean selectCityUser(Integer orgId);
51 51
 
52 52
     /**
53 53
      * 活跃用户数
54 54
      * @return
55 55
      */
56
-    ResponseBean selectActiveUserCount(String dateType, LocalDate startDate, LocalDate endDate);
56
+    ResponseBean selectActiveUserCount(Integer orgId, String dateType, LocalDate startDate, LocalDate endDate);
57 57
 
58 58
     /**
59 59
      * 新增用户数
@@ -61,7 +61,7 @@ public interface IStatisticalService {
61 61
      * @param endDate
62 62
      * @return
63 63
      */
64
-    ResponseBean selectNewsUserCount(LocalDate startDate,LocalDate endDate);
64
+    ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate,LocalDate endDate);
65 65
 
66 66
     /**
67 67
      * 用户行为
@@ -71,6 +71,7 @@ public interface IStatisticalService {
71 71
      */
72 72
     ResponseBean selectUserBehavior(Integer pageNum,
73 73
                                     Integer pageSize,
74
+                                    Integer orgId,
74 75
                                     LocalDate startDate,
75 76
                                     LocalDate endDate,
76 77
                                     String buildingId,
@@ -84,25 +85,25 @@ public interface IStatisticalService {
84 85
      * @param personId
85 86
      * @return
86 87
      */
87
-    ResponseBean selectEventAll(String event, String personId);
88
+    ResponseBean selectEventAll(Integer orgId, String event, String personId);
88 89
 
89 90
     /**
90 91
      * 转换率 统计
91 92
      * @param conversion
92 93
      * @return
93 94
      */
94
-    ResponseBean selectConversion(String conversion);
95
+    ResponseBean selectConversion(Integer orgId, String conversion);
95 96
 
96 97
     /**
97 98
      * 用户来源 首页
98 99
      * @return
99 100
      */
100
-    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate);
101
+    ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate);
101 102
 
102 103
     /**
103 104
      * 意向用户 首页
104 105
      * @param buildingId
105 106
      * @return
106 107
      */
107
-    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId);
108
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId);
108 109
 }

+ 5
- 5
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java Ver fichero

@@ -54,7 +54,7 @@ public interface ITaBuildingService extends IService<TaBuilding> {
54 54
      * @param parameter
55 55
      * @return
56 56
      */
57
-    ResponseBean buildingUpdate(String parameter);
57
+    ResponseBean buildingUpdate(String parameter, Integer orgId);
58 58
 
59 59
     /**
60 60
      *
@@ -68,19 +68,19 @@ public interface ITaBuildingService extends IService<TaBuilding> {
68 68
      * @param parameter
69 69
      * @return
70 70
      */
71
-    ResponseBean buildingAdd(String parameter);
71
+    ResponseBean buildingAdd(String parameter, Integer orgId);
72 72
 
73 73
     /**
74 74
      * 修改成已发布
75 75
      * @return
76 76
      */
77
-    ResponseBean buildingUpdateStatus(String parameter);
77
+    ResponseBean buildingUpdateStatus(String parameter, Integer orgId);
78 78
 
79 79
     /**
80 80
      * 楼盘删除
81 81
      * @return
82 82
      */
83
-    ResponseBean buildingdelete(String id);
83
+    ResponseBean buildingdelete(String id, Integer orgId);
84 84
 
85 85
 
86 86
     /**
@@ -155,7 +155,7 @@ public interface ITaBuildingService extends IService<TaBuilding> {
155 155
      * 查询所有项目
156 156
      * @return
157 157
      */
158
-    ResponseBean buildingAll();
158
+    ResponseBean buildingAll(Integer orgId);
159 159
 
160 160
     Integer getCityById(String buildingId);
161 161
 }

+ 51
- 50
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Ver fichero

@@ -46,33 +46,33 @@ public class StatisticalServiceImpl implements IStatisticalService {
46 46
 
47 47
 
48 48
     @Override
49
-    public ResponseBean indexStatistical() {
49
+    public ResponseBean indexStatistical(Integer orgId) {
50 50
 
51 51
         ResponseBean responseBean = new ResponseBean();
52 52
         Map<String,Object> map = new HashMap<>();
53 53
 
54 54
         // 总用户数
55
-        Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
55
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
56 56
 
57 57
         // 注册数
58
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
58
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
59 59
 
60 60
         // 最近七天
61
-        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
61
+        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
62 62
 
63 63
         // 用户行为
64
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null, null, null, null, null);
64
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null, null, null, null, null);
65 65
 
66 66
         // 用户活跃数
67
-        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
67
+        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
68 68
 
69 69
         // 新增用户数
70
-        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
70
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
71 71
 
72 72
         // 性别比例
73 73
         // 1 男 2 女
74
-        Integer selectSexMale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
75
-        Integer selectSexFemale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
74
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
75
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
76 76
         Map<String, Object> selectSexMaleMap = new HashMap<>();
77 77
         selectSexMaleMap.put("name", "男");
78 78
         selectSexMaleMap.put("value", selectSexMale);
@@ -84,21 +84,21 @@ public class StatisticalServiceImpl implements IStatisticalService {
84 84
         selectSexUser.add(selectSexFemaleMap);
85 85
 
86 86
         // 城市比例
87
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
87
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
88 88
 
89 89
         // 转化率, 当前 默认项目收藏
90
-        Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical("save");
90
+        Map<String, Object> selectBuildingStatistical = taBuildingMapper.selectBuildingStatistical(orgId, "save");
91 91
 
92 92
         // -------  用户来源 start ------------
93 93
 
94 94
         // 用户来源 柱状
95
-        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
95
+        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(orgId, CommConstant.PERSON_REALTY_CONSULTANT, null, null);
96 96
 
97 97
         // 用户来源 饼状
98 98
         // 来源置业顾问, 来源全民经纪人,自由进入
99
-        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
100
-        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
101
-        Integer person_null = taPersonMapper.selectUserSourcePie(null, CommConstant.PERSON_REALTY_CONSULTANT);
99
+        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
100
+        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
101
+        Integer person_null = taPersonMapper.selectUserSourcePie(orgId, null, CommConstant.PERSON_REALTY_CONSULTANT);
102 102
         Map<String, Object> pieMap = new HashMap<>();
103 103
         pieMap.put("person_realty_consultant", person_realty_consultant);
104 104
         pieMap.put("person_estate_agent", person_estate_agent);
@@ -127,7 +127,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
127 127
     }
128 128
 
129 129
     @Override
130
-    public ResponseBean selectActiveUserCount(String dateType, LocalDate startDate, LocalDate endDate) {
130
+    public ResponseBean selectActiveUserCount(Integer orgId, String dateType, LocalDate startDate, LocalDate endDate) {
131 131
         ResponseBean responseBean = new ResponseBean();
132 132
 
133 133
         String type = null;
@@ -142,7 +142,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
142 142
         }
143 143
 
144 144
         // 用户活跃数
145
-        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, type, null, null);
145
+        List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, type, null, null);
146 146
         Map<String, Object> map = new HashMap<>();
147 147
         map.put("selectActiveUserCount", selectActiveUserCount);
148 148
         responseBean.addSuccess(map);
@@ -150,11 +150,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
150 150
     }
151 151
 
152 152
     @Override
153
-    public ResponseBean selectNewsUserCount(LocalDate startDate, LocalDate endDate) {
153
+    public ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
154 154
         ResponseBean responseBean = new ResponseBean();
155 155
 
156 156
         // 新增用户数
157
-        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
157
+        List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
158 158
 
159 159
         Map<String, Object> map = new HashMap<>();
160 160
         map.put("selectNewsUserCount", selectNewsUserCount);
@@ -165,6 +165,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
165 165
     @Override
166 166
     public ResponseBean selectUserBehavior(Integer pageNum,
167 167
                                            Integer pageSize,
168
+                                           Integer orgId,
168 169
                                            LocalDate startDate,
169 170
                                            LocalDate endDate,
170 171
                                            String buildingId,
@@ -174,7 +175,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
174 175
         ResponseBean responseBean = new ResponseBean();
175 176
 
176 177
         // 用户行为
177
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
178
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
178 179
 
179 180
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180 181
         IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
@@ -187,7 +188,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
187 188
     }
188 189
 
189 190
     @Override
190
-    public ResponseBean selectEventAll(String event, String personId) {
191
+    public ResponseBean selectEventAll(Integer orgId, String event, String personId) {
191 192
         ResponseBean responseBean = new ResponseBean();
192 193
 
193 194
         List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
@@ -196,48 +197,48 @@ public class StatisticalServiceImpl implements IStatisticalService {
196 197
     }
197 198
 
198 199
     @Override
199
-    public ResponseBean selectConversion(String conversion) {
200
+    public ResponseBean selectConversion(Integer orgId, String conversion) {
200 201
         ResponseBean responseBean = new ResponseBean();
201 202
         Map<String, Object> result = new HashMap<>();
202 203
 
203 204
         switch (conversion) {
204 205
             case CommConstant.BUILDING_SAVE:
205
-                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical("save");
206
+                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical(orgId, "save");
206 207
                 result.put("data_count", selectBuildingStatisticalSave);
207 208
                 break;
208 209
             case CommConstant.BUILDING_SHARE:
209
-                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical("share");
210
+                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical(orgId,"share");
210 211
                 result.put("data_count", selectBuildingStatisticalShare);
211 212
                 break;
212 213
             case CommConstant.ACTIVITY_SAVE:
213
-                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical("save");
214
+                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "save");
214 215
                 result.put("data_count", selectBuildingDynamicStatisticalSave);
215 216
                 break;
216 217
             case CommConstant.ACTIVITY_SHARE:
217
-                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical("share");
218
+                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "share");
218 219
                 result.put("data_count", selectBuildingDynamicStatisticalShare);
219 220
                 break;
220 221
             case CommConstant.NEWS_SAVE:
221
-                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical("save");
222
+                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical(orgId, "save");
222 223
                 result.put("data_count", selectNewsStatisticalSave);
223 224
                 break;
224 225
 
225 226
             case CommConstant.NEWS_SHARE:
226
-                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical("share");
227
+                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical(orgId, "share");
227 228
                 result.put("data_count", selectNewsStatisticalShare);
228 229
                 break;
229 230
 
230 231
             case CommConstant.ACTIVITY_SIGN:
231
-                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical();
232
+                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical(orgId);
232 233
                 result.put("data_count", selectBuildingDynamicEnlistStatistical);
233 234
                 break;
234 235
 
235 236
             case CommConstant.AUTHORIZATION_PHONE:
236 237
                 // 总用户数
237
-                Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
238
+                Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
238 239
 
239 240
                 // 注册数
240
-                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
241
+                Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
241 242
                 Map<String, Object> userMap = new HashMap<>();
242 243
                 userMap.put("pvNum", selectUserCount);
243 244
                 userMap.put("registeredCount", selectRegisteredCount);
@@ -251,23 +252,23 @@ public class StatisticalServiceImpl implements IStatisticalService {
251 252
 
252 253
 
253 254
     @Override
254
-    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate) {
255
+    public ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate) {
255 256
         ResponseBean responseBean = new ResponseBean();
256 257
         // 用户来源 柱状
257
-        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
258
+        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
258 259
 
259 260
         // 用户来源饼状
260 261
         // 来源置业顾问, 来源全民经纪人,自由进入
261
-        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
262
-        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
263
-        Integer person_null = taPersonMapper.selectUserSourcePie(null, CommConstant.PERSON_REALTY_CONSULTANT);
262
+        Integer person_realty_consultant = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.PERSON_REALTY_CONSULTANT);
263
+        Integer person_estate_agent = taPersonMapper.selectUserSourcePie(orgId, CommConstant.PERSON_ESTATE_AGENT, CommConstant.PERSON_REALTY_CONSULTANT);
264
+        Integer person_null = taPersonMapper.selectUserSourcePie(orgId, null, CommConstant.PERSON_REALTY_CONSULTANT);
264 265
         Map<String, Object> map = new HashMap<>();
265 266
         map.put("person_realty_consultant", person_realty_consultant);
266 267
         map.put("person_estate_agent", person_estate_agent);
267 268
         map.put("person_null", person_null);
268 269
 
269 270
         // 用户来源 数据列表
270
-        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
271
+        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(orgId, CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
271 272
 
272 273
         Map<String, Object> result = new HashMap<>();
273 274
         result.put("columnar", mapList);
@@ -280,10 +281,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
280 281
 
281 282
 
282 283
     @Override
283
-    public ResponseBean selectUserCount() {
284
+    public ResponseBean selectUserCount(Integer orgId) {
284 285
         ResponseBean responseBean = new ResponseBean();
285 286
         // 总用户数
286
-        Integer selectUserCount = taPersonMapper.selectUserCount(CommConstant.PERSON_REALTY_CONSULTANT);
287
+        Integer selectUserCount = taPersonMapper.selectUserCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
287 288
         Map<String, Object> map = new HashMap<>();
288 289
         map.put("selectUserCount", selectUserCount);
289 290
         responseBean.addSuccess(map);
@@ -291,10 +292,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
291 292
     }
292 293
 
293 294
     @Override
294
-    public ResponseBean selectRegisteredCount() {
295
+    public ResponseBean selectRegisteredCount(Integer orgId) {
295 296
         ResponseBean responseBean = new ResponseBean();
296 297
         // 注册数
297
-        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(CommConstant.PERSON_REALTY_CONSULTANT);
298
+        Integer selectRegisteredCount = taPersonMapper.selectRegisteredCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
298 299
         Map<String, Object> map = new HashMap<>();
299 300
         map.put("selectRegisteredCount", selectRegisteredCount);
300 301
         responseBean.addSuccess(map);
@@ -302,10 +303,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
302 303
     }
303 304
 
304 305
     @Override
305
-    public ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate) {
306
+    public ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
306 307
         ResponseBean responseBean = new ResponseBean();
307 308
         // 最近七天
308
-        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
309
+        Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(orgId, CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
309 310
         Map<String, Object> map = new HashMap<>();
310 311
         map.put("selectRecentlyCount", selectRecentlyCount);
311 312
         responseBean.addSuccess(map);
@@ -313,13 +314,13 @@ public class StatisticalServiceImpl implements IStatisticalService {
313 314
     }
314 315
 
315 316
     @Override
316
-    public ResponseBean selectSexUser() {
317
+    public ResponseBean selectSexUser(Integer orgId) {
317 318
         ResponseBean responseBean = new ResponseBean();
318 319
 
319 320
         // 性别比例
320 321
         // 1 男 2 女
321
-        Integer selectSexMale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
322
-        Integer selectSexFemale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
322
+        Integer selectSexMale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
323
+        Integer selectSexFemale = taPersonMapper.selectSexUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
323 324
         Map<String, Object> selectSexMaleMap = new HashMap<>();
324 325
         selectSexMaleMap.put("name", "男");
325 326
         selectSexMaleMap.put("value", selectSexMale);
@@ -337,11 +338,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
337 338
     }
338 339
 
339 340
     @Override
340
-    public ResponseBean selectCityUser() {
341
+    public ResponseBean selectCityUser(Integer orgId) {
341 342
         ResponseBean responseBean = new ResponseBean();
342 343
 
343 344
         // 城市比例
344
-        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
345
+        List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
345 346
         Map<String, Object> map = new HashMap<>();
346 347
         map.put("selectCityUser", selectCityUser);
347 348
         responseBean.addSuccess(map);
@@ -349,11 +350,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
349 350
     }
350 351
 
351 352
     @Override
352
-    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId) {
353
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId) {
353 354
         ResponseBean responseBean = new ResponseBean();
354 355
 
355 356
         IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
356
-        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, buildingId);
357
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId);
357 358
 
358 359
         responseBean.addSuccess(page);
359 360
         return responseBean;

+ 30
- 22
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Ver fichero

@@ -192,30 +192,36 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
192 192
     }
193 193
 
194 194
     @Override
195
-    public ResponseBean buildingUpdate(String parameter) {
195
+    public ResponseBean buildingUpdate(String parameter, Integer orgId) {
196 196
         JSONObject object= JSONObject.parseObject(parameter);
197 197
 
198 198
         TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
199
+
200
+        //图片先删除再添加
199 201
         String imgStr = object.getString("img");
200 202
         List<TaBuildingImg> buildingImgs = JSONObject.parseArray(imgStr, TaBuildingImg.class);
203
+        if (CollectionUtils.isNotEmpty(buildingImgs)) {
204
+            QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
205
+            buildingIdQueryWrapper.eq("building_id", building.getBuildingId());
206
+            taBuildingMapper.update(building,buildingIdQueryWrapper);
207
+            QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
208
+            BuildingImgQueryWrapper.eq("building_id", building.getBuildingId());
209
+            BuildingImgQueryWrapper.eq("img_type", "banner");
210
+            taBuildingImgMapper.delete(BuildingImgQueryWrapper);
211
+            insertImgBatch(buildingImgs, building.getBuildingId());
212
+        }
201 213
 
202
-        //图片先删除再添加
203
-        QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
204
-        buildingIdQueryWrapper.eq("building_id", building.getBuildingId());
205
-        taBuildingMapper.update(building,buildingIdQueryWrapper);
206
-        QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
207
-        BuildingImgQueryWrapper.eq("building_id", building.getBuildingId());
208
-        BuildingImgQueryWrapper.eq("img_type", "banner");
209
-        taBuildingImgMapper.delete(BuildingImgQueryWrapper);
210
-        insertImgBatch(buildingImgs, building.getBuildingId());
211 214
 
212 215
         // tag先删除再增加
213 216
         String tagStr = object.getString("tag");
214 217
         List<TaBuildingTag> buildingTags = JSONObject.parseArray(tagStr, TaBuildingTag.class);
215
-        QueryWrapper<TaBuildingTag> BuildingTagQueryWrapper = new QueryWrapper<>();
216
-        BuildingTagQueryWrapper.eq("building_id", building.getBuildingId());
217
-        taBuildingTagMapper.delete(BuildingTagQueryWrapper);
218
-        insertTagBatch(buildingTags, building.getBuildingId());
218
+        if (CollectionUtils.isNotEmpty(buildingTags)) {
219
+            QueryWrapper<TaBuildingTag> BuildingTagQueryWrapper = new QueryWrapper<>();
220
+            BuildingTagQueryWrapper.eq("building_id", building.getBuildingId());
221
+            taBuildingTagMapper.delete(BuildingTagQueryWrapper);
222
+            insertTagBatch(buildingTags, building.getBuildingId());
223
+        }
224
+
219 225
         if(null != building.getCityId()){
220 226
             TdCity city = tdCityMapper.selectById(building.getCityId());
221 227
             city.setStatus("1");
@@ -227,7 +233,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
227 233
         taBuildingProjectTypeMapper.deleteByBuildingId(building.getBuildingId());
228 234
         JSONArray buildingProjectTypeArray = object.getJSONArray("buildingProjectType");
229 235
         if (CollectionUtils.isNotEmpty(buildingProjectTypeArray)) {
230
-            taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray);
236
+            taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
231 237
         }
232 238
         return ResponseBean.success("");
233 239
     }
@@ -238,7 +244,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
238 244
     }
239 245
 
240 246
     @Override
241
-    public ResponseBean buildingAdd(String parameter) {
247
+    public ResponseBean buildingAdd(String parameter, Integer orgId) {
242 248
         JSONObject object= JSONObject.parseObject(parameter);
243 249
 
244 250
         TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
@@ -247,6 +253,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
247 253
         }
248 254
         building.setCreateDate(LocalDateTime.now());
249 255
         building.setStatus(0);
256
+        building.setOrgId(orgId);
250 257
         if (taBuildingMapper.insert(building) < 1) {
251 258
             return ResponseBean.error("添加项目楼栋失败", ResponseBean.ERROR_UNAVAILABLE);
252 259
         }
@@ -273,23 +280,23 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
273 280
         }
274 281
 
275 282
         // 项目类型
276
-        // 先删除之前关联的
277 283
         JSONArray buildingProjectTypeArray = object.getJSONArray("buildingProjectType");
278 284
         if (CollectionUtils.isNotEmpty(buildingProjectTypeArray)) {
279
-            taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray);
285
+            taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
280 286
         }
281 287
 
282 288
         return ResponseBean.success("");
283 289
     }
284 290
 
285 291
     @Override
286
-    public ResponseBean buildingUpdateStatus(String parameter) {
292
+    public ResponseBean buildingUpdateStatus(String parameter, Integer orgId) {
287 293
         TaBuilding  building = new TaBuilding();
288 294
         JSONObject jsonobject = JSONObject.parseObject(parameter);
289 295
         Integer  status= jsonobject.getInteger("status");
290 296
         String id = jsonobject.getString("id");
291 297
         QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
292 298
         buildingIdQueryWrapper.eq("building_id", id);
299
+        buildingIdQueryWrapper.eq("org_id", orgId);
293 300
         building.setBuildingId(id);
294 301
         building.setStatus(status);
295 302
         taBuildingMapper.update(building,buildingIdQueryWrapper);
@@ -297,7 +304,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
297 304
     }
298 305
 
299 306
     @Override
300
-    public ResponseBean buildingdelete(String id) {
307
+    public ResponseBean buildingdelete(String id, Integer orgId) {
301 308
         TaBuilding  building = new TaBuilding();
302 309
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
303 310
         buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,id);
@@ -308,6 +315,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
308 315
         }
309 316
         QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
310 317
         buildingIdQueryWrapper.eq("building_id", id);
318
+        buildingIdQueryWrapper.eq("org_id", orgId);
311 319
         building.setBuildingId(String.valueOf(id));
312 320
         building.setStatus(-1);
313 321
         taBuildingMapper.update(building,buildingIdQueryWrapper);
@@ -566,8 +574,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
566 574
     }
567 575
 
568 576
     @Override
569
-    public ResponseBean buildingAll() {
570
-        List<TaBuilding> taBuilding= taBuildingMapper.buildingAll();
577
+    public ResponseBean buildingAll(Integer orgId) {
578
+        List<TaBuilding> taBuilding= taBuildingMapper.buildingAll(orgId);
571 579
         return ResponseBean.success(taBuilding);
572 580
     }
573 581
 

+ 2
- 0
src/main/resources/mapper/TaBuildingDynamicMapper.xml Ver fichero

@@ -108,6 +108,7 @@
108 108
                 sum(share_num) as shareNum
109 109
             </if>
110 110
             from ta_building_dynamic
111
+        where org_id = #{orgId}
111 112
     </select>
112 113
 
113 114
     <select id="selectBuildingDynamicEnlistStatistical" resultType="map">
@@ -115,6 +116,7 @@
115 116
         sum(pv_num) as pvNum,
116 117
         IFNULL(sum(enlist_num),0) as enlistNum
117 118
         from ta_building_dynamic
119
+        where org_id = #{orgId}
118 120
     </select>
119 121
 
120 122
 </mapper>

+ 2
- 0
src/main/resources/mapper/TaBuildingMapper.xml Ver fichero

@@ -65,6 +65,7 @@
65 65
     <select id="buildingAll" resultType="com.huiju.estateagents.entity.TaBuilding">
66 66
          SELECT * FROM ta_building
67 67
          where status > -1
68
+         and org_id = #{orgId}
68 69
     </select>
69 70
 
70 71
     <select id="selectBuilding" resultType="com.huiju.estateagents.entity.TaBuilding">
@@ -82,6 +83,7 @@
82 83
               IFNULL(sum(share_num),0) as shareNum
83 84
           </if>
84 85
         from ta_building
86
+        where org_id = ${orgId}
85 87
     </select>
86 88
 
87 89
     <select id="selectBuildingPage" resultType="com.huiju.estateagents.entity.TaBuilding">

+ 1
- 1
src/main/resources/mapper/TaBuildingProjectTypeMapper.xml Ver fichero

@@ -7,7 +7,7 @@
7 7
         (building_id, price, decoration, rights_year, status, building_type_id, building_type_name)
8 8
         values
9 9
         <foreach collection="list" item="item" separator=",">
10
-            (#{item.buildingId}, #{item.price}, #{item.decoration}, #{item.rightsYear}
10
+            (#{buildingId}, #{item.price}, #{item.decoration}, #{item.rightsYear}
11 11
             , #{item.status}, #{item.buildingTypeId}, #{item.buildingTypeName})
12 12
         </foreach>
13 13
     </insert>

+ 1
- 0
src/main/resources/mapper/TaNewsMapper.xml Ver fichero

@@ -13,6 +13,7 @@
13 13
             sum(share_num) as shareNum
14 14
         </if>
15 15
         from ta_news
16
+        where org_id = #{orgId}
16 17
     </select>
17 18
 
18 19
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml Ver fichero

@@ -22,7 +22,7 @@
22 22
             SUM(tpir.intention) as intention
23 23
         FROM
24 24
             ta_person_intention_record tpir
25
-            LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
25
+            LEFT JOIN ta_person tp on tpir.person_id = tp.person_id AND tp.org_id = #{orgId}
26 26
             <where>
27 27
                 <if test="buildingId != null and buildingId != ''">
28 28
                     tpir.building_id = #{buildingId}

+ 12
- 6
src/main/resources/mapper/TaPersonMapper.xml Ver fichero

@@ -150,7 +150,8 @@ FROM
150 150
             COUNT(1) as activity_count
151 151
         FROM
152 152
         ta_person tp
153
-        where ifnull(tp.person_type, '') != #{personType}
153
+        where tp.org_id = #{org} AND
154
+          ifnull(tp.person_type, '') != #{personType}
154 155
 
155 156
         <if test="startDate != null or endDate != null">
156 157
             AND  tp.create_date BETWEEN #{startDate} and #{endDate}
@@ -189,7 +190,7 @@ FROM
189 190
             FROM
190 191
               ta_person tp
191 192
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
192
-            where ifnull(tp.person_type, '') != #{personType}
193
+            where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
193 194
             <if test="buildingId != null and buildingId != ''">
194 195
                 and tpvr.building_id = #{buildingId}
195 196
             </if>
@@ -247,7 +248,7 @@ FROM
247 248
              LEFT JOIN
248 249
             ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
249 250
             ON tp.person_id = tpvr.person_id
250
-             where ifnull(tp.person_type, '') != #{personType}
251
+             where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
251 252
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
252 253
         ) AS temp ON
253 254
         <if test="dateType == 'month'.toString()">
@@ -328,7 +329,7 @@ FROM
328 329
                     tp.create_date as create_date
329 330
                 FROM
330 331
                  ta_person tp
331
-                where ifnull(tp.person_type, '') != #{personType}
332
+                where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
332 333
                 <if test="startDate != null or endDate != null">
333 334
                     AND tp.create_date BETWEEN #{startDate} and #{endDate}
334 335
                 </if>
@@ -348,7 +349,8 @@ FROM
348 349
     <select id="selectUserSourcePie" resultType="integer">
349 350
         select count(1)
350 351
         FROM ta_person
351
-        WHERE ifnull(person_type, '') != #{personType}
352
+        WHERE org_id = #{org} AND
353
+          ifnull(person_type, '') != #{personType}
352 354
         <if test="recommendPersonType != null and recommendPersonType != ''">
353 355
             and recommend_person_type = #{recommendPersonType}
354 356
         </if>
@@ -364,6 +366,7 @@ FROM
364 366
             LEFT JOIN td_person_from tpfs
365 367
             ON tps.from_code = tpfs.from_code
366 368
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
369
+            AND tps.org_id = #{org}
367 370
             and ifnull(tps.person_type, '') != #{personType}
368 371
             <if test="startDate != null or endDate != null">
369 372
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
@@ -379,6 +382,7 @@ FROM
379 382
             LEFT JOIN td_person_from tpfs
380 383
             ON tps.from_code = tpfs.from_code
381 384
             WHERE tpfs.from_code = tpf.from_code
385
+            AND tps.org_id = #{org}
382 386
             and ifnull(tps.person_type, '') != #{personType}
383 387
             <if test="startDate != null or endDate != null">
384 388
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
@@ -391,7 +395,7 @@ FROM
391 395
         FROM td_person_from tpf
392 396
         LEFT JOIN ta_person tp
393 397
         ON tp.from_code = tpf.from_code
394
-        where ifnull(tp.person_type, '') != #{personType}
398
+        where tp.org_id = #{org} AND ifnull(tp.person_type, '') != #{personType}
395 399
         GROUP BY tpf.from_code
396 400
     </select>
397 401
 
@@ -434,6 +438,7 @@ FROM
434 438
             LEFT JOIN td_person_from tpfs
435 439
             ON tps.from_code = tpfs.from_code
436 440
             WHERE tpfs.from_code = tps.from_code
441
+            AND tps.org_id = #{org}
437 442
             and ifnull(tps.person_type, '') != 'Realty Consultant'
438 443
             AND tps.create_date BETWEEN #{startDate} AND #{endDate}
439 444
 
@@ -451,6 +456,7 @@ FROM
451 456
             LEFT JOIN td_person_from tpfs
452 457
             ON tps.from_code = tpfs.from_code
453 458
             WHERE tpfs.from_code = tps.from_code
459
+                AND tps.org_id = #{org}
454 460
                 and ifnull(tps.person_type, '') != 'Realty Consultant'
455 461
                 AND tps.create_date BETWEEN #{startDate} AND #{endDate}
456 462
                 and tps.phone is not null