|
|
@@ -8,6 +8,7 @@ import com.happy.Until.DateUtil;
|
|
|
import com.happy.Until.Enum.PayEnum;
|
|
|
import com.happy.Until.Func;
|
|
|
import com.happy.Until.HttpUtils;
|
|
|
+import com.happy.Until.UUIDUtil;
|
|
|
import com.happy.dao.BookDao;
|
|
|
import com.happy.dto.BookTypeEto;
|
|
|
import com.happy.dto.IPage;
|
|
|
@@ -24,6 +25,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
@Service("BookService")
|
|
|
public class BookImplService implements BookService {
|
|
|
@@ -32,6 +34,7 @@ public class BookImplService implements BookService {
|
|
|
public BookDao bookDao;
|
|
|
@Resource
|
|
|
public BookinglogService bookinglogService;
|
|
|
+
|
|
|
@Resource
|
|
|
public AdminManagerService adminManagerService;
|
|
|
|
|
|
@@ -182,9 +185,10 @@ public class BookImplService implements BookService {
|
|
|
HotelDict operate = hotelDictService.getById(1997956736);//响应时间 1自动接单 2自动拒单
|
|
|
String sqlx = " and create_time <= DATE_SUB(NOW(), INTERVAL " + times + " MINUTE) and order_status = 2 ";
|
|
|
List<Booking> bookings = bookDao.queryList(sqlx);
|
|
|
- List<HouseNumberStatus> list = new ArrayList<>();
|
|
|
+ AtomicInteger n = new AtomicInteger();
|
|
|
if (operate.getCode() == 1){
|
|
|
bookings.forEach(booking -> {
|
|
|
+ List<HouseNumberStatus> list = new ArrayList<>();
|
|
|
//不可入住的房间
|
|
|
List<HouseNumber> houseNumbers = houseNumberService.queryHouseStatus(booking);
|
|
|
//所有房间
|
|
|
@@ -199,6 +203,15 @@ public class BookImplService implements BookService {
|
|
|
i.getAndIncrement();
|
|
|
}
|
|
|
});
|
|
|
+ }else {
|
|
|
+ //所有房间都可以预定
|
|
|
+ houseNumberList.forEach(houseNumber -> {
|
|
|
+ //添加的房间不在不可添加的房间当中并且数量小于订房总数
|
|
|
+ if (i.get() < booking.getHouseOrderNumber()){
|
|
|
+ Ids.add(houseNumber.getId());
|
|
|
+ i.getAndIncrement();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
@@ -229,8 +242,15 @@ public class BookImplService implements BookService {
|
|
|
list.add(houseNumberStatus);
|
|
|
}
|
|
|
}
|
|
|
+ int m = houseNumberStatusService.saveBatch(list);
|
|
|
+ if (m > 0){
|
|
|
+ n.getAndIncrement();
|
|
|
+ booking.setOrderStatus("3");
|
|
|
+ booking.setUpdateTime(UUIDUtil.getNewDate());
|
|
|
+ bookDao.updateBooking(booking);
|
|
|
+ }
|
|
|
});
|
|
|
- return houseNumberStatusService.saveBatch(list);
|
|
|
+ return n.get();
|
|
|
}else {
|
|
|
String ip = request.getServerName();
|
|
|
ip += "/mhotel/abkchargeback.action";
|