瀏覽代碼

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

张延森 5 年之前
父節點
當前提交
94175775b4

+ 9
- 11
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java 查看文件

@@ -105,7 +105,7 @@ public class TaHousingResourcesController extends BaseController {
105 105
      */
106 106
     @ResponseBody
107 107
     @RequestMapping(value = "/admin/houseDelete/{id}", method = RequestMethod.DELETE)
108
-    public ResponseBean taHousingResourcesDelete(@PathVariable Integer id,HttpServletRequest request) {
108
+    public ResponseBean taHousingResourcesDelete(@PathVariable Integer id, HttpServletRequest request) {
109 109
         ResponseBean responseBean = new ResponseBean();
110 110
         try {
111 111
             //校验是否有预选记录
@@ -114,8 +114,8 @@ public class TaHousingResourcesController extends BaseController {
114 114
             queryWrapper.eq("org_id", getOrgId(request));
115 115
             queryWrapper.eq("house_id", id);
116 116
             List<TaPreselectionRecord> taPreselectionRecords = taPreselectionRecordService.list(queryWrapper);
117
-            if (taPreselectionRecords.size() > 0){
118
-                return ResponseBean.error("存在预选房源不能删除!",ResponseBean.ERROR_UNAVAILABLE);
117
+            if (taPreselectionRecords.size() > 0) {
118
+                return ResponseBean.error("存在预选房源不能删除!", ResponseBean.ERROR_UNAVAILABLE);
119 119
             }
120 120
             TaHousingResources taHousingResources = new TaHousingResources();
121 121
             taHousingResources.setHouseId(id);
@@ -219,7 +219,6 @@ public class TaHousingResourcesController extends BaseController {
219 219
                                              HttpServletRequest request) {
220 220
         ResponseBean responseBean = new ResponseBean();
221 221
         Integer orgId = getOrgId(request);
222
-
223 222
         try {
224 223
             responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId));
225 224
         } catch (Exception e) {
@@ -279,8 +278,7 @@ public class TaHousingResourcesController extends BaseController {
279 278
      */
280 279
     @RequestMapping(value = "/wx/getHousingDetailById", method = RequestMethod.GET)
281 280
     public ResponseBean getHousingDetailById(@RequestParam(value = "houseId") String houseId,
282
-                                             @RequestParam(value = "personId") String personId,
283
-                                             HttpServletRequest request) {
281
+                                             @RequestParam(value = "personId") String personId) {
284 282
         ResponseBean responseBean = new ResponseBean();
285 283
         try {
286 284
             responseBean.addSuccess(iTaHousingResourcesService.getHousingDetailById(personId, houseId));
@@ -319,7 +317,7 @@ public class TaHousingResourcesController extends BaseController {
319 317
                                     HttpServletRequest request) {
320 318
         ResponseBean responseBean = new ResponseBean();
321 319
         try {
322
-            responseBean = iTaHousingResourcesService.getExcelData(file,salesBatchId,buildingId,getOrgId(request));
320
+            responseBean = iTaHousingResourcesService.getExcelData(file, salesBatchId, buildingId, getOrgId(request));
323 321
         } catch (Exception e) {
324 322
             e.printStackTrace();
325 323
             logger.error("taHousingResourcesUpdate -=- {}", e.toString());
@@ -330,12 +328,12 @@ public class TaHousingResourcesController extends BaseController {
330 328
 
331 329
     @PostMapping(value = "/admin/house/saveExcelValue", consumes = "multipart/*", headers = "content-type=multipart/form-data")
332 330
     public ResponseBean saveExcelValue(@RequestParam("file") MultipartFile file,
333
-                                    @RequestParam("salesBatchId") Integer salesBatchId,
334
-                                    @RequestParam("buildingId") String buildingId,
335
-                                    HttpServletRequest request) {
331
+                                       @RequestParam("salesBatchId") Integer salesBatchId,
332
+                                       @RequestParam("buildingId") String buildingId,
333
+                                       HttpServletRequest request) {
336 334
         ResponseBean responseBean = new ResponseBean();
337 335
         try {
338
-            responseBean = iTaHousingResourcesService.saveExcelValue(file,salesBatchId,buildingId,getOrgId(request));
336
+            responseBean = iTaHousingResourcesService.saveExcelValue(file, salesBatchId, buildingId, getOrgId(request));
339 337
         } catch (Exception e) {
340 338
             e.printStackTrace();
341 339
             logger.error("taHousingResourcesUpdate -=- {}", e.toString());

+ 4
- 5
src/main/java/com/huiju/estateagents/controller/TaPreselectionRecordController.java 查看文件

@@ -70,8 +70,8 @@ public class TaPreselectionRecordController extends BaseController {
70 70
      * @return
71 71
      * @author gushaoyong
72 72
      */
73
-    @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.POST)
74
-    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord,HttpServletRequest request) {
73
+    @RequestMapping(value = "/wx/taPreselectionRecord", method = RequestMethod.POST)
74
+    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord, HttpServletRequest request) {
75 75
         ResponseBean responseBean = new ResponseBean();
76 76
         Integer orgId = getOrgId(request);
77 77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
@@ -80,7 +80,7 @@ public class TaPreselectionRecordController extends BaseController {
80 80
         try {
81 81
 
82 82
             // 校验参数
83
-            if (StringUtils.isBlank(taPreselectionRecord.getHouseId()) && StringUtils.isBlank(taPreselectionRecord.getPersonId()) &&
83
+            if (StringUtils.isBlank(taPreselectionRecord.getHouseId()) || StringUtils.isBlank(taPreselectionRecord.getPersonId()) ||
84 84
                 taPreselectionRecord.getOrgId() == null) {
85 85
                 logger.info("taPreselectionRecordAdd 参数错误");
86 86
                 responseBean.addError("参数错误");
@@ -175,7 +175,7 @@ public class TaPreselectionRecordController extends BaseController {
175 175
                                                    @RequestParam("houseId") String houseId) {
176 176
         ResponseBean responseBean = new ResponseBean();
177 177
         try {
178
-            responseBean.addSuccess(iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId));
178
+            responseBean = iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId);
179 179
         } catch (Exception e) {
180 180
             logger.error("taPreselectionRecordCancel -=- {}", e);
181 181
             responseBean.addError(e.getMessage());
@@ -199,7 +199,6 @@ public class TaPreselectionRecordController extends BaseController {
199 199
                                                HttpServletRequest request) {
200 200
         ResponseBean responseBean = new ResponseBean();
201 201
         Integer orgId = getOrgId(request);
202
-
203 202
         try {
204 203
             responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, orgId, personId));
205 204
         } catch (Exception e) {

+ 59
- 36
src/main/java/com/huiju/estateagents/controller/TaSalesBatchController.java 查看文件

@@ -20,8 +20,8 @@ import java.util.List;
20 20
 
21 21
 /**
22 22
  * <p>
23
-    * 销售批次表  前端控制器
24
-    * </p>
23
+ * 销售批次表  前端控制器
24
+ * </p>
25 25
  *
26 26
  * @author jobob
27 27
  * @since 2020-02-10
@@ -38,26 +38,27 @@ public class TaSalesBatchController extends BaseController {
38 38
 
39 39
     /**
40 40
      * 分页查询列表
41
+     *
41 42
      * @param pageNum
42 43
      * @param pageSize
43 44
      * @return
44 45
      */
45
-    @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.GET)
46
-    public ResponseBean taSalesBatchList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
48
-                                         @RequestParam(value ="salesBatchName", required = false) String salesBatchName,
49
-                                         @RequestParam(value ="buildingId", required = false) String buildingId,
50
-                                         @RequestParam(value = "status", required = false) Integer status, HttpServletRequest request){
46
+    @RequestMapping(value = "/admin/taSalesBatch", method = RequestMethod.GET)
47
+    public ResponseBean taSalesBatchList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
48
+                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
49
+                                         @RequestParam(value = "salesBatchName", required = false) String salesBatchName,
50
+                                         @RequestParam(value = "buildingId", required = false) String buildingId,
51
+                                         @RequestParam(value = "status", required = false) Integer status, HttpServletRequest request) {
51 52
         ResponseBean responseBean = new ResponseBean();
52 53
         try {
53 54
             //使用分页插件
54
-		    IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
55
+            IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
55 56
 
56 57
             IPage<TaSalesBatch> result = iTaSalesBatchService.selectByCondition(pg, salesBatchName, buildingId, status, getOrgId(request));
57 58
             responseBean.addSuccess(result);
58
-        }catch (Exception e){
59
+        } catch (Exception e) {
59 60
             e.printStackTrace();
60
-            logger.error("taSalesBatchList -=- {}",e.toString());
61
+            logger.error("taSalesBatchList -=- {}", e.toString());
61 62
             responseBean.addError(e.getMessage());
62 63
         }
63 64
         return responseBean;
@@ -65,24 +66,25 @@ public class TaSalesBatchController extends BaseController {
65 66
 
66 67
     /**
67 68
      * 保存对象
69
+     *
68 70
      * @param taSalesBatch 实体对象
69 71
      * @return
70 72
      */
71
-    @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.POST)
72
-    public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch, HttpServletRequest request){
73
+    @RequestMapping(value = "/admin/taSalesBatch", method = RequestMethod.POST)
74
+    public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch, HttpServletRequest request) {
73 75
         ResponseBean responseBean = new ResponseBean();
74 76
         try {
75 77
             taSalesBatch.setOrgId(getOrgId(request));
76 78
             taSalesBatch.setCreateDate(LocalDateTime.now());
77 79
             taSalesBatch.setUpdateTime(LocalDateTime.now());
78
-            if (iTaSalesBatchService.save(taSalesBatch)){
80
+            if (iTaSalesBatchService.save(taSalesBatch)) {
79 81
                 responseBean.addSuccess(taSalesBatch);
80
-            }else {
82
+            } else {
81 83
                 responseBean.addError("fail");
82 84
             }
83
-        }catch (Exception e){
85
+        } catch (Exception e) {
84 86
             e.printStackTrace();
85
-            logger.error("taSalesBatchAdd -=- {}",e.toString());
87
+            logger.error("taSalesBatchAdd -=- {}", e.toString());
86 88
             responseBean.addError(e.getMessage());
87 89
         }
88 90
         return responseBean;
@@ -108,21 +110,22 @@ public class TaSalesBatchController extends BaseController {
108 110
 
109 111
     /**
110 112
      * 根据id删除对象
111
-     * @param id  实体ID
113
+     *
114
+     * @param id 实体ID
112 115
      */
113 116
     @ResponseBody
114
-    @RequestMapping(value="/admin/taSalesBatch/{id}", method= RequestMethod.DELETE)
115
-    public ResponseBean taSalesBatchDelete(@PathVariable Integer id){
117
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.DELETE)
118
+    public ResponseBean taSalesBatchDelete(@PathVariable Integer id) {
116 119
         ResponseBean responseBean = new ResponseBean();
117 120
         try {
118
-            if(iTaSalesBatchService.removeById(id)){
121
+            if (iTaSalesBatchService.removeById(id)) {
119 122
                 responseBean.addSuccess("success");
120
-            }else {
123
+            } else {
121 124
                 responseBean.addError("fail");
122 125
             }
123
-        }catch (Exception e){
126
+        } catch (Exception e) {
124 127
             e.printStackTrace();
125
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
128
+            logger.error("taSalesBatchDelete -=- {}", e.toString());
126 129
             responseBean.addError(e.getMessage());
127 130
         }
128 131
         return responseBean;
@@ -130,24 +133,25 @@ public class TaSalesBatchController extends BaseController {
130 133
 
131 134
     /**
132 135
      * 修改对象
133
-     * @param id  实体ID
136
+     *
137
+     * @param id           实体ID
134 138
      * @param taSalesBatch 实体对象
135 139
      * @return
136 140
      */
137
-    @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.PUT)
141
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.PUT)
138 142
     public ResponseBean taSalesBatchUpdate(@PathVariable Integer id,
139
-                                           @RequestBody TaSalesBatch taSalesBatch){
143
+                                           @RequestBody TaSalesBatch taSalesBatch) {
140 144
         ResponseBean responseBean = new ResponseBean();
141 145
         try {
142 146
             taSalesBatch.setSalesBatchId(id);
143
-            if (iTaSalesBatchService.updateById(taSalesBatch)){
147
+            if (iTaSalesBatchService.updateById(taSalesBatch)) {
144 148
                 responseBean.addSuccess(taSalesBatch);
145
-            }else {
149
+            } else {
146 150
                 responseBean.addError("fail");
147 151
             }
148
-        }catch (Exception e){
152
+        } catch (Exception e) {
149 153
             e.printStackTrace();
150
-            logger.error("taSalesBatchUpdate -=- {}",e.toString());
154
+            logger.error("taSalesBatchUpdate -=- {}", e.toString());
151 155
             responseBean.addError(e.getMessage());
152 156
         }
153 157
         return responseBean;
@@ -155,16 +159,35 @@ public class TaSalesBatchController extends BaseController {
155 159
 
156 160
     /**
157 161
      * 根据id查询对象
158
-     * @param id  实体ID
162
+     *
163
+     * @param id 实体ID
159 164
      */
160
-    @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.GET)
161
-    public ResponseBean taSalesBatchGet(@PathVariable Integer id){
165
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.GET)
166
+    public ResponseBean taSalesBatchGet(@PathVariable Integer id) {
162 167
         ResponseBean responseBean = new ResponseBean();
163 168
         try {
164 169
             responseBean.addSuccess(iTaSalesBatchService.getById(id));
165
-        }catch (Exception e){
170
+        } catch (Exception e) {
171
+            e.printStackTrace();
172
+            logger.error("taSalesBatchDelete -=- {}", e.toString());
173
+            responseBean.addError(e.getMessage());
174
+        }
175
+        return responseBean;
176
+    }
177
+
178
+    /**
179
+     * 根据id查询对象-小程序端
180
+     *
181
+     * @param id 实体ID
182
+     */
183
+    @RequestMapping(value = "/wx/taSalesBatch/{id}", method = RequestMethod.GET)
184
+    public ResponseBean taSalesBatchGetForMiniApp(@PathVariable Integer id) {
185
+        ResponseBean responseBean = new ResponseBean();
186
+        try {
187
+            responseBean.addSuccess(iTaSalesBatchService.getById(id));
188
+        } catch (Exception e) {
166 189
             e.printStackTrace();
167
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
190
+            logger.error("taSalesBatchGetForMiniApp -=- {}", e.toString());
168 191
             responseBean.addError(e.getMessage());
169 192
         }
170 193
         return responseBean;

+ 5
- 0
src/main/java/com/huiju/estateagents/po/TaHousingResourcesPO.java 查看文件

@@ -52,4 +52,9 @@ public class TaHousingResourcesPO extends TaHousingResources {
52 52
 
53 53
     @TableField(exist = false)
54 54
     private String termName;
55
+
56
+    /**
57
+     * 楼盘名称
58
+     */
59
+    private String buildingName;
55 60
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaPreselectionRecordService.java 查看文件

@@ -42,7 +42,7 @@ public interface ITaPreselectionRecordService extends IService<TaPreselectionRec
42 42
      * @param houseId  房源ID
43 43
      * @return
44 44
      */
45
-    Boolean taPreselectionRecordCancel(String personId, String houseId);
45
+    ResponseBean taPreselectionRecordCancel(String personId, String houseId);
46 46
 
47 47
     /**
48 48
      * 校验用户是否预选

+ 17
- 15
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java 查看文件

@@ -130,6 +130,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
130 130
                 buildingImgQueryWrapper = new QueryWrapper<>();
131 131
                 buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
132 132
                 buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
133
+                buildingImgQueryWrapper.orderByAsc("order_no");
133 134
                 taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
134 135
                 apartment.setBuildingImgList(taBuildingImgList);
135 136
                 resultList.add(apartment);
@@ -174,6 +175,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
174 175
             buildingImgQueryWrapper = new QueryWrapper<>();
175 176
             buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
176 177
             buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
178
+            buildingImgQueryWrapper.orderByAsc("order_no");
177 179
             taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
178 180
         }
179 181
         if (CollectionUtils.isNotEmpty(taBuildingImgList)) {
@@ -378,7 +380,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
378 380
                 String floorName = row.getCell(3).getStringCellValue().trim();
379 381
                 String roomName = row.getCell(4).getStringCellValue().trim();
380 382
                 BigDecimal price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
381
-                Integer heat = Integer.valueOf(String.valueOf(row.getCell(6).getNumericCellValue()).substring(0,1));
383
+                Integer heat = Integer.valueOf(String.valueOf(row.getCell(6).getNumericCellValue()).substring(0, 1));
382 384
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
383 385
 
384 386
                 int currentRow = j + 1;
@@ -412,18 +414,18 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
412 414
 
413 415
                 QueryWrapper<TaHousingResources> taHousingResourcesQueryWrapper = new QueryWrapper<>();
414 416
 //                taHousingResourcesQueryWrapper.eq("sales_batch_id",salesBatchId);
415
-                taHousingResourcesQueryWrapper.eq("building_id",buildingId);
416
-                taHousingResourcesQueryWrapper.eq("org_id",orgId);
417
-                taHousingResourcesQueryWrapper.gt("status",CommConstant.STATUS_DELETE);
418
-                taHousingResourcesQueryWrapper.eq("term_name",termName);
419
-                taHousingResourcesQueryWrapper.eq("block_name",blockName);
420
-                taHousingResourcesQueryWrapper.eq("unit_name",unitName);
421
-                taHousingResourcesQueryWrapper.eq("floor_name",floorName);
422
-                taHousingResourcesQueryWrapper.eq("room_name",roomName);
417
+                taHousingResourcesQueryWrapper.eq("building_id", buildingId);
418
+                taHousingResourcesQueryWrapper.eq("org_id", orgId);
419
+                taHousingResourcesQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
420
+                taHousingResourcesQueryWrapper.eq("term_name", termName);
421
+                taHousingResourcesQueryWrapper.eq("block_name", blockName);
422
+                taHousingResourcesQueryWrapper.eq("unit_name", unitName);
423
+                taHousingResourcesQueryWrapper.eq("floor_name", floorName);
424
+                taHousingResourcesQueryWrapper.eq("room_name", roomName);
423 425
                 TaHousingResources oldTaHouseingResources = taHousingResourcesMapper.selectOne(taHousingResourcesQueryWrapper);
424
-                if (null != oldTaHouseingResources){
425
-                    logger.info("数据库存在重复房源:{}",houseInfo);
426
-                    responseBean.addError("第"+ currentRow +"行与系统已录入房源"+ oldTaHouseingResources.getHouseId() +"重复");
426
+                if (null != oldTaHouseingResources) {
427
+                    logger.info("数据库存在重复房源:{}", houseInfo);
428
+                    responseBean.addError("第" + currentRow + "行与系统已录入房源" + oldTaHouseingResources.getHouseId() + "重复");
427 429
                     return responseBean;
428 430
                 }
429 431
 
@@ -463,13 +465,13 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
463 465
     public ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
464 466
         ResponseBean responseBean = new ResponseBean();
465 467
         responseBean = getExcelData(file, salesBatchId, buildingId, orgId);
466
-        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS){
468
+        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS) {
467 469
             return responseBean;
468 470
         }
469 471
 
470 472
         //获取校验成功的数据
471
-        Map<String,Object> data = (Map<String,Object>)responseBean.getData();
472
-        List<TaHousingResources> list =  (List<TaHousingResources>)data.get("list");
473
+        Map<String, Object> data = (Map<String, Object>) responseBean.getData();
474
+        List<TaHousingResources> list = (List<TaHousingResources>) data.get("list");
473 475
         list.forEach(e -> {
474 476
             e.setOrgId(orgId);
475 477
             e.setSalesBatchId(salesBatchId);

+ 28
- 6
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java 查看文件

@@ -77,6 +77,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
77 77
                     buildingImgQueryWrapper = new QueryWrapper<>();
78 78
                     buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
79 79
                     buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
80
+                    buildingImgQueryWrapper.orderByAsc("order_no");
80 81
                     taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
81 82
                     po.setBuildingImgList(taBuildingImgList);
82 83
                 }
@@ -97,8 +98,8 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
97 98
         // 校验用户是否已经预选房源
98 99
         TaPreselectionRecord record = taPreselectionRecordMapper
99 100
                 .getRecordByPersonIdAndHouseId(taPreselectionRecord.getPersonId(), taPreselectionRecord.getHouseId());
100
-        if (record != null) {
101
-            responseBean.addError("您已经预选过该房源");
101
+        if (record != null && 1 == record.getStatus()) {
102
+            responseBean.addError("已预选过此房源,请到选房记录中查看。");
102 103
             return responseBean;
103 104
         }
104 105
 
@@ -115,7 +116,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
115 116
         }
116 117
 
117 118
         // 校验当前房源状态是否为已发布
118
-        if (!"1".equals(resourcesPO.getStatus())) {
119
+        if (1 != resourcesPO.getStatus()) {
119 120
             responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
120 121
             return responseBean;
121 122
         }
@@ -143,18 +144,39 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
143 144
 
144 145
     @Override
145 146
     @Transactional
146
-    public Boolean taPreselectionRecordCancel(String personId, String houseId) {
147
+    public ResponseBean taPreselectionRecordCancel(String personId, String houseId) {
147 148
         logger.info("taPreselectionRecordCancel 接收参数:personId:{},houseId:{}", personId, houseId);
148 149
 
150
+        ResponseBean responseBean = new ResponseBean<>();
151
+        // 校验是否已经取消
152
+        TaPreselectionRecord preselectionRecord = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
153
+        if (preselectionRecord != null && 1 != preselectionRecord.getStatus()) {
154
+            responseBean.addError("未预选过此房源,或已取消预选此房源");
155
+            return responseBean;
156
+        }
157
+
158
+        TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(houseId, "0");
159
+        if (resourcesPO == null || 1 != resourcesPO.getStatus()) {
160
+            responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
161
+            return responseBean;
162
+        }
163
+
164
+        // 校验当前批次状态是否为已发布
165
+        if (resourcesPO.getSaleBatchStatus() != 1) {
166
+            responseBean.addError("当前销售批次已临时取消发布,请稍后再试或联系置业顾问了解详情。");
167
+            return responseBean;
168
+        }
169
+
149 170
         // 更新预选记录
150 171
         TaPreselectionRecord record = new TaPreselectionRecord();
151
-        record.setPreselectionRecordId(Integer.parseInt(personId));
172
+        record.setPreselectionRecordId(preselectionRecord.getPreselectionRecordId());
152 173
         record.setStatus(0);
153 174
         record.setUpdateDate(DateUtils.today());
154 175
         updateById(record);
155 176
 
156 177
         // 更新房源表热度
157
-        return taHousingResourcesMapper.updateForSubtractHeat(houseId);
178
+        responseBean.addSuccess(taHousingResourcesMapper.updateForSubtractHeat(houseId));
179
+        return responseBean;
158 180
     }
159 181
 
160 182
     @Override

+ 7
- 8
src/main/resources/mapper/TaHousingResourcesMapper.xml 查看文件

@@ -108,20 +108,19 @@
108 108
             t2.building_area,
109 109
             t3.preselection_start_time,
110 110
             t3.preselection_end_time,
111
-            t3.`status` saleBatchStatus
111
+            t3.`status` saleBatchStatus,
112
+            t4.building_name buildingName
112 113
         FROM
113
-            ta_housing_resources t,
114
-            ta_building_apartment t2,
115
-            ta_sales_batch t3
114
+            ta_housing_resources t
115
+            LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
116
+            LEFT JOIN ta_sales_batch t3 ON t.sales_batch_id = t3.sales_batch_id
117
+            LEFT JOIN ta_building t4 ON t.building_id = t4.building_id
116 118
         WHERE
117
-        t.house_id = #{houseId}
118
-        AND t.apartment_id = t2.apartment_id
119
-        AND t.sales_batch_id = t3.sales_batch_id
119
+            t.house_id = #{houseId}
120 120
         <if test="type != null and type == '1' ">
121 121
             AND t.`status` = 1
122 122
             AND t3.`status` = 1
123 123
         </if>
124
-        AND t2.`status` = 1
125 124
     </select>
126 125
 
127 126
     <select id="getHouseResourceList" resultType="com.huiju.estateagents.entity.TaHousingResources">