|
|
@@ -2,11 +2,9 @@ package com.happy.action;
|
|
|
|
|
|
import com.happy.Model.Booking;
|
|
|
import com.happy.Model.weixin.Users;
|
|
|
+import com.happy.Until.*;
|
|
|
import com.happy.Until.Enum.B;
|
|
|
-import com.happy.Until.Func;
|
|
|
-import com.happy.Until.ResUtil;
|
|
|
-import com.happy.Until.ResponseUtil;
|
|
|
-import com.happy.Until.ResultUtil;
|
|
|
+import com.happy.Until.Enum.OrderEnum;
|
|
|
import com.happy.common.http.Message;
|
|
|
import com.happy.constant.ResultStatusCode;
|
|
|
import com.happy.service.AppBookService;
|
|
|
@@ -134,7 +132,28 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- appBookService.createOrder(houseId, startTime, endTime, houseOrderNumber,userName,userPhone, userId);
|
|
|
+ // 将时间统一转化为 yyyy/MM/dd
|
|
|
+ String startDate = DateUtil.parseDateToStr((Func.parseDate(startTime)),DateUtil.Time_Formatter_Day);
|
|
|
+ String endDate = DateUtil.parseDateToStr((Func.parseDate(endTime)),DateUtil.Time_Formatter_Day);
|
|
|
+
|
|
|
+ // 创建订单之前,先验证是否有房间
|
|
|
+ String backMessage = appBookService.varificationHouse(houseId, startDate, endDate);
|
|
|
+ if(Func.checkNull(backMessage))
|
|
|
+ {
|
|
|
+ jsonObject.put(B.CODE, ResultStatusCode.CANNTBOOKING.getStatus());
|
|
|
+ jsonObject.put(B.MESSAGE,backMessage);
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ String mess = appBookService.createOrder(houseId, startDate, endDate, houseOrderNumber,userName,userPhone, userId);
|
|
|
+ if (!Func.checkNull(mess))
|
|
|
+ {
|
|
|
+ jsonObject.put(B.CODE, ResultStatusCode.BAD_REQUEST.getStatus());
|
|
|
+ jsonObject.put(B.MESSAGE,mess);
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
jsonObject.put(B.CODE, ResultStatusCode.OK.getStatus());
|
|
|
ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
@@ -158,6 +177,20 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ // 将时间统一转化为 yyyy/MM/dd
|
|
|
+ String startDate = DateUtil.parseDateToStr((Func.parseDate(startTime)),DateUtil.Time_Formatter_Day);
|
|
|
+ String endDate = DateUtil.parseDateToStr((Func.parseDate(endTime)),DateUtil.Time_Formatter_Day);
|
|
|
+
|
|
|
+ // 创建订单之前,先验证是否有房间
|
|
|
+ String backMessage = appBookService.varificationHouse(houseId, startDate, endDate);
|
|
|
+ if(Func.checkNull(backMessage))
|
|
|
+ {
|
|
|
+ jsonObject.put(B.CODE, ResultStatusCode.CANNTBOOKING.getStatus());
|
|
|
+ jsonObject.put(B.MESSAGE,backMessage);
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
appBookService.reCreateOrder(houseId, startTime, endTime, houseOrderNumber,userName,userPhone, userId);
|
|
|
jsonObject.put(B.CODE, ResultStatusCode.OK.getStatus());
|
|
|
ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
@@ -165,7 +198,9 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 取消订单功能
|
|
|
+ * bookingId 订单id
|
|
|
+ * 取消订单功能:
|
|
|
+ * //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
|
|
|
* @return
|
|
|
*/
|
|
|
public String cancelBooking(){
|
|
|
@@ -190,6 +225,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * bookingId 订单id
|
|
|
* 删除订单功能(假删除)
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -218,7 +254,9 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
|
|
|
/**
|
|
|
*验证是否有房间
|
|
|
- * houseId,startTime,endTime
|
|
|
+ * houseId, 房型id
|
|
|
+ * startTime, 开始时间
|
|
|
+ * endTime 结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
public String varificationHouse()
|
|
|
@@ -242,8 +280,8 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- jsonObject.put(B.CODE, ResultStatusCode.BAD_REQUEST.getStatus());
|
|
|
- jsonObject.put(B.MESSAGE,backMessage);
|
|
|
+ jsonObject.put(B.CODE, ResultStatusCode.OK.getStatus());
|
|
|
+ jsonObject.put(B.MESSAGE, OrderEnum.有空房.toString());
|
|
|
ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
|
|
|
return null;
|
|
|
}
|