Kaynağa Gözat

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

魏超 5 yıl önce
ebeveyn
işleme
93ffbfaa0e

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/MiniAppController.java Dosyayı Görüntüle

@@ -333,7 +333,7 @@ public class MiniAppController extends BaseController {
333 333
 
334 334
             // 定位城市
335 335
             String location = null == lon ? null : lon + "," + lat;
336
-            TdCity tdCity = iTdCityService.getLocationCity(location, orgId, getPersonId(request));
336
+            TdCity tdCity = iTdCityService.getLocationCity(location, orgId, taPerson.getPersonId());
337 337
             result.put("city", tdCity);
338 338
 
339 339
             return ResponseBean.success(result);

+ 21
- 3
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java Dosyayı Görüntüle

@@ -228,8 +228,8 @@ public class TaHousingResourcesController extends BaseController {
228 228
         Integer orgId = getOrgId(request);
229 229
         String personId = getPersonId(request);
230 230
 
231
-        logger.info("TaHouseingResourcesController.listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
232
-                orgId, salesBatchId, startPrice, endPrice, apartmentId);
231
+        logger.info("TaHouseingResourcesController.listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{},source:{}",
232
+                orgId, salesBatchId, startPrice, endPrice, apartmentId, source);
233 233
 
234 234
         try {
235 235
             //获取所有楼房的预选热度和认筹热度
@@ -488,7 +488,7 @@ public class TaHousingResourcesController extends BaseController {
488 488
      * @return
489 489
      */
490 490
     @RequestMapping(value = "/admin/house/updateLockingStatus", method = RequestMethod.PUT)
491
-    public ResponseBean updateLockingStatus(Integer houseId, String type, Integer raiseHouseId, String personId,Integer raiseRecordId,
491
+    public ResponseBean updateLockingStatus(Integer houseId, String type, Integer raiseHouseId, String personId, Integer raiseRecordId,
492 492
                                             HttpServletRequest request) {
493 493
         ResponseBean responseBean = new ResponseBean();
494 494
         try {
@@ -500,4 +500,22 @@ public class TaHousingResourcesController extends BaseController {
500 500
         }
501 501
         return responseBean;
502 502
     }
503
+
504
+    /**
505
+     * 校验房源认筹状态
506
+     *
507
+     * @return
508
+     */
509
+    @RequestMapping(value = "/wx/check/raise", method = RequestMethod.GET)
510
+    public ResponseBean checkRaise(@RequestParam(value = "houseIds") String houseIds,HttpServletRequest request) {
511
+        ResponseBean responseBean = new ResponseBean();
512
+        try {
513
+            boolean state = iTaHousingResourcesService.checkRaiseState(houseIds,getPersonId(request),getOrgId(request));
514
+            responseBean.addSuccess(state);
515
+        } catch (Exception e) {
516
+            logger.error("校验房源状态 -=- {}", e.getMessage());
517
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_MISSING_PARAMS);
518
+        }
519
+        return responseBean;
520
+    }
503 521
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaRaiseRecordController.java Dosyayı Görüntüle

@@ -291,7 +291,7 @@ public class TaRaiseRecordController extends BaseController {
291 291
                     return responseBean;
292 292
                 }
293 293
                 if (!CommConstant.PAY_STATUS_UNPAID.equals(tr.getPayStatus())) {
294
-                    responseBean.addError(String.format("认筹单编号为%s的记录已缴费或意图款,请重新选择", record.getRaiseRecordId()));
294
+                    responseBean.addError(String.format("认筹单编号为%s的记录为未缴费状态 ,请重新选择", record.getRaiseRecordId()));
295 295
                     return responseBean;
296 296
                 }
297 297
             }
@@ -516,7 +516,7 @@ public class TaRaiseRecordController extends BaseController {
516 516
             responseBean.addSuccess(iTaRaiseRecordService.saveRaiseInfo(taRaiseRecord, getOrgId(request), getPersonId(request)));
517 517
         } catch (Exception e) {
518 518
             logger.error("微信端下认筹单 -=- {}", e.toString());
519
-            responseBean.addError(e.getMessage());
519
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_MISSING_PARAMS);
520 520
         }
521 521
         return responseBean;
522 522
     }

+ 6
- 0
src/main/java/com/huiju/estateagents/po/TaHousingResourcesPO.java Dosyayı Görüntüle

@@ -107,4 +107,10 @@ public class TaHousingResourcesPO extends TaHousingResources {
107 107
      */
108 108
     @TableField(exist = false)
109 109
     private Integer raiseRecordId;
110
+
111
+    /**
112
+     * 是否展示房源价格
113
+     */
114
+    @TableField(exist = false)
115
+    private Boolean displayHousePrice;
110 116
 }

+ 6
- 0
src/main/java/com/huiju/estateagents/po/TaPreselectionRecordPO.java Dosyayı Görüntüle

@@ -110,4 +110,10 @@ public class TaPreselectionRecordPO extends TaPreselectionRecord {
110 110
      */
111 111
     @TableField(exist = false)
112 112
     private TaHousingResources housingInfo;
113
+
114
+    /**
115
+     * 是否展示房源价格
116
+     */
117
+    @TableField(exist = false)
118
+    private Boolean displayHousePrice;
113 119
 }

+ 9
- 0
src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java Dosyayı Görüntüle

@@ -171,4 +171,13 @@ public interface ITaHousingResourcesService extends IService<TaHousingResources>
171 171
      * @return
172 172
      */
173 173
     ResponseBean updateLockingStatus(Integer houseId, String type, Integer orgId, Integer raiseHouseId, String personId, Integer raiseRecordId);
174
+
175
+    /**
176
+     * 校验房源的认筹状态
177
+     * @param houseIds
178
+     * @param personId
179
+     * @param orgId
180
+     * @return
181
+     */
182
+    boolean checkRaiseState(String houseIds, String personId, Integer orgId) throws Exception;
174 183
 }

+ 79
- 62
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java Dosyayı Görüntüle

@@ -280,74 +280,12 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
280 280
         if (null == taRaise) {
281 281
             resourcesPO.setRaiseBtn(false);
282 282
         } else {
283
-            //有认筹表的情况下判断是否认筹过这个房源
284
-            boolean raiseBtnStatus = checkRaiseBtn(taRaise, salesBatchId, personId, houseId, orgId);
285 283
             resourcesPO.setTaRaise(taRaise);
286 284
         }
287 285
 
288 286
         return resourcesPO;
289 287
     }
290 288
 
291
-    /**
292
-     * 校验认筹状态的按钮
293
-     *
294
-     * @param taRaise
295
-     * @param salesBatchId
296
-     * @param personId
297
-     * @param houseId
298
-     * @param orgId
299
-     * @return
300
-     */
301
-    private boolean checkRaiseBtn(TaRaise taRaise, Integer salesBatchId, String personId, Integer houseId, Integer orgId) {
302
-        if (taRaise.getStatus() != CommConstant.STATUS_NORMAL) {
303
-            return false;
304
-        }
305
-        if (taRaise.getNeedPreselection()) {
306
-            //查看是否有当前房源的预选记录
307
-            QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
308
-            preselectionRecordQueryWrapper.eq("sales_batch_id", salesBatchId);
309
-            preselectionRecordQueryWrapper.eq("building_id", taRaise.getBuildingId());
310
-            preselectionRecordQueryWrapper.eq("org_id", orgId);
311
-            preselectionRecordQueryWrapper.eq("house_id", houseId);
312
-            preselectionRecordQueryWrapper.eq("person_id", personId);
313
-            TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
314
-            if (null == taPreselectionRecord) {
315
-                return false;
316
-            }
317
-        }
318
-        //判断是否在时间之内
319
-
320
-        LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
321
-        LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
322
-        LocalDateTime now = LocalDateTime.now();
323
-        if (now.isBefore(raiseStartTime) || now.isAfter(raiseEndTime)) {
324
-            return false;
325
-        }
326
-        //销售批次校验
327
-        TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(salesBatchId);
328
-        if (taSalesBatch.getStatus() != CommConstant.STATUS_NORMAL) {
329
-            return false;
330
-        }
331
-
332
-        //房源信息
333
-        TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseId);
334
-        if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL || CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())) {
335
-            return false;
336
-        }
337
-
338
-        //查询我的认筹记录表
339
-        QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
340
-        taRaiseHouseQueryWrapper.eq("org_id", orgId);
341
-        taRaiseHouseQueryWrapper.eq("house_id", houseId);
342
-        taRaiseHouseQueryWrapper.eq("person_id", personId);
343
-        List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
344
-        if (list.size() > 0) {
345
-            return false;
346
-        }
347
-
348
-        return true;
349
-    }
350
-
351 289
     /**
352 290
      * 校验楼栋信息存不存在
353 291
      *
@@ -797,6 +735,85 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
797 735
         return responseBean;
798 736
     }
799 737
 
738
+    /**
739
+     * 校验房源的认筹状态
740
+     *
741
+     * @param houseIds
742
+     * @param personId
743
+     * @param orgId
744
+     * @return
745
+     */
746
+    @Override
747
+    public boolean checkRaiseState(String houseIds, String personId, Integer orgId) throws Exception {
748
+        String[] houseIdArr = houseIds.split(",");
749
+        //房源信息
750
+        TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseIdArr[0]);
751
+        //通过销售批次信息获取认筹信息
752
+        QueryWrapper<TaRaise> taRaiseQueryWrapper = new QueryWrapper<>();
753
+        taRaiseQueryWrapper.eq("org_id",orgId);
754
+        taRaiseQueryWrapper.eq("sales_batch_id",taHousingResources.getSalesBatchId());
755
+        taRaiseQueryWrapper.eq("building_id",taHousingResources.getBuildingId());
756
+        TaRaise taRaise = taRaiseMapper.selectOne(taRaiseQueryWrapper);
757
+        if (taRaise.getStatus() != CommConstant.STATUS_NORMAL) {
758
+            throw new Exception("认筹单已经作废");
759
+        }
760
+        //校验房源是否同一批次
761
+        for (String houseId : houseIdArr){
762
+            TaHousingResources taHousingResourcesChecked = taHousingResourcesMapper.selectById(houseId);
763
+            if (taHousingResources.getSalesBatchId() != taHousingResourcesChecked.getSalesBatchId()){
764
+                throw new Exception("非同一批次房源");
765
+            }
766
+            if (taRaise.getNeedPreselection()) {
767
+                //查看是否有当前房源的预选记录
768
+                QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
769
+                preselectionRecordQueryWrapper.eq("sales_batch_id", taRaise.getSalesBatchId());
770
+                preselectionRecordQueryWrapper.eq("building_id", taRaise.getBuildingId());
771
+                preselectionRecordQueryWrapper.eq("org_id", orgId);
772
+                preselectionRecordQueryWrapper.eq("house_id", houseId);
773
+                preselectionRecordQueryWrapper.eq("person_id", personId);
774
+                TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
775
+                if (null == taPreselectionRecord) {
776
+                    throw new Exception("需要先预选才能认筹");
777
+                }
778
+            }
779
+            //查询我的认筹记录表
780
+            QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
781
+            taRaiseHouseQueryWrapper.eq("org_id", orgId);
782
+            taRaiseHouseQueryWrapper.eq("house_id", houseId);
783
+            taRaiseHouseQueryWrapper.eq("person_id", personId);
784
+            List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
785
+            if (list.size() > 0) {
786
+                throw new Exception("您已有认筹单包含当前房源");
787
+            }
788
+
789
+        }
790
+        if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL) {
791
+            throw new Exception("房源已被取消发布");
792
+        }
793
+        if (CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())){
794
+            throw new Exception("房源已被其他客户锁定");
795
+        }
796
+        //销售批次信息
797
+        TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(taHousingResources.getSalesBatchId());
798
+        //销售批次校验
799
+        if (null == taSalesBatch) {
800
+            throw new Exception("无销售批次无法认筹");
801
+        }
802
+        if (taSalesBatch.getStatus() != CommConstant.STATUS_NORMAL) {
803
+            throw new Exception("销售批次已被取消发布");
804
+        }
805
+
806
+        //判断是否在时间之内
807
+        LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
808
+        LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
809
+        LocalDateTime now = LocalDateTime.now();
810
+        if (now.isBefore(raiseStartTime) || now.isAfter(raiseEndTime)) {
811
+            throw new Exception("不在认筹时间内");
812
+        }
813
+
814
+        return true;
815
+    }
816
+
800 817
     //更新房号
801 818
     private void updateRoom(TaHousingResources taHousingResources) {
802 819
         TaBuildingRoom taBuildingRoom = new TaBuildingRoom();

+ 15
- 15
src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java Dosyayı Görüntüle

@@ -72,25 +72,11 @@ public class TdCityServiceImpl extends ServiceImpl<TdCityMapper, TdCity> impleme
72 72
         if (jsonObject.getString("status").equals("1")) {
73 73
             JSONObject addressComponent = jsonObject.getJSONObject("regeocode").getJSONObject("addressComponent");
74 74
             String citycode = addressComponent.getString("citycode");
75
-            QueryWrapper<TdCity> queryWrapper = new QueryWrapper<>();
76
-            queryWrapper.eq("citycode", citycode);
77
-            queryWrapper.eq("leveltype", 2);
78
-            List<TdCity> tdCities = tdCityMapper.selectList(queryWrapper);
79
-            if (tdCities.size() > 0) {
80
-                List<TdCity> cityList = selectWxCity(null, orgId);
81
-                Integer cityId = tdCities.get(0).getId();
82
-                for (TdCity tdCity : cityList) {
83
-                    if (tdCity.getId().equals(cityId)) {
84
-                        return tdCity;
85
-                    }
86
-                }
87
-            }
88
-//            return null;
89
-
90 75
             // 保存用户位置信息
91 76
             if (StringUtils.isNotBlank(personId)) {
92 77
                 ExecutorService threadPool = Executors.newCachedThreadPool();
93 78
                 threadPool.execute(() -> {
79
+                    logger.info("保存用户位置信息开始");
94 80
                     TaPersonPositon record = new TaPersonPositon();
95 81
                     try {
96 82
                         String[] locationArr = location.split(",");
@@ -113,6 +99,20 @@ public class TdCityServiceImpl extends ServiceImpl<TdCityMapper, TdCity> impleme
113 99
                 });
114 100
             }
115 101
 
102
+            QueryWrapper<TdCity> queryWrapper = new QueryWrapper<>();
103
+            queryWrapper.eq("citycode", citycode);
104
+            queryWrapper.eq("leveltype", 2);
105
+            List<TdCity> tdCities = tdCityMapper.selectList(queryWrapper);
106
+            if (tdCities.size() > 0) {
107
+                List<TdCity> cityList = selectWxCity(null, orgId);
108
+                Integer cityId = tdCities.get(0).getId();
109
+                for (TdCity tdCity : cityList) {
110
+                    if (tdCity.getId().equals(cityId)) {
111
+                        return tdCity;
112
+                    }
113
+                }
114
+            }
115
+//            return null;
116 116
         }
117 117
 
118 118
         // 没有匹配到则返回默认城市

+ 12
- 31
src/main/resources/mapper/TaHousingResourcesMapper.xml Dosyayı Görüntüle

@@ -8,7 +8,7 @@
8 8
         FROM
9 9
         (
10 10
         SELECT
11
-        t.house_id,
11
+        t.*,
12 12
         (
13 13
         CASE
14 14
         WHEN ( SELECT num_char_extract ( t.term_name, 2 ) + 0 ) = 0 THEN
@@ -27,51 +27,30 @@
27 27
         ( SELECT num_char_extract ( t.unit_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.unit_name, 2 ) + 0 )
28 28
         END
29 29
         ) unitNamePre,
30
-        t.building_id,
31
-        t.block_id,
32
-        t.block_name,
33
-        t.sales_batch_id,
34
-        t.unit_id,
35
-        t.unit_name,
36
-        t.floor_id,
37
-        t.floor_name,
38
-        t.room_id,
39
-        t.room_name,
40
-        t.price,
41
-        t.heat,
42
-        t.real_heat,
43
-        t.apartment_id,
44
-        t.`status`,
45
-        t.org_id,
46 30
         t2.inside_area,
47 31
         t2.building_area,
48
-        t2.apartment_name,
49
-        t3.term_id,
50
-        t.term_name,
51
-        t.raise_heat,
52
-        t.raise_real_heat,
53
-        t.house_locking_status
32
+        t2.apartment_name
54 33
         FROM
55 34
         ta_housing_resources t
56 35
         LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
57
-        LEFT JOIN ta_building_block t3 ON t.block_id = t3.block_id
58 36
         LEFT JOIN ta_sales_batch t4 ON t.sales_batch_id = t4.sales_batch_id
59 37
         <if test="source == 'raiseChoose'">
60 38
             LEFT JOIN ta_raise_house t5 ON t.house_id = t5.house_id
61 39
             LEFT JOIN ta_raise_record t6 ON t6.raise_record_id = t5.raise_record_id
40
+            LEFT JOIN ta_raise t7 ON t.sales_batch_id = t7.sales_batch_id
62 41
         </if>
63 42
         WHERE
64
-        t.sales_batch_id = #{salesBatchId}
65
-        AND t.org_id = #{orgId}
66
-        AND t.`status` > 0
67
-        AND t4.`status` = 1
43
+            t.sales_batch_id = #{salesBatchId}
44
+            AND t.org_id = #{orgId}
45
+            AND t.`status` > 0
46
+            AND t4.`status` = 1
68 47
         <if test = "source == 'raiseChoose'">
69 48
             AND ( t6.`status` != 0 OR t6.`status` IS NULL )
49
+            AND (t.house_locking_status  != 'locked' OR t.house_locking_status IS NULL)
50
+            AND t7.raise_start_time &lt;= now( ) AND t7.raise_end_time &gt;= now()
70 51
             <if test="personId != null and personId != ''">
71
-                AND t6.person_id != #{personId}
52
+                AND (t6.person_id != #{personId} OR t6.person_id IS NULL)
72 53
             </if>
73
-            AND (t.house_locking_status  != 'locked'
74
-            OR t.house_locking_status IS NULL)
75 54
         </if>
76 55
         <choose>
77 56
             <when test=" endPrice != null and startPrice == null">
@@ -90,6 +69,8 @@
90 69
             AND t.apartment_id = #{apartmentId}
91 70
         </if>
92 71
         ) t5
72
+        GROUP BY
73
+        t5.house_id
93 74
         ORDER BY
94 75
         t5.termNamePre,
95 76
         t5.blockNamePre,

+ 2
- 1
src/main/resources/mapper/TaPreselectionRecordMapper.xml Dosyayı Görüntüle

@@ -14,7 +14,8 @@
14 14
             t2.apartment_id,
15 15
             t2.building_id buildingId,
16 16
             t2.`status` housingStatus,
17
-            t3.`status` saleBatchStatus
17
+            t3.`status` saleBatchStatus,
18
+            t3.display_house_price
18 19
         FROM
19 20
             ta_preselection_record t
20 21
         LEFT JOIN ta_housing_resources t2 ON t.house_id = t2.house_id