Merge remote-tracking branch 'origin/beta' into beta

beta-enc
dongxiaoke 2 years ago
commit f06488784a
  1. 197
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 33
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/DDMMessage.java
  3. 16
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/EleNewMessage.java
  4. 17
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/EleOuterMessage.java
  5. 15
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/FindRedInfoDTO.java
  6. 15
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/HZSQDMessage.java
  7. 35
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/ele/HZSQDXZTXXMessage.java
  8. 3
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java
  9. 3
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java
  10. 69
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  11. 3
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java
  12. 69
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java

@ -3,6 +3,8 @@ package com.jianshui.api.controller.http.invoice.v1;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.order.protocol.invoke.DxhyInterfaceResponse;
import com.google.gson.Gson;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.enums.ErrorCode;
@ -13,6 +15,10 @@ 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.domain.ele.EleNewMessage;
import com.jianshui.invoice.domain.ele.EleOuterMessage;
import com.jianshui.invoice.domain.ele.FindRedInfoDTO;
import com.jianshui.invoice.domain.ele.HZSQDMessage;
import com.jianshui.invoice.utils.elephant.ElephantUtils;
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO;
import com.jianshui.invoice.domain.Redinfo;
@ -38,6 +44,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
/**
* @Description
@ -69,53 +76,91 @@ public class InvoiceController {
private InvoiceAddPService addService;
@GetMapping("/api/v1/test")
public Object test(){
public EleNewMessage test() {
Companyservice companyservice = new Companyservice();
FindRedInfo findRedInfo = new FindRedInfo();
findRedInfo.setSQBQQPCH("127021937706230911155203");
findRedInfo.setNSRSBH("91370921MACWQ1520M");
AjaxResult queryResult = null;
DxhyInterfaceResponse dxhyInterfaceResponse = null;
try {
queryResult = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice);
dxhyInterfaceResponse = 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));
log.error("【销项发票】【大象接口】【红字信息表查询】发票请求异常,请求报文{},销方信息{}",
JSONUtil.parse(findRedInfo).toString(), JSONObject.toJSONString(companyservice));
e.printStackTrace();
throw new JianshuiServiceException("系统异常!");
}
return null;
String data = dxhyInterfaceResponse.getData();
cn.hutool.json.JSONObject dataStr = new cn.hutool.json.JSONObject(data);
if ("000000".equals(dataStr.getStr("ZTDM"))) {
Gson gson = new Gson();
EleOuterMessage eleOuterMessage = gson.fromJson(data, EleOuterMessage.class);
String inMsg = "";
String inMsgInfo = "";
List<HZSQDMessage> hzsqdxzzxx = eleOuterMessage.getHZSQDXZZXX();
for (HZSQDMessage hzsqdMessage : hzsqdxzzxx) {
inMsg = hzsqdMessage.getHZSQDXZTXX().getZTDM();
inMsgInfo = hzsqdMessage.getHZSQDXZTXX().getZTXX();
hzsqdMessage.getHZSQDXZTXX().setBillNo(findRedInfo.getSQBQQPCH());
}
EleNewMessage eleNewMessage = new EleNewMessage();
BeanUtil.copyProperties(eleOuterMessage, eleNewMessage);
eleNewMessage.setStatus(eleOuterMessage.getZTDM().substring(eleOuterMessage.getZTDM().length() - 4));
if ("060000".equals(inMsg)) {
eleNewMessage.setMessage(inMsgInfo);
eleNewMessage.setData(eleOuterMessage.getHZSQDXZZXX());
return eleNewMessage;
} else {
eleNewMessage.setMessage(inMsgInfo);
eleNewMessage.setData(eleOuterMessage.getHZSQDXZZXX());
return eleNewMessage;
}
} else {
EleNewMessage eleNewMessage = new EleNewMessage();
eleNewMessage.setStatus("9999");
eleNewMessage.setMessage("接口请求失败");
return eleNewMessage;
}
}
/**
* 功能描述: 红字查询接口
*
* @param identity
* @return : com.jianshui.invoice.domain.dto.HXResponse
*/
@PostMapping({"/api/invoice/v1/findRedInfo", "/api/invoice/v1/findRedInfo/{identity}", "/invoice/findRedInfo"})
public Object findRedInfo(HttpServletRequest request,String identity) throws Exception {
public EleNewMessage findRedInfo(HttpServletRequest request, String identity) throws Exception {
log.info("开始执行");
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
EleNewMessage eleNewMessage = new EleNewMessage();
eleNewMessage.setStatus("9999");
eleNewMessage.setMessage("身份认证参数为空");
return eleNewMessage;
}
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
if (companyservice == null) {
return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND);
EleNewMessage eleNewMessage = new EleNewMessage();
eleNewMessage.setStatus("9999");
eleNewMessage.setMessage("企业信息不存在");
return eleNewMessage;
}
String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey);
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "find_redinfo");
// 获得请求实例,并且进行扣费
log.info("解密数据{}",decryptResult);
FindRedInfo findRedInfo = decryptResult.toJavaObject(FindRedInfo.class);
log.info("解密数据{}", decryptResult);
FindRedInfoDTO findRedInfoDTO = decryptResult.toJavaObject(FindRedInfoDTO.class);
FindRedInfo findRedInfo = new FindRedInfo();
findRedInfo.setSQBQQPCH(findRedInfoDTO.getBillNo());
findRedInfo.setNSRSBH(findRedInfoDTO.getNSRSBH());
log.info("转换数据{}", JSONUtil.toJsonStr(findRedInfo));
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.findRedInfo(findRedInfo, companyservice);
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey);
return invoiceResponseService.response(result, companyservice, "find_redinfo");
EleNewMessage result = invoiceService.findRedInfo(findRedInfo, companyservice);
return result;
}
@ -216,7 +261,7 @@ public class InvoiceController {
@ApiOperation("开票请求接口-(蓝字发票开具,红字发票开具)")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/add", "/api/invoice/v1/add/{identity}", "/invoice/addInvoice"})
public Object addInvoice(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -260,7 +305,7 @@ public class InvoiceController {
// @ApiOperation("开票查询接口(发票请求流水号)")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/query", "/api/invoice/v1/query/{identity}", "/invoice/queryInvoice"})
public Object queryInvoice(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -289,7 +334,7 @@ public class InvoiceController {
// @ApiOperation("开票查询接口(订单号)")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/query_orderno", "/api/invoice/v1/query_orderno/{identity}", "/invoice/queryInvoiceByOrderNo"})
public Object queryInvoiceOrderno(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -319,7 +364,7 @@ public class InvoiceController {
// @ApiOperation("开票查询接口(范围查询)")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/query_scope", "/api/invoice/v1/query_scope/{identity}", "/urlcode/queryInvoice"})
public Object queryInvoiceScope(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -349,7 +394,7 @@ public class InvoiceController {
// @ApiOperation("作废发票")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/deprecate", "/api/invoice/v1/deprecate/{identity}", "/invoice/deleteInvoice"})
public Object deprecateInvoice(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -378,8 +423,8 @@ public class InvoiceController {
// @ApiOperation("作废发票结果查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/deprecate_query", "/api/invoice/v1/deprecate_query/{identity}", "/invoice/deleteInvoiceQuery","/invoice/deprecate_query"})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/deprecate_query", "/api/invoice/v1/deprecate_query/{identity}", "/invoice/deleteInvoiceQuery", "/invoice/deprecate_query"})
public Object deprecateQueryInvoice(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
@ -404,12 +449,14 @@ public class InvoiceController {
}
/** 红字信息表上传*/
/**
* 红字信息表上传
*/
@Validated
// @ApiOperation("红字信息表上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/upload_redinfo", "/api/invoice/v1/upload_redinfo/{identity}", "/invoice/redInvoiceApply"})
public Object uploadRedInfo(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -450,7 +497,7 @@ public class InvoiceController {
// @ApiOperation("红字信息表下载")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/download_redinfo", "/api/invoice/v1/download_redinfo/{identity}", "/invoice/redInvoiceDownload"})
public Object downloadRedInfo(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -492,7 +539,7 @@ public class InvoiceController {
// @ApiOperation("发票推送接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/push", "/api/invoice/v1/push/{identity}"})
public Object push(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -522,8 +569,8 @@ public class InvoiceController {
// @ApiOperation("发票批量打印接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/batch_print", "/api/invoice/v1/batch_print/{identity}","/invoice/batch_print"})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/batch_print", "/api/invoice/v1/batch_print/{identity}", "/invoice/batch_print"})
public Object print(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
@ -565,8 +612,8 @@ public class InvoiceController {
// @ApiOperation("打印机查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/printer_list", "/api/invoice/v1/printer_list/{identity}","/invoice/printer_list"})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/printer_list", "/api/invoice/v1/printer_list/{identity}", "/invoice/printer_list"})
public Object printer(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
@ -608,7 +655,7 @@ public class InvoiceController {
// @ApiOperation("发票签章")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/sign_e_seal", "/api/invoice/v1/sign_e_seal/{identity}"})
public Object signESeal(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -637,7 +684,7 @@ public class InvoiceController {
// @ApiOperation("发票专用章导入注册")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/register_e_seal", "/api/invoice/v1/register_e_seal/{identity}"})
public Object registerESeal(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -666,7 +713,7 @@ public class InvoiceController {
// @ApiOperation("发票专用章图片生成")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/create_e_seal", "/api/invoice/v1/create_e_seal/{identity}"})
public Object createESeal(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -956,18 +1003,18 @@ public class InvoiceController {
/**
* @Author: kk
* @Description: 通用异步查询接口
* @DateTime: 2023/6/2 17:35
* @Params:
* @Return
*/
* @Author: kk
* @Description: 通用异步查询接口
* @DateTime: 2023/6/2 17:35
* @Params:
* @Return
*/
// TODO: 2023/4/6 全电接口
// @ApiOperation("通用异步查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/queryResultInfo/{identity}", "/api/invoice/v1/queryResultInfo"})
public Object queryResultInfo(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -999,10 +1046,10 @@ public class InvoiceController {
}
// @ApiOperation("获取发票下载地址")
// @ApiOperation("获取发票下载地址")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/getFileUrl/{identity}", "/api/invoice/v1/getFileUrl"})
public Object getFileUrl(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
@ -1023,7 +1070,7 @@ public class InvoiceController {
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
InvoiceAllFileAcquisitionTWODTO invoiceAllFileAcquisitionTWODTO= decryptResult.toJavaObject(InvoiceAllFileAcquisitionTWODTO.class);
InvoiceAllFileAcquisitionTWODTO invoiceAllFileAcquisitionTWODTO = decryptResult.toJavaObject(InvoiceAllFileAcquisitionTWODTO.class);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.getFileUrl(invoiceAllFileAcquisitionTWODTO, companyservice);
@ -1034,10 +1081,10 @@ public class InvoiceController {
}
// @ApiOperation("全电文件获取")
// @ApiOperation("全电文件获取")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/getFileAcquisition/{identity}", "/api/invoice/v1/getFileAcquisition"})
public Object getFileAcquisition(HttpServletRequest request, String identity) throws Exception {
@ -1060,7 +1107,7 @@ public class InvoiceController {
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionDTO= decryptResult.toJavaObject(InvoiceAllFileAcquisitionOnTWODTO.class);
InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionDTO = decryptResult.toJavaObject(InvoiceAllFileAcquisitionOnTWODTO.class);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.getFileAcquisitionOn(invoiceAllFileAcquisitionDTO, companyservice);
@ -1072,10 +1119,10 @@ public class InvoiceController {
}
// @ApiOperation("获取人脸识别二维码")
// @ApiOperation("获取人脸识别二维码")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/qrcode/{identity}", "/api/invoice/v1/qrcode"})
public Object qrcode(HttpServletRequest request, String identity) throws Exception {
@ -1108,10 +1155,10 @@ public class InvoiceController {
}
// @ApiOperation("发票查询")
// @ApiOperation("发票查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/query/{identity}", "/api/invoice/v1/query"})
public Object query(HttpServletRequest request, String identity) throws Exception {
// query
@ -1135,7 +1182,7 @@ public class InvoiceController {
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
InvoiceAllFileQueryTWODTO invoiceAllFileQueryTWODTO = BeanUtil.copyProperties(decryptResult,InvoiceAllFileQueryTWODTO.class);
InvoiceAllFileQueryTWODTO invoiceAllFileQueryTWODTO = BeanUtil.copyProperties(decryptResult, InvoiceAllFileQueryTWODTO.class);
HXResponse result = invoiceService.query(invoiceAllFileQueryTWODTO, companyservice);
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
@ -1145,10 +1192,10 @@ public class InvoiceController {
}
// @ApiOperation("获取发票打印XML")
// @ApiOperation("获取发票打印XML")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/print_xml/{identity}", "/api/invoice/v1/print_xml"})
public Object printXmlml(HttpServletRequest request, String identity) throws Exception {
@ -1172,7 +1219,7 @@ public class InvoiceController {
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
InvoiceAllPrintXMLTWODTO invoiceAllPrintXMLTWODTO = BeanUtil.copyProperties(decryptResult,InvoiceAllPrintXMLTWODTO.class);
InvoiceAllPrintXMLTWODTO invoiceAllPrintXMLTWODTO = BeanUtil.copyProperties(decryptResult, InvoiceAllPrintXMLTWODTO.class);
HXResponse result = invoiceService.getPrintXML(invoiceAllPrintXMLTWODTO, companyservice);
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
@ -1182,10 +1229,10 @@ public class InvoiceController {
}
// @ApiOperation("快速红冲")
// @ApiOperation("快速红冲")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/issueFastRedInvoice/{identity}", "/api/invoice/v1/issueFastRedInvoice"})
public Object issueFastRedInvoice(HttpServletRequest request, String identity) throws Exception {
// issueFastRedInvoice
@ -1208,7 +1255,7 @@ public class InvoiceController {
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
InvoiceAllKshcJsonDataTWODTO invoiceAllKshcJsonDataTWODTO= decryptResult.toJavaObject(InvoiceAllKshcJsonDataTWODTO.class);
InvoiceAllKshcJsonDataTWODTO invoiceAllKshcJsonDataTWODTO = decryptResult.toJavaObject(InvoiceAllKshcJsonDataTWODTO.class);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.issueFastRedInvoice(invoiceAllKshcJsonDataTWODTO, companyservice);
@ -1220,10 +1267,10 @@ public class InvoiceController {
}
// @ApiOperation("蓝字发票统计")
// @ApiOperation("蓝字发票统计")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/invoice_statistics/{identity}", "/api/invoice/v1/invoice_statistics"})
public Object invoiceStatistics(HttpServletRequest request, String identity) throws Exception {
// invoiceStatic
@ -1256,10 +1303,10 @@ public class InvoiceController {
}
// @ApiOperation("审核红字信息表")
// @ApiOperation("审核红字信息表")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/auditRedInfo/{identity}", "/api/invoice/v1/auditRedInfo"})
public Object auditRedInfo(HttpServletRequest request, String identity) throws Exception {
// auditRedInfo
@ -1282,7 +1329,7 @@ public class InvoiceController {
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
InvoiceAllShhzJsonDataTWODTO invoiceAllShhzDTO= decryptResult.toJavaObject(InvoiceAllShhzJsonDataTWODTO.class);
InvoiceAllShhzJsonDataTWODTO invoiceAllShhzDTO = decryptResult.toJavaObject(InvoiceAllShhzJsonDataTWODTO.class);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.auditRedInfo(invoiceAllShhzDTO, companyservice);
@ -1294,10 +1341,10 @@ public class InvoiceController {
}
// @ApiOperation("查询红字信息表明细")
// @ApiOperation("查询红字信息表明细")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/queryRedInfoDetail/{identity}", "/api/invoice/v1/queryRedInfoDetail"})
public Object queryRedInfoDetail(HttpServletRequest request, String identity) throws Exception {
// auditRedInfo
@ -1320,7 +1367,7 @@ public class InvoiceController {
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
InvoiceAllRedInvoiceDetailTWODTO invoiceAllRedInvoiceDetailDTO= decryptResult.toJavaObject(InvoiceAllRedInvoiceDetailTWODTO.class);
InvoiceAllRedInvoiceDetailTWODTO invoiceAllRedInvoiceDetailDTO = decryptResult.toJavaObject(InvoiceAllRedInvoiceDetailTWODTO.class);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.queryRedInfoDetail(invoiceAllRedInvoiceDetailDTO, companyservice);
@ -1332,15 +1379,15 @@ public class InvoiceController {
}
/**
* @Author: kk
* @Description: 单据传入
* @DateTime: 2023/6/25 10:00
* @Params:
* @Return
*/
* @Author: kk
* @Description: 单据传入
* @DateTime: 2023/6/25 10:00
* @Params:
* @Return
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)})
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/invoiceIncome/{identity}", "/api/invoice/v1/invoiceIncome"})
public Object invoiceIncome(HttpServletRequest request, String identity) throws Exception {
@ -1358,7 +1405,7 @@ public class InvoiceController {
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey);
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "");
BillInfoPDTO billInfoPDTO = BeanUtil.copyProperties(decryptResult,BillInfoPDTO.class);
BillInfoPDTO billInfoPDTO = BeanUtil.copyProperties(decryptResult, BillInfoPDTO.class);
HXResponse result = addService.invoiceIssuance(billInfoPDTO);
return result;
@ -1366,6 +1413,4 @@ public class InvoiceController {
}
}

@ -0,0 +1,33 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class DDMMessage {
private String BYZD1;
private String BYZD2;
private String BYZD3;
private String DJ;
private String DW;
private String DYLZFPMXXH;
private String FPHXZ;
private String GGXH;
private String HSBZ;
private String JE;
private String KCE;
private String LSLBS;
private String SE;
private String SL;
private String SPBM;
private String SPID;
private String SPSL;
private String XH;
private String XMMC;
private String YHZCBS;
private String ZXBM;
private String ZZSTSGL;
}

@ -0,0 +1,16 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
import java.util.List;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class EleNewMessage {
private List<HZSQDMessage> data;
private String status;
private String message;
}

@ -0,0 +1,17 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
import java.util.List;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class EleOuterMessage {
private List<HZSQDMessage> HZSQDXZZXX;
private String SQBQQPCH;
private String ZTDM;
private String ZTXX;
}

@ -0,0 +1,15 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class FindRedInfoDTO {
// 请求批次号
private String billNo;
// 申请方纳税人识别号
private String NSRSBH;
}

@ -0,0 +1,15 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
import java.util.List;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class HZSQDMessage {
private List<DDMMessage> DDMXXX;
private HZSQDXZTXXMessage HZSQDXZTXX;
}

@ -0,0 +1,35 @@
package com.jianshui.invoice.domain.ele;
import lombok.Data;
/**
* @author xingze
* @date 2023/9/12
*/
@Data
public class HZSQDXZTXXMessage {
private String BMBBBH;
private String DSLBZ;
private String FPLXDM;
private String GMFDZDH;
private String GMFMC;
private String GMFSBH;
private String GMFYHZH;
private String HJJE;
private String HJSE;
private String billNo;
private String SQSM;
private String TKSJ;
private String XHFDZDH;
private String XHFMC;
private String XHFSBH;
private String XHFYHZH;
private String XXBBH;
private String XXBLX;
private String XXBTSBS;
private String YFPDM;
private String YFPHM;
private String YYSBZ;
private String ZTDM;
private String ZTXX;
}

@ -9,6 +9,7 @@ import com.jianshui.invoice.domain.Invoice;
import com.jianshui.invoice.domain.Redinfo;
import com.jianshui.invoice.domain.dto.*;
import com.jianshui.invoice.domain.dto.api.*;
import com.jianshui.invoice.domain.ele.EleNewMessage;
import javax.servlet.http.HttpServletRequest;
@ -277,5 +278,5 @@ public interface IInvoiceApiService {
* @param companyservice
* @return : java.lang.Object
*/
HXResponse findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice);
EleNewMessage findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice);
}

@ -20,6 +20,7 @@ import com.jianshui.invoice.domain.*;
import com.jianshui.invoice.domain.dto.*;
import com.jianshui.invoice.domain.dto.api.*;
import com.jianshui.invoice.domain.dto.api.aisino.console.*;
import com.jianshui.invoice.domain.ele.EleNewMessage;
import com.jianshui.invoice.domain.vo.api.aisino.console.AisinoConsoleInvoiceAddVO;
import com.jianshui.invoice.mapper.BillInfoMapper;
import com.jianshui.invoice.mapper.InvoiceMapper;
@ -1019,7 +1020,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService {
}
@Override
public HXResponse findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
public EleNewMessage findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
return null;
}

@ -9,6 +9,8 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dxhy.order.protocol.invoke.DxhyInterfaceResponse;
import com.google.gson.Gson;
import com.jianshui.common.config.JianshuiConfig;
import com.jianshui.common.constant.Constants;
import com.jianshui.common.core.domain.AjaxResult;
@ -29,6 +31,9 @@ import com.jianshui.invoice.domain.dto.adapter.response.RedInfoDTO;
import com.jianshui.invoice.domain.dto.adapter.response.RedInfoDetailDTO;
import com.jianshui.invoice.domain.dto.api.*;
import com.jianshui.invoice.domain.dto.api.elephant.*;
import com.jianshui.invoice.domain.ele.EleNewMessage;
import com.jianshui.invoice.domain.ele.EleOuterMessage;
import com.jianshui.invoice.domain.ele.HZSQDMessage;
import com.jianshui.invoice.mapper.BillInfoMapper;
import com.jianshui.invoice.mapper.InvoiceMapper;
import com.jianshui.invoice.mapper.RedinfoMapper;
@ -728,42 +733,68 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
return new HXResponse("0000", "查询成功", result);
}
/**
* 功能描述: 红字信息查询
*
* @param findRedInfo
* @param companyservice
* @return : java.lang.Object
*/
@Override
public HXResponse findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
log.info("传入信息",JSONUtil.toJsonStr(findRedInfo));
if (StringUtils.isEmpty(findRedInfo.getSQBQQPCH()) || StringUtils.isEmpty(findRedInfo.getNSRSBH())){
public EleNewMessage findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
log.info("传入信息", JSONUtil.toJsonStr(findRedInfo));
if (StringUtils.isEmpty(findRedInfo.getSQBQQPCH()) || StringUtils.isEmpty(findRedInfo.getNSRSBH())) {
log.error("传入信息为空");
return new HXResponse("9999","传入信息为空");
EleNewMessage eleNewMessage = new EleNewMessage();
eleNewMessage.setStatus("9999");
eleNewMessage.setMessage("接口请求失败");
return eleNewMessage;
}
AjaxResult queryResult = null;
DxhyInterfaceResponse dxhyInterfaceResponse = null;
try {
queryResult = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice);
dxhyInterfaceResponse = 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("系统异常!");
}
log.info("【销项发票】【大象发票】红字信息表查询请求结果{}", queryResult.toString());
JSONObject jsonData = queryResult.getJsonData();
String ztdm = jsonData.getString("ZTDM");
log.info("外层状态码{}",ztdm);
if ("000000".equals(ztdm)){
return new HXResponse(jsonData.toJSONString());
}else if ("009999".equals(ztdm)){
return new HXResponse("9999","接口请求失败(展示具体错误信息)");
}else {
return new HXResponse("9999","数据查询失败");
String data = dxhyInterfaceResponse.getData();
cn.hutool.json.JSONObject dataStr = new cn.hutool.json.JSONObject(data);
if ("000000".equals(dataStr.getStr("ZTDM"))) {
Gson gson = new Gson();
EleOuterMessage eleOuterMessage = gson.fromJson(data, EleOuterMessage.class);
String inMsgInfo = "";
List<HZSQDMessage> hzsqdxzzxx = eleOuterMessage.getHZSQDXZZXX();
for (HZSQDMessage hzsqdMessage : hzsqdxzzxx) {
hzsqdMessage.getHZSQDXZTXX().setZTDM(hzsqdMessage.getHZSQDXZTXX().getZTDM().substring(hzsqdMessage.getHZSQDXZTXX().getZTDM().length() - 4));
inMsgInfo = hzsqdMessage.getHZSQDXZTXX().getZTXX();
hzsqdMessage.getHZSQDXZTXX().setBillNo(findRedInfo.getSQBQQPCH());
}
EleNewMessage eleNewMessage = new EleNewMessage();
BeanUtil.copyProperties(eleOuterMessage, eleNewMessage);
eleNewMessage.setStatus(eleOuterMessage.getZTDM().substring(eleOuterMessage.getZTDM().length() - 4));
if ("审核通过".equals(inMsgInfo)) {
eleNewMessage.setMessage(eleOuterMessage.getZTXX());
eleNewMessage.setData(eleOuterMessage.getHZSQDXZZXX());
return eleNewMessage;
} else {
for (HZSQDMessage hzsqdMessage : hzsqdxzzxx) {
hzsqdMessage.getHZSQDXZTXX().setZTDM("1999");
}
eleNewMessage.setMessage(eleOuterMessage.getZTXX());
eleNewMessage.setData(eleOuterMessage.getHZSQDXZZXX());
return eleNewMessage;
}
} else {
EleNewMessage eleNewMessage = new EleNewMessage();
eleNewMessage.setStatus("9999");
eleNewMessage.setMessage("接口请求失败");
return eleNewMessage;
}
}
/**
* 申请/上传 红字发票
*
@ -897,11 +928,11 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
// 外部状态代码
String ztdm = contentJson.getString("ZTDM");
if (StringUtils.equals("060111",ztdm) || StringUtils.equals("060001",ztdm)){
if (StringUtils.equals("060111", ztdm) || StringUtils.equals("060001", ztdm)) {
redinfo.setRedInfoStatus("0");
redinfo.setRedInfoMessage(contentJson.getString("ZTXX"));
redinfoMapper.updateRedinfo(redinfo);
return new HXResponse("8888","数据上传成功,请调用信息下载接口查询审核状态!");
return new HXResponse("8888", "数据上传成功,请调用查询接口,查询审核状态!");
}
if (!StringUtils.equals("0000", ztdm)) {
redinfo.setRedInfoStatus("2");

@ -31,6 +31,7 @@ import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddInfoTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddmxListTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.red.AddRedInvoiceTwoDTO;
import com.jianshui.invoice.domain.ele.EleNewMessage;
import com.jianshui.invoice.domain.vo.jcsk.*;
import com.jianshui.invoice.mapper.*;
import com.jianshui.invoice.service.IInvoiceApiService;
@ -1568,7 +1569,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
@Override
public HXResponse findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
public EleNewMessage findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice) {
return null;
}

@ -1,19 +1,15 @@
package com.jianshui.invoice.utils.elephant;
import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
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;
@ -23,19 +19,16 @@ import com.jianshui.common.exception.jianshui.JianshuiParamErrorException;
import com.jianshui.common.exception.jianshui.JianshuiServiceConfigErrorException;
import com.jianshui.common.exception.jianshui.JianshuiServiceException;
import com.jianshui.common.utils.StringUtils;
import com.jianshui.common.utils.TimeUtil;
import com.jianshui.common.utils.http.HttpUtils;
import com.jianshui.common.utils.jianshui.CommonUtils;
import com.jianshui.common.utils.spring.SpringUtils;
import com.jianshui.invoice.constant.elephant.ElephantConstants;
import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.system.domain.CompanyserviceProp;
import com.jianshui.system.service.ICompanyservicePropService;
import com.jianshui.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
@ -345,43 +338,57 @@ public class ElephantUtils {
* @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);
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;
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;
// 封装大象v6调用类
// TODO 注意调整这里
DxhyInterfaceRequest dxhyInterfaceRequest = new DxhyInterfaceRequest();
// 地址
dxhyInterfaceRequest.setRequestUrl(url);
// 请求方式
dxhyInterfaceRequest.setRequestType("POST");
// 超时时间(毫秒值)
dxhyInterfaceRequest.setHttpTimeOut("100000");
// 流水号(拷贝的接口文档的)
dxhyInterfaceRequest.setDataExchangeId("1617954341800234234234552");
dxhyInterfaceRequest.setSecretId("e1de400c3aba4ed4b50b8c55885caf19");
dxhyInterfaceRequest.setSecretKey("8877d2d2b7d240cdb103cfae0f49491e");
dxhyInterfaceRequest.setContent(byteContent);
// appid
dxhyInterfaceRequest.setSecretId(secretId);
// appkey
dxhyInterfaceRequest.setSecretKey(sercretKey);
// 内容字段(content请求体)
dxhyInterfaceRequest.setContent(str);
// 不打包
dxhyInterfaceRequest.setZipCode("0");
// 不加密
dxhyInterfaceRequest.setEncryptCode("0");
// 大象v6调用方法(获取结果处理)
DxhyInterfaceResponse dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest);
log.info("请求成功,结果{}",JSONUtil.toJsonStr(dxhyInterfaceResponse));
String code = dxhyInterfaceResponse.getCode();
return AjaxResult.error("请求失败");
return dxhyInterfaceResponse;
}
@ -415,7 +422,7 @@ public class ElephantUtils {
}
//kk TODO : 2023/9/5 大象接口迁京东云
//https://js.ele12.com/
host = "https://js.ele12.com/order-api";
// host = "https://js.ele12.com/order-api";
String url = host + uri;
// String token = getToken();

Loading…
Cancel
Save