|
@@ -1,10 +1,8 @@
|
|
|
package com.happy.service.impl;
|
|
package com.happy.service.impl;
|
|
|
|
|
|
|
|
import com.happy.Model.Booking;
|
|
import com.happy.Model.Booking;
|
|
|
-import com.happy.Model.House;
|
|
|
|
|
-import com.happy.Until.TimeExchange;
|
|
|
|
|
import com.happy.dao.BookDao;
|
|
import com.happy.dao.BookDao;
|
|
|
-import com.happy.dao.HouseDao;
|
|
|
|
|
|
|
+import com.happy.dto.IPage;
|
|
|
import com.happy.service.BookService;
|
|
import com.happy.service.BookService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@@ -16,86 +14,49 @@ public class BookImplService implements BookService {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
public BookDao bookDao;
|
|
public BookDao bookDao;
|
|
|
- @Resource
|
|
|
|
|
- public HouseDao houseDao;
|
|
|
|
|
-
|
|
|
|
|
- public int insert(Booking booking){
|
|
|
|
|
- return bookDao.insert(booking);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修改预定状态
|
|
|
|
|
- public int update(String status,String dom,int id){
|
|
|
|
|
- return bookDao.update(status,dom, id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修改支付状态
|
|
|
|
|
- public int update_pay(String status,String order_num){
|
|
|
|
|
- return bookDao.update_pay(status, order_num);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 删除订单
|
|
|
|
|
- public int del(int id){
|
|
|
|
|
- return bookDao.del(id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public Booking queryBookById(int id){
|
|
|
|
|
- return bookDao.queryBookById(id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public List<Booking> queryBookPage(String sqlx, int page, int rows){
|
|
|
|
|
- return bookDao.queryBookPage(sqlx, page, rows);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 查询用户表中的总记录数
|
|
|
|
|
- public int queryBookTotal(String sqlx){
|
|
|
|
|
- return bookDao.queryBookTotal(sqlx);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- // 导出订单数据
|
|
|
|
|
- public List<Booking> queryBooks(String sqlx){
|
|
|
|
|
- return bookDao.queryBooks(sqlx);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int insertBooking(Booking book) {
|
|
|
|
|
+ return bookDao.insertBooking(book);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 查看每天未完成的订单与修改后的数量比较
|
|
|
|
|
- public boolean queryOrdering(String h_type,int num){
|
|
|
|
|
- List<String> use_times = TimeExchange.getHighTime();
|
|
|
|
|
- for (int i = 0; i < use_times.size(); i++) {
|
|
|
|
|
- // 当天已租出去的房间数量
|
|
|
|
|
- List<Booking> list = bookDao.queryOrdering(h_type,use_times.get(i));
|
|
|
|
|
- System.out.println(list);
|
|
|
|
|
- if (list!=null && list.size()>num){
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int updateBooking(Booking book) {
|
|
|
|
|
+ return bookDao.updateBooking(book);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public List<Booking> queryOrderByType(String h_type){
|
|
|
|
|
- return bookDao.queryOrderByType(h_type);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int delBooking(int id) {
|
|
|
|
|
+ return bookDao.delBooking(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 查看是否有空房
|
|
|
|
|
- public boolean querySpare(String h_type,List<String> times){
|
|
|
|
|
-// House house = houseDao.queryByType(h_type);
|
|
|
|
|
-// for (int i = 0; i < times.size(); i++) {
|
|
|
|
|
-// List<Booking> list = bookDao.querySpare(h_type,times.get(i));
|
|
|
|
|
-// if (list!=null && list.size()>=house.getNumber()){
|
|
|
|
|
-// return false;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Booking getById(int id) {
|
|
|
|
|
+ return bookDao.getById(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public Booking queryByOrder(String order_num){
|
|
|
|
|
- return bookDao.queryByOrder(order_num);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<Booking> queryPage(String sqlx, int page, int rows) {
|
|
|
|
|
+ IPage<Booking> iPage = new IPage();
|
|
|
|
|
+ List<Booking> bookList = bookDao.queryPage(sqlx,page,rows);
|
|
|
|
|
+ int total = bookDao.queryTotal(sqlx);
|
|
|
|
|
+ iPage.setPageList(bookList);
|
|
|
|
|
+ iPage.setPage(page);
|
|
|
|
|
+ iPage.setTotalPage( (int)Math.ceil((double)total/rows));
|
|
|
|
|
+ iPage.setRows(rows);
|
|
|
|
|
+ iPage.setTotal(total);
|
|
|
|
|
+ return iPage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 查询已入住且截至的订单
|
|
|
|
|
- public List<Booking> queryEnd(String date){
|
|
|
|
|
- return bookDao.queryEnd(date);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Booking> queryList(String sqlx) {
|
|
|
|
|
+ return bookDao.queryList(sqlx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public List<Booking> queryByCard(String card_number,String status){
|
|
|
|
|
- return bookDao.queryByCard(card_number, status);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Booking getOen(String sqlx){
|
|
|
|
|
+ List<Booking> list = bookDao.queryList(sqlx);
|
|
|
|
|
+ if(list!=null && list.size()>0) return list.get(0);
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|