|
|
@@ -15,8 +15,6 @@ typedef struct MediaData {
|
|
|
} MediaData_t;
|
|
|
*/
|
|
|
|
|
|
-import com.itextpdf.text.log.Logger;
|
|
|
-import com.itextpdf.text.log.LoggerFactory;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
@@ -25,7 +23,6 @@ import java.io.FileOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
public class Finance {
|
|
|
- static Logger logger = LoggerFactory.getLogger(Finance.class);
|
|
|
public native static long NewSdk();
|
|
|
|
|
|
/**
|
|
|
@@ -135,31 +132,31 @@ public class Finance {
|
|
|
static {
|
|
|
String osname = System.getProperties().getProperty("os.name");
|
|
|
if (osname.contains("Windows")) {
|
|
|
- logger.info("系统为Windows");
|
|
|
+ System.out.println("系统为Windows");
|
|
|
//windows下运行需要给资源文件夹下四个注册表存放在下面打印的目录任何一个地方即可,linux直接打包丢上去运行即可
|
|
|
System.out.println(System.getProperty("java.library.path"));
|
|
|
System.loadLibrary("WeWorkFinanceSdk");
|
|
|
} else if (osname.contains("Linux")) {
|
|
|
- logger.info("系统为Linux");
|
|
|
- loadLib("/tmp/libWeWorkFinanceSdk_Java.so");
|
|
|
+ System.out.println("系统为Linux");
|
|
|
+ loadLib("/jniLibs/libWeWorkFinanceSdk_Java.so");
|
|
|
} else {
|
|
|
- logger.error(String.format("不兼容的系统:{%s}, osname"));
|
|
|
+ System.out.println(String.format("不兼容的系统:{%s}, osname"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void loadLib(String libName) {
|
|
|
String folderName = System.getProperty("user.dir") + File.separator;
|
|
|
File libFile = new File(folderName, libName);
|
|
|
- logger.info("libFile:" + libFile.getAbsolutePath());
|
|
|
+ System.out.println("libFile:" + libFile.getAbsolutePath());
|
|
|
//文件存在 则直接加载
|
|
|
if (libFile.exists()) {
|
|
|
- logger.info("加载so库");
|
|
|
+ System.out.println("加载so库");
|
|
|
System.load(libFile.getAbsolutePath());
|
|
|
} else {
|
|
|
- logger.info("so库不存在");
|
|
|
+ System.out.println("so库不存在");
|
|
|
try {
|
|
|
InputStream inputStream = new ClassPathResource(libName).getInputStream();
|
|
|
- logger.info("读取so文件 写入到系统目标路径中");
|
|
|
+ System.out.println("读取so文件 写入到系统目标路径中");
|
|
|
File parentFile = libFile.getParentFile();
|
|
|
if (null != parentFile && !parentFile.exists()) {
|
|
|
parentFile.mkdirs();
|
|
|
@@ -171,9 +168,9 @@ public class Finance {
|
|
|
//关闭流
|
|
|
inputStream.close();
|
|
|
fos.close();
|
|
|
- logger.info("so文件写入成功! 尝试重新加载");
|
|
|
+ System.out.println("so文件写入成功! 尝试重新加载");
|
|
|
System.load(libFile.getAbsolutePath());
|
|
|
- logger.info("so文件重新加载成功!");
|
|
|
+ System.out.println("so文件重新加载成功!");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
// Sentry.captureException(e);
|