|
|
|
|
@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import oracle.sql.CLOB;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.lang.reflect.Array;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.net.HttpURLConnection;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.sql.Blob;
|
|
|
|
|
import java.sql.Clob;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
@ -19,7 +22,7 @@ public class PubTools {
|
|
|
|
|
static SimpleDateFormat dfYMD = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String HTTPS = PropertiesUtil.getValue("domainInteger") + File.separator;
|
|
|
|
|
/**
|
|
|
|
|
* 判断字符串是否为空
|
|
|
|
|
* yyp 20190305
|
|
|
|
|
@ -232,6 +235,57 @@ public class PubTools {
|
|
|
|
|
}
|
|
|
|
|
return reString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 远程网络请求,需要能访问外网的环境:根据路径判断附件是否存在
|
|
|
|
|
*
|
|
|
|
|
* @param imageUrl
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static boolean isImageExist(String imageUrl) {
|
|
|
|
|
try {
|
|
|
|
|
URL url = new URL(PubTools.HTTPS + imageUrl);
|
|
|
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
|
|
conn.setRequestMethod("HEAD"); // 仅获取响应头:ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
conn.setConnectTimeout(5000);
|
|
|
|
|
int statusCode = conn.getResponseCode();
|
|
|
|
|
if (statusCode != 200) return false; // 非200状态码直接返回失败:ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
|
|
|
|
|
return true; // 验证是否为图片类型:ml-citation{ref="1,6" data="citationList"}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 本地访问:根据路径判断附件是否存在
|
|
|
|
|
*
|
|
|
|
|
* @param imageUrl
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static boolean isImageExistLocal(String imageUrl) {
|
|
|
|
|
try {
|
|
|
|
|
URL url = new URL(imageUrl);
|
|
|
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
|
|
conn.setRequestMethod("HEAD"); // 仅获取响应头:ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
conn.setConnectTimeout(5000);
|
|
|
|
|
int statusCode = conn.getResponseCode();
|
|
|
|
|
if (statusCode != 200) return false; // 非200状态码直接返回失败:ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
|
|
|
|
|
return true; // 验证是否为图片类型:ml-citation{ref="1,6" data="citationList"}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getEnabledOcr() {
|
|
|
|
|
int a = 0;
|
|
|
|
|
String ocrenabled = PropertiesUtil.getValue("OCRENABLED");
|
|
|
|
|
if ("1".equals(ocrenabled)) {
|
|
|
|
|
a = 1;
|
|
|
|
|
}
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|