提交 afc108c0 authored 作者: aiqingguo's avatar aiqingguo

银行测试

上级 c36e3c41
...@@ -4,17 +4,17 @@ import com.clx.performance.service.TempService; ...@@ -4,17 +4,17 @@ import com.clx.performance.service.TempService;
import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO; import com.clx.performance.vo.pc.child.OrderChildLineStatisticsVO;
import com.msl.common.result.Result; import com.msl.common.result.Result;
import com.nbcb.sdk.OpenSDK; import com.nbcb.sdk.OpenSDK;
import com.openapi.sdk.test.Demo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.init.ResourceReader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.net.URL; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/** /**
...@@ -44,14 +44,25 @@ public class TempBankController { ...@@ -44,14 +44,25 @@ public class TempBankController {
private void bankTest() throws Exception { private void bankTest() throws Exception {
String priKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgTt6OadouxxxSDg/0SZdOIBqtnFGKrpwmL+quEUf+hfSgCgYIKoEcz1UBgi2hRANCAAQGHNN2NO7btp+w1248yk98E0asGC8sG0bmIzdom4M0xp3vc4IfXjmZ8omUz4oVcjzAuyMSSpJM6uPLcU1SH4HZ"; String priKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgTt6OadouxxxSDg/0SZdOIBqtnFGKrpwmL+quEUf+hfSgCgYIKoEcz1UBgi2hRANCAAQGHNN2NO7btp+w1248yk98E0asGC8sG0bmIzdom4M0xp3vc4IfXjmZ8omUz4oVcjzAuyMSSpJM6uPLcU1SH4HZ";
log.info("path:{}", TempBankController.class.getClassLoader().getResource("").getPath()); InputStream inputStream = ResourceReader.class.getClassLoader().getResourceAsStream("test.txt");
if (inputStream != null) {
OpenSDK.init(inputStream, priKey);
OpenSDK.init(TempBankController.class.getClassLoader().getResource("config.properties").getPath(), priKey); String filePath = "a.txt";
String res1 = OpenSDK.sendFile("", "open-filegateway",TempBankController.class.getClassLoader().getResource("bank.txt").getPath());
try (FileOutputStream fos = new FileOutputStream(filePath)) {
fos.write("123 测试".getBytes());
String res1 = OpenSDK.sendFile("", "open-filegateway",fos.toString());
log.info("url:{}", res1); log.info("url:{}", res1);
} catch (IOException e) {
e.printStackTrace();
}
}
} }
...@@ -66,25 +77,17 @@ public class TempBankController { ...@@ -66,25 +77,17 @@ public class TempBankController {
} }
} }
//商户私钥 /**
private static String priKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgTt6OadouxxxSDg/0SZdOIBqtnFGKrpwmL+quEUf+hfSgCgYIKoEcz1UBgi2hRANCAAQGHNN2NO7btp+w1248yk98E0asGC8sG0bmIzdom4M0xp3vc4IfXjmZ8omUz4oVcjzAuyMSSpJM6uPLcU1SH4HZ"; * @throws Exception
static { */
// // 初始化(只需在系统启动时初始化一次,config.properties的路径可以是绝对路径,也可以是当前工程的相对路径) public static void callBySepJson() throws Exception {
// URL resource = TempBankController.class.getClassLoader().getResource("config.properties"); String priKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgTt6OadouxxxSDg/0SZdOIBqtnFGKrpwmL+quEUf+hfSgCgYIKoEcz1UBgi2hRANCAAQGHNN2NO7btp+w1248yk98E0asGC8sG0bmIzdom4M0xp3vc4IfXjmZ8omUz4oVcjzAuyMSSpJM6uPLcU1SH4HZ";
// String path = resource.getPath();
//
// System.out.println(TempBankController.class.getClassLoader().getResource("config.properties").getPath());
System.out.println(TempBankController.class.getClassLoader().getResource("").getPath()); System.out.println(TempBankController.class.getClassLoader().getResource("").getPath());
OpenSDK.init(TempBankController.class.getClassLoader().getResource("config.properties").getPath(), priKey); OpenSDK.init(TempBankController.class.getClassLoader().getResource("config.properties").getPath(), priKey);
}
/**
* @throws Exception
*/
public static void callBySepJson() throws Exception {
/* /*
* dataJson 是放置具体交易请求业务报文,dataJson报文结构如下: {"Data":{"app_name":"1"}} * dataJson 是放置具体交易请求业务报文,dataJson报文结构如下: {"Data":{"app_name":"1"}}
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论