修改宁波银行自定义接口的返回格式
This commit is contained in:
parent
d93acb9ffe
commit
4912b61ae4
|
@ -15,7 +15,7 @@ public interface INingboBankTreasuryService {
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
**/
|
**/
|
||||||
JsonResultEntity sendNbBank(JSONObject jsonObject);
|
Object sendNbBank(JSONObject jsonObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,7 +33,8 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService
|
||||||
* @Date 4:45 下午 2024/7/9
|
* @Date 4:45 下午 2024/7/9
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity sendNbBank(JSONObject jsonObject) {
|
public Object sendNbBank(JSONObject jsonObject) {
|
||||||
|
JSONObject returnJson = new JSONObject();
|
||||||
JSONObject entity = getstrObj("jsonStr", jsonObject);
|
JSONObject entity = getstrObj("jsonStr", jsonObject);
|
||||||
String dataJson = entity.getString("Data");
|
String dataJson = entity.getString("Data");
|
||||||
String appKey = entity.getString("appKey");
|
String appKey = entity.getString("appKey");
|
||||||
|
@ -48,30 +49,35 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService
|
||||||
OpenSDK.dynamicInit(configParam,true);
|
OpenSDK.dynamicInit(configParam,true);
|
||||||
} catch (SDKException e) {
|
} catch (SDKException e) {
|
||||||
logger.error("初始化宁波银行OpenSDK错误:{}",e.getMessage());
|
logger.error("初始化宁波银行OpenSDK错误:{}",e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("初始化宁波银行OpenSDK错误");
|
returnJson.put("retCode","9999");
|
||||||
|
returnJson.put("retMsg","初始化宁波银行OpenSDK错误");
|
||||||
|
return returnJson;
|
||||||
}
|
}
|
||||||
//发送数据
|
//发送数据
|
||||||
try {
|
try {
|
||||||
String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ",""));
|
String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ",""));
|
||||||
//String returnData = OpenSDK.send(productID,serviceID,dataJson);
|
|
||||||
if(returnData == null || "".equals(returnData)){
|
if(returnData == null || "".equals(returnData)){
|
||||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK返回错误");
|
returnJson.put("retCode","9999");
|
||||||
|
returnJson.put("retMsg","发送宁波银行OpenSDK返回错误");
|
||||||
|
return returnJson;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
JSONObject returnJson = JSONObject.parseObject(returnData);
|
returnJson = JSONObject.parseObject(returnData);
|
||||||
JSONObject retData = returnJson.getJSONObject("Data");
|
JSONObject retData = returnJson.getJSONObject("Data");
|
||||||
String retCode = retData.getString("retCode");
|
String retCode = retData.getString("retCode");
|
||||||
if(retCode != null && "0000".equals(retCode)){
|
String retMsg = retData.getString("retMsg");
|
||||||
return BaseResult.getSuccessMessageEntity("发送宁波银行成功",returnJson);
|
returnJson.put("retCode",retCode);
|
||||||
}else {
|
returnJson.put("retMsg",retMsg);
|
||||||
return BaseResult.getFailureMessageEntity("发送宁波银行错误",returnJson);
|
return returnJson;
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK返回转换Json错误");
|
returnJson.put("retCode","9999");
|
||||||
|
returnJson.put("retMsg","发送宁波银行OpenSDK返回转换Json错误");
|
||||||
|
return returnJson;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("发送宁波银行OpenSDK错误:{}",e.getMessage());
|
returnJson.put("retCode","9999");
|
||||||
return BaseResult.getFailureMessageEntity("发送宁波银行OpenSDK错误");
|
returnJson.put("retMsg","发送宁波银行OpenSDK错误");
|
||||||
|
return returnJson;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue