|
|
@@ -2,12 +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.Enum.OrderEnum;
|
|
|
-import com.happy.Until.Func;
|
|
|
-import com.happy.Until.ResUtil;
|
|
|
-import com.happy.Until.ResponseUtil;
|
|
|
-import com.happy.Until.ResultUtil;
|
|
|
import com.happy.common.http.Message;
|
|
|
import com.happy.constant.ResultStatusCode;
|
|
|
import com.happy.service.AppBookService;
|
|
|
@@ -135,7 +132,21 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- String mess = 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());
|
|
|
@@ -166,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());
|