Merge branch 'fw-ningbobank' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into 237master
Conflicts: base-webapp/pom.xml pom.xml
This commit is contained in:
commit
ec223c07cd
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>kangarooDataCenterV3</artifactId>
|
||||
<groupId>com.hzya.frame</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>fw-ningbobank</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${revision}</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.hzya.frame</groupId>
|
||||
<artifactId>base-service</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql-connector-java}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.hzya.bip</groupId>-->
|
||||
<!-- <artifactId>pubbaseapp_nccloud_rtLevel</artifactId>-->
|
||||
<!-- <version>1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/resources/lib/pubbaseapp_nccloud_rtLevel-1.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.hzya.bipyonyoulog</groupId>-->
|
||||
<!-- <artifactId>yonyoulog</artifactId>-->
|
||||
<!-- <version>1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/resources/lib/yonyoulog.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.hzya.bcprov</groupId>-->
|
||||
<!-- <artifactId>bcprov</artifactId>-->
|
||||
<!-- <version>1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/resources/lib/bcprov-jdk15on-1.70.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.hzya.DataApiSdk</groupId>-->
|
||||
<!-- <artifactId>DataApiSdk</artifactId>-->
|
||||
<!-- <version>1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/resources/lib/DataApiSdk-jar-with-dependencies.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.hzya.openBasicSDK</groupId>
|
||||
<artifactId>openBasicSDK</artifactId>
|
||||
<version>1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/resources/lib/openBasicSDK-2.1.230630.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>none</mainClass> <!-- 取消查找本项目下的Main方法:为了解决Unable to find main class的问题 -->
|
||||
<classifier>execute</classifier> <!-- 为了解决依赖模块找不到此模块中的类或属性 -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
package com.hzya.frame.ningboBankTreasury.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
|
||||
public class NingboBankTreasuryEntity extends BaseEntity {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.hzya.frame.ningboBankTreasury.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
public interface INingboBankTreasuryService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 发送宁波银行
|
||||
* @Date 4:45 下午 2024/7/9
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
Object sendNbBank(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 发送宁波银行下载文件
|
||||
* @Date 4:45 下午 2024/7/9
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
Object sendNbBankFileDownload(JSONObject jsonObject);
|
||||
/**
|
||||
*
|
||||
* @content 此方法获取初始化参数,拼接请求参数
|
||||
* @author laborer
|
||||
* @date 2024/5/27 0027 11:38
|
||||
*
|
||||
*/
|
||||
SysExtensionApiEntity doChangeData(SysExtensionApiEntity entity);
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
package com.hzya.frame.ningboBankTreasury.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.ningboBankTreasury.service.INingboBankTreasuryService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.nbcb.sdk.OpenSDK;
|
||||
import com.nbcb.sdk.aes.exception.SDKException;
|
||||
import com.nbcb.sdk.aes.param.ConfigParam;
|
||||
import com.nbcb.sdk.file.FileDownloadResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service(value = "ningboBankTreasuryServiceImpl")
|
||||
public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(NingboBankTreasuryServiceImpl.class);
|
||||
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 单笔查证接口
|
||||
* @Date 4:45 下午 2024/7/9
|
||||
**/
|
||||
@Override
|
||||
public Object sendNbBank(JSONObject jsonObject) {
|
||||
JSONObject returnJson = new JSONObject();
|
||||
JSONObject entity = getstrObj("jsonStr", jsonObject);
|
||||
String dataJson = entity.getString("Data");
|
||||
String appKey = entity.getString("appKey");
|
||||
String privateKey = entity.getString("privateKey");
|
||||
String publicUrl = entity.getString("publicUrl");
|
||||
String publicKey = entity.getString("publicKey");
|
||||
String productID = entity.getString("productID");
|
||||
String serviceID = entity.getString("serviceID");
|
||||
//初始化宁波银行OpenSDK
|
||||
try {
|
||||
ConfigParam configParam = new ConfigParam(privateKey,publicUrl,appKey,publicKey,10000,20000);
|
||||
OpenSDK.dynamicInit(configParam,true);
|
||||
} catch (SDKException e) {
|
||||
logger.error("初始化宁波银行OpenSDK错误:{}",e.getMessage());
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","初始化宁波银行OpenSDK错误");
|
||||
return returnJson;
|
||||
}
|
||||
//发送数据
|
||||
try {
|
||||
String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ",""));
|
||||
if(returnData == null || "".equals(returnData)){
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK返回错误");
|
||||
return returnJson;
|
||||
}
|
||||
try {
|
||||
returnJson = JSONObject.parseObject(returnData);
|
||||
JSONObject retData = returnJson.getJSONObject("Data");
|
||||
String retCode = retData.getString("retCode");
|
||||
String retMsg = retData.getString("retMsg");
|
||||
returnJson.put("retCode",retCode);
|
||||
returnJson.put("retMsg",retMsg);
|
||||
return returnJson;
|
||||
} catch (Exception e) {
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK返回转换Json错误");
|
||||
return returnJson;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK错误");
|
||||
return returnJson;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 发送宁波银行下载文件
|
||||
*
|
||||
* @Date 4:45 下午 2024/7/9
|
||||
**/
|
||||
@Override
|
||||
public Object sendNbBankFileDownload(JSONObject jsonObject) {
|
||||
JSONObject returnJson = new JSONObject();
|
||||
JSONObject entity = getstrObj("jsonStr", jsonObject);
|
||||
String dataJson = entity.getString("Data");
|
||||
JSONObject data = JSONObject.parseObject(dataJson);
|
||||
JSONObject dataFileid = data.getJSONObject("Data");
|
||||
String appKey = entity.getString("appKey");
|
||||
String privateKey = entity.getString("privateKey");
|
||||
String publicUrl = entity.getString("publicUrl");
|
||||
String publicKey = entity.getString("publicKey");
|
||||
String productID = entity.getString("productID");
|
||||
String serviceID = entity.getString("serviceID");
|
||||
//初始化宁波银行OpenSDK
|
||||
try {
|
||||
ConfigParam configParam = new ConfigParam(privateKey,publicUrl,appKey,publicKey,10000,20000);
|
||||
OpenSDK.dynamicInit(configParam,true);
|
||||
} catch (SDKException e) {
|
||||
logger.error("初始化宁波银行OpenSDK错误:{}",e.getMessage());
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","初始化宁波银行OpenSDK错误");
|
||||
return returnJson;
|
||||
}
|
||||
//发送数据
|
||||
try {
|
||||
FileDownloadResponse returnData = OpenSDK.sendFileDownload(productID,"open-filegateway",dataFileid.getString("fileId"),null);
|
||||
if(returnData == null || "".equals(returnData)){
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK返回错误");
|
||||
return returnJson;
|
||||
}
|
||||
try {
|
||||
|
||||
//returnJson = JSONObject.parseObject(returnData);
|
||||
//JSONObject retData = returnJson.getJSONObject("Data");
|
||||
String retCode = returnData.getRetCode();
|
||||
String retMsg = returnData.getRetMsg();
|
||||
returnJson.put("data",returnData.getData());
|
||||
returnJson.put("retCode",retCode);
|
||||
returnJson.put("retMsg",retMsg);
|
||||
return returnJson;
|
||||
} catch (Exception e) {
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK返回转换Json错误");
|
||||
return returnJson;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
returnJson.put("retCode","9999");
|
||||
returnJson.put("retMsg","发送宁波银行OpenSDK错误");
|
||||
return returnJson;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity
|
||||
* @content 此方法获取初始化参数,拼接请求参数
|
||||
* @author laborer
|
||||
* @date 2024/5/27 0027 11:38
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity doChangeData(SysExtensionApiEntity entity) {
|
||||
try {
|
||||
if(entity == null ){
|
||||
return entity;
|
||||
}
|
||||
Map<String, String> returnHeaders = new HashMap<>();
|
||||
JSONObject returnDataData = new JSONObject();
|
||||
JSONObject returnData = new JSONObject();
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
String bodys = entity.getBodys();
|
||||
JSONObject data = JSONObject.parseObject(bodys);
|
||||
|
||||
//先处理转发请求header
|
||||
returnHeaders.put("yatl",headers.get("yatl"));
|
||||
returnHeaders.put("yadj",headers.get("yadj"));
|
||||
|
||||
returnDataData.put("appKey",headers.get("appKey"));
|
||||
returnDataData.put("privateKey",headers.get("privateKey"));
|
||||
returnDataData.put("publicUrl",headers.get("publicUrl"));
|
||||
returnDataData.put("publicKey",headers.get("publicKey"));
|
||||
returnDataData.put("productID",headers.get("productID"));
|
||||
returnDataData.put("serviceID",headers.get("serviceID"));
|
||||
data.put("custId",headers.get("custId"));
|
||||
returnData.put("Data",data);
|
||||
returnDataData.put("Data",returnData);
|
||||
entity.setHeaders(returnHeaders);
|
||||
entity.setBodys(returnDataData.toJSONString());
|
||||
} catch (Exception e) {
|
||||
//发送内部处理方法错误
|
||||
logger.error("宁波银行内部转换接口错误:{}",e.getMessage());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public JSONObject getstrObj(String key, JSONObject object) {
|
||||
if (checkStr(object.getString(key)) ) {
|
||||
return object.getJSONObject(key);
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
/**
|
||||
* @param str
|
||||
* @return void
|
||||
* @Author lvleigang
|
||||
* @Description 校验字符串
|
||||
* @Date 11:41 上午 2022/12/7
|
||||
**/
|
||||
protected Boolean checkStr(String str) {
|
||||
Boolean flag = true;
|
||||
if (str == null || "".equals(str)) {
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
</web-app>
|
Loading…
Reference in New Issue