|
|
|
@ -207,9 +207,25 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
// 还需要单独调用下发票结果获取接口,获取订单结果
|
|
|
|
|
JSONObject queryBody = new JSONObject(); |
|
|
|
|
queryBody.put("NSRSBH", companyservice.getSellertax()); |
|
|
|
|
queryBody.put("DDQQPCH", billInfo.getSystemOrderno()); |
|
|
|
|
queryBody.put("FPLXDM", fplxdm); |
|
|
|
|
queryBody.put("SFFHSBSJ", "0"); |
|
|
|
|
// queryBody.put("DDQQPCH", billInfo.getSystemOrderno());
|
|
|
|
|
// queryBody.put("FPLXDM", fplxdm);
|
|
|
|
|
// queryBody.put("SFFHSBSJ", "0");
|
|
|
|
|
|
|
|
|
|
// TODO: 2023/10/8 数电
|
|
|
|
|
// 订单请求流水号
|
|
|
|
|
queryBody.put("DDQQLSH", billInfo.getSystemOrderno()); |
|
|
|
|
/*// 提取码
|
|
|
|
|
queryBody.put("TQM", "0"); |
|
|
|
|
// 订单号
|
|
|
|
|
queryBody.put("DDH", "0"); |
|
|
|
|
// 红字确认单编号
|
|
|
|
|
queryBody.put("HZQRDBH", "0"); |
|
|
|
|
// 版式文件(0:需要;1:不需要)
|
|
|
|
|
queryBody.put("BSWJ", "0"); |
|
|
|
|
// 订单日期起
|
|
|
|
|
queryBody.put("DDRQQ", "0"); |
|
|
|
|
// 订单日期止
|
|
|
|
|
queryBody.put("DDRQZ", "0");*/ |
|
|
|
|
// queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody));
|
|
|
|
|
try { |
|
|
|
|
queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); |
|
|
|
@ -230,7 +246,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
if (contentJson != null) { |
|
|
|
|
String ztdm = contentJson.getString("ZTDM"); |
|
|
|
|
// 021002 020111
|
|
|
|
|
if (!StringUtils.equalsAny(ztdm, "020111", "020000", "010000")) { |
|
|
|
|
if (!StringUtils.equalsAny(ztdm, "020111", "020000", "010000","000000")) { |
|
|
|
|
// 开票失败
|
|
|
|
|
if (StringUtils.equals("020002", ztdm)) { |
|
|
|
|
billInfo.setState(22); |
|
|
|
@ -325,7 +341,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
AjaxResult queryResult = null; |
|
|
|
|
try { |
|
|
|
|
queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.QUERY_INVOICE_LOCALHOST, ElephantConstantsV6.QUERY_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); |
|
|
|
|
queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.QUERY_INVOICE_LOCALHOST, ElephantConstantsV6.QUERY_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); |
|
|
|
|
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { |
|
|
|
|
log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryBody).toString(), JSONObject.toJSONString(companyservice)); |
|
|
|
|
e.printStackTrace(); |
|
|
|
@ -387,18 +403,16 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
String ddzt = ddfpxx.getDDZT(); // 000000 成功,001000 订单处理成功 001999开票失败
|
|
|
|
|
// 021002 020111
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(ddzt, "000000")) { |
|
|
|
|
// 开票状态: 2 :开票完成( 最终状态),其他状态分别为: 20:开票中; 21:开票成功签章中;22:开票失败;24: 开票成功签章失败;3: 发票已作废31
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(ddzt, "030000")) { |
|
|
|
|
invoice.setState(2); // "开票状态"
|
|
|
|
|
} else if (StringUtils.equals(ddzt, "001999")) { |
|
|
|
|
} else if (StringUtils.equals(ddzt, "031999")) { |
|
|
|
|
invoice.setState(22); // "开票状态"
|
|
|
|
|
} else if (StringUtils.equals(ddzt, "002000")) { |
|
|
|
|
//kk TODO : 2023/9/6 目前的状态是开票中
|
|
|
|
|
/*if (StringUtils.equals(ztdm, "002000")) { |
|
|
|
|
invoice.setState(22); // "开票状态" 辣鸡大象,订单开票异常的外层报文也是002000,内层报文也是这个
|
|
|
|
|
} else { |
|
|
|
|
invoice.setState(20); // "开票状态"
|
|
|
|
|
}*/ |
|
|
|
|
} else if (StringUtils.equals(ddzt, "032000")) { |
|
|
|
|
invoice.setState(20); // "开票状态"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (StringUtils.equals(ddzt, "003000")) { |
|
|
|
|
invoice.setState(3); // "开票状态"
|
|
|
|
|
} else if (StringUtils.equals(ddzt, "004000")) { |
|
|
|
@ -531,7 +545,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
tempDetail.setYhzcbs(Integer.parseInt(StringUtils.isEmpty(ddmxxx.getYHZCBS()) ? "0" : ddmxxx.getYHZCBS())); // 优惠政策标识
|
|
|
|
|
tempDetail.setZzstsgl(StringUtils.isEmpty(ddmxxx.getZZSTSGL()) ? "" : ddmxxx.getZZSTSGL()); // 增值税特殊管理
|
|
|
|
|
tempDetail.setLslbs(StringUtils.isEmpty(ddmxxx.getLSLBS()) ? "" : ddmxxx.getLSLBS()); // 零税率标识
|
|
|
|
|
if (ddmxxx.getKCE() != null) { |
|
|
|
|
if (ddmxxx.getKCE() != null && !"".equals(ddmxxx.getKCE())) { |
|
|
|
|
tempDetail.setKce(new BigDecimal(ddmxxx.getKCE())); // 扣除额
|
|
|
|
|
} |
|
|
|
|
tempDetail.setTax(new BigDecimal(ddmxxx.getSE())); // 税额
|
|
|
|
|