满意v6查询

beta-enc
kane 2 years ago
parent 2303b4486b
commit ec0aa89453
  1. 23
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 3
      jianshui-breaker/pom.xml
  3. 4
      jianshui-common/pom.xml
  4. 3
      jianshui-income/pom.xml
  5. 3
      jianshui-invoice-all/pom.xml
  6. 7
      jianshui-invoice/pom.xml
  7. 2
      jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstants.java
  8. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  9. 54
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java
  10. 3
      jianshui-platform/pom.xml

@ -7,10 +7,13 @@ import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.enums.ErrorCode;
import com.jianshui.common.exception.jianshui.JianshuiParamErrorException;
import com.jianshui.common.exception.jianshui.JianshuiServiceException;
import com.jianshui.common.utils.StringUtils;
import com.jianshui.common.utils.http.HttpHelper;
import com.jianshui.invoice.constant.elephant.ElephantConstants;
import com.jianshui.invoice.domain.BillInfo;
import com.jianshui.invoice.domain.FindRedInfo;
import com.jianshui.invoice.utils.elephant.ElephantUtils;
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO;
import com.jianshui.invoice.domain.Redinfo;
import com.jianshui.invoice.domain.dto.*;
@ -32,6 +35,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/**
* @Description
@ -62,6 +68,23 @@ public class InvoiceController {
@Autowired
private InvoiceAddPService addService;
@GetMapping("/api/v1/test")
public Object test(){
Companyservice companyservice = new Companyservice();
FindRedInfo findRedInfo = new FindRedInfo();
findRedInfo.setSQBQQPCH("127021937706230911155203");
findRedInfo.setNSRSBH("91370921MACWQ1520M");
AjaxResult queryResult = null;
try {
queryResult = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice);
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
log.error("【销项发票】【大象接口】【红字信息表查询】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(findRedInfo).toString(), JSONObject.toJSONString(companyservice));
e.printStackTrace();
throw new JianshuiServiceException("系统异常!");
}
return null;
}
/**
* 功能描述: 红字查询接口
* @param identity

@ -18,8 +18,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<scope>compile</scope>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

@ -151,8 +151,8 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<scope>compile</scope>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

@ -44,8 +44,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<scope>compile</scope>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

@ -45,8 +45,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<scope>compile</scope>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

@ -16,6 +16,11 @@
</description>
<dependencies>
<dependency>
<groupId>com.dxhy.order</groupId>
<artifactId>SIMS-order-sdk</artifactId>
<version>1.2.3-RELEASE</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.jianshui</groupId>
@ -34,7 +39,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<version>5.8.20</version>
</dependency>
<dependency>

@ -54,7 +54,7 @@ public class ElephantConstants {
public static String REDINFO_DOWNLOAD = "order-api/order-api/v4/DownloadRedInvoiceApplicationResult";
public static String REDINFO_DOWNLOAD_LOCALHOST = "/invoice/api/v4/DownloadRedInvoiceApplicationResult";
public static String REDINFO_DOWNLOAD_METHOD = "DownloadRedInvoiceApplicationResult";
public static String REDINFO_FIND_LOCALHOST = "/invoice/api/v4/GetRedInvoiceApplication";
public static String REDINFO_FIND_LOCALHOST = "/invoice/api/v6/GetRedInvoiceApplication";
public static String REDINFO_FIND_METHOD = "GetRedInvoiceApplication";
// 发票作废

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -735,14 +736,14 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
*/
@Override
public HXResponse findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
log.info("传入信息======》",JSONUtil.toJsonStr(findRedInfo));
log.info("传入信息",JSONUtil.toJsonStr(findRedInfo));
if (StringUtils.isEmpty(findRedInfo.getSQBQQPCH()) || StringUtils.isEmpty(findRedInfo.getNSRSBH())){
log.error("传入信息为空");
return new HXResponse("9999","传入信息为空");
}
AjaxResult queryResult = null;
try {
queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice);
queryResult = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice);
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
log.error("【销项发票】【大象接口】【红字信息表查询】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(findRedInfo).toString(), JSONObject.toJSONString(companyservice));
e.printStackTrace();

@ -12,6 +12,10 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.entity.Companyservice;
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
*

@ -45,8 +45,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M1</version>
<scope>compile</scope>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

Loading…
Cancel
Save