Commit c5460253 by chengzhuoshen

1.移除掉无效的jar依赖,并修改相关依赖代码,比如velocity,log相关的pom依赖。

parent dfee5fc4
......@@ -35,29 +35,14 @@
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
......
......@@ -31,8 +31,6 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
this.context = context;
}
protected String defaultDateTimeFormate = "yyyy-MM-dd HH:mm:ss,SSS";
//TODO
protected String getRandomNumber(int length) {
String randomNumber = "";
......
package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.util.StringUtil;
import org.dom4j.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FieldB70Generate extends AbstractMx2MtTagsGenerate {
......
package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.util.StringUtil;
import org.dom4j.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
public class FieldB72Generate extends AbstractMx2MtTagsGenerate {
......
......@@ -2,8 +2,6 @@ package com.brilliance.swift.mx2mt.mt900910.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Field13DGenerate extends AbstractMx2MtTagsGenerate {
......
package com.brilliance.swift.mx2mt.mt900910.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.util.StringUtil;
import org.dom4j.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <GrpHdr><MsgId>
......
......@@ -2,8 +2,6 @@ package com.brilliance.swift.mx2mt.mt900910.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <Ntfctn><Ntry><NtryDtls><TxDtls><Refs><EndToEndId>
......
......@@ -2,8 +2,6 @@ package com.brilliance.swift.mx2mt.mt940950.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <Stmt><Acct><Id><IBAN>
......
......@@ -2,8 +2,6 @@ package com.brilliance.swift.mx2mt.mt940950.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <GrpHdr><MsgPgntn><PgNb>
......
......@@ -2,8 +2,6 @@ package com.brilliance.swift.mx2mt.mt940950.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <Stmt><Bal>[i]<Tp><CdOrPrtry><Cd>
......
......@@ -17,7 +17,6 @@
package com.brilliance.swift.util;
import com.brilliance.swift.exception.CommonRuntimeException;
import org.apache.commons.lang.ClassUtils;
import java.io.Closeable;
import java.io.Externalizable;
......@@ -134,7 +133,7 @@ public abstract class ClassUtil {
}
if (cl == null) {
// No thread context class loader -> use class loader of this class.
cl = ClassUtils.class.getClassLoader();
cl = ClassUtil.class.getClassLoader();
if (cl == null) {
// getClassLoader() returning null indicates the bootstrap ClassLoader
try {
......
......@@ -2,7 +2,6 @@ package com.brilliance.swift.util;
import com.brilliance.swift.exception.IORuntimeException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.io.FileFilter;
......@@ -78,7 +77,7 @@ public class FileUtil {
public static URI toURI(String location) {
try {
return new URI(StringUtils.replace(location, " ", "%20"));
return new URI(location.replace(" ", "%20"));
} catch (Exception e) {
throw new IllegalArgumentException("URI转换异常:" + e.getMessage(), e);
}
......
......@@ -2,7 +2,6 @@ package com.brilliance.swift.util;
import com.brilliance.swift.constants.Mx2MtConstants;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.io.FileInputStream;
......@@ -369,7 +368,7 @@ public abstract class StringUtil {
* @throws
*/
public static String getStringByEnter(String string, int length, int rows) {
if (StringUtils.isEmpty(string))
if (StringUtil.isEmpty(string))
return string;
if (--rows <= 0) {
return string.length() > length ? string.substring(0, length) : string;
......
package com.brilliance.swift.util;
import com.brilliance.swift.exception.SwiftException;
import org.apache.commons.io.FileUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URL;
import java.util.Map;
/**
* 通过模型类将模板转成字符串
*
* **/
public class TemplateUtil {
/**
* 通过模型生成函数将模板转成字符串
* @Param String template 模板名称
* @Param cache 模板变量Map集合
* @Param outPut 文件输出保存路径
* @Param encode 文件生成编码
* @Return string 返回生成的文件字符串
* **/
public static String makeFileByTemplate(String template, Map<String, Object> cache, String outPut, String encode) {
String lastStr="";
ClassLoader classLoader = TemplateUtil.class.getClassLoader();
URL url = classLoader.getResource("template/");
if (url != null) {
VelocityEngine ve = new VelocityEngine();
try {
ve.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, url.toURI().getPath());
ve.setProperty(Velocity.OUTPUT_ENCODING, encode);
ve.setProperty(Velocity.INPUT_ENCODING, encode);
ve.init();
VelocityContext context = new VelocityContext();
Template vt = ve.getTemplate(template);
context.put("vm", cache);
StringWriter sw = new StringWriter();
vt.merge(context, sw);
lastStr=sw.toString();
if (!StringUtil.isEmpty(outPut)) {
FileUtils.write(new File(outPut),lastStr.replaceAll("\\\\\\\\", "\\$"), encode, false);
}
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
}
} else {
}
return lastStr;
}
public static void makeFileByTemplate2(String template, Map<String, Object> cache, String outPut, String encode) throws IOException {
ClassLoader classLoader = TemplateUtil.class.getClassLoader();
URL url = classLoader.getResource("template/");
if (url != null) {
VelocityEngine ve = new VelocityEngine();
ve.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, url.getPath());
ve.setProperty(Velocity.OUTPUT_ENCODING, encode);
ve.setProperty(Velocity.INPUT_ENCODING, encode);
ve.init();
VelocityContext context = new VelocityContext();
Template vt = ve.getTemplate(template);
for (String key : cache.keySet()) {
context.put(key, cache.get(key));
}
StringWriter sw = new StringWriter();
vt.merge(context, sw);
FileUtils.write(new File(outPut), sw.toString().replaceAll("\\\\\\\\", "\\$"), encode, false);
} else {
throw new FileNotFoundException("没有在template目录下找到模板文件:" + template);
}
}
public static void main(String[] args) throws Exception {
}
}
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