dingxin 5 years ago
parent
commit
2bea420930
21 changed files with 244 additions and 180 deletions
  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 View File

1
 package com.huiju.estateagents.controller;
1
 package com.huiju.estateagents.controller;
2
 
2
 
3
+import com.huiju.estateagents.base.BaseController;
3
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.service.IStatisticalService;
5
 import com.huiju.estateagents.service.IStatisticalService;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.format.annotation.DateTimeFormat;
7
 import org.springframework.format.annotation.DateTimeFormat;
7
 import org.springframework.web.bind.annotation.*;
8
 import org.springframework.web.bind.annotation.*;
8
 
9
 
10
+import javax.servlet.http.HttpServletRequest;
9
 import java.time.LocalDate;
11
 import java.time.LocalDate;
10
-import java.util.Date;
11
 
12
 
12
 /**
13
 /**
13
  * 数据统计
14
  * 数据统计
14
  */
15
  */
15
 @RestController
16
 @RestController
16
 @RequestMapping("/api")
17
 @RequestMapping("/api")
17
-public class StatisticalController {
18
+public class StatisticalController extends BaseController {
18
 
19
 
19
     @Autowired
20
     @Autowired
20
     private IStatisticalService iStatisticalService;
21
     private IStatisticalService iStatisticalService;
24
      * @return
25
      * @return
25
      */
26
      */
26
     @GetMapping(value = "/admin/indexStatistical")
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
     @GetMapping(value = "/admin/selectActiveUserCount")
36
     @GetMapping(value = "/admin/selectActiveUserCount")
36
     public ResponseBean selectActiveUserCount(@RequestParam String dateType,
37
     public ResponseBean selectActiveUserCount(@RequestParam String dateType,
37
                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
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
      */
47
      */
46
     @GetMapping(value = "/admin/selectNewsUserCount")
48
     @GetMapping(value = "/admin/selectNewsUserCount")
47
     public ResponseBean selectNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
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
      * @return
57
      * @return
55
      */
58
      */
56
     @GetMapping(value = "/admin/selectConversion")
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
                                            @RequestParam(value = "buildingId", required = false) String buildingId,
74
                                            @RequestParam(value = "buildingId", required = false) String buildingId,
71
                                            @RequestParam(value = "eventType", required = false) String eventType,
75
                                            @RequestParam(value = "eventType", required = false) String eventType,
72
                                            @RequestParam(value = "event", required = false) String event,
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
      */
85
      */
81
     @GetMapping(value = "/admin/selectEventAll")
86
     @GetMapping(value = "/admin/selectEventAll")
82
     public ResponseBean selectEventAll(@RequestParam(required = false) String event,
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
      */
97
      */
92
     @GetMapping(value = "/admin/selectUserResource")
98
     @GetMapping(value = "/admin/selectUserResource")
93
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
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
      * @return
108
      * @return
102
      */
109
      */
103
     @GetMapping(value = "/admin/selectUserCount")
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
      * @return
117
      * @return
111
      */
118
      */
112
     @GetMapping(value = "/admin/selectRegisteredCount")
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
      */
127
      */
121
     @GetMapping(value = "/admin/selectRecentlyCount")
128
     @GetMapping(value = "/admin/selectRecentlyCount")
122
     public ResponseBean selectRecentlyCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
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
      * @return
137
      * @return
130
      */
138
      */
131
     @GetMapping(value = "/admin/selectSexUser")
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
      * @return
146
      * @return
139
      */
147
      */
140
     @GetMapping(value = "/admin/selectCityUser")
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
     @GetMapping(value = "/admin/selectIntentionUser")
158
     @GetMapping(value = "/admin/selectIntentionUser")
150
     public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
159
     public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
151
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
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 View File

75
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
75
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
76
                                      @RequestParam(value = "cityId",required = false)Integer cityId,
76
                                      @RequestParam(value = "cityId",required = false)Integer cityId,
77
                                      @RequestParam(value = "isMain",required = false)Integer isMain,
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
                                      @RequestParam(value = "buildingStatus",required = false)String buildingStatus,
96
                                      @RequestParam(value = "buildingStatus",required = false)String buildingStatus,
97
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
97
                                      @RequestParam(value = "marketStatus",required = false)String marketStatus,
98
                                      @RequestParam(value = "cityId",required = false)Integer cityId,
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
      * @return
107
      * @return
108
      */
108
      */
109
     @PutMapping("/admin/building/update")
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
      * @return
117
      * @return
118
      */
118
      */
119
     @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
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
      * @return
127
      * @return
128
      */
128
      */
129
     @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
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
      * @param id
136
      * @param id
137
-     * @param session
137
+     * @param request
138
      * @return
138
      * @return
139
      */
139
      */
140
     @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
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
      * 查询当前所有项目
284
      * 查询当前所有项目
285
      */
285
      */
286
     @RequestMapping(value = "/admin/buildingAll", method = RequestMethod.GET)
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
         return taBuilding;
289
         return taBuilding;
290
     }
290
     }
291
 }
291
 }

+ 21
- 5
src/main/java/com/huiju/estateagents/controller/TaPersonController.java View File

416
         return taPersonService.editConsultant(id, paramStr);
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
         ResponseBean responseBean = new ResponseBean();
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
         try{
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
             }else {
440
             }else {
427
                 responseBean.addError("fail");
441
                 responseBean.addError("fail");
428
             }
442
             }
563
 
577
 
564
         return ResponseBean.success(taPerson);
578
         return ResponseBean.success(taPerson);
565
     }
579
     }
580
+
566
     
581
     
567
     /**
582
     /**
568
      * 微信添加人员添加城市
583
      * 微信添加人员添加城市
594
         responseBean.addError("未找到城市");
609
         responseBean.addError("未找到城市");
595
         return responseBean;
610
         return responseBean;
596
     }
611
     }
612
+
597
 }
613
 }

+ 5
- 5
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java View File

336
      * @param taRecommendCustomer 实体对象
336
      * @param taRecommendCustomer 实体对象
337
      * @return
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
                                         @RequestBody TaRecommendCustomer taRecommendCustomer){
341
                                         @RequestBody TaRecommendCustomer taRecommendCustomer){
342
         ResponseBean responseBean = new ResponseBean();
342
         ResponseBean responseBean = new ResponseBean();
343
-        taRecommendCustomer.setCustomerId(id);
343
+        taRecommendCustomer.setCustomerId(customerId);
344
         try {
344
         try {
345
             if (taRecommendCustomerService.updateById(taRecommendCustomer)){
345
             if (taRecommendCustomerService.updateById(taRecommendCustomer)){
346
                 responseBean.addSuccess(taRecommendCustomer);
346
                 responseBean.addSuccess(taRecommendCustomer);
399
 //        return responseBean;
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
         ResponseBean responseBean = new ResponseBean();
404
         ResponseBean responseBean = new ResponseBean();
405
         try {
405
         try {
406
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
406
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));

+ 10
- 3
src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java View File

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

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java View File

63
      * 转化率 活动收藏 / 活动分享
63
      * 转化率 活动收藏 / 活动分享
64
      * @return
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
      * @return
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 View File

41
     @Update("UPDATE ta_building  SET ${field} = IFNULL(${field}, 0) + #{increment}  WHERE building_id = #{buildingId}")
41
     @Update("UPDATE ta_building  SET ${field} = IFNULL(${field}, 0) + #{increment}  WHERE building_id = #{buildingId}")
42
     void setFieldNum(@Param("buildingId") String buildingId, @Param("field") String field, @Param("increment") int increment);
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
      * 转化率 项目收藏 / 项目分享
54
      * 转化率 项目收藏 / 项目分享
55
      * @return
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 View File

32
      * 批量添加
32
      * 批量添加
33
      * @param list
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 View File

33
      * 转化率 咨迅收藏 / 咨迅分享
33
      * 转化率 咨迅收藏 / 咨迅分享
34
      * @return
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 View File

29
      * @param buildingId
29
      * @param buildingId
30
      * @return
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 View File

56
      * @return
56
      * @return
57
      */
57
      */
58
     @ResultType(Integer.class)
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
      * @return
65
      * @return
66
      */
66
      */
67
     @ResultType(Integer.class)
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
      * @param personType
73
      * @param personType
74
      * @return
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
     //---------- 用户总数 end ------------
78
     //---------- 用户总数 end ------------
79
 
79
 
84
      * @param endDate
84
      * @param endDate
85
      * @return
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
                                       @Param("startDate")LocalDate startDate,
89
                                       @Param("startDate")LocalDate startDate,
89
                                       @Param("endDate")LocalDate endDate,
90
                                       @Param("endDate")LocalDate endDate,
90
                                       @Param("buildingId") String buildingId,
91
                                       @Param("buildingId") String buildingId,
98
      * @param dateType
99
      * @param dateType
99
      * @return
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
      * @param endDate
108
      * @param endDate
108
      * @return
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
      * @param personType
118
      * @param personType
118
      * @return
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
      */
129
      */
129
     @ResultType(Map.class)
130
     @ResultType(Map.class)
130
     @Select("SELECT " +
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
     // ------------- 用户来源 start ------------
149
     // ------------- 用户来源 start ------------
143
      * @param recommendPersonType
153
      * @param recommendPersonType
144
      * @return
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
      * @return
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
     // ------------- 用户来源 end ------------
169
     // ------------- 用户来源 end ------------
160
 
170
 

+ 13
- 12
src/main/java/com/huiju/estateagents/service/IStatisticalService.java View File

14
      * 首页统计总数
14
      * 首页统计总数
15
      * @return
15
      * @return
16
      */
16
      */
17
-    ResponseBean indexStatistical();
17
+    ResponseBean indexStatistical(Integer orgId);
18
 
18
 
19
     // ----------------   用户统计 start --------------
19
     // ----------------   用户统计 start --------------
20
     /**
20
     /**
21
      * 用户总数
21
      * 用户总数
22
      * @return
22
      * @return
23
      */
23
      */
24
-    ResponseBean selectUserCount();
24
+    ResponseBean selectUserCount(Integer orgId);
25
 
25
 
26
     /**
26
     /**
27
      * 注册数
27
      * 注册数
28
      * @return
28
      * @return
29
      */
29
      */
30
-    ResponseBean selectRegisteredCount();
30
+    ResponseBean selectRegisteredCount(Integer orgId);
31
 
31
 
32
     /**
32
     /**
33
      * 用户最近七天
33
      * 用户最近七天
34
      * @return
34
      * @return
35
      */
35
      */
36
-    ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate);
36
+    ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate);
37
 
37
 
38
     // ----------------   用户统计 end --------------
38
     // ----------------   用户统计 end --------------
39
 
39
 
41
      * 性别比例
41
      * 性别比例
42
      * @return
42
      * @return
43
      */
43
      */
44
-    ResponseBean selectSexUser();
44
+    ResponseBean selectSexUser(Integer orgId);
45
 
45
 
46
     /**
46
     /**
47
      * 城市比例
47
      * 城市比例
48
      * @return
48
      * @return
49
      */
49
      */
50
-    ResponseBean selectCityUser();
50
+    ResponseBean selectCityUser(Integer orgId);
51
 
51
 
52
     /**
52
     /**
53
      * 活跃用户数
53
      * 活跃用户数
54
      * @return
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
      * @param endDate
61
      * @param endDate
62
      * @return
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
      */
71
      */
72
     ResponseBean selectUserBehavior(Integer pageNum,
72
     ResponseBean selectUserBehavior(Integer pageNum,
73
                                     Integer pageSize,
73
                                     Integer pageSize,
74
+                                    Integer orgId,
74
                                     LocalDate startDate,
75
                                     LocalDate startDate,
75
                                     LocalDate endDate,
76
                                     LocalDate endDate,
76
                                     String buildingId,
77
                                     String buildingId,
84
      * @param personId
85
      * @param personId
85
      * @return
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
      * @param conversion
92
      * @param conversion
92
      * @return
93
      * @return
93
      */
94
      */
94
-    ResponseBean selectConversion(String conversion);
95
+    ResponseBean selectConversion(Integer orgId, String conversion);
95
 
96
 
96
     /**
97
     /**
97
      * 用户来源 首页
98
      * 用户来源 首页
98
      * @return
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
      * @param buildingId
105
      * @param buildingId
105
      * @return
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 View File

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

+ 51
- 50
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java View File

46
 
46
 
47
 
47
 
48
     @Override
48
     @Override
49
-    public ResponseBean indexStatistical() {
49
+    public ResponseBean indexStatistical(Integer orgId) {
50
 
50
 
51
         ResponseBean responseBean = new ResponseBean();
51
         ResponseBean responseBean = new ResponseBean();
52
         Map<String,Object> map = new HashMap<>();
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
         // 1 男 2 女
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
         Map<String, Object> selectSexMaleMap = new HashMap<>();
76
         Map<String, Object> selectSexMaleMap = new HashMap<>();
77
         selectSexMaleMap.put("name", "男");
77
         selectSexMaleMap.put("name", "男");
78
         selectSexMaleMap.put("value", selectSexMale);
78
         selectSexMaleMap.put("value", selectSexMale);
84
         selectSexUser.add(selectSexFemaleMap);
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
         // -------  用户来源 start ------------
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
         Map<String, Object> pieMap = new HashMap<>();
102
         Map<String, Object> pieMap = new HashMap<>();
103
         pieMap.put("person_realty_consultant", person_realty_consultant);
103
         pieMap.put("person_realty_consultant", person_realty_consultant);
104
         pieMap.put("person_estate_agent", person_estate_agent);
104
         pieMap.put("person_estate_agent", person_estate_agent);
127
     }
127
     }
128
 
128
 
129
     @Override
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
         ResponseBean responseBean = new ResponseBean();
131
         ResponseBean responseBean = new ResponseBean();
132
 
132
 
133
         String type = null;
133
         String type = null;
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
         Map<String, Object> map = new HashMap<>();
146
         Map<String, Object> map = new HashMap<>();
147
         map.put("selectActiveUserCount", selectActiveUserCount);
147
         map.put("selectActiveUserCount", selectActiveUserCount);
148
         responseBean.addSuccess(map);
148
         responseBean.addSuccess(map);
150
     }
150
     }
151
 
151
 
152
     @Override
152
     @Override
153
-    public ResponseBean selectNewsUserCount(LocalDate startDate, LocalDate endDate) {
153
+    public ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
154
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
159
         Map<String, Object> map = new HashMap<>();
160
         map.put("selectNewsUserCount", selectNewsUserCount);
160
         map.put("selectNewsUserCount", selectNewsUserCount);
165
     @Override
165
     @Override
166
     public ResponseBean selectUserBehavior(Integer pageNum,
166
     public ResponseBean selectUserBehavior(Integer pageNum,
167
                                            Integer pageSize,
167
                                            Integer pageSize,
168
+                                           Integer orgId,
168
                                            LocalDate startDate,
169
                                            LocalDate startDate,
169
                                            LocalDate endDate,
170
                                            LocalDate endDate,
170
                                            String buildingId,
171
                                            String buildingId,
174
         ResponseBean responseBean = new ResponseBean();
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
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180
         IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
181
         IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
187
     }
188
     }
188
 
189
 
189
     @Override
190
     @Override
190
-    public ResponseBean selectEventAll(String event, String personId) {
191
+    public ResponseBean selectEventAll(Integer orgId, String event, String personId) {
191
         ResponseBean responseBean = new ResponseBean();
192
         ResponseBean responseBean = new ResponseBean();
192
 
193
 
193
         List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
194
         List<TaPersonVisitRecord> taPersonVisitRecords = taPersonVisitRecordMapper.selectEventAll(event, personId);
196
     }
197
     }
197
 
198
 
198
     @Override
199
     @Override
199
-    public ResponseBean selectConversion(String conversion) {
200
+    public ResponseBean selectConversion(Integer orgId, String conversion) {
200
         ResponseBean responseBean = new ResponseBean();
201
         ResponseBean responseBean = new ResponseBean();
201
         Map<String, Object> result = new HashMap<>();
202
         Map<String, Object> result = new HashMap<>();
202
 
203
 
203
         switch (conversion) {
204
         switch (conversion) {
204
             case CommConstant.BUILDING_SAVE:
205
             case CommConstant.BUILDING_SAVE:
205
-                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical("save");
206
+                Map<String, Object> selectBuildingStatisticalSave = taBuildingMapper.selectBuildingStatistical(orgId, "save");
206
                 result.put("data_count", selectBuildingStatisticalSave);
207
                 result.put("data_count", selectBuildingStatisticalSave);
207
                 break;
208
                 break;
208
             case CommConstant.BUILDING_SHARE:
209
             case CommConstant.BUILDING_SHARE:
209
-                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical("share");
210
+                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical(orgId,"share");
210
                 result.put("data_count", selectBuildingStatisticalShare);
211
                 result.put("data_count", selectBuildingStatisticalShare);
211
                 break;
212
                 break;
212
             case CommConstant.ACTIVITY_SAVE:
213
             case CommConstant.ACTIVITY_SAVE:
213
-                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical("save");
214
+                Map<String, Object> selectBuildingDynamicStatisticalSave = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "save");
214
                 result.put("data_count", selectBuildingDynamicStatisticalSave);
215
                 result.put("data_count", selectBuildingDynamicStatisticalSave);
215
                 break;
216
                 break;
216
             case CommConstant.ACTIVITY_SHARE:
217
             case CommConstant.ACTIVITY_SHARE:
217
-                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical("share");
218
+                Map<String, Object> selectBuildingDynamicStatisticalShare = taBuildingDynamicMapper.selectBuildingDynamicStatistical(orgId, "share");
218
                 result.put("data_count", selectBuildingDynamicStatisticalShare);
219
                 result.put("data_count", selectBuildingDynamicStatisticalShare);
219
                 break;
220
                 break;
220
             case CommConstant.NEWS_SAVE:
221
             case CommConstant.NEWS_SAVE:
221
-                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical("save");
222
+                Map<String, Object> selectNewsStatisticalSave = taNewsMapper.selectNewsStatistical(orgId, "save");
222
                 result.put("data_count", selectNewsStatisticalSave);
223
                 result.put("data_count", selectNewsStatisticalSave);
223
                 break;
224
                 break;
224
 
225
 
225
             case CommConstant.NEWS_SHARE:
226
             case CommConstant.NEWS_SHARE:
226
-                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical("share");
227
+                Map<String, Object> selectNewsStatisticalShare = taNewsMapper.selectNewsStatistical(orgId, "share");
227
                 result.put("data_count", selectNewsStatisticalShare);
228
                 result.put("data_count", selectNewsStatisticalShare);
228
                 break;
229
                 break;
229
 
230
 
230
             case CommConstant.ACTIVITY_SIGN:
231
             case CommConstant.ACTIVITY_SIGN:
231
-                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical();
232
+                Map<String, Object> selectBuildingDynamicEnlistStatistical = taBuildingDynamicMapper.selectBuildingDynamicEnlistStatistical(orgId);
232
                 result.put("data_count", selectBuildingDynamicEnlistStatistical);
233
                 result.put("data_count", selectBuildingDynamicEnlistStatistical);
233
                 break;
234
                 break;
234
 
235
 
235
             case CommConstant.AUTHORIZATION_PHONE:
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
                 Map<String, Object> userMap = new HashMap<>();
242
                 Map<String, Object> userMap = new HashMap<>();
242
                 userMap.put("pvNum", selectUserCount);
243
                 userMap.put("pvNum", selectUserCount);
243
                 userMap.put("registeredCount", selectRegisteredCount);
244
                 userMap.put("registeredCount", selectRegisteredCount);
251
 
252
 
252
 
253
 
253
     @Override
254
     @Override
254
-    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate) {
255
+    public ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate) {
255
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
265
         Map<String, Object> map = new HashMap<>();
265
         map.put("person_realty_consultant", person_realty_consultant);
266
         map.put("person_realty_consultant", person_realty_consultant);
266
         map.put("person_estate_agent", person_estate_agent);
267
         map.put("person_estate_agent", person_estate_agent);
267
         map.put("person_null", person_null);
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
         Map<String, Object> result = new HashMap<>();
273
         Map<String, Object> result = new HashMap<>();
273
         result.put("columnar", mapList);
274
         result.put("columnar", mapList);
280
 
281
 
281
 
282
 
282
     @Override
283
     @Override
283
-    public ResponseBean selectUserCount() {
284
+    public ResponseBean selectUserCount(Integer orgId) {
284
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
288
         Map<String, Object> map = new HashMap<>();
288
         map.put("selectUserCount", selectUserCount);
289
         map.put("selectUserCount", selectUserCount);
289
         responseBean.addSuccess(map);
290
         responseBean.addSuccess(map);
291
     }
292
     }
292
 
293
 
293
     @Override
294
     @Override
294
-    public ResponseBean selectRegisteredCount() {
295
+    public ResponseBean selectRegisteredCount(Integer orgId) {
295
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
299
         Map<String, Object> map = new HashMap<>();
299
         map.put("selectRegisteredCount", selectRegisteredCount);
300
         map.put("selectRegisteredCount", selectRegisteredCount);
300
         responseBean.addSuccess(map);
301
         responseBean.addSuccess(map);
302
     }
303
     }
303
 
304
 
304
     @Override
305
     @Override
305
-    public ResponseBean selectRecentlyCount(LocalDate startDate, LocalDate endDate) {
306
+    public ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
306
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
310
         Map<String, Object> map = new HashMap<>();
310
         map.put("selectRecentlyCount", selectRecentlyCount);
311
         map.put("selectRecentlyCount", selectRecentlyCount);
311
         responseBean.addSuccess(map);
312
         responseBean.addSuccess(map);
313
     }
314
     }
314
 
315
 
315
     @Override
316
     @Override
316
-    public ResponseBean selectSexUser() {
317
+    public ResponseBean selectSexUser(Integer orgId) {
317
         ResponseBean responseBean = new ResponseBean();
318
         ResponseBean responseBean = new ResponseBean();
318
 
319
 
319
         // 性别比例
320
         // 性别比例
320
         // 1 男 2 女
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
         Map<String, Object> selectSexMaleMap = new HashMap<>();
324
         Map<String, Object> selectSexMaleMap = new HashMap<>();
324
         selectSexMaleMap.put("name", "男");
325
         selectSexMaleMap.put("name", "男");
325
         selectSexMaleMap.put("value", selectSexMale);
326
         selectSexMaleMap.put("value", selectSexMale);
337
     }
338
     }
338
 
339
 
339
     @Override
340
     @Override
340
-    public ResponseBean selectCityUser() {
341
+    public ResponseBean selectCityUser(Integer orgId) {
341
         ResponseBean responseBean = new ResponseBean();
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
         Map<String, Object> map = new HashMap<>();
346
         Map<String, Object> map = new HashMap<>();
346
         map.put("selectCityUser", selectCityUser);
347
         map.put("selectCityUser", selectCityUser);
347
         responseBean.addSuccess(map);
348
         responseBean.addSuccess(map);
349
     }
350
     }
350
 
351
 
351
     @Override
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
         ResponseBean responseBean = new ResponseBean();
354
         ResponseBean responseBean = new ResponseBean();
354
 
355
 
355
         IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
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
         responseBean.addSuccess(page);
359
         responseBean.addSuccess(page);
359
         return responseBean;
360
         return responseBean;

+ 30
- 22
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java View File

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

+ 2
- 0
src/main/resources/mapper/TaBuildingDynamicMapper.xml View File

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

+ 2
- 0
src/main/resources/mapper/TaBuildingMapper.xml View File

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

+ 1
- 1
src/main/resources/mapper/TaBuildingProjectTypeMapper.xml View File

7
         (building_id, price, decoration, rights_year, status, building_type_id, building_type_name)
7
         (building_id, price, decoration, rights_year, status, building_type_id, building_type_name)
8
         values
8
         values
9
         <foreach collection="list" item="item" separator=",">
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
             , #{item.status}, #{item.buildingTypeId}, #{item.buildingTypeName})
11
             , #{item.status}, #{item.buildingTypeId}, #{item.buildingTypeName})
12
         </foreach>
12
         </foreach>
13
     </insert>
13
     </insert>

+ 1
- 0
src/main/resources/mapper/TaNewsMapper.xml View File

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

+ 1
- 1
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml View File

22
             SUM(tpir.intention) as intention
22
             SUM(tpir.intention) as intention
23
         FROM
23
         FROM
24
             ta_person_intention_record tpir
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
             <where>
26
             <where>
27
                 <if test="buildingId != null and buildingId != ''">
27
                 <if test="buildingId != null and buildingId != ''">
28
                     tpir.building_id = #{buildingId}
28
                     tpir.building_id = #{buildingId}

+ 12
- 6
src/main/resources/mapper/TaPersonMapper.xml View File

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