Browse Source

无车优化,自有车接口返回

Administrator 2 years ago
parent
commit
0f0a0e84a2

+ 1 - 1
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarBillWayServiceImpl.java

@@ -301,7 +301,7 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper, NoC
             insertOrUpdateBillStart(noCarWayBill);
             return true;
         }
-        if (DateUtil.getDistanceHours(noCarWayBill.getStartTime(), DateUtil.stringToDate(noCarWayBill.getPredictEndTime())) < INTTHREE) {
+        if (DateUtil.getDistanceMills(noCarWayBill.getStartTime(), DateUtil.stringToDate(noCarWayBill.getPredictEndTime())) < INTTHREE*60 * 60 * 1000) {
             /*历史运单先不校验超时运单*/
             noCarWayBill.setSplitFlag(NoCarWayBill.SPLIT_FALG_TRUE);
         }

+ 27 - 0
src/main/java/com/jkcredit/invoice/util/DateUtil.java

@@ -281,6 +281,33 @@ public class DateUtil {
     }
 
     /**
+     * 判断给定时间与当前时间相差多少小时
+     *
+     * @param date
+     * @return
+     */
+    public static long getDistanceMills(String date, Date now) {
+        DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
+        DateTime dateTime = DateTime.parse(date, format);
+
+        long mills = 0;
+        try {
+            //String转Date
+            Date time = dateTime.toDate();
+
+            long time1 = time.getTime();
+            long time2 = now.getTime();
+            long diff = time1 - time2;
+            mills = diff;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //正数表示在当前时间之后,负数表示在当前时间之前
+        return mills;
+    }
+
+    /**
      * 得到几天前的时间
      */