xujunwei 4 лет назад
Родитель
Сommit
2929e3be6f

+ 25 - 0
framework-common/src/main/java/com/mrxu/framework/common/util/DateFunc.java

@@ -17,6 +17,13 @@ public class DateFunc {
      */
     public static final String  SEPECIAL_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
 
+    /**
+     * @Author: xujunwei
+     * @Date: 2021/12/7
+     * @Description: 定义永久时间 :2099-09-09日
+     */ 
+    public static final Date FOREVER_DATE = new Date(4092566400000l);
+
     /**
      * endFormat
      */
@@ -242,6 +249,19 @@ public class DateFunc {
         return END_FORMAT.format(time);
     }
 
+    /**
+     * 获取最近days日结束日期
+     * @return String 次日开始日期
+     **/
+    public static Date getLastDayEnd(int days) {
+        try {
+            return END_FORMAT.parse(getLastNDayEnd(days));
+        } catch (ParseException e) {
+            e.printStackTrace();
+            throw new RuntimeException("获取最近days日结束日期异常:" + e.getMessage());
+        }
+    }
+
     /**
      * 年月日时分秒转为年月日
      * @param date 时间
@@ -411,4 +431,9 @@ public class DateFunc {
         Date time = cal.getTime();
         return new SimpleDateFormat(resultFormat).format(time);
     }
+
+    public static void main(String[] args) throws ParseException {
+        Date date = START_FORMAT.parse("2099-09-09 00:00:00");
+        System.out.println(date.getTime());
+    }
 }

+ 7 - 3
framework-common/src/main/java/com/mrxu/framework/common/util/MrxuConst.java

@@ -2,9 +2,13 @@ package com.mrxu.framework.common.util;
 
 public class MrxuConst {
 
-    public static int enable = 1;
+    public final static int enable = 1;
+
+    public final static int disable = 0;
+
+    public final static int zero = 0;
+
+    public final static String defaultPerson = "self";
 
-    public static int disable = 0;
 
-    public static int zero = 0;
 }