|  | @@ -295,14 +295,17 @@ public class QzOrderService {
 | 
	
		
			
				|  |  |              for (Map map : orderList) {
 | 
	
		
			
				|  |  |                  String out_trade_no = MapUtils.getString("merch_order_sn", map);
 | 
	
		
			
				|  |  |                  String orderId = MapUtils.getString("order_id", map);
 | 
	
		
			
				|  |  | +                String add_time = MapUtils.getString("add_time", map);
 | 
	
		
			
				|  |  | +                Date addTime = DateUtils.strToDate(add_time);
 | 
	
		
			
				|  |  | +                Date nowDate = new Date();
 | 
	
		
			
				|  |  |                  WechatRefundApiResult result = WechatUtil.wxOrderQuery(out_trade_no);
 | 
	
		
			
				|  |  |                  if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
 | 
	
		
			
				|  |  |                      if(result.getResult_code().equalsIgnoreCase("SUCCESS") && result.getTrade_state().equalsIgnoreCase("SUCCESS")) {
 | 
	
		
			
				|  |  |                          Date successTime = DateUtils.convertStringToDate(result.getTime_end(),DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                          Map orderRaram = new HashMap();
 | 
	
		
			
				|  |  | -                        orderRaram.put("payStatus", 2);
 | 
	
		
			
				|  |  | -                        orderRaram.put("orderStatus", 201);
 | 
	
		
			
				|  |  | +                        orderRaram.put("payStatus", 2);//已支付
 | 
	
		
			
				|  |  | +                        orderRaram.put("orderStatus", 201);//已支付
 | 
	
		
			
				|  |  |                          orderRaram.put("payTransactionId", result.getTransaction_id());
 | 
	
		
			
				|  |  |                          orderRaram.put("payTime", successTime);
 | 
	
		
			
				|  |  |                          orderRaram.put("orderId", orderId);
 | 
	
	
		
			
				|  | @@ -310,8 +313,13 @@ public class QzOrderService {
 | 
	
		
			
				|  |  |                      }else if(result.getResult_code().equalsIgnoreCase("SUCCESS")
 | 
	
		
			
				|  |  |                              && result.getTrade_state().equalsIgnoreCase("NOTPAY")) {//订单未支付
 | 
	
		
			
				|  |  |                          Map orderRaram = new HashMap();
 | 
	
		
			
				|  |  | -                        orderRaram.put("payStatus", 0);
 | 
	
		
			
				|  |  | -                        orderRaram.put("orderStatus", 0);
 | 
	
		
			
				|  |  | +                        if(getDateBetween(addTime,nowDate) >= 15){//订单下单时间超过15分钟直接取消订单
 | 
	
		
			
				|  |  | +                            orderRaram.put("payStatus", 0);//支付状态未支付
 | 
	
		
			
				|  |  | +                            orderRaram.put("orderStatus", 101);//订单状态已取消
 | 
	
		
			
				|  |  | +                        }else{
 | 
	
		
			
				|  |  | +                            orderRaram.put("payStatus", 0);//支付状态未支付
 | 
	
		
			
				|  |  | +                            orderRaram.put("orderStatus", 0);//订单状态未支付
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                          orderRaram.put("orderId", orderId);
 | 
	
		
			
				|  |  |                          qzOrderMapper.updateOrderInfo(orderRaram);
 | 
	
		
			
				|  |  |                      }else{
 | 
	
	
		
			
				|  | @@ -327,7 +335,23 @@ public class QzOrderService {
 | 
	
		
			
				|  |  |          logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate is end ");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public long getDateBetween(Date begin,Date end){
 | 
	
		
			
				|  |  | +        SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        long between = (end.getTime() - begin.getTime())/1000;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        long min = between/60;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return min;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      public static void main(String[] args) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        long between = (new Date().getTime() - DateUtils.strToDate("2018-11-16 09:30:12").getTime())/1000;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        long min = between/60;
 | 
	
		
			
				|  |  | +        System.out.println(min);
 | 
	
		
			
				|  |  |  //        Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  |  //        calendar.add(Calendar.DAY_OF_MONTH, 3);
 | 
	
		
			
				|  |  |  //
 | 
	
	
		
			
				|  | @@ -343,10 +367,12 @@ public class QzOrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          long currentTime = System.currentTimeMillis() + 2 * 60 * 60 * 1000;
 | 
	
		
			
				|  |  |          Date date = new Date(currentTime);
 | 
	
		
			
				|  |  | -        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String nowTime="";nowTime= df.format(date);
 | 
	
		
			
				|  |  | +        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +        String nowTime="";
 | 
	
		
			
				|  |  | +        nowTime= df.format(date);
 | 
	
		
			
				|  |  |          System.out.println(nowTime);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Date successTime = DateUtils.strToDate("2018-11-02 14:57:12");
 | 
	
		
			
				|  |  | +        Date successTime = DateUtils.strToDate("2018-11-02 14:57:12.0");
 | 
	
		
			
				|  |  |          System.out.println(successTime);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |