浏览代码

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

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

70
      * @return
70
      * @return
71
      * @author gushaoyong
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
         ResponseBean responseBean = new ResponseBean();
75
         ResponseBean responseBean = new ResponseBean();
76
         Integer orgId = getOrgId(request);
76
         Integer orgId = getOrgId(request);
77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
80
         try {
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
                 taPreselectionRecord.getOrgId() == null) {
84
                 taPreselectionRecord.getOrgId() == null) {
85
                 logger.info("taPreselectionRecordAdd 参数错误");
85
                 logger.info("taPreselectionRecordAdd 参数错误");
86
                 responseBean.addError("参数错误");
86
                 responseBean.addError("参数错误");
175
                                                    @RequestParam("houseId") String houseId) {
175
                                                    @RequestParam("houseId") String houseId) {
176
         ResponseBean responseBean = new ResponseBean();
176
         ResponseBean responseBean = new ResponseBean();
177
         try {
177
         try {
178
-            responseBean.addSuccess(iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId));
178
+            responseBean = iTaPreselectionRecordService.taPreselectionRecordCancel(personId, houseId);
179
         } catch (Exception e) {
179
         } catch (Exception e) {
180
             logger.error("taPreselectionRecordCancel -=- {}", e);
180
             logger.error("taPreselectionRecordCancel -=- {}", e);
181
             responseBean.addError(e.getMessage());
181
             responseBean.addError(e.getMessage());
199
                                                HttpServletRequest request) {
199
                                                HttpServletRequest request) {
200
         ResponseBean responseBean = new ResponseBean();
200
         ResponseBean responseBean = new ResponseBean();
201
         Integer orgId = getOrgId(request);
201
         Integer orgId = getOrgId(request);
202
-
203
         try {
202
         try {
204
             responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, orgId, personId));
203
             responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, orgId, personId));
205
         } catch (Exception e) {
204
         } catch (Exception e) {

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

20
 
20
 
21
 /**
21
 /**
22
  * <p>
22
  * <p>
23
-    * 销售批次表  前端控制器
24
-    * </p>
23
+ * 销售批次表  前端控制器
24
+ * </p>
25
  *
25
  *
26
  * @author jobob
26
  * @author jobob
27
  * @since 2020-02-10
27
  * @since 2020-02-10
38
 
38
 
39
     /**
39
     /**
40
      * 分页查询列表
40
      * 分页查询列表
41
+     *
41
      * @param pageNum
42
      * @param pageNum
42
      * @param pageSize
43
      * @param pageSize
43
      * @return
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
         ResponseBean responseBean = new ResponseBean();
52
         ResponseBean responseBean = new ResponseBean();
52
         try {
53
         try {
53
             //使用分页插件
54
             //使用分页插件
54
-		    IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
55
+            IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
55
 
56
 
56
             IPage<TaSalesBatch> result = iTaSalesBatchService.selectByCondition(pg, salesBatchName, buildingId, status, getOrgId(request));
57
             IPage<TaSalesBatch> result = iTaSalesBatchService.selectByCondition(pg, salesBatchName, buildingId, status, getOrgId(request));
57
             responseBean.addSuccess(result);
58
             responseBean.addSuccess(result);
58
-        }catch (Exception e){
59
+        } catch (Exception e) {
59
             e.printStackTrace();
60
             e.printStackTrace();
60
-            logger.error("taSalesBatchList -=- {}",e.toString());
61
+            logger.error("taSalesBatchList -=- {}", e.toString());
61
             responseBean.addError(e.getMessage());
62
             responseBean.addError(e.getMessage());
62
         }
63
         }
63
         return responseBean;
64
         return responseBean;
65
 
66
 
66
     /**
67
     /**
67
      * 保存对象
68
      * 保存对象
69
+     *
68
      * @param taSalesBatch 实体对象
70
      * @param taSalesBatch 实体对象
69
      * @return
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
         ResponseBean responseBean = new ResponseBean();
75
         ResponseBean responseBean = new ResponseBean();
74
         try {
76
         try {
75
             taSalesBatch.setOrgId(getOrgId(request));
77
             taSalesBatch.setOrgId(getOrgId(request));
76
             taSalesBatch.setCreateDate(LocalDateTime.now());
78
             taSalesBatch.setCreateDate(LocalDateTime.now());
77
             taSalesBatch.setUpdateTime(LocalDateTime.now());
79
             taSalesBatch.setUpdateTime(LocalDateTime.now());
78
-            if (iTaSalesBatchService.save(taSalesBatch)){
80
+            if (iTaSalesBatchService.save(taSalesBatch)) {
79
                 responseBean.addSuccess(taSalesBatch);
81
                 responseBean.addSuccess(taSalesBatch);
80
-            }else {
82
+            } else {
81
                 responseBean.addError("fail");
83
                 responseBean.addError("fail");
82
             }
84
             }
83
-        }catch (Exception e){
85
+        } catch (Exception e) {
84
             e.printStackTrace();
86
             e.printStackTrace();
85
-            logger.error("taSalesBatchAdd -=- {}",e.toString());
87
+            logger.error("taSalesBatchAdd -=- {}", e.toString());
86
             responseBean.addError(e.getMessage());
88
             responseBean.addError(e.getMessage());
87
         }
89
         }
88
         return responseBean;
90
         return responseBean;
108
 
110
 
109
     /**
111
     /**
110
      * 根据id删除对象
112
      * 根据id删除对象
111
-     * @param id  实体ID
113
+     *
114
+     * @param id 实体ID
112
      */
115
      */
113
     @ResponseBody
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
         ResponseBean responseBean = new ResponseBean();
119
         ResponseBean responseBean = new ResponseBean();
117
         try {
120
         try {
118
-            if(iTaSalesBatchService.removeById(id)){
121
+            if (iTaSalesBatchService.removeById(id)) {
119
                 responseBean.addSuccess("success");
122
                 responseBean.addSuccess("success");
120
-            }else {
123
+            } else {
121
                 responseBean.addError("fail");
124
                 responseBean.addError("fail");
122
             }
125
             }
123
-        }catch (Exception e){
126
+        } catch (Exception e) {
124
             e.printStackTrace();
127
             e.printStackTrace();
125
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
128
+            logger.error("taSalesBatchDelete -=- {}", e.toString());
126
             responseBean.addError(e.getMessage());
129
             responseBean.addError(e.getMessage());
127
         }
130
         }
128
         return responseBean;
131
         return responseBean;
130
 
133
 
131
     /**
134
     /**
132
      * 修改对象
135
      * 修改对象
133
-     * @param id  实体ID
136
+     *
137
+     * @param id           实体ID
134
      * @param taSalesBatch 实体对象
138
      * @param taSalesBatch 实体对象
135
      * @return
139
      * @return
136
      */
140
      */
137
-    @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.PUT)
141
+    @RequestMapping(value = "/admin/taSalesBatch/{id}", method = RequestMethod.PUT)
138
     public ResponseBean taSalesBatchUpdate(@PathVariable Integer id,
142
     public ResponseBean taSalesBatchUpdate(@PathVariable Integer id,
139
-                                           @RequestBody TaSalesBatch taSalesBatch){
143
+                                           @RequestBody TaSalesBatch taSalesBatch) {
140
         ResponseBean responseBean = new ResponseBean();
144
         ResponseBean responseBean = new ResponseBean();
141
         try {
145
         try {
142
             taSalesBatch.setSalesBatchId(id);
146
             taSalesBatch.setSalesBatchId(id);
143
-            if (iTaSalesBatchService.updateById(taSalesBatch)){
147
+            if (iTaSalesBatchService.updateById(taSalesBatch)) {
144
                 responseBean.addSuccess(taSalesBatch);
148
                 responseBean.addSuccess(taSalesBatch);
145
-            }else {
149
+            } else {
146
                 responseBean.addError("fail");
150
                 responseBean.addError("fail");
147
             }
151
             }
148
-        }catch (Exception e){
152
+        } catch (Exception e) {
149
             e.printStackTrace();
153
             e.printStackTrace();
150
-            logger.error("taSalesBatchUpdate -=- {}",e.toString());
154
+            logger.error("taSalesBatchUpdate -=- {}", e.toString());
151
             responseBean.addError(e.getMessage());
155
             responseBean.addError(e.getMessage());
152
         }
156
         }
153
         return responseBean;
157
         return responseBean;
155
 
159
 
156
     /**
160
     /**
157
      * 根据id查询对象
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
         ResponseBean responseBean = new ResponseBean();
167
         ResponseBean responseBean = new ResponseBean();
163
         try {
168
         try {
164
             responseBean.addSuccess(iTaSalesBatchService.getById(id));
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
             e.printStackTrace();
189
             e.printStackTrace();
167
-            logger.error("taSalesBatchDelete -=- {}",e.toString());
190
+            logger.error("taSalesBatchGetForMiniApp -=- {}", e.toString());
168
             responseBean.addError(e.getMessage());
191
             responseBean.addError(e.getMessage());
169
         }
192
         }
170
         return responseBean;
193
         return responseBean;

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

52
 
52
 
53
     @TableField(exist = false)
53
     @TableField(exist = false)
54
     private String termName;
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
      * @param houseId  房源ID
42
      * @param houseId  房源ID
43
      * @return
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
                 buildingImgQueryWrapper = new QueryWrapper<>();
130
                 buildingImgQueryWrapper = new QueryWrapper<>();
131
                 buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
131
                 buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
132
                 buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
132
                 buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
133
+                buildingImgQueryWrapper.orderByAsc("order_no");
133
                 taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
134
                 taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
134
                 apartment.setBuildingImgList(taBuildingImgList);
135
                 apartment.setBuildingImgList(taBuildingImgList);
135
                 resultList.add(apartment);
136
                 resultList.add(apartment);
174
             buildingImgQueryWrapper = new QueryWrapper<>();
175
             buildingImgQueryWrapper = new QueryWrapper<>();
175
             buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
176
             buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
176
             buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
177
             buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
178
+            buildingImgQueryWrapper.orderByAsc("order_no");
177
             taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
179
             taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
178
         }
180
         }
179
         if (CollectionUtils.isNotEmpty(taBuildingImgList)) {
181
         if (CollectionUtils.isNotEmpty(taBuildingImgList)) {
378
                 String floorName = row.getCell(3).getStringCellValue().trim();
380
                 String floorName = row.getCell(3).getStringCellValue().trim();
379
                 String roomName = row.getCell(4).getStringCellValue().trim();
381
                 String roomName = row.getCell(4).getStringCellValue().trim();
380
                 BigDecimal price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
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
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
384
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
383
 
385
 
384
                 int currentRow = j + 1;
386
                 int currentRow = j + 1;
412
 
414
 
413
                 QueryWrapper<TaHousingResources> taHousingResourcesQueryWrapper = new QueryWrapper<>();
415
                 QueryWrapper<TaHousingResources> taHousingResourcesQueryWrapper = new QueryWrapper<>();
414
 //                taHousingResourcesQueryWrapper.eq("sales_batch_id",salesBatchId);
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
                 TaHousingResources oldTaHouseingResources = taHousingResourcesMapper.selectOne(taHousingResourcesQueryWrapper);
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
                     return responseBean;
429
                     return responseBean;
428
                 }
430
                 }
429
 
431
 
463
     public ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
465
     public ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
464
         ResponseBean responseBean = new ResponseBean();
466
         ResponseBean responseBean = new ResponseBean();
465
         responseBean = getExcelData(file, salesBatchId, buildingId, orgId);
467
         responseBean = getExcelData(file, salesBatchId, buildingId, orgId);
466
-        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS){
468
+        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS) {
467
             return responseBean;
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
         list.forEach(e -> {
475
         list.forEach(e -> {
474
             e.setOrgId(orgId);
476
             e.setOrgId(orgId);
475
             e.setSalesBatchId(salesBatchId);
477
             e.setSalesBatchId(salesBatchId);

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

77
                     buildingImgQueryWrapper = new QueryWrapper<>();
77
                     buildingImgQueryWrapper = new QueryWrapper<>();
78
                     buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
78
                     buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
79
                     buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
79
                     buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
80
+                    buildingImgQueryWrapper.orderByAsc("order_no");
80
                     taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
81
                     taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
81
                     po.setBuildingImgList(taBuildingImgList);
82
                     po.setBuildingImgList(taBuildingImgList);
82
                 }
83
                 }
97
         // 校验用户是否已经预选房源
98
         // 校验用户是否已经预选房源
98
         TaPreselectionRecord record = taPreselectionRecordMapper
99
         TaPreselectionRecord record = taPreselectionRecordMapper
99
                 .getRecordByPersonIdAndHouseId(taPreselectionRecord.getPersonId(), taPreselectionRecord.getHouseId());
100
                 .getRecordByPersonIdAndHouseId(taPreselectionRecord.getPersonId(), taPreselectionRecord.getHouseId());
100
-        if (record != null) {
101
-            responseBean.addError("您已经预选过该房源");
101
+        if (record != null && 1 == record.getStatus()) {
102
+            responseBean.addError("已预选过此房源,请到选房记录中查看。");
102
             return responseBean;
103
             return responseBean;
103
         }
104
         }
104
 
105
 
115
         }
116
         }
116
 
117
 
117
         // 校验当前房源状态是否为已发布
118
         // 校验当前房源状态是否为已发布
118
-        if (!"1".equals(resourcesPO.getStatus())) {
119
+        if (1 != resourcesPO.getStatus()) {
119
             responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
120
             responseBean.addError("当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。");
120
             return responseBean;
121
             return responseBean;
121
         }
122
         }
143
 
144
 
144
     @Override
145
     @Override
145
     @Transactional
146
     @Transactional
146
-    public Boolean taPreselectionRecordCancel(String personId, String houseId) {
147
+    public ResponseBean taPreselectionRecordCancel(String personId, String houseId) {
147
         logger.info("taPreselectionRecordCancel 接收参数:personId:{},houseId:{}", personId, houseId);
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
         TaPreselectionRecord record = new TaPreselectionRecord();
171
         TaPreselectionRecord record = new TaPreselectionRecord();
151
-        record.setPreselectionRecordId(Integer.parseInt(personId));
172
+        record.setPreselectionRecordId(preselectionRecord.getPreselectionRecordId());
152
         record.setStatus(0);
173
         record.setStatus(0);
153
         record.setUpdateDate(DateUtils.today());
174
         record.setUpdateDate(DateUtils.today());
154
         updateById(record);
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
     @Override
182
     @Override

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

108
             t2.building_area,
108
             t2.building_area,
109
             t3.preselection_start_time,
109
             t3.preselection_start_time,
110
             t3.preselection_end_time,
110
             t3.preselection_end_time,
111
-            t3.`status` saleBatchStatus
111
+            t3.`status` saleBatchStatus,
112
+            t4.building_name buildingName
112
         FROM
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
         WHERE
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
         <if test="type != null and type == '1' ">
120
         <if test="type != null and type == '1' ">
121
             AND t.`status` = 1
121
             AND t.`status` = 1
122
             AND t3.`status` = 1
122
             AND t3.`status` = 1
123
         </if>
123
         </if>
124
-        AND t2.`status` = 1
125
     </select>
124
     </select>
126
 
125
 
127
     <select id="getHouseResourceList" resultType="com.huiju.estateagents.entity.TaHousingResources">
126
     <select id="getHouseResourceList" resultType="com.huiju.estateagents.entity.TaHousingResources">