Browse Source

Merge remote-tracking branch 'origin/master'

raojiaolong@163.com 2 years ago
parent
commit
1ea02cb4b7

+ 20 - 0
mhotel/src/com/happy/Model/Booking.java

@@ -1,6 +1,8 @@
 package com.happy.Model;
 package com.happy.Model;
 
 
 
 
+import java.util.List;
+
 /**
 /**
  * 订单实体类
  * 订单实体类
  */
  */
@@ -22,11 +24,13 @@ public class Booking {
   private String hotelPerson; // 民宿联系人
   private String hotelPerson; // 民宿联系人
   private String hotelTownship; // 民宿所属乡镇
   private String hotelTownship; // 民宿所属乡镇
   private String hotelConfig; // 民宿配置
   private String hotelConfig; // 民宿配置
+  private List hotelConfigList; // 民宿配置列表
   private String hotelType; // 民宿类型
   private String hotelType; // 民宿类型
   private String hotelIsCanorder; // 是否可取消订单 接单设置(1自动接单 2手动接单)
   private String hotelIsCanorder; // 是否可取消订单 接单设置(1自动接单 2手动接单)
   private String houseId; // 房型id
   private String houseId; // 房型id
   private String houseName; // 户型名称
   private String houseName; // 户型名称
   private String houseConfig; //房间配置
   private String houseConfig; //房间配置
+  private List houseConfigList; //房间配置列表
   private double houseUnitPrice; // 房间单价
   private double houseUnitPrice; // 房间单价
   private double houseTotalPrice; // 总价
   private double houseTotalPrice; // 总价
   private int houseOrderNumber; // 订房数量
   private int houseOrderNumber; // 订房数量
@@ -431,4 +435,20 @@ public class Booking {
   public void setLockTime(String lockTime) {
   public void setLockTime(String lockTime) {
     this.lockTime = lockTime;
     this.lockTime = lockTime;
   }
   }
+
+  public List getHotelConfigList() {
+    return hotelConfigList;
+  }
+
+  public void setHotelConfigList(List hotelConfigList) {
+    this.hotelConfigList = hotelConfigList;
+  }
+
+  public List getHouseConfigList() {
+    return houseConfigList;
+  }
+
+  public void setHouseConfigList(List houseConfigList) {
+    this.houseConfigList = houseConfigList;
+  }
 }
 }

+ 9 - 8
mhotel/src/com/happy/action/AppBookingAction.java

@@ -261,8 +261,8 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
     /**
     /**
      * bookingId 订单id
      * bookingId 订单id
      * open_id
      * open_id
-     * 取消订单功能:
-     * //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
+     * 取消订单功能: 用户点击
+     * //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
      *
      *
      * @return
      * @return
      */
      */
@@ -273,7 +273,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         JSONObject jsonObject = new JSONObject();
         JSONObject jsonObject = new JSONObject();
 
 
         // 取消订单,修改订单的支付状态
         // 取消订单,修改订单的支付状态
-        String mess = bookService.cancelBooking(getBookingId());
+        String mess = bookService.cancelBooking(bookingId);
         if (!Func.checkNull(mess)) {
         if (!Func.checkNull(mess)) {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.message, mess);
             jsonObject.put(B.message, mess);
@@ -285,7 +285,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         if (booking == null )
         if (booking == null )
          {
          {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-            jsonObject.put(B.message, "未获取到订单信息");
+            jsonObject.put(B.message, "未获取到订单信息,请重新查询");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
          }
          }
@@ -302,7 +302,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         if (Func.parseStr(PayEnum.TEN.getNum()).equals(booking.getOrderStatus()) && OrderEnum.微信退款.toString().equals(booking.getRefundWay())) {
         if (Func.parseStr(PayEnum.TEN.getNum()).equals(booking.getOrderStatus()) && OrderEnum.微信退款.toString().equals(booking.getRefundWay())) {
             if (Func.checkNull(this.open_id) || Func.checkNull(this.bookingId)) {
             if (Func.checkNull(this.open_id) || Func.checkNull(this.bookingId)) {
                 jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
                 jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-                jsonObject.put(B.message, ResultStatusCode.BAD_REQUEST.getMsg());
+                jsonObject.put(B.message, "未传入open_id和bookingId");
                 ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
                 ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
                 return null;
                 return null;
             }
             }
@@ -310,7 +310,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
             Users users = userService.queryByOpenid(open_id); // 用户信息
             Users users = userService.queryByOpenid(open_id); // 用户信息
             if (users == null || booking == null) {
             if (users == null || booking == null) {
                 jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
                 jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-                jsonObject.put(B.message, ResultStatusCode.BAD_REQUEST.getMsg());
+                jsonObject.put(B.message, "未查询到当前用户数据users,请先授权");
                 ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
                 ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
                 return null;
                 return null;
             }
             }
@@ -393,7 +393,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         JSONObject resultJson = new JSONObject();
         JSONObject resultJson = new JSONObject();
         if (Func.checkNull(this.open_id) || Func.checkNull(this.bookingId)) {
         if (Func.checkNull(this.open_id) || Func.checkNull(this.bookingId)) {
             resultJson.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             resultJson.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-            resultJson.put(B.message, ResultStatusCode.BAD_REQUEST.getMsg());
+            resultJson.put(B.message,  "未传入open_id和bookingId");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
             return null;
         }
         }
@@ -402,7 +402,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         Booking booking = bookService.getById(Func.parseInt(bookingId)); // 订单信息
         Booking booking = bookService.getById(Func.parseInt(bookingId)); // 订单信息
         if (users == null || booking == null) {
         if (users == null || booking == null) {
             resultJson.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             resultJson.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-            resultJson.put(B.message, ResultStatusCode.BAD_REQUEST.getMsg());
+            resultJson.put(B.message, "未查询到当前用户数据users,请先授权");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
             return null;
         }
         }
@@ -508,6 +508,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
                 book.setRefundTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
                 book.setRefundTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
                 book.setRefundAmount(book.getHouseTotalPrice());
                 book.setRefundAmount(book.getHouseTotalPrice());
                 book.setUpdateTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
                 book.setUpdateTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
+                book.setOrderStatus(Func.parseStr(PayEnum.NINE.getNum()));
                 bookService.updateBooking(book);
                 bookService.updateBooking(book);
 
 
 
 

+ 34 - 2
mhotel/src/com/happy/action/AppMePageAction.java

@@ -13,6 +13,7 @@ import com.happy.constant.ResultStatusCode;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
 import com.happy.service.AppService;
 import com.happy.service.AppService;
 import com.happy.service.BookService;
 import com.happy.service.BookService;
+import com.happy.service.HotelService;
 import com.happy.service.UserService;
 import com.happy.service.UserService;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
@@ -23,8 +24,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.net.URLEncoder;
 import java.net.URLEncoder;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 
 /**
 /**
  * 我的进去Action请求交互
  * 我的进去Action请求交互
@@ -40,6 +40,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     public UserService userService;
     public UserService userService;
     @Resource
     @Resource
     public AppService appService;
     public AppService appService;
+    @Resource
+    public HotelService hotelService;
 
 
     private String contactUserName; // 常用联系人姓名
     private String contactUserName; // 常用联系人姓名
     private String contactUserIdNum; // 常用联系人身份证
     private String contactUserIdNum; // 常用联系人身份证
@@ -141,6 +143,36 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
             return null;
             return null;
         }
         }
 
 
+
+        // 数据字典写入book
+        Map dicMap = hotelService.queryHotelDicMap();
+        // 酒店配置列表数据填充
+        if (!Func.checkNull(book.getHotelConfig()))
+        {
+            List<String> list = Arrays.asList(book.getHotelConfig().split(","));
+            List hotelDicList = new ArrayList();
+            for (String hotelDicId:list) {
+                if (!dicMap.containsKey(Func.parseInt(hotelDicId)))
+                    continue;
+
+                hotelDicList.add(dicMap.get(Func.parseInt(hotelDicId)));
+            }
+            book.setHotelConfigList(hotelDicList);
+        }
+        // 房型配置列表数据填充
+        if (!Func.checkNull(book.getHouseConfig()))
+        {
+            List<String> list = Arrays.asList(book.getHouseConfig().split(","));
+            List houseDicList = new ArrayList();
+            for (String hotelDicId:list) {
+                if (!dicMap.containsKey(Func.parseInt(hotelDicId)))
+                    continue;
+
+                houseDicList.add(dicMap.get(Func.parseInt(hotelDicId)));
+            }
+            book.setHouseConfigList(houseDicList);
+        }
+
         resultJson.put(B.code, ResultStatusCode.OK.getStatus());
         resultJson.put(B.code, ResultStatusCode.OK.getStatus());
         resultJson.put(B.message,ResultStatusCode.OK.getMsg());
         resultJson.put(B.message,ResultStatusCode.OK.getMsg());
         resultJson.put(B.data,book);
         resultJson.put(B.data,book);

+ 1 - 2
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -40,7 +40,7 @@ public class AppHomePageImplService implements AppHomePageService {
     @Override
     @Override
     public IPage<Hotel> getHotelList(String queryValue,String hotel_township, int page, int rows) {
     public IPage<Hotel> getHotelList(String queryValue,String hotel_township, int page, int rows) {
         IPage<Hotel> iPage = new IPage();
         IPage<Hotel> iPage = new IPage();
-        StringBuilder strSql = new StringBuilder("");
+        StringBuilder strSql = new StringBuilder(" and hstatus=1 "); // 酒店正在营业中才显示
         if (!Func.checkNull(queryValue)){
         if (!Func.checkNull(queryValue)){
             strSql.append(" and hname like '%").append(queryValue).append("%' ");
             strSql.append(" and hname like '%").append(queryValue).append("%' ");
         }
         }
@@ -82,7 +82,6 @@ public class AppHomePageImplService implements AppHomePageService {
             hotel.setHconfigList(hotelDicList);
             hotel.setHconfigList(hotelDicList);
         }
         }
 
 
-
         System.out.println(hotel.getManagerId());// 需求确定使用商户id关联房型
         System.out.println(hotel.getManagerId());// 需求确定使用商户id关联房型
         StringBuffer strSql = new StringBuffer();
         StringBuffer strSql = new StringBuffer();
         strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");
         strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");

+ 16 - 11
mhotel/src/com/happy/service/impl/BookImplService.java

@@ -7,6 +7,7 @@ import com.happy.Until.Enum.OrderEnum;
 import com.happy.Until.Enum.PayEnum;
 import com.happy.Until.Enum.PayEnum;
 import com.happy.Until.Func;
 import com.happy.Until.Func;
 import com.happy.common.http.Message;
 import com.happy.common.http.Message;
+import com.happy.common.http.Message2;
 import com.happy.dao.BookDao;
 import com.happy.dao.BookDao;
 import com.happy.dto.BookTypeEto;
 import com.happy.dto.BookTypeEto;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
@@ -93,31 +94,35 @@ public class BookImplService implements BookService {
             return "商家设置不可取消订单,请联系商家";
             return "商家设置不可取消订单,请联系商家";
 
 
         AdminManager adminManager = adminManagerService.getById(Func.parseInt(book.getHotelManagerId()));
         AdminManager adminManager = adminManagerService.getById(Func.parseInt(book.getHotelManagerId()));
+
         //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
         //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
         int status = Func.parseInt(book.getOrderStatus());
         int status = Func.parseInt(book.getOrderStatus());
         if (status == 1)
         if (status == 1)
         {
         {
-            book.setOrderStatus(Func.parseStr(PayEnum.SEVEN.getNum()));
+            book.setOrderStatus(Func.parseStr(PayEnum.SEVEN.getNum())); // 如果在1待支付情况,用户点击取消订单按钮,后台直接修改取消订单操作
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
             bookDao.updateBooking(book);
             bookDao.updateBooking(book);
 
 
-
-            String sendMsg = "订单:"+ book.getOrderNum() +"已取消";
-            // 推送消息给用户
-            Message.send(adminManager.getOpenid(),book.getOrderNum(),book.getUserName(),sendMsg,book.getCreateTime());
-
             return null;
             return null;
         }else if (status == 2 || status == 3)
         }else if (status == 2 || status == 3)
         {
         {
-            book.setOrderStatus(Func.parseStr(PayEnum.TEN.getNum()));
+            book.setOrderStatus(Func.parseStr(PayEnum.TEN.getNum())); // 如果在2已支付,3待入住 情况,用户点击取消订单按钮,后台先修改状态为退款中,然后走退款流程
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
-            // 注明需要退款: (标识走退款操作)
-            book.setRefundWay(OrderEnum.微信退款.toString());
+            if (book.getPayAccount() > 0)
+            {
+                // 注明如果支付金额大于0,则需要退款: (标识走退款操作)
+                book.setRefundWay(OrderEnum.微信退款.toString());
+            }
             bookDao.updateBooking(book);
             bookDao.updateBooking(book);
 
 
+            // 推送消息给商家
             String sendMsg = "订单:"+ book.getOrderNum() +"已取消";
             String sendMsg = "订单:"+ book.getOrderNum() +"已取消";
-            // 推送消息给用户
-            Message.send(adminManager.getOpenid(),book.getOrderNum(),book.getUserName(),sendMsg,book.getCreateTime());
+            if (!Func.checkPhone(book.getOrderStartTime()) && !Func.checkPhone(book.getOrderEndTime())  && !Func.checkNull(book.getHotelName()) && !Func.checkNull(book.getUserName()))
+            {
+                String live_end = book.getOrderStartTime().substring(0,10)  +"~"+  book.getOrderEndTime().substring(0,10);
+                Message2.send(adminManager.getOpenid(),book.getOrderNum(),book.getHouseName(),live_end,book.getUserName(), book.getHotelName(),book.getHouseId());
+            }
+
             return null;
             return null;
         }
         }
         return "当前状态下,不可取消订单";
         return "当前状态下,不可取消订单";