From c5923c9d80bb33cba524fabd59907404464df5e6 Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Fri, 7 Jul 2023 14:08:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=A0=E5=85=A5=E5=BD=B1?= =?UTF-8?q?=E5=83=8F=E7=B3=BB=E7=BB=9F=E7=A8=8E=E7=8E=87=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SDNYMainProcessController.java | 11 ++++++----- .../erp/service/SNPushCheckRecordService.java | 13 +++++++++---- .../impl/SignSaveInvoiceInfoServiceImpl.java | 17 +++++++++++++---- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java b/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java index 06a3d783..6a1261da 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java @@ -207,7 +207,7 @@ public class SDNYMainProcessController extends AbstractController { //先删除原有主数据,再查验更新主数据和明细数据 int delete = baseTDxRecordInvoiceDao.delete(recordWrapper); if(delete > 0) { - checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); + checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap,null); if (!checkInvoiceResult.containsKey("code")) { if (!checkInvoiceResult.containsKey("cyjg")) { @@ -261,7 +261,7 @@ public class SDNYMainProcessController extends AbstractController { } try { - checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); + checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap,"1"); log.info("查验结果为:{}", checkInvoiceResult); } catch (Exception e) { e.printStackTrace(); @@ -507,7 +507,7 @@ public class SDNYMainProcessController extends AbstractController { } BigDecimal tax = new BigDecimal(taxRateDetail); BigDecimal tax1 = tax.divide(new BigDecimal("100")); - if (tax.compareTo(new BigDecimal("1")) < 1) { + if (tax.compareTo(new BigDecimal("0.99")) < 1) { taxRateDetail = tax.toPlainString(); }else { taxRateDetail = tax1.toPlainString(); @@ -828,11 +828,12 @@ public class SDNYMainProcessController extends AbstractController { sapInvoiceDetail.setZTAX("0.00"); sapInvoiceDetail.setZSM(sapInvoiceDetail.getZTAX()); } else { + //传给SAP税率为整数 BigDecimal tax = new BigDecimal(taxRate); sapInvoiceDetail.setZSM(getZSM(tax.toString())); BigDecimal tax1 = tax.multiply(new BigDecimal("100")); sapInvoiceDetail.setZTAX(tax1.toString()); - if (tax1.compareTo(new BigDecimal("100")) > 0) { + if (tax1.compareTo(new BigDecimal("99")) > 0) { sapInvoiceDetail.setZTAX(taxRate); }else if (tax1.scale() > 2){ DecimalFormat decimalFormat = new DecimalFormat("#.00"); @@ -1261,7 +1262,7 @@ public class SDNYMainProcessController extends AbstractController { DecimalFormat decimalFormat = new DecimalFormat("#.00"); String formattedDecimal = decimalFormat.format(new BigDecimal("15")); BigDecimal bigDecimal = new BigDecimal("0.13"); - boolean b = bigDecimal.compareTo(new BigDecimal("1")) < 1; + boolean b = bigDecimal.compareTo(new BigDecimal("0.99")) < 1; System.out.println(); } diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java index 07d73f6d..28c91063 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java @@ -270,7 +270,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { return queryInvoiceResult; } - public JSONObject singleCheckInvoice(Map pramsMap) throws Exception { + public JSONObject singleCheckInvoice(Map pramsMap, String isInteger) throws Exception { //1.封装查验参数 ApiRequest apiRequest = new ApiRequest(); @@ -306,7 +306,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { JSONObject jsonObject = new JSONObject(); if (StringUtils.isNoneBlank(apiResponse.getContent())) { log.info("查验的结果为:{}", apiResponse.getContent()); - jsonObject = convertToSnObject(apiResponse.getContent(), jsonObject, fplxdm); + jsonObject = convertToSnObject(apiResponse.getContent(), jsonObject, fplxdm, isInteger); } // saveCheckRecord(pramsMap, apiResponse); @@ -331,7 +331,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { platformCheckLogService.save(checkLog); } - private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) throws ParseException { + private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType, String isInteger) throws ParseException { String con = new String(Base64.decode(content)); HashMap contentMap = JSONObject.parseObject(con, HashMap.class); @@ -468,6 +468,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { if (!"0".equals(taxRate)) { taxRate = taxRate.substring(0, taxRate.length() - 1); } + //按照小数处理 + if(StringUtils.isNotBlank(isInteger)){ + BigDecimal bigDecimal = new BigDecimal(taxRate); + taxRate = bigDecimal.divide(new BigDecimal("100")).toPlainString(); + } if ("11".equals(invoiceType)) { taxRate = "0"; @@ -726,7 +731,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { pramsMap.put("invoiceType", invoice.getInvoiceType()); } - checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); + checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap,null); log.info("补充查验结果为:{}", checkInvoiceResult); } catch (Exception e) { e.printStackTrace(); diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/SignSaveInvoiceInfoServiceImpl.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/SignSaveInvoiceInfoServiceImpl.java index 4f5a5cbe..6316539a 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/SignSaveInvoiceInfoServiceImpl.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/SignSaveInvoiceInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.dxhy.erp.service.impl; +import com.aisinopdf.text.pdf.B; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -314,10 +315,18 @@ public class SignSaveInvoiceInfoServiceImpl extends MpBaseServiceImpl