Commit 0b2e1498 authored by Quxl's avatar Quxl
parents cb8e9f42 36fdc579
...@@ -29,9 +29,9 @@ public class DateUtil { ...@@ -29,9 +29,9 @@ public class DateUtil {
public static final String FMT_DATE_ISO = "yyyy-MM-ddTHH:mm:ss.SSSZ"; public static final String FMT_DATE_ISO = "yyyy-MM-ddTHH:mm:ss.SSSZ";
public static final String FMT_UTC_GMT = "EEE, dd MMM yyyy HH:mm:ss z"; public static final String FMT_UTC_GMT = "EEE, dd MMM yyyy HH:mm:ss z";
public static final String FMT_YYYYMMddHHMMSS = "yyyyMMddHHmmss"; public static final String FMT_YYYYMMddHHMMSS = "yyyyMMddHHmmss";
public static final String FMT_UTC_ALIYUN="yyyy-MM-dd'T'HH:mm:ss'Z'"; public static final String FMT_UTC_ALIYUN="YYYY-MM-DD'T'hh:mm:ss'Z'";
public static final String FMT_YYYY_MM = "yyyy/MM"; public static final String FMT_YYYY_MM = "yyyy-MM";
public static final Long SECOND = 1000L; public static final Long SECOND = 1000L;
public static final Long MINUTE = 1000L*60; public static final Long MINUTE = 1000L*60;
...@@ -448,7 +448,43 @@ public class DateUtil { ...@@ -448,7 +448,43 @@ public class DateUtil {
} }
return null; return null;
} }
public static String getLastMonth(String format,int month) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
//获取前一个月第一天
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, month);
calendar1.set(Calendar.DAY_OF_MONTH,1);
return sdf.format(calendar1.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String getTimeStamp() { public static String getTimeStamp() {
return String.valueOf(System.currentTimeMillis() / 1000); return String.valueOf(System.currentTimeMillis() / 1000);
} }
/**
* 获取指定小时前的日期
*/
public static String beforeHourDay(String fmt,int hour) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - hour);
return format(calendar.getTime(), fmt);
}
/**
* 取得当前时间向后或向前若干天的时间
*
* @param time
* @param offset
* @return
*/
public static String beforeDay(String fmt, Integer offset) {
Date date = new Date(new Date().getTime() + (offset * 86400000L));
return format(date, fmt);
}
} }
...@@ -572,5 +572,26 @@ public class FileUtil { ...@@ -572,5 +572,26 @@ public class FileUtil {
} }
} }
public static Object fileToObject(File file) {
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
return ois.readObject();
} catch (FileNotFoundException e) {
throw new FileUtilException(e);
} catch (IOException e) {
throw new FileUtilException(e);
} catch (ClassNotFoundException e) {
throw new FileUtilException(e);
} finally {
try {
ois.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }
\ No newline at end of file
package com.egolm.common; package com.egolm.common;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
...@@ -1090,4 +1090,51 @@ public class StringUtil { ...@@ -1090,4 +1090,51 @@ public class StringUtil {
} }
return out.toString(); return out.toString();
} }
/**
*
* @Description 字节数组转16进制字符串
* @param bytes
* @return
* @author 曲欣亮
* @date 2016年4月25日
* @since 2016年4月25日
* @return String
* @throws
*/
public static String bytesToHex(byte[] bytes) {
return Hex.encodeHexString(bytes);
}
/**
*
* @描述:是否是2003的excel,返回true是2003
*
*
* @参数:@param filePath 文件完整路径
*
* @参数:@return
*
* @返回值:boolean
*/
public static boolean isExcel2003(String filePath){
return filePath.matches("^.+\\.(?i)(xls)$");
}
/**
*
* @描述:是否是2007的excel,返回true是2007
*
*
* @参数:@param filePath 文件完整路径
*
* @参数:@return
*
* @返回值:boolean
*/
public static boolean isExcel2007(String filePath){
return filePath.matches("^.+\\.(?i)(xlsx)$");
}
} }
...@@ -52,6 +52,22 @@ public class SqlServerTo { ...@@ -52,6 +52,22 @@ public class SqlServerTo {
} }
} }
public void executeView() {
try {
String sql = "SELECT TABLE_NAME , 'REMARK' AS TABLE_COMMENT FROM INFORMATION_SCHEMA.VIEWS";
PreparedStatement pStemt = conn.prepareStatement(sql);
ResultSet set = pStemt.executeQuery();
while(set.next()) {
String name = set.getString("TABLE_NAME").trim();
String comment = set.getString("TABLE_COMMENT");
execute(name, comment);
}
conn.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void executeFilter(String sign) { public void executeFilter(String sign) {
try { try {
String sql = "SELECT D.name AS TABLE_NAME, 'REMARK' AS TABLE_COMMENT FROM sysobjects AS D WHERE D.XTYPE = 'U' AND D.NAME <> 'dtproperties'"; String sql = "SELECT D.name AS TABLE_NAME, 'REMARK' AS TABLE_COMMENT FROM sysobjects AS D WHERE D.XTYPE = 'U' AND D.NAME <> 'dtproperties'";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment