傅行帆 5 年之前
父節點
當前提交
8089771483
共有 1 個檔案被更改,包括 20 行新增4 行删除
  1. 20
    4
      src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java

+ 20
- 4
src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java 查看文件

107
         TaRaise taRaise = taRaiseMapper.selectById(taRaiseRecord.getRaiseId());
107
         TaRaise taRaise = taRaiseMapper.selectById(taRaiseRecord.getRaiseId());
108
         //如果是自动锁房就要判断里面的房源有没有被锁住
108
         //如果是自动锁房就要判断里面的房源有没有被锁住
109
         if (taRaise.getHouseLockingType().equals(CommConstant.HOUSE_LOCKING_TYPE_AUTO)) {
109
         if (taRaise.getHouseLockingType().equals(CommConstant.HOUSE_LOCKING_TYPE_AUTO)) {
110
-            if (houseList.size() > 0) {
110
+            if (houseList.size() > 1) {
111
                 throw new Exception("此认筹为自动锁房只能选择一个房源!");
111
                 throw new Exception("此认筹为自动锁房只能选择一个房源!");
112
             }
112
             }
113
             //获取房源详细信息
113
             //获取房源详细信息
115
             if (null == taHousingResources) {
115
             if (null == taHousingResources) {
116
                 throw new Exception("此房源不存在!");
116
                 throw new Exception("此房源不存在!");
117
             }
117
             }
118
-            if (taHousingResources.getHouseLockingStatus().equals(CommConstant.HOUSE_LOCKING_STATUS_LOCKED)) {
118
+            if (CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())) {
119
                 throw new Exception("此房源已被锁定!");
119
                 throw new Exception("此房源已被锁定!");
120
             }
120
             }
121
             //检验成功的话先锁定房源
121
             //检验成功的话先锁定房源
122
             lockedHouseResources(taHousingResources);
122
             lockedHouseResources(taHousingResources);
123
         }
123
         }
124
+        //判断销售批次是否是发布状态和房源是否正常状态
125
+        checkHouseStatus(taRaiseRecord,orgId, personId, taRaise);
126
+        //判断我是否认筹过这些房源
127
+
124
         //插入认筹单
128
         //插入认筹单
125
         saveRaiseRecord(taRaiseRecord, orgId, personId, taRaise);
129
         saveRaiseRecord(taRaiseRecord, orgId, personId, taRaise);
126
 
130
 
127
         return taRaiseRecord;
131
         return taRaiseRecord;
128
     }
132
     }
129
 
133
 
134
+    //判断销售批次是否是发布状态和房源是否正常状态
135
+    private void checkHouseStatus(TaRaiseRecord taRaiseRecord, Integer orgId, String personId, TaRaise taRaise) throws Exception {
136
+        //销售批次是否有效状态
137
+        TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(taRaise.getSalesBatchId());
138
+        if (!taSalesBatch.getStatus().equals(CommConstant.STATUS_NORMAL)){
139
+            throw new Exception("此销售批次已经取消发布!");
140
+        }
141
+        //
142
+    }
143
+
130
     @Override
144
     @Override
131
     public TaRaiseRecord getUserInfo(Integer raiseRecordId, Integer orgId) {
145
     public TaRaiseRecord getUserInfo(Integer raiseRecordId, Integer orgId) {
132
         return taRaiseRecordMapper.getUserInfo(raiseRecordId, orgId);
146
         return taRaiseRecordMapper.getUserInfo(raiseRecordId, orgId);
182
             taRaiseHouse.setCreateDate(LocalDateTime.now());
196
             taRaiseHouse.setCreateDate(LocalDateTime.now());
183
             if (taRaise.getHouseLockingType().equals(CommConstant.HOUSE_LOCKING_TYPE_AUTO)) {
197
             if (taRaise.getHouseLockingType().equals(CommConstant.HOUSE_LOCKING_TYPE_AUTO)) {
184
                 taRaiseHouse.setHouseLockingStatus(CommConstant.HOUSE_LOCKING_STATUS_LOCKED);
198
                 taRaiseHouse.setHouseLockingStatus(CommConstant.HOUSE_LOCKING_STATUS_LOCKED);
199
+                taRaiseHouse.setPersonId(personId);
200
+                taRaiseHouse.setPersonName(taPerson.getName());
201
+            }else{
202
+                taRaiseHouse.setHouseLockingStatus(CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED);
185
             }
203
             }
186
             taRaiseHouse.setOrgId(orgId);
204
             taRaiseHouse.setOrgId(orgId);
187
-            taRaiseHouse.setPersonId(personId);
188
-            taRaiseHouse.setPersonName(taPerson.getName());
189
             taRaiseHouse.setRaiseRecordId(taRaiseRecord.getRaiseRecordId());
205
             taRaiseHouse.setRaiseRecordId(taRaiseRecord.getRaiseRecordId());
190
             taRaiseHouseMapper.insert(taRaiseHouse);
206
             taRaiseHouseMapper.insert(taRaiseHouse);
191
         });
207
         });