📝 补充金蝶附件同步关键链路日志(A902/A801-2 调用、单附件成功、内码反查回填与推送完成)
This commit is contained in:
+3
@@ -532,6 +532,7 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
|||||||
if (Func.isBlank(billPkId)) {
|
if (Func.isBlank(billPkId)) {
|
||||||
billPkId = resolveKingdeeBillId(settlement);
|
billPkId = resolveKingdeeBillId(settlement);
|
||||||
if (Func.isNotBlank(billPkId)) {
|
if (Func.isNotBlank(billPkId)) {
|
||||||
|
log.info("正式结算单[{}]经 A102-4/A302-4 反查回填星瀚单据内码:{}", settlement.getFormalSettlementNo(), billPkId);
|
||||||
FormalSettlement patch = new FormalSettlement();
|
FormalSettlement patch = new FormalSettlement();
|
||||||
patch.setId(settlement.getId());
|
patch.setId(settlement.getId());
|
||||||
patch.setKingdeeBillId(billPkId);
|
patch.setKingdeeBillId(billPkId);
|
||||||
@@ -621,6 +622,8 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
|||||||
settlement.setSyncedTime(LocalDateTime.now());
|
settlement.setSyncedTime(LocalDateTime.now());
|
||||||
updateById(settlement);
|
updateById(settlement);
|
||||||
saveChange(settlement.getId(), "结算单基本信息", null, "调整", changeDesc, "");
|
saveChange(settlement.getId(), "结算单基本信息", null, "调整", changeDesc, "");
|
||||||
|
log.info("正式结算单[{}]同步金蝶完成:settlementType={},billNo={},billPkId={}",
|
||||||
|
settlement.getFormalSettlementNo(), settlement.getSettlementType(), billNo, billPkId);
|
||||||
return billNo;
|
return billNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
@@ -585,6 +585,8 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
|||||||
for (BfiInvoiceApplyVO existApply : existApplies) {
|
for (BfiInvoiceApplyVO existApply : existApplies) {
|
||||||
if (existApply != null && entity.getApplicationNo().equals(existApply.getBillno())) {
|
if (existApply != null && entity.getApplicationNo().equals(existApply.getBillno())) {
|
||||||
// 金蝶已生成:直接回填视为同步成功(勾稽纠偏),星瀚内码一并回填(A902 附件上传定位用)
|
// 金蝶已生成:直接回填视为同步成功(勾稽纠偏),星瀚内码一并回填(A902 附件上传定位用)
|
||||||
|
log.info("开票申请[{}]经 A303-4 查得金蝶开票申请单已生成(单据编号[{}],星瀚内码[{}]),跳过重复推送直接回填",
|
||||||
|
entity.getApplicationNo(), existApply.getBillno(), existApply.getId());
|
||||||
entity.setKingdeeBillNo(existApply.getBillno());
|
entity.setKingdeeBillNo(existApply.getBillno());
|
||||||
entity.setKingdeeBillId(existApply.getId() == null ? null : String.valueOf(existApply.getId()));
|
entity.setKingdeeBillId(existApply.getId() == null ? null : String.valueOf(existApply.getId()));
|
||||||
entity.setKingdeeStatus(KingdeeBfiConstant.KINGDEE_STATUS_SYNCED);
|
entity.setKingdeeStatus(KingdeeBfiConstant.KINGDEE_STATUS_SYNCED);
|
||||||
@@ -708,6 +710,7 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
|
|||||||
entity.setSyncedTime(LocalDateTime.now());
|
entity.setSyncedTime(LocalDateTime.now());
|
||||||
updateById(entity);
|
updateById(entity);
|
||||||
record(entity.getId(), "sync", "同步金蝶", TransportBusiConstant.APPROVED, TransportBusiConstant.APPROVED, null, kingdeeNo);
|
record(entity.getId(), "sync", "同步金蝶", TransportBusiConstant.APPROVED, TransportBusiConstant.APPROVED, null, kingdeeNo);
|
||||||
|
log.info("开票申请[{}]A303-1 保存成功:金蝶单据编号[{}],星瀚内码[{}]", entity.getApplicationNo(), kingdeeNo, entity.getKingdeeBillId());
|
||||||
return kingdeeNo;
|
return kingdeeNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
@@ -135,6 +135,8 @@ public class KingdeeAttachmentSyncSupport {
|
|||||||
// 载入既有同步记录(含失败记录,重试成功时覆盖为成功)
|
// 载入既有同步记录(含失败记录,重试成功时覆盖为成功)
|
||||||
Map<String, KingdeeAttachmentSync> existingByKey = existingByKey(bizType, bizId);
|
Map<String, KingdeeAttachmentSync> existingByKey = existingByKey(bizType, bizId);
|
||||||
String entityNumber = KingdeeAttachmentConstant.entityNumber(bizType);
|
String entityNumber = KingdeeAttachmentConstant.entityNumber(bizType);
|
||||||
|
log.info("金蝶附件同步开始:业务单据[{}:{}],星瀚内码={},entityNumber={},待同步附件 {} 个,历史已成功 {} 个",
|
||||||
|
bizType, bizId, billPkId, entityNumber, items.size(), successKeys.size());
|
||||||
int success = 0;
|
int success = 0;
|
||||||
int skipCount = 0;
|
int skipCount = 0;
|
||||||
List<String> failReasons = new ArrayList<>();
|
List<String> failReasons = new ArrayList<>();
|
||||||
@@ -161,6 +163,7 @@ public class KingdeeAttachmentSyncSupport {
|
|||||||
String fileName = Func.isBlank(item.name()) ? "attachment" : item.name();
|
String fileName = Func.isBlank(item.name()) ? "attachment" : item.name();
|
||||||
BfiAttachmentUploadVO uploadVO = bfiService.uploadAttachment(entityNumber, billPkId,
|
BfiAttachmentUploadVO uploadVO = bfiService.uploadAttachment(entityNumber, billPkId,
|
||||||
KingdeeAttachmentConstant.CONTROL_KEY, fileName, content);
|
KingdeeAttachmentConstant.CONTROL_KEY, fileName, content);
|
||||||
|
log.info("金蝶附件上传成功:业务单据[{}:{}],附件[{}],kingdeePath={}", bizType, bizId, item.name(), uploadVO.getPath());
|
||||||
pendingRecords.add(buildRecord(bizType, bizId, item, KingdeeAttachmentConstant.SYNC_STATUS_SUCCESS,
|
pendingRecords.add(buildRecord(bizType, bizId, item, KingdeeAttachmentConstant.SYNC_STATUS_SUCCESS,
|
||||||
null, uploadVO.getPath(), existingByKey.get(item.key())));
|
null, uploadVO.getPath(), existingByKey.get(item.key())));
|
||||||
success++;
|
success++;
|
||||||
|
|||||||
+7
@@ -536,12 +536,15 @@ public class BfiServiceImpl implements IBfiService {
|
|||||||
BfiInvoiceDownloadDTO param = new BfiInvoiceDownloadDTO();
|
BfiInvoiceDownloadDTO param = new BfiInvoiceDownloadDTO();
|
||||||
param.setPath(path);
|
param.setPath(path);
|
||||||
String accessToken = getAccessToken();
|
String accessToken = getAccessToken();
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
log.info("调用BFI接口 进项发票下载开始 path:{}", path);
|
||||||
try {
|
try {
|
||||||
Response response = client.invoiceDownload(accessToken, param);
|
Response response = client.invoiceDownload(accessToken, param);
|
||||||
if (response == null || response.status() != 200) {
|
if (response == null || response.status() != 200) {
|
||||||
log.error("调用BFI接口 进项发票下载异常响应状态:{}", response == null ? "无响应" : response.status());
|
log.error("调用BFI接口 进项发票下载异常响应状态:{}", response == null ? "无响应" : response.status());
|
||||||
throw new BfiException("调用BFI接口进项发票下载异常,响应状态:" + (response == null ? "无响应" : response.status()));
|
throw new BfiException("调用BFI接口进项发票下载异常,响应状态:" + (response == null ? "无响应" : response.status()));
|
||||||
}
|
}
|
||||||
|
log.info("调用BFI接口 进项发票下载结束 耗时:{}ms", System.currentTimeMillis() - start);
|
||||||
return response;
|
return response;
|
||||||
} catch (BfiException e) {
|
} catch (BfiException e) {
|
||||||
throw e;
|
throw e;
|
||||||
@@ -566,12 +569,16 @@ public class BfiServiceImpl implements IBfiService {
|
|||||||
args.set("billPkId", billPkId);
|
args.set("billPkId", billPkId);
|
||||||
args.set("controlKey", StringUtil.isBlank(controlKey) ? "attachmentpanel" : controlKey);
|
args.set("controlKey", StringUtil.isBlank(controlKey) ? "attachmentpanel" : controlKey);
|
||||||
InMemoryMultipartFile file = new InMemoryMultipartFile("file", fileName, MediaType.APPLICATION_OCTET_STREAM_VALUE, fileContent);
|
InMemoryMultipartFile file = new InMemoryMultipartFile("file", fileName, MediaType.APPLICATION_OCTET_STREAM_VALUE, fileContent);
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
log.info("调用BFI接口 附件上传开始 entityNumber:{},billPkId:{},文件:{},大小:{}字节",
|
||||||
|
entityNumber, billPkId, fileName, fileContent.length);
|
||||||
BfiResultVO<BfiAttachmentUploadVO> result = commonCall("附件上传", () -> client.uploadAttachment(accessToken, file, args.toString()));
|
BfiResultVO<BfiAttachmentUploadVO> result = commonCall("附件上传", () -> client.uploadAttachment(accessToken, file, args.toString()));
|
||||||
BfiAttachmentUploadVO uploadVO = result.getData();
|
BfiAttachmentUploadVO uploadVO = result.getData();
|
||||||
if (uploadVO == null || StringUtil.isBlank(uploadVO.getPath())) {
|
if (uploadVO == null || StringUtil.isBlank(uploadVO.getPath())) {
|
||||||
log.error("调用BFI接口 附件上传返回数据为空:{}", JSONUtil.toJsonStr(result));
|
log.error("调用BFI接口 附件上传返回数据为空:{}", JSONUtil.toJsonStr(result));
|
||||||
throw new BfiException("调用BFI接口附件上传异常,返回数据为空");
|
throw new BfiException("调用BFI接口附件上传异常,返回数据为空");
|
||||||
}
|
}
|
||||||
|
log.info("调用BFI接口 附件上传结束 耗时:{}ms,kingdeePath:{}", System.currentTimeMillis() - start, uploadVO.getPath());
|
||||||
return uploadVO;
|
return uploadVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user