feat: 金蝶保存失败异常信息展示金蝶单据号
- BfiBillSaveResultItemVO 新增 getFailMark 定位信息(金蝶单据号,@JsonIgnore 不影响序列化) - commonCall 失败分支按失败分录拼入金蝶单据号,「已提交状态下的单据不允许修改」等场景可直接定位星瀚侧单据 - requireBfiSaveSuccess 单据级失败提示同步拼入
This commit is contained in:
+1
-1
@@ -887,7 +887,7 @@ public class KingdeeApBillSyncSupport {
|
|||||||
BfiBillSaveResultItemVO item = saveResult.getResult().get(0);
|
BfiBillSaveResultItemVO item = saveResult.getResult().get(0);
|
||||||
if (!Boolean.TRUE.equals(item.getBillStatus())) {
|
if (!Boolean.TRUE.equals(item.getBillStatus())) {
|
||||||
String errorText = Func.isBlank(item.getErrorText()) ? "未知错误" : item.getErrorText();
|
String errorText = Func.isBlank(item.getErrorText()) ? "未知错误" : item.getErrorText();
|
||||||
throw new ServiceException(action + "失败:" + errorText);
|
throw new ServiceException(action + "失败:" + errorText + item.getFailMark());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.thirdparty.bfi.pojo.vo;
|
package org.springblade.thirdparty.bfi.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
@@ -91,4 +92,16 @@ public class BfiBillSaveResultItemVO implements Serializable {
|
|||||||
.filter(text -> !text.isEmpty())
|
.filter(text -> !text.isEmpty())
|
||||||
.collect(Collectors.joining(";"));
|
.collect(Collectors.joining(";"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败定位信息:金蝶单据号,供异常提示展示,
|
||||||
|
* 「已提交状态下的单据不允许修改」等场景可凭金蝶单据号直接定位星瀚侧单据
|
||||||
|
*
|
||||||
|
* @return 定位信息文本,形如(金蝶单据:xxx),无可用信息返回空串
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
public String getFailMark() {
|
||||||
|
String billNo = keys == null ? null : keys.get("billno");
|
||||||
|
return billNo == null || billNo.isBlank() ? "" : "(金蝶单据:" + billNo + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-1
@@ -79,6 +79,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiApBillVO;
|
|||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
|
||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiAttachmentUploadVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiAttachmentUploadVO;
|
||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillLockResultVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillLockResultVO;
|
||||||
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultItemVO;
|
||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
|
||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBlacklistVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiBlacklistVO;
|
||||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiClaimAnnounceVO;
|
import org.springblade.thirdparty.bfi.pojo.vo.BfiClaimAnnounceVO;
|
||||||
@@ -112,6 +113,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业财融合(BFI)服务实现
|
* 业财融合(BFI)服务实现
|
||||||
@@ -655,7 +657,7 @@ public class BfiServiceImpl implements IBfiService {
|
|||||||
String message = Optional.ofNullable(result).map(BfiResultVO::getMessage).filter(StringUtil::isNotBlank)
|
String message = Optional.ofNullable(result).map(BfiResultVO::getMessage).filter(StringUtil::isNotBlank)
|
||||||
.orElseGet(() -> Optional.ofNullable(result).map(BfiResultVO::getErrorCode)
|
.orElseGet(() -> Optional.ofNullable(result).map(BfiResultVO::getErrorCode)
|
||||||
.map(errorCode -> "错误码 " + errorCode).orElse("响应为空或解析失败"));
|
.map(errorCode -> "错误码 " + errorCode).orElse("响应为空或解析失败"));
|
||||||
throw new BfiException("调用BFI接口" + type + "异常 " + message);
|
throw new BfiException("调用BFI接口" + type + "异常 " + message + billSaveFailDetail(result));
|
||||||
} catch (BfiException e) {
|
} catch (BfiException e) {
|
||||||
log.error("调用BFI接口 {},BfiException异常", type, e);
|
log.error("调用BFI接口 {},BfiException异常", type, e);
|
||||||
throw e;
|
throw e;
|
||||||
@@ -665,6 +667,26 @@ public class BfiServiceImpl implements IBfiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据保存失败定位后缀:取失败分录的金蝶单据号,非单据保存类调用返回空串
|
||||||
|
*
|
||||||
|
* @param result BFI 响应
|
||||||
|
* @param <T> 响应数据类型
|
||||||
|
* @return 定位后缀,形如 (金蝶单据:xxx)
|
||||||
|
*/
|
||||||
|
private <T> String billSaveFailDetail(BfiResultVO<T> result) {
|
||||||
|
if (result == null || !(result.getData() instanceof BfiBillSaveResultVO billSave)
|
||||||
|
|| billSave.getResult() == null || billSave.getResult().isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String detail = billSave.getResult().stream()
|
||||||
|
.filter(item -> !Boolean.TRUE.equals(item.getBillStatus()))
|
||||||
|
.map(BfiBillSaveResultItemVO::getFailMark)
|
||||||
|
.filter(mark -> !mark.isEmpty())
|
||||||
|
.collect(Collectors.joining(";"));
|
||||||
|
return detail.isEmpty() ? "" : " " + detail;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收票 rim/message 契约公共调用方法,成功错误码兼容 0 与 0000
|
* 收票 rim/message 契约公共调用方法,成功错误码兼容 0 与 0000
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user