瀏覽代碼

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

weichaochao 5 年之前
父節點
當前提交
a9f021b194

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

79
      * @return
79
      * @return
80
      */
80
      */
81
     @RequestMapping(value = "/admin/taHousingResources", method = RequestMethod.POST)
81
     @RequestMapping(value = "/admin/taHousingResources", method = RequestMethod.POST)
82
-    public ResponseBean taHousingResourcesAdd(@RequestBody TaHousingResources taHousingResources,HttpServletRequest request) {
82
+    public ResponseBean taHousingResourcesAdd(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
83
         ResponseBean responseBean = new ResponseBean();
83
         ResponseBean responseBean = new ResponseBean();
84
         try {
84
         try {
85
             taHousingResources.setOrgId(getOrgId(request));
85
             taHousingResources.setOrgId(getOrgId(request));
133
      */
133
      */
134
     @RequestMapping(value = "/admin/taHousingResources/{id}", method = RequestMethod.PUT)
134
     @RequestMapping(value = "/admin/taHousingResources/{id}", method = RequestMethod.PUT)
135
     public ResponseBean taHousingResourcesUpdate(@PathVariable Integer id,
135
     public ResponseBean taHousingResourcesUpdate(@PathVariable Integer id,
136
-                                                 @RequestBody TaHousingResources taHousingResources,HttpServletRequest request) {
136
+                                                 @RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
137
         ResponseBean responseBean = new ResponseBean();
137
         ResponseBean responseBean = new ResponseBean();
138
         try {
138
         try {
139
             taHousingResources.setHouseId(id);
139
             taHousingResources.setHouseId(id);
152
      * 修改户型
152
      * 修改户型
153
      */
153
      */
154
     @RequestMapping(value = "/admin/house/changeApartment", method = RequestMethod.PUT)
154
     @RequestMapping(value = "/admin/house/changeApartment", method = RequestMethod.PUT)
155
-    public ResponseBean houseApartment(@RequestBody TaHousingResources taHousingResources,HttpServletRequest request) {
155
+    public ResponseBean houseApartment(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
156
         ResponseBean responseBean = new ResponseBean();
156
         ResponseBean responseBean = new ResponseBean();
157
         try {
157
         try {
158
             List<TaHousingResources> houseIdList = taHousingResources.getHouseIdList();
158
             List<TaHousingResources> houseIdList = taHousingResources.getHouseIdList();
190
     /**
190
     /**
191
      * 获取房源列表
191
      * 获取房源列表
192
      *
192
      *
193
-     * @param pageNum      页码
194
-     * @param pageSize     分页大小
195
      * @param salesBatchId 销售批次ID
193
      * @param salesBatchId 销售批次ID
194
+     * @param startPrice   房源起始价格
195
+     * @param endPrice     房源结束价格
196
+     * @param apartmentId  户型ID
197
+     * @param request
196
      * @return
198
      * @return
197
      * @author gushaoyong
199
      * @author gushaoyong
198
      */
200
      */
199
     @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.GET)
201
     @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.GET)
200
-    public ResponseBean listHousingResources(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
201
-                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
202
-                                             @RequestParam(value = "salesBatchId") String salesBatchId,
203
-                                             String startPrice, String endPrice, String apartmentId) {
202
+    public ResponseBean listHousingResources(@RequestParam(value = "salesBatchId") String salesBatchId,
203
+                                             String startPrice, String endPrice, String apartmentId,
204
+                                             HttpServletRequest request) {
204
         ResponseBean responseBean = new ResponseBean();
205
         ResponseBean responseBean = new ResponseBean();
206
+        Integer orgId = getOrgId(request);
207
+
205
         try {
208
         try {
206
-            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(pageNum, pageSize, salesBatchId, startPrice, endPrice, apartmentId));
209
+            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId));
207
         } catch (Exception e) {
210
         } catch (Exception e) {
208
             logger.error("listHousingResources -=- {}", e);
211
             logger.error("listHousingResources -=- {}", e);
209
             responseBean.addError(e.getMessage());
212
             responseBean.addError(e.getMessage());
211
         return responseBean;
214
         return responseBean;
212
     }
215
     }
213
 
216
 
217
+    /**
218
+     * 获取房源列表-后台管理端
219
+     *
220
+     * @param salesBatchId 销售批次ID
221
+     * @return
222
+     * @author gushaoyong
223
+     */
224
+    @RequestMapping(value = "/admin/listHousingResources", method = RequestMethod.GET)
225
+    public ResponseBean listHousingResourcesFormCms(@RequestParam(value = "salesBatchId") String salesBatchId,
226
+                                                    HttpServletRequest request) {
227
+        ResponseBean responseBean = new ResponseBean();
228
+        Integer orgId = getOrgId(request);
229
+
230
+        try {
231
+            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, "", "", ""));
232
+        } catch (Exception e) {
233
+            logger.error("listHousingResourcesFormCms -=- {}", e);
234
+            responseBean.addError(e.getMessage());
235
+        }
236
+        return responseBean;
237
+    }
238
+
214
     /**
239
     /**
215
      * 获取某销售批次下所有房源户型
240
      * 获取某销售批次下所有房源户型
216
      *
241
      *
239
      */
264
      */
240
     @RequestMapping(value = "/wx/getHousingDetailById", method = RequestMethod.GET)
265
     @RequestMapping(value = "/wx/getHousingDetailById", method = RequestMethod.GET)
241
     public ResponseBean getHousingDetailById(@RequestParam(value = "houseId") String houseId,
266
     public ResponseBean getHousingDetailById(@RequestParam(value = "houseId") String houseId,
242
-                                             @RequestParam(value = "personId") String personId) {
267
+                                             @RequestParam(value = "personId") String personId,
268
+                                             HttpServletRequest request) {
243
         ResponseBean responseBean = new ResponseBean();
269
         ResponseBean responseBean = new ResponseBean();
244
         try {
270
         try {
245
             responseBean.addSuccess(iTaHousingResourcesService.getHousingDetailById(personId, houseId));
271
             responseBean.addSuccess(iTaHousingResourcesService.getHousingDetailById(personId, houseId));
257
      * @return
283
      * @return
258
      */
284
      */
259
     @RequestMapping(value = "/admin/house/checked", method = RequestMethod.PUT)
285
     @RequestMapping(value = "/admin/house/checked", method = RequestMethod.PUT)
260
-    public ResponseBean houseChecked(@RequestBody TaHousingResources taHousingResources,HttpServletRequest request) {
286
+    public ResponseBean houseChecked(@RequestBody TaHousingResources taHousingResources, HttpServletRequest request) {
261
         ResponseBean responseBean = new ResponseBean();
287
         ResponseBean responseBean = new ResponseBean();
262
         try {
288
         try {
263
             taHousingResources.setOrgId(getOrgId(request));
289
             taHousingResources.setOrgId(getOrgId(request));
272
     }
298
     }
273
 
299
 
274
     @PostMapping(value = "/admin/house/uploadExcel")
300
     @PostMapping(value = "/admin/house/uploadExcel")
275
-    public ResponseBean uploadExcel(@RequestParam("file") MultipartFile file) {
301
+    public ResponseBean uploadExcel(@RequestParam("file") MultipartFile file,
302
+                                    @RequestParam("salesBatchId") Integer salesBatchId,
303
+                                    @RequestParam("buildingId") String buildingId,
304
+                                    HttpServletRequest request) {
276
         ResponseBean responseBean = new ResponseBean();
305
         ResponseBean responseBean = new ResponseBean();
277
-        responseBean = iTaHousingResourcesService.getExcelData(file);
306
+        try {
307
+            responseBean = iTaHousingResourcesService.getExcelData(file,salesBatchId,buildingId,getOrgId(request));
308
+        } catch (Exception e) {
309
+            e.printStackTrace();
310
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
311
+            responseBean.addError("请检查文件");
312
+        }
313
+        return responseBean;
314
+    }
315
+
316
+    @PostMapping(value = "/admin/house/saveExcelValue", consumes = "multipart/*", headers = "content-type=multipart/form-data")
317
+    public ResponseBean saveExcelValue(@RequestParam("file") MultipartFile file,
318
+                                    @RequestParam("salesBatchId") Integer salesBatchId,
319
+                                    @RequestParam("buildingId") String buildingId,
320
+                                    HttpServletRequest request) {
321
+        ResponseBean responseBean = new ResponseBean();
322
+        try {
323
+            responseBean = iTaHousingResourcesService.saveExcelValue(file,salesBatchId,buildingId,getOrgId(request));
324
+        } catch (Exception e) {
325
+            e.printStackTrace();
326
+            logger.error("taHousingResourcesUpdate -=- {}", e.toString());
327
+            responseBean.addError("请检查文件");
328
+        }
278
         return responseBean;
329
         return responseBean;
279
     }
330
     }
280
 }
331
 }

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

71
      * @author gushaoyong
71
      * @author gushaoyong
72
      */
72
      */
73
     @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.POST)
73
     @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.POST)
74
-    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord) {
74
+    public ResponseBean taPreselectionRecordAdd(@RequestBody TaPreselectionRecord taPreselectionRecord,HttpServletRequest request) {
75
         ResponseBean responseBean = new ResponseBean();
75
         ResponseBean responseBean = new ResponseBean();
76
-
76
+        Integer orgId = getOrgId(request);
77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
77
         logger.info("taPreselectionRecordAdd 接收参数,taPreselectionRecord:{}", JSONObject.toJSONString(taPreselectionRecord));
78
 
78
 
79
+        taPreselectionRecord.setOrgId(orgId);
79
         try {
80
         try {
80
 
81
 
81
             // 校验参数
82
             // 校验参数
194
     @RequestMapping(value = "/wx/listPreselectionRecord", method = RequestMethod.GET)
195
     @RequestMapping(value = "/wx/listPreselectionRecord", method = RequestMethod.GET)
195
     public ResponseBean listPreselectionRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
196
     public ResponseBean listPreselectionRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
196
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
197
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
197
-                                               @RequestParam("personId") String personId) {
198
+                                               @RequestParam("personId") String personId,
199
+                                               HttpServletRequest request) {
198
         ResponseBean responseBean = new ResponseBean();
200
         ResponseBean responseBean = new ResponseBean();
199
-        try {
200
-            responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, personId));
201
-        } catch (Exception e) {
202
-            logger.error("listPreselectionRecord -=- {}", e);
203
-            responseBean.addError(e.getMessage());
204
-        }
205
-        return responseBean;
206
-    }
201
+        Integer orgId = getOrgId(request);
207
 
202
 
208
-    /**
209
-     * 校验用户是否已经预选该房源
210
-     *
211
-     * @param personId 用户ID
212
-     * @param houseId  房源ID
213
-     * @return
214
-     * @author gushaoyong
215
-     */
216
-    @RequestMapping(value = "/wx/checkPreselect", method = RequestMethod.POST)
217
-    public ResponseBean checkPreselect(@RequestParam("personId") String personId,
218
-                                       @RequestParam("houseId") String houseId) {
219
-        ResponseBean responseBean = new ResponseBean();
220
         try {
203
         try {
221
-            responseBean.addSuccess(iTaPreselectionRecordService.checkPreselect(personId, houseId));
204
+            responseBean.addSuccess(iTaPreselectionRecordService.listPreselectionRecord(pageNum, pageSize, orgId, personId));
222
         } catch (Exception e) {
205
         } catch (Exception e) {
223
-            logger.error("checkPreselect -=- {}", e);
206
+            logger.error("listPreselectionRecord -=- {}", e);
224
             responseBean.addError(e.getMessage());
207
             responseBean.addError(e.getMessage());
225
         }
208
         }
226
         return responseBean;
209
         return responseBean;
227
     }
210
     }
228
 
211
 
229
     @RequestMapping(value = "/admin/taPreselectRecord", method = RequestMethod.GET)
212
     @RequestMapping(value = "/admin/taPreselectRecord", method = RequestMethod.GET)
230
-    public ResponseBean selectPreSelectRecordList(@RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
231
-                                                  @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
232
-                                                  @RequestParam(value = "salesBatchId")String salesBatchId,
233
-                                                  @RequestParam(value = "houseId", required = false)Integer houseId,
213
+    public ResponseBean selectPreSelectRecordList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
214
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
215
+                                                  @RequestParam(value = "salesBatchId") String salesBatchId,
216
+                                                  @RequestParam(value = "houseId", required = false) Integer houseId,
234
                                                   @RequestParam(value = "phone", required = false) String phone,
217
                                                   @RequestParam(value = "phone", required = false) String phone,
235
                                                   @RequestParam(value = "apartmentId", required = false) String apartmentId,
218
                                                   @RequestParam(value = "apartmentId", required = false) String apartmentId,
236
                                                   @RequestParam(value = "status", required = false) Integer status,
219
                                                   @RequestParam(value = "status", required = false) Integer status,
237
-                                                  HttpServletRequest request){
220
+                                                  HttpServletRequest request) {
238
         ResponseBean responseBean = new ResponseBean();
221
         ResponseBean responseBean = new ResponseBean();
239
         try {
222
         try {
240
             responseBean = iTaPreselectionRecordService.selectPreSelectRecordList(pageNum, pageSize, salesBatchId, houseId, getOrgId(request), phone, apartmentId, status);
223
             responseBean = iTaPreselectionRecordService.selectPreSelectRecordList(pageNum, pageSize, salesBatchId, houseId, getOrgId(request), phone, apartmentId, status);

+ 1
- 2
src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java 查看文件

26
     /**
26
     /**
27
      * 分页获取房源列表
27
      * 分页获取房源列表
28
      *
28
      *
29
-     * @param iPage
30
      * @param salesBatchId
29
      * @param salesBatchId
31
      * @param startPrice
30
      * @param startPrice
32
      * @param endPrice
31
      * @param endPrice
33
      * @param apartmentId
32
      * @param apartmentId
34
      * @return
33
      * @return
35
      */
34
      */
36
-    IPage<TaHousingResourcesPO> listHousingResources(IPage<TaHousingResourcesPO> iPage,
35
+    List<TaHousingResourcesPO> listHousingResources(@Param("orgId") Integer orgId,
37
                                                      @Param("salesBatchId") String salesBatchId,
36
                                                      @Param("salesBatchId") String salesBatchId,
38
                                                      @Param("startPrice") String startPrice,
37
                                                      @Param("startPrice") String startPrice,
39
                                                      @Param("endPrice") String endPrice,
38
                                                      @Param("endPrice") String endPrice,

+ 3
- 1
src/main/java/com/huiju/estateagents/mapper/TaPreselectionRecordMapper.java 查看文件

30
      * @param personId
30
      * @param personId
31
      * @return
31
      * @return
32
      */
32
      */
33
-    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);
34
 
36
 
35
     /**
37
     /**
36
      * 根据房源ID和用户ID获取预选记录
38
      * 根据房源ID和用户ID获取预选记录

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

19
 @Accessors(chain = true)
19
 @Accessors(chain = true)
20
 public class TaHousingResourcesPO extends TaHousingResources {
20
 public class TaHousingResourcesPO extends TaHousingResources {
21
 
21
 
22
-    /**
23
-     * 户型名称
24
-     */
25
-    private String apartmentName;
26
-
27
     private Double insideArea;
22
     private Double insideArea;
28
 
23
 
29
     private Double buildingArea;
24
     private Double buildingArea;
54
      */
49
      */
55
     @TableField(exist = false)
50
     @TableField(exist = false)
56
     private List<TaBuildingImg> buildingImgList;
51
     private List<TaBuildingImg> buildingImgList;
52
+
53
+    @TableField(exist = false)
54
+    private String termName;
57
 }
55
 }

+ 23
- 7
src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java 查看文件

22
 
22
 
23
     /* 分页获取房源列表
23
     /* 分页获取房源列表
24
      *
24
      *
25
-     * @param pageNum      页码
26
-     * @param pageSize     分页大小
27
      * @param salesBatchId 销售批次ID
25
      * @param salesBatchId 销售批次ID
28
      * @param startPrice
26
      * @param startPrice
29
      * @param endPrice
27
      * @param endPrice
30
      * @param apartmentId
28
      * @param apartmentId
31
      * @return
29
      * @return
32
      */
30
      */
33
-    IPage<TaHousingResourcesPO> listHousingResources(Integer pageNum, Integer pageSize, String salesBatchId, String startPrice, String endPrice, String apartmentId);
31
+    List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId);
34
 
32
 
35
     /**
33
     /**
36
      * 获取某销售批次下所有房源户型
34
      * 获取某销售批次下所有房源户型
43
     /**
41
     /**
44
      * 根据房源ID获取房源详情
42
      * 根据房源ID获取房源详情
45
      *
43
      *
46
-     * @param personId
47
-     * @param houseId
44
+     * @param personId 用户ID
45
+     * @param houseId  房源ID
48
      * @return
46
      * @return
49
      */
47
      */
50
-    TaHousingResourcesPO getHousingDetailById(String personId,String houseId);
48
+    TaHousingResourcesPO getHousingDetailById(String personId, String houseId);
51
 
49
 
52
     /**
50
     /**
53
      * 校验楼栋信息存不存在
51
      * 校验楼栋信息存不存在
52
+     *
54
      * @param taHousingResources
53
      * @param taHousingResources
55
      * @return
54
      * @return
56
      */
55
      */
58
 
57
 
59
     /**
58
     /**
60
      * 添加楼栋信息
59
      * 添加楼栋信息
60
+     *
61
      * @param taHousingResources
61
      * @param taHousingResources
62
      * @return
62
      * @return
63
      */
63
      */
65
 
65
 
66
     /**
66
     /**
67
      * 分页获取房源信息
67
      * 分页获取房源信息
68
+     *
68
      * @param salesBatchId
69
      * @param salesBatchId
69
      * @param buildingId
70
      * @param buildingId
70
      * @param pageNumber
71
      * @param pageNumber
84
 
85
 
85
     /**
86
     /**
86
      * 更新房源信息
87
      * 更新房源信息
88
+     *
87
      * @param taHousingResources
89
      * @param taHousingResources
88
      * @return
90
      * @return
89
      */
91
      */
91
 
93
 
92
     /**
94
     /**
93
      * 获取表格中的数据
95
      * 获取表格中的数据
96
+     *
94
      * @param file
97
      * @param file
98
+     * @param salesBatchId
99
+     * @param buildingId
100
+     * @param orgId
101
+     * @return
102
+     */
103
+    ResponseBean getExcelData(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);
104
+
105
+    /**
106
+     * 保存文件
107
+     * @param file
108
+     * @param salesBatchId
109
+     * @param buildingId
110
+     * @param orgId
95
      * @return
111
      * @return
96
      */
112
      */
97
-    ResponseBean getExcelData(MultipartFile file);
113
+    ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);
98
 }
114
 }

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

21
      *
21
      *
22
      * @param pageNum
22
      * @param pageNum
23
      * @param pageSize
23
      * @param pageSize
24
+     * @param orgId
24
      * @param personId
25
      * @param personId
25
      * @return
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
      * 添加预选记录预选

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

25
 import org.slf4j.LoggerFactory;
25
 import org.slf4j.LoggerFactory;
26
 import org.springframework.beans.factory.annotation.Autowired;
26
 import org.springframework.beans.factory.annotation.Autowired;
27
 import org.springframework.stereotype.Service;
27
 import org.springframework.stereotype.Service;
28
+import org.springframework.transaction.annotation.Transactional;
28
 import org.springframework.web.multipart.MultipartFile;
29
 import org.springframework.web.multipart.MultipartFile;
29
 
30
 
31
+import java.math.BigDecimal;
30
 import java.time.LocalDateTime;
32
 import java.time.LocalDateTime;
31
 import java.util.ArrayList;
33
 import java.util.ArrayList;
32
 import java.util.HashMap;
34
 import java.util.HashMap;
41
  * @author jobob
43
  * @author jobob
42
  * @since 2020-02-10
44
  * @since 2020-02-10
43
  */
45
  */
46
+@Transactional(rollbackFor = Exception.class)
44
 @Service
47
 @Service
45
 public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResourcesMapper, TaHousingResources> implements ITaHousingResourcesService {
48
 public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResourcesMapper, TaHousingResources> implements ITaHousingResourcesService {
46
 
49
 
63
 
66
 
64
     @Autowired
67
     @Autowired
65
     private TaBuildingRoomMapper taBuildingRoomMapper;
68
     private TaBuildingRoomMapper taBuildingRoomMapper;
66
-    
69
+
67
     @Autowired
70
     @Autowired
68
     private TaBuildingMapper taBuildingMapper;
71
     private TaBuildingMapper taBuildingMapper;
69
 
72
 
80
     /**
83
     /**
81
      * 分页获取房源列表
84
      * 分页获取房源列表
82
      *
85
      *
83
-     * @param pageNum      页码
84
-     * @param pageSize     分页大小
85
      * @param salesBatchId 销售批次ID
86
      * @param salesBatchId 销售批次ID
86
      * @param startPrice
87
      * @param startPrice
87
      * @param endPrice
88
      * @param endPrice
89
      * @return
90
      * @return
90
      */
91
      */
91
     @Override
92
     @Override
92
-    public IPage<TaHousingResourcesPO> listHousingResources(Integer pageNum, Integer pageSize, String salesBatchId, String startPrice, String endPrice, String apartmentId) {
93
-        logger.info("listHousingResources 接收参数:pageNum:{},pageSize:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
94
-                pageNum, pageSize, salesBatchId, startPrice, endPrice, apartmentId);
93
+    public List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId) {
94
+        logger.info("listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
95
+                orgId, salesBatchId, startPrice, endPrice, apartmentId);
96
+
97
+        List<TaHousingResourcesPO> resourcesPOList =
98
+                taHousingResourcesMapper.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId);
95
 
99
 
96
-        IPage<TaHousingResourcesPO> iPage = new Page<>(pageNum, pageSize);
97
-        return taHousingResourcesMapper.listHousingResources(iPage, salesBatchId, startPrice, endPrice, apartmentId);
100
+        return resourcesPOList;
98
     }
101
     }
99
 
102
 
100
     /**
103
     /**
164
         List<TaBuildingImg> taBuildingImgList = new ArrayList<>();
167
         List<TaBuildingImg> taBuildingImgList = new ArrayList<>();
165
         List<TaApartmentImg> buildingImg;
168
         List<TaApartmentImg> buildingImg;
166
         QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
169
         QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
167
-        QueryWrapper<TaApartmentImg>  apartmentImgQueryWrapper = new QueryWrapper<>();
170
+        QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper = new QueryWrapper<>();
168
         apartmentImgQueryWrapper.eq("apartment_id", resourcesPO.getApartmentId());
171
         apartmentImgQueryWrapper.eq("apartment_id", resourcesPO.getApartmentId());
169
         buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
172
         buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
170
         for (TaApartmentImg apartmentImg : buildingImg) {
173
         for (TaApartmentImg apartmentImg : buildingImg) {
173
             buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
176
             buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
174
             taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
177
             taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
175
         }
178
         }
176
-        if(CollectionUtils.isNotEmpty(taBuildingImgList)){
179
+        if (CollectionUtils.isNotEmpty(taBuildingImgList)) {
177
             resourcesPO.setBuildingImgList(taBuildingImgList);
180
             resourcesPO.setBuildingImgList(taBuildingImgList);
178
         }
181
         }
179
 
182
 
191
         StringBuffer result = new StringBuffer();
194
         StringBuffer result = new StringBuffer();
192
         //校验期
195
         //校验期
193
         String termResult = checckedTerm(taHousingResources);
196
         String termResult = checckedTerm(taHousingResources);
194
-        result.append(termResult.equals("notExist") ? "期名" + taHousingResources.getTermName() + "不存在,会直接新建。" : termResult );
197
+        result.append(termResult.equals("notExist") ? "期名" + taHousingResources.getTermName() + "不存在,会直接新建。" : termResult);
195
         //校验栋
198
         //校验栋
196
         String blockResult = checkedBlock(taHousingResources);
199
         String blockResult = checkedBlock(taHousingResources);
197
-        result.append(blockResult.equals("notExist") ? "楼栋名" + taHousingResources.getBlockName() + "不存在,会直接新建。" : blockResult );
200
+        result.append(blockResult.equals("notExist") ? "楼栋名" + taHousingResources.getBlockName() + "不存在,会直接新建。" : blockResult);
198
         //校验单元
201
         //校验单元
199
         String unitResult = checkedUnit(taHousingResources);
202
         String unitResult = checkedUnit(taHousingResources);
200
-        result.append(unitResult.equals("notExist") ? "单元名" + taHousingResources.getUnitName() + "不存在,会直接新建。" : unitResult );
203
+        result.append(unitResult.equals("notExist") ? "单元名" + taHousingResources.getUnitName() + "不存在,会直接新建。" : unitResult);
201
         //校验楼层
204
         //校验楼层
202
         String floorResult = checkedFloor(taHousingResources);
205
         String floorResult = checkedFloor(taHousingResources);
203
-        result.append(floorResult.equals("notExist") ? "楼层名" + taHousingResources.getFloorName() + "不存在,会直接新建。" : floorResult );
206
+        result.append(floorResult.equals("notExist") ? "楼层名" + taHousingResources.getFloorName() + "不存在,会直接新建。" : floorResult);
204
         //校验房号
207
         //校验房号
205
         String roomResult = checkedRoom(taHousingResources);
208
         String roomResult = checkedRoom(taHousingResources);
206
-        result.append(roomResult.equals("notExist") ? "房号" + taHousingResources.getRoomName() + "不存在,会直接新建。" : roomResult );
209
+        result.append(roomResult.equals("notExist") ? "房号" + taHousingResources.getRoomName() + "不存在,会直接新建。" : roomResult);
207
         return result;
210
         return result;
208
     }
211
     }
209
 
212
 
227
         String roomResult = checkedRoom(taHousingResources);
230
         String roomResult = checkedRoom(taHousingResources);
228
 
231
 
229
         //创建期
232
         //创建期
230
-        if (!roomResult.equals("notExist")){
231
-            return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!",ResponseBean.ERROR_UNAVAILABLE);
233
+        if (!roomResult.equals("notExist")) {
234
+            return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!", ResponseBean.ERROR_UNAVAILABLE);
232
         }
235
         }
233
 
236
 
234
         //期不存在就添加
237
         //期不存在就添加
235
-        if (termResult.equals("notExist")){
238
+        if (termResult.equals("notExist")) {
236
             addTerm(taHousingResources);
239
             addTerm(taHousingResources);
237
         }
240
         }
238
 
241
 
239
         //楼栋不存在就添加
242
         //楼栋不存在就添加
240
-        if (blockResult.equals("notExist")){
243
+        if (blockResult.equals("notExist")) {
241
             addBlock(taHousingResources);
244
             addBlock(taHousingResources);
242
         }
245
         }
243
 
246
 
244
         //单元不存在就添加
247
         //单元不存在就添加
245
-        if (unitResult.equals("notExist")){
248
+        if (unitResult.equals("notExist")) {
246
             addUnit(taHousingResources);
249
             addUnit(taHousingResources);
247
         }
250
         }
248
 
251
 
249
         //楼层不存在就添加
252
         //楼层不存在就添加
250
-        if (floorResult.equals("notExist")){
253
+        if (floorResult.equals("notExist")) {
251
             addFloor(taHousingResources);
254
             addFloor(taHousingResources);
252
         }
255
         }
253
 
256
 
254
         //房间号不存在就添加
257
         //房间号不存在就添加
255
-        if (roomResult.equals("notExist")){
258
+        if (roomResult.equals("notExist")) {
256
             addRoom(taHousingResources);
259
             addRoom(taHousingResources);
257
         }
260
         }
258
-        
261
+
259
         // 获取楼盘名称
262
         // 获取楼盘名称
260
         TaBuilding taBuilding = taBuildingMapper.selectById(taHousingResources.getBuildingId());
263
         TaBuilding taBuilding = taBuildingMapper.selectById(taHousingResources.getBuildingId());
261
         taHousingResources.setBuildingName(taBuilding.getBuildingName());
264
         taHousingResources.setBuildingName(taBuilding.getBuildingName());
314
         taHousingResources.setFloorId(oldTaHousingResources.getFloorId());
317
         taHousingResources.setFloorId(oldTaHousingResources.getFloorId());
315
         taHousingResources.setRoomId(oldTaHousingResources.getRoomId());
318
         taHousingResources.setRoomId(oldTaHousingResources.getRoomId());
316
         //只允许编辑房间名
319
         //只允许编辑房间名
317
-        if (!oldTaHousingResources.getRoomName().equals(taHousingResources.getRoomName())){
320
+        if (!oldTaHousingResources.getRoomName().equals(taHousingResources.getRoomName())) {
318
             //校验房号
321
             //校验房号
319
             String roomResult = checkedRoom(taHousingResources);
322
             String roomResult = checkedRoom(taHousingResources);
320
 
323
 
321
             //房间号不存在就更新
324
             //房间号不存在就更新
322
-            if (roomResult.equals("notExist")){
325
+            if (roomResult.equals("notExist")) {
323
                 updateRoom(taHousingResources);
326
                 updateRoom(taHousingResources);
324
-            }else{
325
-                return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!",ResponseBean.ERROR_UNAVAILABLE);
327
+            } else {
328
+                return ResponseBean.error("房间名" + taHousingResources.getRoomName() + "存在。请修改房间名!", ResponseBean.ERROR_UNAVAILABLE);
326
             }
329
             }
327
 
330
 
328
         }
331
         }
337
      * 获取表格中的数据
340
      * 获取表格中的数据
338
      *
341
      *
339
      * @param file
342
      * @param file
343
+     * @param salesBatchId
344
+     * @param buildingId
345
+     * @param orgId
340
      * @return
346
      * @return
341
      */
347
      */
342
     @Override
348
     @Override
343
-    public ResponseBean getExcelData(MultipartFile file) {
349
+    public ResponseBean getExcelData(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
344
         ResponseBean responseBean = new ResponseBean();
350
         ResponseBean responseBean = new ResponseBean();
345
         List<TaHousingResources> list = new ArrayList<>();
351
         List<TaHousingResources> list = new ArrayList<>();
346
         if (file == null) {
352
         if (file == null) {
380
                 String unitName = row.getCell(2).getStringCellValue().trim();
386
                 String unitName = row.getCell(2).getStringCellValue().trim();
381
                 String floorName = row.getCell(3).getStringCellValue().trim();
387
                 String floorName = row.getCell(3).getStringCellValue().trim();
382
                 String roomName = row.getCell(4).getStringCellValue().trim();
388
                 String roomName = row.getCell(4).getStringCellValue().trim();
383
-                String price = row.getCell(5).getStringCellValue().trim();
384
-                String heat = row.getCell(6).getStringCellValue().trim();
389
+                BigDecimal price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
390
+                Integer heat = Integer.valueOf(String.valueOf(row.getCell(6).getNumericCellValue()).substring(0,1));
385
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
391
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
386
 
392
 
387
-                int currentRow = j+1;
388
-                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(termName)){
393
+                int currentRow = j + 1;
394
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(termName)) {
389
                     responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
395
                     responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
390
                     return responseBean;
396
                     return responseBean;
391
                 }
397
                 }
392
-                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(blockName)){
398
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(blockName)) {
393
                     responseBean.addError("第" + currentRow + "行" + "楼栋不能为空!");
399
                     responseBean.addError("第" + currentRow + "行" + "楼栋不能为空!");
394
                     return responseBean;
400
                     return responseBean;
395
                 }
401
                 }
396
-                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(unitName)){
402
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(unitName)) {
397
                     responseBean.addError("第" + currentRow + "行" + "单元不能为空!");
403
                     responseBean.addError("第" + currentRow + "行" + "单元不能为空!");
398
                     return responseBean;
404
                     return responseBean;
399
                 }
405
                 }
400
-                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(floorName)){
406
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(floorName)) {
401
                     responseBean.addError("第" + currentRow + "行" + "层不能为空!");
407
                     responseBean.addError("第" + currentRow + "行" + "层不能为空!");
402
                     return responseBean;
408
                     return responseBean;
403
                 }
409
                 }
404
-                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(roomName)){
410
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(roomName)) {
405
                     responseBean.addError("第" + currentRow + "行" + "房号不能为空!");
411
                     responseBean.addError("第" + currentRow + "行" + "房号不能为空!");
406
                     return responseBean;
412
                     return responseBean;
407
                 }
413
                 }
408
 
414
 
409
                 String houseInfo = termName + blockName + unitName + floorName + roomName;
415
                 String houseInfo = termName + blockName + unitName + floorName + roomName;
410
-                if (temHousingList.contains(houseInfo)){
411
-                    logger.info("存在重复房源:{}",houseInfo);
412
-                    responseBean.addError("第"+ currentRow +"行存在重复房源");
416
+                if (temHousingList.contains(houseInfo)) {
417
+                    logger.info("存在重复房源:{}", houseInfo);
418
+                    responseBean.addError("第" + currentRow + "行存在重复房源");
419
+                    return responseBean;
420
+                }
421
+
422
+                QueryWrapper<TaHousingResources> taHousingResourcesQueryWrapper = new QueryWrapper<>();
423
+                taHousingResourcesQueryWrapper.eq("sales_batch_id",salesBatchId);
424
+                taHousingResourcesQueryWrapper.eq("building_id",buildingId);
425
+                taHousingResourcesQueryWrapper.eq("org_id",orgId);
426
+                taHousingResourcesQueryWrapper.gt("status",CommConstant.STATUS_DELETE);
427
+                taHousingResourcesQueryWrapper.eq("term_name",termName);
428
+                taHousingResourcesQueryWrapper.eq("block_name",blockName);
429
+                taHousingResourcesQueryWrapper.eq("unit_name",unitName);
430
+                taHousingResourcesQueryWrapper.eq("floor_name",floorName);
431
+                taHousingResourcesQueryWrapper.eq("room_name",roomName);
432
+                TaHousingResources oldTaHouseingResources = taHousingResourcesMapper.selectOne(taHousingResourcesQueryWrapper);
433
+                if (null != oldTaHouseingResources){
434
+                    logger.info("数据库存在重复房源:{}",houseInfo);
435
+                    responseBean.addError("第"+ currentRow +"行与系统已录入房源"+ oldTaHouseingResources.getHouseId() +"重复");
413
                     return responseBean;
436
                     return responseBean;
414
                 }
437
                 }
415
 
438
 
421
                 taHousingResources.setUnitName(unitName);
444
                 taHousingResources.setUnitName(unitName);
422
                 taHousingResources.setFloorName(floorName);
445
                 taHousingResources.setFloorName(floorName);
423
                 taHousingResources.setRoomName(roomName);
446
                 taHousingResources.setRoomName(roomName);
447
+                taHousingResources.setPrice(price);
448
+                taHousingResources.setHeat(heat);
449
+                taHousingResources.setStatus(status);
424
                 list.add(taHousingResources);
450
                 list.add(taHousingResources);
425
             }
451
             }
426
         }
452
         }
427
         //构建分页
453
         //构建分页
428
-        Map<String,Object> data = new HashMap<String, Object>();
429
-        data.put("list",list);
430
-        data.put("total",list.size());
454
+        Map<String, Object> data = new HashMap<String, Object>();
455
+        data.put("list", list);
456
+        data.put("total", list.size());
431
 
457
 
432
         responseBean.addSuccess(data);
458
         responseBean.addSuccess(data);
433
         return responseBean;
459
         return responseBean;
434
     }
460
     }
435
 
461
 
462
+    /**
463
+     * 保存文件
464
+     *
465
+     * @param file
466
+     * @param salesBatchId
467
+     * @param buildingId
468
+     * @param orgId
469
+     * @return
470
+     */
471
+    @Override
472
+    public ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId) {
473
+        ResponseBean responseBean = new ResponseBean();
474
+        responseBean = getExcelData(file, salesBatchId, buildingId, orgId);
475
+        if (responseBean.getCode() != ResponseBean.CODE_SUCCESS){
476
+            return responseBean;
477
+        }
478
+
479
+        //获取校验成功的数据
480
+        Map<String,Object> data = (Map<String,Object>)responseBean.getData();
481
+        List<TaHousingResources> list =  (List<TaHousingResources>)data.get("list");
482
+        list.forEach(e -> {
483
+            e.setOrgId(orgId);
484
+            e.setSalesBatchId(salesBatchId);
485
+            e.setBuildingId(buildingId);
486
+            addHouseResources(e);
487
+        });
488
+        return ResponseBean.success(list);
489
+    }
490
+
436
     //更新房号
491
     //更新房号
437
     private void updateRoom(TaHousingResources taHousingResources) {
492
     private void updateRoom(TaHousingResources taHousingResources) {
438
         TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
493
         TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
550
 
605
 
551
     //校验房号
606
     //校验房号
552
     private String checkedRoom(TaHousingResources taHousingResources) {
607
     private String checkedRoom(TaHousingResources taHousingResources) {
553
-        if (StringUtils.isEmpty(taHousingResources.getRoomName())){
608
+        if (StringUtils.isEmpty(taHousingResources.getRoomName())) {
554
             return "请输入房号。";
609
             return "请输入房号。";
555
-        }else{
610
+        } else {
556
             //查询房号
611
             //查询房号
557
             TaBuildingRoom taBuildingRoom = selectRoom(taHousingResources);
612
             TaBuildingRoom taBuildingRoom = selectRoom(taHousingResources);
558
-            if (null != taBuildingRoom){
613
+            if (null != taBuildingRoom) {
559
                 taHousingResources.setRoomId(taBuildingRoom.getRoomId());
614
                 taHousingResources.setRoomId(taBuildingRoom.getRoomId());
560
                 return "房间名" + taHousingResources.getRoomName() + "存在。不允许保存,请修改!";
615
                 return "房间名" + taHousingResources.getRoomName() + "存在。不允许保存,请修改!";
561
-            }else{
616
+            } else {
562
                 return "notExist";
617
                 return "notExist";
563
             }
618
             }
564
         }
619
         }
567
     //查询房间号
622
     //查询房间号
568
     private TaBuildingRoom selectRoom(TaHousingResources taHousingResources) {
623
     private TaBuildingRoom selectRoom(TaHousingResources taHousingResources) {
569
         QueryWrapper<TaBuildingRoom> queryWrapper = new QueryWrapper<>();
624
         QueryWrapper<TaBuildingRoom> queryWrapper = new QueryWrapper<>();
570
-        queryWrapper.eq("org_id",taHousingResources.getOrgId());
571
-        queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
572
-        queryWrapper.eq("building_id",taHousingResources.getBuildingId());
573
-        queryWrapper.eq("term_id",taHousingResources.getTermId());
574
-        queryWrapper.eq("block_id",taHousingResources.getBlockId());
575
-        queryWrapper.eq("unit_id",taHousingResources.getUnitId());
576
-        queryWrapper.eq("floor_id",taHousingResources.getFloorId());
577
-        queryWrapper.eq("room_name",taHousingResources.getRoomName());
625
+        queryWrapper.eq("org_id", taHousingResources.getOrgId());
626
+        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
627
+        queryWrapper.eq("building_id", taHousingResources.getBuildingId());
628
+        queryWrapper.eq("term_id", taHousingResources.getTermId());
629
+        queryWrapper.eq("block_id", taHousingResources.getBlockId());
630
+        queryWrapper.eq("unit_id", taHousingResources.getUnitId());
631
+        queryWrapper.eq("floor_id", taHousingResources.getFloorId());
632
+        queryWrapper.eq("room_name", taHousingResources.getRoomName());
578
         return taBuildingRoomMapper.selectOne(queryWrapper);
633
         return taBuildingRoomMapper.selectOne(queryWrapper);
579
     }
634
     }
580
 
635
 
581
     //校验楼层
636
     //校验楼层
582
     private String checkedFloor(TaHousingResources taHousingResources) {
637
     private String checkedFloor(TaHousingResources taHousingResources) {
583
-        if (StringUtils.isEmpty(taHousingResources.getFloorName())){
638
+        if (StringUtils.isEmpty(taHousingResources.getFloorName())) {
584
             return "请输入楼层名。";
639
             return "请输入楼层名。";
585
-        }else{
640
+        } else {
586
             QueryWrapper<TaBuildingFloor> queryWrapper = new QueryWrapper<>();
641
             QueryWrapper<TaBuildingFloor> queryWrapper = new QueryWrapper<>();
587
-            queryWrapper.eq("org_id",taHousingResources.getOrgId());
588
-            queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
589
-            queryWrapper.eq("building_id",taHousingResources.getBuildingId());
590
-            queryWrapper.eq("term_id",taHousingResources.getTermId());
591
-            queryWrapper.eq("block_id",taHousingResources.getBlockId());
592
-            queryWrapper.eq("unit_id",taHousingResources.getUnitId());
593
-            queryWrapper.eq("floor_name",taHousingResources.getFloorName());
642
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
643
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
644
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
645
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
646
+            queryWrapper.eq("block_id", taHousingResources.getBlockId());
647
+            queryWrapper.eq("unit_id", taHousingResources.getUnitId());
648
+            queryWrapper.eq("floor_name", taHousingResources.getFloorName());
594
             TaBuildingFloor taBuildingFloor = taBuildingFloorMapper.selectOne(queryWrapper);
649
             TaBuildingFloor taBuildingFloor = taBuildingFloorMapper.selectOne(queryWrapper);
595
-            if (null != taBuildingFloor){
650
+            if (null != taBuildingFloor) {
596
                 taHousingResources.setFloorId(taBuildingFloor.getFloorId());
651
                 taHousingResources.setFloorId(taBuildingFloor.getFloorId());
597
                 return "楼层名" + taHousingResources.getFloorName() + "存在。";
652
                 return "楼层名" + taHousingResources.getFloorName() + "存在。";
598
-            }else{
653
+            } else {
599
                 return "notExist";
654
                 return "notExist";
600
             }
655
             }
601
         }
656
         }
603
 
658
 
604
     //校验单元
659
     //校验单元
605
     private String checkedUnit(TaHousingResources taHousingResources) {
660
     private String checkedUnit(TaHousingResources taHousingResources) {
606
-        if (StringUtils.isEmpty(taHousingResources.getUnitName())){
661
+        if (StringUtils.isEmpty(taHousingResources.getUnitName())) {
607
             return "请输入单元名。";
662
             return "请输入单元名。";
608
-        }else{
663
+        } else {
609
             QueryWrapper<TaBuildingUnit> queryWrapper = new QueryWrapper<>();
664
             QueryWrapper<TaBuildingUnit> queryWrapper = new QueryWrapper<>();
610
-            queryWrapper.eq("org_id",taHousingResources.getOrgId());
611
-            queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
612
-            queryWrapper.eq("building_id",taHousingResources.getBuildingId());
613
-            queryWrapper.eq("term_id",taHousingResources.getTermId());
614
-            queryWrapper.eq("block_id",taHousingResources.getBlockId());
615
-            queryWrapper.eq("unit_name",taHousingResources.getUnitName());
665
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
666
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
667
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
668
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
669
+            queryWrapper.eq("block_id", taHousingResources.getBlockId());
670
+            queryWrapper.eq("unit_name", taHousingResources.getUnitName());
616
             TaBuildingUnit taBuildingUnit = taBuildingUnitMapper.selectOne(queryWrapper);
671
             TaBuildingUnit taBuildingUnit = taBuildingUnitMapper.selectOne(queryWrapper);
617
-            if (null != taBuildingUnit){
672
+            if (null != taBuildingUnit) {
618
                 taHousingResources.setUnitId(taBuildingUnit.getUnitId());
673
                 taHousingResources.setUnitId(taBuildingUnit.getUnitId());
619
                 return "单元名" + taHousingResources.getUnitName() + "存在。";
674
                 return "单元名" + taHousingResources.getUnitName() + "存在。";
620
-            }else{
675
+            } else {
621
                 return "notExist";
676
                 return "notExist";
622
             }
677
             }
623
         }
678
         }
625
 
680
 
626
     //校验楼盘
681
     //校验楼盘
627
     private String checkedBlock(TaHousingResources taHousingResources) {
682
     private String checkedBlock(TaHousingResources taHousingResources) {
628
-        if (StringUtils.isEmpty(taHousingResources.getBlockName())){
683
+        if (StringUtils.isEmpty(taHousingResources.getBlockName())) {
629
             return "请输入楼栋名。";
684
             return "请输入楼栋名。";
630
-        }else{
685
+        } else {
631
             QueryWrapper<TaBuildingBlock> queryWrapper = new QueryWrapper<>();
686
             QueryWrapper<TaBuildingBlock> queryWrapper = new QueryWrapper<>();
632
-            queryWrapper.eq("org_id",taHousingResources.getOrgId());
633
-            queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
634
-            queryWrapper.eq("building_id",taHousingResources.getBuildingId());
635
-            queryWrapper.eq("term_id",taHousingResources.getTermId());
636
-            queryWrapper.eq("block_name",taHousingResources.getBlockName());
687
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
688
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
689
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
690
+            queryWrapper.eq("term_id", taHousingResources.getTermId());
691
+            queryWrapper.eq("block_name", taHousingResources.getBlockName());
637
             TaBuildingBlock taBuildingBlock = taBuildingBlockMapper.selectOne(queryWrapper);
692
             TaBuildingBlock taBuildingBlock = taBuildingBlockMapper.selectOne(queryWrapper);
638
-            if (null != taBuildingBlock){
693
+            if (null != taBuildingBlock) {
639
                 taHousingResources.setBlockId(taBuildingBlock.getBlockId());
694
                 taHousingResources.setBlockId(taBuildingBlock.getBlockId());
640
                 return "楼栋名" + taHousingResources.getBlockName() + "存在。";
695
                 return "楼栋名" + taHousingResources.getBlockName() + "存在。";
641
-            }else{
696
+            } else {
642
                 return "notExist";
697
                 return "notExist";
643
             }
698
             }
644
         }
699
         }
646
 
701
 
647
     //校验期
702
     //校验期
648
     private String checckedTerm(TaHousingResources taHousingResources) {
703
     private String checckedTerm(TaHousingResources taHousingResources) {
649
-        if (StringUtils.isEmpty(taHousingResources.getTermName())){
704
+        if (StringUtils.isEmpty(taHousingResources.getTermName())) {
650
             return "请输入期名。";
705
             return "请输入期名。";
651
-        }else{
706
+        } else {
652
             QueryWrapper<TaBuildingTerm> queryWrapper = new QueryWrapper<>();
707
             QueryWrapper<TaBuildingTerm> queryWrapper = new QueryWrapper<>();
653
-            queryWrapper.eq("org_id",taHousingResources.getOrgId());
654
-            queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
655
-            queryWrapper.eq("building_id",taHousingResources.getBuildingId());
656
-            queryWrapper.eq("term_name",taHousingResources.getTermName());
708
+            queryWrapper.eq("org_id", taHousingResources.getOrgId());
709
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
710
+            queryWrapper.eq("building_id", taHousingResources.getBuildingId());
711
+            queryWrapper.eq("term_name", taHousingResources.getTermName());
657
             TaBuildingTerm taBuildingTerm = taBuildingTermMapper.selectOne(queryWrapper);
712
             TaBuildingTerm taBuildingTerm = taBuildingTermMapper.selectOne(queryWrapper);
658
-            if (null != taBuildingTerm){
713
+            if (null != taBuildingTerm) {
659
                 taHousingResources.setTermId(taBuildingTerm.getTermId());
714
                 taHousingResources.setTermId(taBuildingTerm.getTermId());
660
                 return "期名" + taHousingResources.getTermName() + "存在。";
715
                 return "期名" + taHousingResources.getTermName() + "存在。";
661
-            }else{
716
+            } else {
662
                 return "notExist";
717
                 return "notExist";
663
             }
718
             }
664
         }
719
         }

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

56
     TaApartmentImgMapper taApartmentImgMapper;
56
     TaApartmentImgMapper taApartmentImgMapper;
57
 
57
 
58
     @Override
58
     @Override
59
-    public IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, String personId) {
60
-        logger.info("listPreselectionRecord 接收参数:pageNum:{},pageSize:{},personId:{}", pageNum, pageSize, personId);
59
+    public IPage<TaPreselectionRecordPO> listPreselectionRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId) {
60
+        logger.info("listPreselectionRecord 接收参数:pageNum:{},pageSize:{},orgId:{},personId:{}", pageNum, pageSize, orgId, personId);
61
 
61
 
62
         IPage<TaPreselectionRecordPO> iPage = new Page<>(pageNum, pageSize);
62
         IPage<TaPreselectionRecordPO> iPage = new Page<>(pageNum, pageSize);
63
-        iPage = taPreselectionRecordMapper.listPreselectionRecord(iPage, personId);
63
+        iPage = taPreselectionRecordMapper.listPreselectionRecord(iPage, orgId, personId);
64
 
64
 
65
         List<TaPreselectionRecordPO> poList = iPage.getRecords();
65
         List<TaPreselectionRecordPO> poList = iPage.getRecords();
66
         if (CollectionUtils.isNotEmpty(poList)) {
66
         if (CollectionUtils.isNotEmpty(poList)) {

+ 27
- 13
src/main/resources/mapper/TaHousingResourcesMapper.xml 查看文件

3
 <mapper namespace="com.huiju.estateagents.mapper.TaHousingResourcesMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaHousingResourcesMapper">
4
 
4
 
5
     <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
5
     <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
6
+        SELECT
7
+          *
8
+        FROM
9
+          (
6
         SELECT
10
         SELECT
7
             t.house_id,
11
             t.house_id,
8
             t.building_id,
12
             t.building_id,
23
             t.org_id,
27
             t.org_id,
24
             t2.inside_area,
28
             t2.inside_area,
25
             t2.building_area,
29
             t2.building_area,
26
-            t2.apartment_name
30
+            t2.apartment_name,
31
+            t3.term_id,
32
+            t4.term_name termName
27
         FROM
33
         FROM
28
-            ta_housing_resources t,
29
-            ta_building_apartment t2
34
+          ta_housing_resources t
35
+        LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
36
+        LEFT JOIN ta_building_block t3 ON t.block_id = t3.block_id
37
+        LEFT JOIN ta_building_term t4 ON t3.term_id = t4.term_id
30
         WHERE
38
         WHERE
31
             t.sales_batch_id = #{salesBatchId}
39
             t.sales_batch_id = #{salesBatchId}
32
-        <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
33
-            AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
34
-        </if>
35
-        <if test="apartmentId != null and apartmentId != ''">
36
-            AND t.apartment_id = #{apartmentId}
37
-        </if>
38
-        AND t.apartment_id = t2.apartment_id
39
-        AND t.`status` = 1
40
-        AND t2.`status` = 1
41
-        ORDER BY t.create_date DESC
40
+            <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
41
+                AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
42
+            </if>
43
+            <if test="apartmentId != null and apartmentId != ''">
44
+                AND t.apartment_id = #{apartmentId}
45
+            </if>
46
+            AND t.org_id = #{orgId}
47
+            AND t.`status` = 1
48
+            AND t2.`status` = 1
49
+          ) t5
50
+        ORDER BY
51
+            t5.termName,
52
+            t5.block_name,
53
+            t5.unit_name,
54
+            t5.floor_name DESC,
55
+            t5.room_name
42
     </select>
56
     </select>
43
 
57
 
44
     <select id="listBuildApartmentBySalesBatchId" resultType="com.huiju.estateagents.entity.TaBuildingApartment">
58
     <select id="listBuildApartmentBySalesBatchId" resultType="com.huiju.estateagents.entity.TaBuildingApartment">

+ 1
- 0
src/main/resources/mapper/TaPreselectionRecordMapper.xml 查看文件

30
             ta_housing_resources t2
30
             ta_housing_resources t2
31
         WHERE
31
         WHERE
32
             t.person_id = #{personId}
32
             t.person_id = #{personId}
33
+            AND t.org_id = #{orgId}
33
             AND t.house_id = t2.house_id
34
             AND t.house_id = t2.house_id
34
         ORDER BY
35
         ORDER BY
35
             t.create_date DESC
36
             t.create_date DESC