Browse Source

定时程序

夏文涛 2 years ago
parent
commit
dc093d5f5a
1 changed files with 16 additions and 3 deletions
  1. 16 3
      mhotel/src/com/happy/action/bookAction.java

+ 16 - 3
mhotel/src/com/happy/action/bookAction.java

@@ -845,16 +845,29 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
      */
      */
     public void setBookStatus(){
     public void setBookStatus(){
 
 
+        System.out.println("自动接单定时程序");
+
         HotelDict respTime = hotelDictService.getById(1000011001);//响应时间
         HotelDict respTime = hotelDictService.getById(1000011001);//响应时间
+
+        System.out.println("自动接单定时程序1");
+
         HotelDict operate = hotelDictService.getById(1000011002);//响应时间 1自动接单 2自动拒单
         HotelDict operate = hotelDictService.getById(1000011002);//响应时间 1自动接单 2自动拒单
+
+        System.out.println("自动接单定时程序2");
+
         String sqlx = " and create_time <= DATE_SUB(NOW(), INTERVAL " + respTime.getName() + " MINUTE) and order_status = 2 and hotel_is_order = 1";
         String sqlx = " and create_time <= DATE_SUB(NOW(), INTERVAL " + respTime.getName() + " MINUTE) and order_status = 2 and hotel_is_order = 1";
         List<Booking> bookings = bookService.queryList(sqlx);
         List<Booking> bookings = bookService.queryList(sqlx);
 
 
-        System.out.println("自动接单,订单编号"+bookings.stream().map(Booking::getOrderNum)+";拼接条件:"+sqlx);
+        System.out.println("自动接单定时程序3:"+sqlx);
+
+        String result =bookings == null ? "" : bookings.stream().map(Booking::getOrderNum).collect(Collectors.joining());
+
+        System.out.println("自动接单,订单编号:"+result+";拼接条件:"+sqlx);
 
 
         AtomicInteger n = new AtomicInteger();
         AtomicInteger n = new AtomicInteger();
         if ("1".equals(operate.getName())){
         if ("1".equals(operate.getName())){
-            bookings.forEach(booking -> {
+
+            for (Booking booking:bookings) {
                 List<HouseNumberStatus> list = new ArrayList<>();
                 List<HouseNumberStatus> list = new ArrayList<>();
                 //不可入住的房间
                 //不可入住的房间
                 List<HouseNumber> houseNumbers = houseNumberService.queryHouseStatus(booking);
                 List<HouseNumber> houseNumbers = houseNumberService.queryHouseStatus(booking);
@@ -916,7 +929,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
                     booking.setUpdateTime(UUIDUtil.getNewDate());
                     booking.setUpdateTime(UUIDUtil.getNewDate());
                     bookService.updateBooking(booking);
                     bookService.updateBooking(booking);
                 }
                 }
-            });
+            }
         }else {
         }else {
             HotelDict dict = hotelDictService.getById(1000011999);
             HotelDict dict = hotelDictService.getById(1000011999);
             bookings.forEach(booking -> {
             bookings.forEach(booking -> {