Commit 93a3cc03a8e86aacfeba17b12453e6cd928ad961
1 parent
d28ad9a8
feat(storage): 增加管道数据ID参数以优化映射查询
- 在 CustomerBuilder 中调用映射服务时传入 pipelineDataId 参数 - 更新 DynamicTaxPipelineMappingService 方法签名及实现,增加 pipelineDataId 参数 - 修改 ITaxPipelineMappingService 接口定义,支持 pipelineDataId 查询条件 - 调整 TaxPipelineMappingRepository.xml 查询语句,加入 pipeline_data_id 过滤条件 - 修正 TaxReceiveService 中的调用方法,确保传递 pipelineDataId 参数 - 移除 TaxReceiveService 中未使用的 PrintWriter 和 StringWriter 导入语句
Showing
5 changed files
with
16 additions
and
13 deletions
tax-boot/src/main/java/com/diligrp/tax/boot/service/TaxReceiveService.java
| ... | ... | @@ -19,8 +19,6 @@ import jakarta.annotation.Resource; |
| 19 | 19 | import org.springframework.stereotype.Service; |
| 20 | 20 | import org.springframework.transaction.annotation.Transactional; |
| 21 | 21 | |
| 22 | -import java.io.PrintWriter; | |
| 23 | -import java.io.StringWriter; | |
| 24 | 22 | import java.util.Optional; |
| 25 | 23 | |
| 26 | 24 | /** |
| ... | ... | @@ -64,7 +62,7 @@ public class TaxReceiveService { |
| 64 | 62 | |
| 65 | 63 | @Transactional |
| 66 | 64 | public void recordMapping(MessageContext messageContext) { |
| 67 | - Optional<TenantTaxPipelineMapping> dbOptions = taxPipelineMappingService.findByPipelineIdAndDocumentTypeAndSystemDataId(messageContext.getTenantPipeline().getTenantId(), messageContext.getTenantPipeline().getId(), messageContext.getDocumentType(), messageContext.getSystemDataId()); | |
| 65 | + Optional<TenantTaxPipelineMapping> dbOptions = taxPipelineMappingService.findByPipelineIdAndDocumentTypeAndSystemDataId(messageContext.getTenantPipeline().getTenantId(), messageContext.getTenantPipeline().getId(), messageContext.getDocumentType(), messageContext.getSystemDataId(),messageContext.getPipelineDataId()); | |
| 68 | 66 | dbOptions.ifPresentOrElse( |
| 69 | 67 | e -> { |
| 70 | 68 | TaxPipelineMappingCreate create = new TaxPipelineMappingCreate(); | ... | ... |
tax-central/src/main/java/com/diligrp/tax/central/service/ITaxPipelineMappingService.java
| ... | ... | @@ -10,13 +10,14 @@ public interface ITaxPipelineMappingService { |
| 10 | 10 | /** |
| 11 | 11 | * 按管道 ID 和文档类型以及系统数据 ID 查找 |
| 12 | 12 | * |
| 13 | - * @param tenantId 租户 ID | |
| 14 | - * @param pipelineId 管道 ID | |
| 15 | - * @param documentType 文档类型 | |
| 16 | - * @param systemDataId 系统数据 ID | |
| 13 | + * @param tenantId 租户 ID | |
| 14 | + * @param pipelineId 管道 ID | |
| 15 | + * @param documentType 文档类型 | |
| 16 | + * @param systemDataId 系统数据 ID | |
| 17 | + * @param pipelineDataId | |
| 17 | 18 | * @return {@link Optional }<{@link TenantTaxPipelineMapping }> |
| 18 | 19 | */ |
| 19 | - Optional<TenantTaxPipelineMapping> findByPipelineIdAndDocumentTypeAndSystemDataId(Long tenantId, Long pipelineId, String documentType, String systemDataId); | |
| 20 | + Optional<TenantTaxPipelineMapping> findByPipelineIdAndDocumentTypeAndSystemDataId(Long tenantId, Long pipelineId, String documentType, String systemDataId, String pipelineDataId); | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * 插入 | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/CustomerBuilder.java
| ... | ... | @@ -52,7 +52,7 @@ public class CustomerBuilder extends Builder<StandardCustomer> { |
| 52 | 52 | List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); |
| 53 | 53 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(customer, ts)); |
| 54 | 54 | //查询数据库的客户信息 如果存在 赋值id |
| 55 | - Optional<TenantTaxPipelineMapping> dbOptions = taxPipelineMappingService.findByPipelineIdAndDocumentTypeAndSystemDataId(pipeline.getTenantId(), pipeline.getId(), markDocument().value, systemDataId); | |
| 55 | + Optional<TenantTaxPipelineMapping> dbOptions = taxPipelineMappingService.findByPipelineIdAndDocumentTypeAndSystemDataId(pipeline.getTenantId(), pipeline.getId(), markDocument().value, systemDataId, messageContext.getPipelineDataId()); | |
| 56 | 56 | dbOptions.ifPresent(e -> { |
| 57 | 57 | customer.setCustomerId(e.getPipelineDataId()); |
| 58 | 58 | customer.setSystemDataId(e.getSystemDataId()); | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/service/DynamicTaxPipelineMappingService.java
| ... | ... | @@ -62,22 +62,25 @@ public class DynamicTaxPipelineMappingService implements ITaxPipelineMappingServ |
| 62 | 62 | /** |
| 63 | 63 | * 按管道 ID 和文档类型以及系统数据 ID 查找 |
| 64 | 64 | * |
| 65 | - * @param pipelineId 管道 ID | |
| 66 | - * @param documentType 文档类型 | |
| 67 | - * @param systemDataId 系统数据 ID | |
| 65 | + * @param pipelineId 管道 ID | |
| 66 | + * @param documentType 文档类型 | |
| 67 | + * @param systemDataId 系统数据 ID | |
| 68 | + * @param pipelineDataId | |
| 68 | 69 | * @return {@link Optional }<{@link TenantTaxPipelineMapping }> |
| 69 | 70 | */ |
| 70 | 71 | @Override |
| 71 | - public Optional<TenantTaxPipelineMapping> findByPipelineIdAndDocumentTypeAndSystemDataId(Long tenantId, Long pipelineId, String documentType, String systemDataId) { | |
| 72 | + public Optional<TenantTaxPipelineMapping> findByPipelineIdAndDocumentTypeAndSystemDataId(Long tenantId, Long pipelineId, String documentType, String systemDataId, String pipelineDataId) { | |
| 72 | 73 | Optional.ofNullable(tenantId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "租户ID不能为空")); |
| 73 | 74 | Optional.ofNullable(pipelineId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "管道ID不能为空")); |
| 74 | 75 | Optional.ofNullable(documentType).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "文档类型不能为空")); |
| 75 | 76 | Optional.ofNullable(systemDataId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "系统数据不能为空")); |
| 77 | + Optional.ofNullable(pipelineDataId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "管道数据不能为空")); | |
| 76 | 78 | TaxPipelineMapping taxPipelineMapping = new TaxPipelineMapping(); |
| 77 | 79 | taxPipelineMapping.setTenantId(tenantId); |
| 78 | 80 | taxPipelineMapping.setPipelineId(pipelineId); |
| 79 | 81 | taxPipelineMapping.setDocumentType(documentType); |
| 80 | 82 | taxPipelineMapping.setSystemDataId(systemDataId); |
| 83 | + taxPipelineMapping.setPipelineDataId(pipelineDataId); | |
| 81 | 84 | taxPipelineMapping.setState(MappingStateType.SYNCED.value); |
| 82 | 85 | return taxPipelineMappingRepository.findByPipelineIdAndDocumentTypeAndSystemDataId(taxPipelineMapping); |
| 83 | 86 | } | ... | ... |
tax-storage/src/main/resources/com/diligrp/tax/storage/repo/TaxPipelineMappingRepository.xml