From c568e918936a322baa91991c5d154b5ec441453b Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 27 九月 2020 09:14:34 +0800
Subject: [PATCH] 优化 再次出租bug

---
 service-user/src/main/java/com/java110/user/bmo/rentingPool/impl/SaveRentingPoolBMOImpl.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/bmo/rentingPool/impl/SaveRentingPoolBMOImpl.java b/service-user/src/main/java/com/java110/user/bmo/rentingPool/impl/SaveRentingPoolBMOImpl.java
index 974e5c0..248a843 100644
--- a/service-user/src/main/java/com/java110/user/bmo/rentingPool/impl/SaveRentingPoolBMOImpl.java
+++ b/service-user/src/main/java/com/java110/user/bmo/rentingPool/impl/SaveRentingPoolBMOImpl.java
@@ -2,6 +2,7 @@
 
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.rentingPool.RentingPoolDto;
 import com.java110.intf.user.IRentingPoolInnerServiceSMO;
 import com.java110.po.rentingPool.RentingPoolPo;
 import com.java110.user.bmo.rentingPool.ISaveRentingPoolBMO;
@@ -9,6 +10,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 @Service("saveRentingPoolBMOImpl")
 public class SaveRentingPoolBMOImpl implements ISaveRentingPoolBMO {
@@ -25,6 +28,17 @@
     @Java110Transactional
     public ResponseEntity<String> save(RentingPoolPo rentingPoolPo) {
 
+        //鏌ヨ 鏄惁宸茬粡瀛樺湪 鎴垮眿寰呭嚭绉熺殑鏁版嵁
+        RentingPoolDto rentingPoolDto = new RentingPoolDto();
+        rentingPoolDto.setCommunityId(rentingPoolPo.getCommunityId());
+        rentingPoolDto.setRoomId(rentingPoolPo.getRoomId());
+        rentingPoolDto.setStates(new String[]{"0", "1", "2", "3", "4", "5", "7"});
+        List<RentingPoolDto> rentingPoolDtos = rentingPoolInnerServiceSMOImpl.queryRentingPools(rentingPoolDto);
+
+        if (rentingPoolDtos != null && rentingPoolDtos.size() > 0) {
+            throw new IllegalArgumentException("璇ユ埧灞嬪綋鍓嶄负" + rentingPoolDtos.get(0).getStateName() + ",涓嶈兘鍐嶆鍑虹");
+        }
+
         rentingPoolPo.setRentingId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_rentingId));
         int flag = rentingPoolInnerServiceSMOImpl.saveRentingPool(rentingPoolPo);
 

--
Gitblit v1.8.0