|
@@ -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
|
*
|
|
@@ -802,6 +740,79 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
|
802
|
740
|
return responseBean;
|
803
|
741
|
}
|
804
|
742
|
|
|
743
|
+ /**
|
|
744
|
+ * 校验房源的认筹状态
|
|
745
|
+ *
|
|
746
|
+ * @param houseId
|
|
747
|
+ * @param personId
|
|
748
|
+ * @param orgId
|
|
749
|
+ * @return
|
|
750
|
+ */
|
|
751
|
+ @Override
|
|
752
|
+ public boolean checkRaiseState(Integer houseId, String personId, Integer orgId) throws Exception {
|
|
753
|
+ //房源信息
|
|
754
|
+ TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseId);
|
|
755
|
+ if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
756
|
+ throw new Exception("房源已被取消发布");
|
|
757
|
+ }
|
|
758
|
+ if (CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())){
|
|
759
|
+ throw new Exception("房源已被其他客户锁定");
|
|
760
|
+ }
|
|
761
|
+ //销售批次信息
|
|
762
|
+ TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(taHousingResources.getSalesBatchId());
|
|
763
|
+ //销售批次校验
|
|
764
|
+ if (null == taSalesBatch) {
|
|
765
|
+ throw new Exception("无销售批次无法认筹");
|
|
766
|
+ }
|
|
767
|
+ if (taSalesBatch.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
768
|
+ throw new Exception("销售批次已被取消发布");
|
|
769
|
+ }
|
|
770
|
+
|
|
771
|
+ //通过销售批次信息获取认筹信息
|
|
772
|
+ QueryWrapper<TaRaise> taRaiseQueryWrapper = new QueryWrapper<>();
|
|
773
|
+ taRaiseQueryWrapper.eq("org_id",orgId);
|
|
774
|
+ taRaiseQueryWrapper.eq("sales_batch_id",taHousingResources.getSalesBatchId());
|
|
775
|
+ taRaiseQueryWrapper.eq("building_id",taHousingResources.getBuildingId());
|
|
776
|
+ TaRaise taRaise = taRaiseMapper.selectOne(taRaiseQueryWrapper);
|
|
777
|
+ if (taRaise.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
778
|
+ throw new Exception("认筹单已经作废");
|
|
779
|
+ }
|
|
780
|
+ if (taRaise.getNeedPreselection()) {
|
|
781
|
+ //查看是否有当前房源的预选记录
|
|
782
|
+ QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
|
|
783
|
+ preselectionRecordQueryWrapper.eq("sales_batch_id", taRaise.getSalesBatchId());
|
|
784
|
+ preselectionRecordQueryWrapper.eq("building_id", taRaise.getBuildingId());
|
|
785
|
+ preselectionRecordQueryWrapper.eq("org_id", orgId);
|
|
786
|
+ preselectionRecordQueryWrapper.eq("house_id", houseId);
|
|
787
|
+ preselectionRecordQueryWrapper.eq("person_id", personId);
|
|
788
|
+ TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
|
|
789
|
+ if (null == taPreselectionRecord) {
|
|
790
|
+ throw new Exception("需要先预选才能认筹");
|
|
791
|
+ }
|
|
792
|
+ }
|
|
793
|
+ //判断是否在时间之内
|
|
794
|
+
|
|
795
|
+ LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
|
|
796
|
+ LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
|
|
797
|
+ LocalDateTime now = LocalDateTime.now();
|
|
798
|
+ if (now.isBefore(raiseStartTime) || now.isAfter(raiseEndTime)) {
|
|
799
|
+ throw new Exception("不在认筹时间内");
|
|
800
|
+ }
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+ //查询我的认筹记录表
|
|
804
|
+ QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
|
|
805
|
+ taRaiseHouseQueryWrapper.eq("org_id", orgId);
|
|
806
|
+ taRaiseHouseQueryWrapper.eq("house_id", houseId);
|
|
807
|
+ taRaiseHouseQueryWrapper.eq("person_id", personId);
|
|
808
|
+ List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
|
|
809
|
+ if (list.size() > 0) {
|
|
810
|
+ throw new Exception("您已有认筹单包含当前房源");
|
|
811
|
+ }
|
|
812
|
+
|
|
813
|
+ return true;
|
|
814
|
+ }
|
|
815
|
+
|
805
|
816
|
//更新房号
|
806
|
817
|
private void updateRoom(TaHousingResources taHousingResources) {
|
807
|
818
|
TaBuildingRoom taBuildingRoom = new TaBuildingRoom();
|