|
|
@@ -768,10 +768,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
resultList.addAll(followAggVoList);
|
|
|
}
|
|
|
|
|
|
- // 3. 查询额外其他费用收入数据,补充到结果集
|
|
|
- List<InsPlyIncomeDto> incomeDtoList = queryFollowIncomeData(settlementReportQueryVo);
|
|
|
- if (CollUtil.isEmpty(incomeDtoList)) {
|
|
|
- return resultList;
|
|
|
+ // 应收项为空时才去补充数据,不为空时不补充数据,补充数据是因为联查了invoice和settlement表,所以没开票和结算的数据会被过滤掉,才需要补充数据
|
|
|
+ List<InsPlyIncomeDto> incomeDtoList = CollUtil.newArrayList();
|
|
|
+ if (StrUtil.isBlank(settlementReportQueryVo.getInvoiceType())){
|
|
|
+ // 3. 查询额外其他费用收入数据,补充到结果集
|
|
|
+ incomeDtoList = queryFollowIncomeData(settlementReportQueryVo);
|
|
|
+ if (CollUtil.isEmpty(incomeDtoList)) {
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 4. 根据筛选条件过滤收入数据(发票、结算时间/状态过滤)
|
|
|
@@ -4535,16 +4539,19 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
.map(InsPlyIncomeInvoiceSettlement::getActualReceivedAmount)
|
|
|
.filter(Objects::nonNull)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
-// BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
|
|
|
-// .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
|
|
|
-// .filter(Objects::nonNull)
|
|
|
-// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
|
|
|
+ .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
BigDecimal receivableSupervisePremium = action.getReceivableSupervisePremium() != null ? action.getReceivableSupervisePremium(): BigDecimal.ZERO;
|
|
|
|
|
|
// BigDecimal overinflatedAmount = action.getOverinflatedAmount() != null? action.getOverinflatedAmount(): BigDecimal.ZERO;
|
|
|
// 回款差计算逻辑调整 2026年7月14日09:29:08
|
|
|
- BigDecimal settlementPaymentDifference = BigDecimalUtil.subtract(settlementAmount,receivableSupervisePremium);
|
|
|
+// BigDecimal settlementPaymentDifference = BigDecimal.ZERO;
|
|
|
+// if (CollUtil.isNotEmpty(insPlyIncomeInvoiceSettlements) && settlementAmount.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+// settlementPaymentDifference = BigDecimalUtil.subtract(settlementAmount,receivableSupervisePremium);
|
|
|
+// }
|
|
|
// 待结算金额 = 开票金额 - 已收金额
|
|
|
BigDecimal remainSettlementAmount = receivableSupervisePremium.subtract(BigDecimalUtil.add(settlementAmount, settlementPaymentDifference));
|
|
|
// 设置已结算的金额
|
|
|
@@ -4554,7 +4561,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 特殊梳理,当待结算金额计算出来为负数时, 设置为0
|
|
|
remainSettlementAmount = BigDecimal.ZERO;
|
|
|
}
|
|
|
- action.setRemainSettlementAmount( remainSettlementAmount);
|
|
|
+ action.setRemainSettlementAmount(remainSettlementAmount);
|
|
|
action.setCompanyAllName(allCompanyHierarchyPaths.get(Objects.toString(action.getCompanyId(),"")));
|
|
|
action.setSettlementStatus(settlementStatusName);
|
|
|
|
|
|
@@ -6090,11 +6097,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
* 3. 记录更新人和更新时间
|
|
|
* </p>
|
|
|
*
|
|
|
- * @param invoiceId 发票序号,用于定位需要更新的发票记录
|
|
|
+ * @param updateSettlementStatusVo 发票序号,用于定位需要更新的发票记录
|
|
|
* @return int 返回受影响的记录数,通常为1表示更新成功,0表示更新失败或记录不存在
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateSettlementStatus(String invoiceId) {
|
|
|
+ public int updateSettlementStatus(UpdateSettlementStatusVo updateSettlementStatusVo) {
|
|
|
+ String invoiceId = updateSettlementStatusVo.getInvoiceId();
|
|
|
+ String settlementPaymentReason = updateSettlementStatusVo.getSettlementPaymentReason();
|
|
|
+
|
|
|
String userName = baseController.getUserName();
|
|
|
String systemCode = baseController.getSystemCode();
|
|
|
log.info("租户[{}]下的用户[{}]标识发票[{}]为结算完成", systemCode, userName, invoiceId);
|
|
|
@@ -6109,6 +6119,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
if(subtract.compareTo(BigDecimal.ZERO) != 0){
|
|
|
InsPlyIncomeInvoiceSettlement insPlyIncomeInvoiceSettlement = insPlyIncomeInvoiceSettlements.get(0);
|
|
|
insPlyIncomeInvoiceSettlement.setSettlementPaymentDifference(BigDecimalUtil.add(subtract,insPlyIncomeInvoiceSettlement.getSettlementPaymentDifference()));
|
|
|
+ insPlyIncomeInvoiceSettlement.setSettlementPaymentReason(settlementPaymentReason);
|
|
|
insPlyIncomeInvoiceSettlementMapper.updateById(insPlyIncomeInvoiceSettlement);
|
|
|
}
|
|
|
return insPlyIncomeInvoiceMapper.update(null, new LambdaUpdateWrapper<InsPlyIncomeInvoice>()
|