Browse Source

定时任务

夏文涛 2 năm trước cách đây
mục cha
commit
472a51a8ba

+ 11 - 3
mhotel/src/applicationContext.xml

@@ -26,12 +26,20 @@
     <!-- 配置数据源 -->
     <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
         <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
+
+        <!--线上数据库地址-->
         <property name="url"
-                  value="jdbc:mysql://101.42.162.31:3306/mhotel?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"></property>
+                  value="jdbc:mysql://101.42.162.31:3306/hotel?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"></property>
+        <property name="username" value="root"></property>
+        <property name="password" value="Ro0!ot_369!"></property>
+
+        <!--测试数据库作废地址-->
+<!--        <property name="url"-->
+<!--                  value="jdbc:mysql://211.101.247.132:3306/mhotel?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"></property>-->
 <!--        <property name="username" value="hotel"></property>-->
 <!--        <property name="password" value="Aws3227cd!"></property>-->
-        <property name="username" value="root"></property>
-        <property name="password" value="$Root123"></property>
+
+
 
                 <!-- 配置获取连接等待超时的时间 -->
         <property name="maxWait" value="60000" />

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

@@ -15,10 +15,10 @@ public class WeiXinUtil {
 
     public static String ip = "101.42.162.31";//测试回跳ip
                               // "172.16.20.88";//线上回跳ip
-    public static String ip_h = // "https://chtech.ncjti.edu.cn/homestay/mhotel/";//31回调地址
+    public static String ip_h = "https://chtech.ncjti.edu.cn/homestay/mhotel/";//31回调地址
                                 //"https://www.xn--gmq052a5d255v.com/hotelReservation/mhotel";//测试回跳地址 这个中文域名测试跳不过去
                                 // 不知道这个乡宿的域名微信是否会回调,不会的话要改成 https://chtech.ncjti.edu.cn/homestay/mhotel/
-                                 "https://www.jinganrenjiams.com/hotelReservation/mhotel";//88线上回跳地址
+                                // "https://chtech.ncjti.edu.cn/hotelReservation/mhotel";//88线上回跳地址
 
     //public static String ip_q = "https://chtech.ncjti.edu.cn/hotelReservation/dist";
     public static String ip_q = "http://192.168.161.227:8000/hotelReservation/dist";

+ 3 - 3
mhotel/src/com/happy/action/bookAction.java

@@ -853,7 +853,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
     /**
      * 定时任务
      */
-    public void setBookStatus() {
+    public void setBookStatus() throws ParseException {
 
         System.out.println("自动接单定时程序");
 
@@ -864,8 +864,8 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
         HotelDict operate = hotelDictService.getById(1000011002);//响应时间 1自动接单 2自动拒单
 
         System.out.println("自动接单定时程序2");
-
-        String sqlx = " and create_time <= DATE_SUB(NOW(), INTERVAL " + respTime.getName() + " MINUTE) and order_status = 2 and hotel_is_order = 1";
+        String dateTime = TimeExchange.TimeRangeI(TimeExchange.getTime(), Integer.valueOf(respTime.getName()), "yyyy-MM-dd HH:mm:ss");
+        String sqlx = " and create_time <= '" + dateTime + "' and order_status = 2 and hotel_is_order = 1";
         List<Booking> bookings = bookService.queryList(sqlx);
 
         System.out.println("自动接单定时程序3:" + sqlx);