Commit 9975a9426dbf7195520ad4d5a7779ae2a4357a3b
1 parent
406ad771
feat(proxy): 添加第三方ID字段并优化处理逻辑
- 在 BaseProxy 中添加 thirdPartyId 字段及 Getter/Setter 注解- 移除 CustomerProxy 中重复定义的 thirdPartyId 字段 -优化 CustomerSender 中对成功实体列表的判空逻辑 - 在 ProxyProcessor 中设置消息上下文的第三方ID数据
Showing
4 changed files
with
9 additions
and
4 deletions
tax-central/src/main/java/com/diligrp/tax/central/domain/BaseProxy.java
| 1 | package com.diligrp.tax.central.domain; | 1 | package com.diligrp.tax.central.domain; |
| 2 | 2 | ||
| 3 | +import lombok.Getter; | ||
| 4 | +import lombok.Setter; | ||
| 5 | + | ||
| 3 | /** | 6 | /** |
| 4 | * @Author: zhangmeiyang | 7 | * @Author: zhangmeiyang |
| 5 | * @CreateTime: 2025-10-30 17:26 | 8 | * @CreateTime: 2025-10-30 17:26 |
| 6 | * @Version: todo | 9 | * @Version: todo |
| 7 | */ | 10 | */ |
| 11 | +@Getter | ||
| 12 | +@Setter | ||
| 8 | public abstract class BaseProxy { | 13 | public abstract class BaseProxy { |
| 14 | + private String thirdPartyId; | ||
| 9 | } | 15 | } |
tax-central/src/main/java/com/diligrp/tax/central/domain/proxy/kingdee/CustomerProxy.java
tax-proxy/src/main/java/com/diligrp/tax/proxy/demarcate/kingdee/CustomerSender.java
| @@ -44,9 +44,7 @@ public class CustomerSender extends Sender<CustomerProxy> { | @@ -44,9 +44,7 @@ public class CustomerSender extends Sender<CustomerProxy> { | ||
| 44 | RepoRet<?> repoRet = KingDeeHelper.auditSend(JsonUtils.convertValue(mapping, new TypeReference<>() {}), new K3CloudApi(identifyInfo), markDocument().value); | 44 | RepoRet<?> repoRet = KingDeeHelper.auditSend(JsonUtils.convertValue(mapping, new TypeReference<>() {}), new K3CloudApi(identifyInfo), markDocument().value); |
| 45 | //联系人新增和更新完成 | 45 | //联系人新增和更新完成 |
| 46 | ArrayList<SuccessEntity> successEntity = repoRet.getResult().getResponseStatus().getSuccessEntitys(); | 46 | ArrayList<SuccessEntity> successEntity = repoRet.getResult().getResponseStatus().getSuccessEntitys(); |
| 47 | - if (successEntity.isEmpty()) { | ||
| 48 | - throw new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL); | ||
| 49 | - } | 47 | + Optional.ofNullable(successEntity).filter(e -> !e.isEmpty()).orElseThrow(()->new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL)); |
| 50 | SuccessEntity first = successEntity.getFirst(); | 48 | SuccessEntity first = successEntity.getFirst(); |
| 51 | var proxy = new CustomerProxy(); | 49 | var proxy = new CustomerProxy(); |
| 52 | proxy.setThirdPartyId(first.getId()); | 50 | proxy.setThirdPartyId(first.getId()); |
tax-proxy/src/main/java/com/diligrp/tax/proxy/process/kingdee/ProxyProcessor.java
| @@ -25,6 +25,7 @@ public class ProxyProcessor extends AbstractProcessor { | @@ -25,6 +25,7 @@ public class ProxyProcessor extends AbstractProcessor { | ||
| 25 | AbstractConnectionManager<?> abstractConnectionManager = ConnectionContext.CONNECTION_MAP.get(messageContext.getSystemTypeEnum()); | 25 | AbstractConnectionManager<?> abstractConnectionManager = ConnectionContext.CONNECTION_MAP.get(messageContext.getSystemTypeEnum()); |
| 26 | IdentifyInfo identifyInfo = (IdentifyInfo) abstractConnectionManager.getConnection(messageContext.getTenantPipeline()); | 26 | IdentifyInfo identifyInfo = (IdentifyInfo) abstractConnectionManager.getConnection(messageContext.getTenantPipeline()); |
| 27 | BaseProxy send = ProxyContext.CONTEXT.get(messageContext.getDocumentTypeEnum()).send(messageContext.getMappingObject(), identifyInfo); | 27 | BaseProxy send = ProxyContext.CONTEXT.get(messageContext.getDocumentTypeEnum()).send(messageContext.getMappingObject(), identifyInfo); |
| 28 | + messageContext.setPipelineDataId(send.getThirdPartyId()); | ||
| 28 | messageContext.setProxyObject(send); | 29 | messageContext.setProxyObject(send); |
| 29 | return messageContext; | 30 | return messageContext; |
| 30 | } | 31 | } |