Browse Source

Merge branch 'dev'

# Conflicts:
#	src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
weichaochao 5 years ago
parent
commit
e1b54f49ad
61 changed files with 2645 additions and 447 deletions
  1. 1
    1
      pom.xml
  2. 12
    0
      src/main/java/com/huiju/estateagents/common/CommConstant.java
  3. 58
    2
      src/main/java/com/huiju/estateagents/common/DateUtils.java
  4. 1
    1
      src/main/java/com/huiju/estateagents/controller/CommonController.java
  5. 50
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingApartmentController.java
  6. 13
    4
      src/main/java/com/huiju/estateagents/controller/TaBuildingBlockController.java
  7. 58
    41
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  8. 15
    4
      src/main/java/com/huiju/estateagents/controller/TaBuildingFloorController.java
  9. 143
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingTermController.java
  10. 14
    4
      src/main/java/com/huiju/estateagents/controller/TaBuildingUnitController.java
  11. 171
    29
      src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java
  12. 3
    0
      src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java
  13. 35
    28
      src/main/java/com/huiju/estateagents/controller/TaPreselectionRecordController.java
  14. 134
    40
      src/main/java/com/huiju/estateagents/controller/TaSalesBatchController.java
  15. 1
    1
      src/main/java/com/huiju/estateagents/controller/TaShareController.java
  16. 24
    0
      src/main/java/com/huiju/estateagents/controller/TaSharePersonFromController.java
  17. 4
    1
      src/main/java/com/huiju/estateagents/entity/TaBuilding.java
  18. 7
    2
      src/main/java/com/huiju/estateagents/entity/TaBuildingBlock.java
  19. 7
    2
      src/main/java/com/huiju/estateagents/entity/TaBuildingFloor.java
  20. 7
    2
      src/main/java/com/huiju/estateagents/entity/TaBuildingRoom.java
  21. 64
    0
      src/main/java/com/huiju/estateagents/entity/TaBuildingTerm.java
  22. 7
    2
      src/main/java/com/huiju/estateagents/entity/TaBuildingUnit.java
  23. 2
    0
      src/main/java/com/huiju/estateagents/entity/TaConsultantInfo.java
  24. 24
    5
      src/main/java/com/huiju/estateagents/entity/TaHousingResources.java
  25. 4
    0
      src/main/java/com/huiju/estateagents/entity/TaPoster.java
  26. 8
    0
      src/main/java/com/huiju/estateagents/entity/TaPreselectionRecord.java
  27. 12
    0
      src/main/java/com/huiju/estateagents/entity/TaSalesBatch.java
  28. 17
    0
      src/main/java/com/huiju/estateagents/entity/TaSharePersonFrom.java
  29. 18
    0
      src/main/java/com/huiju/estateagents/mapper/TaBuildingTermMapper.java
  30. 32
    6
      src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java
  31. 25
    1
      src/main/java/com/huiju/estateagents/mapper/TaPreselectionRecordMapper.java
  32. 22
    0
      src/main/java/com/huiju/estateagents/mapper/TaSalesBatchMapper.java
  33. 4
    0
      src/main/java/com/huiju/estateagents/mapper/TaSharePersonFromMapper.java
  34. 31
    0
      src/main/java/com/huiju/estateagents/po/BuildingImgPO.java
  35. 15
    6
      src/main/java/com/huiju/estateagents/po/TaHousingResourcesPO.java
  36. 65
    0
      src/main/java/com/huiju/estateagents/po/TaPreselectionRecordPO.java
  37. 16
    0
      src/main/java/com/huiju/estateagents/service/ITaBuildingTermService.java
  38. 71
    16
      src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java
  39. 5
    11
      src/main/java/com/huiju/estateagents/service/ITaPreselectionRecordService.java
  40. 21
    0
      src/main/java/com/huiju/estateagents/service/ITaSalesBatchService.java
  41. 2
    0
      src/main/java/com/huiju/estateagents/service/ITaSharePersonFromService.java
  42. 3
    3
      src/main/java/com/huiju/estateagents/service/impl/HelpRecordServiceImpl.java
  43. 96
    83
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  44. 20
    0
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingTermServiceImpl.java
  45. 678
    36
      src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java
  46. 6
    2
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  47. 79
    13
      src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java
  48. 1
    1
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  49. 161
    2
      src/main/java/com/huiju/estateagents/service/impl/TaSalesBatchServiceImpl.java
  50. 19
    0
      src/main/java/com/huiju/estateagents/service/impl/TaSharePersonFromServiceImpl.java
  51. 3
    3
      src/main/java/com/huiju/estateagents/service/impl/TaShareServiceImpl.java
  52. 5
    0
      src/main/resources/mapper/TaBuildingTermMapper.xml
  53. 177
    68
      src/main/resources/mapper/TaHousingResourcesMapper.xml
  54. 1
    1
      src/main/resources/mapper/TaPersonMapper.xml
  55. 20
    0
      src/main/resources/mapper/TaPersonVisitRecordMapper.xml
  56. 67
    7
      src/main/resources/mapper/TaPreselectionRecordMapper.xml
  57. 13
    12
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  58. 29
    1
      src/main/resources/mapper/TaSalesBatchMapper.xml
  59. 9
    5
      src/main/resources/mapper/TaShareCountMapper.xml
  60. 4
    1
      src/main/resources/mapper/TaShareMapper.xml
  61. 31
    0
      src/main/resources/mapper/TaSharePersonFromMapper.xml

+ 1
- 1
pom.xml View File

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

+ 12
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java View File

@@ -441,6 +441,7 @@ public class CommConstant {
441 441
 	public static final String TARGET_TYPE_H5 = "H5";
442 442
     public static final String ACTIVITY_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/checkin/index\"}";
443 443
     public static final String DRAINAGE_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/project/h5Page\"}";
444
+    public static final String HOUSE_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"onlineSelling/pages/houseList/index\"}";
444 445
     
445 446
     /**
446 447
      * 消息通知
@@ -517,6 +518,11 @@ public class CommConstant {
517 518
      */
518 519
     public static final String EVENT_H5 = "h5";
519 520
 
521
+    /**
522
+     * 房源分享
523
+     */
524
+    public static final String HOUSE = "house";
525
+
520 526
     /**
521 527
      * 系统参数  通知消息次时间间隔
522 528
      */
@@ -592,4 +598,10 @@ public class CommConstant {
592 598
      */
593 599
     public static final String PRICE_TYPE_AVERAGE = "average";
594 600
 
601
+    /**
602
+     * excel后缀
603
+     */
604
+    public static final String SUFFIX_2003 = ".xls";
605
+    public static final String SUFFIX_2007 = ".xlsx";
606
+
595 607
 }

+ 58
- 2
src/main/java/com/huiju/estateagents/common/DateUtils.java View File

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.common;
2 2
 
3
+import java.time.Duration;
3 4
 import java.time.Instant;
4 5
 import java.time.LocalDateTime;
5 6
 import java.time.ZoneId;
@@ -39,13 +40,68 @@ public class DateUtils {
39 40
     }
40 41
 
41 42
     public static boolean checkTimeRange(LocalDateTime start, LocalDateTime end, LocalDateTime dt) {
42
-        if(dt == null){
43
+        if (dt == null) {
43 44
             dt = LocalDateTime.now();
44 45
         }
45 46
 
46
-        if(dt.isAfter(start) && dt.isBefore(end)){
47
+        if (dt.isAfter(start) && dt.isBefore(end)) {
47 48
             return true;
48 49
         }
49 50
         return false;
50 51
     }
52
+
53
+    /**
54
+     * 当前时间是否早于指定时间
55
+     *
56
+     * @param target
57
+     * @return
58
+     */
59
+    public static boolean isBefore(String target) {
60
+        LocalDateTime dt = LocalDateTime.now();
61
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
62
+        LocalDateTime targetTime = LocalDateTime.parse(target, df);
63
+        if (dt.isBefore(targetTime)) {
64
+            return true;
65
+        }
66
+        return false;
67
+    }
68
+
69
+    /**
70
+     * 当前时间是否晚于指定时间
71
+     *
72
+     * @param target
73
+     * @return
74
+     */
75
+    public static boolean isAfter(String target) {
76
+        LocalDateTime dt = LocalDateTime.now();
77
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
78
+        LocalDateTime targetTime = LocalDateTime.parse(target, df);
79
+        if (dt.isAfter(targetTime)) {
80
+            return true;
81
+        }
82
+        return false;
83
+    }
84
+
85
+    /**
86
+     * 获取时间差
87
+     *
88
+     * @param dt1
89
+     * @param dt2 目标时间
90
+     * @return
91
+     */
92
+    public static String diffTime(LocalDateTime dt1, LocalDateTime dt2) {
93
+        Duration duration = Duration.between(dt1, dt2);
94
+        long minutes = duration.toMinutes();
95
+        int hours = (int) Math.floor(minutes / 60);
96
+        int minute = (int) minutes % 60;
97
+        int day = (int) Math.floor(hours / 24);
98
+        int hour = hours % 24;
99
+
100
+        return day + "天" + hour + "小时" + minute + "分钟";
101
+    }
102
+
103
+    public static LocalDateTime timeToLocalDateTime(String target){
104
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
105
+        return LocalDateTime.parse(target, df);
106
+    }
51 107
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/CommonController.java View File

@@ -28,7 +28,7 @@ public class CommonController {
28 28
     ITdMiniappTemplateTypeService iTdMiniappTemplateTypeService;
29 29
 
30 30
     /**
31
-     * 图片上传
31
+     * 图片
32 32
      * @param multipartFile
33 33
      * @return
34 34
      */

+ 50
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingApartmentController.java View File

@@ -1,11 +1,26 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.entity.TaBuildingApartment;
10
+import com.huiju.estateagents.entity.TaBuildingBlock;
11
+import com.huiju.estateagents.service.ITaBuildingApartmentService;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
4 15
 import org.springframework.web.bind.annotation.RequestMapping;
5 16
 
17
+import org.springframework.web.bind.annotation.RequestMethod;
18
+import org.springframework.web.bind.annotation.RequestParam;
6 19
 import org.springframework.web.bind.annotation.RestController;
7 20
 import com.huiju.estateagents.base.BaseController;
8 21
 
22
+import javax.servlet.http.HttpServletRequest;
23
+
9 24
 /**
10 25
  * <p>
11 26
  * 项目户型表 前端控制器
@@ -18,4 +33,39 @@ import com.huiju.estateagents.base.BaseController;
18 33
 @RequestMapping("/api")
19 34
 public class TaBuildingApartmentController extends BaseController {
20 35
 
36
+    private final Logger logger = LoggerFactory.getLogger(TaBuildingApartmentController.class);
37
+    @Autowired
38
+    private ITaBuildingApartmentService taBuildingApartmentService;
39
+
40
+    /**
41
+     * author fxf
42
+     * 分页查询列表
43
+     * @param pageNum
44
+     * @param pageSize
45
+     * @return
46
+     */
47
+    @RequestMapping(value="/admin/apartmentList",method= RequestMethod.GET)
48
+    public ResponseBean getApartmentList(@RequestParam(value ="buildingId") String buildingId,
49
+                                            @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
50
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
51
+                                            HttpServletRequest request){
52
+        ResponseBean responseBean = new ResponseBean();
53
+        try {
54
+            //使用分页插件
55
+            IPage<TaBuildingApartment> pg = new Page<>(pageNum, pageSize);
56
+            QueryWrapper<TaBuildingApartment> queryWrapper = new QueryWrapper<>();
57
+            queryWrapper.eq("building_id",buildingId);
58
+            queryWrapper.eq("apartment_type",CommConstant.APARTMENT_TYPR_APART);
59
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
60
+            queryWrapper.orderByDesc("create_date");
61
+
62
+            IPage<TaBuildingApartment> result = taBuildingApartmentService.page(pg, queryWrapper);
63
+            responseBean.addSuccess(result);
64
+        }catch (Exception e){
65
+            e.printStackTrace();
66
+            logger.error("getApartmentList -=- {}",e.toString());
67
+            responseBean.addError(e.getMessage());
68
+        }
69
+        return responseBean;
70
+    }
21 71
 }

+ 13
- 4
src/main/java/com/huiju/estateagents/controller/TaBuildingBlockController.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8 9
 import com.huiju.estateagents.entity.TaBuildingBlock;
9 10
 import com.huiju.estateagents.service.ITaBuildingBlockService;
10 11
 import org.slf4j.Logger;
@@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.web.bind.annotation.*;
14 15
 
16
+import javax.servlet.http.HttpServletRequest;
17
+
15 18
 /**
16 19
  * <p>
17 20
     * 楼栋表  前端控制器
@@ -21,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
21 24
  * @since 2020-02-10
22 25
  */
23 26
 @RestController
24
-@RequestMapping("/")
27
+@RequestMapping("/api")
25 28
 public class TaBuildingBlockController extends BaseController {
26 29
 
27 30
     private final Logger logger = LoggerFactory.getLogger(TaBuildingBlockController.class);
@@ -31,19 +34,25 @@ public class TaBuildingBlockController extends BaseController {
31 34
 
32 35
 
33 36
     /**
37
+     * author fxf
34 38
      * 分页查询列表
35 39
      * @param pageNum
36 40
      * @param pageSize
37 41
      * @return
38 42
      */
39
-    @RequestMapping(value="/taBuildingBlock",method= RequestMethod.GET)
40
-    public ResponseBean taBuildingBlockList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
43
+    @RequestMapping(value="/admin/taBuildingBlock",method= RequestMethod.GET)
44
+    public ResponseBean taBuildingBlockList(@RequestParam(value ="buildingId",required = true) String buildingId,
45
+                                            @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
47
+                                            HttpServletRequest request){
42 48
         ResponseBean responseBean = new ResponseBean();
43 49
         try {
44 50
             //使用分页插件
45 51
 		    IPage<TaBuildingBlock> pg = new Page<>(pageNum, pageSize);
46 52
             QueryWrapper<TaBuildingBlock> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.eq("org_id",getOrgId(request));
54
+            queryWrapper.eq("building_id",buildingId);
55
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
47 56
             queryWrapper.orderByDesc("create_date");
48 57
 
49 58
             IPage<TaBuildingBlock> result = iTaBuildingBlockService.page(pg, queryWrapper);

+ 58
- 41
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java View File

@@ -64,6 +64,7 @@ public class TaBuildingController extends BaseController {
64 64
 
65 65
     /**
66 66
      * 楼盘详情
67
+     *
67 68
      * @param id
68 69
      * @return
69 70
      */
@@ -72,12 +73,13 @@ public class TaBuildingController extends BaseController {
72 73
     @ApiImplicitParams({
73 74
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "id", value = "项目id")
74 75
     })
75
-    public ResponseBean buildingSelectId(@PathVariable(value = "id") String id){
76
+    public ResponseBean buildingSelectId(@PathVariable(value = "id") String id) {
76 77
         return taBuildingService.buildingSelectId(id);
77 78
     }
78 79
 
79 80
     /**
80 81
      * 楼盘列表 查询所有有效的
82
+     *
81 83
      * @param pageNum
82 84
      * @param pageSize
83 85
      * @param name
@@ -97,21 +99,22 @@ public class TaBuildingController extends BaseController {
97 99
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "isMain", value = "是否主推项目"),
98 100
     })
99 101
     @GetMapping("/admin/buildinglist")
100
-    public ResponseBean buildingList(@RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
101
-                                     @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
102
-                                     @RequestParam(value = "name", required = false)String name,
103
-                                     @RequestParam(value = "code", required = false)String code,
104
-                                     @RequestParam(value = "startDate",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
105
-                                     @RequestParam(value = "buildingStatus",required = false)String buildingStatus,
106
-                                     @RequestParam(value = "marketStatus",required = false)String marketStatus,
107
-                                     @RequestParam(value = "cityId",required = false)Integer cityId,
108
-                                     @RequestParam(value = "isMain",required = false)Integer isMain,
109
-                                     HttpServletRequest request){
110
-        return taBuildingService.buildingList(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain, getOrgId(request),getTaPersonBuildingListByUserId(request));
102
+    public ResponseBean buildingList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
103
+                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
104
+                                     @RequestParam(value = "name", required = false) String name,
105
+                                     @RequestParam(value = "code", required = false) String code,
106
+                                     @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
107
+                                     @RequestParam(value = "buildingStatus", required = false) String buildingStatus,
108
+                                     @RequestParam(value = "marketStatus", required = false) String marketStatus,
109
+                                     @RequestParam(value = "cityId", required = false) Integer cityId,
110
+                                     @RequestParam(value = "isMain", required = false) Integer isMain,
111
+                                     HttpServletRequest request) {
112
+        return taBuildingService.buildingList(pageNum, pageSize, name, code, startDate, buildingStatus, marketStatus, cityId, isMain, getOrgId(request), getTaPersonBuildingListByUserId(request));
111 113
     }
112 114
 
113 115
     /**
114 116
      * 楼盘列表
117
+     *
115 118
      * @param pageNum
116 119
      * @param pageSize
117 120
      * @param name
@@ -131,21 +134,22 @@ public class TaBuildingController extends BaseController {
131 134
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "isMain", value = "是否主推项目"),
132 135
     })
133 136
     @GetMapping("/admin/buildinglist/select")
134
-    public ResponseBean buildingListSelect(@RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
135
-                                     @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
136
-                                     @RequestParam(value = "name", required = false)String name,
137
-                                     @RequestParam(value = "code", required = false)String code,
138
-                                     @RequestParam(value = "startDate",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)LocalDateTime startDate,
139
-                                     @RequestParam(value = "buildingStatus",required = false)String buildingStatus,
140
-                                     @RequestParam(value = "marketStatus",required = false)String marketStatus,
141
-                                     @RequestParam(value = "cityId",required = false)Integer cityId,
142
-                                     @RequestParam(value = "isMain",required = false)Integer isMain,
143
-                                           HttpServletRequest request){
144
-        return taBuildingService.buildingListSelect(pageNum,pageSize,name,code,startDate,buildingStatus,marketStatus,cityId,isMain,getOrgId(request),getTaPersonBuildingListByUserId(request));
137
+    public ResponseBean buildingListSelect(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
138
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
139
+                                           @RequestParam(value = "name", required = false) String name,
140
+                                           @RequestParam(value = "code", required = false) String code,
141
+                                           @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
142
+                                           @RequestParam(value = "buildingStatus", required = false) String buildingStatus,
143
+                                           @RequestParam(value = "marketStatus", required = false) String marketStatus,
144
+                                           @RequestParam(value = "cityId", required = false) Integer cityId,
145
+                                           @RequestParam(value = "isMain", required = false) Integer isMain,
146
+                                           HttpServletRequest request) {
147
+        return taBuildingService.buildingListSelect(pageNum, pageSize, name, code, startDate, buildingStatus, marketStatus, cityId, isMain, getOrgId(request), getTaPersonBuildingListByUserId(request));
145 148
     }
146 149
 
147 150
     /**
148 151
      * 更新楼盘
152
+     *
149 153
      * @param parameter
150 154
      * @return
151 155
      */
@@ -154,12 +158,13 @@ public class TaBuildingController extends BaseController {
154 158
 
155 159
     })
156 160
     @PutMapping("/admin/building/update")
157
-    public ResponseBean buildingUpdate(@RequestBody String parameter, HttpServletRequest request){
161
+    public ResponseBean buildingUpdate(@RequestBody String parameter, HttpServletRequest request) {
158 162
         return taBuildingService.buildingUpdate(parameter, getOrgId(request));
159 163
     }
160 164
 
161 165
     /**
162 166
      * 楼盘添加
167
+     *
163 168
      * @param parameter
164 169
      * @return
165 170
      */
@@ -168,12 +173,13 @@ public class TaBuildingController extends BaseController {
168 173
 
169 174
     })
170 175
     @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
171
-    public ResponseBean buildingAdd(@RequestBody String parameter, HttpServletRequest request){
176
+    public ResponseBean buildingAdd(@RequestBody String parameter, HttpServletRequest request) {
172 177
         return taBuildingService.buildingAdd(parameter, getOrgId(request));
173 178
     }
174 179
 
175 180
     /**
176 181
      * 楼盘getPersonId(request);
182
+     *
177 183
      * @param parameter
178 184
      * @return
179 185
      */
@@ -182,12 +188,13 @@ public class TaBuildingController extends BaseController {
182 188
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "status:状态,id:项目id"),
183 189
     })
184 190
     @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
185
-    public ResponseBean buildingUpdateStatus(@RequestBody String parameter, HttpServletRequest request){
191
+    public ResponseBean buildingUpdateStatus(@RequestBody String parameter, HttpServletRequest request) {
186 192
         return taBuildingService.buildingUpdateStatus(parameter, getOrgId(request));
187 193
     }
188 194
 
189 195
     /**
190 196
      * 楼盘删除
197
+     *
191 198
      * @param id
192 199
      * @param request
193 200
      * @return
@@ -197,35 +204,38 @@ public class TaBuildingController extends BaseController {
197 204
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "id", value = "项目id"),
198 205
     })
199 206
     @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
200
-    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpServletRequest request){
207
+    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpServletRequest request) {
201 208
         return taBuildingService.buildingdelete(id, getOrgId(request));
202 209
     }
203 210
 
204 211
     /**
205 212
      * 添加户型
213
+     *
206 214
      * @param parameter
207 215
      * @param session
208 216
      * @return
209 217
      */
210 218
     @ApiOperation(value = "添加户型", notes = "添加户型")
211 219
     @RequestMapping(value = "/admin/buildingApartment/add", method = RequestMethod.POST)
212
-    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session){
220
+    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session) {
213 221
         return taBuildingService.buildingApartmentAdd(parameter);
214 222
     }
215 223
 
216 224
     /**
217 225
      * 户型编辑
226
+     *
218 227
      * @param parameter
219 228
      * @return
220 229
      */
221 230
     @ApiOperation(value = "户型编辑", notes = "户型编辑")
222 231
     @RequestMapping(value = "/admin/buildingApartment/update", method = RequestMethod.PUT)
223
-    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter){
232
+    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter) {
224 233
         return taBuildingService.buildingApartmentUpdate(parameter);
225 234
     }
226 235
 
227 236
     /**
228 237
      * 户型详情
238
+     *
229 239
      * @param id
230 240
      * @return
231 241
      */
@@ -234,12 +244,13 @@ public class TaBuildingController extends BaseController {
234 244
             @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "id", value = "户型id"),
235 245
     })
236 246
     @RequestMapping(value = "/admin/buildingApartment/{id}", method = RequestMethod.GET)
237
-    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id){
247
+    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id) {
238 248
         return taBuildingService.buildingApartmentSelectId(id);
239 249
     }
240 250
 
241 251
     /**
242 252
      * 依据项目ID 查户型
253
+     *
243 254
      * @param id
244 255
      * @return
245 256
      */
@@ -250,18 +261,19 @@ public class TaBuildingController extends BaseController {
250 261
     })
251 262
     @RequestMapping(value = "/admin/buildingApartment/buildingId/{id}", method = RequestMethod.GET)
252 263
     public ResponseBean buildingApartmentBuildingId(@PathVariable(value = "id") String id,
253
-                                                    @RequestParam(value = "apartmentType", required = false) String apartmentType){
264
+                                                    @RequestParam(value = "apartmentType", required = false) String apartmentType) {
254 265
         return taBuildingService.buildingApartmentBuildingId(id, apartmentType);
255 266
     }
256 267
 
257 268
     /**
258 269
      * 微信楼盘列表
270
+     *
259 271
      * @return
260 272
      */
261 273
     @RequestMapping(value = "/wx/building/list", method = RequestMethod.GET)
262 274
     public ResponseBean getWxBuildingList(
263 275
             @RequestParam(defaultValue = "1") Integer pageNumber,
264
-            @RequestParam(defaultValue = "10")Integer pageSize,
276
+            @RequestParam(defaultValue = "10") Integer pageSize,
265 277
             @RequestParam(defaultValue = "false") Boolean mine,
266 278
             @RequestParam(required = false) Integer cityId,
267 279
             @RequestParam(required = false) String name,
@@ -275,7 +287,7 @@ public class TaBuildingController extends BaseController {
275 287
 //            @RequestParam(required = false) Double minBuildingArea, // 最小面积
276 288
 //            @RequestParam(required = false) Double maxBuildingArea, // 最大面积
277 289
             HttpServletRequest request
278
-    ){
290
+    ) {
279 291
         Integer orgId = getOrgId(request);
280 292
         List<String> targets = null;
281 293
         if (null != mine && mine) {
@@ -293,12 +305,13 @@ public class TaBuildingController extends BaseController {
293 305
         List<String[]> priceList = getParamListOf(price);
294 306
         List<String[]> areaList = getParamListOf(area);
295 307
 
296
-        return taBuildingService.getWxBuildingList(pageNumber, pageSize, name, targets, cityId,mine, houseTypeList, buildingTypeList, priceList, areaList,orgId,priceType);
308
+        return taBuildingService.getWxBuildingList(pageNumber, pageSize, name, targets, cityId, mine, houseTypeList, buildingTypeList, priceList, areaList, orgId, priceType);
297 309
     }
298 310
 
299 311
 
300 312
     /**
301 313
      * 先按照 逗号 拆分, 再按照 横线 拆分
314
+     *
302 315
      * @param params
303 316
      * @return
304 317
      */
@@ -310,7 +323,7 @@ public class TaBuildingController extends BaseController {
310 323
         }
311 324
 
312 325
         String[] paramsArray = params.split(",");
313
-        for(String param : paramsArray) {
326
+        for (String param : paramsArray) {
314 327
             paramList.add(param.split("-"));
315 328
         }
316 329
 
@@ -320,31 +333,34 @@ public class TaBuildingController extends BaseController {
320 333
 
321 334
     /**
322 335
      * 微信推荐楼盘列表
336
+     *
323 337
      * @return
324 338
      */
325 339
     @RequestMapping(value = "/wx/building/main", method = RequestMethod.GET)
326
-    public ResponseBean getWxMainBuildingList(String cityId, HttpServletRequest request){
340
+    public ResponseBean getWxMainBuildingList(String cityId, HttpServletRequest request) {
327 341
         Integer orgId = getOrgId(request);
328 342
         return taBuildingService.getWxMainBuildingList(cityId, orgId);
329 343
     }
330 344
 
331 345
     /**
332 346
      * 删除户型
347
+     *
333 348
      * @param id
334 349
      * @return
335 350
      */
336 351
     @RequestMapping(value = "/admin/apartment/deleted/{id}", method = RequestMethod.DELETE)
337
-    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id){
352
+    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id) {
338 353
         return taBuildingService.apartmentDel(id);
339 354
     }
340 355
 
341 356
     /**
342 357
      * 微信楼盘详情
358
+     *
343 359
      * @param id
344 360
      * @return
345 361
      */
346 362
     @RequestMapping(value = "/wx/buildingSelectId/{id}", method = RequestMethod.GET)
347
-    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id,HttpServletRequest request){
363
+    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id, HttpServletRequest request) {
348 364
         String openid = getOpenId(request);
349 365
         Integer orgId = getOrgId(request);
350 366
         List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);
@@ -352,14 +368,15 @@ public class TaBuildingController extends BaseController {
352 368
             return ResponseBean.error("当前账户信息异常, 清除缓存重试", ResponseBean.ERROR_UNAVAILABLE);
353 369
         }
354 370
         TaPerson person = persons.get(0);
355
-        return taBuildingService.buildingAllSelectId(id,person.getPersonId(), orgId);
371
+        return taBuildingService.buildingAllSelectId(id, person.getPersonId(), orgId);
356 372
     }
373
+
357 374
     /**
358 375
      * 查询当前所有项目
359 376
      */
360 377
     @RequestMapping(value = "/admin/buildingAll", method = RequestMethod.GET)
361
-    public  ResponseBean buildingAll(HttpServletRequest request){
362
-        ResponseBean taBuilding= taBuildingService.buildingAll(getOrgId(request));
378
+    public ResponseBean buildingAll(HttpServletRequest request) {
379
+        ResponseBean taBuilding = taBuildingService.buildingAll(getOrgId(request));
363 380
         return taBuilding;
364 381
     }
365 382
 

+ 15
- 4
src/main/java/com/huiju/estateagents/controller/TaBuildingFloorController.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8 9
 import com.huiju.estateagents.entity.TaBuildingFloor;
9 10
 import com.huiju.estateagents.service.ITaBuildingFloorService;
10 11
 import org.slf4j.Logger;
@@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.web.bind.annotation.*;
14 15
 
16
+import javax.servlet.http.HttpServletRequest;
17
+
15 18
 /**
16 19
  * <p>
17 20
     * 楼层表  前端控制器
@@ -21,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
21 24
  * @since 2020-02-10
22 25
  */
23 26
 @RestController
24
-@RequestMapping("/")
27
+@RequestMapping("/api")
25 28
 public class TaBuildingFloorController extends BaseController {
26 29
 
27 30
     private final Logger logger = LoggerFactory.getLogger(TaBuildingFloorController.class);
@@ -36,14 +39,22 @@ public class TaBuildingFloorController extends BaseController {
36 39
      * @param pageSize
37 40
      * @return
38 41
      */
39
-    @RequestMapping(value="/taBuildingFloor",method= RequestMethod.GET)
40
-    public ResponseBean taBuildingFloorList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
42
+    @RequestMapping(value="/admin/taBuildingFloor",method= RequestMethod.GET)
43
+    public ResponseBean taBuildingFloorList(@RequestParam(value = "buildingId") String buildingId,
44
+                                            @RequestParam(value = "blockId",required = false) Integer blockId,
45
+                                            @RequestParam(value = "unitid",required = false) Integer unitId,
46
+                                            @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize, HttpServletRequest request){
42 48
         ResponseBean responseBean = new ResponseBean();
43 49
         try {
44 50
             //使用分页插件
45 51
 		    IPage<TaBuildingFloor> pg = new Page<>(pageNum, pageSize);
46 52
             QueryWrapper<TaBuildingFloor> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.eq("org_id",getOrgId(request));
54
+            queryWrapper.eq("building_id",buildingId);
55
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
56
+            queryWrapper.eq(null != blockId,"block_id",blockId);
57
+            queryWrapper.eq(null != unitId,"unit_id",unitId);
47 58
             queryWrapper.orderByDesc("create_date");
48 59
 
49 60
             IPage<TaBuildingFloor> result = iTaBuildingFloorService.page(pg, queryWrapper);

+ 143
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingTermController.java View File

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

+ 14
- 4
src/main/java/com/huiju/estateagents/controller/TaBuildingUnitController.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8 9
 import com.huiju.estateagents.entity.TaBuildingUnit;
9 10
 import com.huiju.estateagents.service.ITaBuildingUnitService;
10 11
 import org.slf4j.Logger;
@@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.web.bind.annotation.*;
14 15
 
16
+import javax.servlet.http.HttpServletRequest;
17
+
15 18
 /**
16 19
  * <p>
17 20
     * 单元表  前端控制器
@@ -21,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
21 24
  * @since 2020-02-10
22 25
  */
23 26
 @RestController
24
-@RequestMapping("/")
27
+@RequestMapping("/api")
25 28
 public class TaBuildingUnitController extends BaseController {
26 29
 
27 30
     private final Logger logger = LoggerFactory.getLogger(TaBuildingUnitController.class);
@@ -36,14 +39,21 @@ public class TaBuildingUnitController extends BaseController {
36 39
      * @param pageSize
37 40
      * @return
38 41
      */
39
-    @RequestMapping(value="/taBuildingUnit",method= RequestMethod.GET)
40
-    public ResponseBean taBuildingUnitList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
-                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
42
+    @RequestMapping(value="/admin/taBuildingUnit",method= RequestMethod.GET)
43
+    public ResponseBean taBuildingUnitList(@RequestParam(value = "buildingId") String buildingId,
44
+                                           @RequestParam(value = "blockId", required = false) Integer blockId,
45
+                                           @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
47
+                                           HttpServletRequest request){
42 48
         ResponseBean responseBean = new ResponseBean();
43 49
         try {
44 50
             //使用分页插件
45 51
 		    IPage<TaBuildingUnit> pg = new Page<>(pageNum, pageSize);
46 52
             QueryWrapper<TaBuildingUnit> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.eq("org_id",getOrgId(request));
54
+            queryWrapper.eq("building_id",buildingId);
55
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
56
+            queryWrapper.eq(null != blockId,"block_id",blockId);
47 57
             queryWrapper.orderByDesc("create_date");
48 58
 
49 59
             IPage<TaBuildingUnit> result = iTaBuildingUnitService.page(pg, queryWrapper);

+ 171
- 29
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java View File

@@ -1,15 +1,25 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.huiju.estateagents.base.BaseController;
4 5
 import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.CommConstant;
7
+import com.huiju.estateagents.entity.TaBuildingRoom;
5 8
 import com.huiju.estateagents.entity.TaHousingResources;
9
+import com.huiju.estateagents.entity.TaPreselectionRecord;
10
+import com.huiju.estateagents.po.TaHousingResourcesPO;
11
+import com.huiju.estateagents.service.ITaBuildingRoomService;
6 12
 import com.huiju.estateagents.service.ITaHousingResourcesService;
13
+import com.huiju.estateagents.service.ITaPreselectionRecordService;
14
+import io.swagger.annotations.ApiOperation;
7 15
 import org.slf4j.Logger;
8 16
 import org.slf4j.LoggerFactory;
9 17
 import org.springframework.beans.factory.annotation.Autowired;
10 18
 import org.springframework.web.bind.annotation.*;
19
+import org.springframework.web.multipart.MultipartFile;
11 20
 
12 21
 import javax.servlet.http.HttpServletRequest;
22
+import java.util.List;
13 23
 
14 24
 /**
15 25
  * <p>
@@ -28,6 +38,11 @@ public class TaHousingResourcesController extends BaseController {
28 38
     @Autowired
29 39
     public ITaHousingResourcesService iTaHousingResourcesService;
30 40
 
41
+    @Autowired
42
+    private ITaBuildingRoomService taBuildingRoomService;
43
+
44
+    @Autowired
45
+    private ITaPreselectionRecordService taPreselectionRecordService;
31 46
 
32 47
     /**
33 48
      * 分页查询列表
@@ -42,12 +57,20 @@ public class TaHousingResourcesController extends BaseController {
42 57
     @RequestMapping(value = "/admin/taHousingResources", method = RequestMethod.GET)
43 58
     public ResponseBean taHousingResourcesList(@RequestParam(value = "salesBatchId", required = true) Integer salesBatchId,
44 59
                                                @RequestParam(value = "buildingId", required = true) String buildingId,
60
+                                               @RequestParam(value = "termName", required = false) String termName,
61
+                                               @RequestParam(value = "blockName", required = false) String blockName,
62
+                                               @RequestParam(value = "unitName", required = false) String unitName,
63
+                                               @RequestParam(value = "floorName", required = false) String floorName,
64
+                                               @RequestParam(value = "roomName", required = false) String roomName,
65
+                                               @RequestParam(value = "apartmentId", required = false) String apartmentId,
66
+                                               @RequestParam(value = "status", required = false) Integer status,
67
+                                               @RequestParam(value = "houseId", required = false) String houseId,
45 68
                                                @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
46 69
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
47 70
                                                HttpServletRequest request) {
48 71
         ResponseBean responseBean = new ResponseBean();
49 72
         try {
50
-            responseBean = iTaHousingResourcesService.selectPageList(salesBatchId, buildingId, pageNumber, pageSize, getOrgId(request));
73
+            responseBean = iTaHousingResourcesService.selectPageList(salesBatchId, buildingId, pageNumber, pageSize, getOrgId(request), termName, blockName, unitName, floorName, roomName, apartmentId, status, houseId);
51 74
         } catch (Exception e) {
52 75
             e.printStackTrace();
53 76
             logger.error("taHousingResourcesList -=- {}", e.toString());
@@ -62,15 +85,12 @@ public class TaHousingResourcesController extends BaseController {
62 85
      * @param taHousingResources 实体对象
63 86
      * @return
64 87
      */
65
-    @RequestMapping(value = "/taHousingResources", method = RequestMethod.POST)
66
-    public ResponseBean taHousingResourcesAdd(@RequestBody TaHousingResources taHousingResources) {
88
+    @RequestMapping(value = "/admin/taHousingResources", method = RequestMethod.POST)
89
+    public ResponseBean taHousingResourcesAdd(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
67 90
         ResponseBean responseBean = new ResponseBean();
68 91
         try {
69
-            if (iTaHousingResourcesService.save(taHousingResources)) {
70
-                responseBean.addSuccess(taHousingResources);
71
-            } else {
72
-                responseBean.addError("fail");
73
-            }
92
+            taHousingResources.setOrgId(getOrgId(request));
93
+            responseBean = iTaHousingResourcesService.addHouseResources(taHousingResources);
74 94
         } catch (Exception e) {
75 95
             e.printStackTrace();
76 96
             logger.error("taHousingResourcesAdd -=- {}", e.toString());
@@ -85,11 +105,29 @@ public class TaHousingResourcesController extends BaseController {
85 105
      * @param id 实体ID
86 106
      */
87 107
     @ResponseBody
88
-    @RequestMapping(value = "/taHousingResources/{id}", method = RequestMethod.DELETE)
89
-    public ResponseBean taHousingResourcesDelete(@PathVariable Integer id) {
108
+    @RequestMapping(value = "/admin/houseDelete/{id}", method = RequestMethod.DELETE)
109
+    public ResponseBean taHousingResourcesDelete(@PathVariable Integer id, HttpServletRequest request) {
90 110
         ResponseBean responseBean = new ResponseBean();
91 111
         try {
92
-            if (iTaHousingResourcesService.removeById(id)) {
112
+            //校验是否有预选记录
113
+            QueryWrapper<TaPreselectionRecord> queryWrapper = new QueryWrapper<>();
114
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
115
+            queryWrapper.eq("org_id", getOrgId(request));
116
+            queryWrapper.eq("house_id", id);
117
+            List<TaPreselectionRecord> taPreselectionRecords = taPreselectionRecordService.list(queryWrapper);
118
+            if (taPreselectionRecords.size() > 0) {
119
+                return ResponseBean.error("存在预选房源不能删除!", ResponseBean.ERROR_UNAVAILABLE);
120
+            }
121
+            TaHousingResources taHousingResources = new TaHousingResources();
122
+            taHousingResources.setHouseId(id);
123
+            taHousingResources.setStatus(CommConstant.STATUS_DELETE);
124
+            if (iTaHousingResourcesService.updateById(taHousingResources)) {
125
+                //删除房号
126
+                TaHousingResources housingResources = iTaHousingResourcesService.getById(id);
127
+                TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
128
+                taBuildingRoom.setRoomId(housingResources.getRoomId());
129
+                taBuildingRoom.setStatus(CommConstant.STATUS_DELETE);
130
+                taBuildingRoomService.updateById(taBuildingRoom);
93 131
                 responseBean.addSuccess("success");
94 132
             } else {
95 133
                 responseBean.addError("fail");
@@ -109,16 +147,36 @@ public class TaHousingResourcesController extends BaseController {
109 147
      * @param taHousingResources 实体对象
110 148
      * @return
111 149
      */
112
-    @RequestMapping(value = "/taHousingResources/{id}", method = RequestMethod.PUT)
150
+    @RequestMapping(value = "/admin/taHousingResources/{id}", method = RequestMethod.PUT)
113 151
     public ResponseBean taHousingResourcesUpdate(@PathVariable Integer id,
114
-                                                 @RequestBody TaHousingResources taHousingResources) {
152
+                                                 @RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
115 153
         ResponseBean responseBean = new ResponseBean();
116 154
         try {
117
-            if (iTaHousingResourcesService.updateById(taHousingResources)) {
118
-                responseBean.addSuccess(taHousingResources);
119
-            } else {
120
-                responseBean.addError("fail");
121
-            }
155
+            taHousingResources.setHouseId(id);
156
+            taHousingResources.setUpdateUser(getUserId(request));
157
+            taHousingResources.setOrgId(getOrgId(request));
158
+            responseBean = iTaHousingResourcesService.updateHouseResources(taHousingResources);
159
+        } catch (Exception e) {
160
+            e.printStackTrace();
161
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
162
+            responseBean.addError(e.getMessage());
163
+        }
164
+        return responseBean;
165
+    }
166
+
167
+    /**
168
+     * 修改户型
169
+     */
170
+    @RequestMapping(value = "/admin/house/changeApartment", method = RequestMethod.PUT)
171
+    public ResponseBean houseApartment(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
172
+        ResponseBean responseBean = new ResponseBean();
173
+        try {
174
+            List<TaHousingResources> houseIdList = taHousingResources.getHouseIdList();
175
+            houseIdList.forEach(e -> {
176
+                e.setApartmentId(taHousingResources.getApartmentId());
177
+            });
178
+            iTaHousingResourcesService.updateBatchById(houseIdList);
179
+            responseBean.addSuccess(houseIdList);
122 180
         } catch (Exception e) {
123 181
             e.printStackTrace();
124 182
             logger.error("taHousingResourcesUpdate -=- {}", e.toString());
@@ -132,7 +190,7 @@ public class TaHousingResourcesController extends BaseController {
132 190
      *
133 191
      * @param id 实体ID
134 192
      */
135
-    @RequestMapping(value = "/taHousingResources/{id}", method = RequestMethod.GET)
193
+    @RequestMapping(value = "/admin/taHousingResources/{id}", method = RequestMethod.GET)
136 194
     public ResponseBean taHousingResourcesGet(@PathVariable Integer id) {
137 195
         ResponseBean responseBean = new ResponseBean();
138 196
         try {
@@ -148,19 +206,26 @@ public class TaHousingResourcesController extends BaseController {
148 206
     /**
149 207
      * 获取房源列表
150 208
      *
151
-     * @param pageNum      页码
152
-     * @param pageSize     分页大小
153 209
      * @param salesBatchId 销售批次ID
210
+     * @param startPrice   房源起始价格
211
+     * @param endPrice     房源结束价格
212
+     * @param apartmentId  户型ID
213
+     * @param request
154 214
      * @return
215
+     * @author gushaoyong
155 216
      */
156
-    @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.POST)
157
-    public ResponseBean listHousingResources(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
158
-                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
159
-                                             @RequestParam(value = "salesBatchId") String salesBatchId,
160
-                                             String startPrice, String endPrice, String apartmentId) {
217
+    @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.GET)
218
+    public ResponseBean listHousingResources(@RequestParam(value = "salesBatchId") String salesBatchId,
219
+                                             String startPrice, String endPrice, String apartmentId,
220
+                                             HttpServletRequest request) {
161 221
         ResponseBean responseBean = new ResponseBean();
222
+        Integer orgId = getOrgId(request);
223
+
224
+        logger.info("TaHouseingResourcesController.listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
225
+                orgId, salesBatchId, startPrice, endPrice, apartmentId);
226
+
162 227
         try {
163
-            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(pageNum, pageSize, salesBatchId, startPrice, endPrice, apartmentId));
228
+            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, 1));
164 229
         } catch (Exception e) {
165 230
             logger.error("listHousingResources -=- {}", e);
166 231
             responseBean.addError(e.getMessage());
@@ -168,13 +233,36 @@ public class TaHousingResourcesController extends BaseController {
168 233
         return responseBean;
169 234
     }
170 235
 
236
+    /**
237
+     * 获取房源列表-后台管理端
238
+     *
239
+     * @param salesBatchId 销售批次ID
240
+     * @return
241
+     * @author gushaoyong
242
+     */
243
+    @RequestMapping(value = "/admin/listHousingResources", method = RequestMethod.GET)
244
+    public ResponseBean listHousingResourcesFormCms(@RequestParam(value = "salesBatchId") String salesBatchId,
245
+                                                    HttpServletRequest request) {
246
+        ResponseBean responseBean = new ResponseBean();
247
+        Integer orgId = getOrgId(request);
248
+
249
+        try {
250
+            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, "", "", "", 0));
251
+        } catch (Exception e) {
252
+            logger.error("listHousingResourcesFormCms -=- {}", e);
253
+            responseBean.addError(e.getMessage());
254
+        }
255
+        return responseBean;
256
+    }
257
+
171 258
     /**
172 259
      * 获取某销售批次下所有房源户型
173 260
      *
174 261
      * @param salesBatchId
175 262
      * @return
263
+     * @author gushaoyong
176 264
      */
177
-    @RequestMapping(value = "/wx/listBuildApartmentBySalesBatchId", method = RequestMethod.POST)
265
+    @RequestMapping(value = "/wx/listBuildApartmentBySalesBatchId", method = RequestMethod.GET)
178 266
     public ResponseBean listBuildApartmentBySalesBatchId(@RequestParam(value = "salesBatchId") String salesBatchId) {
179 267
         ResponseBean responseBean = new ResponseBean();
180 268
         try {
@@ -191,8 +279,9 @@ public class TaHousingResourcesController extends BaseController {
191 279
      *
192 280
      * @param houseId
193 281
      * @return
282
+     * @author gushaoyong
194 283
      */
195
-    @RequestMapping(value = "/wx/getHousingDetailById", method = RequestMethod.POST)
284
+    @RequestMapping(value = "/wx/getHousingDetailById", method = RequestMethod.GET)
196 285
     public ResponseBean getHousingDetailById(@RequestParam(value = "houseId") String houseId,
197 286
                                              @RequestParam(value = "personId") String personId) {
198 287
         ResponseBean responseBean = new ResponseBean();
@@ -204,4 +293,57 @@ public class TaHousingResourcesController extends BaseController {
204 293
         }
205 294
         return responseBean;
206 295
     }
296
+
297
+
298
+    /**
299
+     * 校验房源是否合格
300
+     *
301
+     * @return
302
+     */
303
+    @RequestMapping(value = "/admin/house/checked", method = RequestMethod.PUT)
304
+    public ResponseBean houseChecked(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
305
+        ResponseBean responseBean = new ResponseBean();
306
+        try {
307
+            taHousingResources.setOrgId(getOrgId(request));
308
+            StringBuffer result = iTaHousingResourcesService.checked(taHousingResources);
309
+            responseBean.addSuccess(result);
310
+        } catch (Exception e) {
311
+            e.printStackTrace();
312
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
313
+            responseBean.addError(e.getMessage());
314
+        }
315
+        return responseBean;
316
+    }
317
+
318
+    @PostMapping(value = "/admin/house/uploadExcel")
319
+    public ResponseBean uploadExcel(@RequestParam("file") MultipartFile file,
320
+                                    @RequestParam("salesBatchId") Integer salesBatchId,
321
+                                    @RequestParam("buildingId") String buildingId,
322
+                                    HttpServletRequest request) {
323
+        ResponseBean responseBean = new ResponseBean();
324
+        try {
325
+            responseBean = iTaHousingResourcesService.getExcelData(file, salesBatchId, buildingId, getOrgId(request));
326
+        } catch (Exception e) {
327
+            e.printStackTrace();
328
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
329
+            responseBean.addError("请检查文件");
330
+        }
331
+        return responseBean;
332
+    }
333
+
334
+    @PostMapping(value = "/admin/house/saveExcelValue", consumes = "multipart/*", headers = "content-type=multipart/form-data")
335
+    public ResponseBean saveExcelValue(@RequestParam("file") MultipartFile file,
336
+                                       @RequestParam("salesBatchId") Integer salesBatchId,
337
+                                       @RequestParam("buildingId") String buildingId,
338
+                                       HttpServletRequest request) {
339
+        ResponseBean responseBean = new ResponseBean();
340
+        try {
341
+            responseBean = iTaHousingResourcesService.saveExcelValue(file, salesBatchId, buildingId, getOrgId(request));
342
+        } catch (Exception e) {
343
+            e.printStackTrace();
344
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
345
+            responseBean.addError("请检查文件");
346
+        }
347
+        return responseBean;
348
+    }
207 349
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java View File

@@ -380,6 +380,9 @@ public class TaPersonVisitRecordController extends BaseController {
380 380
                 case CommConstant.EVENT_H5:
381 381
                     e.setDrainageShareNum(shareNum);
382 382
                     break;
383
+                case CommConstant.HOUSE:
384
+                    e.setHouseShareNum(shareNum);
385
+                    break;
383 386
             }
384 387
         });
385 388
         result.setRecords(taConsultantInfos);

+ 35
- 28
src/main/java/com/huiju/estateagents/controller/TaPreselectionRecordController.java View File

@@ -15,6 +15,8 @@ import org.slf4j.LoggerFactory;
15 15
 import org.springframework.beans.factory.annotation.Autowired;
16 16
 import org.springframework.web.bind.annotation.*;
17 17
 
18
+import javax.servlet.http.HttpServletRequest;
19
+
18 20
 /**
19 21
  * <p>
20 22
  * 预选记录表  前端控制器
@@ -24,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
24 26
  * @since 2020-02-10
25 27
  */
26 28
 @RestController
27
-@RequestMapping("/")
29
+@RequestMapping("/api")
28 30
 public class TaPreselectionRecordController extends BaseController {
29 31
 
30 32
     private final Logger logger = LoggerFactory.getLogger(TaPreselectionRecordController.class);
@@ -39,8 +41,9 @@ public class TaPreselectionRecordController extends BaseController {
39 41
      * @param pageNum
40 42
      * @param pageSize
41 43
      * @return
44
+     * @author gushaoyong
42 45
      */
43
-    @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.GET)
46
+    @RequestMapping(value = "/admin/taPreselectionRecord", method = RequestMethod.GET)
44 47
     public ResponseBean taPreselectionRecordList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
45 48
                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
46 49
         ResponseBean responseBean = new ResponseBean();
@@ -65,17 +68,19 @@ public class TaPreselectionRecordController extends BaseController {
65 68
      *
66 69
      * @param taPreselectionRecord 实体对象
67 70
      * @return
71
+     * @author gushaoyong
68 72
      */
69
-    @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.POST)
70
-    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord) {
73
+    @RequestMapping(value = "/wx/taPreselectionRecord", method = RequestMethod.POST)
74
+    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord, HttpServletRequest request) {
71 75
         ResponseBean responseBean = new ResponseBean();
72
-
76
+        Integer orgId = getOrgId(request);
73 77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
74 78
 
79
+        taPreselectionRecord.setOrgId(orgId);
75 80
         try {
76 81
 
77 82
             // 校验参数
78
-            if (StringUtils.isBlank(taPreselectionRecord.getHouseId()) && StringUtils.isBlank(taPreselectionRecord.getPersonId()) &&
83
+            if (StringUtils.isBlank(taPreselectionRecord.getHouseId()) || StringUtils.isBlank(taPreselectionRecord.getPersonId()) ||
79 84
                 taPreselectionRecord.getOrgId() == null) {
80 85
                 logger.info("taPreselectionRecordAdd 参数错误");
81 86
                 responseBean.addError("参数错误");
@@ -162,17 +167,16 @@ public class TaPreselectionRecordController extends BaseController {
162 167
     /**
163 168
      * 取消房源预选
164 169
      *
165
-     * @param personId 用户ID
166 170
      * @return
167 171
      */
168
-    @RequestMapping("/wx/taPreselectionRecordCancel")
169
-    public ResponseBean taPreselectionRecordCancel(@RequestParam("personId") String personId,
170
-                                                   @RequestParam("houseId") String houseId) {
172
+    @RequestMapping(value = "/wx/taPreselectionRecordCancel", method = RequestMethod.DELETE)
173
+    public ResponseBean taPreselectionRecordCancel(@RequestParam("houseId") String houseId,
174
+                                                   @RequestParam("personId") String personId) {
171 175
         ResponseBean responseBean = new ResponseBean();
172 176
         try {
173
-            responseBean.addSuccess(iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId));
177
+            responseBean = iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId);
174 178
         } catch (Exception e) {
175
-            logger.error("taPreselectionRecordCancel -=- {}", e.toString());
179
+            logger.error("taPreselectionRecordCancel -=- {}", e);
176 180
             responseBean.addError(e.getMessage());
177 181
         }
178 182
         return responseBean;
@@ -185,36 +189,39 @@ public class TaPreselectionRecordController extends BaseController {
185 189
      * @param pageSize 分页大小
186 190
      * @param personId 用户ID
187 191
      * @return
192
+     * @author gushaoyong
188 193
      */
189
-    @RequestMapping(value = "/wx/listPreselectionRecord", method = RequestMethod.POST)
194
+    @RequestMapping(value = "/wx/listPreselectionRecord", method = RequestMethod.GET)
190 195
     public ResponseBean listPreselectionRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
191 196
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
192
-                                               @RequestParam("personId") String personId) {
197
+                                               @RequestParam("personId") String personId,
198
+                                               HttpServletRequest request) {
193 199
         ResponseBean responseBean = new ResponseBean();
200
+        Integer orgId = getOrgId(request);
194 201
         try {
195
-            responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, personId));
202
+            responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, orgId, personId));
196 203
         } catch (Exception e) {
197
-            logger.error("listPreselectionRecord -=- {}", e.toString());
204
+            logger.error("listPreselectionRecord -=- {}", e);
198 205
             responseBean.addError(e.getMessage());
199 206
         }
200 207
         return responseBean;
201 208
     }
202 209
 
203
-    /**
204
-     * 校验用户是否已经预选该房源
205
-     *
206
-     * @param personId 用户ID
207
-     * @param houseId  房源ID
208
-     * @return
209
-     */
210
-    @RequestMapping(value = "/wx/checkPreselect", method = RequestMethod.POST)
211
-    public ResponseBean checkPreselect(@RequestParam("personId") String personId,
212
-                                       @RequestParam("houseId") String houseId) {
210
+    @RequestMapping(value = "/admin/taPreselectRecord", method = RequestMethod.GET)
211
+    public ResponseBean selectPreSelectRecordList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
212
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
213
+                                                  @RequestParam(value = "salesBatchId") String salesBatchId,
214
+                                                  @RequestParam(value = "house", required = false) Integer house,
215
+                                                  @RequestParam(value = "phone", required = false) String phone,
216
+                                                  @RequestParam(value = "apartmentId", required = false) String apartmentId,
217
+                                                  @RequestParam(value = "status", required = false) Integer status,
218
+                                                  HttpServletRequest request) {
213 219
         ResponseBean responseBean = new ResponseBean();
214 220
         try {
215
-            responseBean.addSuccess(iTaPreselectionRecordService.checkPreselect(personId, houseId));
221
+            responseBean = iTaPreselectionRecordService.selectPreSelectRecordList(pageNum, pageSize, salesBatchId, house, getOrgId(request), phone, apartmentId, status);
216 222
         } catch (Exception e) {
217
-            logger.error("checkPreselect -=- {}", e.toString());
223
+            e.printStackTrace();
224
+            logger.error("taHousingResourcesList -=- {}", e.toString());
218 225
             responseBean.addError(e.getMessage());
219 226
         }
220 227
         return responseBean;

+ 134
- 40
src/main/java/com/huiju/estateagents/controller/TaSalesBatchController.java View File

@@ -5,8 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.entity.TaMiniapp;
8 10
 import com.huiju.estateagents.entity.TaSalesBatch;
11
+import com.huiju.estateagents.entity.TaShareContent;
12
+import com.huiju.estateagents.service.IMiniAppService;
13
+import com.huiju.estateagents.service.ITaMiniappService;
9 14
 import com.huiju.estateagents.service.ITaSalesBatchService;
15
+import com.huiju.estateagents.service.TaShareContentService;
10 16
 import io.swagger.models.auth.In;
11 17
 import org.slf4j.Logger;
12 18
 import org.slf4j.LoggerFactory;
@@ -16,11 +22,12 @@ import sun.misc.Request;
16 22
 
17 23
 import javax.servlet.http.HttpServletRequest;
18 24
 import java.time.LocalDateTime;
25
+import java.util.List;
19 26
 
20 27
 /**
21 28
  * <p>
22
-    * 销售批次表  前端控制器
23
-    * </p>
29
+ * 销售批次表  前端控制器
30
+ * </p>
24 31
  *
25 32
  * @author jobob
26 33
  * @since 2020-02-10
@@ -34,29 +41,38 @@ public class TaSalesBatchController extends BaseController {
34 41
     @Autowired
35 42
     public ITaSalesBatchService iTaSalesBatchService;
36 43
 
44
+    @Autowired
45
+    public ITaMiniappService taMiniappService;
46
+
47
+    @Autowired
48
+    public IMiniAppService miniAppService;
49
+
50
+    @Autowired
51
+    private TaShareContentService taShareContentService;
37 52
 
38 53
     /**
39 54
      * 分页查询列表
55
+     *
40 56
      * @param pageNum
41 57
      * @param pageSize
42 58
      * @return
43 59
      */
44
-    @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.GET)
45
-    public ResponseBean taSalesBatchList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
47
-                                         @RequestParam(value ="salesBatchName", required = false) String salesBatchName,
48
-                                         @RequestParam(value ="buildingId", required = false) String buildingId,
49
-                                         @RequestParam(value = "status", required = false) Integer status, HttpServletRequest request){
60
+    @RequestMapping(value = "/admin/taSalesBatch", method = RequestMethod.GET)
61
+    public ResponseBean taSalesBatchList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
62
+                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
63
+                                         @RequestParam(value = "salesBatchName", required = false) String salesBatchName,
64
+                                         @RequestParam(value = "buildingId", required = false) String buildingId,
65
+                                         @RequestParam(value = "status", required = false) Integer status, HttpServletRequest request) {
50 66
         ResponseBean responseBean = new ResponseBean();
51 67
         try {
52 68
             //使用分页插件
53
-		    IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
69
+            IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
54 70
 
55 71
             IPage<TaSalesBatch> result = iTaSalesBatchService.selectByCondition(pg, salesBatchName, buildingId, status, getOrgId(request));
56 72
             responseBean.addSuccess(result);
57
-        }catch (Exception e){
73
+        } catch (Exception e) {
58 74
             e.printStackTrace();
59
-            logger.error("taSalesBatchList -=- {}",e.toString());
75
+            logger.error("taSalesBatchList -=- {}", e.toString());
60 76
             responseBean.addError(e.getMessage());
61 77
         }
62 78
         return responseBean;
@@ -64,24 +80,63 @@ public class TaSalesBatchController extends BaseController {
64 80
 
65 81
     /**
66 82
      * 保存对象
83
+     *
67 84
      * @param taSalesBatch 实体对象
68 85
      * @return
69 86
      */
70
-    @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.POST)
71
-    public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch, HttpServletRequest request){
87
+    @RequestMapping(value = "/admin/taSalesBatch", method = RequestMethod.POST)
88
+    public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch, HttpServletRequest request) {
72 89
         ResponseBean responseBean = new ResponseBean();
73 90
         try {
74
-            taSalesBatch.setOrgId(getOrgId(request));
91
+            Integer orgId = getOrgId(request);
92
+
93
+            taSalesBatch.setOrgId(orgId);
75 94
             taSalesBatch.setCreateDate(LocalDateTime.now());
76 95
             taSalesBatch.setUpdateTime(LocalDateTime.now());
77
-            if (iTaSalesBatchService.save(taSalesBatch)){
78
-                responseBean.addSuccess(taSalesBatch);
79
-            }else {
80
-                responseBean.addError("fail");
81
-            }
82
-        }catch (Exception e){
96
+            iTaSalesBatchService.save(taSalesBatch);
97
+
98
+            QueryWrapper<TaMiniapp> taMiniappQuery = new QueryWrapper<>();
99
+            taMiniappQuery.eq("org_id", getOrgId(request));
100
+            TaMiniapp taMiniapp = taMiniappService.getOne(taMiniappQuery);
101
+            // 生成二维码
102
+            ResponseBean taMiniappQrcode = miniAppService.getQrCode(CommConstant.HOUSE_QRCODE.replace("#0", taSalesBatch.getSalesBatchId().toString()).replace("#1", "house"), taMiniapp.getMiniappId());
103
+            taSalesBatch.setQrCode(String.valueOf(taMiniappQrcode.getData()));
104
+            iTaSalesBatchService.updateById(taSalesBatch);
105
+
106
+            // 设置默认分享设置
107
+            TaShareContent shareContent = new TaShareContent();
108
+            shareContent.setOrgId(orgId);
109
+            shareContent.setTargetId(taSalesBatch.getSalesBatchId().toString());
110
+            shareContent.setShareContentTitle("诚挚邀您在线选房购房~");
111
+            shareContent.setShareContentImg(taSalesBatch.getAerialViewImg());
112
+            shareContent.setShareContentType("house");
113
+            shareContent.setStatus(1);
114
+            shareContent.setCreateDate(LocalDateTime.now());
115
+            taShareContentService.save(shareContent);
116
+
117
+            responseBean.addSuccess(taSalesBatch);
118
+        } catch (Exception e) {
119
+            e.printStackTrace();
120
+            logger.error("taSalesBatchAdd -=- {}", e.toString());
121
+            responseBean.addError(e.getMessage());
122
+        }
123
+        return responseBean;
124
+    }
125
+
126
+    /**
127
+     * 删除批次
128
+     *
129
+     * @param taSalesBatch 实体对象
130
+     * @return
131
+     */
132
+    @RequestMapping(value = "/admin/taSalesBatch", method = RequestMethod.PUT)
133
+    public ResponseBean taSalesBatchDel(@RequestBody List<TaSalesBatch> salesBatchs, HttpServletRequest request) {
134
+        ResponseBean responseBean = new ResponseBean();
135
+        try {
136
+            responseBean = iTaSalesBatchService.delSalesBatchList(getOrgId(request), salesBatchs);
137
+        } catch (Exception e) {
83 138
             e.printStackTrace();
84
-            logger.error("taSalesBatchAdd -=- {}",e.toString());
139
+            logger.error("taSalesBatchAdd -=- {}", e.toString());
85 140
             responseBean.addError(e.getMessage());
86 141
         }
87 142
         return responseBean;
@@ -89,21 +144,22 @@ public class TaSalesBatchController extends BaseController {
89 144
 
90 145
     /**
91 146
      * 根据id删除对象
92
-     * @param id  实体ID
147
+     *
148
+     * @param id 实体ID
93 149
      */
94 150
     @ResponseBody
95
-    @RequestMapping(value="/admin/taSalesBatch/{id}", method= RequestMethod.DELETE)
96
-    public ResponseBean taSalesBatchDelete(@PathVariable Integer id){
151
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.DELETE)
152
+    public ResponseBean taSalesBatchDelete(@PathVariable Integer id) {
97 153
         ResponseBean responseBean = new ResponseBean();
98 154
         try {
99
-            if(iTaSalesBatchService.removeById(id)){
155
+            if (iTaSalesBatchService.removeById(id)) {
100 156
                 responseBean.addSuccess("success");
101
-            }else {
157
+            } else {
102 158
                 responseBean.addError("fail");
103 159
             }
104
-        }catch (Exception e){
160
+        } catch (Exception e) {
105 161
             e.printStackTrace();
106
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
162
+            logger.error("taSalesBatchDelete -=- {}", e.toString());
107 163
             responseBean.addError(e.getMessage());
108 164
         }
109 165
         return responseBean;
@@ -111,24 +167,25 @@ public class TaSalesBatchController extends BaseController {
111 167
 
112 168
     /**
113 169
      * 修改对象
114
-     * @param id  实体ID
170
+     *
171
+     * @param id           实体ID
115 172
      * @param taSalesBatch 实体对象
116 173
      * @return
117 174
      */
118
-    @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.PUT)
175
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.PUT)
119 176
     public ResponseBean taSalesBatchUpdate(@PathVariable Integer id,
120
-                                           @RequestBody TaSalesBatch taSalesBatch){
177
+                                           @RequestBody TaSalesBatch taSalesBatch) {
121 178
         ResponseBean responseBean = new ResponseBean();
122 179
         try {
123 180
             taSalesBatch.setSalesBatchId(id);
124
-            if (iTaSalesBatchService.updateById(taSalesBatch)){
181
+            if (iTaSalesBatchService.updateById(taSalesBatch)) {
125 182
                 responseBean.addSuccess(taSalesBatch);
126
-            }else {
183
+            } else {
127 184
                 responseBean.addError("fail");
128 185
             }
129
-        }catch (Exception e){
186
+        } catch (Exception e) {
130 187
             e.printStackTrace();
131
-            logger.error("taSalesBatchUpdate -=- {}",e.toString());
188
+            logger.error("taSalesBatchUpdate -=- {}", e.toString());
132 189
             responseBean.addError(e.getMessage());
133 190
         }
134 191
         return responseBean;
@@ -136,16 +193,53 @@ public class TaSalesBatchController extends BaseController {
136 193
 
137 194
     /**
138 195
      * 根据id查询对象
139
-     * @param id  实体ID
196
+     *
197
+     * @param id 实体ID
140 198
      */
141
-    @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.GET)
142
-    public ResponseBean taSalesBatchGet(@PathVariable Integer id){
199
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.GET)
200
+    public ResponseBean taSalesBatchGet(@PathVariable Integer id) {
143 201
         ResponseBean responseBean = new ResponseBean();
144 202
         try {
145 203
             responseBean.addSuccess(iTaSalesBatchService.getById(id));
146
-        }catch (Exception e){
204
+        } catch (Exception e) {
205
+            e.printStackTrace();
206
+            logger.error("taSalesBatchDelete -=- {}", e.toString());
207
+            responseBean.addError(e.getMessage());
208
+        }
209
+        return responseBean;
210
+    }
211
+
212
+    /**
213
+     * 根据id提示信息-小程序端
214
+     *
215
+     * @param id 实体ID
216
+     */
217
+    @RequestMapping(value = "/wx/getNoticeInfo/{id}", method = RequestMethod.GET)
218
+    public ResponseBean getNoticeInfo(@PathVariable Integer id) {
219
+        ResponseBean responseBean = new ResponseBean();
220
+        try {
221
+            responseBean = iTaSalesBatchService.getNoticeInfo(id);
222
+        } catch (Exception e) {
223
+            e.printStackTrace();
224
+            logger.error("getNoticeInfo -=- {}", e.toString());
225
+            responseBean.addError(e.getMessage());
226
+        }
227
+        return responseBean;
228
+    }
229
+
230
+    /**
231
+     * 根据id查询对象--小程序
232
+     *
233
+     * @param id 实体ID
234
+     */
235
+    @RequestMapping(value = "/wx/taSalesBatch/{id}", method = RequestMethod.GET)
236
+    public ResponseBean taSalesBatchGetForMiniApp(@PathVariable Integer id) {
237
+        ResponseBean responseBean = new ResponseBean();
238
+        try {
239
+            responseBean = iTaSalesBatchService.getSalesBatchById(id);
240
+        } catch (Exception e) {
147 241
             e.printStackTrace();
148
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
242
+            logger.error("taSalesBatchGetForMiniApp -=- {}", e.toString());
149 243
             responseBean.addError(e.getMessage());
150 244
         }
151 245
         return responseBean;

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaShareController.java View File

@@ -66,7 +66,7 @@ public class TaShareController extends BaseController {
66 66
                                          @RequestParam(value = "shareType", required = false)String shareType,
67 67
                                          @RequestParam(value = "personType", required = false)String personType,
68 68
                                          @RequestParam(value = "phone", required = false)String phone,
69
-                                         Integer salesBatchId, HttpServletRequest request){
69
+                                         @RequestParam(value = "salesBatchId")Integer salesBatchId, HttpServletRequest request){
70 70
         ResponseBean responseBean = new ResponseBean();
71 71
         try {
72 72
             if (salesBatchId == null){

+ 24
- 0
src/main/java/com/huiju/estateagents/controller/TaSharePersonFromController.java View File

@@ -154,4 +154,28 @@ public class TaSharePersonFromController extends BaseController {
154 154
         }
155 155
         return responseBean;
156 156
     }
157
+
158
+    /**
159
+     * 根据id查询对象
160
+     */
161
+    @RequestMapping(value="api/admin/taHouseVisit",method= RequestMethod.GET)
162
+    public ResponseBean taSharePersonFromVisit(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
163
+                                               @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
164
+                                               @RequestParam(value = "sceneType", required = false)String sceneType,
165
+                                               @RequestParam(value = "personType", required = false)String personType,
166
+                                               @RequestParam(value = "phone", required = false)String phone,
167
+                                               @RequestParam(value = "salesBatchId")String salesBatchId, HttpServletRequest request){
168
+        ResponseBean responseBean = new ResponseBean();
169
+        try {
170
+            if (salesBatchId == null){
171
+                return ResponseBean.success("");
172
+            }
173
+            responseBean = iTaSharePersonFromService.selectHouseVisitList(pageNum, pageSize, getOrgId(request), personType, sceneType, phone, salesBatchId);
174
+        }catch (Exception e){
175
+            e.printStackTrace();
176
+            logger.error("taShareCountList -=- {}",e.toString());
177
+            responseBean.addError(e.getMessage());
178
+        }
179
+        return responseBean;
180
+    }
157 181
 }

+ 4
- 1
src/main/java/com/huiju/estateagents/entity/TaBuilding.java View File

@@ -340,6 +340,9 @@ public class TaBuilding implements Serializable {
340 340
     /**
341 341
      * 项目亮点封面
342 342
      */
343
-    @TableField(strategy=FieldStrategy.IGNORED)
343
+    @TableField(strategy = FieldStrategy.IGNORED)
344 344
     private String highlightsCover;
345
+
346
+    @TableField(exist = false)
347
+    private List<TaSalesBatch> salesBatch;
345 348
 }

+ 7
- 2
src/main/java/com/huiju/estateagents/entity/TaBuildingBlock.java View File

@@ -40,10 +40,15 @@ public class TaBuildingBlock implements Serializable {
40 40
      */
41 41
     private String blockName;
42 42
 
43
+    /**
44
+     * 期id
45
+     */
46
+    private Integer termId;
47
+
43 48
     /**
44 49
      * 状态
45 50
      */
46
-    private String status;
51
+    private Integer status;
47 52
 
48 53
     /**
49 54
      * 公司id
@@ -58,7 +63,7 @@ public class TaBuildingBlock implements Serializable {
58 63
     /**
59 64
      * 更新时间
60 65
      */
61
-    private String updateDate;
66
+    private LocalDateTime updateDate;
62 67
 
63 68
 
64 69
 }

+ 7
- 2
src/main/java/com/huiju/estateagents/entity/TaBuildingFloor.java View File

@@ -40,6 +40,11 @@ public class TaBuildingFloor implements Serializable {
40 40
      */
41 41
     private Integer blockId;
42 42
 
43
+    /**
44
+     * 期id
45
+     */
46
+    private Integer termId;
47
+
43 48
     /**
44 49
      * 单元id
45 50
      */
@@ -53,7 +58,7 @@ public class TaBuildingFloor implements Serializable {
53 58
     /**
54 59
      * 状态
55 60
      */
56
-    private String status;
61
+    private Integer status;
57 62
 
58 63
     /**
59 64
      * 公司id
@@ -68,7 +73,7 @@ public class TaBuildingFloor implements Serializable {
68 73
     /**
69 74
      * 更新时间
70 75
      */
71
-    private String updateDate;
76
+    private LocalDateTime updateDate;
72 77
 
73 78
 
74 79
 }

+ 7
- 2
src/main/java/com/huiju/estateagents/entity/TaBuildingRoom.java View File

@@ -40,6 +40,11 @@ public class TaBuildingRoom implements Serializable {
40 40
      */
41 41
     private Integer blockId;
42 42
 
43
+    /**
44
+     * 期id
45
+     */
46
+    private Integer termId;
47
+
43 48
     /**
44 49
      * 单元id
45 50
      */
@@ -58,7 +63,7 @@ public class TaBuildingRoom implements Serializable {
58 63
     /**
59 64
      * 状态
60 65
      */
61
-    private String status;
66
+    private Integer status;
62 67
 
63 68
     /**
64 69
      * 公司id
@@ -73,7 +78,7 @@ public class TaBuildingRoom implements Serializable {
73 78
     /**
74 79
      * 更新时间
75 80
      */
76
-    private String updateDate;
81
+    private LocalDateTime updateDate;
77 82
 
78 83
 
79 84
 }

+ 64
- 0
src/main/java/com/huiju/estateagents/entity/TaBuildingTerm.java View File

@@ -0,0 +1,64 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 楼栋期表 
15
+ * </p>
16
+ *
17
+ * @author jobob
18
+ * @since 2020-02-12
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaBuildingTerm implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 楼栋期id
29
+     */
30
+    @TableId(value = "term_id", type = IdType.AUTO)
31
+    private Integer termId;
32
+
33
+    /**
34
+     * 楼盘id
35
+     */
36
+    private String buildingId;
37
+
38
+    /**
39
+     * 楼栋名称
40
+     */
41
+    private String termName;
42
+
43
+    /**
44
+     * 状态
45
+     */
46
+    private Integer status;
47
+
48
+    /**
49
+     * 公司id
50
+     */
51
+    private Integer orgId;
52
+
53
+    /**
54
+     * 创建时间
55
+     */
56
+    private LocalDateTime createDate;
57
+
58
+    /**
59
+     * 更新时间
60
+     */
61
+    private LocalDateTime updateDate;
62
+
63
+
64
+}

+ 7
- 2
src/main/java/com/huiju/estateagents/entity/TaBuildingUnit.java View File

@@ -40,6 +40,11 @@ public class TaBuildingUnit implements Serializable {
40 40
      */
41 41
     private Integer blockId;
42 42
 
43
+    /**
44
+     * 期id
45
+     */
46
+    private Integer termId;
47
+
43 48
     /**
44 49
      * 单元
45 50
      */
@@ -48,7 +53,7 @@ public class TaBuildingUnit implements Serializable {
48 53
     /**
49 54
      * 状态
50 55
      */
51
-    private String status;
56
+    private Integer status;
52 57
 
53 58
     /**
54 59
      * 公司id
@@ -63,7 +68,7 @@ public class TaBuildingUnit implements Serializable {
63 68
     /**
64 69
      * 更新时间
65 70
      */
66
-    private String updateDate;
71
+    private LocalDateTime updateDate;
67 72
 
68 73
 
69 74
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaConsultantInfo.java View File

@@ -32,6 +32,8 @@ public class TaConsultantInfo {
32 32
 
33 33
     private Integer drainageShareNum;
34 34
 
35
+    private Integer houseShareNum;
36
+
35 37
     private Integer buildingTypeId;
36 38
 
37 39
     private String priceType;

+ 24
- 5
src/main/java/com/huiju/estateagents/entity/TaHousingResources.java View File

@@ -3,6 +3,7 @@ package com.huiju.estateagents.entity;
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import com.baomidou.mybatisplus.annotation.TableField;
5 5
 import com.baomidou.mybatisplus.annotation.TableId;
6
+import io.swagger.models.auth.In;
6 7
 import lombok.Data;
7 8
 import lombok.EqualsAndHashCode;
8 9
 import lombok.experimental.Accessors;
@@ -10,6 +11,7 @@ import lombok.experimental.Accessors;
10 11
 import java.io.Serializable;
11 12
 import java.math.BigDecimal;
12 13
 import java.time.LocalDateTime;
14
+import java.util.List;
13 15
 
14 16
 /**
15 17
  * <p>
@@ -37,6 +39,11 @@ public class TaHousingResources implements Serializable {
37 39
      */
38 40
     private String buildingId;
39 41
 
42
+    /**
43
+     * 楼盘名称
44
+     */
45
+    private String buildingName;
46
+
40 47
     /**
41 48
      * 楼栋 与楼盘区分
42 49
      */
@@ -50,7 +57,7 @@ public class TaHousingResources implements Serializable {
50 57
     /**
51 58
      * 销售批次id
52 59
      */
53
-    private String salesBatchId;
60
+    private Integer salesBatchId;
54 61
 
55 62
     /**
56 63
      * 单元id
@@ -75,13 +82,23 @@ public class TaHousingResources implements Serializable {
75 82
     /**
76 83
      * 房号id
77 84
      */
78
-    private String roomId;
85
+    private Integer roomId;
79 86
 
80 87
     /**
81 88
      * 房间名称
82 89
      */
83 90
     private String roomName;
84 91
 
92
+    /**
93
+     * 期id
94
+     */
95
+    private Integer termId;
96
+
97
+    /**
98
+     * 期名称
99
+     */
100
+    private String termName;
101
+
85 102
     /**
86 103
      * 价格
87 104
      */
@@ -95,7 +112,6 @@ public class TaHousingResources implements Serializable {
95 112
     /**
96 113
      * 实际热度
97 114
      */
98
-    @TableField(exist = false)
99 115
     private Integer realHeat;
100 116
 
101 117
     /**
@@ -112,7 +128,7 @@ public class TaHousingResources implements Serializable {
112 128
     /**
113 129
      * 状态
114 130
      */
115
-    private String status;
131
+    private Integer status;
116 132
 
117 133
     /**
118 134
      * 公司id
@@ -127,10 +143,13 @@ public class TaHousingResources implements Serializable {
127 143
     /**
128 144
      * 更新时间
129 145
      */
130
-    private String updateDate;
146
+    private LocalDateTime updateDate;
131 147
 
132 148
     private Integer updateUser;
133 149
 
134 150
     @TableField(exist = false)
135 151
     private String updateName;
152
+
153
+    @TableField(exist = false)
154
+    private List<TaHousingResources> houseIdList;
136 155
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/entity/TaPoster.java View File

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableName;
5 6
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -79,4 +80,7 @@ public class TaPoster implements Serializable {
79 80
 
80 81
     @TableField(exist = false)
81 82
     private List<Integer> templateIds = new ArrayList<>();
83
+
84
+    @TableField(exist = false)
85
+    private List<TdPosterTemplate> templates;
82 86
 }

+ 8
- 0
src/main/java/com/huiju/estateagents/entity/TaPreselectionRecord.java View File

@@ -65,5 +65,13 @@ public class TaPreselectionRecord implements Serializable {
65 65
      */
66 66
     private Integer updateUser;
67 67
 
68
+    /**
69
+     * 销售批次id
70
+     */
71
+    private Integer salesBatchId;
68 72
 
73
+    /**
74
+     * 楼盘id
75
+     */
76
+    private String buildingId;
69 77
 }

+ 12
- 0
src/main/java/com/huiju/estateagents/entity/TaSalesBatch.java View File

@@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
9 9
 
10 10
 import java.io.Serializable;
11 11
 import java.time.LocalDateTime;
12
+import java.util.List;
12 13
 
13 14
 /**
14 15
  * <p>
@@ -86,10 +87,21 @@ public class TaSalesBatch implements Serializable {
86 87
      */
87 88
     private String remark;
88 89
 
90
+    /**
91
+     * 房源列表二维码
92
+     */
93
+    private String qrCode;
94
+
89 95
     /**
90 96
      * 项目名称
91 97
      */
92 98
     @TableField(exist = false)
93 99
     private String buildingName;
94 100
 
101
+    @TableField(exist = false)
102
+    private List<TaPoster> posters;
103
+
104
+    @TableField(exist = false)
105
+    private List<TaShareContent> shareContents;
106
+
95 107
 }

+ 17
- 0
src/main/java/com/huiju/estateagents/entity/TaSharePersonFrom.java View File

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import lombok.Data;
6 7
 import lombok.EqualsAndHashCode;
@@ -74,5 +75,21 @@ public class TaSharePersonFrom implements Serializable {
74 75
 
75 76
     private Boolean isFirstTime;
76 77
 
78
+    @TableField(exist = false)
79
+    private String nameOrnick;
77 80
 
81
+    @TableField(exist = false)
82
+    private String sceneName;
83
+
84
+    @TableField(exist = false)
85
+    private String name;
86
+
87
+    @TableField(exist = false)
88
+    private String phone;
89
+
90
+    @TableField(exist = false)
91
+    private String photoOravatar;
92
+
93
+    @TableField(exist = false)
94
+    private String salesBatchName;
78 95
 }

+ 18
- 0
src/main/java/com/huiju/estateagents/mapper/TaBuildingTermMapper.java View File

@@ -0,0 +1,18 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.huiju.estateagents.entity.TaBuildingTerm;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 楼栋期表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author jobob
13
+ * @since 2020-02-12
14
+ */
15
+@Mapper
16
+public interface TaBuildingTermMapper extends BaseMapper<TaBuildingTerm> {
17
+
18
+}

+ 32
- 6
src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.huiju.estateagents.entity.TaBuildingApartment;
6 6
 import com.huiju.estateagents.entity.TaHousingResources;
7
+import com.huiju.estateagents.entity.TaSalesBatch;
7 8
 import com.huiju.estateagents.po.TaHousingResourcesPO;
8 9
 import org.apache.ibatis.annotations.Mapper;
9 10
 import org.apache.ibatis.annotations.Param;
@@ -26,18 +27,19 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
26 27
     /**
27 28
      * 分页获取房源列表
28 29
      *
29
-     * @param iPage
30 30
      * @param salesBatchId
31 31
      * @param startPrice
32 32
      * @param endPrice
33 33
      * @param apartmentId
34
+     * @param type         为1只展示已发布的房源
34 35
      * @return
35 36
      */
36
-    IPage<TaHousingResourcesPO> listHousingResources(IPage<TaHousingResourcesPO> iPage,
37
-                                                     @Param("salesBatchId") String salesBatchId,
38
-                                                     @Param("startPrice") String startPrice,
39
-                                                     @Param("endPrice") String endPrice,
40
-                                                     @Param("apartmentId") String apartmentId);
37
+    List<TaHousingResourcesPO> listHousingResources(@Param("orgId") Integer orgId,
38
+                                                    @Param("salesBatchId") String salesBatchId,
39
+                                                    @Param("startPrice") String startPrice,
40
+                                                    @Param("endPrice") String endPrice,
41
+                                                    @Param("apartmentId") String apartmentId,
42
+                                                    @Param("type") Integer type);
41 43
 
42 44
     /**
43 45
      * 获取某销售批次下所有房源户型
@@ -72,4 +74,28 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
72 74
      */
73 75
     TaHousingResourcesPO getHousingDetailById(@Param("houseId") String houseId,
74 76
                                               @Param("type") String type);
77
+
78
+    /**
79
+     * 分页获取数据
80
+     *
81
+     * @param pg
82
+     * @param salesBatchId
83
+     * @param buildingId
84
+     * @param orgId
85
+     * @param termName
86
+     * @param blockName
87
+     * @param unitName
88
+     * @param floorName
89
+     * @param roomName
90
+     * @param apartmentId
91
+     * @param status
92
+     * @param houseId
93
+     * @return
94
+     */
95
+    IPage<TaHousingResources> getHouseResourceList(IPage<TaHousingResources> pg,@Param("salesBatchId") Integer salesBatchId,@Param("buildingId") String buildingId,
96
+                                                   @Param("orgId") Integer orgId,@Param("termName") String termName,@Param("blockName") String blockName,
97
+                                                   @Param("unitName") String unitName,@Param("floorName") String floorName,@Param("roomName") String roomName,
98
+                                                   @Param("apartmentId") String apartmentId,@Param("status") Integer status,@Param("houseId") String houseId);
99
+
100
+    List<TaHousingResources> selectHousingList(@Param("orgId") Integer orgId,@Param("taSalesBatchList") List<TaSalesBatch> taSalesBatchList);
75 101
 }

+ 25
- 1
src/main/java/com/huiju/estateagents/mapper/TaPreselectionRecordMapper.java View File

@@ -2,12 +2,15 @@ package com.huiju.estateagents.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 6
 import com.huiju.estateagents.entity.TaPreselectionRecord;
6 7
 import com.huiju.estateagents.po.TaPreselectionRecordPO;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
9 10
 import org.springframework.stereotype.Component;
10 11
 
12
+import java.util.List;
13
+
11 14
 /**
12 15
  * <p>
13 16
  * 预选记录表  Mapper 接口
@@ -27,7 +30,9 @@ public interface TaPreselectionRecordMapper extends BaseMapper<TaPreselectionRec
27 30
      * @param personId
28 31
      * @return
29 32
      */
30
-    IPage<TaPreselectionRecordPO> listPreselectionRecord(IPage<TaPreselectionRecordPO> iPage, @Param("personId") String personId);
33
+    IPage<TaPreselectionRecordPO> listPreselectionRecord(IPage<TaPreselectionRecordPO> iPage,
34
+                                                         @Param("orgId") Integer orgId,
35
+                                                         @Param("personId") String personId);
31 36
 
32 37
     /**
33 38
      * 根据房源ID和用户ID获取预选记录
@@ -38,4 +43,23 @@ public interface TaPreselectionRecordMapper extends BaseMapper<TaPreselectionRec
38 43
      */
39 44
     TaPreselectionRecord getRecordByPersonIdAndHouseId(@Param("personId") String personId,
40 45
                                                        @Param("houseId") String houseId);
46
+
47
+    /**
48
+     * 查询预选记录表
49
+     * @param page
50
+     * @param salesBatchId
51
+     * @param houseId
52
+     * @param orgId
53
+     * @param phone
54
+     * @param apartmentId
55
+     * @param status
56
+     * @return
57
+     */
58
+    List<TaPreselectionRecord> selectPreSelectRecordList(Page page,
59
+                                                         @Param("salesBatchId") String salesBatchId,
60
+                                                         @Param("houseId") Integer houseId,
61
+                                                         @Param("orgId") Integer orgId,
62
+                                                         @Param("phone") String phone,
63
+                                                         @Param("apartmentId") String apartmentId,
64
+                                                         @Param("status") Integer status);
41 65
 }

+ 22
- 0
src/main/java/com/huiju/estateagents/mapper/TaSalesBatchMapper.java View File

@@ -6,6 +6,9 @@ import com.huiju.estateagents.entity.TaSalesBatch;
6 6
 import org.apache.ibatis.annotations.Mapper;
7 7
 import org.apache.ibatis.annotations.Param;
8 8
 
9
+import java.util.List;
10
+import java.util.Map;
11
+
9 12
 /**
10 13
  * <p>
11 14
  * 销售批次表  Mapper 接口
@@ -17,4 +20,23 @@ import org.apache.ibatis.annotations.Param;
17 20
 @Mapper
18 21
 public interface TaSalesBatchMapper extends BaseMapper<TaSalesBatch> {
19 22
     IPage<TaSalesBatch> selectByCondition(IPage<TaSalesBatch> page, @Param("salesBatchName") String salesBatchName, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId);
23
+
24
+    /**
25
+     * 根据批次号统计预选数据
26
+     *
27
+     * @param orgId
28
+     * @param taSalesBatchList
29
+     * @return
30
+     */
31
+    Integer countPreSelectRecord(@Param("orgId") Integer orgId, @Param("taSalesBatchList") List<TaSalesBatch> taSalesBatchList);
32
+
33
+    void updateSalesBatchStatus(@Param("orgId") Integer orgId, @Param("taSalesBatchList") List<TaSalesBatch> taSalesBatchList);
34
+
35
+    /**
36
+     * 获取房源总数和总热度
37
+     *
38
+     * @param salesBatchId
39
+     * @return
40
+     */
41
+    Map<String,Object> getTotalHousesAndHeat(@Param("salesBatchId") Integer salesBatchId);
20 42
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/mapper/TaSharePersonFromMapper.java View File

@@ -1,10 +1,13 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 5
 import com.huiju.estateagents.entity.TaSharePersonFrom;
5 6
 import org.apache.ibatis.annotations.Mapper;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
9
+import java.util.List;
10
+
8 11
 /**
9 12
  * <p>
10 13
  *   Mapper 接口
@@ -16,4 +19,5 @@ import org.apache.ibatis.annotations.Param;
16 19
 @Mapper
17 20
 public interface TaSharePersonFromMapper extends BaseMapper<TaSharePersonFrom> {
18 21
     Integer countViewNum(@Param("userId") Integer userId, @Param("orgId")Integer orgId, @Param("personId")String personId, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate);
22
+    List<TaSharePersonFrom> selectHouseVisitList(Page page, @Param("orgId") Integer orgId, @Param("personType") String personType, @Param("sceneType")String sceneType, @Param("phone")String phone, @Param("saleBatchId")String saleBatchId);
19 23
 }

+ 31
- 0
src/main/java/com/huiju/estateagents/po/BuildingImgPO.java View File

@@ -0,0 +1,31 @@
1
+package com.huiju.estateagents.po;
2
+
3
+import lombok.Data;
4
+import lombok.EqualsAndHashCode;
5
+import lombok.experimental.Accessors;
6
+
7
+/**
8
+ * @Auther: gusy
9
+ * @Date: 2020/2/19 16:24
10
+ */
11
+@Data
12
+@EqualsAndHashCode(callSuper = false)
13
+@Accessors(chain = true)
14
+public class BuildingImgPO {
15
+
16
+    /**
17
+     * 是否全景图,1是
18
+     */
19
+    private Integer type;
20
+
21
+    /**
22
+     * 图片链接
23
+     */
24
+    private String url;
25
+
26
+    /**
27
+     * 全景图链接
28
+     */
29
+    private String panoramaLink;
30
+
31
+}

+ 15
- 6
src/main/java/com/huiju/estateagents/po/TaHousingResourcesPO.java View File

@@ -1,12 +1,15 @@
1 1
 package com.huiju.estateagents.po;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.huiju.estateagents.entity.TaBuildingImg;
5
+import com.huiju.estateagents.entity.TaBuildingPanorama;
4 6
 import com.huiju.estateagents.entity.TaHousingResources;
5 7
 import lombok.Data;
6 8
 import lombok.EqualsAndHashCode;
7 9
 import lombok.experimental.Accessors;
8 10
 
9 11
 import java.time.LocalDateTime;
12
+import java.util.List;
10 13
 
11 14
 /**
12 15
  * @Auther: gusy
@@ -17,17 +20,12 @@ import java.time.LocalDateTime;
17 20
 @Accessors(chain = true)
18 21
 public class TaHousingResourcesPO extends TaHousingResources {
19 22
 
20
-    /**
21
-     * 户型名称
22
-     */
23
-    private String apartmentName;
24
-
25 23
     private Double insideArea;
26 24
 
27 25
     private Double buildingArea;
28 26
 
29 27
     /**
30
-     * 是否预选已经预选,1 是 0
28
+     * 是否已经预选该房源,true 是 false
31 29
      */
32 30
     @TableField(exist = false)
33 31
     private Boolean isPreselect;
@@ -46,4 +44,15 @@ public class TaHousingResourcesPO extends TaHousingResources {
46 44
      * 销售批次状态
47 45
      */
48 46
     private Integer saleBatchStatus;
47
+
48
+    /**
49
+     * 户型图片列表
50
+     */
51
+    @TableField(exist = false)
52
+    private List<BuildingImgPO> buildingImgList;
53
+
54
+    /**
55
+     * 楼盘名称
56
+     */
57
+    private String buildingName;
49 58
 }

+ 65
- 0
src/main/java/com/huiju/estateagents/po/TaPreselectionRecordPO.java View File

@@ -1,10 +1,14 @@
1 1
 package com.huiju.estateagents.po;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.huiju.estateagents.entity.TaBuildingImg;
3 5
 import com.huiju.estateagents.entity.TaPreselectionRecord;
4 6
 import lombok.Data;
5 7
 import lombok.EqualsAndHashCode;
6 8
 import lombok.experimental.Accessors;
7 9
 
10
+import java.util.List;
11
+
8 12
 /**
9 13
  * @Auther: gusy
10 14
  * @Date: 2020/2/11 15:16
@@ -38,4 +42,65 @@ public class TaPreselectionRecordPO extends TaPreselectionRecord {
38 42
      * 价格
39 43
      */
40 44
     private String price;
45
+
46
+    /**
47
+     * 户型id
48
+     */
49
+    private String apartmentId;
50
+
51
+    /**
52
+     * 户型名称
53
+     */
54
+    private String apartmentName;
55
+
56
+    /**
57
+     * 楼盘名称
58
+     */
59
+    private String buildingName;
60
+
61
+    /**
62
+     * 户型图片列表
63
+     */
64
+    @TableField(exist = false)
65
+    private List<TaBuildingImg> buildingImgList;
66
+
67
+    /**
68
+     * 期区
69
+     */
70
+    private String termname;
71
+
72
+    /**
73
+     * 用户昵称
74
+     */
75
+    private String nameOrnick;
76
+
77
+    /**
78
+     * 用户U型明
79
+     */
80
+    private String name;
81
+
82
+    /**
83
+     * 用户头像
84
+     */
85
+    private String avatarurl;
86
+
87
+    /**
88
+     * 手机号
89
+     */
90
+    private String phone;
91
+
92
+    /**
93
+     * 最后修改人
94
+     */
95
+    private String updateName;
96
+
97
+    /**
98
+     * 房源状态
99
+     */
100
+    private String housingStatus;
101
+
102
+    /**
103
+     * 销售批次装填
104
+     */
105
+    private String saleBatchStatus;
41 106
 }

+ 16
- 0
src/main/java/com/huiju/estateagents/service/ITaBuildingTermService.java View File

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.entity.TaBuildingTerm;
5
+
6
+/**
7
+ * <p>
8
+ * 楼栋期表  服务类
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2020-02-12
13
+ */
14
+public interface ITaBuildingTermService extends IService<TaBuildingTerm> {
15
+
16
+}

+ 71
- 16
src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java View File

@@ -6,6 +6,7 @@ import com.huiju.estateagents.base.ResponseBean;
6 6
 import com.huiju.estateagents.entity.TaBuildingApartment;
7 7
 import com.huiju.estateagents.entity.TaHousingResources;
8 8
 import com.huiju.estateagents.po.TaHousingResourcesPO;
9
+import org.springframework.web.multipart.MultipartFile;
9 10
 
10 11
 import java.util.List;
11 12
 
@@ -19,28 +20,16 @@ import java.util.List;
19 20
  */
20 21
 public interface ITaHousingResourcesService extends IService<TaHousingResources> {
21 22
 
22
-    /**
23
-     * 分页获取房源详情数据
24
-     * @param salesBatchId
25
-     * @param buildingId
26
-     * @param pageNumber
27
-     * @param pageSize
28
-     * @param orgId
29
-     * @return
30
-     */
31
-    ResponseBean selectPageList(Integer salesBatchId, String buildingId, Integer pageNumber, Integer pageSize, Integer orgId);
32
-
33 23
     /* 分页获取房源列表
34 24
      *
35
-     * @param pageNum      页码
36
-     * @param pageSize     分页大小
37 25
      * @param salesBatchId 销售批次ID
38 26
      * @param startPrice
39 27
      * @param endPrice
40 28
      * @param apartmentId
29
+     * @param type  为1只展示已发布的房源
41 30
      * @return
42 31
      */
43
-    IPage<TaHousingResourcesPO> listHousingResources(Integer pageNum, Integer pageSize, String salesBatchId, String startPrice, String endPrice, String apartmentId);
32
+    List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type);
44 33
 
45 34
     /**
46 35
      * 获取某销售批次下所有房源户型
@@ -53,9 +42,75 @@ public interface ITaHousingResourcesService extends IService<TaHousingResources>
53 42
     /**
54 43
      * 根据房源ID获取房源详情
55 44
      *
56
-     * @param personId
45
+     * @param personId 用户ID
46
+     * @param houseId  房源ID
47
+     * @return
48
+     */
49
+    TaHousingResourcesPO getHousingDetailById(String personId, String houseId);
50
+
51
+    /**
52
+     * 校验楼栋信息存不存在
53
+     *
54
+     * @param taHousingResources
55
+     * @return
56
+     */
57
+    StringBuffer checked(TaHousingResources taHousingResources);
58
+
59
+    /**
60
+     * 添加楼栋信息
61
+     *
62
+     * @param taHousingResources
63
+     * @return
64
+     */
65
+    ResponseBean addHouseResources(TaHousingResources taHousingResources);
66
+
67
+    /**
68
+     * 分页获取房源信息
69
+     *
70
+     * @param salesBatchId
71
+     * @param buildingId
72
+     * @param pageNumber
73
+     * @param pageSize
74
+     * @param orgId
75
+     * @param termName
76
+     * @param blockName
77
+     * @param unitName
78
+     * @param floorName
79
+     * @param roomName
80
+     * @param apartmentId
81
+     * @param status
57 82
      * @param houseId
58 83
      * @return
59 84
      */
60
-    TaHousingResourcesPO getHousingDetailById(String personId,String houseId);
85
+    ResponseBean selectPageList(Integer salesBatchId, String buildingId, Integer pageNumber, Integer pageSize, Integer orgId, String termName, String blockName, String unitName, String floorName, String roomName, String apartmentId, Integer status, String houseId);
86
+
87
+    /**
88
+     * 更新房源信息
89
+     *
90
+     * @param taHousingResources
91
+     * @return
92
+     */
93
+    ResponseBean updateHouseResources(TaHousingResources taHousingResources);
94
+
95
+    /**
96
+     * 获取表格中的数据
97
+     *
98
+     * @param file
99
+     * @param salesBatchId
100
+     * @param buildingId
101
+     * @param orgId
102
+     * @return
103
+     */
104
+    ResponseBean getExcelData(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);
105
+
106
+    /**
107
+     * 保存文件
108
+     *
109
+     * @param file
110
+     * @param salesBatchId
111
+     * @param buildingId
112
+     * @param orgId
113
+     * @return
114
+     */
115
+    ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);
61 116
 }

+ 5
- 11
src/main/java/com/huiju/estateagents/service/ITaPreselectionRecordService.java View File

@@ -21,10 +21,11 @@ public interface ITaPreselectionRecordService extends IService<TaPreselectionRec
21 21
      *
22 22
      * @param pageNum
23 23
      * @param pageSize
24
+     * @param orgId
24 25
      * @param personId
25 26
      * @return
26 27
      */
27
-    IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, String personId);
28
+    IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId);
28 29
 
29 30
     /**
30 31
      * 添加预选记录预选
@@ -37,19 +38,12 @@ public interface ITaPreselectionRecordService extends IService<TaPreselectionRec
37 38
     /**
38 39
      * 取消预选
39 40
      *
40
-     * @param personId 用户ID
41
+     * @param personId
41 42
      * @param houseId  房源ID
42 43
      * @return
43 44
      */
44
-    Boolean taPreselectionRecordCancel(String personId, String houseId);
45
+    ResponseBean taPreselectionRecordCancel(String personId, String houseId);
45 46
 
46
-    /**
47
-     * 校验用户是否预选
48
-     *
49
-     * @param personId 用户ID
50
-     * @param houseId  房源ID
51
-     * @return
52
-     */
53
-    TaPreselectionRecord checkPreselect(String personId, String houseId);
47
+    ResponseBean selectPreSelectRecordList(Integer pageNum, Integer pageSize, String salesBatchId, Integer houseId, Integer orgId, String phone, String apartmentId, Integer status);
54 48
 
55 49
 }

+ 21
- 0
src/main/java/com/huiju/estateagents/service/ITaSalesBatchService.java View File

@@ -3,8 +3,11 @@ package com.huiju.estateagents.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.estateagents.base.ResponseBean;
6 7
 import com.huiju.estateagents.entity.TaSalesBatch;
7 8
 
9
+import java.util.List;
10
+
8 11
 /**
9 12
  * <p>
10 13
  * 销售批次表  服务类
@@ -15,4 +18,22 @@ import com.huiju.estateagents.entity.TaSalesBatch;
15 18
  */
16 19
 public interface ITaSalesBatchService extends IService<TaSalesBatch> {
17 20
     IPage<TaSalesBatch> selectByCondition(IPage<TaSalesBatch> page, String salesBatchName, String buildingId, Integer status, Integer orgId);
21
+
22
+    ResponseBean delSalesBatchList(Integer orgId, List<TaSalesBatch> taSalesBatchList);
23
+
24
+    /**
25
+     * 获取通知信息
26
+     *
27
+     * @param salesBatchId 销售批次ID
28
+     * @return
29
+     */
30
+    ResponseBean getNoticeInfo(Integer salesBatchId);
31
+
32
+    /**
33
+     * 获取销售批次详情
34
+     *
35
+     * @param salesBatchId
36
+     * @return
37
+     */
38
+    ResponseBean getSalesBatchById(Integer salesBatchId);
18 39
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/service/ITaSharePersonFromService.java View File

@@ -24,4 +24,6 @@ public interface ITaSharePersonFromService extends IService<TaSharePersonFrom> {
24 24
      * @return
25 25
      */
26 26
     TaSharePersonFrom addSharePersonRecord(String personId, Integer orgId, String from, String recommender, String targetId);
27
+
28
+    ResponseBean selectHouseVisitList(Integer pageNum, Integer pageSize, Integer orgId, String personType, String sceneType, String phone, String saleBatchId);
27 29
 }

+ 3
- 3
src/main/java/com/huiju/estateagents/service/impl/HelpRecordServiceImpl.java View File

@@ -62,13 +62,13 @@ public class HelpRecordServiceImpl extends ServiceImpl<HelpRecordMapper, HelpRec
62 62
 	 * @return
63 63
 	 */
64 64
 	@Override
65
-	public ResponseBean saveBooster(HelpRecord helpRecord, Integer orgId, TaPerson person) {
65
+	public synchronized ResponseBean saveBooster(HelpRecord helpRecord, Integer orgId, TaPerson person) {
66 66
 		//查看是否助力成功
67 67
 		HelpInitiateRecord helpInitiateRecord = helpInitiateRecordMapper.selectById(helpRecord.getHelpRecordInitiateId());
68 68
 		if (!StringUtils.isEmpty(helpInitiateRecord.getVerification())){
69 69
 			return ResponseBean.error("该活动已成功", ResponseBean.ERROR_UNAVAILABLE);
70 70
 		}
71
-		
71
+
72 72
 		HelpActivity helpActivity = helpActivityMapper.selectById(helpRecord.getHelpActivityId());
73 73
 		//是否助力成功
74 74
 		if (null != helpInitiateRecord.getEnlistNum() && helpInitiateRecord.getEnlistNum() >= helpActivity.getPersonNum()){
@@ -137,7 +137,7 @@ public class HelpRecordServiceImpl extends ServiceImpl<HelpRecordMapper, HelpRec
137 137
 		map.put("helpInitiateRecord",helpInitiateRecord);
138 138
 		return ResponseBean.success(map);
139 139
 	}
140
-	
140
+
141 141
 	/**
142 142
 	 * 发送微信消息
143 143
 	 * @param helpInitiateRecord

+ 96
- 83
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java View File

@@ -94,7 +94,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
94 94
     private TaShareContentService taShareContentService;
95 95
 
96 96
     @Autowired
97
-    private  TaOrgMapper  taOrgMapper;
97
+    private TaOrgMapper taOrgMapper;
98 98
 
99 99
     @Autowired
100 100
     private ITaBuildingMapRelationService iTaBuildingMapRelationService;
@@ -105,16 +105,19 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
105 105
     @Autowired
106 106
     private ITaBuildingPanoramaService taBuildingPanoramaService;
107 107
 
108
+    @Autowired
109
+    private ITaSalesBatchService iTaSalesBatchService;
110
+
108 111
     @Override
109
-    public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId,List<TaPersonBuilding> taPersonBuildingList) {
112
+    public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
110 113
         Page<TaBuilding> page = new Page<>();
111 114
         page.setSize(pageSize == null ? 10 : pageSize);
112 115
         page.setCurrent(pageNum == null ? 1 : pageNum);
113 116
 
114
-        List<TaBuilding> buildings = taBuildingMapper.buildingList(page, name, code,startDate,buildingStatus,marketStatus,cityId,isMain, orgId,taPersonBuildingList);
117
+        List<TaBuilding> buildings = taBuildingMapper.buildingList(page, name, code, startDate, buildingStatus, marketStatus, cityId, isMain, orgId, taPersonBuildingList);
115 118
 
116 119
         if (null != buildings) {
117
-            for(TaBuilding taBuilding: buildings) {
120
+            for (TaBuilding taBuilding : buildings) {
118 121
                 //查询当前图片
119 122
                 QueryWrapper<TaBuildingImg> queryWrapper = new QueryWrapper<>();
120 123
                 queryWrapper.eq("building_id", taBuilding.getBuildingId());
@@ -139,8 +142,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
139 142
 
140 143
         return ResponseBean.success(page);
141 144
     }
145
+
142 146
     @Override
143
-    public ResponseBean buildingListSelect(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain,Integer orgId,List<TaPersonBuilding> taPersonBuildingList) {
147
+    public ResponseBean buildingListSelect(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
144 148
 //        Page<TaBuilding> page = new Page<>();
145 149
 //        page.setSize(pageSize == null ? 10 : pageSize);
146 150
 //        page.setCurrent(pageNum == null ? 1 : pageNum);
@@ -151,6 +155,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
151 155
 
152 156
     /**
153 157
      * 查询项目图片
158
+     *
154 159
      * @param buildingId
155 160
      * @param imgType
156 161
      * @return
@@ -162,15 +167,15 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
162 167
         buildingImgQueryWrapper.eq("img_type", imgType);
163 168
         buildingImgQueryWrapper.orderByAsc("order_no");
164 169
         List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
165
-        return  buildingImg.size() > 0 ? buildingImg : null;
170
+        return buildingImg.size() > 0 ? buildingImg : null;
166 171
     }
167 172
 
168 173
     @Override
169 174
     public ResponseBean buildingSelectId(String id) {
170 175
         // 查询基础信息
171 176
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
172
-        buildingtWrapper.lambda().gt(TaBuilding::getStatus,-1);
173
-        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,id);
177
+        buildingtWrapper.lambda().gt(TaBuilding::getStatus, -1);
178
+        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId, id);
174 179
         TaBuilding building = taBuildingMapper.selectOne(buildingtWrapper);
175 180
 
176 181
         //查询当前图片
@@ -185,7 +190,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
185 190
         // 查询tag
186 191
         QueryWrapper<TaBuildingTag> BuildingTagQueryWrapper = new QueryWrapper<>();
187 192
         BuildingTagQueryWrapper.eq("building_id", id);
188
-        List<TaBuildingTag> buildingTags= taBuildingTagMapper.selectList(BuildingTagQueryWrapper);
193
+        List<TaBuildingTag> buildingTags = taBuildingTagMapper.selectList(BuildingTagQueryWrapper);
189 194
         building.setBuildingTag(buildingTags);
190 195
 
191 196
         // 项目类型
@@ -193,8 +198,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
193 198
         buildingProjectTypeQueryWrapper.eq("building_id", building.getBuildingId());
194 199
         List<TaBuildingProjectType> taBuildingProjectTypes = taBuildingProjectTypeMapper.selectList(buildingProjectTypeQueryWrapper);
195 200
         building.setBuildingProjectType(taBuildingProjectTypes);
196
-        building.setPosters(taPosterService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
197
-        building.setShareContents(taShareContentService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
201
+        building.setPosters(taPosterService.getPostersForTarget(id, CommConstant.POSTER_CONTENT_TYPE_BUILDING));
202
+        building.setShareContents(taShareContentService.getPostersForTarget(id, CommConstant.POSTER_CONTENT_TYPE_BUILDING));
198 203
 
199 204
         // 查询 周边数据
200 205
         QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
@@ -207,15 +212,15 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
207 212
     }
208 213
 
209 214
     @Override
210
-    public ResponseBean buildingAllSelectId(String id,String personId, Integer orgId) {
215
+    public ResponseBean buildingAllSelectId(String id, String personId, Integer orgId) {
211 216
         // 查询基础信息
212 217
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
213
-        buildingtWrapper.lambda().gt(TaBuilding::getStatus,-1);
214
-        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,id);
218
+        buildingtWrapper.lambda().gt(TaBuilding::getStatus, -1);
219
+        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId, id);
215 220
         TaBuilding building = taBuildingMapper.selectOne(buildingtWrapper);
216 221
 
217
-        if (null == building){
218
-            return ResponseBean.error("项目不存在",ResponseBean.ERROR_UNAVAILABLE);
222
+        if (null == building) {
223
+            return ResponseBean.error("项目不存在", ResponseBean.ERROR_UNAVAILABLE);
219 224
         }
220 225
         //查询当前图片
221 226
         building.setBuildingImg(getBuildingImg(id, CommConstant.BUILDING_IMG_BANNER));
@@ -242,7 +247,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
242 247
         AppointmentQueryWrapper.eq("status", 1);
243 248
         AppointmentQueryWrapper.orderByDesc("create_date");
244 249
         List<TaBuildingApartment> appoint = taBuildingApartmentMapper.selectList(AppointmentQueryWrapper);
245
-        for (TaBuildingApartment apar:appoint) {
250
+        for (TaBuildingApartment apar : appoint) {
246 251
             List<TaBuildingImg> imgs = taBuildingImgMapper.getBuildingImgByApartment(apar.getApartmentId());
247 252
             apar.setBuildingImgList(imgs);
248 253
         }
@@ -250,13 +255,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
250 255
 
251 256
         getBuildingAttaches(building);
252 257
         QueryWrapper<TaSave> saveQueryWrapper = new QueryWrapper<>();
253
-        saveQueryWrapper.eq("tagert_type",CommConstant.FAVOR_PROJECT);
254
-        saveQueryWrapper.eq("person_id",personId);
255
-        saveQueryWrapper.eq("saved_target",building.getBuildingId());
258
+        saveQueryWrapper.eq("tagert_type", CommConstant.FAVOR_PROJECT);
259
+        saveQueryWrapper.eq("person_id", personId);
260
+        saveQueryWrapper.eq("saved_target", building.getBuildingId());
256 261
         Integer num = taSaveMapper.selectCount(saveQueryWrapper);
257
-        if (num>0){
262
+        if (num > 0) {
258 263
             building.setIsSave(CommConstant.STATUS_NORMAL);
259
-        }else {
264
+        } else {
260 265
             building.setIsSave(CommConstant.STATUS_UNACCALIMED);
261 266
         }
262 267
 
@@ -268,8 +273,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
268 273
         building.setBuildingProjectType(buildingProjectTypes);
269 274
 
270 275
         // 海报和分享
271
-        building.setPosters(taPosterService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
272
-        building.setShareContents(taShareContentService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
276
+        building.setPosters(taPosterService.getPostersForTarget(id, CommConstant.POSTER_CONTENT_TYPE_BUILDING));
277
+        building.setShareContents(taShareContentService.getPostersForTarget(id, CommConstant.POSTER_CONTENT_TYPE_BUILDING));
273 278
 
274 279
         // 助力活动
275 280
         QueryWrapper<HelpActivity> helpActivityQueryWrapper = new QueryWrapper<>();
@@ -304,18 +309,25 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
304 309
         List<TaBuildingPanorama> panoramaList = taBuildingPanoramaService.list(panoramaQueryWrapper);
305 310
         building.setPanoramaList(panoramaList);
306 311
 
312
+        // 查询关联的销售批次
313
+        QueryWrapper<TaSalesBatch> salesBatchQueryWrapper = new QueryWrapper<>();
314
+        salesBatchQueryWrapper.lambda().eq(TaSalesBatch::getBuildingId, id);
315
+        salesBatchQueryWrapper.lambda().eq(TaSalesBatch::getStatus, CommConstant.STATUS_NORMAL);
316
+        List<TaSalesBatch> taSalesBatch = iTaSalesBatchService.list(salesBatchQueryWrapper);
317
+        building.setSalesBatch(taSalesBatch);
318
+
307 319
         return ResponseBean.success(building);
308 320
     }
309 321
 
310 322
     @Override
311 323
     public ResponseBean buildingUpdate(String parameter, Integer orgId) {
312 324
         ResponseBean responseBean = new ResponseBean();
313
-        JSONObject object= JSONObject.parseObject(parameter);
325
+        JSONObject object = JSONObject.parseObject(parameter);
314 326
 
315 327
         TaBuilding building = object.toJavaObject(TaBuilding.class);
316 328
 
317 329
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, null, "update");
318
-        if (!isMainMoreThanTenFlag){
330
+        if (!isMainMoreThanTenFlag) {
319 331
             responseBean.addError("当前城市最多只能推荐10个项目至首页哦。");
320 332
             return responseBean;
321 333
         }
@@ -334,7 +346,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
334 346
             buildingIdQueryWrapper.eq("building_id", building.getBuildingId());
335 347
             buildingIdQueryWrapper.eq("org_id", orgId);
336 348
             building.setName(building.getBuildingName());
337
-            taBuildingMapper.update(building,buildingIdQueryWrapper);
349
+            taBuildingMapper.update(building, buildingIdQueryWrapper);
338 350
             QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
339 351
             BuildingImgQueryWrapper.eq("building_id", building.getBuildingId());
340 352
             BuildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_BANNER);
@@ -375,7 +387,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
375 387
             insertTagBatch(buildingTags, building.getBuildingId());
376 388
         }
377 389
 
378
-        if(null != building.getCityId()){
390
+        if (null != building.getCityId()) {
379 391
             TdCity city = tdCityMapper.selectById(building.getCityId());
380 392
             city.setStatus("1");
381 393
             tdCityMapper.updateById(city);
@@ -456,22 +468,22 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
456 468
     public ResponseBean buildingAdd(String parameter, Integer orgId) {
457 469
         ResponseBean responseBean = new ResponseBean();
458 470
 
459
-        JSONObject object= JSONObject.parseObject(parameter);
471
+        JSONObject object = JSONObject.parseObject(parameter);
460 472
         // 根据orgId查询当前楼盘最大数
461 473
         TaOrg taOrg = taOrgMapper.selectById(orgId);
462 474
         // 查询当前org楼盘总数
463
-        QueryWrapper<TaBuilding>  taBuildingQuery = new QueryWrapper<>();
464
-        taBuildingQuery.eq("org_id",orgId);
465
-        taBuildingQuery.gt("status",-1);
466
-        int orgNum= taBuildingMapper.selectCount(taBuildingQuery);
467
-        if (orgNum >= taOrg.getBuildingNum()){
468
-            return ResponseBean.error("当前系统仅供维护"+taOrg.getBuildingNum()+"个项目,需要维护更多项目,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
475
+        QueryWrapper<TaBuilding> taBuildingQuery = new QueryWrapper<>();
476
+        taBuildingQuery.eq("org_id", orgId);
477
+        taBuildingQuery.gt("status", -1);
478
+        int orgNum = taBuildingMapper.selectCount(taBuildingQuery);
479
+        if (orgNum >= taOrg.getBuildingNum()) {
480
+            return ResponseBean.error("当前系统仅供维护" + taOrg.getBuildingNum() + "个项目,需要维护更多项目,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
469 481
         }
470 482
 
471 483
         TaBuilding building = object.toJavaObject(TaBuilding.class);
472 484
 
473 485
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, null, "add");
474
-        if (!isMainMoreThanTenFlag){
486
+        if (!isMainMoreThanTenFlag) {
475 487
             responseBean.addError("当前城市最多只能推荐10个项目至首页哦。");
476 488
             return responseBean;
477 489
         }
@@ -483,7 +495,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
483 495
         if (taBuildingMapper.insert(building) < 1) {
484 496
             return ResponseBean.error("添加项目楼栋失败", ResponseBean.ERROR_UNAVAILABLE);
485 497
         }
486
-        if(null != building.getCityId()){
498
+        if (null != building.getCityId()) {
487 499
             TdCity city = tdCityMapper.selectById(building.getCityId());
488 500
             city.setStatus("1");
489 501
             tdCityMapper.updateById(city);
@@ -531,13 +543,14 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
531 543
         }
532 544
 
533 545
         //添加默认意向值
534
-        iTaBuildingIntentionService.saveDefaultIntention(building.getOrgId(),building.getBuildingId());
546
+        iTaBuildingIntentionService.saveDefaultIntention(building.getOrgId(), building.getBuildingId());
535 547
 
536 548
         return ResponseBean.success(building);
537 549
     }
538 550
 
539 551
     /**
540 552
      * 批量插入 周边地图数据
553
+     *
541 554
      * @param list
542 555
      * @param buildingId
543 556
      * @param orgId
@@ -561,31 +574,31 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
561 574
         ResponseBean responseBean = new ResponseBean();
562 575
 
563 576
         JSONObject jsonobject = JSONObject.parseObject(parameter);
564
-        Integer  status= jsonobject.getInteger("status");
577
+        Integer status = jsonobject.getInteger("status");
565 578
         String id = jsonobject.getString("id");
566 579
         QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
567 580
         buildingIdQueryWrapper.eq("building_id", id);
568 581
         buildingIdQueryWrapper.eq("org_id", orgId);
569
-        TaBuilding  building = taBuildingMapper.selectOne(buildingIdQueryWrapper);
582
+        TaBuilding building = taBuildingMapper.selectOne(buildingIdQueryWrapper);
570 583
 
571 584
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, status, "updateStatus");
572
-        if (!isMainMoreThanTenFlag){
585
+        if (!isMainMoreThanTenFlag) {
573 586
             responseBean.addError("当前城市最多只能推荐10个项目至首页哦");
574 587
             return responseBean;
575 588
         }
576 589
         building.setStatus(status);
577
-        taBuildingMapper.update(building,buildingIdQueryWrapper);
590
+        taBuildingMapper.update(building, buildingIdQueryWrapper);
578 591
         return ResponseBean.success("");
579 592
     }
580 593
 
581 594
     @Override
582 595
     public ResponseBean buildingdelete(String id, Integer orgId) {
583
-        TaBuilding  building = new TaBuilding();
596
+        TaBuilding building = new TaBuilding();
584 597
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
585
-        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,id);
586
-        TaBuilding bui= taBuildingMapper.selectOne(buildingtWrapper);
598
+        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId, id);
599
+        TaBuilding bui = taBuildingMapper.selectOne(buildingtWrapper);
587 600
 
588
-        if (bui.getStatus().equals(1)){
601
+        if (bui.getStatus().equals(1)) {
589 602
             return ResponseBean.error("楼盘已发布不可以删除", ResponseBean.ERROR_UNAVAILABLE);
590 603
         }
591 604
         QueryWrapper<TaBuilding> buildingIdQueryWrapper = new QueryWrapper<>();
@@ -593,14 +606,14 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
593 606
         buildingIdQueryWrapper.eq("org_id", orgId);
594 607
         building.setBuildingId(String.valueOf(id));
595 608
         building.setStatus(-1);
596
-        taBuildingMapper.update(building,buildingIdQueryWrapper);
609
+        taBuildingMapper.update(building, buildingIdQueryWrapper);
597 610
 
598 611
         return ResponseBean.success("");
599 612
     }
600 613
 
601 614
     @Override
602 615
     public ResponseBean buildingApartmentAdd(String parameter) {
603
-        TaBuildingApartment building = JSONObject.parseObject(parameter,TaBuildingApartment.class);
616
+        TaBuildingApartment building = JSONObject.parseObject(parameter, TaBuildingApartment.class);
604 617
         building.setStatus(1);
605 618
         building.setCreateDate(LocalDateTime.now());
606 619
         if (taBuildingApartmentMapper.insert(building) < 1) {
@@ -622,7 +635,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
622 635
     @Override
623 636
     public ResponseBean buildingApartmentUpdate(String parameter) {
624 637
         ResponseBean responseBean = new ResponseBean();
625
-        TaBuildingApartment building = JSONObject.parseObject(parameter,TaBuildingApartment.class);
638
+        TaBuildingApartment building = JSONObject.parseObject(parameter, TaBuildingApartment.class);
626 639
         if (StringUtils.isEmpty(building.getApartmentId())) {
627 640
             responseBean.addError("id不存在!");
628 641
             return responseBean;
@@ -638,7 +651,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
638 651
         buildingApartmentQueryWrapper.eq("apartment_id", building.getApartmentId());
639 652
         building.setInsideArea(building.getInsideArea() == null ? 0d : building.getInsideArea());
640 653
         building.setBuildingArea(building.getBuildingArea() == null ? 0d : building.getBuildingArea());
641
-        taBuildingApartmentMapper.update(building,buildingApartmentQueryWrapper);
654
+        taBuildingApartmentMapper.update(building, buildingApartmentQueryWrapper);
642 655
 
643 656
         JSONObject jsonobject = JSONObject.parseObject(parameter);
644 657
         //图片数组
@@ -658,21 +671,21 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
658 671
         buildingApartmentQueryWrapper.eq("apartment_id", id);
659 672
         //拿到当前户型信息
660 673
         TaBuildingApartment buildingApartment = taBuildingApartmentMapper.selectOne(buildingApartmentQueryWrapper);
661
-        if ( null == buildingApartment ){
674
+        if (null == buildingApartment) {
662 675
             return ResponseBean.success("", "没有发现户型图上传");
663 676
         }
664 677
 
665 678
         //根据户型ID查楼盘户型对应图片表
666
-        ArrayList arrayList= new ArrayList<>();
679
+        ArrayList arrayList = new ArrayList<>();
667 680
         QueryWrapper<TaApartmentImg> ApartmentImgQueryWrapper = new QueryWrapper<>();
668 681
         ApartmentImgQueryWrapper.eq("apartment_id", buildingApartment.getApartmentId());
669
-        List<TaApartmentImg> buildingImg= taApartmentImgMapper.selectList(ApartmentImgQueryWrapper);
670
-        for (TaApartmentImg apartmentImg:buildingImg){
682
+        List<TaApartmentImg> buildingImg = taApartmentImgMapper.selectList(ApartmentImgQueryWrapper);
683
+        for (TaApartmentImg apartmentImg : buildingImg) {
671 684
             QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
672
-            buildingImgQueryWrapper.eq("img_id",apartmentImg.getImgId());
673
-            buildingImgQueryWrapper.eq("img_type",CommConstant.BUILDING_IMG_APARMENT);
674
-            List<TaBuildingImg> buildingImgList= taBuildingImgMapper.selectList(buildingImgQueryWrapper);
675
-            for (TaBuildingImg buImg:buildingImgList) {
685
+            buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
686
+            buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
687
+            List<TaBuildingImg> buildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
688
+            for (TaBuildingImg buImg : buildingImgList) {
676 689
                 arrayList.add(buImg);
677 690
             }
678 691
         }
@@ -697,10 +710,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
697 710
             String[] buildingTypeList,
698 711
             List<String[]> priceList,
699 712
             List<String[]> areaList,
700
-            Integer orgId,String priceType) {
713
+            Integer orgId, String priceType) {
701 714
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
702 715
 
703
-        if(CollectionUtils.isEmpty(targets) && mine){
716
+        if (CollectionUtils.isEmpty(targets) && mine) {
704 717
             return ResponseBean.success(page);
705 718
         }
706 719
 
@@ -715,11 +728,11 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
715 728
 //
716 729
 //        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
717 730
 
718
-        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseTypeList, buildingTypeList, priceList, areaList,orgId,priceType);
731
+        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseTypeList, buildingTypeList, priceList, areaList, orgId, priceType);
719 732
 
720 733
         List<TaBuilding> buildingList = result.getRecords();
721 734
         if (CollectionUtils.isNotEmpty(buildingList)) {
722
-            for (TaBuilding build:buildingList) {
735
+            for (TaBuilding build : buildingList) {
723 736
                 getBuildingAttaches(build);
724 737
 
725 738
                 // 兼容 3.0/3.5 版本(3.0/3.5 封面取的全是 buildingListImg 的第一张),因为在3.5.1新增了封面图
@@ -799,9 +812,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
799 812
             // tags
800 813
             if (!StringUtils.isEmpty(building.getTags())) {
801 814
                 List<TaBuildingTag> tags = new ArrayList<>();
802
-                String[] tagsArray =  building.getTags().split(",");
815
+                String[] tagsArray = building.getTags().split(",");
803 816
                 if (null != tagsArray) {
804
-                    for(String tagName: tagsArray) {
817
+                    for (String tagName : tagsArray) {
805 818
                         TaBuildingTag tag = new TaBuildingTag();
806 819
                         tag.setBuildingId(buildingId);
807 820
                         tag.setTagName(tagName);
@@ -875,14 +888,14 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
875 888
     public ResponseBean buildingApartmentBuildingId(String id, String apartmentType) {
876 889
         QueryWrapper<TaBuildingApartment> buildingApartmentQueryWrapper = new QueryWrapper<>();
877 890
         buildingApartmentQueryWrapper.eq("building_id", id);
878
-        buildingApartmentQueryWrapper.eq("status",1);
879
-        buildingApartmentQueryWrapper.eq(org.apache.commons.lang3.StringUtils.isNotBlank(apartmentType),"apartment_type",apartmentType);
891
+        buildingApartmentQueryWrapper.eq("status", 1);
892
+        buildingApartmentQueryWrapper.eq(org.apache.commons.lang3.StringUtils.isNotBlank(apartmentType), "apartment_type", apartmentType);
880 893
         buildingApartmentQueryWrapper.orderByDesc("create_date");
881
-        List<TaBuildingApartment> buildingApartment= taBuildingApartmentMapper.selectList(buildingApartmentQueryWrapper);
894
+        List<TaBuildingApartment> buildingApartment = taBuildingApartmentMapper.selectList(buildingApartmentQueryWrapper);
882 895
         buildingApartment.forEach(e -> {
883 896
             QueryWrapper<TaApartmentImg> ApartmentImgQueryWrapper = new QueryWrapper<>();
884 897
             ApartmentImgQueryWrapper.eq("apartment_id", e.getApartmentId());
885
-            List<TaApartmentImg> buildingImg= taApartmentImgMapper.selectList(ApartmentImgQueryWrapper);
898
+            List<TaApartmentImg> buildingImg = taApartmentImgMapper.selectList(ApartmentImgQueryWrapper);
886 899
 
887 900
             List<TaBuildingImg> buildingImag = buildingImg.stream().map(img -> {
888 901
                 QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
@@ -907,21 +920,21 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
907 920
 
908 921
 //        TaBuilding  building= new TaBuilding();
909 922
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
910
-        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,buildingApartment.getBuildingId());
923
+        buildingtWrapper.lambda().eq(TaBuilding::getBuildingId, buildingApartment.getBuildingId());
911 924
 //        TaBuilding bui= taBuildingMapper.selectOne(buildingtWrapper);
912 925
 //        if (bui.getStatus().equals(1)){
913 926
 //            return ResponseBean.error("楼盘已发布不可以删除", ResponseBean.ERROR_UNAVAILABLE);
914 927
 //        }
915 928
 
916 929
         buildingApartment.setStatus(-1);
917
-       taBuildingApartmentMapper.update(buildingApartment,buildingApartmentQueryWrapper);
930
+        taBuildingApartmentMapper.update(buildingApartment, buildingApartmentQueryWrapper);
918 931
 
919
-       return ResponseBean.success("");
932
+        return ResponseBean.success("");
920 933
     }
921 934
 
922 935
     @Override
923 936
     public ResponseBean buildingAll(Integer orgId) {
924
-        List<TaBuilding> taBuilding= taBuildingMapper.buildingAll(orgId);
937
+        List<TaBuilding> taBuilding = taBuildingMapper.buildingAll(orgId);
925 938
         return ResponseBean.success(taBuilding);
926 939
     }
927 940
 
@@ -936,8 +949,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
936 949
     }
937 950
 
938 951
     @Override
939
-    public ResponseBean getBuildingListById(Integer orgId,Integer cityId) {
940
-        List<TaBuilding> buildings = taBuildingMapper.getBuildingListById(orgId,cityId);
952
+    public ResponseBean getBuildingListById(Integer orgId, Integer cityId) {
953
+        List<TaBuilding> buildings = taBuildingMapper.getBuildingListById(orgId, cityId);
941 954
         return ResponseBean.success(buildings);
942 955
     }
943 956
 
@@ -948,6 +961,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
948 961
 
949 962
     /**
950 963
      * 推荐到首页楼盘不能超过10个
964
+     *
951 965
      * @param taBuilding
952 966
      * @return
953 967
      */
@@ -956,13 +970,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
956 970
         queryWrapper.eq("building_id", taBuilding.getBuildingId());
957 971
         queryWrapper.eq("org_id", orgId);
958 972
         TaBuilding info = taBuildingMapper.selectOne(queryWrapper);
959
-        if (taBuilding.getIsMain() != 1){
973
+        if (taBuilding.getIsMain() != 1) {
960 974
             return true;
961 975
         }
962 976
 //        if (operte.equals("update") && (info.getStatus() == 2)){
963 977
 //            return true;
964 978
 //        }
965
-        if (operte.equals("updateStatus") && status == 2){
979
+        if (operte.equals("updateStatus") && status == 2) {
966 980
             return true;
967 981
         }
968 982
         QueryWrapper<TaBuilding> taBuildingQueryWrapper = new QueryWrapper<>();
@@ -971,19 +985,17 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
971 985
         taBuildingQueryWrapper.eq("org_id", orgId);
972 986
         taBuildingQueryWrapper.ne("status", "-1");
973 987
         taBuildingQueryWrapper.ne("status", "2");
974
-        if (taBuilding.getBuildingId() != null){
988
+        if (taBuilding.getBuildingId() != null) {
975 989
             taBuildingQueryWrapper.ne("building_id", taBuilding.getBuildingId());
976 990
         }
977 991
         List<TaBuilding> taBuildings = taBuildingMapper.selectList(taBuildingQueryWrapper);
978
-        if (taBuildings != null && taBuildings.size() >= 10){
992
+        if (taBuildings != null && taBuildings.size() >= 10) {
979 993
             return false;
980 994
         }
981 995
         return true;
982 996
     }
983 997
 
984 998
 
985
-
986
-
987 999
     private List<TaBuildingImg> insertImgBatch(List<TaBuildingImg> imgs, String buildingId) {
988 1000
         return imgs.stream().map(img -> {
989 1001
             TaBuildingImg Images = new TaBuildingImg();
@@ -1011,7 +1023,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
1011 1023
 
1012 1024
     int insertApartmentImgBatch(List<TaBuildingImg> imgs, String buildingId, String apartmentId) {
1013 1025
         int rows = 0;
1014
-        for (TaBuildingImg img: imgs){
1026
+        for (TaBuildingImg img : imgs) {
1015 1027
             TaBuildingImg Images = new TaBuildingImg();
1016 1028
             Images.setBuildingId(buildingId);
1017 1029
             Images.setImgType(img.getImgType());
@@ -1022,9 +1034,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
1022 1034
 
1023 1035
             if (taBuildingImgMapper.insert(Images) < 1) {
1024 1036
                 continue;
1025
-            };
1037
+            }
1038
+            ;
1026 1039
 
1027
-            TaApartmentImg apartmentImg= new TaApartmentImg();
1040
+            TaApartmentImg apartmentImg = new TaApartmentImg();
1028 1041
             apartmentImg.setApartmentId(apartmentId);
1029 1042
             apartmentImg.setImgId(Images.getImgId());
1030 1043
             apartmentImg.setStatus(1);

+ 20
- 0
src/main/java/com/huiju/estateagents/service/impl/TaBuildingTermServiceImpl.java View File

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.huiju.estateagents.entity.TaBuildingTerm;
5
+import com.huiju.estateagents.mapper.TaBuildingTermMapper;
6
+import com.huiju.estateagents.service.ITaBuildingTermService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 楼栋期表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2020-02-12
16
+ */
17
+@Service
18
+public class TaBuildingTermServiceImpl extends ServiceImpl<TaBuildingTermMapper, TaBuildingTerm> implements ITaBuildingTermService {
19
+
20
+}

+ 678
- 36
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java View File

@@ -6,18 +6,35 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8 8
 import com.huiju.estateagents.common.CommConstant;
9
-import com.huiju.estateagents.entity.TaBuildingApartment;
10
-import com.huiju.estateagents.entity.TaBuildingBlock;
11
-import com.huiju.estateagents.entity.TaHousingResources;
9
+import com.huiju.estateagents.common.StringUtils;
10
+import com.huiju.estateagents.entity.*;
11
+import com.huiju.estateagents.mapper.*;
12
+import com.huiju.estateagents.mapper.TaApartmentImgMapper;
13
+import com.huiju.estateagents.mapper.TaBuildingImgMapper;
12 14
 import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
15
+import com.huiju.estateagents.mapper.TaPreselectionRecordMapper;
16
+import com.huiju.estateagents.po.BuildingImgPO;
13 17
 import com.huiju.estateagents.po.TaHousingResourcesPO;
14 18
 import com.huiju.estateagents.service.ITaHousingResourcesService;
19
+import org.apache.commons.collections.CollectionUtils;
20
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
21
+import org.apache.poi.ss.usermodel.Row;
22
+import org.apache.poi.ss.usermodel.Sheet;
23
+import org.apache.poi.ss.usermodel.Workbook;
24
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
15 25
 import org.slf4j.Logger;
16 26
 import org.slf4j.LoggerFactory;
17 27
 import org.springframework.beans.factory.annotation.Autowired;
18 28
 import org.springframework.stereotype.Service;
29
+import org.springframework.transaction.annotation.Transactional;
30
+import org.springframework.web.multipart.MultipartFile;
19 31
 
32
+import java.math.BigDecimal;
33
+import java.time.LocalDateTime;
34
+import java.util.ArrayList;
35
+import java.util.HashMap;
20 36
 import java.util.List;
37
+import java.util.Map;
21 38
 
22 39
 /**
23 40
  * <p>
@@ -27,6 +44,7 @@ import java.util.List;
27 44
  * @author jobob
28 45
  * @since 2020-02-10
29 46
  */
47
+@Transactional(rollbackFor = Exception.class)
30 48
 @Service
31 49
 public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResourcesMapper, TaHousingResources> implements ITaHousingResourcesService {
32 50
 
@@ -35,50 +53,59 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
35 53
     @Autowired
36 54
     private TaHousingResourcesMapper taHousingResourcesMapper;
37 55
 
38
-    /**
39
-     * 分页获取房源详情数据
40
-     *
41
-     * @param salesBatchId
42
-     * @param buildingId
43
-     * @param pageNumber
44
-     * @param pageSize
45
-     * @param orgId
46
-     * @return
47
-     */
48
-    @Override
49
-    public ResponseBean selectPageList(Integer salesBatchId, String buildingId, Integer pageNumber, Integer pageSize, Integer orgId) {
50
-        //使用分页插件
51
-        IPage<TaHousingResources> pg = new Page<>(pageNumber, pageSize);
52
-        QueryWrapper<TaHousingResources> queryWrapper = new QueryWrapper<>();
53
-        //销售批次id
54
-        queryWrapper.eq("sales_batch_id", salesBatchId);
55
-        queryWrapper.eq("building_id", buildingId);
56
-        queryWrapper.eq("org_id", orgId);
57
-        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
58
-        queryWrapper.orderByDesc("create_date");
59
-        IPage<TaHousingResources> list = this.page(pg, queryWrapper);
56
+    @Autowired
57
+    private TaBuildingTermMapper taBuildingTermMapper;
58
+
59
+    @Autowired
60
+    private TaBuildingBlockMapper taBuildingBlockMapper;
61
+
62
+    @Autowired
63
+    private TaBuildingUnitMapper taBuildingUnitMapper;
64
+
65
+    @Autowired
66
+    private TaBuildingFloorMapper taBuildingFloorMapper;
67
+
68
+    @Autowired
69
+    private TaBuildingRoomMapper taBuildingRoomMapper;
70
+
71
+    @Autowired
72
+    private TaBuildingMapper taBuildingMapper;
73
+
74
+    @Autowired
75
+    private TaPreselectionRecordMapper taPreselectionRecordMapper;
76
+
77
+    @Autowired
78
+    TaBuildingImgMapper taBuildingImgMapper;
79
+
80
+    @Autowired
81
+    TaApartmentImgMapper taApartmentImgMapper;
82
+
83
+    @Autowired
84
+    private TaBuildingPanoramaMapper taBuildingPanoramaMapper;
60 85
 
61
-        return ResponseBean.success(list);
62
-    }
63 86
 
64 87
     /**
65 88
      * 分页获取房源列表
66 89
      *
67
-     * @param pageNum      页码
68
-     * @param pageSize     分页大小
69 90
      * @param salesBatchId 销售批次ID
70 91
      * @param startPrice
71 92
      * @param endPrice
72 93
      * @param apartmentId
94
+     * @param type
73 95
      * @return
74 96
      */
75 97
     @Override
76
-    public IPage<TaHousingResourcesPO> listHousingResources(Integer pageNum, Integer pageSize, String salesBatchId, String startPrice, String endPrice, String apartmentId) {
77
-        logger.info("listHousingResources 接收参数:pageNum:{},pageSize:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
78
-                pageNum, pageSize, salesBatchId, startPrice, endPrice, apartmentId);
98
+    public List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type) {
99
+        logger.info("listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{},type:{}",
100
+                orgId, salesBatchId, startPrice, endPrice, apartmentId, type);
101
+
102
+        startPrice = StringUtils.isEmpty(startPrice) ? null : startPrice;
103
+        endPrice = StringUtils.isEmpty(endPrice) ? null : endPrice;
79 104
 
80
-        IPage<TaHousingResourcesPO> iPage = new Page<>(pageNum, pageSize);
81
-        return taHousingResourcesMapper.listHousingResources(iPage, salesBatchId, startPrice, endPrice, apartmentId);
105
+        List<TaHousingResourcesPO> resourcesPOList =
106
+                taHousingResourcesMapper.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, type);
107
+
108
+        return resourcesPOList;
82 109
     }
83 110
 
84 111
     /**
@@ -91,7 +118,33 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
91 118
     public List<TaBuildingApartment> listBuildApartmentBySalesBatchId(String salesBatchId) {
92 119
         logger.info("listBuildApartmentBySalesBatchId 接收参数:salesBatchId:{}", salesBatchId);
93 120
 
94
-        return taHousingResourcesMapper.listBuildApartmentBySalesBatchId(salesBatchId);
121
+        // 获取户型列表
122
+        List<TaBuildingApartment> apartmentList = taHousingResourcesMapper.listBuildApartmentBySalesBatchId(salesBatchId);
123
+        if (CollectionUtils.isEmpty(apartmentList)) {
124
+            return null;
125
+        }
126
+
127
+        // 组装户型图片
128
+        List<TaBuildingApartment> resultList = new ArrayList<>();
129
+        List<TaBuildingImg> taBuildingImgList;
130
+        List<TaApartmentImg> buildingImg;
131
+        QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper;
132
+        QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
133
+        for (TaBuildingApartment apartment : apartmentList) {
134
+            apartmentImgQueryWrapper = new QueryWrapper<>();
135
+            apartmentImgQueryWrapper.eq("apartment_id", apartment.getApartmentId());
136
+            buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
137
+            for (TaApartmentImg apartmentImg : buildingImg) {
138
+                buildingImgQueryWrapper = new QueryWrapper<>();
139
+                buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
140
+                buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
141
+                buildingImgQueryWrapper.orderByAsc("order_no");
142
+                taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
143
+                apartment.setBuildingImgList(taBuildingImgList);
144
+                resultList.add(apartment);
145
+            }
146
+        }
147
+        return resultList;
95 148
     }
96 149
 
97 150
     /**
@@ -105,6 +158,595 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
105 158
     public TaHousingResourcesPO getHousingDetailById(String personId, String houseId) {
106 159
         logger.info("getHousingDetailById 接收参数:personId:{},houseId:{}", personId, houseId);
107 160
 
108
-        return taHousingResourcesMapper.getHousingDetailById(houseId, "1");
161
+        // 查询房源详情
162
+        TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(houseId, "1");
163
+        if (resourcesPO == null) {
164
+            return null;
165
+        }
166
+
167
+        // 获取该用户是否预选房源信息
168
+        TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
169
+        if (taPreselectionRecord != null) {
170
+            resourcesPO.setIsPreselect(true);
171
+        } else {
172
+            resourcesPO.setIsPreselect(false);
173
+        }
174
+
175
+        List<BuildingImgPO> buildingImgPOList = new ArrayList<>();
176
+        BuildingImgPO buildingImgPO;
177
+        if (!StringUtils.isEmpty(resourcesPO.getApartmentId())) {
178
+            // 获取全景图
179
+            QueryWrapper<TaBuildingPanorama> buildingPanoramaQueryWrapper = new QueryWrapper<>();
180
+            buildingPanoramaQueryWrapper.eq("org_id", resourcesPO.getOrgId());
181
+            buildingPanoramaQueryWrapper.eq("building_id", resourcesPO.getBuildingId());
182
+            buildingPanoramaQueryWrapper.eq("apartment_id", resourcesPO.getApartmentId());
183
+            buildingPanoramaQueryWrapper.eq("panorama_type", "apartment");
184
+            buildingPanoramaQueryWrapper.eq("status", "1");
185
+            List<TaBuildingPanorama> panoramaList = taBuildingPanoramaMapper.selectList(buildingPanoramaQueryWrapper);
186
+            if (CollectionUtils.isNotEmpty(panoramaList)) {
187
+                for (TaBuildingPanorama panorama : panoramaList) {
188
+                    buildingImgPO = new BuildingImgPO();
189
+                    buildingImgPO.setUrl(panorama.getCoverImg());
190
+                    buildingImgPO.setType(1);
191
+                    buildingImgPO.setPanoramaLink(panorama.getPanoramaLink());
192
+                    buildingImgPOList.add(buildingImgPO);
193
+                }
194
+            }
195
+
196
+            // 获取户型图片列表
197
+            List<TaBuildingImg> taBuildingImgList = new ArrayList<>();
198
+            List<TaApartmentImg> buildingImg;
199
+            QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
200
+            QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper = new QueryWrapper<>();
201
+            apartmentImgQueryWrapper.eq("apartment_id", resourcesPO.getApartmentId());
202
+            buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
203
+            for (TaApartmentImg apartmentImg : buildingImg) {
204
+                buildingImgQueryWrapper = new QueryWrapper<>();
205
+                buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
206
+                buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
207
+                buildingImgQueryWrapper.orderByAsc("order_no");
208
+                taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
209
+            }
210
+            if (CollectionUtils.isNotEmpty(taBuildingImgList)) {
211
+                for (TaBuildingImg img : taBuildingImgList) {
212
+                    buildingImgPO = new BuildingImgPO();
213
+                    buildingImgPO.setType(0);
214
+                    buildingImgPO.setUrl(img.getUrl());
215
+                    buildingImgPOList.add(buildingImgPO);
216
+                }
217
+            }
218
+        }
219
+
220
+        resourcesPO.setBuildingImgList(buildingImgPOList);
221
+        return resourcesPO;
222
+    }
223
+
224
+    /**
225
+     * 校验楼栋信息存不存在
226
+     *
227
+     * @param taHousingResources
228
+     * @return
229
+     */
230
+    @Override
231
+    public StringBuffer checked(TaHousingResources taHousingResources) {
232
+        StringBuffer result = new StringBuffer();
233
+        //校验期
234
+        String termResult = checckedTerm(taHousingResources);
235
+        result.append(termResult.equals("notExist") ? "期名" + taHousingResources.getTermName() + "不存在,会直接新建。" : termResult);
236
+        //校验栋
237
+        String blockResult = checkedBlock(taHousingResources);
238
+        result.append(blockResult.equals("notExist") ? "楼栋名" + taHousingResources.getBlockName() + "不存在,会直接新建。" : blockResult);
239
+        //校验单元
240
+        String unitResult = checkedUnit(taHousingResources);
241
+        result.append(unitResult.equals("notExist") ? "单元名" + taHousingResources.getUnitName() + "不存在,会直接新建。" : unitResult);
242
+        //校验楼层
243
+        String floorResult = checkedFloor(taHousingResources);
244
+        result.append(floorResult.equals("notExist") ? "楼层名" + taHousingResources.getFloorName() + "不存在,会直接新建。" : floorResult);
245
+        //校验房号
246
+        String roomResult = checkedRoom(taHousingResources);
247
+        result.append(roomResult.equals("notExist") ? "房号" + taHousingResources.getRoomName() + "不存在,会直接新建。" : roomResult);
248
+        return result;
249
+    }
250
+
251
+    /**
252
+     * 添加楼栋信息
253
+     *
254
+     * @param taHousingResources
255
+     * @return
256
+     */
257
+    @Override
258
+    public ResponseBean addHouseResources(TaHousingResources taHousingResources) {
259
+        //校验期
260
+        String termResult = checckedTerm(taHousingResources);
261
+        //校验栋
262
+        String blockResult = checkedBlock(taHousingResources);
263
+        //校验单元
264
+        String unitResult = checkedUnit(taHousingResources);
265
+        //校验楼层
266
+        String floorResult = checkedFloor(taHousingResources);
267
+        //校验房号
268
+        String roomResult = checkedRoom(taHousingResources);
269
+
270
+        //创建期
271
+        if (!roomResult.equals("notExist")) {
272
+            return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!", ResponseBean.ERROR_UNAVAILABLE);
273
+        }
274
+
275
+        //期不存在就添加
276
+        if (termResult.equals("notExist")) {
277
+            addTerm(taHousingResources);
278
+        }
279
+
280
+        //楼栋不存在就添加
281
+        if (blockResult.equals("notExist")) {
282
+            addBlock(taHousingResources);
283
+        }
284
+
285
+        //单元不存在就添加
286
+        if (unitResult.equals("notExist")) {
287
+            addUnit(taHousingResources);
288
+        }
289
+
290
+        //楼层不存在就添加
291
+        if (floorResult.equals("notExist")) {
292
+            addFloor(taHousingResources);
293
+        }
294
+
295
+        //房间号不存在就添加
296
+        if (roomResult.equals("notExist")) {
297
+            addRoom(taHousingResources);
298
+        }
299
+
300
+        // 获取楼盘名称
301
+        TaBuilding taBuilding = taBuildingMapper.selectById(taHousingResources.getBuildingId());
302
+        taHousingResources.setBuildingName(taBuilding.getBuildingName());
303
+        //添加房源信息
304
+        taHousingResources.setCreateDate(LocalDateTime.now());
305
+        taHousingResourcesMapper.insert(taHousingResources);
306
+        return ResponseBean.success(taHousingResources);
307
+    }
308
+
309
+    /**
310
+     * 分页获取房源信息
311
+     *
312
+     * @param salesBatchId
313
+     * @param buildingId
314
+     * @param pageNumber
315
+     * @param pageSize
316
+     * @param orgId
317
+     * @param termName
318
+     * @param blockName
319
+     * @param unitName
320
+     * @param floorName
321
+     * @param roomName
322
+     * @param apartmentId
323
+     * @param status
324
+     * @param houseId
325
+     * @return
326
+     */
327
+    @Override
328
+    public ResponseBean selectPageList(Integer salesBatchId, String buildingId, Integer pageNumber, Integer pageSize, Integer orgId, String termName, String blockName, String unitName, String floorName, String roomName, String apartmentId, Integer status, String houseId) {
329
+        IPage<TaHousingResources> pg = new Page<>(pageNumber, pageSize);
330
+        IPage<TaHousingResources> pageData = taHousingResourcesMapper.getHouseResourceList(pg, salesBatchId, buildingId, orgId, termName, blockName, unitName, floorName, roomName, apartmentId, status, houseId);
331
+        return ResponseBean.success(pageData);
332
+    }
333
+
334
+    /**
335
+     * 更新房源信息
336
+     *
337
+     * @param taHousingResources
338
+     * @return
339
+     */
340
+    @Override
341
+    public ResponseBean updateHouseResources(TaHousingResources taHousingResources) {
342
+        TaHousingResources oldTaHousingResources = taHousingResourcesMapper.selectById(taHousingResources.getHouseId());
343
+        taHousingResources.setTermId(oldTaHousingResources.getTermId());
344
+        taHousingResources.setBlockId(oldTaHousingResources.getBlockId());
345
+        taHousingResources.setUnitId(oldTaHousingResources.getUnitId());
346
+        taHousingResources.setFloorId(oldTaHousingResources.getFloorId());
347
+        taHousingResources.setRoomId(oldTaHousingResources.getRoomId());
348
+        //只允许编辑房间名
349
+        if (!oldTaHousingResources.getRoomName().equals(taHousingResources.getRoomName())) {
350
+            //校验房号
351
+            String roomResult = checkedRoom(taHousingResources);
352
+
353
+            //房间号不存在就更新
354
+            if (roomResult.equals("notExist")) {
355
+                updateRoom(taHousingResources);
356
+            } else {
357
+                return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!", ResponseBean.ERROR_UNAVAILABLE);
358
+            }
359
+
360
+        }
361
+
362
+        //添加房源信息
363
+        taHousingResources.setUpdateDate(LocalDateTime.now());
364
+        taHousingResourcesMapper.updateById(taHousingResources);
365
+        return ResponseBean.success(taHousingResources);
366
+    }
367
+
368
+    /**
369
+     * 获取表格中的数据
370
+     *
371
+     * @param file
372
+     * @param salesBatchId
373
+     * @param buildingId
374
+     * @param orgId
375
+     * @return
376
+     */
377
+    @Override
378
+    public ResponseBean getExcelData(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
379
+        ResponseBean responseBean = new ResponseBean();
380
+        List<TaHousingResources> list = new ArrayList<>();
381
+        if (file == null) {
382
+            responseBean.addError("对象不能为空");
383
+            return responseBean;
384
+        }
385
+        //获取文件的名字
386
+        String originalFilename = file.getOriginalFilename();
387
+        Workbook workbook = null;
388
+        try {
389
+            if (originalFilename.endsWith(CommConstant.SUFFIX_2003)) {
390
+                workbook = new HSSFWorkbook(file.getInputStream());
391
+            } else if (originalFilename.endsWith(CommConstant.SUFFIX_2007)) {
392
+                workbook = new XSSFWorkbook(file.getInputStream());
393
+            }
394
+        } catch (Exception e) {
395
+            logger.info(originalFilename);
396
+            e.printStackTrace();
397
+            responseBean.addError("格式错误");
398
+            return responseBean;
399
+        }
400
+        if (workbook == null) {
401
+            logger.info(originalFilename);
402
+            responseBean.addError("格式错误");
403
+            return responseBean;
404
+        } else {
405
+            List<String> temHousingList = new ArrayList<String>();
406
+            //获取一个sheet也就是一个工作簿
407
+            Sheet sheet = workbook.getSheetAt(0);
408
+            int lastRowNum = sheet.getLastRowNum();
409
+            //从第一行开始第一行一般是标题
410
+            for (int j = 3; j <= lastRowNum; j++) {
411
+                Row row = sheet.getRow(j);
412
+                TaHousingResources taHousingResources = new TaHousingResources();
413
+                String termName = row.getCell(0).getStringCellValue().trim();
414
+                String blockName = row.getCell(1).getStringCellValue().trim();
415
+                String unitName = row.getCell(2).getStringCellValue().trim();
416
+                String floorName = row.getCell(3).getStringCellValue().trim();
417
+                String roomName = row.getCell(4).getStringCellValue().trim();
418
+                BigDecimal price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
419
+                String heatString = String.valueOf(row.getCell(6).getNumericCellValue());
420
+                String split = heatString.substring(0, heatString.indexOf("."));
421
+                Integer heat = Integer.valueOf(split);
422
+                Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
423
+
424
+                int currentRow = j + 1;
425
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(termName)) {
426
+                    responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
427
+                    return responseBean;
428
+                }
429
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(blockName)) {
430
+                    responseBean.addError("第" + currentRow + "行" + "楼栋不能为空!");
431
+                    return responseBean;
432
+                }
433
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(unitName)) {
434
+                    responseBean.addError("第" + currentRow + "行" + "单元不能为空!");
435
+                    return responseBean;
436
+                }
437
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(floorName)) {
438
+                    responseBean.addError("第" + currentRow + "行" + "层不能为空!");
439
+                    return responseBean;
440
+                }
441
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(roomName)) {
442
+                    responseBean.addError("第" + currentRow + "行" + "房号不能为空!");
443
+                    return responseBean;
444
+                }
445
+
446
+                String houseInfo = termName + blockName + unitName + floorName + roomName;
447
+                if (temHousingList.contains(houseInfo)) {
448
+                    logger.info("存在重复房源:{}", houseInfo);
449
+                    responseBean.addError("第" + currentRow + "行存在重复房源,请删除重复房源后再次上传文件。");
450
+                    return responseBean;
451
+                }
452
+
453
+                QueryWrapper<TaHousingResources> taHousingResourcesQueryWrapper = new QueryWrapper<>();
454
+//                taHousingResourcesQueryWrapper.eq("sales_batch_id",salesBatchId);
455
+                taHousingResourcesQueryWrapper.eq("building_id", buildingId);
456
+                taHousingResourcesQueryWrapper.eq("org_id", orgId);
457
+                taHousingResourcesQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
458
+                taHousingResourcesQueryWrapper.eq("term_name", termName);
459
+                taHousingResourcesQueryWrapper.eq("block_name", blockName);
460
+                taHousingResourcesQueryWrapper.eq("unit_name", unitName);
461
+                taHousingResourcesQueryWrapper.eq("floor_name", floorName);
462
+                taHousingResourcesQueryWrapper.eq("room_name", roomName);
463
+                TaHousingResources oldTaHouseingResources = taHousingResourcesMapper.selectOne(taHousingResourcesQueryWrapper);
464
+                if (null != oldTaHouseingResources) {
465
+                    logger.info("数据库存在重复房源:{}", houseInfo);
466
+                    responseBean.addError("第" + currentRow + "行与系统已录入房源" + oldTaHouseingResources.getHouseId() + "重复,请删除重复房源后再次上传文件。(注意,要检查本楼盘下所有批次的房源)。");
467
+                    return responseBean;
468
+                }
469
+
470
+                //把数据塞入temList校验是否有重复的数据
471
+                temHousingList.add(houseInfo);
472
+                //构建数据
473
+                taHousingResources.setTermName(termName);
474
+                taHousingResources.setBlockName(blockName);
475
+                taHousingResources.setUnitName(unitName);
476
+                taHousingResources.setFloorName(floorName);
477
+                taHousingResources.setRoomName(roomName);
478
+                taHousingResources.setPrice(price);
479
+                taHousingResources.setHeat(heat);
480
+                taHousingResources.setStatus(status);
481
+                list.add(taHousingResources);
482
+            }
483
+        }
484
+        //构建分页
485
+        Map<String, Object> data = new HashMap<String, Object>();
486
+        data.put("list", list);
487
+        data.put("total", list.size());
488
+
489
+        responseBean.addSuccess(data);
490
+        return responseBean;
491
+    }
492
+
493
+    /**
494
+     * 保存文件
495
+     *
496
+     * @param file
497
+     * @param salesBatchId
498
+     * @param buildingId
499
+     * @param orgId
500
+     * @return
501
+     */
502
+    @Override
503
+    public ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
504
+        ResponseBean responseBean = new ResponseBean();
505
+        responseBean = getExcelData(file, salesBatchId, buildingId, orgId);
506
+        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS) {
507
+            return responseBean;
508
+        }
509
+
510
+        //获取校验成功的数据
511
+        Map<String, Object> data = (Map<String, Object>) responseBean.getData();
512
+        List<TaHousingResources> list = (List<TaHousingResources>) data.get("list");
513
+        list.forEach(e -> {
514
+            e.setOrgId(orgId);
515
+            e.setSalesBatchId(salesBatchId);
516
+            e.setBuildingId(buildingId);
517
+            addHouseResources(e);
518
+        });
519
+        return ResponseBean.success(list);
520
+    }
521
+
522
+    //更新房号
523
+    private void updateRoom(TaHousingResources taHousingResources) {
524
+        TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
525
+        taBuildingRoom.setUpdateDate(LocalDateTime.now());
526
+        taBuildingRoom.setTermId(taHousingResources.getTermId());
527
+        taBuildingRoom.setBlockId(taHousingResources.getBlockId());
528
+        taBuildingRoom.setUnitId(taHousingResources.getUnitId());
529
+        taBuildingRoom.setFloorId(taHousingResources.getFloorId());
530
+        taBuildingRoom.setRoomName(taHousingResources.getRoomName());
531
+        taBuildingRoom.setRoomId(taHousingResources.getRoomId());
532
+        taBuildingRoomMapper.updateById(taBuildingRoom);
533
+    }
534
+
535
+    //更新楼层
536
+    private void updateFloor(TaHousingResources taHousingResources) {
537
+        TaBuildingFloor taBuildingFloor = new TaBuildingFloor();
538
+        taBuildingFloor.setUpdateDate(LocalDateTime.now());
539
+        taBuildingFloor.setTermId(taHousingResources.getTermId());
540
+        taBuildingFloor.setBlockId(taHousingResources.getBlockId());
541
+        taBuildingFloor.setUnitId(taHousingResources.getUnitId());
542
+        taBuildingFloor.setFloorName(taHousingResources.getFloorName());
543
+        taBuildingFloorMapper.updateById(taBuildingFloor);
544
+    }
545
+
546
+    //更新单元
547
+    private void updateUnit(TaHousingResources taHousingResources) {
548
+        TaBuildingUnit taBuildingUnit = new TaBuildingUnit();
549
+        taBuildingUnit.setUpdateDate(LocalDateTime.now());
550
+        taBuildingUnit.setTermId(taHousingResources.getTermId());
551
+        taBuildingUnit.setBlockId(taHousingResources.getBlockId());
552
+        taBuildingUnit.setUnitName(taHousingResources.getUnitName());
553
+        taBuildingUnit.setUnitId(taHousingResources.getUnitId());
554
+        taBuildingUnitMapper.updateById(taBuildingUnit);
555
+    }
556
+
557
+    //更新栋
558
+    private void updataBlock(TaHousingResources taHousingResources) {
559
+        TaBuildingBlock taBuildingBlock = new TaBuildingBlock();
560
+        taBuildingBlock.setUpdateDate(LocalDateTime.now());
561
+        taBuildingBlock.setTermId(taHousingResources.getTermId());
562
+        taBuildingBlock.setBlockName(taHousingResources.getBlockName());
563
+        taBuildingBlock.setBlockId(taHousingResources.getBlockId());
564
+        taBuildingBlockMapper.updateById(taBuildingBlock);
565
+    }
566
+
567
+    //添加房间号
568
+    private void addRoom(TaHousingResources taHousingResources) {
569
+        TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
570
+        taBuildingRoom.setBuildingId(taHousingResources.getBuildingId());
571
+        taBuildingRoom.setCreateDate(LocalDateTime.now());
572
+        taBuildingRoom.setOrgId(taHousingResources.getOrgId());
573
+        taBuildingRoom.setStatus(CommConstant.STATUS_NORMAL);
574
+        taBuildingRoom.setTermId(taHousingResources.getTermId());
575
+        taBuildingRoom.setBlockId(taHousingResources.getBlockId());
576
+        taBuildingRoom.setUnitId(taHousingResources.getUnitId());
577
+        taBuildingRoom.setFloorId(taHousingResources.getFloorId());
578
+        taBuildingRoom.setRoomName(taHousingResources.getRoomName());
579
+        taBuildingRoomMapper.insert(taBuildingRoom);
580
+        taHousingResources.setRoomId(taBuildingRoom.getRoomId());
581
+    }
582
+
583
+    //添加楼层
584
+    private void addFloor(TaHousingResources taHousingResources) {
585
+        TaBuildingFloor taBuildingFloor = new TaBuildingFloor();
586
+        taBuildingFloor.setBuildingId(taHousingResources.getBuildingId());
587
+        taBuildingFloor.setCreateDate(LocalDateTime.now());
588
+        taBuildingFloor.setOrgId(taHousingResources.getOrgId());
589
+        taBuildingFloor.setStatus(CommConstant.STATUS_NORMAL);
590
+        taBuildingFloor.setTermId(taHousingResources.getTermId());
591
+        taBuildingFloor.setBlockId(taHousingResources.getBlockId());
592
+        taBuildingFloor.setUnitId(taHousingResources.getUnitId());
593
+        taBuildingFloor.setFloorName(taHousingResources.getFloorName());
594
+        taBuildingFloorMapper.insert(taBuildingFloor);
595
+        taHousingResources.setFloorId(taBuildingFloor.getFloorId());
596
+    }
597
+
598
+    //添加单元
599
+    private void addUnit(TaHousingResources taHousingResources) {
600
+        TaBuildingUnit taBuildingUnit = new TaBuildingUnit();
601
+        taBuildingUnit.setBuildingId(taHousingResources.getBuildingId());
602
+        taBuildingUnit.setCreateDate(LocalDateTime.now());
603
+        taBuildingUnit.setOrgId(taHousingResources.getOrgId());
604
+        taBuildingUnit.setStatus(CommConstant.STATUS_NORMAL);
605
+        taBuildingUnit.setTermId(taHousingResources.getTermId());
606
+        taBuildingUnit.setBlockId(taHousingResources.getBlockId());
607
+        taBuildingUnit.setUnitName(taHousingResources.getUnitName());
608
+        taBuildingUnitMapper.insert(taBuildingUnit);
609
+        taHousingResources.setUnitId(taBuildingUnit.getUnitId());
610
+    }
611
+
612
+    //添加楼栋
613
+    private void addBlock(TaHousingResources taHousingResources) {
614
+        TaBuildingBlock taBuildingBlock = new TaBuildingBlock();
615
+        taBuildingBlock.setBuildingId(taHousingResources.getBuildingId());
616
+        taBuildingBlock.setCreateDate(LocalDateTime.now());
617
+        taBuildingBlock.setOrgId(taHousingResources.getOrgId());
618
+        taBuildingBlock.setStatus(CommConstant.STATUS_NORMAL);
619
+        taBuildingBlock.setTermId(taHousingResources.getTermId());
620
+        taBuildingBlock.setBlockName(taHousingResources.getBlockName());
621
+        taBuildingBlockMapper.insert(taBuildingBlock);
622
+        taHousingResources.setBlockId(taBuildingBlock.getBlockId());
623
+    }
624
+
625
+    //添加期
626
+    private void addTerm(TaHousingResources taHousingResources) {
627
+        TaBuildingTerm taBuildingTerm = new TaBuildingTerm();
628
+        taBuildingTerm.setBuildingId(taHousingResources.getBuildingId());
629
+        taBuildingTerm.setCreateDate(LocalDateTime.now());
630
+        taBuildingTerm.setOrgId(taHousingResources.getOrgId());
631
+        taBuildingTerm.setStatus(CommConstant.STATUS_NORMAL);
632
+        taBuildingTerm.setTermName(taHousingResources.getTermName());
633
+        taBuildingTermMapper.insert(taBuildingTerm);
634
+        taHousingResources.setTermId(taBuildingTerm.getTermId());
635
+    }
636
+
637
+    //校验房号
638
+    private String checkedRoom(TaHousingResources taHousingResources) {
639
+        if (StringUtils.isEmpty(taHousingResources.getRoomName())) {
640
+            return "请输入房号。";
641
+        } else {
642
+            //查询房号
643
+            TaBuildingRoom taBuildingRoom = selectRoom(taHousingResources);
644
+            if (null != taBuildingRoom) {
645
+                taHousingResources.setRoomId(taBuildingRoom.getRoomId());
646
+                return "房间名" + taHousingResources.getRoomName() + "存在。不允许保存,请修改!";
647
+            } else {
648
+                return "notExist";
649
+            }
650
+        }
651
+    }
652
+
653
+    //查询房间号
654
+    private TaBuildingRoom selectRoom(TaHousingResources taHousingResources) {
655
+        QueryWrapper<TaBuildingRoom> queryWrapper = new QueryWrapper<>();
656
+        queryWrapper.eq("org_id", taHousingResources.getOrgId());
657
+        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
658
+        queryWrapper.eq("building_id", taHousingResources.getBuildingId());
659
+        queryWrapper.eq("term_id", taHousingResources.getTermId());
660
+        queryWrapper.eq("block_id", taHousingResources.getBlockId());
661
+        queryWrapper.eq("unit_id", taHousingResources.getUnitId());
662
+        queryWrapper.eq("floor_id", taHousingResources.getFloorId());
663
+        queryWrapper.eq("room_name", taHousingResources.getRoomName());
664
+        return taBuildingRoomMapper.selectOne(queryWrapper);
665
+    }
666
+
667
+    //校验楼层
668
+    private String checkedFloor(TaHousingResources taHousingResources) {
669
+        if (StringUtils.isEmpty(taHousingResources.getFloorName())) {
670
+            return "请输入楼层名。";
671
+        } else {
672
+            QueryWrapper<TaBuildingFloor> queryWrapper = new QueryWrapper<>();
673
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
674
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
675
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
676
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
677
+            queryWrapper.eq("block_id", taHousingResources.getBlockId());
678
+            queryWrapper.eq("unit_id", taHousingResources.getUnitId());
679
+            queryWrapper.eq("floor_name", taHousingResources.getFloorName());
680
+            TaBuildingFloor taBuildingFloor = taBuildingFloorMapper.selectOne(queryWrapper);
681
+            if (null != taBuildingFloor) {
682
+                taHousingResources.setFloorId(taBuildingFloor.getFloorId());
683
+                return "楼层名" + taHousingResources.getFloorName() + "存在。";
684
+            } else {
685
+                return "notExist";
686
+            }
687
+        }
688
+    }
689
+
690
+    //校验单元
691
+    private String checkedUnit(TaHousingResources taHousingResources) {
692
+        if (StringUtils.isEmpty(taHousingResources.getUnitName())) {
693
+            return "请输入单元名。";
694
+        } else {
695
+            QueryWrapper<TaBuildingUnit> queryWrapper = new QueryWrapper<>();
696
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
697
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
698
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
699
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
700
+            queryWrapper.eq("block_id", taHousingResources.getBlockId());
701
+            queryWrapper.eq("unit_name", taHousingResources.getUnitName());
702
+            TaBuildingUnit taBuildingUnit = taBuildingUnitMapper.selectOne(queryWrapper);
703
+            if (null != taBuildingUnit) {
704
+                taHousingResources.setUnitId(taBuildingUnit.getUnitId());
705
+                return "单元名" + taHousingResources.getUnitName() + "存在。";
706
+            } else {
707
+                return "notExist";
708
+            }
709
+        }
710
+    }
711
+
712
+    //校验楼盘
713
+    private String checkedBlock(TaHousingResources taHousingResources) {
714
+        if (StringUtils.isEmpty(taHousingResources.getBlockName())) {
715
+            return "请输入楼栋名。";
716
+        } else {
717
+            QueryWrapper<TaBuildingBlock> queryWrapper = new QueryWrapper<>();
718
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
719
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
720
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
721
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
722
+            queryWrapper.eq("block_name", taHousingResources.getBlockName());
723
+            TaBuildingBlock taBuildingBlock = taBuildingBlockMapper.selectOne(queryWrapper);
724
+            if (null != taBuildingBlock) {
725
+                taHousingResources.setBlockId(taBuildingBlock.getBlockId());
726
+                return "楼栋名" + taHousingResources.getBlockName() + "存在。";
727
+            } else {
728
+                return "notExist";
729
+            }
730
+        }
731
+    }
732
+
733
+    //校验期
734
+    private String checckedTerm(TaHousingResources taHousingResources) {
735
+        if (StringUtils.isEmpty(taHousingResources.getTermName())) {
736
+            return "请输入期名。";
737
+        } else {
738
+            QueryWrapper<TaBuildingTerm> queryWrapper = new QueryWrapper<>();
739
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
740
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
741
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
742
+            queryWrapper.eq("term_name", taHousingResources.getTermName());
743
+            TaBuildingTerm taBuildingTerm = taBuildingTermMapper.selectOne(queryWrapper);
744
+            if (null != taBuildingTerm) {
745
+                taHousingResources.setTermId(taBuildingTerm.getTermId());
746
+                return "期名" + taHousingResources.getTermName() + "存在。";
747
+            } else {
748
+                return "notExist";
749
+            }
750
+        }
109 751
     }
110 752
 }

+ 6
- 2
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java View File

@@ -179,9 +179,13 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
179 179
 
180 180
         UpdateWrapper<TaPerson> wrapper = new UpdateWrapper<>();
181 181
         wrapper.set("phone", phone);
182
-        wrapper.set("person_type",CommConstant.PERSON_ESTATE_CUSTOMER);
182
+
183
+        if (CommConstant.PERSON_ESTATE_DRIFT.equals(person.getPersonType())) {
184
+            wrapper.set("person_type",CommConstant.PERSON_ESTATE_CUSTOMER);
185
+        }
186
+
183 187
         wrapper.eq("mini_openid", miniOpenid);
184
-        wrapper.eq("person_type",CommConstant.PERSON_ESTATE_DRIFT);
188
+//        wrapper.eq("person_type",CommConstant.PERSON_ESTATE_DRIFT);
185 189
         taPersonMapper.update(new TaPerson(), wrapper);
186 190
 
187 191
         person.setPhone(phone);

+ 79
- 13
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java View File

@@ -1,17 +1,26 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 8
 import com.huiju.estateagents.base.ResponseBean;
9
+import com.huiju.estateagents.common.CommConstant;
8 10
 import com.huiju.estateagents.common.DateUtils;
11
+import com.huiju.estateagents.common.StringUtils;
12
+import com.huiju.estateagents.entity.TaApartmentImg;
13
+import com.huiju.estateagents.entity.TaBuildingImg;
9 14
 import com.huiju.estateagents.entity.TaPreselectionRecord;
15
+import com.huiju.estateagents.entity.TaSharePersonFrom;
16
+import com.huiju.estateagents.mapper.TaApartmentImgMapper;
17
+import com.huiju.estateagents.mapper.TaBuildingImgMapper;
10 18
 import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
11 19
 import com.huiju.estateagents.mapper.TaPreselectionRecordMapper;
12 20
 import com.huiju.estateagents.po.TaHousingResourcesPO;
13 21
 import com.huiju.estateagents.po.TaPreselectionRecordPO;
14 22
 import com.huiju.estateagents.service.ITaPreselectionRecordService;
23
+import org.apache.commons.collections.CollectionUtils;
15 24
 import org.slf4j.Logger;
16 25
 import org.slf4j.LoggerFactory;
17 26
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +28,8 @@ import org.springframework.stereotype.Service;
19 28
 import org.springframework.transaction.annotation.Transactional;
20 29
 
21 30
 import java.time.LocalDateTime;
31
+import java.util.ArrayList;
32
+import java.util.List;
22 33
 
23 34
 /**
24 35
  * <p>
@@ -39,12 +50,43 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
39 50
     @Autowired
40 51
     private TaHousingResourcesMapper taHousingResourcesMapper;
41 52
 
53
+    @Autowired
54
+    TaBuildingImgMapper taBuildingImgMapper;
55
+
56
+    @Autowired
57
+    TaApartmentImgMapper taApartmentImgMapper;
58
+
42 59
     @Override
43
-    public IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, String personId) {
44
-        logger.info("listPreselectionRecord 接收参数:pageNum:{},pageSize:{},personId:{}", pageNum, pageSize, personId);
60
+    public IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId) {
61
+        logger.info("listPreselectionRecord 接收参数:pageNum:{},pageSize:{},orgId:{},personId:{}", pageNum, pageSize, orgId, personId);
45 62
 
46 63
         IPage<TaPreselectionRecordPO> iPage = new Page<>(pageNum, pageSize);
47
-        return taPreselectionRecordMapper.listPreselectionRecord(iPage, personId);
64
+        iPage = taPreselectionRecordMapper.listPreselectionRecord(iPage, orgId, personId);
65
+
66
+        List<TaPreselectionRecordPO> poList = iPage.getRecords();
67
+        if (CollectionUtils.isNotEmpty(poList)) {
68
+            List<TaPreselectionRecordPO> resultList = new ArrayList<>();
69
+            List<TaBuildingImg> taBuildingImgList;
70
+            List<TaApartmentImg> buildingImg;
71
+            QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper;
72
+            QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
73
+            for (TaPreselectionRecordPO po : poList) {
74
+                apartmentImgQueryWrapper = new QueryWrapper<>();
75
+                apartmentImgQueryWrapper.eq("apartment_id", po.getApartmentId());
76
+                buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
77
+                for (TaApartmentImg apartmentImg : buildingImg) {
78
+                    buildingImgQueryWrapper = new QueryWrapper<>();
79
+                    buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
80
+                    buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
81
+                    buildingImgQueryWrapper.orderByAsc("order_no");
82
+                    taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
83
+                    po.setBuildingImgList(taBuildingImgList);
84
+                }
85
+                resultList.add(po);
86
+            }
87
+            iPage.setRecords(resultList);
88
+        }
89
+        return iPage;
48 90
     }
49 91
 
50 92
     @Override
@@ -58,7 +100,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
58 100
         TaPreselectionRecord record = taPreselectionRecordMapper
59 101
                 .getRecordByPersonIdAndHouseId(taPreselectionRecord.getPersonId(), taPreselectionRecord.getHouseId());
60 102
         if (record != null) {
61
-            responseBean.addError("您已经预选过该房源");
103
+            responseBean.addError("已预选过此房源,请到选房记录中查看。");
62 104
             return responseBean;
63 105
         }
64 106
 
@@ -75,18 +117,19 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
75 117
         }
76 118
 
77 119
         // 校验当前房源状态是否为已发布
78
-        if (!"1".equals(resourcesPO.getStatus())) {
120
+        if (1 != resourcesPO.getStatus()) {
79 121
             responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
80 122
             return responseBean;
81 123
         }
82 124
 
83 125
         // 校验预选操作时间是否在规定范围内
84
-        if (DateUtils.checkTimeRange(resourcesPO.getPreselectionStartTime(), resourcesPO.getPreselectionEndTime(), null)) {
126
+        if (!DateUtils.checkTimeRange(resourcesPO.getPreselectionStartTime(), resourcesPO.getPreselectionEndTime(), null)) {
85 127
             responseBean.addError("当前时间不在预选时间范围内,请联系置业顾问了解详情。");
86 128
             return responseBean;
87 129
         }
88 130
 
89 131
         // 添加预选记录
132
+        taPreselectionRecord.setSalesBatchId(resourcesPO.getSalesBatchId());
90 133
         taPreselectionRecord.setStatus(1);
91 134
         taPreselectionRecord.setCreateDate(LocalDateTime.now());
92 135
         save(taPreselectionRecord);
@@ -103,24 +146,47 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
103 146
 
104 147
     @Override
105 148
     @Transactional
106
-    public Boolean taPreselectionRecordCancel(String personId, String houseId) {
149
+    public ResponseBean taPreselectionRecordCancel(String personId, String houseId) {
107 150
         logger.info("taPreselectionRecordCancel 接收参数:personId:{},houseId:{}", personId, houseId);
108 151
 
152
+        ResponseBean responseBean = new ResponseBean<>();
153
+        // 校验是否已经取消
154
+        TaPreselectionRecord preselectionRecord = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
155
+        if (preselectionRecord == null) {
156
+            responseBean.addError("未预选过此房源,或已取消预选此房源");
157
+            return responseBean;
158
+        }
159
+
160
+        TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(houseId, "0");
161
+        if (resourcesPO == null || 1 != resourcesPO.getStatus()) {
162
+            responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
163
+            return responseBean;
164
+        }
165
+
166
+        // 校验当前批次状态是否为已发布
167
+        if (resourcesPO.getSaleBatchStatus() != 1) {
168
+            responseBean.addError("当前销售批次已临时取消发布,请稍后再试或联系置业顾问了解详情。");
169
+            return responseBean;
170
+        }
171
+
109 172
         // 更新预选记录
110 173
         TaPreselectionRecord record = new TaPreselectionRecord();
111
-        record.setPreselectionRecordId(Integer.parseInt(personId));
174
+        record.setPreselectionRecordId(preselectionRecord.getPreselectionRecordId());
112 175
         record.setStatus(0);
113 176
         record.setUpdateDate(DateUtils.today());
114 177
         updateById(record);
115 178
 
116 179
         // 更新房源表热度
117
-        return taHousingResourcesMapper.updateForSubtractHeat(houseId);
180
+        responseBean.addSuccess(taHousingResourcesMapper.updateForSubtractHeat(houseId));
181
+        return responseBean;
118 182
     }
119 183
 
120 184
     @Override
121
-    public TaPreselectionRecord checkPreselect(String personId, String houseId) {
122
-        logger.info("checkPreselect 接收参数:personId:{},houseId:{}", personId, houseId);
123
-
124
-        return taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
185
+    public ResponseBean selectPreSelectRecordList(Integer pageNum, Integer pageSize, String salesBatchId, Integer houseId, Integer orgId, String phone, String apartmentId, Integer status) {
186
+        Page page = new Page(pageNum, pageSize);
187
+        // 分页查询
188
+        List<TaPreselectionRecord> list = taPreselectionRecordMapper.selectPreSelectRecordList(page, salesBatchId, houseId, orgId, phone, apartmentId, status);
189
+        page.setRecords(list);
190
+        return ResponseBean.success(page);
125 191
     }
126 192
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java View File

@@ -210,7 +210,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
210 210
     }
211 211
 
212 212
     @Override
213
-    public ResponseBean recommendCust(String paramStr, String openid,Integer orgId) {
213
+    public synchronized ResponseBean recommendCust(String paramStr, String openid,Integer orgId) {
214 214
         JSONObject params = JSONObject.parseObject(paramStr);
215 215
         if (null == params) {
216 216
             return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);

+ 161
- 2
src/main/java/com/huiju/estateagents/service/impl/TaSalesBatchServiceImpl.java View File

@@ -1,14 +1,31 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
-import com.huiju.estateagents.entity.TaSalesBatch;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.common.StringUtils;
10
+import com.huiju.estateagents.entity.*;
11
+import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
12
+import com.huiju.estateagents.mapper.TaPosterMapper;
7 13
 import com.huiju.estateagents.mapper.TaSalesBatchMapper;
14
+import com.huiju.estateagents.service.ITaBuildingRoomService;
15
+import com.huiju.estateagents.service.ITaHousingResourcesService;
8 16
 import com.huiju.estateagents.service.ITaSalesBatchService;
17
+import org.apache.commons.collections.CollectionUtils;
18
+import org.checkerframework.checker.units.qual.A;
19
+import org.slf4j.Logger;
20
+import org.slf4j.LoggerFactory;
9 21
 import org.springframework.beans.factory.annotation.Autowired;
10 22
 import org.springframework.stereotype.Service;
11 23
 
24
+import java.math.BigDecimal;
25
+import java.util.ArrayList;
26
+import java.util.List;
27
+import java.util.Map;
28
+
12 29
 /**
13 30
  * <p>
14 31
  * 销售批次表  服务实现类
@@ -20,11 +37,153 @@ import org.springframework.stereotype.Service;
20 37
 @Service
21 38
 public class TaSalesBatchServiceImpl extends ServiceImpl<TaSalesBatchMapper, TaSalesBatch> implements ITaSalesBatchService {
22 39
 
40
+    private Logger logger = LoggerFactory.getLogger(TaSalesBatchServiceImpl.class);
41
+
23 42
     @Autowired
24 43
     private TaSalesBatchMapper taSalesBatchMapper;
25 44
 
45
+    @Autowired
46
+    TaPosterMapper taPosterMapper;
47
+
48
+    @Autowired
49
+    private ShareContentServiceImpl shareContentService;
50
+
51
+    @Autowired
52
+    private TdPosterTemplateServiceImpl tdPosterTemplateService;
53
+
54
+    @Autowired
55
+    private TaPosterServiceImpl taPosterService;
56
+
57
+    @Autowired
58
+    private TaHousingResourcesMapper taHousingResourcesMapper;
59
+
60
+    @Autowired
61
+    private ITaHousingResourcesService taHousingResourcesService;
62
+
63
+    @Autowired
64
+    private ITaBuildingRoomService taBuildingRoomService;
65
+
26 66
     @Override
27 67
     public IPage<TaSalesBatch> selectByCondition(IPage<TaSalesBatch> page, String salesBatchName, String buildingId, Integer status, Integer orgId) {
28 68
         return taSalesBatchMapper.selectByCondition(page, salesBatchName, buildingId, status, orgId);
29 69
     }
70
+
71
+    @Override
72
+    public ResponseBean delSalesBatchList(Integer orgId, List<TaSalesBatch> taSalesBatchList) {
73
+        ResponseBean responseBean = new ResponseBean();
74
+        Integer count = taSalesBatchMapper.countPreSelectRecord(orgId, taSalesBatchList);
75
+        if (count > 0) {
76
+            responseBean.addError("已有用户预选,请先删除预选记录。");
77
+            return responseBean;
78
+        }
79
+        //无预选状态下删除销售批次的同时删除房源信息
80
+        List<TaHousingResources> housingList =taHousingResourcesMapper.selectHousingList(orgId,taSalesBatchList);
81
+        List<TaBuildingRoom> taBuildingRoomList = new ArrayList<>();
82
+        housingList.forEach(e -> {
83
+            e.setStatus(CommConstant.STATUS_DELETE);
84
+            TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
85
+            taBuildingRoom.setRoomId(e.getRoomId());
86
+            taBuildingRoom.setStatus(CommConstant.STATUS_DELETE);
87
+            taBuildingRoomList.add(taBuildingRoom);
88
+        });
89
+
90
+        //房源改为无效
91
+        if (CollectionUtils.isNotEmpty(housingList)){
92
+            taHousingResourcesService.updateBatchById(housingList);
93
+        }
94
+
95
+        if (CollectionUtils.isNotEmpty(taBuildingRoomList)){
96
+            taBuildingRoomService.updateBatchById(taBuildingRoomList);
97
+        }
98
+
99
+        //删除销售批次
100
+        taSalesBatchMapper.updateSalesBatchStatus(orgId, taSalesBatchList);
101
+        return responseBean;
102
+    }
103
+
104
+    /**
105
+     * 获取通知信息
106
+     *
107
+     * @param salesBatchId 销售批次ID
108
+     * @return
109
+     */
110
+    @Override
111
+    public ResponseBean getNoticeInfo(Integer salesBatchId) {
112
+        logger.info("getNoticeInfo 接收参数:saleBatchId:{}", salesBatchId);
113
+
114
+        ResponseBean responseBean = new ResponseBean();
115
+
116
+        TaSalesBatch salesBatch = getById(salesBatchId);
117
+        if (salesBatch == null) {
118
+            responseBean.addError("未查询到数据");
119
+            return responseBean;
120
+        }
121
+
122
+        Long totalHouses = null;
123
+        BigDecimal totalRealHeat = null;
124
+        BigDecimal totalHeat = null;
125
+
126
+        // 获取房源预选数量
127
+        Map<String, Object> result = taSalesBatchMapper.getTotalHousesAndHeat(salesBatchId);
128
+        if (result != null) {
129
+            totalHouses = (Long) result.get("totalHouses");
130
+            totalRealHeat = (BigDecimal) result.get("totalRealHeat");
131
+            totalHeat = (BigDecimal) result.get("totalHeat");
132
+        }
133
+
134
+        JSONObject obj = new JSONObject();
135
+        obj.put("preselectionStartTime", salesBatch.getPreselectionStartTime());
136
+        obj.put("preselectionEndTime", salesBatch.getPreselectionEndTime());
137
+        obj.put("salesNumber", totalHouses == null ? 0 : totalHouses);
138
+        obj.put("preselectionNumber", totalRealHeat == null ? 0 : totalRealHeat);
139
+        obj.put("heatNumber", totalHeat == null ? 0 : totalHeat);
140
+        responseBean.addSuccess(obj);
141
+        return responseBean;
142
+    }
143
+
144
+    /**
145
+     * 获取销售批次详情
146
+     *
147
+     * @param salesBatchId
148
+     * @return
149
+     */
150
+    @Override
151
+    public ResponseBean getSalesBatchById(Integer salesBatchId) {
152
+        logger.info("getSalesBatchById 接收参数:saleBatchId:{}", salesBatchId);
153
+
154
+        ResponseBean responseBean = new ResponseBean();
155
+        TaSalesBatch result = getById(salesBatchId);
156
+        if (result == null) {
157
+            responseBean.addSuccess(null);
158
+            return responseBean;
159
+        }
160
+
161
+        // 获取海报信息
162
+        QueryWrapper<TaPoster> queryWrapper = new QueryWrapper<>();
163
+        queryWrapper.eq("target_id", salesBatchId + "");
164
+        queryWrapper.eq("target_type", "house");
165
+        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
166
+        List<TaPoster> posterList = taPosterService.list(queryWrapper);
167
+
168
+        // 获取分享内容信息
169
+        List<TaShareContent> shareContentList = shareContentService.getPostersForTarget(salesBatchId + "", "house");
170
+
171
+        List<TaPoster> resultPosterList = new ArrayList<>();
172
+        if (CollectionUtils.isNotEmpty(posterList)) {
173
+            for (TaPoster poster : posterList) {
174
+                QueryWrapper<TdPosterTemplate> templateQueryWrapper = new QueryWrapper<>();
175
+                templateQueryWrapper.eq("status", "1");
176
+                templateQueryWrapper.eq("type ", "HousingChoice ");
177
+                List<TdPosterTemplate> posterTemplate = tdPosterTemplateService.list(templateQueryWrapper);
178
+
179
+                poster.setTemplates(posterTemplate);
180
+                resultPosterList.add(poster);
181
+            }
182
+        }
183
+
184
+        result.setPosters(resultPosterList);
185
+        result.setShareContents(shareContentList);
186
+        responseBean.addSuccess(result);
187
+        return responseBean;
188
+    }
30 189
 }

+ 19
- 0
src/main/java/com/huiju/estateagents/service/impl/TaSharePersonFromServiceImpl.java View File

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 6
 import com.huiju.estateagents.base.ResponseBean;
6 7
 import com.huiju.estateagents.common.CommConstant;
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
11 12
 import org.springframework.stereotype.Service;
12 13
 
13 14
 import java.time.LocalDateTime;
15
+import java.util.List;
14 16
 
15 17
 /**
16 18
  * <p>
@@ -37,6 +39,10 @@ public class TaSharePersonFromServiceImpl extends ServiceImpl<TaSharePersonFromM
37 39
 
38 40
     @Autowired
39 41
     private TaSharePersonFromMapper taSharePersonFromMapper;
42
+
43
+    @Autowired
44
+    private  TaSalesBatchMapper taSalesBatchMapper;
45
+
40 46
     /**
41 47
      * 添加客户分享记录
42 48
      *
@@ -99,4 +105,17 @@ public class TaSharePersonFromServiceImpl extends ServiceImpl<TaSharePersonFromM
99 105
         taSharePersonFromMapper.insert(taSharePersonFrom);
100 106
         return taSharePersonFrom;
101 107
     }
108
+
109
+    @Override
110
+    public ResponseBean selectHouseVisitList(Integer pageNum, Integer pageSize, Integer orgId, String personType, String sceneType, String phone, String saleBatchId) {
111
+        Page page = new Page(pageNum,pageSize);
112
+        // 分页查询
113
+        List<TaSharePersonFrom> list = taSharePersonFromMapper.selectHouseVisitList(page, orgId, personType, sceneType, phone, saleBatchId);
114
+        TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(saleBatchId);
115
+        list.forEach(e -> {
116
+            e.setSalesBatchName(taSalesBatch.getSalesBatchName());
117
+        });
118
+        page.setRecords(list);
119
+        return ResponseBean.success(page);
120
+    }
102 121
 }

+ 3
- 3
src/main/java/com/huiju/estateagents/service/impl/TaShareServiceImpl.java View File

@@ -191,9 +191,9 @@ public class TaShareServiceImpl extends ServiceImpl<TaShareMapper, TaShare> impl
191 191
         // 分页查询
192 192
         List<TaShare> list = taShareMapper.selectHouseShareList(page, orgId, personType, shareType, phone, saleBatchId);
193 193
         TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(saleBatchId);
194
-//        list.forEach(e -> {
195
-//            e.setSalesBatchName(taSalesBatch.getSalesBatchName());
196
-//        });
194
+        list.forEach(e -> {
195
+            e.setSalesBatchName(taSalesBatch.getSalesBatchName());
196
+        });
197 197
         page.setRecords(list);
198 198
         return ResponseBean.success(page);
199 199
     }

+ 5
- 0
src/main/resources/mapper/TaBuildingTermMapper.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.mapper.TaBuildingTermMapper">
4
+
5
+</mapper>

+ 177
- 68
src/main/resources/mapper/TaHousingResourcesMapper.xml View File

@@ -4,109 +4,218 @@
4 4
 
5 5
     <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
6 6
         SELECT
7
-        t.house_id,
8
-        t.building_id,
9
-        t.block_id,
10
-        t.block_name,
11
-        t.sales_batch_id,
12
-        t.unit_id,
13
-        t.unit_name,
14
-        t.floor_id,
15
-        t.floor_name,
16
-        t.room_id,
17
-        t.room_name,
18
-        t.price,
19
-        t.heat,
20
-        t.apartment_id,
21
-        t.`status`,
22
-        t.org_id,
23
-        t2.inside_area,
24
-        t2.building_area
7
+          *
25 8
         FROM
26
-        ta_housing_resources t,
27
-        ta_building_apartment t2
9
+          (
10
+        SELECT
11
+            t.house_id,
12
+            (
13
+            CASE
14
+            WHEN ( SELECT num_char_extract ( t.term_name, 2 ) + 0 ) = 0 THEN
15
+            ( SELECT num_char_extract ( t.term_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.term_name, 2 ) + 0 )
16
+            END
17
+            ) termNamePre,
18
+            (
19
+            CASE
20
+            WHEN ( SELECT num_char_extract ( t.block_name, 2 ) + 0 ) = 0 THEN
21
+            ( SELECT num_char_extract ( t.block_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.block_name, 2 ) + 0 )
22
+            END
23
+            ) blockNamePre,
24
+            (
25
+            CASE
26
+            WHEN ( SELECT num_char_extract ( t.unit_name, 2 ) + 0 ) = 0 THEN
27
+            ( SELECT num_char_extract ( t.unit_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.unit_name, 2 ) + 0 )
28
+            END
29
+            ) unitNamePre,
30
+            t.building_id,
31
+            t.block_id,
32
+            t.block_name,
33
+            t.sales_batch_id,
34
+            t.unit_id,
35
+            t.unit_name,
36
+            t.floor_id,
37
+            t.floor_name,
38
+            t.room_id,
39
+            t.room_name,
40
+            t.price,
41
+            t.heat,
42
+            t.real_heat,
43
+            t.apartment_id,
44
+            t.`status`,
45
+            t.org_id,
46
+            t2.inside_area,
47
+            t2.building_area,
48
+            t2.apartment_name,
49
+            t3.term_id,
50
+            t.term_name
51
+        FROM
52
+          ta_housing_resources t
53
+        LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
54
+        LEFT JOIN ta_building_block t3 ON t.block_id = t3.block_id
28 55
         WHERE
29
-        t.sales_batch_id = #{salesBatchId}
30
-        <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
31
-            AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
32
-        </if>
33
-        <if test="apartmentId != null and apartmentId != ''">
34
-            AND t.apartment_id = #{apartmentId}
35
-        </if>
36
-        AND t.apartment_id = t2.apartment_id
37
-        AND t.`status` = 1
38
-        AND t2.`status` = 1
56
+            t.sales_batch_id = #{salesBatchId}
57
+            AND t.org_id = #{orgId}
58
+            <choose>
59
+                <when test=" endPrice != null and startPrice == null">
60
+                    AND t.price &lt;= #{endPrice}
61
+                </when>
62
+                <when test=" startPrice != null and endPrice == null">
63
+                    AND t.price &gt;= #{startPrice}
64
+                </when>
65
+                <when test="startPrice != null and endPrice != null ">
66
+                    AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
67
+                </when>
68
+                <otherwise>
69
+                </otherwise>
70
+            </choose>
71
+            <if test="apartmentId != null and apartmentId != ''">
72
+                AND t.apartment_id = #{apartmentId}
73
+            </if>
74
+            <choose>
75
+                <when test="type == 1">
76
+                    AND t.`status` > 0
77
+                </when>
78
+                <otherwise>
79
+                    AND t.`status` > -1
80
+                </otherwise>
81
+            </choose>
82
+
83
+          ) t5
39 84
         ORDER BY
40
-        t.create_date DESC
85
+            t5.termNamePre,
86
+            t5.blockNamePre,
87
+            t5.unitNamePre,
88
+            ( SELECT num_char_extract ( t5.floor_name, 2 ) + 0 ) DESC,
89
+            ( SELECT num_char_extract ( t5.room_name, 2 ) + 0)
41 90
     </select>
42 91
 
43 92
     <select id="listBuildApartmentBySalesBatchId" resultType="com.huiju.estateagents.entity.TaBuildingApartment">
44
-        SELECT
93
+	    SELECT
45 94
             t3.apartment_id,
46 95
             t3.apartment_name,
47 96
             t3.apartment_type,
48 97
             t3.inside_area,
49
-            t3.building_area
98
+            t3.building_area,
99
+            t2.apartment_id
100
+        FROM
101
+            (
102
+        SELECT
103
+            t.sales_batch_id,
104
+            t.apartment_id
50 105
         FROM
51
-            ( SELECT t.sales_batch_id, t.apartment_id FROM ta_housing_resources t WHERE t.sales_batch_id = #{salesBatchId} GROUP BY t.apartment_id ) t2
106
+            ta_housing_resources t
107
+        WHERE
108
+            t.sales_batch_id = #{salesBatchId}
109
+            AND t.`status` > 0
110
+            AND t.apartment_id IS NOT NULL
111
+        GROUP BY
112
+            t.apartment_id
113
+            ) t2
52 114
             LEFT JOIN ta_building_apartment t3 ON t2.apartment_id = t3.apartment_id
53 115
         ORDER BY
54
-	      t3.apartment_name
116
+            t3.apartment_name
55 117
     </select>
56 118
 
57 119
     <update id="updateForAddHeat" parameterType="java.lang.String">
58 120
         UPDATE ta_housing_resources t
59
-        SET t.heat = t.heat + 1
121
+        SET t.real_heat = IFNULL(t.real_heat, 0) + 1
60 122
         WHERE
61 123
             t.house_id = #{houseId}
62
-            AND t.heat >= 0
63 124
     </update>
64 125
 
65 126
     <update id="updateForSubtractHeat" parameterType="java.lang.String">
66 127
         UPDATE ta_housing_resources t
67
-        SET t.heat = t.heat - 1
128
+        SET t.real_heat = IFNULL(t.real_heat, 0) - 1
68 129
         WHERE
69 130
             t.house_id = #{houseId}
70
-            AND t.heat > 0
131
+            AND t.real_heat > 0
71 132
     </update>
72 133
 
73 134
     <select id="getHousingDetailById" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
74 135
         SELECT
75
-        t.house_id,
76
-        t.building_id,
77
-        t.block_id,
78
-        t.block_name,
79
-        t.sales_batch_id,
80
-        t.unit_id,
81
-        t.unit_name,
82
-        t.floor_id,
83
-        t.floor_name,
84
-        t.room_id,
85
-        t.room_name,
86
-        t.price,
87
-        t.heat,
88
-        t.apartment_id,
89
-        t.`status`,
90
-        t.org_id,
91
-        t2.apartment_name,
92
-        t2.inside_area,
93
-        t2.building_area,
94
-        t3.preselection_start_time,
95
-        t3.preselection_end_time,
96
-        t3.`status` saleBatchStatus
136
+            t.house_id,
137
+            t.building_id,
138
+            t.block_id,
139
+            t.block_name,
140
+            t.sales_batch_id,
141
+            t.unit_id,
142
+            t.unit_name,
143
+            t.floor_id,
144
+            t.floor_name,
145
+            t.room_id,
146
+            t.room_name,
147
+            t.price,
148
+            t.heat,
149
+            t.real_heat,
150
+            t.apartment_id,
151
+            t.`status`,
152
+            t.org_id,
153
+            t.term_id,
154
+            t.term_name,
155
+            t2.apartment_name,
156
+            t2.inside_area,
157
+            t2.building_area,
158
+            t3.preselection_start_time,
159
+            t3.preselection_end_time,
160
+            t3.`status` saleBatchStatus,
161
+            t4.building_name buildingName
97 162
         FROM
98
-        ta_housing_resources t,
99
-        ta_building_apartment t2,
100
-        ta_sales_batch t3
163
+            ta_housing_resources t
164
+            LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
165
+            LEFT JOIN ta_sales_batch t3 ON t.sales_batch_id = t3.sales_batch_id
166
+            LEFT JOIN ta_building t4 ON t.building_id = t4.building_id
101 167
         WHERE
102
-        t.house_id = #{houseId}
103
-        AND t.apartment_id = t2.apartment_id
104
-        AND t.sales_batch_id = t3.sales_batch_id
168
+            t.house_id = #{houseId}
105 169
         <if test="type != null and type == '1' ">
106 170
             AND t.`status` = 1
107 171
             AND t3.`status` = 1
108 172
         </if>
109
-        AND t2.`status` = 1
173
+    </select>
174
+
175
+    <select id="getHouseResourceList" resultType="com.huiju.estateagents.entity.TaHousingResources">
176
+        SELECT
177
+            t.* ,
178
+            a.apartment_name,
179
+            u.user_name as update_name
180
+        FROM
181
+            ta_housing_resources t
182
+        LEFT JOIN ta_building_apartment a ON t.apartment_id = a.apartment_id
183
+        LEFT JOIN ta_user u on t.update_user = u.user_id
184
+        WHERE t.`status` > -1
185
+        AND t.org_id = #{orgId}
186
+        and t.building_id = #{buildingId}
187
+        and t.sales_batch_id = #{salesBatchId}
188
+        <if test="apartmentId != null and apartmentId != ''">
189
+            AND t.apartment_id = #{apartmentId}
190
+        </if>
191
+        <if test="status != null">
192
+            AND t.status = #{status}
193
+        </if>
194
+        <if test="houseId != null and houseId != ''">
195
+            AND t.house_id like CONCAT('%',#{houseId}, '%')
196
+        </if>
197
+        <if test="termName != null and termName != ''">
198
+            AND t.term_name like CONCAT('%',#{termName}, '%')
199
+        </if>
200
+        <if test="blockName != null and blockName != ''">
201
+            AND t.block_name like CONCAT('%',#{blockName}, '%')
202
+        </if>
203
+        <if test="unitName != null and unitName != ''">
204
+            AND t.unit_name like CONCAT('%',#{unitName}, '%')
205
+        </if>
206
+        <if test="floorName != null and floorName != ''">
207
+            AND t.floor_name like CONCAT('%',#{floorName}, '%')
208
+        </if>
209
+        <if test="roomName != null and roomName != ''">
210
+            AND t.room_name like CONCAT('%',#{roomName}, '%')
211
+        </if>
212
+    </select>
213
+
214
+    <select id="selectHousingList" resultType="com.huiju.estateagents.entity.TaHousingResources">
215
+        select * from ta_housing_resources where org_id = #{orgId} and sales_batch_id in
216
+        <foreach collection="taSalesBatchList" item="taSalesBatch" open="(" close=")" separator=",">
217
+            #{taSalesBatch.salesBatchId}
218
+        </foreach>
110 219
     </select>
111 220
 
112 221
 </mapper>

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

@@ -257,7 +257,7 @@ FROM
257 257
             FROM
258 258
                ta_person tp
259 259
              LEFT JOIN
260
-                ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record where org_id = #{org} GROUP BY  person_id  ) as tpvr
260
+            ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record where org_id = #{org} GROUP BY  person_id  ) as tpvr
261 261
             ON tp.person_id = tpvr.person_id
262 262
              where tp.org_id = #{org} AND tp.person_type IN ('customer','drift','estate agent')
263 263
              GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )

+ 20
- 0
src/main/resources/mapper/TaPersonVisitRecordMapper.xml View File

@@ -336,6 +336,26 @@
336 336
             and t.person_id = #{personId} order by t.create_date desc limit 9999
337 337
             ) t
338 338
             group by t.target_id
339
+         union all
340
+
341
+        select * from (
342
+            select
343
+            t.be_share as target_id,
344
+            g.aerial_view_img as activity_img,
345
+            g.sales_batch_name as activity_name,
346
+            '1' as price,
347
+            '2' as building_name,
348
+            '3' as address,
349
+            1 as building_type_id,
350
+			left(t.tagert_type,5) as eventType,
351
+			t.create_date as visit_time
352
+            from ta_share t
353
+            left join ta_sales_batch g on t.be_share = g.sales_batch_id
354
+            where t.tagert_type like CONCAT('house' , '%')
355
+            and t.person_id = #{personId} order by t.create_date desc limit 9999
356
+            ) t
357
+            group by t.target_id
358
+
339 359
         ) t
340 360
         order by t.visit_time desc
341 361
     </select>

+ 67
- 7
src/main/resources/mapper/TaPreselectionRecordMapper.xml View File

@@ -4,20 +4,40 @@
4 4
 
5 5
     <select id="listPreselectionRecord" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
6 6
         SELECT
7
-            t.*,
7
+            t3.*,
8
+            t4.building_name,
9
+            t5.`status` saleBatchStatus
10
+        FROM
11
+            (
12
+        SELECT
13
+            t.preselection_record_id,
14
+            t.person_id,
15
+            t.org_id,
16
+            t.house_id,
17
+            t.`status`,
18
+            t.create_date,
19
+            t2.term_name,
8 20
             t2.block_name,
9 21
             t2.unit_name,
10 22
             t2.floor_name,
11 23
             t2.room_name,
12
-            t2.price
24
+            t2.price,
25
+            t2.apartment_id,
26
+            t2.building_id buildingId,
27
+            t2.`status` housingStatus,
28
+            t2.sales_batch_id saleBatchId
13 29
         FROM
14
-            ta_preselection_record t ,
30
+            ta_preselection_record t,
15 31
             ta_housing_resources t2
16 32
         WHERE
17
-            t.person_id = #{persionId}
18
-            and t.house_id = t2.house_id
19
-        ORDER BY
20
-            t.create_date DESC;
33
+            t.person_id = #{personId}
34
+            AND t.org_id = #{orgId}
35
+            AND t.house_id = t2.house_id
36
+            ) t3
37
+            LEFT JOIN ta_building t4 ON t3.buildingId = t4.building_id
38
+            LEFT JOIN ta_sales_batch t5 ON t3.saleBatchId = t5.sales_batch_id
39
+         ORDER BY
40
+            t3.create_date DESC
21 41
     </select>
22 42
 
23 43
     <select id="getRecordByPersonIdAndHouseId" resultType="com.huiju.estateagents.entity.TaPreselectionRecord">
@@ -28,6 +48,46 @@
28 48
         WHERE
29 49
             t.person_id = #{personId}
30 50
             AND t.house_id = #{houseId}
51
+            AND t.status = 1
52
+    </select>
53
+
54
+    <select id="selectPreSelectRecordList" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
55
+        select * from (
56
+        select t.house_id,
57
+        a.block_name,
58
+        a.unit_name,
59
+        a.floor_name,
60
+        a.room_name,
61
+        a.apartment_id,
62
+        b.nickname as nameOrnick,
63
+        b.`name`,
64
+        b.avatarurl,
65
+        b.phone,
66
+        a.term_name,
67
+        t.`status`,
68
+        t.update_date,
69
+        t.building_id,
70
+        t.sales_batch_id,
71
+        e.apartment_name,
72
+        b.person_id
73
+        from ta_preselection_record t
74
+        left join ta_housing_resources a on t.house_id = a.house_id
75
+        left join ta_person b on t.person_id = b.person_id
76
+        LEFT JOIN ta_building_apartment e ON a.apartment_id = e.apartment_id
77
+        where b.org_id = #{orgId} and a.sales_batch_id = #{salesBatchId}
78
+        <if test="houseId != null and houseId !=''">and t.house_id = #{houseId}
79
+        </if>
80
+        <if test="phone != null and phone != ''">
81
+            and b.
82
+            phone = #{phone}
83
+        </if>
84
+        <if test="apartmentId != null and apartmentId != ''">
85
+          and a.apartment_id = #{apartmentId}
86
+        </if>
87
+        <if test="status != null">
88
+          and t.status = #{status}
89
+        </if>
90
+        order by t.create_date desc) t group by t.house_id, t.person_id
31 91
     </select>
32 92
 
33 93
 </mapper>

+ 13
- 12
src/main/resources/mapper/TaRecommendCustomerMapper.xml View File

@@ -111,13 +111,13 @@ FROM
111 111
         SELECT
112 112
         a.*,
113 113
         a.customer_id AS customerId,
114
-        if(b.NAME  = null, d.name, b.name) as consultantName,
115
-        if(b.tel  = null, d.tel, b.tel) AS consultTel,
114
+        IFNULL(d.user_name, b.name) as consultantName,
115
+        IFNULL(d.phone, b.tel) as consultTel,
116 116
         c.building_name as intentionName
117 117
         FROM
118 118
         ta_recommend_customer a
119 119
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
120
-        LEFT JOIN ta_person d on a.realty_consultant = d.user_id
120
+        LEFT JOIN ta_user d on a.realty_consultant = d.user_id
121 121
         LEFT JOIN ta_building c ON a.building_id = c.building_id
122 122
         <where>
123 123
             a.status > 0
@@ -135,10 +135,10 @@ FROM
135 135
                 and a.phone like concat(concat("%",#{tel}),"%")
136 136
             </if>
137 137
             <if test="consultName != null and consultName !=''">
138
-                and b.name like CONCAT('%',#{consultName}, '%')
138
+                and IFNULL(d.user_name, b.name) like CONCAT('%',#{consultName}, '%')
139 139
             </if>
140 140
             <if test="consultTel != null and consultTel !=''">
141
-                and b.tel = #{consultTel}
141
+                and IFNULL(d.phone, b.tel) = #{consultTel}
142 142
             </if>
143 143
             <if test="entryType != null and entryType !=''">
144 144
                 and a.entry_type = #{entryType}
@@ -170,12 +170,12 @@ FROM
170 170
         FROM
171 171
         ta_recommend_customer a
172 172
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
173
-        LEFT JOIN ta_person c on a.recommend_person = c.person_id
174 173
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
175 174
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
176 175
         <if test="orgId != null">
177 176
             and p.org_id =  #{orgId}
178 177
         </if>
178
+        LEFT JOIN ta_person c on p.share_person_id = c.person_id
179 179
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
180 180
         <where>
181 181
             a.status > 0
@@ -377,11 +377,12 @@ FROM
377 377
         a.phone as phone,
378 378
         c.building_name as intentionName,
379 379
         if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
380
-        b.NAME AS consultantName,
381
-        b.tel AS consultTel
380
+        IFNULL(d.user_name, b.name) as consultantName,
381
+        IFNULL(d.phone, b.tel) as consultTel
382 382
         FROM
383 383
         ta_recommend_customer a
384 384
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
385
+        LEFT JOIN ta_user d on a.realty_consultant = d.user_id
385 386
         LEFT JOIN ta_building c ON a.building_id = c.building_id
386 387
         <where>
387 388
             a.status > 0
@@ -399,10 +400,10 @@ FROM
399 400
                 and a.phone like concat(concat("%",#{tel}),"%")
400 401
             </if>
401 402
             <if test="consultName != null and consultName !=''">
402
-                and b.name like CONCAT('%',#{consultName}, '%')
403
+                and IFNULL(d.user_name, b.name) like CONCAT('%',#{consultName}, '%')
403 404
             </if>
404 405
             <if test="consultTel != null and consultTel !=''">
405
-                and b.tel = #{consultTel}
406
+                and IFNULL(d.phone, b.tel) = #{consultTel}
406 407
             </if>
407 408
             <if test="entryType != null and entryType !=''">
408 409
                 and a.entry_type = #{entryType}
@@ -553,7 +554,7 @@ FROM
553 554
         </where>
554 555
         order by b.create_date desc
555 556
     </select>
556
-    <!--        limit #{pageCode}, #{pageSize}-->
557
+<!--    limit #{pageCode}, #{pageSize}-->
557 558
 
558 559
     <select id="getCustomerExportListCount" resultType="Integer" >
559 560
         SELECT
@@ -673,7 +674,7 @@ FROM
673 674
         group by a.customer_id,a.building_id
674 675
         order by a.create_date desc
675 676
     </select>
676
-    <!--        limit #{pageCode}, #{pageSize}-->
677
+<!--    limit #{pageCode}, #{pageSize}-->
677 678
 
678 679
     <select id="getMyCustStatistics" resultType="java.util.Map">
679 680
         SELECT

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

@@ -1,11 +1,19 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaSalesBatchMapper">
4
+    <update id="updateSalesBatchStatus">
5
+      update ta_sales_batch t set t.status = -1
6
+      where t.org_id = #{orgId}
7
+      and t.sales_batch_id in
8
+      <foreach collection="taSalesBatchList" item="taSalesBatch" open="(" close=")" separator=",">
9
+         #{taSalesBatch.salesBatchId}
10
+      </foreach>
11
+    </update>
4 12
 
5 13
     <select id="selectByCondition" resultType="com.huiju.estateagents.entity.TaSalesBatch">
6 14
         select t.*, a.building_name from ta_sales_batch t
7 15
         left join ta_building a on t.building_id = a.building_id
8
-        where t.org_id = #{orgId}
16
+        where t.org_id = #{orgId} and t.status != -1
9 17
         <if test="buildingId != null and buildingId != ''">
10 18
             and t.building_id = #{buildingId}
11 19
         </if>
@@ -16,4 +24,24 @@
16 24
             and t.status = #{status}
17 25
         </if>
18 26
     </select>
27
+
28
+    <select id="countPreSelectRecord" resultType="java.lang.Integer">
29
+      select count(*) from ta_preselection_record t
30
+      where t.org_id = #{orgId}
31
+      and t.sales_batch_id in
32
+      <foreach collection="taSalesBatchList" item="taSalesBatch" open="(" close=")" separator=",">
33
+          #{taSalesBatch.salesBatchId}
34
+      </foreach>
35
+    </select>
36
+
37
+    <select id="getTotalHousesAndHeat" resultType="java.util.Map">
38
+        SELECT
39
+            count( * ) totalHouses,
40
+            sum( t.real_heat ) totalRealHeat,
41
+            sum( t.heat) totalHeat
42
+        FROM
43
+            ta_housing_resources t
44
+        WHERE
45
+            t.STATUS = 1 and t.sales_batch_id = #{salesBatchId}
46
+    </select>
19 47
 </mapper>

+ 9
- 5
src/main/resources/mapper/TaShareCountMapper.xml View File

@@ -25,9 +25,9 @@
25 25
         when e.building_name != null || e.building_name != '' then e.building_name
26 26
         when f.news_name != null || f.news_name != '' then f.news_name
27 27
         when g.`name` != null || g.`name` != '' then g.`name`
28
+        when h.sales_batch_name != null || h.sales_batch_name != '' then h.sales_batch_name
28 29
         else '空'
29 30
         end as shareTitle,t.create_date
30
-
31 31
         from ta_share_count t
32 32
         left join ta_building_dynamic a on t.be_share = a.dynamic_id and t.tagert_type = 'activity'
33 33
         left join ta_help_activity b on t.be_share = b.help_activity_id and t.tagert_type = 'help'
@@ -35,10 +35,11 @@
35 35
         LEFT JOIN ta_drainage d on t.be_share = d.drainage_id and t.tagert_type = 'h5'
36 36
         left join ta_building e on t.be_share = e.building_id and t.tagert_type = 'project'
37 37
         LEFT JOIN ta_news f on t.be_share = f.news_id and t.tagert_type = 'news'
38
+        LEFT JOIN ta_sales_batch h on t.be_share = h.sales_batch_id and t.tagert_type like CONCAT('house' , '%')
38 39
         left JOIN ta_person g on t.be_share = g.person_id and t.tagert_type = 'consultant'
39 40
         where t.person_id = #{personId}
40 41
         <if test="shareType != null and shareType != ''">
41
-            and t.tagert_type = #{shareType}
42
+            and (t.tagert_type = #{shareType} || t.tagert_type like CONCAT(#{shareType} , '%'))
42 43
         </if>
43 44
         <if test="shareTitle != null and shareTitle != ''">
44 45
             and
@@ -49,7 +50,8 @@
49 50
                 d.`name` like CONCAT('%', #{shareTitle} , '%') or
50 51
                 e.building_name like CONCAT('%', #{shareTitle} , '%') or
51 52
                 f.news_name like CONCAT('%', #{shareTitle} , '%') or
52
-                g.`name` like CONCAT('%', #{shareTitle} , '%')
53
+                g.`name` like CONCAT('%', #{shareTitle} , '%') or
54
+                h.sales_batch_name like CONCAT('%', #{shareTitle} , '%')
53 55
             )
54 56
         </if>
55 57
         order by t.create_date desc
@@ -64,7 +66,8 @@
64 66
                 when d.`name` != null || d.name != '' then d.`name`
65 67
                 when e.building_name != null || e.building_name != '' then e.building_name
66 68
                 when f.news_name != null || f.news_name != '' then f.news_name
67
-                when a.`name` != null || a.`name` != '' then a.`name`
69
+                when h.sales_batch_name != null || h.sales_batch_name !='' then h.sales_batch_name
70
+                WHEN y.`name` != NULL || y.`name` != '' THEN y.`name`
68 71
                 else '空'
69 72
                 end as shareTitle,
70 73
                         z.phone as personPhone,
@@ -80,7 +83,7 @@
80 83
                 LEFT JOIN ta_drainage d on t.target_id = d.drainage_id and t.target_type = 'h5_share'
81 84
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
82 85
                 LEFT JOIN ta_news f on t.target_id = f.news_id and t.target_type = 'news_share'
83
-
86
+                left join ta_sales_batch h on t.target_id = h.sales_batch_id and t.target_type = 'house_share'
84 87
         LEFT JOIN ta_person a ON t.share_person = a.person_id
85 88
         LEFT JOIN ta_person y on t.share_person = y.user_id
86 89
         LEFT JOIN ta_person z ON t.person_id = z.person_id
@@ -102,6 +105,7 @@
102 105
             e.building_name like CONCAT('%', #{shareTitle} , '%') or
103 106
             f.news_name like CONCAT('%', #{shareTitle} , '%') or
104 107
             a.`name` like CONCAT('%', #{shareTitle} , '%')
108
+            h.sales_batch_name like like CONCAT('%', #{shareTitle} , '%')
105 109
             )
106 110
         </if>
107 111
         GROUP BY

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

@@ -3,9 +3,12 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaShareMapper">
4 4
 
5 5
     <select id="selectHouseShareList" resultType="com.huiju.estateagents.entity.TaShare">
6
-      select a.avatarurl as photoOravatar, a.nickname, a.name, a.phone, a.person_type, t.create_date From ta_share t
6
+      select a.avatarurl as photoOravatar, a.nickname as nameOrnick, a.name, a.phone, a.person_type, t.tagert_type, t.create_date From ta_share_count t
7 7
       left join ta_person a on t.person_id = a.person_id
8
+      left join ta_sales_batch b on t.be_share = b.sales_batch_id
8 9
       where a.org_id = #{orgId}
10
+      and t.tagert_type in ('housePost','houseApp')
11
+      and b.sales_batch_id = #{saleBatchId}
9 12
       <if test="personType != null and personType != ''">
10 13
           and a.person_Type = #{personType}
11 14
       </if>

+ 31
- 0
src/main/resources/mapper/TaSharePersonFromMapper.xml View File

@@ -23,4 +23,35 @@
23 23
         GROUP BY t.person_id
24 24
         ) t
25 25
     </select>
26
+
27
+    <select id="selectHouseVisitList" resultType="com.huiju.estateagents.entity.TaSharePersonFrom">
28
+        select c.avatarurl as photoOravatar, c.nickname as nameOrnick, c.name, c.phone, c.person_type as sharePersonType, t.create_date, b.scene_type as sceneName
29
+        From ta_share_person_from t
30
+        LEFT JOIN ta_person_from_record a on t.person_id = a.person_id
31
+        left join td_wx_dict b on a.scene_id = b.scene_id
32
+        left join ta_person c on t.person_id = c.person_id
33
+        left join ta_housing_resources d on d.house_id = t.target_id
34
+        where a.org_id = #{orgId}
35
+        and t.target_type = 'house_share'
36
+        and t.target_id = #{saleBatchId}
37
+        <if test="personType != null and personType != ''">
38
+            and c.person_Type = #{personType}
39
+        </if>
40
+        <if test="sceneType != null and sceneType != ''">
41
+            <choose>
42
+                <when test="sceneType == 'share'">
43
+                    and b.scene_type like CONCAT('%', #{sceneType})
44
+                </when>
45
+                <otherwise>
46
+                    and b.scene_type = #{sceneType}
47
+                </otherwise>
48
+            </choose>
49
+        </if>
50
+        <if test="phone != null and phone != ''">
51
+            and c.phone = #{phone}
52
+        </if>
53
+        and t.share_person != t.person_id
54
+        GROUP BY t.target_id,t.target_type,t.person_id,t.share_person
55
+        order by t.create_date desc
56
+    </select>
26 57
 </mapper>