|
|
@@ -169,6 +169,45 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 进行更新数据将订单状态修改为已超时。
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String updateOrderStatus()
|
|
|
+ {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (Func.checkNull(bookingId))
|
|
|
+ {
|
|
|
+ jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
|
|
|
+ jsonObject.put(B.message, "未传入bookingId---updateOrderStatus");
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ Booking booking = bookService.getById(Func.parseInt(bookingId));
|
|
|
+ Date createTime = DateUtil.parseDate(booking.getCreateTime(),DateUtil.Time_Formatter_Second);
|
|
|
+ // 对订单时间进行累加
|
|
|
+ String lockTime = TimeExchange.TimeRangeM(DateUtil.getFormatPaternDate(createTime), Func.parseInt(booking.getLockTime()));
|
|
|
+ // 当前时间 大于 锁定时间 为true 且支付状态
|
|
|
+ boolean flag = TimeExchange.CompareDate(lockTime, TimeExchange.getDate());
|
|
|
+ if (flag)
|
|
|
+ {
|
|
|
+ // 如果超时,则将订单状态修改为已超时
|
|
|
+ booking.setOrderStatus(Func.parseStr(PayEnum.SIX.getNum()));
|
|
|
+ booking.setUpdateTime(TimeExchange.getDate());
|
|
|
+ bookService.updateBooking(booking);
|
|
|
+ System.out.println("已将订单"+booking.getOrderNum()+"标识为支付超时");
|
|
|
+
|
|
|
+ jsonObject.put(B.code, ResultStatusCode.OK.getStatus());
|
|
|
+ jsonObject.put(B.message, "已将订单"+booking.getOrderNum()+"标识为支付超时");
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -704,7 +743,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
|
|
|
Users users = userService.queryByOpenid(open_id); // 用户信息
|
|
|
Booking booking = bookService.getById(Func.parseInt(bookingId)); // 订单信息
|
|
|
- if (users == null || booking == null) {
|
|
|
+ if (users == null || booking == null || booking.getOrderStatus().equals(Func.parseStr(PayEnum.SIX.getNum()))) {
|
|
|
resultjson.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
|
|
|
resultjson.put(B.message, ResultStatusCode.BAD_REQUEST.getMsg());
|
|
|
ResponseUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
@@ -827,10 +866,10 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
{
|
|
|
// 自动接单,订单状态修改为待入住
|
|
|
booking.setOrderStatus(Func.parseStr(PayEnum.THREE.getNum()));
|
|
|
-// String userId = booking.getCreateUserid();
|
|
|
-// Users users = userService.queryByUserId(userId);
|
|
|
-// String mess = "您已成功订房,订单号:"+order_num;
|
|
|
-// Message.send(users.getOpenid(),order_num, users.getUser_name(),mess, booking.getPayTime());
|
|
|
+ String userId = booking.getCreateUserid();
|
|
|
+ Users users = userService.queryByUserId(userId);
|
|
|
+ String mess = "您已成功订房,订单号:"+order_num;
|
|
|
+ Message.send(users.getOpenid(),order_num, users.getUser_name(),mess, booking.getPayTime());
|
|
|
}
|
|
|
|
|
|
// 手动接单,发消息给商家
|