Kaynağa Gözat

上传文件

陈士柏 2 yıl önce
ebeveyn
işleme
320fe3bba3

+ 327 - 0
mhotel/src/com/happy/service/impl/AppBookImplService.java

@@ -0,0 +1,327 @@
+package com.happy.service.impl;
+
+import com.baidubce.model.User;
+import com.happy.Model.*;
+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 com.happy.vo.DailyPriceVo;
+import com.happy.vo.HousePriceDataVo;
+import com.happy.vo.HousePriceOneDataVo;
+import com.happy.vo.HousePriceResultVo;
+import org.apache.struts2.ServletActionContext;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Service("AppBookService")
+public class AppBookImplService implements AppBookService {
+
+    @Resource
+    public BookService bookService;
+    @Resource
+    public BookinglogService bookinglogService;
+    @Resource
+    public HotelService hotelService;
+    @Resource
+    public HouseService houseService;
+    @Resource
+    public UserService userService;
+    @Resource
+    public HotelDictService hotelDictService;
+    @Resource
+    public AdminManagerService adminManagerService;
+    @Resource
+    public HousePriceService housePriceService;
+
+    @Resource
+    public HotelCoupomService hotelCoupomService;
+    @Resource
+    public HotelCoupomStatusService hotelCoupomStatusService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String createOrder(String bookingId, String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId, String complaintId, String useId) throws ParseException {
+        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(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();
+
+        int day = DateUtil.getDayDiff(startTime, endTime); // 中间多少天
+        String orderLiveTime = Func.parseInt(houseOrderNumber) + OrderEnum.间.toString() + day + OrderEnum.晚.toString();
+        String hotelType = hotelDictService.getDictNameById(Integer.parseInt(hotel.getHtype()));// 民宿类型hotel.getHtype()
+
+
+        // 设置民宿信息
+        booking.setHotelId(Func.parseStr(hotel.getId()));
+        booking.setHotelName(adminManager.getHotelName()); // 创建表单的时候,取酒店名称(数据来源于admin_manager中的hotelname)
+        booking.setHotelHposition(hotel.getHposition());
+        booking.setHotelHpositionWens(hotel.getHpositionWens());
+        booking.setHotelManagerId(hotel.getManagerId());
+        booking.setHotelTownship(adminManager.getHotelTownship());
+        booking.setHotelConfig(hotel.getHconfig());
+        booking.setHotelType(hotelType);  // 民宿类型(舒适形、舒适型、包吃住型、普通型)
+        booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder())); // 是否自动取消订单
+        booking.setHotelIsOrder(Func.parseStr(hotel.getIsOrder())); // 是否自动接单
+        booking.setHotelIsCheckout(Func.parseStr(hotel.getIsCheckout())); // 是否自动离店
+        booking.setHotelPhone(adminManager.getCorpnPhone());
+        booking.setHotelPerson(adminManager.getCorpnName());
+        booking.setLockTime(hotel.getLockTime());
+
+        // 设置房型信息
+        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());
+
+        /**
+         * 2023-09-15 A-jax 订单总价等于房间数量 * 这些天的价格总和
+         */
+        List<HousePriceDataVo> priceDatas = housePriceService.queryPriceByHouseId(house.getId(), startTime, TimeExchange.TimeDesD(endTime, -1));
+
+        List<HousePriceOneDataVo> oneDatas = new ArrayList<>();
+        //将数据处理成单天的
+        for (HousePriceDataVo hp : priceDatas) {
+            if (hp.getStartTime().equals(hp.getEndTime())) {
+                HousePriceOneDataVo oneData = new HousePriceOneDataVo();
+                oneData.setSetDate(hp.getStartTime());
+                oneData.setCreateDate(hp.getCreateDate());
+                oneData.setPrice(hp.getPrice());
+                oneData.setHouseId(hp.getHouseId());
+                oneDatas.add(oneData);
+            } else {
+                int beDateNum = TimeExchange.daysBetween(hp.getStartTime(), hp.getEndTime());
+                for (int i = 0; i <= beDateNum; i++) {
+                    HousePriceOneDataVo oneData = new HousePriceOneDataVo();
+                    oneData.setSetDate(TimeExchange.TimeDesD(hp.getStartTime(), i));
+                    oneData.setCreateDate(hp.getCreateDate());
+                    oneData.setPrice(hp.getPrice());
+                    oneData.setHouseId(hp.getHouseId());
+                    oneDatas.add(oneData);
+                }
+            }
+        }
+
+        List<String> dateStrs = new ArrayList<>();
+        int dateNum = TimeExchange.daysBetween(startTime, endTime);
+        for (int i = 0; i <= dateNum; i++) {
+            String date = TimeExchange.TimeDesD(startTime, i);
+            dateStrs.add(date);
+        }
+
+        /**
+         * 获取该房型默认价格
+         */
+        Double housePrice = houseService.queryPriceByHouseId(house.getId());
+        Double dayPrices = 0.0;
+        for (String dateStr : dateStrs) {
+            HousePriceResultVo data = new HousePriceResultVo();
+            data.setDate(dateStr);
+            List<HousePriceOneDataVo> datas = oneDatas.stream().filter(e -> e.getSetDate().equals(dateStr)).sorted(Comparator.comparing(HousePriceOneDataVo::getCreateDate, Comparator.reverseOrder())).collect(Collectors.toList());
+
+            if (!dateStr.equals(endTime)) {
+                if (datas.size() > 0) {
+                    dayPrices = dayPrices + datas.get(0).getPrice();
+                } else {
+                    dayPrices = dayPrices + housePrice;
+                }
+            }
+        }
+
+        double totalPrice = Func.parseDbl(houseOrderNumber) * dayPrices;
+
+        if (!Func.checkNull(complaintId) && !Func.checkNull(useId)) {
+            HotelCouponStatus hotelCouponStatus = hotelCoupomStatusService.getById(useId);
+            if (hotelCouponStatus != null) {
+                hotelCouponStatus.setStatus(2);
+                hotelCouponStatus.setBookingId(bookingId);
+                BigDecimal totalPriceBigDecimal = new BigDecimal(totalPrice);
+
+                //        优惠券
+                HotelCoupon hotelCoupon = hotelCoupomService.getById(complaintId);
+                Integer type = hotelCoupon.getType();
+                if (1 == type) {
+//            满减金额
+                    Double meetPrice = hotelCoupon.getMeetPrice();
+                    BigDecimal meetPriceBigDecimal = new BigDecimal(meetPrice);
+
+                    if (meetPrice < totalPrice) {
+                        //            减免金额
+                        Double deductionPrice = hotelCoupon.getDeductionPrice();
+                        BigDecimal deductionPriceBigDecimal = new BigDecimal(deductionPrice);
+                        //            实付金额
+                        BigDecimal subtract = totalPriceBigDecimal.subtract(deductionPriceBigDecimal);
+                        totalPrice = subtract.doubleValue();
+                        hotelCouponStatus.setDiscountAmount(deductionPrice);
+                        hotelCoupomStatusService.update(hotelCouponStatus);
+                    }
+
+                } else if (2 == type) {
+//            享受的折扣
+                    Double rebatePrice = hotelCoupon.getRebatePrice();
+                    BigDecimal rebatePriceBigDecimal = new BigDecimal(rebatePrice / 10);
+
+//            最大减免金额
+                    Double maxDeduction = hotelCoupon.getMaxDeduction();
+                    BigDecimal maxDeductionBigDecimal = new BigDecimal(maxDeduction);
+
+//            折扣后的价格
+                    BigDecimal bigDecimal = totalPriceBigDecimal.multiply(rebatePriceBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    double v = bigDecimal.doubleValue();
+
+//            减去最大折扣后的价格
+                    BigDecimal subtract = totalPriceBigDecimal.subtract(maxDeductionBigDecimal);
+                    double v1 = subtract.doubleValue();
+
+                    if (v > v1) {
+                        totalPrice = v;
+                        BigDecimal subtract1 = totalPriceBigDecimal.subtract(bigDecimal);
+                        hotelCouponStatus.setDiscountAmount(subtract1.doubleValue());
+                    } else if (v < v1) {
+                        totalPrice = v1;
+                        hotelCouponStatus.setDiscountAmount(maxDeduction);
+                    } else if (v == v1) {
+                        totalPrice = v1;
+                        hotelCouponStatus.setDiscountAmount(maxDeduction);
+                    }
+
+                    hotelCoupomStatusService.update(hotelCouponStatus);
+
+                }
+            }
+        }
+
+        booking.setHouseTotalPrice(totalPrice);
+        booking.setOrderAccount(totalPrice);
+
+        // 设置住客信息
+        booking.setUserName(userName);
+        booking.setUserPhone(userPhone);
+        booking.setOrderStartTime(startTime);
+        booking.setOrderEndTime(endTime);
+        booking.setOrderLiveTime(orderLiveTime);
+
+        // 订单信息
+        booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
+        booking.setOrderStatus(Func.parseStr(PayEnum.待支付.getNum())); // 1待支付状态
+        booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
+        booking.setCreateUserid(userId);
+        booking.setId(Func.parseInt(bookingId));
+        int i = bookService.insertBooking(booking);
+
+        // 生成订单时,写入数据操作
+        bookinglogService.addBooklog(OrderEnum.生成订单.toString(), booking);
+
+        if (i == 0)
+            return ResultStatusCode.CANNTBOOKING.CANNTBOOKING.getMsg();
+
+        return null;
+    }
+
+    @Override
+    public String varificationHouse(String houseId, String startTime, String endTime, String houseOrderNumber) {
+        House house = houseService.getById(houseId);
+        if (house == null)
+            return "无此房间,请重新查询";
+        if (Func.checkNull(houseOrderNumber))
+            houseOrderNumber = "0";
+
+        if (house.getNumber() < Func.parseInt(houseOrderNumber))
+            return OrderEnum.超出限定房间数量.toString();
+
+        // 判断是否有房间,对每个房型进行标识
+        StringBuffer strSqlBook = new StringBuffer();
+        strSqlBook.append(" and house_id = '").append(house.getId()).append("' ");
+        strSqlBook.append(" and hotel_manager_id = '").append(house.getManagerId()).append("' ");
+//        if (!Func.checkNull(startTime))
+//            strSqlBook.append(" and order_start_time >= '").append(startTime).append(" 00:00:00  ' ");
+//        if (!Func.checkNull(endTime))
+//            strSqlBook.append(" and order_end_time < '").append(endTime).append(" 23:59:59 ' ");
+
+        //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
+        strSqlBook.append(" and  ( order_status = '").append(PayEnum.待支付.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.已支付.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.待入住.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.已入住.getNum()).append("' ) ");
+
+        List<Booking> bookList = bookService.queryList(strSqlBook.toString());
+        if (bookList == null)
+            return null;
+
+        Map<String, Integer> timeMap = new HashMap(); // map<时间,天数>进行累加
+//        int totalNum = 0;
+        for (Booking booking : bookList) {
+            if (Func.checkNull(booking.getHouseId()))
+                continue;
+
+            int day = DateUtil.getDayDiff(booking.getOrderStartTime(), booking.getOrderEndTime());
+            for (int i = 0; i < day; i++) {
+                String time = DateUtil.parseDateToStr(DateUtil.addDate(DateUtil.parseDateOnly(booking.getOrderStartTime()), Calendar.DATE, i), DateUtil.Time_Formatter_Day);
+                if (!timeMap.containsKey(time)) {
+                    timeMap.put(time, booking.getHouseOrderNumber());
+                    continue;
+                }
+
+                timeMap.put(time, booking.getHouseOrderNumber() + Func.parseInt(timeMap.get(time)));
+            }
+        }
+
+        List<String> dayQueryList = new ArrayList();
+        // 遍历查询的每一天当做一个列表数据
+        int dayQuerys = DateUtil.getDayDiff(startTime, endTime);
+        for (int i = 0; i < dayQuerys; i++) {
+            String time = DateUtil.parseDateToStr(DateUtil.addDate(DateUtil.parseDateOnly(startTime), Calendar.DATE, i), DateUtil.Time_Formatter_Day);
+            dayQueryList.add(time);
+        }
+
+
+        for (String dayQuery : dayQueryList) {
+            if (Func.checkNull(dayQuery))
+                continue;
+
+            if (timeMap.containsKey(dayQuery)) {
+                int totalNum = timeMap.get(dayQuery); // 当天房间的数量
+                // 订单中房数量》= 总房间数量 表示已满
+                if (totalNum >= house.getNumber())
+                    return dayQuery + OrderEnum.房间已满.toString();
+
+                // 现存房数量 《 要订的订房数量   表示已满
+                if ((house.getNumber() - totalNum) < Func.parseInt(houseOrderNumber))
+                    return dayQuery + OrderEnum.房间已满.toString();
+            }
+
+        }
+
+
+        return null;
+    }
+
+}

+ 209 - 0
mhotel/src/com/happy/service/impl/AppImplService.java

@@ -0,0 +1,209 @@
+package com.happy.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.happy.Model.Admin;
+import com.happy.Model.AdminManager;
+import com.happy.Model.app.Around_product;
+import com.happy.Model.app.Arounds;
+import com.happy.Model.app.News;
+import com.happy.Model.weixin.CodeEntity;
+import com.happy.Model.weixin.WechatResult;
+import com.happy.common.http.Get_airticle;
+import com.happy.common.model.airticle.Item_content;
+import com.happy.common.util.WechatUtil;
+import com.happy.dao.AppDao;
+import com.happy.service.AppService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("AppService")
+public class AppImplService implements AppService {
+
+    @Resource
+    public AppDao appDao;
+
+    public CodeEntity getCodeInfo(String code){
+        CodeEntity entity = new CodeEntity();
+        JSONObject wx = WechatUtil.getOpenId(code);
+        // json数据转换成字符串
+        assert wx != null;
+        String openid = wx.get("openid").toString();
+        String sessionkey = wx.get("session_key").toString();
+        // 当主体账户绑定小程序后就可以获取到,未绑定无法获取
+        String unionId="";
+        if(wx.get("unionid")!=null){
+            unionId=wx.get("unionid").toString();
+        }
+        entity.setOpenid(openid);
+        entity.setSessionkey(sessionkey);
+        entity.setUnionid(unionId);
+        // 是否需要获取手机号,true需要
+        entity.setFlagPhone(true);
+        // 返回参数
+        return entity;
+    }
+
+    public JSONObject getGCodeInfo(String code){
+        JSONObject jsonObject = new JSONObject();
+        JSONObject wx = WechatUtil.getGOpenId(code);
+        // json数据转换成字符串
+        assert wx != null;
+        WechatResult result = new Gson().fromJson(wx.toString(), WechatResult.class);
+        String openid = result.getOpenid();
+        String access_token = result.getAccess_token();
+        jsonObject.put("openid",openid);
+        jsonObject.put("token",access_token);
+        return jsonObject;
+    }
+
+    // 登录
+    public Admin login(String admin_name, String password){
+        return appDao.login(admin_name, password);
+    }
+
+    public Admin queryByOpenid(String openid){
+        return appDao.queryByOpenid(openid);
+    }
+
+    public Admin queryByNameAndOpenid(String admin_name,String openid){
+        return appDao.queryByNameAndOpenid(admin_name, openid);
+    }
+
+    public int updateOpenid(String openid,String admin_name){
+        return appDao.updateOpenid(openid, admin_name);
+    }
+
+    public int updateOpenidNull(String openid){
+        return appDao.updateOpenidNull(openid);
+    }
+
+    /**********************
+     * ********商户绑定**********
+     * ********************/
+    public AdminManager login_ma(String admin_name, String password){
+        return appDao.login_ma(admin_name, password);
+    }
+
+    public AdminManager queryMaByOpenid(String openid){
+        return appDao.queryMaByOpenid(openid);
+    }
+
+    public AdminManager queryMaByNameAndOpenid(String admin_name,String openid){
+        return appDao.queryMaByNameAndOpenid(admin_name, openid);
+    }
+
+    public int updateMaOpenid(String openid,String admin_name){
+        return appDao.updateMaOpenid(openid, admin_name);
+    }
+
+    public int updateMaOpenidNull(String openid){
+        return appDao.updateMaOpenidNull(openid);
+    }
+
+    /** ================================资讯============================= **/
+    public int insertNews(News news){
+        return appDao.insertNews(news);
+    }
+
+    public int delNews(int id){
+        return appDao.delNews(id);
+    }
+
+    public int updateNews(News news){
+        return appDao.updateNews(news);
+    }
+
+    public int updateTop(News news){
+        return appDao.updateTop(news);
+    }
+
+    public News queryByTit(String title){
+        return appDao.queryByTit(title);
+    }
+
+    public News queryById(int id){
+        return appDao.queryById(id);
+    }
+
+    public List<Item_content> getNews(int page, int rows) throws Exception {
+        return Get_airticle.get(page,rows);
+    }
+
+    public List<News> queryNewPage(int page, int rows, String sqlx){
+        return appDao.queryNewPage(page, rows, sqlx);
+    }
+
+    public int queryNewTotal(String sqlx){
+        return appDao.queryNewTotal(sqlx);
+    }
+
+    /** ==============================周边=================================== **/
+    public int insertRound(Arounds arounds){
+        return appDao.insertRound(arounds);
+    }
+
+    public int updateRoundById(Arounds arounds){
+        return appDao.updateRoundById(arounds);
+    }
+
+    public int updateRoundCountById(Arounds arounds){
+        return appDao.updateRoundCountById(arounds);
+    }
+
+    public int delAround(int id){
+        return appDao.delAround(id);
+    }
+
+    public Arounds queryAroundById(int id){
+        return appDao.queryAroundById(id);
+    }
+
+    public Arounds queryAroundByName(String rname){
+        return appDao.queryAroundByName(rname);
+    }
+
+    public List<Arounds> queryAroundPage(String sqlx, int page, int rows){
+        return appDao.queryAroundPage(sqlx, page, rows);
+    }
+
+    public int queryAroundTotal(String sqlx){
+        return appDao.queryAroundTotal(sqlx);
+    }
+
+    /** =========================产品============================== **/
+    public int insertProduct(Around_product around_product){
+        return appDao.insertProduct(around_product);
+    }
+
+    public int updateProductById(Around_product around_product){
+        return appDao.updateProductById(around_product);
+    }
+
+    public int delAroundProduct(int id){
+        return appDao.delAroundProduct(id);
+    }
+
+    public Around_product queryAPById(int id){
+        return appDao.queryAPById(id);
+    }
+
+    public Around_product queryAPByName(int aid,String product_name){
+        return appDao.queryAPByName(aid, product_name);
+    }
+
+    public List<Around_product> queryAPPage(int aid,String sqlx, int page, int rows){
+        return appDao.queryAPPage(aid,sqlx, page, rows);
+    }
+
+    public int queryAPTotal(int aid,String sqlx){
+        return appDao.queryAPTotal(aid,sqlx);
+    }
+
+    public List<Around_product> queryAP(int aid,String sqlx){
+        return appDao.queryAP(aid, sqlx);
+    }
+
+}

+ 299 - 0
mhotel/src/com/happy/service/impl/BookImplService.java

@@ -0,0 +1,299 @@
+package com.happy.service.impl;
+
+import com.happy.Model.Booking;
+import com.happy.Model.HotelDict;
+import com.happy.Model.HouseNumber;
+import com.happy.Model.HouseNumberStatus;
+import com.happy.Model.app.News;
+import com.happy.Model.app.Tongji;
+import com.happy.Until.*;
+import com.happy.Until.Enum.PayEnum;
+import com.happy.dao.BookDao;
+import com.happy.dao.HotelDictDao;
+import com.happy.dto.BookTypeEto;
+import com.happy.dto.IPage;
+import com.happy.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.text.ParseException;
+import java.time.LocalDate;
+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 {
+
+    @Resource
+    public BookDao bookDao;
+
+    @Resource
+    public HotelDictDao hotelDictDao;
+    @Resource
+    public BookinglogService bookinglogService;
+
+    @Resource
+    public AdminManagerService adminManagerService;
+
+    @Resource
+    public HotelDictService hotelDictService;
+
+    @Resource
+    public HouseNumberService houseNumberService;
+
+    @Resource
+    public HouseNumberStatusService houseNumberStatusService;
+
+    @Autowired
+    private HttpServletRequest request;
+
+    @Override
+    public int insertBooking(Booking book) {
+        return bookDao.insertBooking(book);
+    }
+
+    @Override
+    public int updateBooking(Booking book) {
+        return bookDao.updateBooking(book);
+    }
+
+    @Override
+    public int delBooking(int id) {
+        return bookDao.delBooking(id);
+    }
+
+    @Override
+    public Booking getById(int id) {
+        return bookDao.getById(id);
+    }
+
+    @Override
+    public IPage<Booking> queryPage(String sqlx, int page, int rows, String orderDesc) {
+        IPage<Booking> iPage = new IPage();
+        List<Booking> bookList = bookDao.queryPage(sqlx,page,rows,orderDesc);
+        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 Tongji queryOrderT(String sqlx){
+        return bookDao.queryOrderT(sqlx);
+    }
+
+    // 支付金额统计
+    public Tongji queryPayT(String sqlx){
+        return bookDao.queryPayT(sqlx);
+    }
+
+    // 退款金额统计
+    public Tongji queryRefundT(String sqlx){
+        return bookDao.queryRefundT(sqlx);
+    }
+
+    // 入账金额统计
+    public Tongji queryInT(String sqlx){
+        return bookDao.queryInT(sqlx);
+    }
+
+    @Override
+    public List<Booking> queryList(String sqlx) {
+        return bookDao.queryList(sqlx);
+    }
+
+    // 清账操作
+    public int updateSaccount(Booking booking){
+        return bookDao.updateSaccount(booking);
+    }
+
+    @Override
+    public Booking getOen(String sqlx){
+        List<Booking> list = bookDao.queryList(sqlx);
+        if(list!=null && list.size()>0) return list.get(0);
+        return null;
+    }
+
+    @Override
+    public Double sumAccount(String sqlx){
+        return bookDao.sumAccount(sqlx);
+    }
+
+    @Override
+    public BookTypeEto getBookStatusSum(String sqlx){
+        return bookDao.getBookStatusSum(sqlx);
+    }
+
+//    @Override
+//    public String cancelBooking(String bookingId) throws Exception {
+//        if (Func.checkNull(bookingId))
+//            return "未传入订单id";
+//
+//        Booking book = bookDao.getById(Func.parseInt(bookingId));
+//        //是否能取消订单(1是 2否)
+//        if (Func.parseInt(book.getHotelIsCanorder()) == 2)
+//            return "商家设置不可取消订单,请联系商家";
+//
+//        AdminManager adminManager = adminManagerService.getById(Func.parseInt(book.getHotelManagerId()));
+//
+//        //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
+//        int status = Func.parseInt(book.getOrderStatus());
+//        if (status == 1)
+//        {
+//            book.setOrderStatus(Func.parseStr(PayEnum.SEVEN.getNum())); // 如果在1待支付情况,用户点击取消订单按钮,后台直接修改取消订单操作
+//            book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
+//            book.setRemake(Func.parseStr(PayEnum.FIVE.getPayStatus()));
+//            bookDao.updateBooking(book);
+//
+//            return null;
+//        }else if (status == 2 || status == 3)
+//        {
+//            book.setOrderStatus(Func.parseStr(PayEnum.TEN.getNum())); // 如果在2已支付,3待入住 情况,用户点击取消订单按钮,后台先修改状态为退款中,然后走退款流程
+//            book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
+//            book.setRemake(Func.parseStr(PayEnum.FIVE.getPayStatus()));
+//            if (book.getPayAccount() > 0)
+//            {
+//                // 注明如果支付金额大于0,则需要退款: (标识走退款操作)
+//                book.setRefundWay(OrderEnum.微信退款.toString());
+//            }
+//            bookDao.updateBooking(book);
+//
+//            return null;
+//        }
+//        return "当前状态下,不可取消订单";
+//    }
+
+    @Override
+    public String delBooking(String bookingId) {
+        if (Func.checkNull(bookingId))
+            return "未传入订单id";
+
+        // 是否假删除:0删除,1正常
+        Booking book = bookDao.getById(Func.parseInt(bookingId));
+        if (book == null)
+            return "无此订单,请重新查询";
+
+        book.setStatus_del(0);
+        book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
+
+        int status = Func.parseInt(book.getOrderStatus());
+        if (status == PayEnum.待支付.getNum()) {
+            book.setOrderStatus(Func.parseStr(PayEnum.已取消.getNum())); // 如果在1待支付情况,用户点击删除订单按钮,后台直接修改取消订单操作,(应当释放房间)
+            book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
+            book.setRemake(Func.parseStr(PayEnum.已取消.getPayStatus()));
+        }
+        bookDao.updateBooking(book);
+
+        // 退款成功后,写入数据操作
+        bookinglogService.addBooklog("用户删除了这条订单的显示数据"  ,book);
+
+        return null;
+    }
+
+    @Override
+    public Booking queryByOrder(String orderNum) {
+        List<Booking> list = bookDao.queryList("and order_num = '"+orderNum+"'");
+        if(list!=null && list.size()>0) return list.get(0);
+        return null;
+    }
+
+    @Override
+    public int updateBookStatus() {
+        HotelDict respTime = hotelDictService.getById(1000011001);//响应时间
+        HotelDict operate = hotelDictService.getById(1000011002);//响应时间 1自动接单 2自动拒单
+        String sqlx = " and create_time <= DATE_SUB(NOW(), INTERVAL " + respTime.getName() + " MINUTE) and order_status = 2 ";
+        List<Booking> bookings = bookDao.queryList(sqlx);
+        AtomicInteger n = new AtomicInteger();
+        if ("1".equals(operate.getName())){
+            bookings.forEach(booking -> {
+                List<HouseNumberStatus> list = new ArrayList<>();
+                //不可入住的房间
+                List<HouseNumber> houseNumbers = houseNumberService.queryHouseStatus(booking);
+                //所有房间
+                List<HouseNumber> houseNumberList = houseNumberService.queryByHouseId(booking.getHouseId());
+                AtomicInteger i = new AtomicInteger();
+                List<String> Ids = new ArrayList<>();
+                if (houseNumbers != null){
+                    houseNumberList.forEach(houseNumber -> {
+                        //添加的房间不在不可添加的房间当中并且数量小于订房总数
+                        if (!houseNumbers.contains(houseNumber) && i.get() < booking.getHouseOrderNumber()){
+                            Ids.add(houseNumber.getId());
+                            i.getAndIncrement();
+                        }
+                    });
+                }else {
+                    //所有房间都可以预定
+                    houseNumberList.forEach(houseNumber -> {
+                        //添加的房间不在不可添加的房间当中并且数量小于订房总数
+                        if (i.get() < booking.getHouseOrderNumber()){
+                            Ids.add(houseNumber.getId());
+                            i.getAndIncrement();
+                        }
+                    });
+                }
+
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+                DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                LocalDateTime str = LocalDateTime.parse(booking.getOrderStartTime(), inputFormatter);
+                LocalDateTime end = LocalDateTime.parse(booking.getOrderEndTime(), inputFormatter);
+                String a = str.format(formatter);
+                String B = end.format(formatter);
+                LocalDate strDate = LocalDate.parse(a, formatter);
+                LocalDate endDate = LocalDate.parse(B, formatter);
+                Date now = null;
+                try {
+                    now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                for (String number : Ids){
+                    for (LocalDate date = strDate; !date.isAfter(endDate.minusDays(1)); date = date.plusDays(1)){
+                        HouseNumberStatus houseNumberStatus = new HouseNumberStatus();
+                        houseNumberStatus.setNumberId(number);
+                        houseNumberStatus.setId(String.valueOf(UUID.randomUUID()));
+                        houseNumberStatus.setCreateDate(now);
+                        houseNumberStatus.setModifyDate(now);
+                        houseNumberStatus.setRemark("");
+                        houseNumberStatus.setBookingId(String.valueOf(booking.getId()));
+                        houseNumberStatus.setSetDate(date.format(formatter));
+                        houseNumberStatus.setStatus(5);//状态(0删除 1.正常 2.关房 3.脏房 4.净房 5.预定 6.入住)
+                        list.add(houseNumberStatus);
+                    }
+                }
+                int m = houseNumberStatusService.saveBatch(list);
+                if (m > 0){
+                    n.getAndIncrement();
+                    booking.setOrderStatus("3");
+                    booking.setUpdateTime(UUIDUtil.getNewDate());
+                    bookDao.updateBooking(booking);
+                }
+            });
+            return n.get();
+        }else {
+            HotelDict dict = hotelDictDao.getById(1000011999);
+            bookings.forEach(booking -> {
+                Map<String, String> params = new HashMap<>();
+                params.put("bookingId", String.valueOf(booking.getId()));
+                try {
+                    String msg = HttpUtils.post(dict.getFileUrl(), params);
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+            });
+        }
+        return 0;
+    }
+
+
+
+}