|
@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.BufferedReader;
|
|
import java.io.BufferedReader;
|
|
|
import java.io.PrintWriter;
|
|
import java.io.PrintWriter;
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -126,6 +127,46 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
this.status = status;
|
|
this.status = status;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 定时任务
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String scheduledTasks()
|
|
|
|
|
+ {
|
|
|
|
|
+ // 获取所有的订单待支付状态
|
|
|
|
|
+ StringBuffer strSqlBook = new StringBuffer();
|
|
|
|
|
+ strSqlBook.append(" and order_status = '").append(PayEnum.ONE.getNum()).append("' ");
|
|
|
|
|
+ List<Booking> bookingList = bookService.queryList(strSqlBook.toString());
|
|
|
|
|
+ if (bookingList == null || bookingList.size() <= 0){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ for (Booking booking: bookingList) {
|
|
|
|
|
+ if (booking == null || Func.checkNull(booking.getCreateTime()) || Func.checkNull(booking.getLockTime()))
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ // 对订单时间进行累加
|
|
|
|
|
+ String lockTime = TimeExchange.TimeRangeM(booking.getCreateTime(),Func.parseInt(booking.getLockTime()));
|
|
|
|
|
+ boolean flag = TimeExchange.CompareDate(lockTime,TimeExchange.getDate());
|
|
|
|
|
+ if (flag)
|
|
|
|
|
+ {
|
|
|
|
|
+ // 如果超时,则将订单状态修改为已超时
|
|
|
|
|
+ booking.setOrderStatus(Func.parseStr(PayEnum.SIX.getPayStatus()));
|
|
|
|
|
+ booking.setUpdateTime(TimeExchange.getDate());
|
|
|
|
|
+ bookService.updateBooking(booking);
|
|
|
|
|
+ System.out.println("已将订单"+booking.getOrderNum()+"标识为支付超时");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* houseId; // 房型id
|
|
* houseId; // 房型id
|
|
@@ -565,6 +606,8 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
try {
|
|
try {
|
|
|
// 支付费用
|
|
// 支付费用
|
|
|
int totalPrice = (int) booking.getHouseTotalPrice();
|
|
int totalPrice = (int) booking.getHouseTotalPrice();
|
|
|
|
|
+ int totalfee = (int) (totalPrice * 100);
|
|
|
|
|
+
|
|
|
WechatUnifiedOrder w = new WechatUnifiedOrder();
|
|
WechatUnifiedOrder w = new WechatUnifiedOrder();
|
|
|
w.setAppid(WeiXinUtil.appid_c);
|
|
w.setAppid(WeiXinUtil.appid_c);
|
|
|
w.setAttach("chuanghai");
|
|
w.setAttach("chuanghai");
|
|
@@ -576,7 +619,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
|
|
|
String orderNo = booking.getOrderNum(); // 订单编号
|
|
String orderNo = booking.getOrderNum(); // 订单编号
|
|
|
w.setOut_trade_no(orderNo);
|
|
w.setOut_trade_no(orderNo);
|
|
|
w.setSpbill_create_ip(WeiXinUtil.ip);
|
|
w.setSpbill_create_ip(WeiXinUtil.ip);
|
|
|
- w.setTotal_fee(totalPrice);
|
|
|
|
|
|
|
+ w.setTotal_fee(totalfee);
|
|
|
w.setTrade_type("JSAPI");
|
|
w.setTrade_type("JSAPI");
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
params.put("attach", w.getAttach());
|
|
params.put("attach", w.getAttach());
|