feat: 适配发票开具推送接口(初版)

release
liufeilong 2 years ago
parent 6549899d9c
commit 86a5965900
  1. 17
      order-management-common/src/main/java/com/dxhy/order/constant/OrderInfoEnum.java
  2. 83
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java
  3. 120
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/protocol/po/pushinvoice/sap/FptsMxSap.java
  4. 270
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/protocol/po/pushinvoice/sap/FptsReqSap.java

@ -1206,6 +1206,23 @@ public enum OrderInfoEnum {
*/
ORDER_KPZZGL_CXLX_0("0","全部"),
ORDER_KPZZGL_CXLX_1("1","启动"),
/**
* 系统标识
*/
SYS_SIGN_FP("JS","发票平台"),
/**
* 接口业务ID
* FI006 金税平台将金税开票信息返回SAP的接口(ERP-FI-INT-033)
* FI007 SAP销售结算信息传给金税系统(ERP-FI-INT-034)
* FI008 金税发票作废信息返回到SAP(ERP-FI-INT-041)
* FI010 销售结算报账单的驳回状态传给发票系统(ERP-FI-INT-046)
*/
INTERFACE_BUSINESS_ID_FPKJTS("FI006","发票开具回推"),
INTERFACE_BUSINESS_ID_FPKJ("FI007","发票开具"),
INTERFACE_BUSINESS_ID_FPZFTS("FI008","发票作废回推"),
INTERFACE_BUSINESS_ID_DDZTGX("FI010","订单状态更新"),
;
/**

@ -16,6 +16,7 @@ import com.dxhy.order.consumer.model.protocol.ResponseStatus;
import com.dxhy.order.consumer.modules.jdjos.service.PushInvoiceToJdJosService;
import com.dxhy.order.consumer.modules.manager.service.PushInvoiceService;
import com.dxhy.order.consumer.modules.manager.service.QuickCodeInfoService;
import com.dxhy.order.consumer.modules.order.service.OrderCommonService;
import com.dxhy.order.consumer.modules.order.service.OrderInfoService;
import com.dxhy.order.consumer.modules.order.service.OrderItemInfoService;
import com.dxhy.order.consumer.modules.order.service.OrderProcessService;
@ -23,6 +24,11 @@ import com.dxhy.order.consumer.modules.ticketpool.service.PushTicketPoolService;
import com.dxhy.order.consumer.openapi.protocol.CommonRequestParam;
import com.dxhy.order.consumer.openapi.protocol.Response;
import com.dxhy.order.consumer.openapi.protocol.order.*;
import com.dxhy.order.consumer.openapi.protocol.po.EsOutput;
import com.dxhy.order.consumer.openapi.protocol.po.IsInput;
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonRequestParam;
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonResponseParam;
import com.dxhy.order.consumer.openapi.protocol.po.pushinvoice.sap.FptsReqSap;
import com.dxhy.order.consumer.openapi.protocol.v4.ResponseV4BO;
import com.dxhy.order.consumer.openapi.protocol.v4.invalid.ZftsxxReqBO;
import com.dxhy.order.consumer.openapi.protocol.v4.invalid.ZfxxRspBO;
@ -52,10 +58,7 @@ import com.dxhy.order.model.ofd.OfdToPdfResponse;
import com.dxhy.order.model.qd.OrderInfoQd;
import com.dxhy.order.model.queue.*;
import com.dxhy.order.model.queue.jdwj.JdwjMqData;
import com.dxhy.order.utils.CommonUtils;
import com.dxhy.order.utils.HttpUtils;
import com.dxhy.order.utils.JsonUtils;
import com.dxhy.order.utils.NsrsbhUtils;
import com.dxhy.order.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -138,6 +141,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
@Resource
private PushInvoiceToJdJosService pushInvoiceToJdJosService;
@Resource
private OrderCommonService apiInvoiceCommonMapperService;
@Override
public R pushRouting(String pushMsg) {
@ -335,7 +341,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
String error = "税号:" + fpTsMqData.getNsrsbh() + ",推送地址没有配置";
return R.error(error);
}
//TODO lfl 系统来源待赋值
String xtly = "";
String fptsParam = "";
//多个地址循环推送
for (PushInfo pushInfo : pushInfoList) {
@ -350,19 +358,20 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
log.warn("税号:{},组装请求报文为空,不进行推送数据", fpTsMqData.getNsrsbh());
continue;
}
Map<String, String> requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent());
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
fptsParam = convertToYwxtParam(xtly,content);
}else {
fptsParam = JsonUtils.getInstance().toJsonString(requestMap);
}
try {
String param = JsonUtils.getInstance().toJsonString(requestMap);
if (param.length() > 500) {
param = param.substring(0, 400);
}
log.info("{}推送企业开始,推送企业url:{},推送参数:{}", LOGGER_MSG, pushInfo.getPushUrl(), param);
log.info("{}推送企业开始,推送企业url:{},推送参数:{}", LOGGER_MSG, pushInfo.getPushUrl(), fptsParam.substring(0,400));
long startTime = System.currentTimeMillis();
String result = "";
if (ConfigurerInfo.INTERFACE_VERSION_V5.equals(pushInfo.getVersionIdent())
|| ConfigurerInfo.INTERFACE_VERSION_V6.equals(pushInfo.getVersionIdent())) {
result = HttpUtils.doPost(pushInfo.getPushUrl(), JsonUtils.getInstance().toJsonString(requestMap));
result = HttpUtils.doPost(pushInfo.getPushUrl(), fptsParam);
} else {
result = HttpUtils.doPost(pushInfo.getPushUrl(), requestMap);
}
@ -372,7 +381,31 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
if (!StringUtils.isBlank(result)) {
if (ConfigurerInfo.INTERFACE_VERSION_V5.equals(pushInfo.getVersionIdent())
|| ConfigurerInfo.INTERFACE_VERSION_V6.equals(pushInfo.getVersionIdent())) {
DxhyInterfaceResponse dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class);
DxhyInterfaceResponse dxhyInterfaceResponse = new DxhyInterfaceResponse();
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class);
EsOutput es_output = poCommonResponseParam.getES_OUTPUT();
String sapkey = es_output.getSAPKEY();
String ztype = es_output.getZTYPE();
String zmessage = es_output.getZMESSAGE();
DdfptsV5 ddfptsV5 = new DdfptsV5();
ddfptsV5.setDDQQLSH(sapkey);
ddfptsV5.setNSRSBH("");
if(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)){
ddfptsV5.setZTDM(ConfigureConstant.STRING_000000);
}else {
ddfptsV5.setZTDM(ConfigureConstant.STRING_9999);
}
ddfptsV5.setZTXX(zmessage);
dxhyInterfaceResponse.setReturnCode(ConfigureConstant.STRING_000000);
dxhyInterfaceResponse.setReturnMessage("处理成功");
dxhyInterfaceResponse.setEncryptCode(ConfigurerInfo.ENCRYPTCODE_0);
dxhyInterfaceResponse.setZipCode(ConfigurerInfo.ENCRYPTCODE_0);
dxhyInterfaceResponse.setContent(Base64Encoding.encode(JsonUtils.getInstance().toJsonString(ddfptsV5)));
}else{
dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class);
}
if (ObjectUtil.isNotNull(dxhyInterfaceResponse)) {
if (ConfigureConstant.STRING_000000.equals(dxhyInterfaceResponse.getReturnCode())) {
CommonRequestParam commonRequestParam1 = new CommonRequestParam();
@ -791,6 +824,30 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
return content;
}
public String convertToYwxtParam(String xtly,String content){
String ywxtParam = "";
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content, DdfpzxxV5.class);
FptsReqSap fptsReqSap = new FptsReqSap();
//TODO lfl 发票推送数据转换
IsInput isInput = new IsInput();
isInput.setSYSID(OrderInfoEnum.SYS_SIGN_FP.getKey());
isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPKJTS.getKey());
isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey());
isInput.setZORG("");
isInput.setZFILED5("");
String jsonString = JsonUtils.getInstance().toJsonString(fptsReqSap);
Map map = JsonUtils.getInstance().parseObject(jsonString, Map.class);
isInput.setZDATA(map);
PoCommonRequestParam poCommonRequestParam = new PoCommonRequestParam();
poCommonRequestParam.setISINPUT(isInput);
ywxtParam = JsonUtils.getInstance().toJsonString(poCommonRequestParam);
}
return ywxtParam;
}
/**
* 获取发票推送请求报文

@ -0,0 +1,120 @@
package com.dxhy.order.consumer.openapi.protocol.po.pushinvoice.sap;
import lombok.Data;
/**
* @Description: SAP发票推送明细实体
* @Author liufeilong
* @Date 2023-02-07
**/
@Data
public class FptsMxSap {
/**
* 结算单号
*/
private String ZJSDH;
/**
* 发票号码
*/
private String ZFPHM;
/**
* 发票代码
*/
private String ZFPDM;
/**
* 发票行号
*/
private String ZFPHH;
/**
* 物料编号
*/
private String MATNR;
/**
* 型号规格
*/
private String ZGGXH;
/**
* 数量单位
*/
private String ZSLDW;
/**
* 数量
*/
private String ZZSL;
/**
* 税率
*/
private String ZTAX;
/**
* 单价(SAP)
*/
private String ZZDJ;
/**
* 不含税金额(SAP)SAP不含税总金额
*/
private String ZBHSJE;
/**
* 税额(SAP)SAP总税额
*/
private String ZZSE;
/**
* 含税金额SAP开票含税总额
*/
private String ZHSJE;
/**
* 单价(发票)
*/
private String ZZDJFP;
/**
* 不含税金额(SAP)金税系统开票不含税金额
*/
private String ZBHSJEY;
/**
* 税额(发票)金税系统开票总税额
*/
private String ZZSEY;
/**
* 含税金额(发票)金税系统开票含税总额
*/
private String ZHSJEY;
/**
* 不含税金额(差额)"金税系统与SAP差额-不含税ZBHSJE_Y- ZBHSJE"
*/
private String ZBHSJEDIF;
/**
* 税额(差额)"金税系统与SAP差额-税额ZZSE_Y- ZZSE"
*/
private String ZZSEDIF;
/**
* 含税金额(差额)"金税系统与SAP差额-含税金额ZBHSJE_Y- ZBHSJE"
*/
private String ZHSJEDIF;
/**
* 开票日期
*/
private String INVOICEDATE;
/**
* 发票类型
*/
private String INVOICETYPE;
/**
* 货物或应税劳务服务名称
*/
private String ZHWMC;
/**
* ID
*/
private String ZHID;
/**
* 头表ID
*/
private String ZTID;
/**
* 国税局商品编码
*/
private String ZGSJBM;
/**
* 税码
*/
private String ZSM;
}

@ -0,0 +1,270 @@
package com.dxhy.order.consumer.openapi.protocol.po.pushinvoice.sap;
import lombok.Data;
import java.util.List;
/**
* @Description: SAP-发票推送请求实体
* @Author liufeilong
* @Date 2023-02-07
**/
@Data
public class FptsReqSap {
/**
* 结算单号
*/
private String ZJSDH;
/**
* 发票代码
*/
private String ZFPDM;
/**
* 发票号码
*/
private String ZFPHM;
/**
* 发票类型
*/
private String ZFPLX;
/**
* 销方编号
*/
private String ZXFBM;
/**
* 购方编号
*/
private String ZGFBH;
/**
* 不含税金额(SAP)SAP不含税总金额
*/
private String ZBHSJE;
/**
* 税额(SAP)SAP总税额
*/
private String ZZSE;
/**
* 含税金额SAP开票含税总额
*/
private String ZHSJE;
/**
* 不含税金额(SAP)金税系统开票不含税金额
*/
private String ZBHSJEY;
/**
* 税额(发票)金税系统开票总税额
*/
private String ZZSEY;
/**
* 含税金额(发票)金税系统开票含税总额
*/
private String ZHSJEY;
/**
* 不含税金额(差额)"金税系统与SAP差额-不含税ZBHSJE_Y- ZBHSJE"
*/
private String ZBHSJEDIF;
/**
* 税额(差额)"金税系统与SAP差额-税额ZZSE_Y- ZZSE"
*/
private String ZZSEDIF;
/**
* 含税金额(差额)"金税系统与SAP差额-含税金额ZBHSJE_Y- ZBHSJE"
*/
private String ZHSJEDIF;
/**
* 备注
*/
private String ZZBZ;
/**
* 发票状态
*/
private String ZFPZT;
/**
* 最终开票完成标识
*/
private String ZZZKPZT;
/**
* 原发票号码
*/
private String ZYFPHM;
/**
* 原发票代码
*/
private String ZYFPDM;
/**
* 红字信息表编号
*/
private String ZHZXXB;
/**
* 影像发票ID
*/
private String ZYXID;
/**
* 影像发票URL
*/
private String ZFPURL;
/**
* 开票日期
*/
private String ZKPRQ;
/**
* 购方名称
*/
private String ZGFMC;
/**
* 购方税号
*/
private String ZGFSH;
/**
* 销方名称
*/
private String ZXFMC;
/**
* 销方税号
*/
private String ZXFSH;
/**
* ID:发票代码+发票号码+发票类型
*/
private String ZTID;
/**
* 校验码
*/
private String ZJYM;
/**
* 购方开户行账户
*/
private String ZGFZH;
/**
* 购方地址电话
*/
private String ZGFDH;
/**
* 销方地址电话
*/
private String ZXFDH;
/**
* 销方开户行账户
*/
private String ZXFZH;
/**
* 机打代码
*/
private String ZJDDM;
/**
* 机打号码
*/
private String ZJDHM;
/**
* 主管税务机关
*/
private String ZSWJG;
/**
* 主管税务机关代码
*/
private String ZJGDM;
/**
* 票据来源
*/
private String ZPJLY;
/**
* 员工Code
*/
private String ZYGC;
/**
* 用户名
*/
private String ZYHM;
/**
* 全名
*/
private String ZQM;
/**
* 公司代码
*/
private String ZGSDM;
/**
* 业务单据编号(报账单编号)
*/
private String ZYWDJ;
/**
* 业务状态
*/
private String ZYWZT;
/**
* 票据状态
*/
private String ZPJZT;
/**
* 创建时间
*/
private String ZCJSJ;
/**
* 创建人
*/
private String ZCJR;
/**
* 更新时间
*/
private String ZGXSJ;
/**
* 更新人
*/
private String ZGXR;
/**
* 缩略图ID
*/
private String ZSLT;
/**
* 图片附件ID
*/
private String ZFU;
/**
* 报账状态
*/
private String ZBAZT;
/**
* 查验状态
*/
private String ZCYZT;
/**
* 查验结果描述
*/
private String ZCYJG;
/**
* 查验日期
*/
private String ZCYRQ;
/**
* 报账单号
*/
private String ZBZDH;
/**
* 税率
*/
private String ZTAX;
/**
* 税码
*/
private String ZSM;
/**
* 发票影像编号
*/
private String FPYXBH;
/**
* 影像编码ID
*/
private String IMGID;
/**
* 序号
*/
private String SORT;
/**
* 删除标记
*/
private String ZZDEL;
/**
* 行项目结构
*/
private List<FptsMxSap> ITITEM;
}
Loading…
Cancel
Save