📝 补充金蝶附件同步关键链路日志(A902/A801-2 调用、单附件成功、内码反查回填与推送完成)

This commit is contained in:
刘泉佳
2026-09-24 13:47:30 +08:00
parent c2f3a48c0e
commit 1932ffe2d7
4 changed files with 16 additions and 0 deletions
@@ -532,6 +532,7 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
if (Func.isBlank(billPkId)) {
billPkId = resolveKingdeeBillId(settlement);
if (Func.isNotBlank(billPkId)) {
log.info("正式结算单[{}]经 A102-4/A302-4 反查回填星瀚单据内码:{}", settlement.getFormalSettlementNo(), billPkId);
FormalSettlement patch = new FormalSettlement();
patch.setId(settlement.getId());
patch.setKingdeeBillId(billPkId);
@@ -621,6 +622,8 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
settlement.setSyncedTime(LocalDateTime.now());
updateById(settlement);
saveChange(settlement.getId(), "结算单基本信息", null, "调整", changeDesc, "");
log.info("正式结算单[{}]同步金蝶完成:settlementType={},billNo={},billPkId={}",
settlement.getFormalSettlementNo(), settlement.getSettlementType(), billNo, billPkId);
return billNo;
}
@@ -585,6 +585,8 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
for (BfiInvoiceApplyVO existApply : existApplies) {
if (existApply != null && entity.getApplicationNo().equals(existApply.getBillno())) {
// 金蝶已生成:直接回填视为同步成功(勾稽纠偏),星瀚内码一并回填(A902 附件上传定位用)
log.info("开票申请[{}]经 A303-4 查得金蝶开票申请单已生成(单据编号[{}],星瀚内码[{}]),跳过重复推送直接回填",
entity.getApplicationNo(), existApply.getBillno(), existApply.getId());
entity.setKingdeeBillNo(existApply.getBillno());
entity.setKingdeeBillId(existApply.getId() == null ? null : String.valueOf(existApply.getId()));
entity.setKingdeeStatus(KingdeeBfiConstant.KINGDEE_STATUS_SYNCED);
@@ -708,6 +710,7 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
entity.setSyncedTime(LocalDateTime.now());
updateById(entity);
record(entity.getId(), "sync", "同步金蝶", TransportBusiConstant.APPROVED, TransportBusiConstant.APPROVED, null, kingdeeNo);
log.info("开票申请[{}]A303-1 保存成功:金蝶单据编号[{}],星瀚内码[{}]", entity.getApplicationNo(), kingdeeNo, entity.getKingdeeBillId());
return kingdeeNo;
}
@@ -135,6 +135,8 @@ public class KingdeeAttachmentSyncSupport {
// 载入既有同步记录(含失败记录,重试成功时覆盖为成功)
Map<String, KingdeeAttachmentSync> existingByKey = existingByKey(bizType, bizId);
String entityNumber = KingdeeAttachmentConstant.entityNumber(bizType);
log.info("金蝶附件同步开始:业务单据[{}:{}],星瀚内码={},entityNumber={},待同步附件 {} 个,历史已成功 {} 个",
bizType, bizId, billPkId, entityNumber, items.size(), successKeys.size());
int success = 0;
int skipCount = 0;
List<String> failReasons = new ArrayList<>();
@@ -161,6 +163,7 @@ public class KingdeeAttachmentSyncSupport {
String fileName = Func.isBlank(item.name()) ? "attachment" : item.name();
BfiAttachmentUploadVO uploadVO = bfiService.uploadAttachment(entityNumber, billPkId,
KingdeeAttachmentConstant.CONTROL_KEY, fileName, content);
log.info("金蝶附件上传成功:业务单据[{}:{}],附件[{}],kingdeePath={}", bizType, bizId, item.name(), uploadVO.getPath());
pendingRecords.add(buildRecord(bizType, bizId, item, KingdeeAttachmentConstant.SYNC_STATUS_SUCCESS,
null, uploadVO.getPath(), existingByKey.get(item.key())));
success++;