Commit aba7d7e87fb340fd0b9c12347ae1112d9a27878a
1 parent
f45f595b
feat(kingdee): 完善客户和单据字段映射及配置服务
- 修改 BaseCustomer 类增加字段注释说明 - 优化 CustomerBuilder 中默认数据配置逻辑 - 引入 MappingUtils 工具类统一处理字段反射赋值 - 扩展 DocumentType 枚举支持更多文档类型和字段定义 - 新增 FieldType 和 SettingFieldType 枚举用于字段设置分类 - 添加 DynamicHttpPostClient 和 JsonPathUtils 支持远程调用与解析- 实现 ITaxTenantService 接口方法以支持按文档类型查询配置- 在 ReceiptBuilder、ReceivableBuilder 和 RefundBuilder 中应用新的映射逻辑 - 引入新模型类如 DynamicValue、Option、RemoteParam 等支持灵活配置 - 更新 pom.xml 添加 json-path 依赖- 删除已废弃的 TaxPipelineConfigController 控制器及相关仓储服务代码
Showing
37 changed files
with
1032 additions
and
450 deletions
tax-central/pom.xml
| @@ -31,6 +31,10 @@ | @@ -31,6 +31,10 @@ | ||
| 31 | <artifactId>spring-boot-starter-validation</artifactId> | 31 | <artifactId>spring-boot-starter-validation</artifactId> |
| 32 | </dependency> | 32 | </dependency> |
| 33 | <dependency> | 33 | <dependency> |
| 34 | + <groupId>com.jayway.jsonpath</groupId> | ||
| 35 | + <artifactId>json-path</artifactId> | ||
| 36 | + </dependency> | ||
| 37 | + <dependency> | ||
| 34 | <groupId>com.kingdee</groupId> | 38 | <groupId>com.kingdee</groupId> |
| 35 | <artifactId>k3cloud-webapi-sdk</artifactId> | 39 | <artifactId>k3cloud-webapi-sdk</artifactId> |
| 36 | <version>8.0.6</version> | 40 | <version>8.0.6</version> |
tax-central/src/main/java/com/diligrp/tax/central/context/TenantStorageContext.java
| @@ -2,9 +2,7 @@ package com.diligrp.tax.central.context; | @@ -2,9 +2,7 @@ package com.diligrp.tax.central.context; | ||
| 2 | 2 | ||
| 3 | import com.diligrp.tax.central.event.RestoreTenantEvent; | 3 | import com.diligrp.tax.central.event.RestoreTenantEvent; |
| 4 | import com.diligrp.tax.central.model.TenantPipeline; | 4 | import com.diligrp.tax.central.model.TenantPipeline; |
| 5 | -import com.diligrp.tax.central.model.TenantPipelineConfig; | ||
| 6 | import com.diligrp.tax.central.service.ITaxTenantService; | 5 | import com.diligrp.tax.central.service.ITaxTenantService; |
| 7 | -import com.diligrp.tax.central.type.DocumentType; | ||
| 8 | import com.diligrp.tax.central.type.SystemType; | 6 | import com.diligrp.tax.central.type.SystemType; |
| 9 | import jakarta.annotation.Resource; | 7 | import jakarta.annotation.Resource; |
| 10 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| @@ -50,30 +48,16 @@ public class TenantStorageContext implements CommandLineRunner { | @@ -50,30 +48,16 @@ public class TenantStorageContext implements CommandLineRunner { | ||
| 50 | public void loadTenantPipeline() { | 48 | public void loadTenantPipeline() { |
| 51 | List<TenantPipeline> taxPipelineVOS = tenantTaxService.listAllEnablePipeline(); | 49 | List<TenantPipeline> taxPipelineVOS = tenantTaxService.listAllEnablePipeline(); |
| 52 | Optional.ofNullable(taxPipelineVOS).ifPresent(pipelines -> { | 50 | Optional.ofNullable(taxPipelineVOS).ifPresent(pipelines -> { |
| 53 | - Map<Long, Map<SystemType, Map<String, TenantPipeline>>> tenantPipelineMap = pipelines.stream() | ||
| 54 | - .collect(Collectors.groupingBy( | ||
| 55 | - TenantPipeline::getTenantId, | ||
| 56 | - Collectors.groupingBy( | ||
| 57 | - TenantPipeline::getSystemType, | ||
| 58 | - Collectors.toMap( | ||
| 59 | - TenantPipeline::getCode, | ||
| 60 | - this::loadConfig, | ||
| 61 | - (existing, replacement) -> existing | ||
| 62 | - ) | ||
| 63 | - ) | ||
| 64 | - )); | 51 | + var tenantPipelineMap = pipelines.stream() |
| 52 | + .collect(Collectors.groupingBy(TenantPipeline::getTenantId, | ||
| 53 | + Collectors.groupingBy(TenantPipeline::getSystemType, | ||
| 54 | + Collectors.toMap(TenantPipeline::getCode, e -> e))) | ||
| 55 | + ); | ||
| 65 | TENANT_PIPELINE_MAP.clear(); | 56 | TENANT_PIPELINE_MAP.clear(); |
| 66 | TENANT_PIPELINE_MAP.putAll(tenantPipelineMap); | 57 | TENANT_PIPELINE_MAP.putAll(tenantPipelineMap); |
| 67 | }); | 58 | }); |
| 68 | } | 59 | } |
| 69 | 60 | ||
| 70 | - private TenantPipeline loadConfig(TenantPipeline tenantPipeline) { | ||
| 71 | - List<TenantPipelineConfig> list = tenantTaxService.listByPipelineId(tenantPipeline.getId()); | ||
| 72 | - Map<DocumentType, List<TenantPipelineConfig>> collect = list.stream().collect(Collectors.groupingBy(k -> DocumentType.from(k.getDocumentType()), Collectors.toList())); | ||
| 73 | - tenantPipeline.setTenantPipelineConfigs(collect); | ||
| 74 | - return tenantPipeline; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | @Override | 61 | @Override |
| 78 | public void run(String... args) throws Exception { | 62 | public void run(String... args) throws Exception { |
| 79 | publisher.publishEvent(new RestoreTenantEvent(this)); | 63 | publisher.publishEvent(new RestoreTenantEvent(this)); |
tax-central/src/main/java/com/diligrp/tax/central/domain/MessageContext.java
| @@ -15,7 +15,7 @@ public class MessageContext { | @@ -15,7 +15,7 @@ public class MessageContext { | ||
| 15 | private String pipelineDataId; | 15 | private String pipelineDataId; |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | - * 账套数据对接第三方系统id | 18 | + * 账套数据对接第三方系统单据id |
| 19 | */ | 19 | */ |
| 20 | private String systemDataId; | 20 | private String systemDataId; |
| 21 | /** | 21 | /** |
tax-central/src/main/java/com/diligrp/tax/central/domain/document/kingdee/BaseCustomer.java
| @@ -24,7 +24,7 @@ public abstract class BaseCustomer extends BaseDocument { | @@ -24,7 +24,7 @@ public abstract class BaseCustomer extends BaseDocument { | ||
| 24 | @Converter(value = StringConverter.class, targetField = "FCUSTID") | 24 | @Converter(value = StringConverter.class, targetField = "FCUSTID") |
| 25 | private String customerId; | 25 | private String customerId; |
| 26 | /** | 26 | /** |
| 27 | - * 客户编号 | 27 | + * 客户编号(FNumber) |
| 28 | */ | 28 | */ |
| 29 | @Converter(value = StringConverter.class, targetField = "FNumber") | 29 | @Converter(value = StringConverter.class, targetField = "FNumber") |
| 30 | private String customerCode; | 30 | private String customerCode; |
| @@ -84,7 +84,7 @@ public abstract class BaseCustomer extends BaseDocument { | @@ -84,7 +84,7 @@ public abstract class BaseCustomer extends BaseDocument { | ||
| 84 | @Converter(value = CustomerCreateOrgConverter.class, targetField = "FCreateOrgId") | 84 | @Converter(value = CustomerCreateOrgConverter.class, targetField = "FCreateOrgId") |
| 85 | private String customerCreateOrg; | 85 | private String customerCreateOrg; |
| 86 | /** | 86 | /** |
| 87 | - * 使用组织 | 87 | + * 使用组织(FUseOrgId) |
| 88 | */ | 88 | */ |
| 89 | @Converter(value = CustomerUseOrgConverter.class, targetField = "FUseOrgId") | 89 | @Converter(value = CustomerUseOrgConverter.class, targetField = "FUseOrgId") |
| 90 | private String customerUseOrg; | 90 | private String customerUseOrg; |
tax-central/src/main/java/com/diligrp/tax/central/model/DynamicValue.java
0 → 100644
| 1 | +package com.diligrp.tax.central.model; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | +import lombok.Setter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Author: zhangmeiyang | ||
| 8 | + * @CreateTime: 2025-11-10 18:16 | ||
| 9 | + * @Version: todo | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@Setter | ||
| 13 | +public class DynamicValue { | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 配置值 | ||
| 17 | + */ | ||
| 18 | + private String configValue; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 配置映射值 | ||
| 22 | + */ | ||
| 23 | + private String configMapValue; | ||
| 24 | +} |
tax-central/src/main/java/com/diligrp/tax/central/model/Option.java
0 → 100644
| 1 | +package com.diligrp.tax.central.model; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | +import lombok.NoArgsConstructor; | ||
| 6 | +import lombok.Setter; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author: zhangmeiyang | ||
| 10 | + * @CreateTime: 2025-11-10 18:01 | ||
| 11 | + * @Version: todo | ||
| 12 | + */ | ||
| 13 | +@Getter | ||
| 14 | +@Setter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +@NoArgsConstructor | ||
| 17 | +public class Option { | ||
| 18 | + private String label; | ||
| 19 | + private String value; | ||
| 20 | + | ||
| 21 | +} |
tax-central/src/main/java/com/diligrp/tax/central/model/RemoteParam.java
0 → 100644
| 1 | +package com.diligrp.tax.central.model; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | +import lombok.Setter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Author: zhangmeiyang | ||
| 8 | + * @CreateTime: 2025-11-10 18:17 | ||
| 9 | + * @Version: todo | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@Setter | ||
| 13 | +public class RemoteParam { | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 固定参数 | ||
| 17 | + */ | ||
| 18 | + private String fixedParams; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 标识字段(远程调用时替换参数) | ||
| 22 | + */ | ||
| 23 | + private String field; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 远程地址 | ||
| 27 | + */ | ||
| 28 | + private String remoteAddress; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 数据路径 | ||
| 32 | + */ | ||
| 33 | + private String dataPath; | ||
| 34 | +} |
tax-central/src/main/java/com/diligrp/tax/central/model/TenantPipeline.java
| 1 | package com.diligrp.tax.central.model; | 1 | package com.diligrp.tax.central.model; |
| 2 | 2 | ||
| 3 | -import com.diligrp.tax.central.type.DocumentType; | ||
| 4 | import com.diligrp.tax.central.type.SystemType; | 3 | import com.diligrp.tax.central.type.SystemType; |
| 5 | import lombok.Getter; | 4 | import lombok.Getter; |
| 6 | import lombok.Setter; | 5 | import lombok.Setter; |
| 7 | 6 | ||
| 8 | -import java.util.List; | ||
| 9 | import java.util.Map; | 7 | import java.util.Map; |
| 10 | 8 | ||
| 11 | /** | 9 | /** |
| @@ -22,5 +20,4 @@ public class TenantPipeline { | @@ -22,5 +20,4 @@ public class TenantPipeline { | ||
| 22 | private String name; | 20 | private String name; |
| 23 | private String code; | 21 | private String code; |
| 24 | private Map<String, Object> params; | 22 | private Map<String, Object> params; |
| 25 | - private Map<DocumentType, List<TenantPipelineConfig>> tenantPipelineConfigs; | ||
| 26 | } | 23 | } |
tax-central/src/main/java/com/diligrp/tax/central/model/TenantPipelineConfig.java
| 1 | package com.diligrp.tax.central.model; | 1 | package com.diligrp.tax.central.model; |
| 2 | 2 | ||
| 3 | +import com.diligrp.tax.central.type.SettingFieldType; | ||
| 3 | import lombok.Getter; | 4 | import lombok.Getter; |
| 4 | import lombok.Setter; | 5 | import lombok.Setter; |
| 5 | 6 | ||
| 6 | -import java.time.LocalDateTime; | 7 | +import java.util.Map; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | * @Author: zhangmeiyang | 10 | * @Author: zhangmeiyang |
| @@ -30,15 +31,22 @@ public class TenantPipelineConfig { | @@ -30,15 +31,22 @@ public class TenantPipelineConfig { | ||
| 30 | */ | 31 | */ |
| 31 | private String configKey; | 32 | private String configKey; |
| 32 | /** | 33 | /** |
| 33 | - * 配置值 | 34 | + * 设置字段类型 |
| 34 | */ | 35 | */ |
| 35 | - private String configValue; | 36 | + private SettingFieldType settingFieldType; |
| 37 | + | ||
| 36 | /** | 38 | /** |
| 37 | - * 创建时间 | 39 | + * 固定值 |
| 38 | */ | 40 | */ |
| 39 | - private LocalDateTime createdTime; | 41 | + private String fixedValue; |
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 动态值 | ||
| 45 | + */ | ||
| 46 | + private Map<String, String> dynamicValues; | ||
| 47 | + | ||
| 40 | /** | 48 | /** |
| 41 | - * 修改时间 | 49 | + * 远程参数 |
| 42 | */ | 50 | */ |
| 43 | - private LocalDateTime modifiedTime; | 51 | + private RemoteParam remoteParam; |
| 44 | } | 52 | } |
tax-central/src/main/java/com/diligrp/tax/central/service/ITaxTenantService.java
| @@ -31,8 +31,9 @@ public interface ITaxTenantService { | @@ -31,8 +31,9 @@ public interface ITaxTenantService { | ||
| 31 | /** | 31 | /** |
| 32 | * 按管道 ID 列出 | 32 | * 按管道 ID 列出 |
| 33 | * | 33 | * |
| 34 | - * @param pipelineId 管道 ID | 34 | + * @param pipelineId 管道 ID |
| 35 | + * @param documentType 文档类型 | ||
| 35 | * @return {@link List }<{@link TenantPipelineConfig }> | 36 | * @return {@link List }<{@link TenantPipelineConfig }> |
| 36 | */ | 37 | */ |
| 37 | - List<TenantPipelineConfig> listByPipelineId(Long pipelineId); | 38 | + List<TenantPipelineConfig> listByPipelineIdAndDocumentType(Long pipelineId, String documentType); |
| 38 | } | 39 | } |
tax-central/src/main/java/com/diligrp/tax/central/type/DocumentType.java
| 1 | package com.diligrp.tax.central.type; | 1 | package com.diligrp.tax.central.type; |
| 2 | 2 | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | +import java.util.Set; | ||
| 6 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 7 | +import java.util.stream.Collectors; | ||
| 8 | +import java.util.stream.Stream; | ||
| 9 | + | ||
| 3 | public enum DocumentType { | 10 | public enum DocumentType { |
| 4 | - CUSTOMER_INFO("BD_Customer"), | ||
| 5 | - AR_RECEIVABLE("AR_receivable"), | ||
| 6 | - AR_RECEIVE_BILL("AR_RECEIVEBILL"), | ||
| 7 | - AR_REFUND_BILL("AR_REFUNDBILL"); | 11 | + CUSTOMER_INFO("BD_Customer", "客户信息", Set.of( |
| 12 | + FieldType.CUSTOMER_CONTACT_COMPANY_TYPE, | ||
| 13 | + FieldType.CUSTOMER_CREATE_ORG, | ||
| 14 | + FieldType.CUSTOMER_USE_ORG, | ||
| 15 | + FieldType.CUSTOMER_GROUP | ||
| 16 | + )), | ||
| 17 | + AR_RECEIVABLE("AR_receivable", "应收单", Set.of( | ||
| 18 | + FieldType.BUSINESS_TYPE, | ||
| 19 | + FieldType.SETTLE_ORG, | ||
| 20 | + FieldType.SALE_ORG, | ||
| 21 | + FieldType.SALE_DEPT, | ||
| 22 | + FieldType.PAY_ORG, | ||
| 23 | + FieldType.CURRENCY, | ||
| 24 | + FieldType.RECEIVABLE_SETTLE_METHOD, | ||
| 25 | + FieldType.RECEIVABLE_CUSTOMER, | ||
| 26 | + FieldType.RECEIVABLE_RECEIVER, | ||
| 27 | + FieldType.RECEIVABLE_ORDERER, | ||
| 28 | + FieldType.RECEIVABLE_PAYER, | ||
| 29 | + FieldType.RECEIVABLE_STANDARD_CURRENCY, | ||
| 30 | + FieldType.RECEIVABLE_CHARGE_ITEM, | ||
| 31 | + FieldType.RECEIVABLE_CARD_NUMBER, | ||
| 32 | + FieldType.RECEIVABLE_CHARGE_ITEM_DEPT | ||
| 33 | + )), | ||
| 34 | + AR_RECEIVE_BILL("AR_RECEIVEBILL", "收款单", Set.of( | ||
| 35 | + FieldType.BUSINESS_TYPE, | ||
| 36 | + FieldType.SETTLE_ORG, | ||
| 37 | + FieldType.SALE_ORG, | ||
| 38 | + FieldType.SALE_DEPT, | ||
| 39 | + FieldType.PAY_ORG, | ||
| 40 | + FieldType.CURRENCY, | ||
| 41 | + FieldType.RECEIPT_CURRENCY, | ||
| 42 | + FieldType.RECEIPT_SETTLE_CURRENCY, | ||
| 43 | + FieldType.RECEIPT_CONTACT_TYPE, | ||
| 44 | + FieldType.RECEIPT_CONTACT, | ||
| 45 | + FieldType.RECEIPT_PAY_CONTACT_TYPE, | ||
| 46 | + FieldType.RECEIPT_PAY_CONTACT, | ||
| 47 | + FieldType.RECEIPT_CHARGE_ITEM, | ||
| 48 | + FieldType.RECEIPT_SETTLE_METHOD, | ||
| 49 | + FieldType.RECEIPT_CHARGE_ITEM_DEPT | ||
| 50 | + )), | ||
| 51 | + AR_REFUND_BILL("AR_REFUNDBILL", "收款退款单", Set.of( | ||
| 52 | + FieldType.BUSINESS_TYPE, | ||
| 53 | + FieldType.SETTLE_ORG, | ||
| 54 | + FieldType.SALE_ORG, | ||
| 55 | + FieldType.SALE_DEPT, | ||
| 56 | + FieldType.PAY_ORG, | ||
| 57 | + FieldType.CURRENCY, | ||
| 58 | + FieldType.REFUND_CURRENCY, | ||
| 59 | + FieldType.REFUND_SETTLE_CURRENCY, | ||
| 60 | + FieldType.REFUND_RECEIVE_CONTACT_TYPE, | ||
| 61 | + FieldType.REFUND_RECEIVE_CONTACT, | ||
| 62 | + FieldType.REFUND_CONTACT_TYPE, | ||
| 63 | + FieldType.REFUND_CONTACT, | ||
| 64 | + FieldType.REFUND_CHARGE_ITEM, | ||
| 65 | + FieldType.REFUND_SETTLE_METHOD, | ||
| 66 | + FieldType.REFUND_CHARGE_ITEM_DEPT | ||
| 67 | + )); | ||
| 8 | 68 | ||
| 9 | public final String value; | 69 | public final String value; |
| 70 | + public final String desc; | ||
| 71 | + public final Set<FieldType> fieldType; | ||
| 10 | 72 | ||
| 11 | - DocumentType(String value) { | 73 | + DocumentType(String value, String desc, Set<FieldType> fieldType) { |
| 12 | this.value = value; | 74 | this.value = value; |
| 75 | + this.desc = desc; | ||
| 76 | + this.fieldType = fieldType; | ||
| 13 | } | 77 | } |
| 14 | 78 | ||
| 15 | public static DocumentType from(String value) { | 79 | public static DocumentType from(String value) { |
| @@ -29,4 +93,14 @@ public enum DocumentType { | @@ -29,4 +93,14 @@ public enum DocumentType { | ||
| 29 | } | 93 | } |
| 30 | throw new IllegalArgumentException("Invalid DocumentType value: " + value); | 94 | throw new IllegalArgumentException("Invalid DocumentType value: " + value); |
| 31 | } | 95 | } |
| 96 | + | ||
| 97 | + public static List<Map<String, String>> getDocumentTypeList() { | ||
| 98 | + DocumentType[] values = DocumentType.values(); | ||
| 99 | + return Stream.of(values).map(type -> { | ||
| 100 | + Map<String, String> map = new ConcurrentHashMap<>(); | ||
| 101 | + map.put("value", type.value); | ||
| 102 | + map.put("desc", type.desc); | ||
| 103 | + return map; | ||
| 104 | + }).collect(Collectors.toList()); | ||
| 105 | + } | ||
| 32 | } | 106 | } |
tax-central/src/main/java/com/diligrp/tax/central/type/FieldType.java
0 → 100644
| 1 | +package com.diligrp.tax.central.type; | ||
| 2 | + | ||
| 3 | +public enum FieldType { | ||
| 4 | + //customer | ||
| 5 | + CUSTOMER_CONTACT_COMPANY_TYPE("contactCompanyType", "联系人类型"), | ||
| 6 | + CUSTOMER_CREATE_ORG("customerCreateOrg", "创建组织"), | ||
| 7 | + CUSTOMER_USE_ORG("customerUseOrg", "使用组织"), | ||
| 8 | + CUSTOMER_GROUP("customerGroup", "分组"), | ||
| 9 | + //public | ||
| 10 | + BUSINESS_TYPE("businessType", "业务类型"), | ||
| 11 | + SETTLE_ORG("settleOrg", "结算组织"), | ||
| 12 | + SALE_ORG("saleOrg", "销售组织"), | ||
| 13 | + SALE_DEPT("saleDept", "销售部门"), | ||
| 14 | + PAY_ORG("payOrg", "支付组织"), | ||
| 15 | + CURRENCY("currency", "币别"), | ||
| 16 | + //receivable | ||
| 17 | + RECEIVABLE_SETTLE_METHOD("settleMethod", "结算方式"), | ||
| 18 | + RECEIVABLE_CUSTOMER("customer", "客户"), | ||
| 19 | + RECEIVABLE_RECEIVER("receiver", "收货方"), | ||
| 20 | + RECEIVABLE_ORDERER("orderer", "订货方"), | ||
| 21 | + RECEIVABLE_PAYER("payer", "付款方"), | ||
| 22 | + RECEIVABLE_STANDARD_CURRENCY("standardCurrency", "本位币"), | ||
| 23 | + RECEIVABLE_CHARGE_ITEM("chargeItem", "费用编码"), | ||
| 24 | + RECEIVABLE_CARD_NUMBER("cardNumber", "卡片编码"), | ||
| 25 | + RECEIVABLE_CHARGE_ITEM_DEPT("chargeItemDept", "费用部门"), | ||
| 26 | + //receipt | ||
| 27 | + RECEIPT_CURRENCY("currency","币别"), | ||
| 28 | + RECEIPT_SETTLE_CURRENCY("settleCurrency","结算币别"), | ||
| 29 | + RECEIPT_CONTACT_TYPE("contactType","往来单位类型"), | ||
| 30 | + RECEIPT_CONTACT("contact","往来单位"), | ||
| 31 | + RECEIPT_PAY_CONTACT_TYPE("payContactType","付款单位类型"), | ||
| 32 | + RECEIPT_PAY_CONTACT("payContact","付款单位"), | ||
| 33 | + RECEIPT_CHARGE_ITEM("chargeItem","费用编码"), | ||
| 34 | + RECEIPT_SETTLE_METHOD("settleMethod","结算方式"), | ||
| 35 | + RECEIPT_CHARGE_ITEM_DEPT("chargeItemDept","费用部门"), | ||
| 36 | + //refund | ||
| 37 | + REFUND_CURRENCY("currency","币别"), | ||
| 38 | + REFUND_SETTLE_CURRENCY("settleCurrency","结算币别"), | ||
| 39 | + REFUND_RECEIVE_CONTACT_TYPE("receiveContactType","收款单位类型"), | ||
| 40 | + REFUND_RECEIVE_CONTACT("receiveContact","收款单位"), | ||
| 41 | + REFUND_CONTACT_TYPE("contactType","往来单位类型"), | ||
| 42 | + REFUND_CONTACT("contact","往来单位"), | ||
| 43 | + REFUND_CHARGE_ITEM("chargeItem","费用编码"), | ||
| 44 | + REFUND_SETTLE_METHOD("settleMethod","结算方式"), | ||
| 45 | + REFUND_CHARGE_ITEM_DEPT("chargeItemDept","费用部门"), | ||
| 46 | + ; | ||
| 47 | + public final String value; | ||
| 48 | + public final String desc; | ||
| 49 | + | ||
| 50 | + FieldType(String value, String desc) { | ||
| 51 | + this.value = value; | ||
| 52 | + this.desc = desc; | ||
| 53 | + } | ||
| 54 | +} |
tax-central/src/main/java/com/diligrp/tax/central/type/SettingFieldType.java
0 → 100644
| 1 | +package com.diligrp.tax.central.type; | ||
| 2 | + | ||
| 3 | +public enum SettingFieldType { | ||
| 4 | + FIXED(0, "固定"), | ||
| 5 | + DYNAMIC(1, "动态"), | ||
| 6 | + REMOTE(2, "远程"), | ||
| 7 | + ; | ||
| 8 | + | ||
| 9 | + public final int value; | ||
| 10 | + public final String desc; | ||
| 11 | + | ||
| 12 | + SettingFieldType(int value, String desc) { | ||
| 13 | + this.value = value; | ||
| 14 | + this.desc = desc; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public static SettingFieldType from(int value) { | ||
| 18 | + for (SettingFieldType type : values()) { | ||
| 19 | + if (type.value == value) { | ||
| 20 | + return type; | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + throw new IllegalArgumentException("SettingFieldType not found"); | ||
| 24 | + } | ||
| 25 | +} |
tax-central/src/main/java/com/diligrp/tax/central/utils/DynamicHttpPostClient.java
0 → 100644
| 1 | +package com.diligrp.tax.central.utils; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 6 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 7 | + | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 动态 HTTP Postor | ||
| 12 | + * | ||
| 13 | + * @author zhangmeiyang | ||
| 14 | + * @date 2025/10/17 | ||
| 15 | + */ | ||
| 16 | +public class DynamicHttpPostClient extends ServiceEndpointSupport{ | ||
| 17 | + | ||
| 18 | + public String postBody(String url, Map<String,Object> params){ | ||
| 19 | + HttpResult res = send(url, JsonUtils.toJsonString(params)); | ||
| 20 | + if (res.statusCode != 200) { | ||
| 21 | + String format = String.format("远程调用失败, URL:[%s],参数:[%s],code:[%s],消息:[%s]", url, params, res.statusCode, res.responseText); | ||
| 22 | + throw new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL,format); | ||
| 23 | + } | ||
| 24 | + return res.responseText; | ||
| 25 | + } | ||
| 26 | +} |
tax-central/src/main/java/com/diligrp/tax/central/utils/JsonPathUtils.java
0 → 100644
| 1 | +package com.diligrp.tax.central.utils; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 4 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 5 | +import com.jayway.jsonpath.JsonPath; | ||
| 6 | + | ||
| 7 | +import java.util.Optional; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author: zhangmeiyang | ||
| 11 | + * @CreateTime: 2025-11-11 11:21 | ||
| 12 | + * @Version: todo | ||
| 13 | + */ | ||
| 14 | +public class JsonPathUtils { | ||
| 15 | + | ||
| 16 | + public static String parse(String httpResult, String dataPath) { | ||
| 17 | + Optional.ofNullable(httpResult).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL)); | ||
| 18 | + Optional.ofNullable(dataPath).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.PARAMETER_IS_NOT_PARSED_CORRECTLY)); | ||
| 19 | + return JsonPath.read(httpResult, dataPath).toString(); | ||
| 20 | + } | ||
| 21 | +} |
tax-central/src/main/java/com/diligrp/tax/central/utils/MappingUtils.java
| @@ -7,16 +7,15 @@ import com.diligrp.tax.central.converter.anno.Converter; | @@ -7,16 +7,15 @@ import com.diligrp.tax.central.converter.anno.Converter; | ||
| 7 | import com.diligrp.tax.central.converter.anno.SubConverter; | 7 | import com.diligrp.tax.central.converter.anno.SubConverter; |
| 8 | import com.diligrp.tax.central.domain.BaseDocument; | 8 | import com.diligrp.tax.central.domain.BaseDocument; |
| 9 | import com.diligrp.tax.central.domain.BaseMapping; | 9 | import com.diligrp.tax.central.domain.BaseMapping; |
| 10 | -import com.diligrp.tax.central.domain.document.kingdee.BaseBill; | ||
| 11 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 10 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 11 | +import com.diligrp.tax.central.model.RemoteParam; | ||
| 12 | +import com.diligrp.tax.central.model.TenantPipelineConfig; | ||
| 12 | import com.diligrp.tax.central.type.TaxSystemType; | 13 | import com.diligrp.tax.central.type.TaxSystemType; |
| 14 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
| 13 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 14 | 16 | ||
| 15 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 16 | -import java.util.Arrays; | ||
| 17 | -import java.util.HashMap; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | 18 | +import java.util.*; |
| 20 | import java.util.function.Function; | 19 | import java.util.function.Function; |
| 21 | import java.util.stream.Stream; | 20 | import java.util.stream.Stream; |
| 22 | 21 | ||
| @@ -45,7 +44,7 @@ public class MappingUtils { | @@ -45,7 +44,7 @@ public class MappingUtils { | ||
| 45 | map.put(converter.targetField(), newVal); | 44 | map.put(converter.targetField(), newVal); |
| 46 | } catch (Exception e) { | 45 | } catch (Exception e) { |
| 47 | log.error("MappingUtils.configureField转换失败", e.fillInStackTrace()); | 46 | log.error("MappingUtils.configureField转换失败", e.fillInStackTrace()); |
| 48 | - throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS,e); | 47 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, e); |
| 49 | } | 48 | } |
| 50 | } | 49 | } |
| 51 | 50 | ||
| @@ -59,7 +58,7 @@ public class MappingUtils { | @@ -59,7 +58,7 @@ public class MappingUtils { | ||
| 59 | map.put(converter.targetField(), newVal); | 58 | map.put(converter.targetField(), newVal); |
| 60 | } catch (Exception e) { | 59 | } catch (Exception e) { |
| 61 | log.error("MappingUtils.configureSubField转换失败", e.fillInStackTrace()); | 60 | log.error("MappingUtils.configureSubField转换失败", e.fillInStackTrace()); |
| 62 | - throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS,e); | 61 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, e); |
| 63 | } | 62 | } |
| 64 | } | 63 | } |
| 65 | 64 | ||
| @@ -73,4 +72,52 @@ public class MappingUtils { | @@ -73,4 +72,52 @@ public class MappingUtils { | ||
| 73 | Arrays.stream(allFields).filter(field -> field.isAnnotationPresent(SubConverter.class)).forEach(field -> configureSubField(t, field, map)); | 72 | Arrays.stream(allFields).filter(field -> field.isAnnotationPresent(SubConverter.class)).forEach(field -> configureSubField(t, field, map)); |
| 74 | return JsonUtils.convertValue(map, clazz); | 73 | return JsonUtils.convertValue(map, clazz); |
| 75 | } | 74 | } |
| 75 | + | ||
| 76 | + | ||
| 77 | + public static List<Field> listFields(Class<?> clazz) { | ||
| 78 | + List<Field> fields = new ArrayList<>(); | ||
| 79 | + while (Objects.nonNull(clazz)) { | ||
| 80 | + fields.addAll(Arrays.asList(clazz.getDeclaredFields())); | ||
| 81 | + clazz = clazz.getSuperclass(); | ||
| 82 | + } | ||
| 83 | + return fields; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public static void reflectField(Object object, Field field, Map<String, TenantPipelineConfig> kvMap) { | ||
| 87 | + if (kvMap.containsKey(field.getName())) { | ||
| 88 | + field.setAccessible(true); | ||
| 89 | + try { | ||
| 90 | + TenantPipelineConfig cfg = kvMap.get(field.getName()); | ||
| 91 | + switch (cfg.getSettingFieldType()) { | ||
| 92 | + case FIXED -> { | ||
| 93 | + var fixedValue = cfg.getFixedValue(); | ||
| 94 | + field.set(object, fixedValue); | ||
| 95 | + } | ||
| 96 | + case DYNAMIC -> { | ||
| 97 | + Map<String, String> dynamicValues = cfg.getDynamicValues(); | ||
| 98 | + String value = (String) field.get(object); | ||
| 99 | + if (dynamicValues.containsKey(value)) { | ||
| 100 | + field.set(object, dynamicValues.get(value)); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + case REMOTE -> { | ||
| 104 | + RemoteParam remoteParam = cfg.getRemoteParam(); | ||
| 105 | + String value = (String) field.get(object); | ||
| 106 | + String fixedParams = remoteParam.getFixedParams(); | ||
| 107 | + String remoteAddress = remoteParam.getRemoteAddress(); | ||
| 108 | + var params = JsonUtils.fromJsonString(fixedParams, new TypeReference<Map<String, Object>>() { | ||
| 109 | + }); | ||
| 110 | + params.put(remoteParam.getField(), value); | ||
| 111 | + var result = SingletonHttpClient.instance().postBody(remoteAddress, params); | ||
| 112 | + String remoteValue = JsonPathUtils.parse(result, remoteParam.getDataPath()); | ||
| 113 | + field.set(object, remoteValue); | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } catch (IllegalAccessException e) { | ||
| 117 | + throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + | ||
| 76 | } | 123 | } |
tax-central/src/main/java/com/diligrp/tax/central/utils/SingletonHttpClient.java
0 → 100644
| 1 | +package com.diligrp.tax.central.utils; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 单例 HTTP 客户端 | ||
| 5 | + * | ||
| 6 | + * @author zhangmeiyang | ||
| 7 | + * @date 2025/10/17 | ||
| 8 | + */ | ||
| 9 | +public class SingletonHttpClient { | ||
| 10 | + | ||
| 11 | + private static final DynamicHttpPostClient INSTANCE = new DynamicHttpPostClient(); | ||
| 12 | + | ||
| 13 | + private SingletonHttpClient() {} | ||
| 14 | + | ||
| 15 | + public static DynamicHttpPostClient instance() { | ||
| 16 | + return INSTANCE; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | +} |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/CustomerBuilder.java
| @@ -7,21 +7,21 @@ import com.diligrp.tax.central.model.TenantPipeline; | @@ -7,21 +7,21 @@ import com.diligrp.tax.central.model.TenantPipeline; | ||
| 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; | 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; |
| 8 | import com.diligrp.tax.central.model.TenantTaxPipelineMapping; | 8 | import com.diligrp.tax.central.model.TenantTaxPipelineMapping; |
| 9 | import com.diligrp.tax.central.service.ITaxPipelineMappingService; | 9 | import com.diligrp.tax.central.service.ITaxPipelineMappingService; |
| 10 | +import com.diligrp.tax.central.service.ITaxTenantService; | ||
| 10 | import com.diligrp.tax.central.type.DocumentType; | 11 | import com.diligrp.tax.central.type.DocumentType; |
| 11 | import com.diligrp.tax.central.type.TaxSystemType; | 12 | import com.diligrp.tax.central.type.TaxSystemType; |
| 12 | import com.diligrp.tax.central.utils.JsonUtils; | 13 | import com.diligrp.tax.central.utils.JsonUtils; |
| 14 | +import com.diligrp.tax.central.utils.MappingUtils; | ||
| 13 | import com.diligrp.tax.doc.demarcate.Builder; | 15 | import com.diligrp.tax.doc.demarcate.Builder; |
| 14 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 15 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 16 | import org.springframework.stereotype.Component; | 18 | import org.springframework.stereotype.Component; |
| 17 | 19 | ||
| 18 | import java.lang.reflect.Field; | 20 | import java.lang.reflect.Field; |
| 19 | -import java.util.Arrays; | ||
| 20 | import java.util.List; | 21 | import java.util.List; |
| 21 | import java.util.Map; | 22 | import java.util.Map; |
| 22 | import java.util.Optional; | 23 | import java.util.Optional; |
| 23 | import java.util.stream.Collectors; | 24 | import java.util.stream.Collectors; |
| 24 | -import java.util.stream.Stream; | ||
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * @Author: zhangmeiyang | 27 | * @Author: zhangmeiyang |
| @@ -35,6 +35,9 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | @@ -35,6 +35,9 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | ||
| 35 | @Resource | 35 | @Resource |
| 36 | private ITaxPipelineMappingService taxPipelineMappingService; | 36 | private ITaxPipelineMappingService taxPipelineMappingService; |
| 37 | 37 | ||
| 38 | + @Resource | ||
| 39 | + private ITaxTenantService taxTenantService; | ||
| 40 | + | ||
| 38 | 41 | ||
| 39 | @Override | 42 | @Override |
| 40 | public DocumentType markDocument() { | 43 | public DocumentType markDocument() { |
| @@ -46,7 +49,7 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | @@ -46,7 +49,7 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | ||
| 46 | StandardCustomer customer = JsonUtils.fromJsonString(body, StandardCustomer.class); | 49 | StandardCustomer customer = JsonUtils.fromJsonString(body, StandardCustomer.class); |
| 47 | Optional.ofNullable(customer.getContacts()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请完善联系人信息")); | 50 | Optional.ofNullable(customer.getContacts()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请完善联系人信息")); |
| 48 | Optional.ofNullable(systemDataId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写系统数据ID")); | 51 | Optional.ofNullable(systemDataId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写系统数据ID")); |
| 49 | - List<TenantPipelineConfig> list = pipeline.getTenantPipelineConfigs().get(markDocument()); | 52 | + List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); |
| 50 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(customer, ts)); | 53 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(customer, ts)); |
| 51 | //查询数据库的客户信息 如果存在 赋值id | 54 | //查询数据库的客户信息 如果存在 赋值id |
| 52 | 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); |
| @@ -58,39 +61,10 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | @@ -58,39 +61,10 @@ public class CustomerBuilder extends Builder<StandardCustomer> { | ||
| 58 | } | 61 | } |
| 59 | 62 | ||
| 60 | private void configureDefaultData(StandardCustomer customer, List<TenantPipelineConfig> list) { | 63 | private void configureDefaultData(StandardCustomer customer, List<TenantPipelineConfig> list) { |
| 61 | - Map<String, String> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, TenantPipelineConfig::getConfigValue)); | ||
| 62 | - Field[] allFields = Stream.concat( | ||
| 63 | - Arrays.stream(customer.getClass().getDeclaredFields()), | ||
| 64 | - Arrays.stream(customer.getClass().getSuperclass().getDeclaredFields()) | ||
| 65 | - ).toArray(Field[]::new); | ||
| 66 | - Arrays.stream(allFields).forEach(field -> reflectField(customer, field, kvMap)); | ||
| 67 | - List<Contact> refundItems = customer.getContacts(); | ||
| 68 | - refundItems.forEach(item -> { | ||
| 69 | - Field[] declaredFields1 = item.getClass().getDeclaredFields(); | ||
| 70 | - Arrays.stream(declaredFields1).forEach(field -> reflectField(item, field, kvMap)); | ||
| 71 | - }); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - public static void reflectField(StandardCustomer object, Field field, Map<String, String> kvMap) { | ||
| 75 | - if (kvMap.containsKey(field.getName())) { | ||
| 76 | - field.setAccessible(true); | ||
| 77 | - try { | ||
| 78 | - field.set(object, kvMap.get(field.getName())); | ||
| 79 | - } catch (IllegalAccessException e) { | ||
| 80 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - public static void reflectField(Contact object, Field field, Map<String, String> kvMap) { | ||
| 87 | - if (kvMap.containsKey(field.getName())) { | ||
| 88 | - field.setAccessible(true); | ||
| 89 | - try { | ||
| 90 | - field.set(object, kvMap.get(field.getName())); | ||
| 91 | - } catch (IllegalAccessException e) { | ||
| 92 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 93 | - } | ||
| 94 | - } | 64 | + Map<String, TenantPipelineConfig> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, o -> o)); |
| 65 | + List<Field> fields = MappingUtils.listFields(customer.getClass()); | ||
| 66 | + fields.forEach(field -> MappingUtils.reflectField(customer, field, kvMap)); | ||
| 67 | + List<Contact> items = customer.getContacts(); | ||
| 68 | + items.forEach(item -> MappingUtils.listFields(item.getClass()).forEach(field -> MappingUtils.reflectField(item, field, kvMap))); | ||
| 95 | } | 69 | } |
| 96 | } | 70 | } |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/ReceiptBuilder.java
| @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.ReceiptItem; | @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.ReceiptItem; | ||
| 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 6 | import com.diligrp.tax.central.model.TenantPipeline; | 6 | import com.diligrp.tax.central.model.TenantPipeline; |
| 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; | 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; |
| 8 | +import com.diligrp.tax.central.service.ITaxTenantService; | ||
| 8 | import com.diligrp.tax.central.type.DocumentType; | 9 | import com.diligrp.tax.central.type.DocumentType; |
| 9 | import com.diligrp.tax.central.type.TaxSystemType; | 10 | import com.diligrp.tax.central.type.TaxSystemType; |
| 10 | import com.diligrp.tax.central.utils.JsonUtils; | 11 | import com.diligrp.tax.central.utils.JsonUtils; |
| 12 | +import com.diligrp.tax.central.utils.MappingUtils; | ||
| 11 | import com.diligrp.tax.doc.demarcate.Builder; | 13 | import com.diligrp.tax.doc.demarcate.Builder; |
| 14 | +import jakarta.annotation.Resource; | ||
| 12 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 13 | 16 | ||
| 14 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 15 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 16 | import java.time.format.DateTimeFormatter; | 19 | import java.time.format.DateTimeFormatter; |
| 17 | -import java.util.Arrays; | ||
| 18 | import java.util.List; | 20 | import java.util.List; |
| 19 | import java.util.Map; | 21 | import java.util.Map; |
| 20 | import java.util.Optional; | 22 | import java.util.Optional; |
| @@ -27,6 +29,9 @@ import java.util.stream.Collectors; | @@ -27,6 +29,9 @@ import java.util.stream.Collectors; | ||
| 27 | */ | 29 | */ |
| 28 | @Component | 30 | @Component |
| 29 | public class ReceiptBuilder extends Builder<ReceiptBill> { | 31 | public class ReceiptBuilder extends Builder<ReceiptBill> { |
| 32 | + @Resource | ||
| 33 | + private ITaxTenantService taxTenantService; | ||
| 34 | + | ||
| 30 | @Override | 35 | @Override |
| 31 | public DocumentType markDocument() { | 36 | public DocumentType markDocument() { |
| 32 | return DocumentType.AR_RECEIVE_BILL; | 37 | return DocumentType.AR_RECEIVE_BILL; |
| @@ -37,42 +42,16 @@ public class ReceiptBuilder extends Builder<ReceiptBill> { | @@ -37,42 +42,16 @@ public class ReceiptBuilder extends Builder<ReceiptBill> { | ||
| 37 | ReceiptBill bill = JsonUtils.fromJsonString(body, ReceiptBill.class); | 42 | ReceiptBill bill = JsonUtils.fromJsonString(body, ReceiptBill.class); |
| 38 | Optional.ofNullable(bill.getReceiptItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); | 43 | Optional.ofNullable(bill.getReceiptItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 39 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); | 44 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 40 | - List<TenantPipelineConfig> list = pipeline.getTenantPipelineConfigs().get(markDocument()); | 45 | + List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); |
| 41 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); | 46 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); |
| 42 | return bill; | 47 | return bill; |
| 43 | } | 48 | } |
| 44 | 49 | ||
| 45 | private void configureDefaultData(ReceiptBill bill, List<TenantPipelineConfig> list) { | 50 | private void configureDefaultData(ReceiptBill bill, List<TenantPipelineConfig> list) { |
| 46 | - Map<String, String> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, TenantPipelineConfig::getConfigValue)); | ||
| 47 | - Field[] declaredFields = bill.getClass().getDeclaredFields(); | ||
| 48 | - Arrays.stream(declaredFields).forEach(field -> reflectField(bill, field, kvMap)); | ||
| 49 | - List<ReceiptItem> refundItems = bill.getReceiptItems(); | ||
| 50 | - refundItems.forEach(item -> { | ||
| 51 | - Field[] declaredFields1 = item.getClass().getDeclaredFields(); | ||
| 52 | - Arrays.stream(declaredFields1).forEach(field -> reflectField(item, field, kvMap)); | ||
| 53 | - }); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - public static void reflectField(ReceiptBill object, Field field, Map<String, String> kvMap) { | ||
| 57 | - if (kvMap.containsKey(field.getName())) { | ||
| 58 | - field.setAccessible(true); | ||
| 59 | - try { | ||
| 60 | - field.set(object, kvMap.get(field.getName())); | ||
| 61 | - } catch (IllegalAccessException e) { | ||
| 62 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - | ||
| 68 | - public static void reflectField(ReceiptItem object, Field field, Map<String, String> kvMap) { | ||
| 69 | - if (kvMap.containsKey(field.getName())) { | ||
| 70 | - field.setAccessible(true); | ||
| 71 | - try { | ||
| 72 | - field.set(object, kvMap.get(field.getName())); | ||
| 73 | - } catch (IllegalAccessException e) { | ||
| 74 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 75 | - } | ||
| 76 | - } | 51 | + Map<String, TenantPipelineConfig> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, o -> o)); |
| 52 | + List<Field> fields = MappingUtils.listFields(bill.getClass()); | ||
| 53 | + fields.forEach(field -> MappingUtils.reflectField(bill, field, kvMap)); | ||
| 54 | + List<ReceiptItem> items = bill.getReceiptItems(); | ||
| 55 | + items.forEach(item -> MappingUtils.listFields(item.getClass()).forEach(field -> MappingUtils.reflectField(item, field, kvMap))); | ||
| 77 | } | 56 | } |
| 78 | } | 57 | } |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/ReceivableBuilder.java
| @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.ReceivableItem; | @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.ReceivableItem; | ||
| 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 6 | import com.diligrp.tax.central.model.TenantPipeline; | 6 | import com.diligrp.tax.central.model.TenantPipeline; |
| 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; | 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; |
| 8 | +import com.diligrp.tax.central.service.ITaxTenantService; | ||
| 8 | import com.diligrp.tax.central.type.DocumentType; | 9 | import com.diligrp.tax.central.type.DocumentType; |
| 9 | import com.diligrp.tax.central.type.TaxSystemType; | 10 | import com.diligrp.tax.central.type.TaxSystemType; |
| 10 | import com.diligrp.tax.central.utils.JsonUtils; | 11 | import com.diligrp.tax.central.utils.JsonUtils; |
| 12 | +import com.diligrp.tax.central.utils.MappingUtils; | ||
| 11 | import com.diligrp.tax.doc.demarcate.Builder; | 13 | import com.diligrp.tax.doc.demarcate.Builder; |
| 14 | +import jakarta.annotation.Resource; | ||
| 12 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 13 | 16 | ||
| 14 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 15 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 16 | import java.time.format.DateTimeFormatter; | 19 | import java.time.format.DateTimeFormatter; |
| 17 | -import java.util.Arrays; | ||
| 18 | import java.util.List; | 20 | import java.util.List; |
| 19 | import java.util.Map; | 21 | import java.util.Map; |
| 20 | import java.util.Optional; | 22 | import java.util.Optional; |
| @@ -28,6 +30,9 @@ import java.util.stream.Collectors; | @@ -28,6 +30,9 @@ import java.util.stream.Collectors; | ||
| 28 | @Component | 30 | @Component |
| 29 | public class ReceivableBuilder extends Builder<ReceivableBill> { | 31 | public class ReceivableBuilder extends Builder<ReceivableBill> { |
| 30 | 32 | ||
| 33 | + @Resource | ||
| 34 | + private ITaxTenantService taxTenantService; | ||
| 35 | + | ||
| 31 | @Override | 36 | @Override |
| 32 | public DocumentType markDocument() { | 37 | public DocumentType markDocument() { |
| 33 | return DocumentType.AR_RECEIVABLE; | 38 | return DocumentType.AR_RECEIVABLE; |
| @@ -38,43 +43,16 @@ public class ReceivableBuilder extends Builder<ReceivableBill> { | @@ -38,43 +43,16 @@ public class ReceivableBuilder extends Builder<ReceivableBill> { | ||
| 38 | ReceivableBill bill = JsonUtils.fromJsonString(body, ReceivableBill.class); | 43 | ReceivableBill bill = JsonUtils.fromJsonString(body, ReceivableBill.class); |
| 39 | Optional.ofNullable(bill.getReceivableItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); | 44 | Optional.ofNullable(bill.getReceivableItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 40 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); | 45 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 41 | - List<TenantPipelineConfig> list = pipeline.getTenantPipelineConfigs().get(markDocument()); | 46 | + List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); |
| 42 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); | 47 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); |
| 43 | - //todo动态规则转换 | ||
| 44 | return bill; | 48 | return bill; |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | private void configureDefaultData(ReceivableBill bill, List<TenantPipelineConfig> list) { | 51 | private void configureDefaultData(ReceivableBill bill, List<TenantPipelineConfig> list) { |
| 48 | - Map<String, String> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, TenantPipelineConfig::getConfigValue)); | ||
| 49 | - Field[] declaredFields = bill.getClass().getDeclaredFields(); | ||
| 50 | - Arrays.stream(declaredFields).forEach(field -> reflectField(bill, field, kvMap)); | ||
| 51 | - List<ReceivableItem> refundItems = bill.getReceivableItems(); | ||
| 52 | - refundItems.forEach(item -> { | ||
| 53 | - Field[] declaredFields1 = item.getClass().getDeclaredFields(); | ||
| 54 | - Arrays.stream(declaredFields1).forEach(field -> reflectField(item, field, kvMap)); | ||
| 55 | - }); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - public static void reflectField(ReceivableBill object, Field field, Map<String, String> kvMap) { | ||
| 59 | - if (kvMap.containsKey(field.getName())) { | ||
| 60 | - field.setAccessible(true); | ||
| 61 | - try { | ||
| 62 | - field.set(object, kvMap.get(field.getName())); | ||
| 63 | - } catch (IllegalAccessException e) { | ||
| 64 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - public static void reflectField(ReceivableItem object, Field field, Map<String, String> kvMap) { | ||
| 71 | - if (kvMap.containsKey(field.getName())) { | ||
| 72 | - field.setAccessible(true); | ||
| 73 | - try { | ||
| 74 | - field.set(object, kvMap.get(field.getName())); | ||
| 75 | - } catch (IllegalAccessException e) { | ||
| 76 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 77 | - } | ||
| 78 | - } | 52 | + Map<String, TenantPipelineConfig> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, o -> o)); |
| 53 | + List<Field> fields = MappingUtils.listFields(bill.getClass()); | ||
| 54 | + fields.forEach(field -> MappingUtils.reflectField(bill, field, kvMap)); | ||
| 55 | + List<ReceivableItem> items = bill.getReceivableItems(); | ||
| 56 | + items.forEach(item -> MappingUtils.listFields(item.getClass()).forEach(field -> MappingUtils.reflectField(item, field, kvMap))); | ||
| 79 | } | 57 | } |
| 80 | } | 58 | } |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/RefundBuilder.java
| @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.RefundItem; | @@ -5,16 +5,18 @@ import com.diligrp.tax.central.domain.document.kingdee.bill.item.RefundItem; | ||
| 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 5 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 6 | import com.diligrp.tax.central.model.TenantPipeline; | 6 | import com.diligrp.tax.central.model.TenantPipeline; |
| 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; | 7 | import com.diligrp.tax.central.model.TenantPipelineConfig; |
| 8 | +import com.diligrp.tax.central.service.ITaxTenantService; | ||
| 8 | import com.diligrp.tax.central.type.DocumentType; | 9 | import com.diligrp.tax.central.type.DocumentType; |
| 9 | import com.diligrp.tax.central.type.TaxSystemType; | 10 | import com.diligrp.tax.central.type.TaxSystemType; |
| 10 | import com.diligrp.tax.central.utils.JsonUtils; | 11 | import com.diligrp.tax.central.utils.JsonUtils; |
| 12 | +import com.diligrp.tax.central.utils.MappingUtils; | ||
| 11 | import com.diligrp.tax.doc.demarcate.Builder; | 13 | import com.diligrp.tax.doc.demarcate.Builder; |
| 14 | +import jakarta.annotation.Resource; | ||
| 12 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 13 | 16 | ||
| 14 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 15 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 16 | import java.time.format.DateTimeFormatter; | 19 | import java.time.format.DateTimeFormatter; |
| 17 | -import java.util.Arrays; | ||
| 18 | import java.util.List; | 20 | import java.util.List; |
| 19 | import java.util.Map; | 21 | import java.util.Map; |
| 20 | import java.util.Optional; | 22 | import java.util.Optional; |
| @@ -28,6 +30,9 @@ import java.util.stream.Collectors; | @@ -28,6 +30,9 @@ import java.util.stream.Collectors; | ||
| 28 | @Component | 30 | @Component |
| 29 | public class RefundBuilder extends Builder<RefundBill> { | 31 | public class RefundBuilder extends Builder<RefundBill> { |
| 30 | 32 | ||
| 33 | + @Resource | ||
| 34 | + private ITaxTenantService taxTenantService; | ||
| 35 | + | ||
| 31 | @Override | 36 | @Override |
| 32 | public DocumentType markDocument() { | 37 | public DocumentType markDocument() { |
| 33 | return DocumentType.AR_REFUND_BILL; | 38 | return DocumentType.AR_REFUND_BILL; |
| @@ -38,43 +43,16 @@ public class RefundBuilder extends Builder<RefundBill> { | @@ -38,43 +43,16 @@ public class RefundBuilder extends Builder<RefundBill> { | ||
| 38 | RefundBill bill = JsonUtils.fromJsonString(body, RefundBill.class); | 43 | RefundBill bill = JsonUtils.fromJsonString(body, RefundBill.class); |
| 39 | Optional.ofNullable(bill.getRefundItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); | 44 | Optional.ofNullable(bill.getRefundItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 40 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); | 45 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 41 | - List<TenantPipelineConfig> list = pipeline.getTenantPipelineConfigs().get(markDocument()); | 46 | + List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); |
| 42 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); | 47 | Optional.ofNullable(list).ifPresent(ts -> configureDefaultData(bill, ts)); |
| 43 | - //todo动态规则转换 | ||
| 44 | return bill; | 48 | return bill; |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | private void configureDefaultData(RefundBill bill, List<TenantPipelineConfig> list) { | 51 | private void configureDefaultData(RefundBill bill, List<TenantPipelineConfig> list) { |
| 48 | - Map<String, String> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, TenantPipelineConfig::getConfigValue)); | ||
| 49 | - Field[] declaredFields = bill.getClass().getDeclaredFields(); | ||
| 50 | - Arrays.stream(declaredFields).forEach(field -> reflectField(bill, field, kvMap)); | ||
| 51 | - List<RefundItem> refundItems = bill.getRefundItems(); | ||
| 52 | - refundItems.forEach(item -> { | ||
| 53 | - Field[] declaredFields1 = item.getClass().getDeclaredFields(); | ||
| 54 | - Arrays.stream(declaredFields1).forEach(field -> reflectField(item, field, kvMap)); | ||
| 55 | - }); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - public static void reflectField(RefundBill object, Field field, Map<String, String> kvMap) { | ||
| 59 | - if (kvMap.containsKey(field.getName())) { | ||
| 60 | - field.setAccessible(true); | ||
| 61 | - try { | ||
| 62 | - field.set(object, kvMap.get(field.getName())); | ||
| 63 | - } catch (IllegalAccessException e) { | ||
| 64 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - public static void reflectField(RefundItem object, Field field, Map<String, String> kvMap) { | ||
| 71 | - if (kvMap.containsKey(field.getName())) { | ||
| 72 | - field.setAccessible(true); | ||
| 73 | - try { | ||
| 74 | - field.set(object, kvMap.get(field.getName())); | ||
| 75 | - } catch (IllegalAccessException e) { | ||
| 76 | - throw new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT, e.getMessage()); | ||
| 77 | - } | ||
| 78 | - } | 52 | + Map<String, TenantPipelineConfig> kvMap = list.stream().collect(Collectors.toMap(TenantPipelineConfig::getConfigKey, o -> o)); |
| 53 | + List<Field> fields = MappingUtils.listFields(bill.getClass()); | ||
| 54 | + fields.forEach(field -> MappingUtils.reflectField(bill, field, kvMap)); | ||
| 55 | + List<RefundItem> items = bill.getRefundItems(); | ||
| 56 | + items.forEach(item -> MappingUtils.listFields(item.getClass()).forEach(field -> MappingUtils.reflectField(item, field, kvMap))); | ||
| 79 | } | 57 | } |
| 80 | } | 58 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/controller/TaxPipelineConfigController.java deleted
100644 → 0
| 1 | -package com.diligrp.tax.storage.controller; | ||
| 2 | - | ||
| 3 | -import com.diligrp.tax.storage.Valid; | ||
| 4 | -import com.diligrp.tax.storage.anno.RebuildIndex; | ||
| 5 | -import com.diligrp.tax.storage.message.Message; | ||
| 6 | -import com.diligrp.tax.storage.model.co.TaxPipelineConfigCO; | ||
| 7 | -import com.diligrp.tax.storage.service.TaxPipelineConfigService; | ||
| 8 | -import jakarta.annotation.Resource; | ||
| 9 | -import org.springframework.validation.annotation.Validated; | ||
| 10 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | -import org.springframework.web.bind.annotation.RestController; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * @Author: zhangmeiyang | ||
| 17 | - * @CreateTime: 2025-11-05 16:22 | ||
| 18 | - * @Version: todo | ||
| 19 | - */ | ||
| 20 | -@RestController | ||
| 21 | -@RequestMapping("/tax/tenant/pipeline/config") | ||
| 22 | -public class TaxPipelineConfigController { | ||
| 23 | - | ||
| 24 | - @Resource | ||
| 25 | - private TaxPipelineConfigService taxPipelineConfigService; | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - /** | ||
| 29 | - * 按管道 ID 和文档类型列出 | ||
| 30 | - * | ||
| 31 | - * @param pipelineId 管道 ID | ||
| 32 | - * @param documentType 文档类型 | ||
| 33 | - * @return {@link Message }<{@link ? }> | ||
| 34 | - */ | ||
| 35 | - @RequestMapping("/list/{pipelineId}/{documentType}") | ||
| 36 | - public Message<?> listByPipelineIdAndDocumentType(@PathVariable("pipelineId") Long pipelineId, @PathVariable("documentType") String documentType) { | ||
| 37 | - return Message.success(taxPipelineConfigService.listByPipelineIdAndDocumentType(pipelineId, documentType)); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * 按管道 ID 列出 | ||
| 42 | - * | ||
| 43 | - * @param pipelineId 管道 ID | ||
| 44 | - * @return {@link Message }<{@link ? }> | ||
| 45 | - */ | ||
| 46 | - @RequestMapping("/list/{pipelineId}") | ||
| 47 | - public Message<?> listByPipelineId(@PathVariable("pipelineId") Long pipelineId) { | ||
| 48 | - return Message.success(taxPipelineConfigService.listByPipelineId(pipelineId)); | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - /** | ||
| 53 | - * 保存 | ||
| 54 | - * | ||
| 55 | - * @param taxPipelineConfig 税务管道配置 | ||
| 56 | - * @return {@link Message }<{@link ? }> | ||
| 57 | - */ | ||
| 58 | - @RequestMapping("/save") | ||
| 59 | - @RebuildIndex | ||
| 60 | - public Message<?> save(@RequestBody @Validated(value = Valid.Create.class) TaxPipelineConfigCO taxPipelineConfig) { | ||
| 61 | - taxPipelineConfigService.save(taxPipelineConfig); | ||
| 62 | - return Message.success(); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 更新 | ||
| 67 | - * | ||
| 68 | - * @param taxPipelineConfig 税务管道配置 | ||
| 69 | - * @return {@link Message }<{@link ? }> | ||
| 70 | - */ | ||
| 71 | - @RequestMapping("/update") | ||
| 72 | - @RebuildIndex | ||
| 73 | - public Message<?> update(@RequestBody @Validated(value = {Valid.Update.class}) TaxPipelineConfigCO taxPipelineConfig) { | ||
| 74 | - taxPipelineConfigService.update(taxPipelineConfig); | ||
| 75 | - return Message.success(); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - /** | ||
| 79 | - * 删除 | ||
| 80 | - * | ||
| 81 | - * @param id id | ||
| 82 | - * @return {@link Message }<{@link ? }> | ||
| 83 | - */ | ||
| 84 | - @RequestMapping("/delete/{id}") | ||
| 85 | - @RebuildIndex | ||
| 86 | - public Message<?> delete(@PathVariable("id") Long id) { | ||
| 87 | - taxPipelineConfigService.delete(id); | ||
| 88 | - return Message.success(); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | -} |
tax-storage/src/main/java/com/diligrp/tax/storage/controller/TaxPipelineFieldConfigController.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.Valid; | ||
| 4 | +import com.diligrp.tax.storage.message.Message; | ||
| 5 | +import com.diligrp.tax.storage.model.co.TaxPipelineFieldConfigCO; | ||
| 6 | +import com.diligrp.tax.storage.service.TaxPipelineFieldConfigService; | ||
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Author: zhangmeiyang | ||
| 16 | + * @CreateTime: 2025-11-10 17:40 | ||
| 17 | + * @Version: todo | ||
| 18 | + */ | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("/tax/tenant/pipeline/field/config") | ||
| 21 | +public class TaxPipelineFieldConfigController { | ||
| 22 | + | ||
| 23 | + @Resource | ||
| 24 | + private TaxPipelineFieldConfigService taxPipelineFieldConfigService; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 列出所有单据 | ||
| 28 | + * | ||
| 29 | + * @return {@link Message }<{@link ? }> | ||
| 30 | + */ | ||
| 31 | + @RequestMapping("/listDocument/{systemType}") | ||
| 32 | + public Message<?> listDocument(@PathVariable("systemType") String systemType) { | ||
| 33 | + return Message.success(taxPipelineFieldConfigService.listDocumentBySystemType(systemType)); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 列出所有可配置的字段 | ||
| 39 | + * | ||
| 40 | + * @param systemType 系统类型 | ||
| 41 | + * @param documentType 文档类型 | ||
| 42 | + * @return {@link Message }<{@link ? }> | ||
| 43 | + */ | ||
| 44 | + @RequestMapping("/listField/{systemType}/{documentType}") | ||
| 45 | + public Message<?> listField(@PathVariable("systemType") String systemType, @PathVariable("documentType") String documentType) { | ||
| 46 | + return Message.success(taxPipelineFieldConfigService.listFieldBySystemTypeAndDocumentType(systemType, documentType)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 保存配置 | ||
| 52 | + * | ||
| 53 | + * @param co 公司 | ||
| 54 | + * @return {@link Message }<{@link ? }> | ||
| 55 | + */ | ||
| 56 | + @RequestMapping("/save") | ||
| 57 | + public Message<?> save(@RequestBody @Validated(value = Valid.Create.class) TaxPipelineFieldConfigCO co) { | ||
| 58 | + taxPipelineFieldConfigService.save(co); | ||
| 59 | + return Message.success(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + | ||
| 63 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineConfig.java deleted
100644 → 0
| 1 | -package com.diligrp.tax.storage.domain; | ||
| 2 | - | ||
| 3 | -import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | -import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | -import lombok.Getter; | ||
| 8 | -import lombok.Setter; | ||
| 9 | - | ||
| 10 | -import java.time.LocalDateTime; | ||
| 11 | - | ||
| 12 | -@Getter | ||
| 13 | -@Setter | ||
| 14 | -@TableName("tax_pipeline_config") | ||
| 15 | -public class TaxPipelineConfig { | ||
| 16 | - @TableId(type = IdType.AUTO) | ||
| 17 | - private Long id; | ||
| 18 | - | ||
| 19 | - @TableField(value = "pipeline_id") | ||
| 20 | - private Long pipelineId; | ||
| 21 | - | ||
| 22 | - @TableField(value = "document_type") | ||
| 23 | - private String documentType; | ||
| 24 | - | ||
| 25 | - @TableField(value = "config_key") | ||
| 26 | - private String configKey; | ||
| 27 | - | ||
| 28 | - @TableField(value = "config_value") | ||
| 29 | - private String configValue; | ||
| 30 | - | ||
| 31 | - @TableField(value = "created_time") | ||
| 32 | - private LocalDateTime createdTime; | ||
| 33 | - | ||
| 34 | - @TableField(value = "modified_time") | ||
| 35 | - private LocalDateTime modifiedTime; | ||
| 36 | - | ||
| 37 | -} |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineDynamicConfig.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.domain; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 账套动态字段配置表 | ||
| 12 | + * @TableName tax_pipeline_dynamic_config | ||
| 13 | + */ | ||
| 14 | +@TableName(value ="tax_pipeline_dynamic_config") | ||
| 15 | +@Data | ||
| 16 | +public class TaxPipelineDynamicConfig { | ||
| 17 | + /** | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + @TableId(type = IdType.AUTO) | ||
| 21 | + private Long id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 账套ID | ||
| 25 | + */ | ||
| 26 | + @TableField(value = "pipeline_field_type_id") | ||
| 27 | + private Long pipelineFieldTypeId; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 配置项VALUE | ||
| 31 | + */ | ||
| 32 | + @TableField(value = "config_value") | ||
| 33 | + private String configValue; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 配置项映射VALUE | ||
| 37 | + */ | ||
| 38 | + @TableField(value = "config_map_value") | ||
| 39 | + private String configMapValue; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 创建时间 | ||
| 43 | + */ | ||
| 44 | + @TableField(value = "created_time") | ||
| 45 | + private LocalDateTime createdTime; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 更新时间 | ||
| 49 | + */ | ||
| 50 | + @TableField(value = "modified_time") | ||
| 51 | + private LocalDateTime modifiedTime; | ||
| 52 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineConfigVO.java renamed to tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineFieldType.java
| 1 | -package com.diligrp.tax.storage.model.vo; | 1 | +package com.diligrp.tax.storage.domain; |
| 2 | 2 | ||
| 3 | -import lombok.Getter; | ||
| 4 | -import lombok.Setter; | ||
| 5 | - | ||
| 6 | -import java.time.Instant; | 3 | +import com.baomidou.mybatisplus.annotation.IdType; |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; |
| 8 | +import lombok.Data; | ||
| 8 | 9 | ||
| 9 | -@Getter | ||
| 10 | -@Setter | ||
| 11 | -public class TaxPipelineConfigVO { | 10 | +/** |
| 11 | + * 账套字段配置表 | ||
| 12 | + * @TableName tax_pipeline_field_type | ||
| 13 | + */ | ||
| 14 | +@TableName(value ="tax_pipeline_field_type") | ||
| 15 | +@Data | ||
| 16 | +public class TaxPipelineFieldType { | ||
| 12 | /** | 17 | /** |
| 13 | - * id | 18 | + * |
| 14 | */ | 19 | */ |
| 20 | + @TableId(type = IdType.AUTO) | ||
| 15 | private Long id; | 21 | private Long id; |
| 22 | + | ||
| 16 | /** | 23 | /** |
| 17 | - * 管道 ID | 24 | + * 账套ID |
| 18 | */ | 25 | */ |
| 26 | + @TableField(value = "pipeline_id") | ||
| 19 | private Long pipelineId; | 27 | private Long pipelineId; |
| 28 | + | ||
| 20 | /** | 29 | /** |
| 21 | - * 文档类型 | 30 | + * 业务单据类型 |
| 22 | */ | 31 | */ |
| 32 | + @TableField(value = "document_type") | ||
| 23 | private String documentType; | 33 | private String documentType; |
| 34 | + | ||
| 24 | /** | 35 | /** |
| 25 | - * 配置键 | 36 | + * 配置项KEY |
| 26 | */ | 37 | */ |
| 38 | + @TableField(value = "config_key") | ||
| 27 | private String configKey; | 39 | private String configKey; |
| 40 | + | ||
| 28 | /** | 41 | /** |
| 29 | * 配置值 | 42 | * 配置值 |
| 30 | */ | 43 | */ |
| 31 | - private String configValue; | 44 | + @TableField(value = "setting_field_type") |
| 45 | + private Integer settingFieldType; | ||
| 46 | + | ||
| 32 | /** | 47 | /** |
| 33 | * 创建时间 | 48 | * 创建时间 |
| 34 | */ | 49 | */ |
| 50 | + @TableField(value = "created_time") | ||
| 35 | private LocalDateTime createdTime; | 51 | private LocalDateTime createdTime; |
| 52 | + | ||
| 36 | /** | 53 | /** |
| 37 | - * 修改时间 | 54 | + * 更新时间 |
| 38 | */ | 55 | */ |
| 56 | + @TableField(value = "modified_time") | ||
| 39 | private LocalDateTime modifiedTime; | 57 | private LocalDateTime modifiedTime; |
| 40 | - | ||
| 41 | } | 58 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineFixedConfig.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.domain; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 账套默认配置表 | ||
| 13 | + * | ||
| 14 | + * @TableName tax_pipeline_fixed_config | ||
| 15 | + */ | ||
| 16 | +@TableName(value = "tax_pipeline_fixed_config") | ||
| 17 | +@Data | ||
| 18 | +public class TaxPipelineFixedConfig { | ||
| 19 | + /** | ||
| 20 | + * | ||
| 21 | + */ | ||
| 22 | + @TableId(type = IdType.AUTO) | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 账套ID | ||
| 27 | + */ | ||
| 28 | + @TableField(value = "pipeline_field_type_id") | ||
| 29 | + private Long pipelineFieldTypeId; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 配置项VALUE | ||
| 33 | + */ | ||
| 34 | + @TableField(value = "config_value") | ||
| 35 | + private String configValue; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 创建时间 | ||
| 39 | + */ | ||
| 40 | + @TableField(value = "created_time") | ||
| 41 | + private LocalDateTime createdTime; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 更新时间 | ||
| 45 | + */ | ||
| 46 | + @TableField(value = "modified_time") | ||
| 47 | + private LocalDateTime modifiedTime; | ||
| 48 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineRemoteConfig.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.domain; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 账套远程调用配置表 | ||
| 13 | + * | ||
| 14 | + * @TableName tax_pipeline_remote_config | ||
| 15 | + */ | ||
| 16 | +@TableName(value = "tax_pipeline_remote_config") | ||
| 17 | +@Data | ||
| 18 | +public class TaxPipelineRemoteConfig { | ||
| 19 | + /** | ||
| 20 | + * | ||
| 21 | + */ | ||
| 22 | + @TableId(type = IdType.AUTO) | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 账套ID | ||
| 27 | + */ | ||
| 28 | + @TableField(value = "pipeline_field_type_id") | ||
| 29 | + private Long pipelineFieldTypeId; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 调用接口参数固定值 | ||
| 33 | + */ | ||
| 34 | + @TableField(value = "fixed_params") | ||
| 35 | + private String fixedParams; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 调用远程接口映射字段 | ||
| 39 | + */ | ||
| 40 | + @TableField(value = "`field`") | ||
| 41 | + private String field; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 远程调用地址 | ||
| 45 | + */ | ||
| 46 | + @TableField(value = "remote_address") | ||
| 47 | + private String remoteAddress; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * jsonpath获取数据路径 | ||
| 51 | + */ | ||
| 52 | + @TableField(value = "data_path") | ||
| 53 | + private String dataPath; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 创建时间 | ||
| 57 | + */ | ||
| 58 | + @TableField(value = "created_time") | ||
| 59 | + private LocalDateTime createdTime; | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 更新时间 | ||
| 63 | + */ | ||
| 64 | + @TableField(value = "modified_time") | ||
| 65 | + private LocalDateTime modifiedTime; | ||
| 66 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineConfigCO.java renamed to tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineFieldConfigCO.java
| 1 | package com.diligrp.tax.storage.model.co; | 1 | package com.diligrp.tax.storage.model.co; |
| 2 | 2 | ||
| 3 | import com.diligrp.tax.storage.Valid; | 3 | import com.diligrp.tax.storage.Valid; |
| 4 | +import com.diligrp.tax.central.model.DynamicValue; | ||
| 5 | +import com.diligrp.tax.central.model.RemoteParam; | ||
| 4 | import jakarta.validation.constraints.NotEmpty; | 6 | import jakarta.validation.constraints.NotEmpty; |
| 5 | import jakarta.validation.constraints.NotNull; | 7 | import jakarta.validation.constraints.NotNull; |
| 6 | import lombok.Getter; | 8 | import lombok.Getter; |
| 7 | import lombok.Setter; | 9 | import lombok.Setter; |
| 8 | 10 | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @Author: zhangmeiyang | ||
| 15 | + * @CreateTime: 2025-11-10 18:10 | ||
| 16 | + * @Version: todo | ||
| 17 | + */ | ||
| 9 | @Getter | 18 | @Getter |
| 10 | @Setter | 19 | @Setter |
| 11 | -public class TaxPipelineConfigCO { | ||
| 12 | - | ||
| 13 | - /** | ||
| 14 | - * id | ||
| 15 | - */ | ||
| 16 | - @NotNull(groups = {Valid.Update.class, Valid.Delete.class}) | ||
| 17 | - private Long id; | 20 | +public class TaxPipelineFieldConfigCO { |
| 18 | 21 | ||
| 19 | /** | 22 | /** |
| 20 | * 管道 ID | 23 | * 管道 ID |
| @@ -28,6 +31,7 @@ public class TaxPipelineConfigCO { | @@ -28,6 +31,7 @@ public class TaxPipelineConfigCO { | ||
| 28 | @NotEmpty(groups = {Valid.Create.class}) | 31 | @NotEmpty(groups = {Valid.Create.class}) |
| 29 | private String documentType; | 32 | private String documentType; |
| 30 | 33 | ||
| 34 | + | ||
| 31 | /** | 35 | /** |
| 32 | * 配置键 | 36 | * 配置键 |
| 33 | */ | 37 | */ |
| @@ -35,9 +39,23 @@ public class TaxPipelineConfigCO { | @@ -35,9 +39,23 @@ public class TaxPipelineConfigCO { | ||
| 35 | private String configKey; | 39 | private String configKey; |
| 36 | 40 | ||
| 37 | /** | 41 | /** |
| 38 | - * 配置值 | 42 | + * 设置字段类型 |
| 39 | */ | 43 | */ |
| 40 | - @NotEmpty(groups = {Valid.Create.class}) | ||
| 41 | - private String configValue; | 44 | + @NotNull(groups = {Valid.Create.class}) |
| 45 | + private Integer settingFieldType; | ||
| 42 | 46 | ||
| 47 | + /** | ||
| 48 | + * 固定值 | ||
| 49 | + */ | ||
| 50 | + private String fixedValue; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 动态值 | ||
| 54 | + */ | ||
| 55 | + private List<DynamicValue> dynamicValues; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 远程参数 | ||
| 59 | + */ | ||
| 60 | + private RemoteParam remoteParam; | ||
| 43 | } | 61 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineConfigRepository.java deleted
100644 → 0
| 1 | -package com.diligrp.tax.storage.repo; | ||
| 2 | - | ||
| 3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | -import com.diligrp.tax.storage.domain.TaxPipelineConfig; | ||
| 5 | -import org.springframework.stereotype.Repository; | ||
| 6 | - | ||
| 7 | -@Repository | ||
| 8 | -public interface TaxPipelineConfigRepository extends BaseMapper<TaxPipelineConfig> { | ||
| 9 | - | ||
| 10 | -} |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineDynamicConfigRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.domain.TaxPipelineDynamicConfig; | ||
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | +* @author dili | ||
| 9 | +* @description 针对表【tax_pipeline_dynamic_config(账套动态字段配置表)】的数据库操作Mapper | ||
| 10 | +* @createDate 2025-11-10 17:51:55 | ||
| 11 | +* @Entity com.diligrp.tax.storage.domain.TaxPipelineDynamicConfig | ||
| 12 | +*/ | ||
| 13 | +@Repository | ||
| 14 | +public interface TaxPipelineDynamicConfigRepository extends BaseMapper<TaxPipelineDynamicConfig> { | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineFieldTypeRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.domain.TaxPipelineFieldType; | ||
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | +* @author dili | ||
| 8 | +* @description 针对表【tax_pipeline_field_type(账套字段配置表)】的数据库操作Mapper | ||
| 9 | +* @createDate 2025-11-10 18:40:44 | ||
| 10 | +* @Entity com.diligrp.tax.storage.domain.TaxPipelineFieldType | ||
| 11 | +*/ | ||
| 12 | +public interface TaxPipelineFieldTypeRepository extends BaseMapper<TaxPipelineFieldType> { | ||
| 13 | + | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineFixedConfigRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.domain.TaxPipelineFixedConfig; | ||
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | +* @author dili | ||
| 9 | +* @description 针对表【tax_pipeline_fixed_config(账套默认配置表)】的数据库操作Mapper | ||
| 10 | +* @createDate 2025-11-10 17:51:55 | ||
| 11 | +* @Entity com.diligrp.tax.storage.domain.TaxPipelineFixedConfig | ||
| 12 | +*/ | ||
| 13 | +@Repository | ||
| 14 | +public interface TaxPipelineFixedConfigRepository extends BaseMapper<TaxPipelineFixedConfig> { | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineRemoteConfigRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.tax.storage.domain.TaxPipelineRemoteConfig; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author dili | ||
| 9 | + * @description 针对表【tax_pipeline_remote_config(账套远程调用配置表)】的数据库操作Mapper | ||
| 10 | + * @createDate 2025-11-10 17:51:55 | ||
| 11 | + * @Entity com.diligrp.tax.storage.domain.TaxPipelineRemoteConfig | ||
| 12 | + */ | ||
| 13 | +@Repository | ||
| 14 | +public interface TaxPipelineRemoteConfigRepository extends BaseMapper<TaxPipelineRemoteConfig> { | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineConfigService.java deleted
100644 → 0
| 1 | -package com.diligrp.tax.storage.service; | ||
| 2 | - | ||
| 3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | -import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 5 | -import com.diligrp.tax.central.type.DocumentType; | ||
| 6 | -import com.diligrp.tax.central.utils.JsonUtils; | ||
| 7 | -import com.diligrp.tax.storage.domain.TaxPipelineConfig; | ||
| 8 | -import com.diligrp.tax.storage.model.co.TaxPipelineConfigCO; | ||
| 9 | -import com.diligrp.tax.storage.model.vo.TaxPipelineConfigVO; | ||
| 10 | -import com.diligrp.tax.storage.repo.TaxPipelineConfigRepository; | ||
| 11 | -import jakarta.annotation.Resource; | ||
| 12 | -import org.springframework.stereotype.Service; | ||
| 13 | -import org.springframework.transaction.annotation.Transactional; | ||
| 14 | - | ||
| 15 | -import java.util.List; | ||
| 16 | -import java.util.Optional; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * @Author: zhangmeiyang | ||
| 20 | - * @CreateTime: 2025-11-05 16:24 | ||
| 21 | - * @Version: todo | ||
| 22 | - */ | ||
| 23 | -@Service | ||
| 24 | -public class TaxPipelineConfigService { | ||
| 25 | - | ||
| 26 | - @Resource | ||
| 27 | - private TaxPipelineConfigRepository taxPipelineConfigRepository; | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * 列表 | ||
| 31 | - * | ||
| 32 | - * @param pipelineId 管道 ID | ||
| 33 | - * @param documentType 文档类型 | ||
| 34 | - * @return {@link Object } | ||
| 35 | - */ | ||
| 36 | - public List<TaxPipelineConfigVO> listByPipelineIdAndDocumentType(Long pipelineId, String documentType) { | ||
| 37 | - LambdaQueryWrapper<TaxPipelineConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 38 | - queryWrapper.eq(TaxPipelineConfig::getPipelineId, pipelineId); | ||
| 39 | - queryWrapper.eq(TaxPipelineConfig::getDocumentType, documentType); | ||
| 40 | - List<TaxPipelineConfig> taxPipelineConfigs = taxPipelineConfigRepository.selectList(queryWrapper); | ||
| 41 | - return taxPipelineConfigs.stream().map(taxPipelineConfig -> JsonUtils.convertValue(taxPipelineConfig, TaxPipelineConfigVO.class)).toList(); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | - * 按管道 ID 列出 | ||
| 46 | - * | ||
| 47 | - * @param pipelineId 管道 ID | ||
| 48 | - * @return {@link List }<{@link TaxPipelineConfigVO }> | ||
| 49 | - */ | ||
| 50 | - public List<TaxPipelineConfigVO> listByPipelineId(Long pipelineId) { | ||
| 51 | - LambdaQueryWrapper<TaxPipelineConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 52 | - queryWrapper.eq(TaxPipelineConfig::getPipelineId, pipelineId); | ||
| 53 | - List<TaxPipelineConfig> taxPipelineConfigs = taxPipelineConfigRepository.selectList(queryWrapper); | ||
| 54 | - return taxPipelineConfigs.stream().map(taxPipelineConfig -> JsonUtils.convertValue(taxPipelineConfig, TaxPipelineConfigVO.class)).toList(); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - /** | ||
| 59 | - * 保存配置 | ||
| 60 | - * | ||
| 61 | - * @param taxPipelineConfig 税务管道配置 | ||
| 62 | - */ | ||
| 63 | - @Transactional | ||
| 64 | - public void save(TaxPipelineConfigCO taxPipelineConfig) { | ||
| 65 | - DocumentType.validateDocumentType(taxPipelineConfig.getDocumentType()); | ||
| 66 | - TaxPipelineConfig config = JsonUtils.convertValue(taxPipelineConfig, TaxPipelineConfig.class); | ||
| 67 | - taxPipelineConfigRepository.insert(config); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - /** | ||
| 72 | - * 更新 | ||
| 73 | - * | ||
| 74 | - * @param taxPipelineConfig 税务管道配置 | ||
| 75 | - */ | ||
| 76 | - @Transactional | ||
| 77 | - public void update(TaxPipelineConfigCO taxPipelineConfig) { | ||
| 78 | - DocumentType.validateDocumentType(taxPipelineConfig.getDocumentType()); | ||
| 79 | - TaxPipelineConfig config = JsonUtils.convertValue(taxPipelineConfig, TaxPipelineConfig.class); | ||
| 80 | - taxPipelineConfigRepository.updateById(config); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | - * 删除 | ||
| 85 | - * | ||
| 86 | - * @param id id | ||
| 87 | - */ | ||
| 88 | - @Transactional | ||
| 89 | - public void delete(Long id) { | ||
| 90 | - TaxPipelineConfig config = Optional.ofNullable(taxPipelineConfigRepository.selectById(id)).orElseThrow(() -> new TaxAgentServiceException("未找到当前配置")); | ||
| 91 | - taxPipelineConfigRepository.deleteById(config); | ||
| 92 | - } | ||
| 93 | -} |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineFieldConfigService.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.service; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 5 | +import com.diligrp.tax.central.model.DynamicValue; | ||
| 6 | +import com.diligrp.tax.central.model.Option; | ||
| 7 | +import com.diligrp.tax.central.model.RemoteParam; | ||
| 8 | +import com.diligrp.tax.central.model.TenantPipelineConfig; | ||
| 9 | +import com.diligrp.tax.central.type.DocumentType; | ||
| 10 | +import com.diligrp.tax.central.type.SettingFieldType; | ||
| 11 | +import com.diligrp.tax.central.type.SystemType; | ||
| 12 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 13 | +import com.diligrp.tax.storage.domain.TaxPipelineDynamicConfig; | ||
| 14 | +import com.diligrp.tax.storage.domain.TaxPipelineFieldType; | ||
| 15 | +import com.diligrp.tax.storage.domain.TaxPipelineFixedConfig; | ||
| 16 | +import com.diligrp.tax.storage.domain.TaxPipelineRemoteConfig; | ||
| 17 | +import com.diligrp.tax.storage.model.co.TaxPipelineFieldConfigCO; | ||
| 18 | +import com.diligrp.tax.storage.repo.TaxPipelineDynamicConfigRepository; | ||
| 19 | +import com.diligrp.tax.storage.repo.TaxPipelineFieldTypeRepository; | ||
| 20 | +import com.diligrp.tax.storage.repo.TaxPipelineFixedConfigRepository; | ||
| 21 | +import com.diligrp.tax.storage.repo.TaxPipelineRemoteConfigRepository; | ||
| 22 | +import jakarta.annotation.Resource; | ||
| 23 | +import org.springframework.stereotype.Service; | ||
| 24 | +import org.springframework.transaction.annotation.Transactional; | ||
| 25 | + | ||
| 26 | +import java.util.List; | ||
| 27 | +import java.util.Map; | ||
| 28 | +import java.util.Optional; | ||
| 29 | +import java.util.stream.Collectors; | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * @Author: zhangmeiyang | ||
| 33 | + * @CreateTime: 2025-11-10 17:59 | ||
| 34 | + * @Version: todo | ||
| 35 | + */ | ||
| 36 | +@Service | ||
| 37 | +public class TaxPipelineFieldConfigService { | ||
| 38 | + | ||
| 39 | + @Resource | ||
| 40 | + private TaxPipelineFieldTypeRepository taxPipelineFieldTypeRepository; | ||
| 41 | + @Resource | ||
| 42 | + private TaxPipelineRemoteConfigRepository taxPipelineRemoteConfigRepository; | ||
| 43 | + @Resource | ||
| 44 | + private TaxPipelineFixedConfigRepository taxPipelineFixedConfigRepository; | ||
| 45 | + @Resource | ||
| 46 | + private TaxPipelineDynamicConfigRepository taxPipelineDynamicConfigRepository; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 按系统类型列出文档 | ||
| 50 | + * | ||
| 51 | + * @param systemType 系统类型 | ||
| 52 | + * @return {@link List }<{@link Option }> | ||
| 53 | + */ | ||
| 54 | + public List<Option> listDocumentBySystemType(String systemType) { | ||
| 55 | + SystemType from = SystemType.from(systemType); | ||
| 56 | + return from.documentTypes.stream().map(documentType -> new Option(documentType.desc, documentType.value)).toList(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 按系统类型和文档类型列出字段 | ||
| 61 | + * | ||
| 62 | + * @param systemType 系统类型 | ||
| 63 | + * @param documentType 文档类型 | ||
| 64 | + * @return {@link List }<{@link Option }> | ||
| 65 | + */ | ||
| 66 | + public List<Option> listFieldBySystemTypeAndDocumentType(String systemType, String documentType) { | ||
| 67 | + SystemType from = SystemType.from(systemType); | ||
| 68 | + DocumentType documentType1 = from.documentTypes.stream().filter(doc -> doc.value.equals(documentType)).findFirst().orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.BUSINESS_MATCHES_ARE_INCORRECT)); | ||
| 69 | + return documentType1.fieldType.stream().map(fieldType -> new Option(fieldType.desc, fieldType.value)).toList(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 保存 | ||
| 74 | + * | ||
| 75 | + * @param co 公司 | ||
| 76 | + */ | ||
| 77 | + @Transactional | ||
| 78 | + public void save(TaxPipelineFieldConfigCO co) { | ||
| 79 | + SettingFieldType from = SettingFieldType.from(co.getSettingFieldType()); | ||
| 80 | + LambdaQueryWrapper<TaxPipelineFieldType> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 81 | + queryWrapper.eq(TaxPipelineFieldType::getPipelineId, co.getPipelineId()).eq(TaxPipelineFieldType::getDocumentType, co.getDocumentType()).eq(TaxPipelineFieldType::getConfigKey, co.getConfigKey()); | ||
| 82 | + TaxPipelineFieldType type = taxPipelineFieldTypeRepository.selectOne(queryWrapper); | ||
| 83 | + Optional.ofNullable(type).ifPresentOrElse( | ||
| 84 | + e -> { | ||
| 85 | + deleteFixedConfig(e); | ||
| 86 | + deleteDynamicConfig(e); | ||
| 87 | + deleteRemoteConfig(e); | ||
| 88 | + saveConfig(co, from, e); | ||
| 89 | + }, | ||
| 90 | + () -> { | ||
| 91 | + TaxPipelineFieldType newType = new TaxPipelineFieldType(); | ||
| 92 | + newType.setPipelineId(co.getPipelineId()); | ||
| 93 | + newType.setDocumentType(co.getDocumentType()); | ||
| 94 | + newType.setConfigKey(co.getConfigKey()); | ||
| 95 | + newType.setSettingFieldType(co.getSettingFieldType()); | ||
| 96 | + taxPipelineFieldTypeRepository.insert(newType); | ||
| 97 | + saveConfig(co, from, newType); | ||
| 98 | + } | ||
| 99 | + ); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @Transactional | ||
| 103 | + public void deleteRemoteConfig(TaxPipelineFieldType e) { | ||
| 104 | + LambdaQueryWrapper<TaxPipelineRemoteConfig> wrapper = new LambdaQueryWrapper<TaxPipelineRemoteConfig>().eq(TaxPipelineRemoteConfig::getPipelineFieldTypeId, e.getId()); | ||
| 105 | + taxPipelineRemoteConfigRepository.delete(wrapper); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Transactional | ||
| 109 | + public void deleteDynamicConfig(TaxPipelineFieldType e) { | ||
| 110 | + LambdaQueryWrapper<TaxPipelineDynamicConfig> wrapper = new LambdaQueryWrapper<TaxPipelineDynamicConfig>().eq(TaxPipelineDynamicConfig::getPipelineFieldTypeId, e.getId()); | ||
| 111 | + taxPipelineDynamicConfigRepository.delete(wrapper); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @Transactional | ||
| 115 | + public void deleteFixedConfig(TaxPipelineFieldType e) { | ||
| 116 | + LambdaQueryWrapper<TaxPipelineFixedConfig> wrapper = new LambdaQueryWrapper<TaxPipelineFixedConfig>().eq(TaxPipelineFixedConfig::getPipelineFieldTypeId, e.getId()); | ||
| 117 | + taxPipelineFixedConfigRepository.delete(wrapper); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @Transactional | ||
| 121 | + public void saveConfig(TaxPipelineFieldConfigCO co, SettingFieldType from, TaxPipelineFieldType newType) { | ||
| 122 | + switch (from) { | ||
| 123 | + case FIXED -> saveFixedConfig(co, newType); | ||
| 124 | + case DYNAMIC -> saveDynamicConfig(co, newType); | ||
| 125 | + case REMOTE -> saveRemoteConfig(co, newType); | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + @Transactional | ||
| 130 | + public void saveRemoteConfig(TaxPipelineFieldConfigCO co, TaxPipelineFieldType newType) { | ||
| 131 | + TaxPipelineRemoteConfig config = new TaxPipelineRemoteConfig(); | ||
| 132 | + config.setPipelineFieldTypeId(newType.getId()); | ||
| 133 | + config.setRemoteAddress(co.getRemoteParam().getRemoteAddress()); | ||
| 134 | + config.setField(co.getRemoteParam().getField()); | ||
| 135 | + config.setDataPath(co.getRemoteParam().getDataPath()); | ||
| 136 | + config.setFixedParams(co.getRemoteParam().getFixedParams()); | ||
| 137 | + taxPipelineRemoteConfigRepository.insert(config); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + @Transactional | ||
| 141 | + public void saveDynamicConfig(TaxPipelineFieldConfigCO co, TaxPipelineFieldType newType) { | ||
| 142 | + co.getDynamicValues().forEach(dynamicValue -> { | ||
| 143 | + TaxPipelineDynamicConfig dynamicConfig = new TaxPipelineDynamicConfig(); | ||
| 144 | + dynamicConfig.setPipelineFieldTypeId(newType.getId()); | ||
| 145 | + dynamicConfig.setConfigValue(dynamicValue.getConfigValue()); | ||
| 146 | + dynamicConfig.setConfigMapValue(dynamicValue.getConfigMapValue()); | ||
| 147 | + taxPipelineDynamicConfigRepository.insert(dynamicConfig); | ||
| 148 | + }); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + @Transactional | ||
| 152 | + public void saveFixedConfig(TaxPipelineFieldConfigCO co, TaxPipelineFieldType newType) { | ||
| 153 | + TaxPipelineFixedConfig config = new TaxPipelineFixedConfig(); | ||
| 154 | + config.setPipelineFieldTypeId(newType.getId()); | ||
| 155 | + config.setConfigValue(co.getFixedValue()); | ||
| 156 | + taxPipelineFixedConfigRepository.insert(config); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public List<TenantPipelineConfig> listByPipelineIdAndDocumentType(Long pipelineId, String documentType) { | ||
| 160 | + LambdaQueryWrapper<TaxPipelineFieldType> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 161 | + queryWrapper.eq(TaxPipelineFieldType::getPipelineId, pipelineId); | ||
| 162 | + queryWrapper.eq(TaxPipelineFieldType::getDocumentType, documentType); | ||
| 163 | + List<TaxPipelineFieldType> taxPipelineFieldTypes = taxPipelineFieldTypeRepository.selectList(queryWrapper); | ||
| 164 | + return taxPipelineFieldTypes.stream().map(e -> { | ||
| 165 | + TenantPipelineConfig res = new TenantPipelineConfig(); | ||
| 166 | + res.setId(e.getId()); | ||
| 167 | + res.setPipelineId(e.getPipelineId()); | ||
| 168 | + res.setDocumentType(e.getDocumentType()); | ||
| 169 | + res.setConfigKey(e.getConfigKey()); | ||
| 170 | + res.setSettingFieldType(SettingFieldType.from(e.getSettingFieldType())); | ||
| 171 | + switch (SettingFieldType.from(e.getSettingFieldType())) { | ||
| 172 | + case FIXED -> res.setFixedValue(queryByPipelineFixedFieldTypeId(e.getId())); | ||
| 173 | + case DYNAMIC -> res.setDynamicValues(queryByPipelineDynamicFieldTypeId(e.getId())); | ||
| 174 | + case REMOTE -> res.setRemoteParam(queryByPipelineRemoteFieldTypeId(e.getId())); | ||
| 175 | + } | ||
| 176 | + return res; | ||
| 177 | + }).toList(); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * 按管道远程字段类型 ID 查询 | ||
| 182 | + * | ||
| 183 | + * @param id id | ||
| 184 | + * @return {@link RemoteParam } | ||
| 185 | + */ | ||
| 186 | + private RemoteParam queryByPipelineRemoteFieldTypeId(Long id) { | ||
| 187 | + LambdaQueryWrapper<TaxPipelineRemoteConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 188 | + queryWrapper.eq(TaxPipelineRemoteConfig::getPipelineFieldTypeId, id); | ||
| 189 | + TaxPipelineRemoteConfig taxPipelineRemoteConfig = taxPipelineRemoteConfigRepository.selectOne(queryWrapper); | ||
| 190 | + var remote = new RemoteParam(); | ||
| 191 | + remote.setRemoteAddress(taxPipelineRemoteConfig.getRemoteAddress()); | ||
| 192 | + remote.setField(taxPipelineRemoteConfig.getField()); | ||
| 193 | + remote.setDataPath(taxPipelineRemoteConfig.getDataPath()); | ||
| 194 | + remote.setFixedParams(taxPipelineRemoteConfig.getFixedParams()); | ||
| 195 | + return remote; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + /** | ||
| 199 | + * 按管道动态字段类型 ID 查询 | ||
| 200 | + * | ||
| 201 | + * @param id id | ||
| 202 | + * @return {@link List }<{@link DynamicValue }> | ||
| 203 | + */ | ||
| 204 | + private Map<String, String> queryByPipelineDynamicFieldTypeId(Long id) { | ||
| 205 | + LambdaQueryWrapper<TaxPipelineDynamicConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 206 | + queryWrapper.eq(TaxPipelineDynamicConfig::getPipelineFieldTypeId, id); | ||
| 207 | + List<TaxPipelineDynamicConfig> taxPipelineDynamicConfigs = taxPipelineDynamicConfigRepository.selectList(queryWrapper); | ||
| 208 | + return taxPipelineDynamicConfigs.stream().map(e -> { | ||
| 209 | + var dynamicValue = new DynamicValue(); | ||
| 210 | + dynamicValue.setConfigValue(e.getConfigValue()); | ||
| 211 | + dynamicValue.setConfigMapValue(e.getConfigMapValue()); | ||
| 212 | + return dynamicValue; | ||
| 213 | + }).collect(Collectors.toMap(DynamicValue::getConfigValue, DynamicValue::getConfigMapValue)); | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + /** | ||
| 217 | + * 按管道固定字段类型 ID 查询 | ||
| 218 | + * | ||
| 219 | + * @param id id | ||
| 220 | + * @return {@link String } | ||
| 221 | + */ | ||
| 222 | + private String queryByPipelineFixedFieldTypeId(Long id) { | ||
| 223 | + LambdaQueryWrapper<TaxPipelineFixedConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 224 | + queryWrapper.eq(TaxPipelineFixedConfig::getPipelineFieldTypeId, id); | ||
| 225 | + TaxPipelineFixedConfig taxPipelineFixedConfig = taxPipelineFixedConfigRepository.selectOne(queryWrapper); | ||
| 226 | + return taxPipelineFixedConfig.getConfigValue(); | ||
| 227 | + } | ||
| 228 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxTenantService.java
| @@ -11,11 +11,9 @@ import com.diligrp.tax.central.type.SystemType; | @@ -11,11 +11,9 @@ import com.diligrp.tax.central.type.SystemType; | ||
| 11 | import com.diligrp.tax.central.type.TaxSystemType; | 11 | import com.diligrp.tax.central.type.TaxSystemType; |
| 12 | import com.diligrp.tax.central.utils.JsonUtils; | 12 | import com.diligrp.tax.central.utils.JsonUtils; |
| 13 | import com.diligrp.tax.storage.domain.TaxPipeline; | 13 | import com.diligrp.tax.storage.domain.TaxPipeline; |
| 14 | -import com.diligrp.tax.storage.domain.TaxPipelineConfig; | ||
| 15 | import com.diligrp.tax.storage.domain.TaxTenant; | 14 | import com.diligrp.tax.storage.domain.TaxTenant; |
| 16 | import com.diligrp.tax.storage.model.co.TaxTenantCO; | 15 | import com.diligrp.tax.storage.model.co.TaxTenantCO; |
| 17 | import com.diligrp.tax.storage.model.vo.TaxTenantVO; | 16 | import com.diligrp.tax.storage.model.vo.TaxTenantVO; |
| 18 | -import com.diligrp.tax.storage.repo.TaxPipelineConfigRepository; | ||
| 19 | import com.diligrp.tax.storage.repo.TaxPipelineRepository; | 17 | import com.diligrp.tax.storage.repo.TaxPipelineRepository; |
| 20 | import com.diligrp.tax.storage.repo.TaxTenantRepository; | 18 | import com.diligrp.tax.storage.repo.TaxTenantRepository; |
| 21 | import com.diligrp.tax.storage.type.StateType; | 19 | import com.diligrp.tax.storage.type.StateType; |
| @@ -42,7 +40,7 @@ public class TaxTenantService implements ITaxTenantService { | @@ -42,7 +40,7 @@ public class TaxTenantService implements ITaxTenantService { | ||
| 42 | @Resource | 40 | @Resource |
| 43 | private TaxPipelineRepository taxPipelineRepository; | 41 | private TaxPipelineRepository taxPipelineRepository; |
| 44 | @Resource | 42 | @Resource |
| 45 | - private TaxPipelineConfigRepository taxPipelineConfigRepository; | 43 | + private TaxPipelineFieldConfigService taxPipelineFieldConfigService; |
| 46 | 44 | ||
| 47 | 45 | ||
| 48 | /** | 46 | /** |
| @@ -85,11 +83,8 @@ public class TaxTenantService implements ITaxTenantService { | @@ -85,11 +83,8 @@ public class TaxTenantService implements ITaxTenantService { | ||
| 85 | * @return {@link List }<{@link TenantPipelineConfig }> | 83 | * @return {@link List }<{@link TenantPipelineConfig }> |
| 86 | */ | 84 | */ |
| 87 | @Override | 85 | @Override |
| 88 | - public List<TenantPipelineConfig> listByPipelineId(Long pipelineId) { | ||
| 89 | - LambdaQueryWrapper<TaxPipelineConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 90 | - queryWrapper.eq(TaxPipelineConfig::getPipelineId, pipelineId); | ||
| 91 | - List<TaxPipelineConfig> taxPipelineConfigs = taxPipelineConfigRepository.selectList(queryWrapper); | ||
| 92 | - return taxPipelineConfigs.stream().map(taxPipelineConfig -> JsonUtils.convertValue(taxPipelineConfig, TenantPipelineConfig.class)).toList(); | 86 | + public List<TenantPipelineConfig> listByPipelineIdAndDocumentType(Long pipelineId, String documentType) { |
| 87 | + return taxPipelineFieldConfigService.listByPipelineIdAndDocumentType(pipelineId,documentType); | ||
| 93 | } | 88 | } |
| 94 | 89 | ||
| 95 | 90 |