|
|
|
@ -16,6 +16,7 @@ import com.dxhy.order.consumer.config.OpenApiConfig; |
|
|
|
|
import com.dxhy.order.consumer.dao.GsClientMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.PushInfoRecordMapper; |
|
|
|
|
import com.dxhy.order.consumer.model.PushInfoRecord; |
|
|
|
|
import com.dxhy.order.consumer.dao.InterfaceRequestDataMapper; |
|
|
|
|
import com.dxhy.order.consumer.model.protocol.CommonResponse; |
|
|
|
|
import com.dxhy.order.consumer.model.protocol.ResponseData; |
|
|
|
|
import com.dxhy.order.consumer.model.protocol.ResponseStatus; |
|
|
|
@ -38,6 +39,7 @@ 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.generateinvoice.sap.FpkjReqSap; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.generateinvoicepush.sap.FpkjtsMxSap; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.generateinvoicepush.sap.FpkjtsReqSap; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.voidinvoicepush.sap.FpzftsReqSap; |
|
|
|
@ -90,6 +92,7 @@ import java.math.BigDecimal; |
|
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 推送企业数据servcie实现类 |
|
|
|
@ -172,6 +175,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
@Resource |
|
|
|
|
private PushInfoRecordMapper pushInfoRecordMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private InterfaceRequestDataMapper interfaceRequestDataMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private GsClientMapper gsClientMapper; |
|
|
|
|
@Value("${snyx.salt:}") |
|
|
|
@ -237,7 +243,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|
|
|
|
|
//推送票池
|
|
|
|
|
try { |
|
|
|
|
if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFpdm()) && StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFphm())) { |
|
|
|
|
if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFphm())) { |
|
|
|
|
pushTicketPoolService.pushTicketPool(commonTsMqData.getFpTsMqData().getFpdm(), commonTsMqData.getFpTsMqData().getFphm(), commonTsMqData.getNsrsbh()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -252,13 +258,15 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
OrderProcessInfo orderProcessInfo = orderProcessService.queryOrderProcessInfoByFpqqlsh(orderInvoiceInfo.getFpqqlsh(), null); |
|
|
|
|
commonTsMqData.setNsrsbh(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
if(StrUtil.isNotBlank(orderProcessInfo.getBzdh())){ |
|
|
|
|
zfTsMqData.setXtly(orderProcessInfo.getXtly()); |
|
|
|
|
zfTsMqData.setBzdh(orderProcessInfo.getBzdh()); |
|
|
|
|
commonPush(commonTsMqData); |
|
|
|
|
}else { |
|
|
|
|
log.error("{},{}{}发票作废推送失败,没有报账单号",LOGGER_MSG,orderInvoiceInfo.getFpdm(),orderInvoiceInfo.getFphm()); |
|
|
|
|
} |
|
|
|
|
//推送票池
|
|
|
|
|
try { |
|
|
|
|
if (StringUtils.isNotBlank(commonTsMqData.getZfTsMqData().getFpdm()) && StringUtils.isNotBlank(commonTsMqData.getZfTsMqData().getFphm())) { |
|
|
|
|
if (StringUtils.isNotBlank(commonTsMqData.getZfTsMqData().getFphm())) { |
|
|
|
|
pushTicketPoolService.pushTicketPool(commonTsMqData.getZfTsMqData().getFpdm(), commonTsMqData.getZfTsMqData().getFphm(), commonTsMqData.getNsrsbh()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -472,7 +480,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
String error=String.format("税号:%s,组装请求报文为空,不进行推送数据",fpTsMqData.getNsrsbh()); |
|
|
|
|
log.warn(error); |
|
|
|
|
failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,error,pushInfo,fpTsMqData.getPushType()); |
|
|
|
|
continue; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
//推送影像系统
|
|
|
|
@ -520,6 +528,11 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
Map map = Maps.newHashMap(); |
|
|
|
|
map.put("ec-key",baseServiceConfig.getEcKey()); |
|
|
|
|
result = HttpUtils.sendPoWithHead(pushInfo.getPushUrl(), fptsParam,baseServiceConfig.getPoUserName(),baseServiceConfig.getPoPassword(),map); |
|
|
|
|
} else if (OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(orderProcessInfo.getXtly()) && StringUtils.isNotBlank(pushInfo.getByzd1()) |
|
|
|
|
&& pushInfo.getByzd1().equals(orderProcessInfo.getXtly())) { |
|
|
|
|
Map map = Maps.newHashMap(); |
|
|
|
|
map.put("authorization",MD5.getMd5Encode(baseServiceConfig.getYxKey())); |
|
|
|
|
result = HttpUtils.sendPoWithHead(pushInfo.getPushUrl(), fptsParam,baseServiceConfig.getPoUserName(),baseServiceConfig.getPoPassword(),map); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
result = HttpUtils.doPost(pushInfo.getPushUrl(), requestMap); |
|
|
|
@ -532,27 +545,32 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|| ConfigurerInfo.INTERFACE_VERSION_V6.equals(pushInfo.getVersionIdent())) { |
|
|
|
|
DxhyInterfaceResponse dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class); |
|
|
|
|
if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(fpTsMqData.getPushType())) { |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){ |
|
|
|
|
//TODO 山能易行回传流水号重置
|
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)||OrderInfoEnum.SYS_SOURCE_SNYXX.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(); |
|
|
|
|
List<DdfptsV5> resultList = new ArrayList<>(); |
|
|
|
|
DdfptsV5 ddfptsV5 = new DdfptsV5(); |
|
|
|
|
ddfptsV5.setDDQQLSH(fpTsMqData.getFpTsMqData().getFpqqlsh()); |
|
|
|
|
ddfptsV5.setNSRSBH(""); |
|
|
|
|
if(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)){ |
|
|
|
|
ddfptsV5.setZTDM(ConfigureConstant.STRING_000000); |
|
|
|
|
}else { |
|
|
|
|
ddfptsV5.setZTDM(ConfigureConstant.STRING_9999); |
|
|
|
|
String[] split = fpTsMqData.getFpTsMqData().getPushBackLsh().split(","); |
|
|
|
|
for (String fpqqlsh : split) { |
|
|
|
|
DdfptsV5 ddfptsV5 = new DdfptsV5(); |
|
|
|
|
ddfptsV5.setDDQQLSH(fpqqlsh); |
|
|
|
|
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); |
|
|
|
|
resultList.add(ddfptsV5); |
|
|
|
|
} |
|
|
|
|
ddfptsV5.setZTXX(zmessage); |
|
|
|
|
dxhyInterfaceResponse.setReturnCode(ConfigureConstant.STRING_000000); |
|
|
|
|
dxhyInterfaceResponse.setReturnMessage("处理成功"); |
|
|
|
|
dxhyInterfaceResponse.setEncryptCode(ConfigurerInfo.ENCRYPTCODE_0); |
|
|
|
|
dxhyInterfaceResponse.setZipCode(ConfigurerInfo.ENCRYPTCODE_0); |
|
|
|
|
resultList.add(ddfptsV5); |
|
|
|
|
|
|
|
|
|
dxhyInterfaceResponse.setContent(Base64Encoding.encode(JsonUtils.getInstance().toJsonString(resultList))); |
|
|
|
|
}else{ |
|
|
|
|
dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class); |
|
|
|
@ -680,68 +698,61 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public R sendImageSys(String content, String pushType, PushInfo pushInfo, Long id){ |
|
|
|
|
R r = new R(); |
|
|
|
|
public void sendImageSys(String content, String pushType, PushInfo pushInfo, Long id){ |
|
|
|
|
PushInfo pushInfo1 = new PushInfo(); |
|
|
|
|
pushInfo1.setId(pushInfo.getId()); |
|
|
|
|
pushInfo1.setByzd1("YXXT"); |
|
|
|
|
DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class); |
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
OutputInvoiceRequest outputInvoiceRequest = buildInvoiceRequest(ddfpxx); |
|
|
|
|
if(outputInvoiceRequest.getInvoiceList() != null && outputInvoiceRequest.getInvoiceList().size() > 0){ |
|
|
|
|
String fplxdm = ddfpxx.getFPLXDM(); |
|
|
|
|
boolean b = OrderInfoEnum.ORDER_INVOICE_TYPE_001.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_002.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_026.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_028.getKey().equals(fplxdm); |
|
|
|
|
if(!b){ |
|
|
|
|
String error=String.format("invoiceNo:%s not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
log.info(error); |
|
|
|
|
failPush(id,content,error,error,pushInfo1,pushType); |
|
|
|
|
r.put(OrderManagementConstant.CODE, "9999"); |
|
|
|
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<DdfpzxxV5> ddfpzxxV5s = JsonUtils.getInstance().listBeanCopy(content, DdfpzxxV5.class); |
|
|
|
|
//DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class);
|
|
|
|
|
for (DdfpzxxV5 ddfpzxxV5 : ddfpzxxV5s) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
String md5Encode = MD5.getMd5Encode(outputInvoiceRequest.getBillNum() + invoiceConfig.getSapSalt() ); |
|
|
|
|
Map<String, String> headerMap = Maps.newHashMap(); |
|
|
|
|
headerMap.put("Authorization",md5Encode); |
|
|
|
|
String param = JSONObject.toJSONString(outputInvoiceRequest); |
|
|
|
|
if(StringUtils.isNotBlank(param) && param.length() > 400){ |
|
|
|
|
param = param.substring(0,400); |
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
OutputInvoiceRequest outputInvoiceRequest = buildInvoiceRequest(ddfpxx); |
|
|
|
|
if(outputInvoiceRequest.getInvoiceList() != null && outputInvoiceRequest.getInvoiceList().size() > 0){ |
|
|
|
|
String fplxdm = ddfpxx.getFPLXDM(); |
|
|
|
|
boolean b = OrderInfoEnum.ORDER_INVOICE_TYPE_001.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_002.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_026.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_028.getKey().equals(fplxdm); |
|
|
|
|
if(!b){ |
|
|
|
|
String error=String.format("invoiceNo:%s not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
log.info(error); |
|
|
|
|
failPush(id,content,error,error,pushInfo1,pushType); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("call image check request url:{},header:{},parameter:{}",invoiceConfig.getSnYxUrl(),JSONObject.toJSONString(headerMap),param); |
|
|
|
|
String body = HttpRequest.post(invoiceConfig.getSnYxUrl()).addHeaders(headerMap).body(JSONObject.toJSONString(outputInvoiceRequest)).timeout(300000).execute().body(); |
|
|
|
|
log.info("call image check return parameter:{}",body); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body); |
|
|
|
|
String status = jsonObject.getString("status");//200 成功、 500 失败
|
|
|
|
|
String message = jsonObject.getString("message"); |
|
|
|
|
String data = jsonObject.getString("data"); |
|
|
|
|
if("200".equals(status)){ |
|
|
|
|
//成功
|
|
|
|
|
successPush(id,content,data,pushInfo1,pushType); |
|
|
|
|
}else { |
|
|
|
|
//失败
|
|
|
|
|
failPush(id,content,message,data,pushInfo1,pushType); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
String md5Encode = MD5.getMd5Encode(outputInvoiceRequest.getBillNum() + invoiceConfig.getSapSalt() ); |
|
|
|
|
Map<String, String> headerMap = Maps.newHashMap(); |
|
|
|
|
headerMap.put("Authorization",md5Encode); |
|
|
|
|
String param = JSONObject.toJSONString(outputInvoiceRequest); |
|
|
|
|
if(StringUtils.isNotBlank(param) && param.length() > 400){ |
|
|
|
|
param = param.substring(0,400); |
|
|
|
|
} |
|
|
|
|
log.info("call image check request url:{},header:{},parameter:{}",invoiceConfig.getSnYxUrl(),JSONObject.toJSONString(headerMap),param); |
|
|
|
|
String body = HttpRequest.post(invoiceConfig.getSnYxUrl()).addHeaders(headerMap).body(JSONObject.toJSONString(outputInvoiceRequest)).timeout(300000).execute().body(); |
|
|
|
|
log.info("call image check return parameter:{}",body); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body); |
|
|
|
|
String status = jsonObject.getString("status");//200 成功、 500 失败
|
|
|
|
|
String message = jsonObject.getString("message"); |
|
|
|
|
String data = jsonObject.getString("data"); |
|
|
|
|
if("200".equals(status)){ |
|
|
|
|
//成功
|
|
|
|
|
successPush(id,content,data,pushInfo1,pushType); |
|
|
|
|
}else { |
|
|
|
|
//失败
|
|
|
|
|
failPush(id,content,message,data,pushInfo1,pushType); |
|
|
|
|
} |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); |
|
|
|
|
log.error(error); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
failPush(id,content,error,e.getMessage(),pushInfo1,pushType); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); |
|
|
|
|
log.error(error); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
failPush(id,content,error,e.getMessage(),pushInfo1,pushType); |
|
|
|
|
r.put(OrderManagementConstant.CODE, "9999"); |
|
|
|
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
String salt = "e4b0190b2fadc0adbe54471ffd79a729"; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1092,7 +1103,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(commonTsMqData.getPushType())) { |
|
|
|
|
//开票推送相关业务处理
|
|
|
|
|
FpTsMqData fpTsMqData = commonTsMqData.getFpTsMqData(); |
|
|
|
|
updatePushErrorMsgToDb(fpTsMqData.getFpqqlsh(), msg, shList); |
|
|
|
|
updatePushErrorMsgToDb(fpTsMqData.getPushBackLsh(), msg, shList); |
|
|
|
|
} else if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(commonTsMqData.getPushType())) { |
|
|
|
|
//作废推送相关业务处理
|
|
|
|
|
ZfTsMqData zfTsMqData = commonTsMqData.getZfTsMqData(); |
|
|
|
@ -1299,13 +1310,16 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updatePushErrorMsgToDb(String fpqqlsh, String errorMessage, List<String> shList) { |
|
|
|
|
OrderInvoiceInfo orderQuery = new OrderInvoiceInfo(); |
|
|
|
|
orderQuery.setFpqqlsh(fpqqlsh); |
|
|
|
|
orderQuery.setPushStatus(OrderInfoEnum.PUSH_STATUS_2.getKey()); |
|
|
|
|
orderQuery.setInvoicePushSbyy(errorMessage); |
|
|
|
|
int updateByPrimaryKeySelective = orderInvoiceInfoService.updateOrderInvoiceInfoByFpqqlsh(orderQuery, shList); |
|
|
|
|
if (updateByPrimaryKeySelective <= 0) { |
|
|
|
|
log.error("{}推送状态更新失败", LOGGER_MSG); |
|
|
|
|
String[] split = fpqqlsh.split(","); |
|
|
|
|
for (String fpqqlshItem : split) { |
|
|
|
|
OrderInvoiceInfo orderQuery = new OrderInvoiceInfo(); |
|
|
|
|
orderQuery.setFpqqlsh(fpqqlshItem); |
|
|
|
|
orderQuery.setPushStatus(OrderInfoEnum.PUSH_STATUS_2.getKey()); |
|
|
|
|
orderQuery.setInvoicePushSbyy(errorMessage); |
|
|
|
|
int updateByPrimaryKeySelective = orderInvoiceInfoService.updateOrderInvoiceInfoByFpqqlsh(orderQuery, shList); |
|
|
|
|
if (updateByPrimaryKeySelective <= 0) { |
|
|
|
|
log.error("{}推送状态更新失败", LOGGER_MSG); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1342,16 +1356,19 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
if (ObjectUtil.isNotEmpty(pushRspBO.getDDFPTS())) { |
|
|
|
|
ddfptsBOList.addAll(pushRspBO.getDDFPTS()); |
|
|
|
|
} else { |
|
|
|
|
DdfptsBO ddfptsBO = new DdfptsBO(); |
|
|
|
|
ddfptsBO.setDDQQLSH(fpqqlsh); |
|
|
|
|
ddfptsBO.setNSRSBH(nsrsbh); |
|
|
|
|
if (ConfigureConstant.STRING_0000.equals(pushRspBO.getZTDM()) || ConfigureConstant.STRING_000000.equals(pushRspBO.getZTDM())) { |
|
|
|
|
ddfptsBO.setZTDM(ConfigureConstant.STRING_000000); |
|
|
|
|
} else { |
|
|
|
|
ddfptsBO.setZTDM(ConfigureConstant.STRING_009999); |
|
|
|
|
} |
|
|
|
|
String[] split = fpqqlsh.split(","); |
|
|
|
|
for (String fpqqlshSplit : split) { |
|
|
|
|
DdfptsBO ddfptsBO = new DdfptsBO(); |
|
|
|
|
ddfptsBO.setDDQQLSH(fpqqlshSplit); |
|
|
|
|
ddfptsBO.setNSRSBH(nsrsbh); |
|
|
|
|
if (ConfigureConstant.STRING_0000.equals(pushRspBO.getZTDM()) || ConfigureConstant.STRING_000000.equals(pushRspBO.getZTDM())) { |
|
|
|
|
ddfptsBO.setZTDM(ConfigureConstant.STRING_000000); |
|
|
|
|
} else { |
|
|
|
|
ddfptsBO.setZTDM(ConfigureConstant.STRING_009999); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ddfptsBOList.add(ddfptsBO); |
|
|
|
|
ddfptsBOList.add(ddfptsBO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DdfptsBO ddfptsBO : ddfptsBOList) { |
|
|
|
@ -1417,109 +1434,128 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(fpTsMqData.getPushType())){ |
|
|
|
|
OrderProcessInfo orderProcessInfo = orderProcessService.queryOrderProcessInfoByFpqqlsh(fpTsMqData.getFpTsMqData().getFpqqlsh(), null); |
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo(); |
|
|
|
|
orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh()); |
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, null); |
|
|
|
|
List<GsClient> gsClients = gsClientMapper.selectByGsdm(orderProcessInfo.getGsdm()); |
|
|
|
|
// OrderProcessInfo orderProcessInfo = orderProcessService.queryOrderProcessInfoByFpqqlsh(fpTsMqData.getFpTsMqData().getFpqqlsh(), null);
|
|
|
|
|
// OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo();
|
|
|
|
|
// orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh());
|
|
|
|
|
// OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, null);
|
|
|
|
|
// List<GsClient> gsClients = gsClientMapper.selectByGsdm(orderProcessInfo.getGsdm());
|
|
|
|
|
|
|
|
|
|
//发票开具推送
|
|
|
|
|
DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class); |
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
List<DdmxxxV5> ddmxxx = ddfpzxxV5.getDDMXXX(); |
|
|
|
|
List<DdfpzxxV5> ddfpzxxV5s = JsonUtils.getInstance().jsonToList(content, DdfpzxxV5.class); |
|
|
|
|
//DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class);
|
|
|
|
|
List<FpkjtsReqSap> mainList = new ArrayList<>(); |
|
|
|
|
FpkjtsReqSap fpkjtsReqSap = new FpkjtsReqSap(); |
|
|
|
|
List<FpkjtsMxSap> itemList = new ArrayList<>(); |
|
|
|
|
//主信息
|
|
|
|
|
if(!OrderInfoEnum.SYS_SOURCE_FPPAGE.getKey().equals(orderProcessInfo.getXtly())){ |
|
|
|
|
fpkjtsReqSap.setZJSDH(orderProcessInfo.getOriginDdh()); |
|
|
|
|
}else { |
|
|
|
|
fpkjtsReqSap.setZJSDH(""); |
|
|
|
|
} |
|
|
|
|
fpkjtsReqSap.setZFPDM(ddfpxx.getFPDM()); |
|
|
|
|
fpkjtsReqSap.setZFPHM(ddfpxx.getFPHM()); |
|
|
|
|
fpkjtsReqSap.setZFPLX(CommonUtils.transToSnFplxdm(ddfpxx.getFPLXDM())); |
|
|
|
|
fpkjtsReqSap.setZXFBM(ddfpxx.getXHFSBH()); |
|
|
|
|
fpkjtsReqSap.setZGFBH(ddfpxx.getGMFSBH()); |
|
|
|
|
fpkjtsReqSap.setZBHSJEY(ddfpxx.getHJJE()); |
|
|
|
|
fpkjtsReqSap.setZZSEY(ddfpxx.getHJSE()); |
|
|
|
|
fpkjtsReqSap.setZHSJEY(ddfpxx.getJSHJ()); |
|
|
|
|
fpkjtsReqSap.setZZBZ(ddfpxx.getBZ()); |
|
|
|
|
fpkjtsReqSap.setZFPZT(ConfigureConstant.STRING_0);//0-正常、1-作废
|
|
|
|
|
String formatKprq = ""; |
|
|
|
|
try { |
|
|
|
|
Date date = (Date) new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ddfpxx.getKPRQ()); |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
formatKprq = sdf.format(date); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("{}发票推送SAP格式化开票日期错误:{}",LOGGER_MSG,e); |
|
|
|
|
} |
|
|
|
|
fpkjtsReqSap.setZKPRQ(formatKprq); |
|
|
|
|
fpkjtsReqSap.setZGFMC(ddfpxx.getGMFMC()); |
|
|
|
|
fpkjtsReqSap.setZGFSH(ddfpxx.getGMFSBH()); |
|
|
|
|
fpkjtsReqSap.setZXFMC(ddfpxx.getXHFMC()); |
|
|
|
|
fpkjtsReqSap.setZXFSH(ddfpxx.getXHFSBH()); |
|
|
|
|
fpkjtsReqSap.setZTID(ddfpxx.getFPDM()+ddfpxx.getFPHM()+ddfpxx.getFPLXDM()); |
|
|
|
|
fpkjtsReqSap.setZGFZH(ddfpxx.getGMFZH()); |
|
|
|
|
fpkjtsReqSap.setZGFDH(ddfpxx.getGMFDH()); |
|
|
|
|
fpkjtsReqSap.setZXFDH(ddfpxx.getXHFDH()); |
|
|
|
|
fpkjtsReqSap.setZXFZH(ddfpxx.getXHFZH()); |
|
|
|
|
fpkjtsReqSap.setZGSDM(orderProcessInfo.getGsdm()); |
|
|
|
|
fpkjtsReqSap.setZYWDJ(orderProcessInfo.getBzdh()); |
|
|
|
|
fpkjtsReqSap.setIMGID(orderInvoiceInfo.getDocuId()); |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_DSXT01.getKey().equals(orderProcessInfo.getXtly()) || |
|
|
|
|
OrderInfoEnum.SYS_SOURCE_DSXT02.getKey().equals(orderProcessInfo.getXtly())){ |
|
|
|
|
fpkjtsReqSap.setPDFZJL(ddfpxx.getPDFZJL()); |
|
|
|
|
fpkjtsReqSap.setZJLLX(ddfpxx.getZJLLX()); |
|
|
|
|
} |
|
|
|
|
//明细信息
|
|
|
|
|
ddmxxx.stream().forEach(f -> { |
|
|
|
|
FpkjtsMxSap detail = new FpkjtsMxSap(); |
|
|
|
|
for (DdfpzxxV5 ddfpzxxV5 : ddfpzxxV5s) { |
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
List<DdmxxxV5> ddmxxx = ddfpzxxV5.getDDMXXX(); |
|
|
|
|
FpkjtsReqSap fpkjtsReqSap = new FpkjtsReqSap(); |
|
|
|
|
List<FpkjtsMxSap> itemList = new ArrayList<>(); |
|
|
|
|
//主信息
|
|
|
|
|
detail.setZJSDH(StringUtils.isNotBlank(orderProcessInfo.getOriginDdh())?orderProcessInfo.getOriginDdh():orderProcessInfo.getDdh()); |
|
|
|
|
// detail.setZJSDH(ddfpxx.getDDH());
|
|
|
|
|
detail.setZFPDM(ddfpxx.getFPDM()); |
|
|
|
|
detail.setZFPHM(ddfpxx.getFPHM()); |
|
|
|
|
detail.setZFPHH(f.getXH()); |
|
|
|
|
if(ObjectUtil.isNull(f.getZXBM()) || StrUtil.isBlank(f.getZXBM())){ |
|
|
|
|
detail.setMATNR(""); |
|
|
|
|
if(!OrderInfoEnum.SYS_SOURCE_FPPAGE.getKey().equals(ddfpxx.getXtly())){ |
|
|
|
|
fpkjtsReqSap.setZJSDH(ddfpxx.getDDH()); |
|
|
|
|
}else { |
|
|
|
|
// DecimalFormat g1=new DecimalFormat("000000000000000000");
|
|
|
|
|
detail.setMATNR(f.getZXBM()); |
|
|
|
|
fpkjtsReqSap.setZJSDH(""); |
|
|
|
|
} |
|
|
|
|
detail.setZGGXH(f.getGGXH()); |
|
|
|
|
detail.setZSLDW(f.getDW()); |
|
|
|
|
detail.setZZSL(f.getSPSL()); |
|
|
|
|
detail.setZTAX(new BigDecimal(f.getSL()).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString()); |
|
|
|
|
detail.setZBHSJEY(f.getJE()); |
|
|
|
|
detail.setZZSEY(f.getSE()); |
|
|
|
|
detail.setZHSJEY(new BigDecimal(f.getJE()).add(new BigDecimal(f.getSE())).toString()); |
|
|
|
|
if(StrUtil.isBlank(f.getDJ())){ |
|
|
|
|
detail.setZZDJFP(""); |
|
|
|
|
}else { |
|
|
|
|
detail.setZZDJFP(f.getDJ()); |
|
|
|
|
// detail.setZZDJFP(new BigDecimal(f.getDJ()).multiply(new BigDecimal(f.getSL()).add(BigDecimal.ONE)).setScale(ConfigureConstant.INT_8,BigDecimal.ROUND_HALF_EVEN).toString());
|
|
|
|
|
fpkjtsReqSap.setZFPDM(ddfpxx.getFPDM()); |
|
|
|
|
fpkjtsReqSap.setZFPHM(ddfpxx.getFPHM()); |
|
|
|
|
fpkjtsReqSap.setZFPLX(CommonUtils.transToSnFplxdm(ddfpxx.getFPLXDM())); |
|
|
|
|
fpkjtsReqSap.setZXFBM(ddfpxx.getXHFSBH()); |
|
|
|
|
fpkjtsReqSap.setZGFBH(ddfpxx.getGMFSBH()); |
|
|
|
|
fpkjtsReqSap.setZBHSJEY(ddfpxx.getHJJE()); |
|
|
|
|
fpkjtsReqSap.setZZSEY(ddfpxx.getHJSE()); |
|
|
|
|
fpkjtsReqSap.setZHSJEY(ddfpxx.getJSHJ()); |
|
|
|
|
fpkjtsReqSap.setZHSJE(ddfpxx.getJSHJ()); |
|
|
|
|
fpkjtsReqSap.setZZBZ(ddfpxx.getBZ()); |
|
|
|
|
fpkjtsReqSap.setZFPZT(ddfpxx.getZFBZ());//0-正常、1-作废
|
|
|
|
|
String formatKprq = ""; |
|
|
|
|
try { |
|
|
|
|
Date date = (Date) new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ddfpxx.getKPRQ()); |
|
|
|
|
SimpleDateFormat sdf = null; |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(ddfpxx.getXtly())) { |
|
|
|
|
sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
}else{ |
|
|
|
|
sdf = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
} |
|
|
|
|
formatKprq = sdf.format(date); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("{}发票推送SAP格式化开票日期错误:{}",LOGGER_MSG,e); |
|
|
|
|
} |
|
|
|
|
detail.setINVOICEDATE(ddfpxx.getKPRQ()); |
|
|
|
|
detail.setINVOICETYPE(ddfpxx.getFPLXDM()); |
|
|
|
|
detail.setZHWMC(f.getXMMC()); |
|
|
|
|
detail.setZSM(ObjectUtil.isNull(smMap.get(f.getSL()))?"":smMap.get(f.getSL()).toString()); |
|
|
|
|
itemList.add(detail); |
|
|
|
|
}); |
|
|
|
|
fpkjtsReqSap.setITITEM(itemList); |
|
|
|
|
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(gsClients.size()>0?gsClients.get(0).getClient():""); |
|
|
|
|
mainList.add(fpkjtsReqSap); |
|
|
|
|
String jsonString = JsonUtils.getInstance().toJsonString(mainList); |
|
|
|
|
isInput.setZDATA(jsonString); |
|
|
|
|
PoCommonRequestParam poCommonRequestParam = new PoCommonRequestParam(); |
|
|
|
|
poCommonRequestParam.setIS_INPUT(isInput); |
|
|
|
|
|
|
|
|
|
ywxtParam = JsonUtils.getInstance().toJsonString(poCommonRequestParam); |
|
|
|
|
fpkjtsReqSap.setZKPRQ(formatKprq); |
|
|
|
|
fpkjtsReqSap.setZGFMC(ddfpxx.getGMFMC()); |
|
|
|
|
fpkjtsReqSap.setZGFSH(ddfpxx.getGMFSBH()); |
|
|
|
|
fpkjtsReqSap.setZXFMC(ddfpxx.getXHFMC()); |
|
|
|
|
fpkjtsReqSap.setZXFSH(ddfpxx.getXHFSBH()); |
|
|
|
|
fpkjtsReqSap.setZTID(ddfpxx.getFPDM()+ddfpxx.getFPHM()+ddfpxx.getFPLXDM()); |
|
|
|
|
fpkjtsReqSap.setZGFZH(ddfpxx.getGMFZH()); |
|
|
|
|
fpkjtsReqSap.setZGFDH(ddfpxx.getGMFDH()); |
|
|
|
|
fpkjtsReqSap.setZXFDH(ddfpxx.getXHFDH()); |
|
|
|
|
fpkjtsReqSap.setZXFZH(ddfpxx.getXHFZH()); |
|
|
|
|
fpkjtsReqSap.setZGSDM(ddfpxx.getCompanyCode()); |
|
|
|
|
fpkjtsReqSap.setZYWDJ(ddfpxx.getBillNum()); |
|
|
|
|
fpkjtsReqSap.setIMGID(ddfpxx.getDocuId()); |
|
|
|
|
fpkjtsReqSap.setZBZDH(ddfpxx.getBillNum()); |
|
|
|
|
// String zfbz = ddfpxx.getZFBZ();
|
|
|
|
|
// String chbz = ddfpxx.getCHBZ();
|
|
|
|
|
// fpkjtsReqSap.setZFPZT();
|
|
|
|
|
if(StringUtils.isNotBlank(ddfpxx.getYFPHM())){ |
|
|
|
|
fpkjtsReqSap.setZYFPDM(ddfpxx.getYFPDM()); |
|
|
|
|
fpkjtsReqSap.setZYFPHM(ddfpxx.getYFPHM()); |
|
|
|
|
fpkjtsReqSap.setZHZXXB(StringUtils.isNotBlank(ddfpxx.getHZXXBBH())?ddfpxx.getHZXXBBH():""); |
|
|
|
|
} |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_DSXT01.getKey().equals(ddfpxx.getXtly()) || |
|
|
|
|
OrderInfoEnum.SYS_SOURCE_DSXT02.getKey().equals(ddfpxx.getXtly())){ |
|
|
|
|
fpkjtsReqSap.setPDFZJL(ddfpxx.getPDFZJL()); |
|
|
|
|
fpkjtsReqSap.setZJLLX(ddfpxx.getZJLLX()); |
|
|
|
|
} |
|
|
|
|
//明细信息
|
|
|
|
|
ddmxxx.stream().forEach(f -> { |
|
|
|
|
FpkjtsMxSap detail = new FpkjtsMxSap(); |
|
|
|
|
//主信息
|
|
|
|
|
detail.setZJSDH(ddfpxx.getDDH()); |
|
|
|
|
// detail.setZJSDH(ddfpxx.getDDH());
|
|
|
|
|
detail.setZFPDM(ddfpxx.getFPDM()); |
|
|
|
|
detail.setZFPHM(ddfpxx.getFPHM()); |
|
|
|
|
detail.setZFPHH(f.getXH()); |
|
|
|
|
if(ObjectUtil.isNull(f.getZXBM()) || StrUtil.isBlank(f.getZXBM())){ |
|
|
|
|
detail.setMATNR(""); |
|
|
|
|
}else { |
|
|
|
|
// DecimalFormat g1=new DecimalFormat("000000000000000000");
|
|
|
|
|
detail.setMATNR(f.getZXBM()); |
|
|
|
|
} |
|
|
|
|
detail.setZGGXH(f.getGGXH()); |
|
|
|
|
detail.setZSLDW(f.getDW()); |
|
|
|
|
detail.setZZSL(f.getSPSL()); |
|
|
|
|
detail.setZTAX(new BigDecimal(f.getSL()).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString()); |
|
|
|
|
detail.setZBHSJEY(f.getJE()); |
|
|
|
|
detail.setZZSEY(f.getSE()); |
|
|
|
|
detail.setZHSJEY(new BigDecimal(f.getJE()).add(new BigDecimal(f.getSE())).toString()); |
|
|
|
|
if(StrUtil.isBlank(f.getDJ())){ |
|
|
|
|
detail.setZZDJFP(""); |
|
|
|
|
}else { |
|
|
|
|
detail.setZZDJFP(f.getDJ()); |
|
|
|
|
// detail.setZZDJFP(new BigDecimal(f.getDJ()).multiply(new BigDecimal(f.getSL()).add(BigDecimal.ONE)).setScale(ConfigureConstant.INT_8,BigDecimal.ROUND_HALF_EVEN).toString());
|
|
|
|
|
} |
|
|
|
|
detail.setINVOICEDATE(ddfpxx.getKPRQ()); |
|
|
|
|
detail.setINVOICETYPE(ddfpxx.getFPLXDM()); |
|
|
|
|
detail.setZHWMC(f.getXMMC()); |
|
|
|
|
detail.setZSM(ObjectUtil.isNull(smMap.get(f.getSL()))?"":smMap.get(f.getSL()).toString()); |
|
|
|
|
itemList.add(detail); |
|
|
|
|
}); |
|
|
|
|
fpkjtsReqSap.setITITEM(itemList); |
|
|
|
|
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(ddfpxx.getGsClients()); |
|
|
|
|
mainList.add(fpkjtsReqSap); |
|
|
|
|
String jsonString = JsonUtils.getInstance().toJsonString(mainList); |
|
|
|
|
isInput.setZDATA(jsonString); |
|
|
|
|
PoCommonRequestParam poCommonRequestParam = new PoCommonRequestParam(); |
|
|
|
|
poCommonRequestParam.setIS_INPUT(isInput); |
|
|
|
|
|
|
|
|
|
ywxtParam = JsonUtils.getInstance().toJsonString(poCommonRequestParam); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else if(OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(fpTsMqData.getPushType())){ |
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpdmAndFphm(fpTsMqData.getZfTsMqData().getFpdm(), fpTsMqData.getZfTsMqData().getFphm(), null); |
|
|
|
@ -1535,6 +1571,8 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
fpzftsReqSap.setZFPZT(ConfigureConstant.STRING_1); |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(orderProcessInfo.getXtly())){ |
|
|
|
|
fpzftsReqSap.setZJSDH(orderProcessInfo.getOriginDdh()); |
|
|
|
|
}else if(OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(orderProcessInfo.getXtly())){ |
|
|
|
|
fpzftsReqSap.setZJSDH(zffptsV5.getDDH()); |
|
|
|
|
}else { |
|
|
|
|
fpzftsReqSap.setZBZDH(orderProcessInfo.getBzdh()); |
|
|
|
|
} |
|
|
|
@ -1574,30 +1612,24 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
String version = pushInfo.getVersionIdent(); |
|
|
|
|
String pushWjl = pushInfo.getPushWjl(); |
|
|
|
|
|
|
|
|
|
List<OrderProcessInfo> orderProcessInfoList = new ArrayList<>(); |
|
|
|
|
OrderProcessInfo orderProcessInfo = orderProcessService.queryOrderProcessInfoByFpqqlsh(fpTsMqData.getFpqqlsh(), shList); |
|
|
|
|
List<GsClient> gsClients = gsClientMapper.selectByGsdm(orderProcessInfo.getGsdm()); |
|
|
|
|
log.info("{}推送接口orderProcessInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderProcessInfo)); |
|
|
|
|
|
|
|
|
|
OrderInfo orderInfo = orderInfoService.selectOrderInfoByOrderId(orderProcessInfo.getOrderInfoId(), shList); |
|
|
|
|
log.info("{}推送接口orderInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderInfo)); |
|
|
|
|
|
|
|
|
|
List<OrderItemInfo> orderItemInfos = orderItemInfoService.selectOrderItemInfoByOrderId(orderProcessInfo.getOrderInfoId(), shList); |
|
|
|
|
List<DdmxxxBO> ddmxxxList = BeanTransitionUtils.transitionOrderInvoiceItemV3(orderItemInfos); |
|
|
|
|
List<OrderInvoiceItemBO> orderInvoiceItems = BeanTransitionUtils.transitionOrderInvoiceItem(orderItemInfos); |
|
|
|
|
|
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo(); |
|
|
|
|
orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh()); |
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, shList); |
|
|
|
|
log.info("{}推送接口orderInvoiceInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderInvoiceInfo)); |
|
|
|
|
|
|
|
|
|
List<OrderProcessInfo> orderProcessInfoRelevantList = orderProcessService.findTopParentList(orderProcessInfo, shList); |
|
|
|
|
List<DdkzxxBO> orderExtensionInfos = BeanTransitionUtils.transitionOrderExtensionInfos(orderProcessInfoRelevantList); |
|
|
|
|
log.info("{}推送接口orderExtensionInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderExtensionInfos)); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询税控设备信息 |
|
|
|
|
*/ |
|
|
|
|
String terminalCode = orderInvoiceInfo.getSksbdm(); |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(orderProcessInfo.getXtly()) && new BigDecimal(orderProcessInfo.getKphjje()).compareTo(BigDecimal.ZERO) > 0){ |
|
|
|
|
List<OrderProcessInfo> orderProcessInfos = orderProcessService.queryOrderProcessInfoByBzdh(orderProcessInfo.getBzdh(), shList); |
|
|
|
|
int count = (int)orderProcessInfos.stream().filter(t ->OrderInfoEnum.ORDER_STATUS_5.getKey().equals(t.getDdzt())).count(); |
|
|
|
|
if(orderProcessInfos.size() != count){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
orderProcessInfoList.addAll(orderProcessInfos); |
|
|
|
|
String fpqqlsh = orderProcessInfos.stream().map(t -> t.getFpqqlsh()).collect(Collectors.joining(",")); |
|
|
|
|
fpTsMqData.setPushBackLsh(fpqqlsh); |
|
|
|
|
log.info("山能易行发票回推重置流水号{}",fpqqlsh); |
|
|
|
|
}else{ |
|
|
|
|
fpTsMqData.setPushBackLsh(orderProcessInfo.getFpqqlsh()); |
|
|
|
|
orderProcessInfoList.add(orderProcessInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//判断推送版本
|
|
|
|
|
if (ConfigurerInfo.INTERFACE_VERSION_V5.equals(version) |
|
|
|
@ -1605,9 +1637,11 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|
|
|
|
|
List<DdfpzxxV5> ddfpzxxV5s = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
|
DdfpzxxV5 interfaceOrderV5 = interfaceServiceV5.getInterfaceOrderV5(orderProcessInfo, shList, ConfigureConstant.STRING_0); |
|
|
|
|
|
|
|
|
|
ddfpzxxV5s.add(interfaceOrderV5); |
|
|
|
|
for (OrderProcessInfo processInfo : orderProcessInfoList) { |
|
|
|
|
processInfo.setGsClients(gsClients.size()>0?gsClients.get(0).getClient():""); |
|
|
|
|
DdfpzxxV5 interfaceOrderV5 = interfaceServiceV5.getInterfaceOrderV5(processInfo, shList, ConfigureConstant.STRING_0); |
|
|
|
|
ddfpzxxV5s.add(interfaceOrderV5); |
|
|
|
|
} |
|
|
|
|
} catch (InterfaceException e) { |
|
|
|
|
|
|
|
|
|
throw new OrderReceiveException(e.getCode(), e.getMessage()); |
|
|
|
@ -1617,6 +1651,25 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
content = JsonUtils.getInstance().toJsonString(ddfpzxxV5s); |
|
|
|
|
|
|
|
|
|
} else if (ConfigurerInfo.INTERFACE_VERSION_V4.equals(version) || ConfigurerInfo.INTERFACE_VERSION_V3.equals(version)) { |
|
|
|
|
OrderInfo orderInfo = orderInfoService.selectOrderInfoByOrderId(orderProcessInfo.getOrderInfoId(), shList); |
|
|
|
|
log.info("{}推送接口orderInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderInfo)); |
|
|
|
|
|
|
|
|
|
List<OrderItemInfo> orderItemInfos = orderItemInfoService.selectOrderItemInfoByOrderId(orderProcessInfo.getOrderInfoId(), shList); |
|
|
|
|
List<DdmxxxBO> ddmxxxList = BeanTransitionUtils.transitionOrderInvoiceItemV3(orderItemInfos); |
|
|
|
|
List<OrderInvoiceItemBO> orderInvoiceItems = BeanTransitionUtils.transitionOrderInvoiceItem(orderItemInfos); |
|
|
|
|
|
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo(); |
|
|
|
|
orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh()); |
|
|
|
|
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, shList); |
|
|
|
|
log.info("{}推送接口orderInvoiceInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderInvoiceInfo)); |
|
|
|
|
|
|
|
|
|
List<OrderProcessInfo> orderProcessInfoRelevantList = orderProcessService.findTopParentList(orderProcessInfo, shList); |
|
|
|
|
List<DdkzxxBO> orderExtensionInfos = BeanTransitionUtils.transitionOrderExtensionInfos(orderProcessInfoRelevantList); |
|
|
|
|
log.info("{}推送接口orderExtensionInfo数据:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(orderExtensionInfos)); |
|
|
|
|
/** |
|
|
|
|
* 查询税控设备信息 |
|
|
|
|
*/ |
|
|
|
|
String terminalCode = orderInvoiceInfo.getSksbdm(); |
|
|
|
|
//新版本请求参数组装response
|
|
|
|
|
DdfpcxRspBO ddfpcxRsp = new DdfpcxRspBO(); |
|
|
|
|
//新版本组装数据方式
|
|
|
|
@ -1813,42 +1866,42 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//旧版本请求参数组装response
|
|
|
|
|
PushReqBO response = new PushReqBO(); |
|
|
|
|
//旧版本组装方式
|
|
|
|
|
List<CommonOrderInvocieBO> commonOrderInvocies = new ArrayList<>(); |
|
|
|
|
CommonOrderInvocieBO commonOrderInvocie = new CommonOrderInvocieBO(); |
|
|
|
|
log.info("==>推送旧的版本接口"); |
|
|
|
|
OrderInvoiceHeadBO orderInvoiceHead = BeanTransitionUtils.transitionOrderInvoiceHead(orderInfo, orderInvoiceInfo); |
|
|
|
|
boolean fpdmhmDp = (OrderInfoEnum.ORDER_INVOICE_TYPE_51.getKey().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_01.getKey().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_02.getKey().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_52.getKey().equals(orderInvoiceInfo.getFpzlDm())) |
|
|
|
|
&& StringUtils.isNotEmpty(orderInvoiceInfo.getFphm()); |
|
|
|
|
if (fpdmhmDp) { |
|
|
|
|
/** |
|
|
|
|
* 获取PDF判断 |
|
|
|
|
*/ |
|
|
|
|
List<FileDownLoad> fileDownLoadList = orderInvoiceInfoService.getInvoiceFile(orderInfo.getDdlx(), orderInvoiceInfo.getFpzlDm(), orderInvoiceInfo.getPdfUrl(), orderInvoiceInfo.getKplsh(), orderInvoiceInfo.getFpdm(), orderInvoiceInfo.getFphm(), orderInvoiceInfo.getXhfNsrsbh(), terminalCode,""); |
|
|
|
|
if (ObjectUtil.isNotEmpty(fileDownLoadList)) { |
|
|
|
|
orderInvoiceHead.setPDF_FILE(fileDownLoadList.get(0).getFileContent()); |
|
|
|
|
} else { |
|
|
|
|
orderInvoiceHead.setPDF_FILE(""); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
orderInvoiceHead.setPDF_FILE(""); |
|
|
|
|
} |
|
|
|
|
// PushReqBO response = new PushReqBO();
|
|
|
|
|
// //旧版本组装方式
|
|
|
|
|
// List<CommonOrderInvocieBO> commonOrderInvocies = new ArrayList<>();
|
|
|
|
|
// CommonOrderInvocieBO commonOrderInvocie = new CommonOrderInvocieBO();
|
|
|
|
|
// log.info("==>推送旧的版本接口");
|
|
|
|
|
// OrderInvoiceHeadBO orderInvoiceHead = BeanTransitionUtils.transitionOrderInvoiceHead(orderInfo, orderInvoiceInfo);
|
|
|
|
|
// boolean fpdmhmDp = (OrderInfoEnum.ORDER_INVOICE_TYPE_51.getKey().equals(orderInvoiceInfo.getFpzlDm())
|
|
|
|
|
// || OrderInfoEnum.ORDER_INVOICE_TYPE_01.getKey().equals(orderInvoiceInfo.getFpzlDm())
|
|
|
|
|
// || OrderInfoEnum.ORDER_INVOICE_TYPE_02.getKey().equals(orderInvoiceInfo.getFpzlDm())
|
|
|
|
|
// || OrderInfoEnum.ORDER_INVOICE_TYPE_52.getKey().equals(orderInvoiceInfo.getFpzlDm()))
|
|
|
|
|
// && StringUtils.isNotEmpty(orderInvoiceInfo.getFphm());
|
|
|
|
|
// if (fpdmhmDp) {
|
|
|
|
|
// /**
|
|
|
|
|
// * 获取PDF判断
|
|
|
|
|
// */
|
|
|
|
|
// List<FileDownLoad> fileDownLoadList = orderInvoiceInfoService.getInvoiceFile(orderInfo.getDdlx(), orderInvoiceInfo.getFpzlDm(), orderInvoiceInfo.getPdfUrl(), orderInvoiceInfo.getKplsh(), orderInvoiceInfo.getFpdm(), orderInvoiceInfo.getFphm(), orderInvoiceInfo.getXhfNsrsbh(), terminalCode,"");
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(fileDownLoadList)) {
|
|
|
|
|
// orderInvoiceHead.setPDF_FILE(fileDownLoadList.get(0).getFileContent());
|
|
|
|
|
// } else {
|
|
|
|
|
// orderInvoiceHead.setPDF_FILE("");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// orderInvoiceHead.setPDF_FILE("");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//组装
|
|
|
|
|
commonOrderInvocie.setORDER_INVOICE_HEAD(orderInvoiceHead); |
|
|
|
|
commonOrderInvocie.setORDER_INVOICE_ITEMS(orderInvoiceItems); |
|
|
|
|
commonOrderInvocies.add(commonOrderInvocie); |
|
|
|
|
|
|
|
|
|
//发票开具状态码 0000 成功 9999 失败
|
|
|
|
|
response.setSTATUS_CODE(OrderInfoContentEnum.PUSH_ENTERPRISE_SUCCESS.getKey()); |
|
|
|
|
response.setSTATUS_MESSAGE(OrderInfoContentEnum.PUSH_ENTERPRISE_SUCCESS.getMessage()); |
|
|
|
|
response.setCOMMON_ORDER_INVOCIE(commonOrderInvocies); |
|
|
|
|
content = JsonUtils.getInstance().toJsonString(response); |
|
|
|
|
// commonOrderInvocie.setORDER_INVOICE_HEAD(orderInvoiceHead);
|
|
|
|
|
// commonOrderInvocie.setORDER_INVOICE_ITEMS(orderInvoiceItems);
|
|
|
|
|
// commonOrderInvocies.add(commonOrderInvocie);
|
|
|
|
|
//
|
|
|
|
|
// //发票开具状态码 0000 成功 9999 失败
|
|
|
|
|
// response.setSTATUS_CODE(OrderInfoContentEnum.PUSH_ENTERPRISE_SUCCESS.getKey());
|
|
|
|
|
// response.setSTATUS_MESSAGE(OrderInfoContentEnum.PUSH_ENTERPRISE_SUCCESS.getMessage());
|
|
|
|
|
// response.setCOMMON_ORDER_INVOCIE(commonOrderInvocies);
|
|
|
|
|
// content = JsonUtils.getInstance().toJsonString(response);
|
|
|
|
|
} |
|
|
|
|
return content; |
|
|
|
|
} |
|
|
|
@ -1878,7 +1931,6 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_52.getValue().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_01.getValue().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_02.getValue().equals(orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
|
|
|
|
|
){ |
|
|
|
|
OrderInfo orderInfo = orderInfoService.selectOrderInfoByOrderId(orderProcessInfo.getOrderInfoId(), shList); |
|
|
|
|
List<FileDownLoad> fileDownLoadList = orderInvoiceInfoService.getInvoiceFile(orderInfo.getDdlx(), orderInvoiceInfo.getFpzlDm(), orderInvoiceInfo.getPdfUrl(), orderInvoiceInfo.getKplsh(), orderInvoiceInfo.getFpdm(), orderInvoiceInfo.getFphm(), orderInvoiceInfo.getXhfNsrsbh(), terminalCode,""); |
|
|
|
@ -1928,6 +1980,18 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
zffptsV5.setFPHM(invalidInvoiceInfo.getFphm()); |
|
|
|
|
zffptsV5.setZFLX(invalidInvoiceInfo.getZflx()); |
|
|
|
|
zffptsV5.setZFYY(invalidInvoiceInfo.getZfyy()); |
|
|
|
|
if(OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(zfTsMqData.getXtly())){ |
|
|
|
|
try { |
|
|
|
|
InterfaceRequestData interfaceRequestData = interfaceRequestDataMapper.selectByBatchId(zfTsMqData.getBzdh(), "GenerateQdInvoice"); |
|
|
|
|
String requestData = interfaceRequestData.getRequestData(); |
|
|
|
|
PoCommonRequestParam poCommonRequestParam = JsonUtils.getInstance().parseObject(requestData, PoCommonRequestParam.class); |
|
|
|
|
String zdata = poCommonRequestParam.getIS_INPUT().getZDATA(); |
|
|
|
|
FpkjReqSap req = JsonUtils.getInstance().parseObject(zdata, FpkjReqSap.class); |
|
|
|
|
zffptsV5.setDDH(StringUtils.isBlank(req.getZJSDH())?"":req.getZJSDH()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("商旅匹配结算单号{}",e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (OrderInfoEnum.INVALID_INVOICE_1.getKey().equals(invalidInvoiceInfo.getZfBz())) { |
|
|
|
|
zffptsV5.setZTDM(InterfaceEnum.INTERFACE_V5_REQ_CHECK_STATUS_050000.getKey()); |
|
|
|
|
zffptsV5.setZTXX(InterfaceEnum.INTERFACE_V5_REQ_CHECK_STATUS_050000.getMessage()); |
|
|
|
|