Quellcode durchsuchen

优化 时间问题

java110 vor 3 Jahren
Ursprung
Commit
824f7dc76a

+ 1 - 1
java110-core/src/main/java/com/java110/core/factory/TempCarFeeFactory.java

@@ -67,7 +67,7 @@ public class TempCarFeeFactory {
             }
             }
             Date nowTime = DateUtil.getCurrentDate();
             Date nowTime = DateUtil.getCurrentDate();
             //支付完成超过15分钟
             //支付完成超过15分钟
-            min = (nowTime.getTime() - payTime.getTime()) / (60 * 1000);
+            min = (nowTime.getTime() - payTime.getTime()) / (60 * 1000* 1.00);
 
 
             return new Double(Math.ceil(min)).longValue();
             return new Double(Math.ceil(min)).longValue();
             //return (nowTime.getTime() - payTime.getTime()) / (60 * 1000);
             //return (nowTime.getTime() - payTime.getTime()) / (60 * 1000);

+ 12 - 1
springboot/src/test/java/com/java110/AppTest.java

@@ -2,8 +2,11 @@ package com.java110;
 
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertTrue;
 
 
+import com.java110.utils.util.DateUtil;
 import org.junit.Test;
 import org.junit.Test;
 
 
+import java.util.Date;
+
 /**
 /**
  * Unit test for simple App.
  * Unit test for simple App.
  */
  */
@@ -15,6 +18,14 @@ public class AppTest
     @Test
     @Test
     public void shouldAnswerWithTrue()
     public void shouldAnswerWithTrue()
     {
     {
-        assertTrue( true );
+
+        Date startTime = DateUtil.getDateFromStringA("2022-08-29 11:47:20");
+        Date endTime = DateUtil.getDateFromStringA("2022-08-29 11:48:21");
+
+
+
+       double min = (endTime.getTime() - startTime.getTime()) / (60 * 1000* 1.00);
+
+        System.out.println(new Double(Math.ceil(min)).longValue());
     }
     }
 }
 }