|
|
@@ -6313,6 +6313,32 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
records = records.stream().filter(action-> !"0".equals(action.getUnSettledAmount())).toList();
|
|
|
}
|
|
|
}
|
|
|
+ // 根据结算状态过滤:0-已开票未结清 1-已结清 2-未开票
|
|
|
+ if(StrUtil.isNotEmpty(settlementReportQueryVo.getSettlementStatus())){
|
|
|
+ String settlementStatus = settlementReportQueryVo.getSettlementStatus();
|
|
|
+ if("2".equals(settlementStatus)){
|
|
|
+ // 未开票:ins_ply_income_invoice没有数据
|
|
|
+ records = records.stream().filter(action -> StrUtil.isEmpty(action.getInvoiceIds())).toList();
|
|
|
+ } else if("0".equals(settlementStatus)){
|
|
|
+ // 已开票未结清:有发票数据,且存在status=0的发票
|
|
|
+ records = records.stream().filter(action -> {
|
|
|
+ if(StrUtil.isEmpty(action.getInvoiceIds())){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<String> invoiceIdList = Arrays.asList(action.getInvoiceIds().split(","));
|
|
|
+ return baseMapper.countUnsettledInvoicesByInvoiceIds(invoiceIdList) > 0;
|
|
|
+ }).toList();
|
|
|
+ } else if("1".equals(settlementStatus)){
|
|
|
+ // 已结清:有发票数据,且所有发票status=1
|
|
|
+ records = records.stream().filter(action -> {
|
|
|
+ if(StrUtil.isEmpty(action.getInvoiceIds())){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<String> invoiceIdList = Arrays.asList(action.getInvoiceIds().split(","));
|
|
|
+ return baseMapper.countUnsettledInvoicesByInvoiceIds(invoiceIdList) == 0;
|
|
|
+ }).toList();
|
|
|
+ }
|
|
|
+ }
|
|
|
receiverSettlementReport.setRecords(records);
|
|
|
}
|
|
|
return receiverSettlementReport;
|