feat: 付款申请单列表增加已指定应付聚合列
This commit is contained in:
+2
@@ -50,6 +50,8 @@ public class PaymentApplicationVO extends PaymentApplication implements KingdeeU
|
||||
@TableField(exist = false) private String kingdeeLockStatus;
|
||||
@TableField(exist = false) private String kingdeeLockFailReason;
|
||||
@TableField(exist = false) private Integer kingdeeTryCount;
|
||||
/** 已指定应付聚合态(assigned全部已指定/failed存在指定失败/unspecified存在未指定),空展示- */
|
||||
@TableField(exist = false) private String kingdeeAssignStatus;
|
||||
/** 金蝶解锁终态标识(unlocked 锁记录回填):解锁时间非空即代表该单曾被金蝶解锁/删单,供页面展示明显标识 */
|
||||
@TableField(exist = false) private LocalDateTime kingdeeUnlockTime;
|
||||
/** 金蝶侧解锁操作人(回调报文 operator) */
|
||||
|
||||
+50
@@ -64,6 +64,8 @@ import org.springblade.transport.mapper.FormalSettlementDetailMapper;
|
||||
import org.springblade.transport.mapper.FormalSettlementMapper;
|
||||
import org.springblade.transport.mapper.FormalSettlementPaymentMapper;
|
||||
import org.springblade.transport.mapper.FormalSettlementSourceMapper;
|
||||
import org.springblade.transport.mapper.InvoiceReceiptMapper;
|
||||
import org.springblade.transport.mapper.InvoiceReceiptSettlementMapper;
|
||||
import org.springblade.transport.mapper.PaymentApplicationInvoiceMapper;
|
||||
import org.springblade.transport.mapper.PaymentApplicationMapper;
|
||||
import org.springblade.transport.mapper.PaymentApplicationRecordMapper;
|
||||
@@ -85,6 +87,8 @@ import org.springblade.transport.pojo.entity.CustomerReceiptAccount;
|
||||
import org.springblade.transport.pojo.entity.FormalSettlement;
|
||||
import org.springblade.transport.pojo.entity.FormalSettlementDetail;
|
||||
import org.springblade.transport.pojo.entity.FormalSettlementPayment;
|
||||
import org.springblade.transport.pojo.entity.InvoiceReceipt;
|
||||
import org.springblade.transport.pojo.entity.InvoiceReceiptSettlement;
|
||||
import org.springblade.transport.pojo.entity.FormalSettlementSource;
|
||||
import org.springblade.transport.pojo.entity.HcsContractExeStage;
|
||||
import org.springblade.transport.pojo.entity.KingdeeBillLock;
|
||||
@@ -170,6 +174,8 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
|
||||
private final BillLedgerMapper billLedgerMapper;
|
||||
private final BillLedgerUsageMapper billLedgerUsageMapper;
|
||||
private final TemporaryCreditLimitMapper temporaryCreditLimitMapper;
|
||||
private final InvoiceReceiptMapper invoiceReceiptMapper;
|
||||
private final InvoiceReceiptSettlementMapper invoiceReceiptRelationMapper;
|
||||
private final IFormalSettlementService formalSettlementService;
|
||||
private final ISettlementProjectAdvanceWriteOffService projectAdvanceWriteOffService;
|
||||
private final IKingdeeBillLockService kingdeeBillLockService;
|
||||
@@ -208,6 +214,7 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
|
||||
});
|
||||
fillAttachmentSyncStatus(KingdeeAttachmentConstant.BIZ_PAY_APPLICATION, voPage.getRecords());
|
||||
fillKingdeeLockStatus(voPage.getRecords());
|
||||
fillKingdeeAssignStatus(voPage.getRecords());
|
||||
return voPage;
|
||||
}
|
||||
|
||||
@@ -233,6 +240,49 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充已指定应付聚合态:按本页结算单一次批量查认领关系与收票登记,避免 N+1。
|
||||
* 聚合规则:任一指定失败 → failed;全部已指定 → assigned;其余(有认领但未指定/未推送)→ unspecified;
|
||||
* 无关联结算单或无有效认领收票不填充,前端展示"-"
|
||||
*
|
||||
* @param rows 本页 VO 列表
|
||||
*/
|
||||
private void fillKingdeeAssignStatus(List<PaymentApplicationVO> rows) {
|
||||
Set<Long> settlementIds = rows.stream()
|
||||
.map(PaymentApplicationVO::getSettlementId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
if (settlementIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<InvoiceReceiptSettlement> relations = invoiceReceiptRelationMapper.selectList(
|
||||
Wrappers.<InvoiceReceiptSettlement>lambdaQuery()
|
||||
.in(InvoiceReceiptSettlement::getFormalSettlementId, settlementIds));
|
||||
Map<Long, List<Long>> receiptIdsBySettlement = relations.stream()
|
||||
.filter(relation -> relation.getFormalSettlementId() != null && relation.getInvoiceReceiptId() != null)
|
||||
.collect(Collectors.groupingBy(InvoiceReceiptSettlement::getFormalSettlementId,
|
||||
Collectors.mapping(InvoiceReceiptSettlement::getInvoiceReceiptId, Collectors.toList())));
|
||||
List<Long> receiptIds = receiptIdsBySettlement.values().stream()
|
||||
.flatMap(List::stream).distinct().toList();
|
||||
Map<Long, InvoiceReceipt> receiptById = receiptIds.isEmpty() ? Map.of()
|
||||
: invoiceReceiptMapper.selectBatchIds(receiptIds).stream()
|
||||
.filter(receipt -> !TransportBusiConstant.VOIDED.equals(receipt.getApprovalStatus())
|
||||
&& !Objects.equals(receipt.getIsDeleted(), 1))
|
||||
.collect(Collectors.toMap(InvoiceReceipt::getId, receipt -> receipt, (left, right) -> left));
|
||||
for (PaymentApplicationVO vo : rows) {
|
||||
List<String> statuses = receiptIdsBySettlement.getOrDefault(vo.getSettlementId(), List.of()).stream()
|
||||
.map(receiptById::get).filter(Objects::nonNull)
|
||||
.map(receipt -> Func.toStrWithEmpty(receipt.getKingdeePushStatus(),
|
||||
KingdeeBfiConstant.RECEIVED_PUSH_UNSYNCED))
|
||||
.toList();
|
||||
if (statuses.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String status = statuses.contains(KingdeeBfiConstant.RECEIVED_PUSH_FAILED) ? "failed"
|
||||
: statuses.stream().allMatch(KingdeeBfiConstant.RECEIVED_PUSH_ASSIGNED::equals)
|
||||
? "assigned" : "unspecified";
|
||||
vo.setKingdeeAssignStatus(status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充金蝶锁状态标识(locked-锁定中/failed-锁定失败;unlocked 终态不返回):
|
||||
* 锁表按本页源单一次批量查询,避免 N+1;locked 时前端可禁用编辑/作废,
|
||||
|
||||
Reference in New Issue
Block a user