|
@@ -1,192 +1,199 @@
|
|
|
-//package com.happy.service.impl;
|
|
|
|
|
-//
|
|
|
|
|
-//import com.baidubce.model.User;
|
|
|
|
|
-//import com.happy.Model.AdminManager;
|
|
|
|
|
-//import com.happy.Model.Booking;
|
|
|
|
|
-//import com.happy.Model.Hotel;
|
|
|
|
|
-//import com.happy.Model.House;
|
|
|
|
|
-//import com.happy.Model.weixin.Users;
|
|
|
|
|
-//import com.happy.Until.DateUtil;
|
|
|
|
|
-//import com.happy.Until.Enum.OrderEnum;
|
|
|
|
|
-//import com.happy.Until.Enum.PayEnum;
|
|
|
|
|
-//import com.happy.Until.Func;
|
|
|
|
|
-//import com.happy.Until.TimeExchange;
|
|
|
|
|
-//import com.happy.common.wx.WxUtil;
|
|
|
|
|
-//import com.happy.constant.ResultStatusCode;
|
|
|
|
|
-//import com.happy.dao.BookDao;
|
|
|
|
|
-//import com.happy.dto.IPage;
|
|
|
|
|
-//import com.happy.service.*;
|
|
|
|
|
-//import org.springframework.stereotype.Service;
|
|
|
|
|
-//
|
|
|
|
|
-//import javax.annotation.Resource;
|
|
|
|
|
-//import java.util.HashMap;
|
|
|
|
|
-//import java.util.List;
|
|
|
|
|
-//import java.util.Map;
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//@Service("AppBookService")
|
|
|
|
|
-//public class AppBookImplService implements AppBookService {
|
|
|
|
|
-//
|
|
|
|
|
-// @Resource
|
|
|
|
|
-// public BookService bookService;
|
|
|
|
|
-// @Resource
|
|
|
|
|
-// public HotelService hotelService;
|
|
|
|
|
-// @Resource
|
|
|
|
|
-// public HouseService houseService;
|
|
|
|
|
-// @Resource
|
|
|
|
|
-// public UserService userService;
|
|
|
|
|
-// @Resource
|
|
|
|
|
-// public AdminManagerService adminManagerService;
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public String createOrder(String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
|
|
|
|
|
-// if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
|
|
|
|
|
-// ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
|
|
|
|
|
-// return null;
|
|
|
|
|
-//
|
|
|
|
|
-// House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
-// StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
-// s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
|
|
|
|
|
-// Hotel hotel = hotelService.getOen(s1.toString());
|
|
|
|
|
-// Users user = userService.queryByUserId(userId);
|
|
|
|
|
-// AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
|
|
|
|
|
-// if (house == null || hotel == null || user == null || adminManager == null)
|
|
|
|
|
-// return "无法获取数据";
|
|
|
|
|
-//
|
|
|
|
|
-// Booking booking = new Booking();
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置民宿信息
|
|
|
|
|
-// booking.setHotelName(hotel.getHname());
|
|
|
|
|
-// booking.setHotelHposition(hotel.getHposition());
|
|
|
|
|
-// booking.setHotelHpositionWens(hotel.getHpositionWens());
|
|
|
|
|
-// booking.setHotelManagerId(hotel.getManagerId());
|
|
|
|
|
-// booking.setHotelTownship(adminManager.getHotelTownship());
|
|
|
|
|
-// booking.setHotelConfig(hotel.getHconfig());
|
|
|
|
|
-// booking.setHotelType(hotel.getHtype());
|
|
|
|
|
-// booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
|
|
|
|
|
-// booking.setHotelManagerId(house.getManagerId());
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置房型信息
|
|
|
|
|
-// booking.setHouseId(Func.parseStr(house.getId()));
|
|
|
|
|
-// booking.setHouseName(house.gethName());
|
|
|
|
|
-// booking.setHouseConfig(house.gethConfig());
|
|
|
|
|
-// booking.setHouseUnitPrice(house.getPrice());
|
|
|
|
|
-// booking.setHouseOrderNumber(Func.parseInt(houseOrderNumber));
|
|
|
|
|
-// booking.setHouseAreas(house.gethAreas());
|
|
|
|
|
-// booking.setHouseRemake(house.getRemark());
|
|
|
|
|
-// double totalPrice = Func.parseInt(houseOrderNumber) * house.getPrice();
|
|
|
|
|
-// booking.setHouseTotalPrice(totalPrice);
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置住客信息
|
|
|
|
|
-// booking.setUserName(userName);
|
|
|
|
|
-// booking.setUserPhone(userPhone);
|
|
|
|
|
-// booking.setOrderStartTime(startTime);
|
|
|
|
|
-// booking.setOrderEndTime(endTime);
|
|
|
|
|
-// int day = DateUtil.getDayDiff(startTime,endTime);
|
|
|
|
|
-// String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
|
|
|
|
|
-// booking.setOrderLiveTime(orderLiveTime);
|
|
|
|
|
-//
|
|
|
|
|
-// // 订单信息
|
|
|
|
|
-// booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
|
|
|
|
|
-// booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 1待支付状态
|
|
|
|
|
-// booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
|
|
|
|
|
-// int i = bookService.insertBooking(booking);
|
|
|
|
|
-// if ( i == 0)
|
|
|
|
|
-// return ResultStatusCode.CANNTBOOKING.CANNTBOOKING.getMsg();
|
|
|
|
|
-//
|
|
|
|
|
-// return null;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public String reCreateOrder(String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
|
|
|
|
|
-// if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
|
|
|
|
|
-// ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
|
|
|
|
|
-// return null;
|
|
|
|
|
-//
|
|
|
|
|
-// House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
-// StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
-// s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
|
|
|
|
|
-// Hotel hotel = hotelService.getOen(s1.toString());
|
|
|
|
|
-// Users user = userService.queryByUserId(userId);
|
|
|
|
|
-// AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
|
|
|
|
|
-// if (house == null || hotel == null || user == null || adminManager == null)
|
|
|
|
|
-// return "无法获取数据";
|
|
|
|
|
-//
|
|
|
|
|
-// Booking booking = new Booking();
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置民宿信息
|
|
|
|
|
-// booking.setHotelName(hotel.getHname());
|
|
|
|
|
-// booking.setHotelHposition(hotel.getHposition());
|
|
|
|
|
-// booking.setHotelHpositionWens(hotel.getHpositionWens());
|
|
|
|
|
-// booking.setHotelManagerId(hotel.getManagerId());
|
|
|
|
|
-// booking.setHotelTownship(adminManager.getHotelTownship());
|
|
|
|
|
-// booking.setHotelConfig(hotel.getHconfig());
|
|
|
|
|
-// booking.setHotelType(hotel.getHtype());
|
|
|
|
|
-// booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
|
|
|
|
|
-// booking.setHotelManagerId(house.getManagerId());
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置房型信息
|
|
|
|
|
-// booking.setHouseId(Func.parseStr(house.getId()));
|
|
|
|
|
-// booking.setHouseName(house.gethName());
|
|
|
|
|
-// booking.setHouseConfig(house.gethConfig());
|
|
|
|
|
-// booking.setHouseUnitPrice(house.getPrice());
|
|
|
|
|
-// booking.setHouseOrderNumber(Func.parseInt(houseOrderNumber));
|
|
|
|
|
-// booking.setHouseAreas(house.gethAreas());
|
|
|
|
|
-// booking.setHouseRemake(house.getRemark());
|
|
|
|
|
-// double totalPrice = Func.parseInt(houseOrderNumber) * house.getPrice();
|
|
|
|
|
-// booking.setHouseTotalPrice(totalPrice);
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置住客信息
|
|
|
|
|
-// booking.setUserName(userName);
|
|
|
|
|
-// booking.setUserPhone(userPhone);
|
|
|
|
|
-// booking.setOrderStartTime(startTime);
|
|
|
|
|
-// booking.setOrderEndTime(endTime);
|
|
|
|
|
-// int day = DateUtil.getDayDiff(startTime,endTime);
|
|
|
|
|
-// String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
|
|
|
|
|
-// booking.setOrderLiveTime(orderLiveTime);
|
|
|
|
|
-//
|
|
|
|
|
-// // 订单信息
|
|
|
|
|
-// booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
|
|
|
|
|
-// booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 待支付状态
|
|
|
|
|
-// booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
|
|
|
|
|
-// bookService.insertBooking(booking);
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// return null;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public String varificationHouse(String houseId, String startTime, String endTime) {
|
|
|
|
|
-//
|
|
|
|
|
-// House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
-// if (house == null)
|
|
|
|
|
-// return "无此房间,请重新查询";
|
|
|
|
|
-//
|
|
|
|
|
-// // 判断是否有房间,对每个房型进行标识
|
|
|
|
|
-// StringBuffer strSqlBook = new StringBuffer();
|
|
|
|
|
-// strSqlBook.append(" and house_id = '").append(house.getId()).append("' ");
|
|
|
|
|
-// strSqlBook.append(" and hotel_manager_id = '").append(house.getManagerId()).append("' ");
|
|
|
|
|
-// strSqlBook.append(" and order_start_time >= '").append(startTime).append("' ");
|
|
|
|
|
-// strSqlBook.append(" and order_end_time < '").append(endTime).append("' ");
|
|
|
|
|
-//
|
|
|
|
|
-// //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
|
|
|
|
|
-// strSqlBook.append(" and order_status = '").append(PayEnum.ONE.getNum()).append("' ");
|
|
|
|
|
-// strSqlBook.append(" or order_status = '").append(PayEnum.TWO.getNum()).append("' ");
|
|
|
|
|
-// strSqlBook.append(" or order_status = '").append(PayEnum.THREE.getNum()).append("' ");
|
|
|
|
|
-// strSqlBook.append(" or order_status = '").append(PayEnum.FOUR.getNum()).append("' ");
|
|
|
|
|
-//
|
|
|
|
|
-// List<Booking> bookList = bookService.queryList(strSqlBook.toString());
|
|
|
|
|
-//
|
|
|
|
|
-// int totalNum = 0;
|
|
|
|
|
-// for (Booking booking: bookList) {
|
|
|
|
|
-// if (Func.checkNull(booking.getHouseId()))
|
|
|
|
|
-// continue;
|
|
|
|
|
-//
|
|
|
|
|
-// totalNum += booking.getHouseOrderNumber();
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// if (totalNum >= house.getNumber())
|
|
|
|
|
-// return OrderEnum.房间已满.toString();
|
|
|
|
|
-// return null;
|
|
|
|
|
-// }
|
|
|
|
|
-//}
|
|
|
|
|
|
|
+package com.happy.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.baidubce.model.User;
|
|
|
|
|
+import com.happy.Model.AdminManager;
|
|
|
|
|
+import com.happy.Model.Booking;
|
|
|
|
|
+import com.happy.Model.Hotel;
|
|
|
|
|
+import com.happy.Model.House;
|
|
|
|
|
+import com.happy.Model.weixin.Users;
|
|
|
|
|
+import com.happy.Until.DateUtil;
|
|
|
|
|
+import com.happy.Until.Enum.OrderEnum;
|
|
|
|
|
+import com.happy.Until.Enum.PayEnum;
|
|
|
|
|
+import com.happy.Until.Func;
|
|
|
|
|
+import com.happy.Until.TimeExchange;
|
|
|
|
|
+import com.happy.Until.UUIDUtil;
|
|
|
|
|
+import com.happy.common.wx.WxUtil;
|
|
|
|
|
+import com.happy.constant.ResultStatusCode;
|
|
|
|
|
+import com.happy.dao.BookDao;
|
|
|
|
|
+import com.happy.dto.IPage;
|
|
|
|
|
+import com.happy.service.*;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@Service("AppBookService")
|
|
|
|
|
+public class AppBookImplService implements AppBookService {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public BookService bookService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public HotelService hotelService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public HouseService houseService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public UserService userService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public AdminManagerService adminManagerService;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String createOrder(String bookingId, String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
|
|
|
|
|
+ if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
|
|
|
|
|
+ ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
|
|
|
|
|
+ return null;
|
|
|
|
|
+
|
|
|
|
|
+ House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
+ s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
|
|
|
|
|
+ Hotel hotel = hotelService.getOen(s1.toString());
|
|
|
|
|
+ Users user = userService.queryByUserId(userId);
|
|
|
|
|
+ AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
|
|
|
|
|
+ if (house == null || hotel == null || user == null || adminManager == null)
|
|
|
|
|
+ return "无法获取数据";
|
|
|
|
|
+
|
|
|
|
|
+ Booking booking = new Booking();
|
|
|
|
|
+
|
|
|
|
|
+ // 设置民宿信息
|
|
|
|
|
+ booking.setHouseId(Func.parseStr(hotel.getId()));
|
|
|
|
|
+ booking.setHotelName(hotel.getHname());
|
|
|
|
|
+ booking.setHotelHposition(hotel.getHposition());
|
|
|
|
|
+ booking.setHotelHpositionWens(hotel.getHpositionWens());
|
|
|
|
|
+ booking.setHotelManagerId(hotel.getManagerId());
|
|
|
|
|
+ booking.setHotelTownship(adminManager.getHotelTownship());
|
|
|
|
|
+ booking.setHotelConfig(hotel.getHconfig());
|
|
|
|
|
+ booking.setHotelType(hotel.getHtype());
|
|
|
|
|
+ booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
|
|
|
|
|
+ booking.setHotelManagerId(house.getManagerId());
|
|
|
|
|
+ booking.setHotelPhone(adminManager.getCorpnPhone());
|
|
|
|
|
+ booking.setHotelPerson(adminManager.getCorpnName());
|
|
|
|
|
+
|
|
|
|
|
+ // 设置房型信息
|
|
|
|
|
+ booking.setHouseId(Func.parseStr(house.getId()));
|
|
|
|
|
+ booking.setHouseName(house.gethName());
|
|
|
|
|
+ booking.setHouseConfig(house.gethConfig());
|
|
|
|
|
+ booking.setHouseUnitPrice(house.getPrice());
|
|
|
|
|
+ booking.setHouseOrderNumber(Func.parseInt(houseOrderNumber));
|
|
|
|
|
+ booking.setHouseAreas(house.gethAreas());
|
|
|
|
|
+ booking.setHouseRemake(house.getRemark());
|
|
|
|
|
+ double totalPrice = Func.parseInt(houseOrderNumber) * house.getPrice();
|
|
|
|
|
+ booking.setHouseTotalPrice(totalPrice);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 设置住客信息
|
|
|
|
|
+ booking.setUserName(userName);
|
|
|
|
|
+ booking.setUserPhone(userPhone);
|
|
|
|
|
+ booking.setOrderStartTime(startTime);
|
|
|
|
|
+ booking.setOrderEndTime(endTime);
|
|
|
|
|
+ int day = DateUtil.getDayDiff(startTime,endTime);
|
|
|
|
|
+ String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
|
|
|
|
|
+ booking.setOrderLiveTime(orderLiveTime);
|
|
|
|
|
+
|
|
|
|
|
+ // 订单信息
|
|
|
|
|
+ booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
|
|
|
|
|
+ booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 1待支付状态
|
|
|
|
|
+ booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
|
|
|
|
|
+ booking.setCreateUserid(userId);
|
|
|
|
|
+ booking.setId(Func.parseInt(bookingId));
|
|
|
|
|
+ int i = bookService.insertBooking(booking);
|
|
|
|
|
+ if ( i == 0)
|
|
|
|
|
+ return ResultStatusCode.CANNTBOOKING.CANNTBOOKING.getMsg();
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String reCreateOrder(String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
|
|
|
|
|
+ if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
|
|
|
|
|
+ ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
|
|
|
|
|
+ return null;
|
|
|
|
|
+
|
|
|
|
|
+ House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
+ s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
|
|
|
|
|
+ Hotel hotel = hotelService.getOen(s1.toString());
|
|
|
|
|
+ Users user = userService.queryByUserId(userId);
|
|
|
|
|
+ AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
|
|
|
|
|
+ if (house == null || hotel == null || user == null || adminManager == null)
|
|
|
|
|
+ return "无法获取数据";
|
|
|
|
|
+
|
|
|
|
|
+ Booking booking = new Booking();
|
|
|
|
|
+
|
|
|
|
|
+ // 设置民宿信息
|
|
|
|
|
+ booking.setHotelName(hotel.getHname());
|
|
|
|
|
+ booking.setHotelHposition(hotel.getHposition());
|
|
|
|
|
+ booking.setHotelHpositionWens(hotel.getHpositionWens());
|
|
|
|
|
+ booking.setHotelManagerId(hotel.getManagerId());
|
|
|
|
|
+ booking.setHotelTownship(adminManager.getHotelTownship());
|
|
|
|
|
+ booking.setHotelConfig(hotel.getHconfig());
|
|
|
|
|
+ booking.setHotelType(hotel.getHtype());
|
|
|
|
|
+ booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
|
|
|
|
|
+ booking.setHotelManagerId(house.getManagerId());
|
|
|
|
|
+
|
|
|
|
|
+ // 设置房型信息
|
|
|
|
|
+ booking.setHouseId(Func.parseStr(house.getId()));
|
|
|
|
|
+ booking.setHouseName(house.gethName());
|
|
|
|
|
+ booking.setHouseConfig(house.gethConfig());
|
|
|
|
|
+ booking.setHouseUnitPrice(house.getPrice());
|
|
|
|
|
+ booking.setHouseOrderNumber(Func.parseInt(houseOrderNumber));
|
|
|
|
|
+ booking.setHouseAreas(house.gethAreas());
|
|
|
|
|
+ booking.setHouseRemake(house.getRemark());
|
|
|
|
|
+ double totalPrice = Func.parseInt(houseOrderNumber) * house.getPrice();
|
|
|
|
|
+ booking.setHouseTotalPrice(totalPrice);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置住客信息
|
|
|
|
|
+ booking.setUserName(userName);
|
|
|
|
|
+ booking.setUserPhone(userPhone);
|
|
|
|
|
+ booking.setOrderStartTime(startTime);
|
|
|
|
|
+ booking.setOrderEndTime(endTime);
|
|
|
|
|
+ int day = DateUtil.getDayDiff(startTime,endTime);
|
|
|
|
|
+ String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
|
|
|
|
|
+ booking.setOrderLiveTime(orderLiveTime);
|
|
|
|
|
+
|
|
|
|
|
+ // 订单信息
|
|
|
|
|
+ booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
|
|
|
|
|
+ booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 待支付状态
|
|
|
|
|
+ booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
|
|
|
|
|
+ bookService.insertBooking(booking);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String varificationHouse(String houseId, String startTime, String endTime) {
|
|
|
|
|
+
|
|
|
|
|
+ House house = houseService.getById(Func.parseInt(houseId));
|
|
|
|
|
+ if (house == null)
|
|
|
|
|
+ return "无此房间,请重新查询";
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否有房间,对每个房型进行标识
|
|
|
|
|
+ StringBuffer strSqlBook = new StringBuffer();
|
|
|
|
|
+ strSqlBook.append(" and house_id = '").append(house.getId()).append("' ");
|
|
|
|
|
+ strSqlBook.append(" and hotel_manager_id = '").append(house.getManagerId()).append("' ");
|
|
|
|
|
+ strSqlBook.append(" and order_start_time >= '").append(startTime).append("' ");
|
|
|
|
|
+ strSqlBook.append(" and order_end_time < '").append(endTime).append("' ");
|
|
|
|
|
+
|
|
|
|
|
+ //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
|
|
|
|
|
+ strSqlBook.append(" and order_status = '").append(PayEnum.ONE.getNum()).append("' ");
|
|
|
|
|
+ strSqlBook.append(" or order_status = '").append(PayEnum.TWO.getNum()).append("' ");
|
|
|
|
|
+ strSqlBook.append(" or order_status = '").append(PayEnum.THREE.getNum()).append("' ");
|
|
|
|
|
+ strSqlBook.append(" or order_status = '").append(PayEnum.FOUR.getNum()).append("' ");
|
|
|
|
|
+
|
|
|
|
|
+ List<Booking> bookList = bookService.queryList(strSqlBook.toString());
|
|
|
|
|
+
|
|
|
|
|
+ int totalNum = 0;
|
|
|
|
|
+ for (Booking booking: bookList) {
|
|
|
|
|
+ if (Func.checkNull(booking.getHouseId()))
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ totalNum += booking.getHouseOrderNumber();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (totalNum >= house.getNumber())
|
|
|
|
|
+ return OrderEnum.房间已满.toString();
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|