堃博生物OA对接宁波银行
This commit is contained in:
parent
be5923d8ea
commit
d1825d3543
|
@ -51,6 +51,13 @@
|
|||
<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>
|
||||
|
|
|
@ -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,28 @@
|
|||
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
|
||||
**/
|
||||
JsonResultEntity sendNbBank(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 此方法获取初始化参数,拼接请求参数
|
||||
* @author laborer
|
||||
* @date 2024/5/27 0027 11:38
|
||||
*
|
||||
*/
|
||||
SysExtensionApiEntity doChangeData(SysExtensionApiEntity entity);
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package com.hzya.frame.ningboBankTreasury.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.bip.v3.v2207.dps.service.impl.PayMentServiceImpl;
|
||||
import com.hzya.frame.ningboBankTreasury.service.INingboBankTreasuryService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
|
||||
import com.hzya.frame.util.bipV3.SHA256Util;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.nbcb.sdk.OpenSDK;
|
||||
import com.nbcb.sdk.aes.exception.SDKException;
|
||||
import com.nbcb.sdk.aes.param.ConfigParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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 JsonResultEntity sendNbBank(JSONObject 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());
|
||||
return BaseResult.getFailureMessageEntity("初始化宁波银行OpenSDK错误");
|
||||
}
|
||||
//发送数据
|
||||
try {
|
||||
String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ",""));
|
||||
//String returnData = OpenSDK.send(productID,serviceID,dataJson);
|
||||
if(returnData == null || "".equals(returnData)){
|
||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK返回错误");
|
||||
}
|
||||
try {
|
||||
JSONObject returnJson = JSONObject.parseObject(returnData);
|
||||
JSONObject retData = returnJson.getJSONObject("Data");
|
||||
String retCode = retData.getString("retCode");
|
||||
if(retCode != null && "0000".equals(retCode)){
|
||||
return BaseResult.getSuccessMessageEntity("发送宁波银行成功",returnJson);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("发送宁波银行错误",returnJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK返回转换Json错误");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("发送宁波银行OpenSDK错误:{}",e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
|
@ -587,6 +587,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
sysApplicationDatabaseDao.logicRemoveMultiCondition(detailEntity);
|
||||
SysApplicationDatabaseEntity databaseEntity = entity.getDatabaseEntity();
|
||||
if (databaseEntity != null) {
|
||||
databaseEntity.setAppId(entity.getId());
|
||||
databaseEntity.setPassword(AESUtil.encrypt(databaseEntity.getPassword()));
|
||||
databaseEntity.setSts("Y");
|
||||
databaseEntity.setSts("Y");
|
||||
|
|
|
@ -228,7 +228,7 @@ a.id
|
|||
from sys_person a
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and a.id like concat('%',#{id},'%')</if>
|
||||
<if test="organId != null and organId != ''">and a.organ_id like concat('%',#{organId},'%')</if>
|
||||
<if test="organId != null and organId != ''">and a.organ_id = #{organId}</if>
|
||||
<if test="personCode != null and personCode != ''">and a.person_code like concat('%',#{personCode},'%')</if>
|
||||
<if test="personName != null and personName != ''">and a.person_name like concat('%',#{personName},'%')</if>
|
||||
<if test="sex != null and sex != ''">and a.sex like concat('%',#{sex},'%')</if>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue