傅行帆 5 년 전
부모
커밋
14c2712dc8

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java 파일 보기

@@ -507,10 +507,10 @@ public class TaHousingResourcesController extends BaseController {
507 507
      * @return
508 508
      */
509 509
     @RequestMapping(value = "/wx/check/raise", method = RequestMethod.GET)
510
-    public ResponseBean checkRaise(@RequestParam(value = "houseId") Integer houseId,HttpServletRequest request) {
510
+    public ResponseBean checkRaise(@RequestParam(value = "houseIds") String houseIds,HttpServletRequest request) {
511 511
         ResponseBean responseBean = new ResponseBean();
512 512
         try {
513
-            boolean state = iTaHousingResourcesService.checkRaiseState(houseId,getPersonId(request),getOrgId(request));
513
+            boolean state = iTaHousingResourcesService.checkRaiseState(houseIds,getPersonId(request),getOrgId(request));
514 514
             responseBean.addSuccess(state);
515 515
         } catch (Exception e) {
516 516
             logger.error("校验房源状态 -=- {}", e.getMessage());

+ 2
- 2
src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java 파일 보기

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

+ 43
- 37
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java 파일 보기

@@ -743,15 +743,55 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
743 743
     /**
744 744
      * 校验房源的认筹状态
745 745
      *
746
-     * @param houseId
746
+     * @param houseIds
747 747
      * @param personId
748 748
      * @param orgId
749 749
      * @return
750 750
      */
751 751
     @Override
752
-    public boolean checkRaiseState(Integer houseId, String personId, Integer orgId) throws Exception {
752
+    public boolean checkRaiseState(String houseIds, String personId, Integer orgId) throws Exception {
753
+        String[] houseIdArr = houseIds.split(",");
753 754
         //房源信息
754
-        TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseId);
755
+        TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseIdArr[0]);
756
+        //通过销售批次信息获取认筹信息
757
+        QueryWrapper<TaRaise> taRaiseQueryWrapper = new QueryWrapper<>();
758
+        taRaiseQueryWrapper.eq("org_id",orgId);
759
+        taRaiseQueryWrapper.eq("sales_batch_id",taHousingResources.getSalesBatchId());
760
+        taRaiseQueryWrapper.eq("building_id",taHousingResources.getBuildingId());
761
+        TaRaise taRaise = taRaiseMapper.selectOne(taRaiseQueryWrapper);
762
+        if (taRaise.getStatus() != CommConstant.STATUS_NORMAL) {
763
+            throw new Exception("认筹单已经作废");
764
+        }
765
+        //校验房源是否同一批次
766
+        for (String houseId : houseIdArr){
767
+            TaHousingResources taHousingResourcesChecked = taHousingResourcesMapper.selectById(houseId);
768
+            if (taHousingResources.getSalesBatchId() != taHousingResourcesChecked.getSalesBatchId()){
769
+                throw new Exception("非同一批次房源");
770
+            }
771
+            if (taRaise.getNeedPreselection()) {
772
+                //查看是否有当前房源的预选记录
773
+                QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
774
+                preselectionRecordQueryWrapper.eq("sales_batch_id", taRaise.getSalesBatchId());
775
+                preselectionRecordQueryWrapper.eq("building_id", taRaise.getBuildingId());
776
+                preselectionRecordQueryWrapper.eq("org_id", orgId);
777
+                preselectionRecordQueryWrapper.eq("house_id", houseId);
778
+                preselectionRecordQueryWrapper.eq("person_id", personId);
779
+                TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
780
+                if (null == taPreselectionRecord) {
781
+                    throw new Exception("需要先预选才能认筹");
782
+                }
783
+            }
784
+            //查询我的认筹记录表
785
+            QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
786
+            taRaiseHouseQueryWrapper.eq("org_id", orgId);
787
+            taRaiseHouseQueryWrapper.eq("house_id", houseId);
788
+            taRaiseHouseQueryWrapper.eq("person_id", personId);
789
+            List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
790
+            if (list.size() > 0) {
791
+                throw new Exception("您已有认筹单包含当前房源");
792
+            }
793
+
794
+        }
755 795
         if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL) {
756 796
             throw new Exception("房源已被取消发布");
757 797
         }
@@ -768,30 +808,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
768 808
             throw new Exception("销售批次已被取消发布");
769 809
         }
770 810
 
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 811
         //判断是否在时间之内
794
-
795 812
         LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
796 813
         LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
797 814
         LocalDateTime now = LocalDateTime.now();
@@ -799,17 +816,6 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
799 816
             throw new Exception("不在认筹时间内");
800 817
         }
801 818
 
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 819
         return true;
814 820
     }
815 821