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 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E5=BD=B1=E5=83=8F=E7=B3=BB=E7=BB=9F=E7=A8=8E=E7=8E=87=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=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 Date: Mon, 10 Jul 2023 09:08:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E5=BD=B1=E5=83=8F=E7=B3=BB=E7=BB=9F=E7=A8=8E=E7=8E=87=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=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 --- .../erp/service/SNPushCheckRecordService.java | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) 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 28c91063..dce1beaa 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 @@ -556,33 +556,22 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { } - if ("免税".equals(detail.getString("sl"))) { + if (StringUtils.isBlank(detail.get("sl").toString()) || "免税".equals(detail.get("sl").toString()) || "不征税".equals(detail.get("sl").toString()) + || "***".equals(detail.get("sl").toString())) { taxRateDetail = "0"; snDetailMap.put("taxRate", taxRateDetail); } else { if (StringUtils.isNoneBlank(detail.get("sl").toString())) { - taxRateDetail = detail.get("sl").toString(); - if (!"0".equals(taxRateDetail)) { - if (StringUtils.isNoneBlank(taxRateDetail)) { - int index = taxRateDetail.indexOf("%"); -// if (index > 0) { -// taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1); -// Float num = Float.parseFloat(taxRateDetail); -// if (num > 9) { -// taxRateDetail = "0." + taxRateDetail; -// } else { -// if (!taxRateDetail.startsWith("0")) { -// taxRateDetail = "0.0" + taxRateDetail; -// } -// } -// } - } + taxRate = detail.get("sl").toString(); + if (!"0".equals(taxRate)) { + taxRate = taxRate.substring(0, taxRate.length() - 1); } - - if ("11".equals(invoiceType)) { - taxRateDetail = "0"; + //按照小数处理 + if(StringUtils.isNotBlank(isInteger)){ + BigDecimal bigDecimal = new BigDecimal(taxRate); + taxRate = bigDecimal.divide(new BigDecimal("100")).toPlainString(); } - log.info("明细-发票税率为:{}", taxRateDetail); + log.info("明细-发票税率为:{}", taxRate); snDetailMap.put("taxRate", taxRateDetail); } } From a2ae8e152d47478dcc1f25b8696bc3d5b2ad6b85 Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Mon, 10 Jul 2023 17:19:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E9=AA=8C?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=EF=BC=88?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E7=A8=8E=E7=8E=87=EF=BC=89=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dxhy/erp/service/SNPushCheckRecordService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 dce1beaa..ed7b1f57 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 @@ -563,16 +563,20 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { } else { if (StringUtils.isNoneBlank(detail.get("sl").toString())) { taxRate = detail.get("sl").toString(); - if (!"0".equals(taxRate)) { - taxRate = taxRate.substring(0, taxRate.length() - 1); - } + taxRate = taxRate.replace("%", ""); +// 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"; + } log.info("明细-发票税率为:{}", taxRate); - snDetailMap.put("taxRate", taxRateDetail); + snDetailMap.put("taxRate", taxRate); } } From f32fd564b78f6ff5f035334cb6314c018b2ba581 Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Tue, 11 Jul 2023 14:50:43 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dxhy/erp/controller/SDNYMainProcessController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 6a1261da..85a0ea9b 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 @@ -203,7 +203,7 @@ public class SDNYMainProcessController extends AbstractController { List baseTDxRecordInvoiceDetail = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper); DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); - if(baseTDxRecordInvoiceDetail != null && baseTDxRecordInvoiceDetail.size() == 0){ + if(baseTDxRecordInvoiceDetail != null && baseTDxRecordInvoiceDetail.size() != 0){ //先删除原有主数据,再查验更新主数据和明细数据 int delete = baseTDxRecordInvoiceDao.delete(recordWrapper); if(delete > 0) { @@ -835,7 +835,7 @@ public class SDNYMainProcessController extends AbstractController { sapInvoiceDetail.setZTAX(tax1.toString()); if (tax1.compareTo(new BigDecimal("99")) > 0) { sapInvoiceDetail.setZTAX(taxRate); - }else if (tax1.scale() > 2){ + }else { DecimalFormat decimalFormat = new DecimalFormat("#.00"); String formattedDecimal = decimalFormat.format(tax1); sapInvoiceDetail.setZTAX(formattedDecimal);