Browse Source

Merge remote-tracking branch 'origin/master'

raojiaolong@163.com 2 years ago
parent
commit
b40d43b426

+ 3 - 3
mhotel/src/com/happy/Model/weixin/WeiXinUtil.java

@@ -5,9 +5,9 @@ public class WeiXinUtil {
     // 创海公众号
     public static String appid_c = "wx2fc3f45732fae5d3";
     public static String screct_c = "7eee4a49a4470a77f9222995e8511547";
-    public static String APIid = "chuanghaikeji1612322883333333333";  // 商户密钥
-    public static String key = "chuanghaikeji1612322883333333333"; // 商户密钥
-    public static String account = "1612322883";  // 商户号
+    public static String APIid = "chuanghaikeji1612274012888888888";  // 商户密钥
+    public static String key = "chuanghaikeji1612274012888888888"; // 商户密钥
+    public static String account = "1612274012";  // 商户号
 
     public static String ip = "172.16.20.88";
     public static String ip_h = "https://chtech.ncjti.edu.cn/hotelReservation/zhotel";

+ 1 - 1
mhotel/src/com/happy/Until/HttpUtils.java

@@ -168,7 +168,7 @@ public class HttpUtils {
 				e.printStackTrace();
 			}
 		}
-		return new String(str.getBytes("iso-8859-1"));
+		return str;
 	}
 
 

+ 3 - 1
mhotel/src/com/happy/Until/weixin/JaxbUtil.java

@@ -159,6 +159,8 @@ public class JaxbUtil {
             }
         }
         sb.append("</xml>");
-        return new String(sb.toString().toString().getBytes(), "utf-8");
+
+        return sb.toString();
+//        return new String(sb.toString().toString().getBytes(), "utf-8");
     }
 } 

+ 45 - 1
mhotel/src/com/happy/action/AppBookingAction.java

@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.PrintWriter;
+import java.text.ParseException;
 import java.util.*;
 
 /**
@@ -126,6 +127,47 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         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()));
+                // 当前时间 大于 锁定时间 为true
+                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
@@ -565,6 +607,8 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
         try {
             // 支付费用
             int totalPrice = (int) booking.getHouseTotalPrice();
+            int totalfee = (int) (totalPrice * 100);
+
             WechatUnifiedOrder w = new WechatUnifiedOrder();
             w.setAppid(WeiXinUtil.appid_c);
             w.setAttach("chuanghai");
@@ -576,7 +620,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
             String orderNo = booking.getOrderNum(); // 订单编号
             w.setOut_trade_no(orderNo);
             w.setSpbill_create_ip(WeiXinUtil.ip);
-            w.setTotal_fee(totalPrice);
+            w.setTotal_fee(totalfee);
             w.setTrade_type("JSAPI");
             Map<String, String> params = new HashMap<String, String>();
             params.put("attach", w.getAttach());