Merge branch 'uat_保证金天擎调用' into 'uat'
增加-天擎返回结果由调用方自行判断方法 See merge request eshop/biz_service_ebtp_extend!86
This commit is contained in:
@ -120,6 +120,18 @@ public class CrypConfigureController{
|
|||||||
|
|
||||||
return BaseResponse.success(this.iCrypConfigureService.callUniInterface(bean));
|
return BaseResponse.success(this.iCrypConfigureService.callUniInterface(bean));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 调用天擎接口
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("调用天擎接口")
|
||||||
|
@PostMapping("/callUniInterfaceJson")
|
||||||
|
public BaseResponse<String> callUniInterfaceJson(@RequestBody CrypBean bean) {
|
||||||
|
|
||||||
|
return BaseResponse.success(this.iCrypConfigureService.callUniInterfaceJson(bean));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载失败日志再发送
|
* 加载失败日志再发送
|
||||||
|
@ -5,6 +5,7 @@ import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
|
|||||||
import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLogVo;
|
import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLogVo;
|
||||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean;
|
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean;
|
||||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对数据表 biz_bid_cryp_configure 操作的 service
|
* 对数据表 biz_bid_cryp_configure 操作的 service
|
||||||
@ -12,12 +13,20 @@ import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ICrypConfigureService extends IBaseService<CrypConfigure> {
|
public interface ICrypConfigureService extends IBaseService<CrypConfigure> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用天擎接口
|
* 调用天擎接口
|
||||||
* @param bean
|
* @param bean
|
||||||
* @return
|
* @return true/false
|
||||||
*/
|
*/
|
||||||
Boolean callUniInterface(CrypBean bean);
|
Boolean callUniInterface(CrypBean bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String callUniInterfaceJson(CrypBean bean);
|
||||||
/**
|
/**
|
||||||
* 加载失败日志再发送
|
* 加载失败日志再发送
|
||||||
* @param
|
* @param
|
||||||
|
@ -76,7 +76,7 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
|||||||
private String app_url;
|
private String app_url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用天擎接口
|
* 区块链调用天擎接口
|
||||||
*
|
*
|
||||||
* @param bean
|
* @param bean
|
||||||
* @return
|
* @return
|
||||||
@ -147,11 +147,58 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.iBlockChainLogService.save(blockChainLog);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区块链调用天擎接口
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Async
|
||||||
|
public String callUniInterfaceJson(CrypBean bean) {
|
||||||
|
log.info("区块链------callUniInterface:---入参-----" + JSON.toJSONString(bean));
|
||||||
|
BlockChainLog blockChainLog = new BlockChainLog();
|
||||||
|
blockChainLog.setId(PropertyUtils.getSnowflakeId());
|
||||||
|
//天擎地址
|
||||||
|
if ("1mb6n6635cJkDb3pEQPUFXc2nRJ8RPaS".equals(app_secret)) {
|
||||||
|
//测试环境
|
||||||
|
bean.setUrl(bean.getUrl().replace(app_url, app_url_test));
|
||||||
|
PEM_PATH = "admin_certPrivateNew.pem";
|
||||||
|
CRT_PATH = "adminNew.crt";
|
||||||
|
} else {
|
||||||
|
PEM_PATH = "bidding_certPrivate.pem";
|
||||||
|
CRT_PATH = "bidding.crt";
|
||||||
|
//生产环境
|
||||||
|
bean.setUrl(bean.getUrl().replace(app_url_test, app_url));
|
||||||
|
}
|
||||||
|
log.info("加密文件:" + PEM_PATH);
|
||||||
|
log.info("解密文件:" + CRT_PATH);
|
||||||
|
log.info("请求路径:" + bean.getUrl());
|
||||||
|
blockChainLog.setInterfaceUrl(bean.getUrl());
|
||||||
|
String json = "";
|
||||||
|
String str = "";
|
||||||
|
try {
|
||||||
|
Map<String, Object> map = JSONArray.parseObject(JSONArray.toJSONString(bean.getObject()), Map.class);
|
||||||
|
|
||||||
|
//传入数据解密
|
||||||
|
String sign = getSignValue(map);
|
||||||
|
|
||||||
|
map.put("SIGN", sign);
|
||||||
|
|
||||||
|
json = getUniBss(bean.getReqName(), map);
|
||||||
|
|
||||||
|
str = UniBssServiceImpl.uniBssHttpPost(bean.getUrl(), json);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("区块链调用失败!~-----------------",e);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载失败日志再发送
|
* 加载失败日志再发送
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user