diff --git a/jianshui-common/pom.xml b/jianshui-common/pom.xml index 5f2202c..8be2ea7 100644 --- a/jianshui-common/pom.xml +++ b/jianshui-common/pom.xml @@ -161,6 +161,15 @@ compile + + + com.dxhy.order + SIMS-order-sdk + 1.2.3-RELEASE + system + ${project.basedir}/src/main/java/com/jianshui/lib/SIMS-order-sdk-1.2.3-RELEASE.jar + + \ No newline at end of file diff --git a/jianshui-common/src/main/java/com/jianshui/lib/SIMS-order-sdk-1.2.3-RELEASE.jar b/jianshui-common/src/main/java/com/jianshui/lib/SIMS-order-sdk-1.2.3-RELEASE.jar new file mode 100644 index 0000000..208f7a3 Binary files /dev/null and b/jianshui-common/src/main/java/com/jianshui/lib/SIMS-order-sdk-1.2.3-RELEASE.jar differ diff --git a/jianshui-invoice/pom.xml b/jianshui-invoice/pom.xml index b8023a4..68fb234 100644 --- a/jianshui-invoice/pom.xml +++ b/jianshui-invoice/pom.xml @@ -16,11 +16,6 @@ - - com.dxhy.order - SIMS-order-sdk - 1.2.3-RELEASE - com.jianshui @@ -69,6 +64,12 @@ 1.6.2 compile + + + + + + diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstants.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstants.java index 4d59458..761dce9 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstants.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstants.java @@ -17,6 +17,7 @@ public class ElephantConstants { public static String DEV_HOST = "https://sandbox.zncspt.com/api/"; public static String DEV_ELECLOUD_HOST = "https://sandbox.ele-cloud.com/api/"; public static String DEV_HOST_LOCAL = "http://140.143.226.17:8087/order-api"; + public static String DEV_HOST_LOCAL_V6_JingDongYun = "https://js.ele12.com/order-api"; // 生产的域名 public static String PROD_HOST = "https://openapi.zncspt.com/api/"; @@ -24,6 +25,7 @@ public class ElephantConstants { public static String PROD_ELECLOUD_HOST = "https://openapi.ele-cloud.com/api/"; public static String PROD_HOST_LOCAL = "http://140.143.226.17:8087/order-api"; + public static String PROD_HOST_LOCAL_V6_JingDongYun = "https://js.ele12.com/order-api"; // 测试的获取token的域名 public static String DEV_TOKEN_HOST = "https://sandbox.zncspt.com/api/authen/token"; diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java index 9f72d81..02c48ad 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java @@ -1,6 +1,8 @@ package com.jianshui.invoice.utils.elephant; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.ContentType; @@ -331,6 +333,7 @@ public class ElephantUtils { /** * 大象请求 大象部署版 v6 无token + * Post请求 * * @param uri 请求uri * @param methodName 文档里的"接口方法" @@ -339,33 +342,34 @@ public class ElephantUtils { * @return */ public static DxhyInterfaceResponse sendRequestWithoutTokenV6(String uri, String methodName, JSON data, Companyservice companyservice) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException { - // v4的考过来的 没变 + ICompanyservicePropService companyserviceProp = SpringUtils.getBean(ICompanyservicePropService.class); CompanyserviceProp secretIdProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "elephant_secret_id"); if (secretIdProp == null) { throw new JianshuiServiceException("企业未配置属性,请联系管理员!"); } - // appid + String secretId = secretIdProp.getValue(); CompanyserviceProp sercretKeyProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "elephant_secret_key"); if (sercretKeyProp == null) { throw new JianshuiServiceException("企业未配置属性,请联系管理员!"); } - // appkey + String sercretKey = sercretKeyProp.getValue(); // 调用v6请求内容(content字段) String str = JSONUtil.toJsonStr(data); boolean isDevMode = CommonUtils.isDevMode(); // 主机名(京东云地址) - String host = ElephantConstants.PROD_HOST_LOCAL; + String host = ElephantConstants.PROD_HOST_LOCAL_V6_JingDongYun; if (isDevMode) { - host = ElephantConstants.DEV_HOST_LOCAL; + host = ElephantConstants.DEV_HOST_LOCAL_V6_JingDongYun; } - host = "https://js.ele12.com/order-api"; // 最终接口地址 String url = host + uri; + + DxhyInterfaceResponse dxhyInterfaceResponse = null; + // 封装大象v6调用类 - // TODO 注意调整这里 DxhyInterfaceRequest dxhyInterfaceRequest = new DxhyInterfaceRequest(); // 地址 dxhyInterfaceRequest.setRequestUrl(url); @@ -374,7 +378,13 @@ public class ElephantUtils { // 超时时间(毫秒值) dxhyInterfaceRequest.setHttpTimeOut("100000"); // 流水号(拷贝的接口文档的) - dxhyInterfaceRequest.setDataExchangeId("1617954341800234234234552"); +// dxhyInterfaceRequest.setDataExchangeId("1617954341800234234234552"); + // 生成流水号 + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + long snowflakeId = snowflake.nextId(); + String snowflakeIdStr = String.valueOf(snowflakeId); + dxhyInterfaceRequest.setDataExchangeId(snowflakeIdStr); + // appid dxhyInterfaceRequest.setSecretId(secretId); // appkey @@ -385,15 +395,22 @@ public class ElephantUtils { dxhyInterfaceRequest.setZipCode("0"); // 不加密 dxhyInterfaceRequest.setEncryptCode("0"); - // 大象v6调用方法(获取结果处理) - DxhyInterfaceResponse dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest); - log.info("请求成功,结果{}",JSONUtil.toJsonStr(dxhyInterfaceResponse)); + + try { + // 大象v6调用方法(获取结果处理) + log.info("【销项】【大象工具类】调用V6接口,入参{}",JSONUtil.toJsonStr(dxhyInterfaceRequest)); + dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest); + log.info("【销项】【大象工具类】请求成功,结果{}",JSONUtil.toJsonStr(dxhyInterfaceResponse)); + } catch (Exception e) { + log.error("【销项】【大象接口】调用HttpsUtilV6.Exception, url=" + url + ",request=" + JSONUtil.toJsonStr(dxhyInterfaceRequest), e); + } return dxhyInterfaceResponse; } + /** * 大象请求 大象部署版 1.2.4 无token * diff --git a/pom.xml b/pom.xml index e65148a..a5c7b8c 100644 --- a/pom.xml +++ b/pom.xml @@ -252,6 +252,8 @@ + + @@ -288,8 +290,14 @@ ${java.version} ${java.version} ${project.build.sourceEncoding} + + + ${project.basedir}/lib + + +