|
|
@ -12,6 +12,10 @@ import cn.hutool.json.JSONUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
|
|
|
|
|
import com.dxhy.order.InvokeDxhyApi; |
|
|
|
|
|
|
|
import com.dxhy.order.ReceiveDxhyApi; |
|
|
|
|
|
|
|
import com.dxhy.order.protocol.invoke.DxhyInterfaceRequest; |
|
|
|
|
|
|
|
import com.dxhy.order.protocol.invoke.DxhyInterfaceResponse; |
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
import com.jianshui.common.core.redis.RedisCache; |
|
|
|
import com.jianshui.common.core.redis.RedisCache; |
|
|
@ -332,6 +336,56 @@ public class ElephantUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 大象请求 大象部署版 v6 无token |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param uri 请求uri |
|
|
|
|
|
|
|
* @param methodName 文档里的"接口方法" |
|
|
|
|
|
|
|
* @param data 请求体 |
|
|
|
|
|
|
|
* @param companyservice companyservice |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static AjaxResult sendRequestWithoutTokenV6(String uri, String methodName, JSON data, Companyservice companyservice) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException { |
|
|
|
|
|
|
|
ICompanyservicePropService companyserviceProp = SpringUtils.getBean(ICompanyservicePropService.class); |
|
|
|
|
|
|
|
CompanyserviceProp secretIdProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "elephant_secret_id"); |
|
|
|
|
|
|
|
if (secretIdProp == null) { |
|
|
|
|
|
|
|
throw new JianshuiServiceException("企业未配置属性,请联系管理员!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String secretId = secretIdProp.getValue(); |
|
|
|
|
|
|
|
CompanyserviceProp sercretKeyProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "elephant_secret_key"); |
|
|
|
|
|
|
|
if (sercretKeyProp == null) { |
|
|
|
|
|
|
|
throw new JianshuiServiceException("企业未配置属性,请联系管理员!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String sercretKey = sercretKeyProp.getValue(); |
|
|
|
|
|
|
|
BASE64Encoder encoder = new BASE64Encoder(); |
|
|
|
|
|
|
|
byte[] contentByte = JSONUtil.toJsonStr(data).getBytes(); |
|
|
|
|
|
|
|
// byte[] contentByte = "{\"DDPCXX\":{\"DDQQPCH\":\"5767e3e0907c4e3c848c3f459b68394b\",\"NSRSBH\":\"110101MYJ2GPQQ4\",\"FPLXDM\":\"004\"},\"DDZXX\":[{\"DDTXX\":{\"DDQQLSH\":\"4767e3e0907c4e3c848c3f459b68394b\",\"NSRSBH\":\"110101MYJ2GPQQ4\",\"NSRMC\":\"测试 localhost\",\"KPLX\":\"0\",\"XHFSBH\":\"110101MYJ2GPQQ4\",\"XHFMC\":\"测试 localhost\",\"XHFDZ\":\"山东省济南市济微路141号中铁物流园1楼\",\"XHFDH\":\"1\",\"XHFYH\":\"齐鲁银行济南王官庄支行 1170 8140 0000 0016 252\",\"XHFZH\":\"1170814000000016252\",\"GMFSBH\":\"91320700774687205M\",\"GMFMC\":\"连云港天邦科技开发有限公司\",\"GMFDZ\":\"江苏省连云港市海州开发区新浦工业园振兴路\",\"GMFDH\":\"0518-85287867\",\"GMFYH\":\"江苏银行连云港浦中支行 \",\"GMFZH\":\"70300101314068535\",\"GMFLX\":\"01\",\"KPR\":\"test1\",\"QDBZ\":\"0\",\"JSHJ\":\"7475.76\",\"HJJE\":\"6615.72\",\"HJSE\":\"860.04\",\"DDH\":\"4767e3e0907c4e3c848c3f459b68394b\",\"DDSJ\":\"2022-05-17 10:09:33\"},\"DDMXXX\":[{\"XH\":\"1\",\"FPHXZ\":\"0\",\"SPBM\":\"108020799\",\"YHZCBS\":\"0\",\"XMMC\":\"圆钢\",\"GGXH\":\"60\",\"DW\":\"吨\",\"SPSL\":1.014,\"DJ\":\"4991.15\",\"JE\":\"5061.03\",\"HSBZ\":\"0\",\"SL\":\"0.13\",\"SE\":\"657.93\",\"BYZD1\":\"\",\"BYZD2\":\"\",\"BYZD3\":\"\"},{\"XH\":\"2\",\"FPHXZ\":\"0\",\"SPBM\":\"108020799\",\"YHZCBS\":\"0\",\"XMMC\":\"圆钢\",\"GGXH\":\"55\",\"DW\":\"吨\",\"SPSL\":0.23,\"DJ\":\"4902.65\",\"JE\":\"1127.61\",\"HSBZ\":\"0\",\"SL\":\"0.13\",\"SE\":\"146.59\",\"BYZD1\":\"\",\"BYZD2\":\"\",\"BYZD3\":\"\"},{\"XH\":\"3\",\"FPHXZ\":\"0\",\"SPBM\":\"108020799\",\"YHZCBS\":\"0\",\"XMMC\":\"圆钢\",\"GGXH\":\"10\",\"DW\":\"吨\",\"SPSL\":0.076,\"DJ\":\"5619.47\",\"JE\":\"427.08\",\"HSBZ\":\"0\",\"SL\":\"0.13\",\"SE\":\"55.52\",\"BYZD1\":\"\",\"BYZD2\":\"\",\"BYZD3\":\"\"}]}]}".getBytes();
|
|
|
|
|
|
|
|
String byteContent = encoder.encode(contentByte); |
|
|
|
|
|
|
|
boolean isDevMode = CommonUtils.isDevMode(); |
|
|
|
|
|
|
|
String host = ElephantConstants.PROD_HOST_LOCAL; |
|
|
|
|
|
|
|
if (isDevMode) { |
|
|
|
|
|
|
|
host = ElephantConstants.DEV_HOST_LOCAL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//kk TODO : 2023/9/5 大象接口迁京东云
|
|
|
|
|
|
|
|
//https://js.ele12.com/
|
|
|
|
|
|
|
|
host = "https://js.ele12.com/order-api"; |
|
|
|
|
|
|
|
String url = host + uri; |
|
|
|
|
|
|
|
DxhyInterfaceRequest dxhyInterfaceRequest = new DxhyInterfaceRequest(); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setRequestUrl(url); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setRequestType("POST"); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setHttpTimeOut("100000"); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setDataExchangeId("1617954341800234234234552"); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setSecretId(secretId); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setSecretKey(sercretKey); |
|
|
|
|
|
|
|
dxhyInterfaceRequest.setContent(byteContent); |
|
|
|
|
|
|
|
DxhyInterfaceResponse dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest); |
|
|
|
|
|
|
|
log.info("请求成功,结果{}",JSONUtil.toJsonStr(dxhyInterfaceResponse)); |
|
|
|
|
|
|
|
String code = dxhyInterfaceResponse.getCode(); |
|
|
|
|
|
|
|
return AjaxResult.error("请求失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 大象请求 大象部署版 1.2.4 无token |
|
|
|
* 大象请求 大象部署版 1.2.4 无token |
|
|
|
* |
|
|
|
* |
|
|
|