优化智能勾选

release
yishiqihuasheng 2 years ago
parent 0168b615da
commit 72bd25056c
  1. 84
      dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java

@ -540,52 +540,54 @@ 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(Comparator.comparing(BaseTDxRecordInvoice::getTaxAmount)).collect(Collectors.toList()); if (i<pageList.size()-1){
log.info("collect====>{}",collect); List<BaseTDxRecordInvoice> collect = pageList.stream().skip(i + 1).sorted(Comparator.comparing(BaseTDxRecordInvoice::getTaxAmount)).collect(Collectors.toList());
if (collect != null && collect.size() > 0){ log.info("collect====>{}",collect);
log.info("从小到大排序在进行添加"); if (collect != null && collect.size() > 0){
for (int j = 0; j < collect.size(); j++) { log.info("从小到大排序在进行添加");
if (collect.get(j).getTaxAmount().compareTo(new BigDecimal("0"))<1){ for (int j = 0; j < collect.size(); j++) {
continue; if (collect.get(j).getTaxAmount().compareTo(new BigDecimal("0"))<1){
}
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; continue;
} }
//发票税号一申请抵扣统计 currentTax = currentTax.add(collect.get(j).getTaxAmount());
if (!gfshList1.contains(pageList.get(i).getGfTaxNo())) { 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()); currentTax = currentTax.subtract(pageList.get(i).getTaxAmount());
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount()); hjje = hjje.subtract(pageList.get(i).getInvoiceAmount());
count--; break;
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;
} }
} }
} }

Loading…
Cancel
Save