From 6cb945f5f6dd242ac2fe8b8d8e4ba644c8a4ab02 Mon Sep 17 00:00:00 2001 From: yishiqihuasheng <1191093413@qq.com> Date: Fri, 19 May 2023 10:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=99=BA=E8=83=BD=E5=8B=BE?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseInvoiceManualCheckServiceImpl.java | 57 +++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java index 0cf02161..a0d1fe1c 100644 --- a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java +++ b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java @@ -10,6 +10,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.Resource; @@ -486,6 +487,8 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl businessList = (List)pramsMap.get("business"); + if (pageList.size() > 0) { List taxList = (List)pramsMap.get("taxList"); List taxnoList = new ArrayList<>(); @@ -505,7 +508,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl0){ count++; - log.info("count++{}",count); + log.info("count++{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); //发票状态不能认证 String invoiceStatus="07"; if ( pageList.get(i).getInvoiceStatus() != null && !invoiceStatus.contains(pageList.get(i).getInvoiceStatus()) @@ -515,7 +518,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl"+hjje); continue; } //发票税号一申请抵扣统计 @@ -524,10 +527,10 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl"+hjje); + continue; } - List businessList = (List)pramsMap.get("business"); BaseSggxCxRespVO vo = getBaseSggxCxRespVO(pageList.get(i), count, taxnoList, businessList); // log.info("智能勾选查询返回对象VO {}",vo); @@ -539,6 +542,52 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl collect = pageList.stream().skip(i + 1).sorted((e1, e2) -> e2.getTaxAmount().compareTo(e1.getTaxAmount())).collect(Collectors.toList()); + if (collect != null && collect.size() > 0){ + log.info("从小到大排序在进行添加"); + for (int j = 0; j < collect.size(); j++) { + currentTax = currentTax.add(collect.get(j).getTaxAmount()); + hjje = hjje.add(collect.get(j).getInvoiceAmount()); + log.info("maxTax====>"+maxTax+",currentTax====>"+currentTax); + if (maxTax.compareTo(currentTax)>0){ + count++; + log.info("最小排序count++{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); + + //发票状态不能认证 + String invoiceStatus="07"; + if ( pageList.get(i).getInvoiceStatus() != null && !invoiceStatus.contains(pageList.get(i).getInvoiceStatus()) + || pageList.get(i).getInvoiceAmount() != null && pageList.get(i).getInvoiceAmount().compareTo(new BigDecimal(0)) < 0 + || pageList.get(i).getTaxAmount() != null && pageList.get(i).getTaxAmount().compareTo(new BigDecimal(0)) < 0) { + + currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); + hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); + count--; + log.info("最小排序count--{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); + continue; + } + //发票税号一申请抵扣统计 + if (!gfshList1.contains(pageList.get(i).getGfTaxNo())) { + //该发票税号已申请抵扣统计 + currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); + hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); + count--; + log.info("最小排序已申请抵扣统计 count-- ==={}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); + + continue; + } + + BaseSggxCxRespVO vo = getBaseSggxCxRespVO(collect.get(j), count, taxnoList, businessList); + log.info("returnList添加vo"); + returnList.add(vo); + }else { + log.info("最小排序统计税额超出税额上限减去最后一个,并结束循环遍历"); + currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); + hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); + break; + } + } + } + break; }