|
|
@ -209,7 +209,9 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
JsonObject headJson = responseJson.getAsJsonObject("response").getAsJsonObject("head"); |
|
|
|
if (SUCCESS_CODE.equals(headJson.get("resultcode").getAsString())) { |
|
|
|
String str = responseJson.getAsJsonObject("response").getAsJsonObject("body").get("resdat").toString(); |
|
|
|
String resdatJsonString = str.substring(1, str.length() - 1).replace("\\\"", "\"");; |
|
|
|
logger.info("str : " + str); |
|
|
|
String resdatJsonString = str.substring(1, str.length() - 1).replace("\\\"", "\"").replaceAll("\\\\\"", "").replace("\\", ""); |
|
|
|
logger.info("resdatJsonString : " + resdatJsonString); |
|
|
|
JsonObject resdatJson = JsonParser.parseString(resdatJsonString).getAsJsonObject(); |
|
|
|
if (SUCCESS_CODE.equals(resdatJson.get("code").getAsString())) { |
|
|
|
JsonObject dataJson = resdatJson.getAsJsonObject("data"); |
|
|
@ -237,6 +239,18 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
basicInvoiceDO.setTotalAmountWin(saleInvoice.getTotalAmount()); |
|
|
|
basicInvoiceDO.setTotalTaxWin(saleInvoice.getTotalTax()); |
|
|
|
basicInvoiceDO.setAmountTaxWin(saleInvoice.getAmountTax()); |
|
|
|
} else if ("51".equals(basicInvoiceDO.getInvoiceType())){ |
|
|
|
// 数电铁路客票
|
|
|
|
BigDecimal taxRate = new BigDecimal(trainTaxRate); |
|
|
|
basicInvoiceDO.setBankTaxRate(zero); |
|
|
|
basicInvoiceDO.setAmountTaxWin(basicInvoiceDO.getAmountTax()); |
|
|
|
basicInvoiceDO.setTaxRate(taxRate); |
|
|
|
// 税额 = 价税合计 / (1 + 税率) * 税率
|
|
|
|
// 合计金额 = 价税合计 - 税额
|
|
|
|
BigDecimal totalTax = |
|
|
|
basicInvoiceDO.getAmountTaxWin().divide(BigDecimal.ONE.add(taxRate), 2, RoundingMode.HALF_UP).multiply(taxRate).setScale(2, RoundingMode.HALF_UP); |
|
|
|
basicInvoiceDO.setTotalTaxWin(totalTax); |
|
|
|
basicInvoiceDO.setTotalAmountWin(basicInvoiceDO.getAmountTaxWin().subtract(totalTax)); |
|
|
|
} else { |
|
|
|
basicInvoiceDO.setTaxRate(zero); |
|
|
|
basicInvoiceDO.setTotalAmountWin(saleInvoice.getAmountTax()); |
|
|
@ -294,7 +308,8 @@ public class CmbServiceImpl implements BaseBankService { |
|
|
|
|
|
|
|
basicInvoiceDO.setBankTaxRate(zero); |
|
|
|
basicInvoiceDO.setAmountTaxWin(basicInvoiceDO.getAmountTax()); |
|
|
|
if ("u".equals(basicInvoiceDO.getInvoiceType()) || "51".equals(basicInvoiceDO.getInvoiceType())) { |
|
|
|
if ("u".equals(basicInvoiceDO.getInvoiceType())) { |
|
|
|
// 火车高铁票
|
|
|
|
BigDecimal taxRate = new BigDecimal(trainTaxRate); |
|
|
|
basicInvoiceDO.setTaxRate(taxRate); |
|
|
|
// 税额 = 价税合计 / (1 + 税率) * 税率
|
|
|
|