类 BaseUtils

java.lang.Object
com.abasecode.opencode.pay.util.BaseUtils

public class BaseUtils extends Object
作者:
Jon e-mail: ijonso123@gmail.com url: Jon's blog url: project github url: AbaseCode.com
  • 构造器详细资料

    • BaseUtils

      public BaseUtils()
  • 方法详细资料

    • getURI

      public static String getURI(String domain, String url)
      获得可访问网址
      参数:
      domain - 域名部分,形状如:https://www.abc.com
      url - 网址部分,可以是 /abc.html或者 https://www.abc.com/abc.html
      返回:
      可访问网址
    • getBytes

      public static byte[] getBytes(String path) throws IOException
      从resource读取文件字节
      参数:
      path -
      返回:
      字节
      抛出:
      IOException
    • getStream

      public static InputStream getStream(String path) throws IOException
      从resource读取文件流
      参数:
      path -
      返回:
      抛出:
      IOException
    • getNonceStr

      public static String getNonceStr()
      获取随机字符串
      返回:
      随机字符串
    • getCurrentTimeStamp

      public static String getCurrentTimeStamp()
      获取当前的Timestamp
      返回:
      时间戳
    • getCurrentTimestampMs

      public static long getCurrentTimestampMs()
      获取当前的时间
      返回:
      时间
    • getOrderNo

      public static String getOrderNo()
      生成订单号
      返回:
      订单号
    • makeUUID

      private static String makeUUID(int len)
      生成随机数
      返回:
      随机数
    • getCurrentUrl

      public static String getCurrentUrl(javax.servlet.http.HttpServletRequest request)
      获取当前工程url
      参数:
      request -
      返回:
      URL
    • getYuanFromFen

      public static String getYuanFromFen(Long m)
      分转元字符串
      参数:
      m - 分
      返回:
    • getYuanFromFen

      public static String getYuanFromFen(int m)
      分转元字符串(int)
      参数:
      m -
      返回:
    • getFenFromYuanLong

      public static Long getFenFromYuanLong(String m)
      元字符串转分(long)
      参数:
      m - 元
      返回:
    • getFenFromYuan

      public static int getFenFromYuan(String m)
      元字符串转分(int)
      参数:
      m -
      返回:
    • getDateTimeStringFromRFC3339

      public static String getDateTimeStringFromRFC3339(String dateString)
      格式化日期
      参数:
      dateString - RFC3339
      返回:
      yyyy-MM-dd HH:mm:ss
    • getDateTimeStringFromRFC3339

      public static String getDateTimeStringFromRFC3339(Date d)
      参数:
      d -
      返回:
    • getDateTimeFromRFC3339

      public static LocalDateTime getDateTimeFromRFC3339(String dateString)
      参数:
      dateString -
      返回:
    • getRFC3339

      public static String getRFC3339(Date date)
      convert time to RFC3339
      参数:
      date - date
      返回:
      2021-01-29T17:05:58+08:00
    • getRFC3339

      public static String getRFC3339(String datetime)
      convert time to RFC3339 format
      参数:
      datetime - format:2021-01-29 17:05:58
      返回:
      datetime string
    • getValue

      public static String getValue(Object o)
      获取字符串值
      参数:
      o -
      返回: