Commit 6088b120 by s_guodong

修改bug

parent 7409e0ce
...@@ -10,7 +10,7 @@ import java.util.Map; ...@@ -10,7 +10,7 @@ import java.util.Map;
import org.apache.commons.collections.map.LinkedMap; import org.apache.commons.collections.map.LinkedMap;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
public class ApiUtil { public class ApiUtil {
...@@ -51,7 +51,7 @@ public class ApiUtil { ...@@ -51,7 +51,7 @@ public class ApiUtil {
File f = new File(dirpath); File f = new File(dirpath);
String[] listFile = f.list(); String[] listFile = f.list();
for (int i = 0; i < listFile.length; i++) { for (int i = 0; i < listFile.length; i++) {
String now = CommonUtil.formatNow("yy-MM-dd"); String now = CommonFunctionUtils.formatNow("yy-MM-dd");
// 文件名的1-9位 // 文件名的1-9位
String fileHead = listFile[i].substring(1, 9); String fileHead = listFile[i].substring(1, 9);
if (fileHead.equals(now)) { if (fileHead.equals(now)) {
...@@ -64,8 +64,8 @@ public class ApiUtil { ...@@ -64,8 +64,8 @@ public class ApiUtil {
public static List<String> sendpack(List<String> list, String nowdate, int set) throws ParseException { public static List<String> sendpack(List<String> list, String nowdate, int set) throws ParseException {
List<String> liststr = new ArrayList<String>(); List<String> liststr = new ArrayList<String>();
Date date = CommonUtil.dateAdd(CommonUtil.parseDate(nowdate, "MM-dd HH:mm:ss"), 1, set); Date date = CommonFunctionUtils.dateAdd(CommonFunctionUtils.parseDate(nowdate, "MM-dd HH:mm:ss"), 1, set);
String logdate = CommonUtil.format(date, "MM-dd HH:mm:ss"); String logdate = CommonFunctionUtils.format(date, "MM-dd HH:mm:ss");
// System.out.println("logdate=" + logdate); // System.out.println("logdate=" + logdate);
for (String logstr : list) { for (String logstr : list) {
String loghead = logstr.substring(1, 15); String loghead = logstr.substring(1, 15);
...@@ -84,7 +84,7 @@ public class ApiUtil { ...@@ -84,7 +84,7 @@ public class ApiUtil {
list.add("[09-02 19:28:57]:所有回报:0857APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#"); list.add("[09-02 19:28:57]:所有回报:0857APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#");
list.add("[09-02 19:28:58]:所有回1报:0858APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#"); list.add("[09-02 19:28:58]:所有回1报:0858APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#");
list.add("[09-02 19:28:59]:所有回报:0859APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#"); list.add("[09-02 19:28:59]:所有回报:0859APINAME=onRecvDeferQuotation#DATATYPE=TDeferQuotation^instID=Ag(T+D)^name=白银延期^lastSettle=3362.000000^lastClose=3355.000000^open=3352.000000^high=3365.000000^low=3339.000000^last=3362.000000^close=0.000000^settle=0.000000^bid1=3361.000000^bidLot1=899^bid2=3360.000000^bidLot2=22^bid3=3359.000000^bidLot3=17^bid4=3358.000000^bidLot4=98^bid5=3357.000000^bidLot5=33^ask1=3362.000000^askLot1=164^ask2=3363.000000^askLot2=257^ask3=3364.000000^askLot3=335^ask4=3365.000000^askLot4=3701^ask5=3366.000000^askLot5=917^volume=334752^weight=334752.000000^highLimit=3630.000000^lowLimit=3093.000000^Posi=5403802^upDown=0.000000^upDownRate=0.000000^turnOver=1123360354.000000^average=3355.000000^quoteDate=20160328^quoteTime=02:25:23^sequenceNo=36202^#DATATYPE=TTRspMsg^Flag=L^RspCode=RSP000000^RspMsg=交易成功^#DATATYPE=String^val=^#");
String now = CommonUtil.formatNow("MM-dd HH:mm:ss"); String now = CommonFunctionUtils.formatNow("MM-dd HH:mm:ss");
System.out.println(sendpack(list, "09-02 19:28:59", -1)); System.out.println(sendpack(list, "09-02 19:28:59", -1));
} }
......
...@@ -7,7 +7,7 @@ import java.net.URL; ...@@ -7,7 +7,7 @@ import java.net.URL;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.util.StringUtil; import com.brilliance.eibs.util.StringUtil;
import com.cfca.util.pki.api.CertUtil; import com.cfca.util.pki.api.CertUtil;
import com.cfca.util.pki.api.EncryptUtil; import com.cfca.util.pki.api.EncryptUtil;
...@@ -47,7 +47,7 @@ public class CfcaMsg { ...@@ -47,7 +47,7 @@ public class CfcaMsg {
URL url = Thread.currentThread().getContextClassLoader() URL url = Thread.currentThread().getContextClassLoader()
.getResource(relativePath); .getResource(relativePath);
if (url == null) { if (url == null) {
url = CommonUtil.class.getClassLoader().getResource( url = CommonFunctionUtils.class.getClassLoader().getResource(
relativePath); relativePath);
} }
return url; return url;
......
...@@ -21,7 +21,7 @@ import org.apache.poi.ss.usermodel.Sheet; ...@@ -21,7 +21,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.util.LogUtil; import com.brilliance.eibs.util.LogUtil;
import com.brilliance.eibs.util.StringUtil; import com.brilliance.eibs.util.StringUtil;
...@@ -492,7 +492,7 @@ public class ExcelUtil { ...@@ -492,7 +492,7 @@ public class ExcelUtil {
if (newValue.trim().length() == 8) { if (newValue.trim().length() == 8) {
newValue = newValue.substring(0, 4) + "/" + newValue.substring(4, 6) + "/" + newValue.substring(6, 8); newValue = newValue.substring(0, 4) + "/" + newValue.substring(4, 6) + "/" + newValue.substring(6, 8);
} }
newCell.setCellValue(CommonUtil.parseDate(newValue, "yyy/MM/dd")); newCell.setCellValue(CommonFunctionUtils.parseDate(newValue, "yyy/MM/dd"));
} }
} }
......
...@@ -630,8 +630,8 @@ public class MTUnPackMessage extends AbstractMTPackMessage { ...@@ -630,8 +630,8 @@ public class MTUnPackMessage extends AbstractMTPackMessage {
// String pyr=tmp.get("50K"); // String pyr=tmp.get("50K");
// String[]PYRADRBLKS= getTwoLayerFiledVal(pyr); // String[]PYRADRBLKS= getTwoLayerFiledVal(pyr);
// System.out.println(PYRADRBLKS[0]); // System.out.println(PYRADRBLKS[0]);
// System.out.println(CommonUtil.toJson(tmp)); // System.out.println(CommonFunctionUtils.toJson(tmp));
// System.out.println(CommonUtil.toJson(getSwfMsgInfo(filepath))); // System.out.println(CommonFunctionUtils.toJson(getSwfMsgInfo(filepath)));
// System.out.println(isContainFieldIn4(filepath,"52[A]")); // System.out.println(isContainFieldIn4(filepath,"52[A]"));
// System.out.println(getFieldValIn4(filepath,"72")); // System.out.println(getFieldValIn4(filepath,"72"));
// System.out.println(getTwoLayerFiledVal(tmp.get("59"))[1]); // System.out.println(getTwoLayerFiledVal(tmp.get("59"))[1]);
......
...@@ -3,7 +3,7 @@ package com.brilliance.eibs.bean; ...@@ -3,7 +3,7 @@ package com.brilliance.eibs.bean;
import com.brilliance.eibs.core.exception.InterfaceException; import com.brilliance.eibs.core.exception.InterfaceException;
import com.brilliance.eibs.core.model.impl.ClassDef; import com.brilliance.eibs.core.model.impl.ClassDef;
import com.brilliance.eibs.core.model.impl.ClassListDef; import com.brilliance.eibs.core.model.impl.ClassListDef;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.util.ClassPathUpdater; import com.brilliance.eibs.util.ClassPathUpdater;
import com.brilliance.eibs.util.Serializable2FileUtil; import com.brilliance.eibs.util.Serializable2FileUtil;
import com.brilliance.eibs.util.StringUtil; import com.brilliance.eibs.util.StringUtil;
...@@ -523,8 +523,8 @@ public class ParseConfig ...@@ -523,8 +523,8 @@ public class ParseConfig
try try
{ {
// String classpath = this.getClass().getClassLoader().getResource("").getFile() + path; // String classpath = this.getClass().getClassLoader().getResource("").getFile() + path;
String classpath = CommonUtil.getCommonURL("").getFile() + path; String classpath = CommonFunctionUtils.getCommonURL("").getFile() + path;
classpath = CommonUtil.decodeURL(classpath); classpath = CommonFunctionUtils.decodeURL(classpath);
logger.debug("buildpath=" + classpath); logger.debug("buildpath=" + classpath);
File fp = new File(buildpath); File fp = new File(buildpath);
// 创建目录 // 创建目录
...@@ -568,8 +568,8 @@ public class ParseConfig ...@@ -568,8 +568,8 @@ public class ParseConfig
{ {
//String separeator=System.getProperty("file.separator"); //String separeator=System.getProperty("file.separator");
// String classpath = this.getClass().getClassLoader().getResource("").getFile() + path; // String classpath = this.getClass().getClassLoader().getResource("").getFile() + path;
String classpath = CommonUtil.getCommonURL("").getFile() + path; String classpath = CommonFunctionUtils.getCommonURL("").getFile() + path;
classpath = CommonUtil.decodeURL(classpath); classpath = CommonFunctionUtils.decodeURL(classpath);
logger.debug("classpath=" + classpath); logger.debug("classpath=" + classpath);
String packagePath = bean.getPackageName().replace(".", separator); String packagePath = bean.getPackageName().replace(".", separator);
logger.debug("packagePath=" + packagePath); logger.debug("packagePath=" + packagePath);
......
...@@ -13,7 +13,7 @@ import com.brilliance.eibs.core.service.instance.plugin.JdbcExecutor; ...@@ -13,7 +13,7 @@ import com.brilliance.eibs.core.service.instance.plugin.JdbcExecutor;
import com.brilliance.eibs.core.service.instance.plugin.SocketProxy; import com.brilliance.eibs.core.service.instance.plugin.SocketProxy;
import com.brilliance.eibs.el.AbstractEL; import com.brilliance.eibs.el.AbstractEL;
import com.brilliance.eibs.el.ApacheJexl; import com.brilliance.eibs.el.ApacheJexl;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.factory.parser.XmlValidator; import com.brilliance.eibs.factory.parser.XmlValidator;
import com.brilliance.eibs.sqlite.Sqlite_OP; import com.brilliance.eibs.sqlite.Sqlite_OP;
import com.brilliance.eibs.util.*; import com.brilliance.eibs.util.*;
...@@ -2091,7 +2091,7 @@ public abstract class AbsFilter implements IFilterInstance { ...@@ -2091,7 +2091,7 @@ public abstract class AbsFilter implements IFilterInstance {
*/ */
public String exchangeStr(String rawstr) { public String exchangeStr(String rawstr) {
if (rawstr.startsWith("0x")) { if (rawstr.startsWith("0x")) {
rawstr = new String(CommonUtil.parseHexStr2Byte(rawstr.replace("0x", ""))); rawstr = new String(CommonFunctionUtils.parseHexStr2Byte(rawstr.replace("0x", "")));
} else { } else {
rawstr = rawstr.replace("\\r", "\r").replace("\\n", "\n").replace("\\t", "\t"); rawstr = rawstr.replace("\\r", "\r").replace("\\n", "\n").replace("\\t", "\t");
} }
......
...@@ -48,8 +48,8 @@ public class ApacheJexl extends AbstractEL { ...@@ -48,8 +48,8 @@ public class ApacheJexl extends AbstractEL {
try { try {
// TODO 需要完善的代码 // TODO 需要完善的代码
// funcs.put(null, // funcs.put(null,
// Class.forName("com.brilliance.eibs.el.CommonUtil")); // Class.forName("com.brilliance.eibs.el.CommonFunctionUtils"));CommonFunctionUtils
funcs.put(null, Thread.currentThread().getContextClassLoader().loadClass("com.brilliance.eibs.el.CommonUtil")); funcs.put(null, Thread.currentThread().getContextClassLoader().loadClass("com.brilliance.eibs.el.CommonFunctionUtils"));
Iterator<FunctionKey> it = funcMap.keySet().iterator(); Iterator<FunctionKey> it = funcMap.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
FunctionKey fk = (FunctionKey) it.next(); FunctionKey fk = (FunctionKey) it.next();
...@@ -254,7 +254,7 @@ public class ApacheJexl extends AbstractEL { ...@@ -254,7 +254,7 @@ public class ApacheJexl extends AbstractEL {
} }
// 通用函数的处理 // 通用函数的处理
else if (expression.matches("[\\w]+\\([\\w\\W]*\\)")) { else if (expression.matches("[\\w]+\\([\\w\\W]*\\)")) {
invokeStaticMethod(value, CommonUtil.class, expression, context); invokeStaticMethod(value, CommonFunctionUtils.class, expression, context);
} else if (expression.matches("([\\w]+\\.[\\w]+)(\\([\\w\\W]*\\))")) { } else if (expression.matches("([\\w]+\\.[\\w]+)(\\([\\w\\W]*\\))")) {
String objstr = getMatchedPortion(expression, "([\\w]+)\\.[\\w]+(\\([\\w\\W]*\\))", 1); String objstr = getMatchedPortion(expression, "([\\w]+)\\.[\\w]+(\\([\\w\\W]*\\))", 1);
invokeMethod(value, context.getVariable(objstr), expression, context); invokeMethod(value, context.getVariable(objstr), expression, context);
......
package com.brilliance.eibs.el;
import com.brilliance.eibs.util.ByteUtil;
import com.brilliance.eibs.util.DateUtil;
import com.brilliance.eibs.util.NumberUtil;
import com.google.gson.Gson;
import org.apache.commons.lang.time.DateUtils;
import javax.xml.datatype.XMLGregorianCalendar;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.text.ParseException;
import java.util.Date;
/**
* @Description
* @Author s_guodong
* @Date 2022/6/30
*/
public class CommonUtil {
public static String decodeURL(String path) {
try {
return URLDecoder.decode(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
}
return null;
}
public static URL getCommonURL(String relativePath) {
URL url = Thread.currentThread().getContextClassLoader()
.getResource(relativePath);
if (url == null) {
url = CommonUtil.class.getClassLoader().getResource(
relativePath);
if (url == null) {
url = CommonUtil.class.getClassLoader()
.getResource("");
try {
return new URL(url + relativePath);
} catch (MalformedURLException e) {
}
}
}
return url;
}
public static final Date dateAdd(Date paramDate, int paramInt1,
int paramInt2) {
return DateUtil.dateAdd(paramDate, paramInt1, paramInt2);
}
public static Date parseDate(Date date, String parsePattern)
throws ParseException {
return DateUtil.parseDate(date, parsePattern);
}
public static Date parseDate(String date, String parsePattern)
throws ParseException {
return DateUtils.parseDate(date, new String[] { parsePattern });
}
public static String formatNow() {
return DateUtil.formatNow();
}
public static String formatNow(String pattern) {
return DateUtil.formatNow(pattern);
}
public static String format(Date date) {
return DateUtil.format(date);
}
public static String format(Date date, String pattern) {
return DateUtil.format(date, pattern);
}
public static String format(XMLGregorianCalendar xgc, String pattern) {
return DateUtil.format(xgc, pattern);
}
public static byte[] intToBytes(int i, int flg) {
return ByteUtil.intToBytes(i, flg);
}
public static byte[] intToBytes(int i) {
return ByteUtil.intToBytes(i);
}
public static int bytesToInt(byte[] bytes) {
return ByteUtil.bytesToInt(bytes);
}
public static String decimalFormat2(Object decimal, int num) {
if (decimal == null || ((decimal instanceof String) && (decimal.toString().trim().equals("")))) {
decimal = "0";
}
return decimalFormat(decimal, num);
}
public static String decimalFormat(Object decimal, int num) {
return NumberUtil.decimalFormat(decimal, num);
}
public static byte[] parseHexStr2Byte(String hexStr) {
return ByteUtil.parseHexStr2Byte(hexStr);
}
public static String toJson(Object obj) {
return new Gson().toJson(obj);
}
/**
* 判断给定路径下的文件是否存在
*
* @return 存在返回文件路径,否则返回空
*/
public static String getFilePath(String filepth) {
File f = null;
try {
f = new File(getCommonURL(filepth).toURI());
} catch (URISyntaxException e) {
return null;
}
return f == null ? null : f.exists() ? f.getPath() : null;
}
}
package com.brilliance.eibs.listener.helpers.impl; package com.brilliance.eibs.listener.helpers.impl;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.factory.parser.impl.XmlParser; import com.brilliance.eibs.factory.parser.impl.XmlParser;
import com.brilliance.eibs.listener.helpers.Watchdog; import com.brilliance.eibs.listener.helpers.Watchdog;
import com.brilliance.eibs.server.manager.EibsServiceHandle; import com.brilliance.eibs.server.manager.EibsServiceHandle;
...@@ -45,9 +45,9 @@ public abstract class FilesWatchdog extends Watchdog { ...@@ -45,9 +45,9 @@ public abstract class FilesWatchdog extends Watchdog {
// 遍历所有监控文件或目录 // 遍历所有监控文件或目录
for (String pathname : pathnames) { for (String pathname : pathnames) {
// url = this.getClass().getClassLoader().getResource(pathname); // url = this.getClass().getClassLoader().getResource(pathname);
url = CommonUtil.getCommonURL(pathname); url = CommonFunctionUtils.getCommonURL(pathname);
if (url != null) { if (url != null) {
file = new File(CommonUtil.decodeURL(url.getFile())); file = new File(CommonFunctionUtils.decodeURL(url.getFile()));
long l; long l;
String filename; String filename;
if (file.isDirectory()) { if (file.isDirectory()) {
...@@ -108,9 +108,9 @@ public abstract class FilesWatchdog extends Watchdog { ...@@ -108,9 +108,9 @@ public abstract class FilesWatchdog extends Watchdog {
Map<String, List<String>> changedFileMap = new HashMap<String, List<String>>(); Map<String, List<String>> changedFileMap = new HashMap<String, List<String>>();
for (String pathname : pathnames) { for (String pathname : pathnames) {
// URL url = this.getClass().getClassLoader().getResource(pathname); // URL url = this.getClass().getClassLoader().getResource(pathname);
URL url = CommonUtil.getCommonURL(pathname); URL url = CommonFunctionUtils.getCommonURL(pathname);
if (url != null) { if (url != null) {
File file = new File(CommonUtil.decodeURL(url.getFile())); File file = new File(CommonFunctionUtils.decodeURL(url.getFile()));
if (file.isDirectory()) { if (file.isDirectory()) {
// 非主配置文件目录 // 非主配置文件目录
if (!pathname.equals(XmlParser.MAIN_PATH)) { if (!pathname.equals(XmlParser.MAIN_PATH)) {
......
...@@ -12,7 +12,7 @@ import com.brilliance.eibs.core.service.instance.TransactionInstance; ...@@ -12,7 +12,7 @@ import com.brilliance.eibs.core.service.instance.TransactionInstance;
import com.brilliance.eibs.el.AbstractEL; import com.brilliance.eibs.el.AbstractEL;
import com.brilliance.eibs.el.ApacheEL; import com.brilliance.eibs.el.ApacheEL;
import com.brilliance.eibs.el.ApacheJexl; import com.brilliance.eibs.el.ApacheJexl;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.factory.BeanFactory; import com.brilliance.eibs.factory.BeanFactory;
import com.brilliance.eibs.factory.FactoryManager; import com.brilliance.eibs.factory.FactoryManager;
import com.brilliance.eibs.factory.parser.ConfigParser; import com.brilliance.eibs.factory.parser.ConfigParser;
...@@ -178,7 +178,7 @@ public class Client { ...@@ -178,7 +178,7 @@ public class Client {
boolean reload = false; boolean reload = false;
try { try {
context.addVariable("transaction", Constants.Log_VAR, logger); context.addVariable("transaction", Constants.Log_VAR, logger);
context.addVariable("transaction", Constants.DATE_VAR, CommonUtil.format(new Date(), "yyyyMMdd")); context.addVariable("transaction", Constants.DATE_VAR, CommonFunctionUtils.format(new Date(), "yyyyMMdd"));
BeanFactory beanFactory = FactoryManager.getBeanFactory(); BeanFactory beanFactory = FactoryManager.getBeanFactory();
// context.setBeanFactory(beanFactory);//设置上下文内存 // context.setBeanFactory(beanFactory);//设置上下文内存
...@@ -393,7 +393,7 @@ public class Client { ...@@ -393,7 +393,7 @@ public class Client {
boolean reload = false; boolean reload = false;
try { try {
context.addVariable("transaction", Constants.Log_VAR, logger); context.addVariable("transaction", Constants.Log_VAR, logger);
context.addVariable("transaction", Constants.DATE_VAR, CommonUtil.format(new Date(), "yyyyMMdd")); context.addVariable("transaction", Constants.DATE_VAR, CommonFunctionUtils.format(new Date(), "yyyyMMdd"));
BeanFactory beanFactory = FactoryManager.getBeanFactory(); BeanFactory beanFactory = FactoryManager.getBeanFactory();
// context.setBeanFactory(beanFactory);//设置上下文内存 // context.setBeanFactory(beanFactory);//设置上下文内存
......
...@@ -6,7 +6,7 @@ import com.brilliance.eibs.core.model.IServiceDef; ...@@ -6,7 +6,7 @@ import com.brilliance.eibs.core.model.IServiceDef;
import com.brilliance.eibs.core.model.ITaskDef; import com.brilliance.eibs.core.model.ITaskDef;
import com.brilliance.eibs.core.service.Context; import com.brilliance.eibs.core.service.Context;
import com.brilliance.eibs.el.ApacheEL; import com.brilliance.eibs.el.ApacheEL;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.factory.BeanFactory; import com.brilliance.eibs.factory.BeanFactory;
import com.brilliance.eibs.factory.FactoryManager; import com.brilliance.eibs.factory.FactoryManager;
import com.brilliance.eibs.factory.parser.ConfigParser; import com.brilliance.eibs.factory.parser.ConfigParser;
...@@ -533,8 +533,8 @@ public class Server { ...@@ -533,8 +533,8 @@ public class Server {
// Thread.currentThread().getContextClassLoader().getResource("").getPath() // Thread.currentThread().getContextClassLoader().getResource("").getPath()
// + "/" + // + "/" +
// PID_FILE_NAME; // PID_FILE_NAME;
String path = CommonUtil.getCommonURL("").getPath() + "/" + PID_FILE_NAME; String path = CommonFunctionUtils.getCommonURL("").getPath() + "/" + PID_FILE_NAME;
path = CommonUtil.decodeURL(path); path = CommonFunctionUtils.decodeURL(path);
File file = new File(path); File file = new File(path);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
......
...@@ -2,7 +2,7 @@ package com.brilliance.eibs.main.client; ...@@ -2,7 +2,7 @@ package com.brilliance.eibs.main.client;
import com.brilliance.eibs.core.service.Context; import com.brilliance.eibs.core.service.Context;
import com.brilliance.eibs.core.service.ResultMsg; import com.brilliance.eibs.core.service.ResultMsg;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.main.Client; import com.brilliance.eibs.main.Client;
import com.brilliance.eibs.server.IServerInstance; import com.brilliance.eibs.server.IServerInstance;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
...@@ -66,7 +66,7 @@ public class ShortSocketHandle implements Runnable { ...@@ -66,7 +66,7 @@ public class ShortSocketHandle implements Runnable {
if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_10)) { if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_10)) {
headLen = Integer.parseInt(new String(headLenBytes)); headLen = Integer.parseInt(new String(headLenBytes));
} else if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_2)) { } else if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_2)) {
headLen = CommonUtil.bytesToInt(headLenBytes); headLen = CommonFunctionUtils.bytesToInt(headLenBytes);
} }
if (is_contain_head_len) { if (is_contain_head_len) {
headLen = headLen - head_len; headLen = headLen - head_len;
...@@ -103,7 +103,7 @@ public class ShortSocketHandle implements Runnable { ...@@ -103,7 +103,7 @@ public class ShortSocketHandle implements Runnable {
if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_10)) { if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_10)) {
header = String.format("%0" + head_len + "d", returnLen).getBytes(); header = String.format("%0" + head_len + "d", returnLen).getBytes();
} else if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_2)) { } else if (head_len_type.equals(IServerInstance.HEAD_LEN_TYPE_2)) {
header = CommonUtil.intToBytes(returnLen); header = CommonFunctionUtils.intToBytes(returnLen);
} }
IOUtils.write(header, socket.getOutputStream()); IOUtils.write(header, socket.getOutputStream());
......
...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.model.IArgumentDef; ...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.model.IArgumentDef;
import com.brilliance.eibs.core.model.IPropertyDef; import com.brilliance.eibs.core.model.IPropertyDef;
import com.brilliance.eibs.core.model.ITaskDef; import com.brilliance.eibs.core.model.ITaskDef;
import com.brilliance.eibs.core.service.ResultMsg; import com.brilliance.eibs.core.service.ResultMsg;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.main.Client; import com.brilliance.eibs.main.Client;
import com.brilliance.eibs.util.StringUtil; import com.brilliance.eibs.util.StringUtil;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -211,8 +211,8 @@ public class CronTask extends Thread { ...@@ -211,8 +211,8 @@ public class CronTask extends Thread {
} }
private static String getPath(ITaskDef taskDef) { private static String getPath(ITaskDef taskDef) {
Date date = CommonUtil.dateAdd(new Date(), 4, Integer.parseInt(taskDef.getDate())); Date date = CommonFunctionUtils.dateAdd(new Date(), 4, Integer.parseInt(taskDef.getDate()));
String filePath = CommonUtil.getCommonURL("").getPath() + "/taskRecord/completed" + CommonUtil.format(date, "yyyyMMdd") String filePath = CommonFunctionUtils.getCommonURL("").getPath() + "/taskRecord/completed" + CommonFunctionUtils.format(date, "yyyyMMdd")
+ ".txt"; + ".txt";
return filePath; return filePath;
} }
......
...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.exception.InterfaceException; ...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.exception.InterfaceException;
import com.brilliance.eibs.core.model.IServiceDef; import com.brilliance.eibs.core.model.IServiceDef;
import com.brilliance.eibs.core.service.Context; import com.brilliance.eibs.core.service.Context;
import com.brilliance.eibs.el.ApacheEL; import com.brilliance.eibs.el.ApacheEL;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.main.Client; import com.brilliance.eibs.main.Client;
import com.sun.net.httpserver.*; import com.sun.net.httpserver.*;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
...@@ -87,7 +87,7 @@ public class HttpsService extends AbsServer { ...@@ -87,7 +87,7 @@ public class HttpsService extends AbsServer {
if (rtnVal instanceof String) { if (rtnVal instanceof String) {
response(httpExchange, (String) rtnVal, encode); response(httpExchange, (String) rtnVal, encode);
} else { } else {
response(httpExchange, CommonUtil.toJson(rtnVal), encode); response(httpExchange, CommonFunctionUtils.toJson(rtnVal), encode);
} }
return; return;
} }
......
...@@ -45,7 +45,7 @@ public class InitServer extends AbsServer { ...@@ -45,7 +45,7 @@ public class InitServer extends AbsServer {
public void call(String interfaceName, String transName) { public void call(String interfaceName, String transName) {
/* /*
* try { CommonUtil.sleep(10000); } catch (InterruptedException * try { CommonFunctionUtils.sleep(10000); } catch (InterruptedException
* e) { // TODO Auto-generated catch block e.printStackTrace(); } * e) { // TODO Auto-generated catch block e.printStackTrace(); }
*/ */
......
...@@ -7,7 +7,7 @@ import java.sql.ResultSet; ...@@ -7,7 +7,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.util.StringUtil; import com.brilliance.eibs.util.StringUtil;
/** /**
...@@ -27,10 +27,10 @@ public class Sqlite_OP { ...@@ -27,10 +27,10 @@ public class Sqlite_OP {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
// URL url = getClass().getClassLoader().getResource(str); // URL url = getClass().getClassLoader().getResource(str);
URL url = CommonUtil.getCommonURL(str); URL url = CommonFunctionUtils.getCommonURL(str);
// String path = url.getPath(); // String path = url.getPath();
String path = url.toExternalForm(); String path = url.toExternalForm();
path = CommonUtil.decodeURL(path); path = CommonFunctionUtils.decodeURL(path);
// System.out.println("path=" + url.getPath()); // System.out.println("path=" + url.getPath());
// System.out.println("externalForm=" + path); // System.out.println("externalForm=" + path);
String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
......
package com.brilliance.eibs.util; package com.brilliance.eibs.util;
import com.brilliance.eibs.bean.ParseConfig; import com.brilliance.eibs.bean.ParseConfig;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
...@@ -82,7 +82,7 @@ public class ClassPathUpdater { ...@@ -82,7 +82,7 @@ public class ClassPathUpdater {
// return // return
// URLDecoder.decode(Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() // URLDecoder.decode(Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath()
// + file, "utf-8"); // + file, "utf-8");
return CommonUtil.decodeURL(CommonUtil.getCommonURL("").getPath() + file); return CommonFunctionUtils.decodeURL(CommonFunctionUtils.getCommonURL("").getPath() + file);
/* /*
* catch (URISyntaxException e) { throw new RuntimeException("URI error.", e); } * catch (URISyntaxException e) { throw new RuntimeException("URI error.", e); }
*/ */
......
package com.brilliance.eibs.util; package com.brilliance.eibs.util;
import com.brilliance.eibs.core.service.Context; import com.brilliance.eibs.core.service.Context;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.util.logging.AbstractLoggingFrame; import com.brilliance.eibs.util.logging.AbstractLoggingFrame;
import com.brilliance.eibs.util.logging.LoggingFrame; import com.brilliance.eibs.util.logging.LoggingFrame;
import com.brilliance.eibs.util.logging.log4j.Log4JLoggingFrame; import com.brilliance.eibs.util.logging.log4j.Log4JLoggingFrame;
...@@ -29,7 +29,7 @@ public class LogUtil { ...@@ -29,7 +29,7 @@ public class LogUtil {
public static final String LOG_PATH = "log"; public static final String LOG_PATH = "log";
public static final String LOG_FILE_NAME_SYMBOL = "interface_id"; public static final String LOG_FILE_NAME_SYMBOL = "interface_id";
public static boolean mode = false; public static boolean mode = false;
public static final String ROOT_PATH = CommonUtil.getFilePath("") + "/"; public static final String ROOT_PATH = CommonFunctionUtils.getFilePath("") + "/";
public static final String LOG_MODE = PropertyUtil.getProperty("sys.properties", "LOGMODE"); public static final String LOG_MODE = PropertyUtil.getProperty("sys.properties", "LOGMODE");
static { static {
......
package com.brilliance.eibs.util; package com.brilliance.eibs.util;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
...@@ -78,7 +78,7 @@ public class NumberUtil { ...@@ -78,7 +78,7 @@ public class NumberUtil {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(CommonUtil.decimalFormat2(null, 2)); System.out.println(CommonFunctionUtils.decimalFormat2(null, 2));
String a = "0.3849999999996"; String a = "0.3849999999996";
System.out.println(NumberUtil.round(Double.valueOf(a), 5)); System.out.println(NumberUtil.round(Double.valueOf(a), 5));
......
package com.brilliance.eibs.util; package com.brilliance.eibs.util;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.velocity.Template; import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
...@@ -17,7 +17,7 @@ import java.util.Map; ...@@ -17,7 +17,7 @@ import java.util.Map;
public class TemplateUtil { public class TemplateUtil {
public static void makeFileByTemplate(String template, Map<String, Object> cache, String outPut, String encode) throws IOException { public static void makeFileByTemplate(String template, Map<String, Object> cache, String outPut, String encode) throws IOException {
ClassLoader classLoader = CommonUtil.class.getClassLoader(); ClassLoader classLoader = CommonFunctionUtils.class.getClassLoader();
URL url = classLoader.getResource("template/"); URL url = classLoader.getResource("template/");
if (url != null) { if (url != null) {
VelocityEngine ve = new VelocityEngine(); VelocityEngine ve = new VelocityEngine();
...@@ -37,7 +37,7 @@ public class TemplateUtil { ...@@ -37,7 +37,7 @@ public class TemplateUtil {
} }
public static void makeFileByTemplate2(String template, Map<String, Object> cache, String outPut, String encode) throws IOException { public static void makeFileByTemplate2(String template, Map<String, Object> cache, String outPut, String encode) throws IOException {
ClassLoader classLoader = CommonUtil.class.getClassLoader(); ClassLoader classLoader = CommonFunctionUtils.class.getClassLoader();
URL url = classLoader.getResource("template/"); URL url = classLoader.getResource("template/");
if (url != null) { if (url != null) {
VelocityEngine ve = new VelocityEngine(); VelocityEngine ve = new VelocityEngine();
......
...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.model.IFieldDef; ...@@ -5,7 +5,7 @@ import com.brilliance.eibs.core.model.IFieldDef;
import com.brilliance.eibs.core.model.ISubfieldDef; import com.brilliance.eibs.core.model.ISubfieldDef;
import com.brilliance.eibs.core.service.Context; import com.brilliance.eibs.core.service.Context;
import com.brilliance.eibs.core.service.instance.impl.AbsFilter; import com.brilliance.eibs.core.service.instance.impl.AbsFilter;
import com.brilliance.eibs.el.CommonUtil; import com.brilliance.eibs.el.CommonFunctionUtils;
import com.brilliance.eibs.factory.parser.XmlValidator; import com.brilliance.eibs.factory.parser.XmlValidator;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter; import org.apache.commons.io.filefilter.DirectoryFileFilter;
...@@ -43,7 +43,7 @@ public class XmlUtil { ...@@ -43,7 +43,7 @@ public class XmlUtil {
**/ **/
public static Collection<File> getAllFile(String path) { public static Collection<File> getAllFile(String path) {
URL url = XmlUtil.getUrl(path); URL url = XmlUtil.getUrl(path);
File srcfile = new File(CommonUtil.decodeURL(url.getPath())); File srcfile = new File(CommonFunctionUtils.decodeURL(url.getPath()));
Collection<File> files = FileUtils.listFiles(srcfile, FileFilterUtils.suffixFileFilter("xml"), DirectoryFileFilter.INSTANCE); Collection<File> files = FileUtils.listFiles(srcfile, FileFilterUtils.suffixFileFilter("xml"), DirectoryFileFilter.INSTANCE);
return files; return files;
} }
...@@ -121,7 +121,7 @@ public class XmlUtil { ...@@ -121,7 +121,7 @@ public class XmlUtil {
* @return * @return
*/ */
public static URL getUrl(String filepath) { public static URL getUrl(String filepath) {
return CommonUtil.getCommonURL(filepath); return CommonFunctionUtils.getCommonURL(filepath);
} }
/** /**
......
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