|
|
@ -10,6 +10,7 @@ import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
@ -486,6 +487,8 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx |
|
|
|
//统计金额
|
|
|
|
//统计金额
|
|
|
|
BigDecimal hjje = new BigDecimal("0"); |
|
|
|
BigDecimal hjje = new BigDecimal("0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Business> businessList = (List<Business>)pramsMap.get("business"); |
|
|
|
|
|
|
|
|
|
|
|
if (pageList.size() > 0) { |
|
|
|
if (pageList.size() > 0) { |
|
|
|
List<Tax> taxList = (List<Tax>)pramsMap.get("taxList"); |
|
|
|
List<Tax> taxList = (List<Tax>)pramsMap.get("taxList"); |
|
|
|
List<String> taxnoList = new ArrayList<>(); |
|
|
|
List<String> taxnoList = new ArrayList<>(); |
|
|
@ -505,7 +508,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx |
|
|
|
|
|
|
|
|
|
|
|
if (maxTax.compareTo(currentTax) >0){ |
|
|
|
if (maxTax.compareTo(currentTax) >0){ |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
log.info("count++{}",count); |
|
|
|
log.info("count++{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); |
|
|
|
//发票状态不能认证
|
|
|
|
//发票状态不能认证
|
|
|
|
String invoiceStatus="07"; |
|
|
|
String invoiceStatus="07"; |
|
|
|
if ( pageList.get(i).getInvoiceStatus() != null && !invoiceStatus.contains(pageList.get(i).getInvoiceStatus()) |
|
|
|
if ( pageList.get(i).getInvoiceStatus() != null && !invoiceStatus.contains(pageList.get(i).getInvoiceStatus()) |
|
|
@ -515,7 +518,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
count--; |
|
|
|
count--; |
|
|
|
log.info("count--{}",count); |
|
|
|
log.info("count--{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
//发票税号一申请抵扣统计
|
|
|
|
//发票税号一申请抵扣统计
|
|
|
@ -524,10 +527,10 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
count--; |
|
|
|
count--; |
|
|
|
log.info("已申请抵扣统计 count-- ==={}",count); |
|
|
|
log.info("已申请抵扣统计 count-- ==={}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje); |
|
|
|
|
|
|
|
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
List<Business> businessList = (List<Business>)pramsMap.get("business"); |
|
|
|
|
|
|
|
BaseSggxCxRespVO vo = getBaseSggxCxRespVO(pageList.get(i), count, taxnoList, businessList); |
|
|
|
BaseSggxCxRespVO vo = getBaseSggxCxRespVO(pageList.get(i), count, taxnoList, businessList); |
|
|
|
|
|
|
|
|
|
|
|
// log.info("智能勾选查询返回对象VO {}",vo);
|
|
|
|
// log.info("智能勾选查询返回对象VO {}",vo);
|
|
|
@ -539,6 +542,52 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseTDxRecordInvoice> 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; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|