Commit a97c9c6fc27baef254b4a76d5f330a9fac483968
1 parent
68e5cc14
feat(tax-central): 新增业务关键词处理工具类及枚举类型
- 新增 AdoptUtils 工具类用于处理业务关键词提取逻辑 - 新增 DocumentFieldType 枚举定义文档字段类型及其解析方式 - 新增 DocumentValueWayType 枚举定义文档值获取方式- 扩展 JsonPathUtils 支持将 JSON 路径映射为 Map 结构 - 新增 PipelineBusinessKeyword 模型类用于存储关键词配置- 实现 ITaxPipelineBusinessKeywordService 接口并完成关键词查询逻辑 - 在 TaxPipelineBusinessConfigService 中实现关键词批量保存与查询功能 - 补充 TaxPipelineBusinessKeyword 相关字段以支持更多配置属性
Showing
10 changed files
with
297 additions
and
19 deletions
tax-central/src/main/java/com/diligrp/tax/central/model/PipelineBusinessKeyword.java
0 → 100644
| 1 | +package com.diligrp.tax.central.model; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.type.DocumentFieldType; | ||
| 4 | +import com.diligrp.tax.central.type.DocumentValueWayType; | ||
| 5 | +import lombok.Getter; | ||
| 6 | +import lombok.Setter; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author: zhangmeiyang | ||
| 10 | + * @CreateTime: 2025-11-18 09:42 | ||
| 11 | + * @Version: todo | ||
| 12 | + */ | ||
| 13 | +@Getter | ||
| 14 | +@Setter | ||
| 15 | +public class PipelineBusinessKeyword { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * id | ||
| 19 | + */ | ||
| 20 | + private Integer id; | ||
| 21 | + /** | ||
| 22 | + * 业务id | ||
| 23 | + */ | ||
| 24 | + private Long taxPipelineBusinessId; | ||
| 25 | + /** | ||
| 26 | + * 单据类型 | ||
| 27 | + */ | ||
| 28 | + private String documentType; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 文档字段 | ||
| 32 | + */ | ||
| 33 | + private String documentField; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 文档字段 | ||
| 37 | + */ | ||
| 38 | + private Integer documentFieldType; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 文档字段类型 ENUM | ||
| 42 | + */ | ||
| 43 | + private DocumentFieldType documentFieldTypeEnum; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 文档值方式 | ||
| 47 | + */ | ||
| 48 | + private Integer documentValueWay; | ||
| 49 | + /** | ||
| 50 | + * 文档价值方式类型 ENUM | ||
| 51 | + */ | ||
| 52 | + private DocumentValueWayType documentValueWayTypeEnum; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 文档值内容 | ||
| 56 | + */ | ||
| 57 | + private String documentValueContent; | ||
| 58 | +} |
tax-central/src/main/java/com/diligrp/tax/central/service/ITaxPipelineBusinessKeywordService.java
| 1 | package com.diligrp.tax.central.service; | 1 | package com.diligrp.tax.central.service; |
| 2 | 2 | ||
| 3 | +import com.diligrp.tax.central.model.PipelineBusinessKeyword; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 3 | /** | 7 | /** |
| 4 | * @author lvqi | 8 | * @author lvqi |
| 5 | */ | 9 | */ |
| 6 | public interface ITaxPipelineBusinessKeywordService { | 10 | public interface ITaxPipelineBusinessKeywordService { |
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 按租户、管道和业务查询 | ||
| 14 | + * | ||
| 15 | + * @param group 群 | ||
| 16 | + * @param entity 实体 | ||
| 17 | + * @param pipelineCode 管道代码 | ||
| 18 | + * @param businessCode 业务代码 | ||
| 19 | + * @return {@link List }<{@link PipelineBusinessKeyword }> | ||
| 20 | + */ | ||
| 21 | + List<PipelineBusinessKeyword> queryByTenantAndPipelineAndBusiness(String group, String entity, String pipelineCode, String businessCode); | ||
| 7 | } | 22 | } |
tax-central/src/main/java/com/diligrp/tax/central/type/DocumentFieldType.java
0 → 100644
| 1 | +package com.diligrp.tax.central.type; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.model.PipelineBusinessKeyword; | ||
| 4 | +import com.diligrp.tax.central.utils.JsonPathUtils; | ||
| 5 | +import com.diligrp.tax.central.utils.JsonUtils; | ||
| 6 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
| 7 | + | ||
| 8 | +import java.util.*; | ||
| 9 | + | ||
| 10 | +public enum DocumentFieldType { | ||
| 11 | + OBJECT(1, "对象") { | ||
| 12 | + @Override | ||
| 13 | + public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { | ||
| 14 | + res.put(keyword.getDocumentField(), JsonPathUtils.parse(json, keyword.getDocumentValueContent())); | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + OBJECT_ARRAY(2, "对象数组") { | ||
| 18 | + @Override | ||
| 19 | + public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { | ||
| 20 | + List<Map<String, Object>> list = new ArrayList<>(); | ||
| 21 | + Map<String, Object> data = JsonUtils.fromJsonString(json, new TypeReference<HashMap<String, Object>>() {}); | ||
| 22 | + data.forEach((k, v) -> { | ||
| 23 | + if (v instanceof Object[] os) { | ||
| 24 | + Arrays.stream(os).forEach(o -> list.add(JsonPathUtils.parseToMap(o, keyword.getDocumentValueContent()))); | ||
| 25 | + } | ||
| 26 | + }); | ||
| 27 | + res.put(keyword.getDocumentField(), list); | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + ; | ||
| 31 | + public final int value; | ||
| 32 | + public final String desc; | ||
| 33 | + | ||
| 34 | + DocumentFieldType(int value, String desc) { | ||
| 35 | + this.value = value; | ||
| 36 | + this.desc = desc; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public static DocumentFieldType from(int value) { | ||
| 40 | + for (DocumentFieldType type : DocumentFieldType.values()) { | ||
| 41 | + if (type.value == value) { | ||
| 42 | + return type; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + throw new IllegalArgumentException("Invalid DocumentFieldType value: " + value); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public abstract void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json); | ||
| 49 | +} |
tax-central/src/main/java/com/diligrp/tax/central/type/DocumentValueWayType.java
0 → 100644
| 1 | +package com.diligrp.tax.central.type; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.model.PipelineBusinessKeyword; | ||
| 4 | + | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author: zhangmeiyang | ||
| 9 | + * @CreateTime: 2025-11-18 10:18 | ||
| 10 | + * @Version: todo | ||
| 11 | + */ | ||
| 12 | +public enum DocumentValueWayType { | ||
| 13 | + FIX(1, "固定") { | ||
| 14 | + @Override | ||
| 15 | + public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { | ||
| 16 | + res.put(keyword.getDocumentField(), keyword.getDocumentValueContent()); | ||
| 17 | + } | ||
| 18 | + }, | ||
| 19 | + VARIABLE(2, "可变") { | ||
| 20 | + @Override | ||
| 21 | + public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { | ||
| 22 | + DocumentFieldType documentFieldTypeEnum = keyword.getDocumentFieldTypeEnum(); | ||
| 23 | + documentFieldTypeEnum.handleAdopt(res,keyword,json); | ||
| 24 | + } | ||
| 25 | + }, | ||
| 26 | + ; | ||
| 27 | + public final int value; | ||
| 28 | + public final String desc; | ||
| 29 | + | ||
| 30 | + DocumentValueWayType(int value, String desc) { | ||
| 31 | + this.value = value; | ||
| 32 | + this.desc = desc; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public static DocumentValueWayType from(int value) { | ||
| 36 | + for (DocumentValueWayType type : DocumentValueWayType.values()) { | ||
| 37 | + if (type.value == value) { | ||
| 38 | + return type; | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + throw new IllegalArgumentException("Invalid DocumentValueWayType value: " + value); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public abstract void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json); | ||
| 45 | +} |
tax-central/src/main/java/com/diligrp/tax/central/utils/AdoptUtils.java
0 → 100644
| 1 | +package com.diligrp.tax.central.utils; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.model.PipelineBusinessKeyword; | ||
| 4 | +import com.diligrp.tax.central.type.DocumentValueWayType; | ||
| 5 | + | ||
| 6 | +import java.util.*; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author: zhangmeiyang | ||
| 10 | + * @CreateTime: 2025-11-18 10:03 | ||
| 11 | + * @Version: todo | ||
| 12 | + */ | ||
| 13 | +public class AdoptUtils { | ||
| 14 | + | ||
| 15 | + public static Map<String, Object> handleAdopt(List<PipelineBusinessKeyword> pipelineBusinessKeywords, String json) { | ||
| 16 | + Map<String, Object> res = new HashMap<>(); | ||
| 17 | + List<PipelineBusinessKeyword> keywords = Optional.ofNullable(pipelineBusinessKeywords).orElse(new ArrayList<>()); | ||
| 18 | + keywords.forEach(keyword -> { | ||
| 19 | + DocumentValueWayType documentValueWayTypeEnum = keyword.getDocumentValueWayTypeEnum(); | ||
| 20 | + documentValueWayTypeEnum.handleAdopt(res, keyword, json); | ||
| 21 | + }); | ||
| 22 | + return res; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} |
tax-central/src/main/java/com/diligrp/tax/central/utils/JsonPathUtils.java
| @@ -2,8 +2,11 @@ package com.diligrp.tax.central.utils; | @@ -2,8 +2,11 @@ package com.diligrp.tax.central.utils; | ||
| 2 | 2 | ||
| 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 4 | import com.diligrp.tax.central.type.TaxSystemType; | 4 | import com.diligrp.tax.central.type.TaxSystemType; |
| 5 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
| 5 | import com.jayway.jsonpath.JsonPath; | 6 | import com.jayway.jsonpath.JsonPath; |
| 6 | 7 | ||
| 8 | +import java.util.HashMap; | ||
| 9 | +import java.util.Map; | ||
| 7 | import java.util.Optional; | 10 | import java.util.Optional; |
| 8 | 11 | ||
| 9 | /** | 12 | /** |
| @@ -18,4 +21,39 @@ public class JsonPathUtils { | @@ -18,4 +21,39 @@ public class JsonPathUtils { | ||
| 18 | Optional.ofNullable(dataPath).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.PARAMETER_IS_NOT_PARSED_CORRECTLY)); | 21 | Optional.ofNullable(dataPath).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.PARAMETER_IS_NOT_PARSED_CORRECTLY)); |
| 19 | return JsonPath.read(httpResult, dataPath).toString(); | 22 | return JsonPath.read(httpResult, dataPath).toString(); |
| 20 | } | 23 | } |
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 解析到map | ||
| 27 | + * | ||
| 28 | + * @param httpResult | ||
| 29 | + * @param dataPathMap 数据路径图 | ||
| 30 | + * @return {@link Map }<{@link String }, {@link Object }> | ||
| 31 | + */ | ||
| 32 | + public static Map<String, Object> parseToMap(String httpResult, Map<String, String> dataPathMap) { | ||
| 33 | + Map<String, Object> res = new HashMap<>(); | ||
| 34 | + Optional.ofNullable(httpResult).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL)); | ||
| 35 | + Optional.ofNullable(dataPathMap).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.PARAMETER_IS_NOT_PARSED_CORRECTLY)); | ||
| 36 | + dataPathMap.forEach((k, v) -> res.put(k, JsonPath.read(httpResult, v))); | ||
| 37 | + return res; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 解析到map | ||
| 42 | + * | ||
| 43 | + * @param resultObject 结果对象 | ||
| 44 | + * @param dataPathMapJson | ||
| 45 | + * @return {@link Map }<{@link String }, {@link Object }> | ||
| 46 | + */ | ||
| 47 | + public static Map<String, Object> parseToMap(Object resultObject, String dataPathMapJson) { | ||
| 48 | + Map<String, Object> res = new HashMap<>(); | ||
| 49 | + String httpResult = JsonUtils.toJsonString(resultObject); | ||
| 50 | + Map<String, String> dataPathMap = JsonUtils.fromJsonString(dataPathMapJson, new TypeReference<HashMap<String, String>>() { | ||
| 51 | + }); | ||
| 52 | + Optional.ofNullable(httpResult).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.REMOTE_SERVICE_CALLS_ARE_EXCEPTIONAL)); | ||
| 53 | + Optional.ofNullable(dataPathMap).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.PARAMETER_IS_NOT_PARSED_CORRECTLY)); | ||
| 54 | + dataPathMap.forEach((k, v) -> res.put(k, JsonPath.read(httpResult, v))); | ||
| 55 | + return res; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + | ||
| 21 | } | 59 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineBusinessKeyword.java
| @@ -4,15 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType; | @@ -4,15 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | import com.baomidou.mybatisplus.annotation.TableField; | 4 | import com.baomidou.mybatisplus.annotation.TableField; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | -import lombok.Data; | ||
| 8 | import lombok.Getter; | 7 | import lombok.Getter; |
| 9 | import lombok.Setter; | 8 | import lombok.Setter; |
| 10 | 9 | ||
| 11 | /** | 10 | /** |
| 12 | - * | ||
| 13 | * @TableName tax_pipeline_business_keyword | 11 | * @TableName tax_pipeline_business_keyword |
| 14 | */ | 12 | */ |
| 15 | -@TableName(value ="tax_pipeline_business_keyword") | 13 | +@TableName(value = "tax_pipeline_business_keyword") |
| 16 | @Getter | 14 | @Getter |
| 17 | @Setter | 15 | @Setter |
| 18 | public class TaxPipelineBusinessKeyword { | 16 | public class TaxPipelineBusinessKeyword { |
| @@ -41,6 +39,12 @@ public class TaxPipelineBusinessKeyword { | @@ -41,6 +39,12 @@ public class TaxPipelineBusinessKeyword { | ||
| 41 | private String documentField; | 39 | private String documentField; |
| 42 | 40 | ||
| 43 | /** | 41 | /** |
| 42 | + * 单据字段类型 | ||
| 43 | + */ | ||
| 44 | + @TableField(value = "document_field_type") | ||
| 45 | + private Integer documentFieldType; | ||
| 46 | + | ||
| 47 | + /** | ||
| 44 | * 单据字段取值方式(1:固定,2:可变) | 48 | * 单据字段取值方式(1:固定,2:可变) |
| 45 | */ | 49 | */ |
| 46 | @TableField(value = "document_value_way") | 50 | @TableField(value = "document_value_way") |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineBusinessKeywordCO.java
| @@ -34,6 +34,12 @@ public class TaxPipelineBusinessKeywordCO { | @@ -34,6 +34,12 @@ public class TaxPipelineBusinessKeywordCO { | ||
| 34 | private String documentField; | 34 | private String documentField; |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | + * 文档字段 | ||
| 38 | + */ | ||
| 39 | + @NotNull(groups = {Valid.Create.class}) | ||
| 40 | + private Integer documentFieldType; | ||
| 41 | + | ||
| 42 | + /** | ||
| 37 | * 文档值方式 | 43 | * 文档值方式 |
| 38 | */ | 44 | */ |
| 39 | @NotNull(groups = {Valid.Create.class}) | 45 | @NotNull(groups = {Valid.Create.class}) |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessKeywordVO.java
| @@ -28,6 +28,11 @@ public class TaxPipelineBusinessKeywordVO { | @@ -28,6 +28,11 @@ public class TaxPipelineBusinessKeywordVO { | ||
| 28 | private String documentField; | 28 | private String documentField; |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | + * 文档字段 | ||
| 32 | + */ | ||
| 33 | + private Integer documentFieldType; | ||
| 34 | + | ||
| 35 | + /** | ||
| 31 | * 文档值方式 | 36 | * 文档值方式 |
| 32 | */ | 37 | */ |
| 33 | private Integer documentValueWay; | 38 | private Integer documentValueWay; |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineBusinessConfigService.java
| @@ -4,16 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | @@ -4,16 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | import com.baomidou.mybatisplus.core.metadata.IPage; | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 6 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 6 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 7 | +import com.diligrp.tax.central.model.PipelineBusinessKeyword; | ||
| 8 | +import com.diligrp.tax.central.service.ITaxPipelineBusinessKeywordService; | ||
| 9 | +import com.diligrp.tax.central.type.DocumentFieldType; | ||
| 7 | import com.diligrp.tax.central.type.DocumentType; | 10 | import com.diligrp.tax.central.type.DocumentType; |
| 11 | +import com.diligrp.tax.central.type.DocumentValueWayType; | ||
| 8 | import com.diligrp.tax.central.type.TaxSystemType; | 12 | import com.diligrp.tax.central.type.TaxSystemType; |
| 9 | import com.diligrp.tax.central.utils.JsonUtils; | 13 | import com.diligrp.tax.central.utils.JsonUtils; |
| 10 | import com.diligrp.tax.storage.api.response.PipelineBusinessResponse; | 14 | import com.diligrp.tax.storage.api.response.PipelineBusinessResponse; |
| 11 | import com.diligrp.tax.storage.domain.*; | 15 | import com.diligrp.tax.storage.domain.*; |
| 12 | import com.diligrp.tax.storage.model.co.*; | 16 | import com.diligrp.tax.storage.model.co.*; |
| 13 | -import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessConfigVO; | ||
| 14 | -import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessExtVO; | ||
| 15 | -import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessKeywordVO; | ||
| 16 | -import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessVO; | 17 | +import com.diligrp.tax.storage.model.vo.*; |
| 17 | import com.diligrp.tax.storage.repo.*; | 18 | import com.diligrp.tax.storage.repo.*; |
| 18 | import jakarta.annotation.Resource; | 19 | import jakarta.annotation.Resource; |
| 19 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| @@ -28,7 +29,7 @@ import java.util.Optional; | @@ -28,7 +29,7 @@ import java.util.Optional; | ||
| 28 | * @Version: todo | 29 | * @Version: todo |
| 29 | */ | 30 | */ |
| 30 | @Service | 31 | @Service |
| 31 | -public class TaxPipelineBusinessConfigService { | 32 | +public class TaxPipelineBusinessConfigService implements ITaxPipelineBusinessKeywordService { |
| 32 | 33 | ||
| 33 | @Resource | 34 | @Resource |
| 34 | private TaxPipelineBusinessConfigRepository taxPipelineBusinessConfigRepository; | 35 | private TaxPipelineBusinessConfigRepository taxPipelineBusinessConfigRepository; |
| @@ -44,6 +45,10 @@ public class TaxPipelineBusinessConfigService { | @@ -44,6 +45,10 @@ public class TaxPipelineBusinessConfigService { | ||
| 44 | 45 | ||
| 45 | @Resource | 46 | @Resource |
| 46 | private TaxPipelineBusinessKeywordRepository taxPipelineBusinessKeywordRepository; | 47 | private TaxPipelineBusinessKeywordRepository taxPipelineBusinessKeywordRepository; |
| 48 | + @Resource | ||
| 49 | + private TaxTenantService taxTenantService; | ||
| 50 | + @Resource | ||
| 51 | + private TaxPipelineService taxPipelineService; | ||
| 47 | 52 | ||
| 48 | /** | 53 | /** |
| 49 | * 保存业务类型 | 54 | * 保存业务类型 |
| @@ -265,17 +270,16 @@ public class TaxPipelineBusinessConfigService { | @@ -265,17 +270,16 @@ public class TaxPipelineBusinessConfigService { | ||
| 265 | @Transactional | 270 | @Transactional |
| 266 | public void batchSaveBusinessKeyword(List<TaxPipelineBusinessKeywordCO> cos) { | 271 | public void batchSaveBusinessKeyword(List<TaxPipelineBusinessKeywordCO> cos) { |
| 267 | Optional.ofNullable(cos).ifPresent(ts -> { | 272 | Optional.ofNullable(cos).ifPresent(ts -> { |
| 268 | - Long taxPipelineBusinessId = ts.getFirst().getTaxPipelineBusinessId(); | ||
| 269 | - LambdaQueryWrapper<TaxPipelineBusinessKeyword> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 270 | - queryWrapper.eq(TaxPipelineBusinessKeyword::getTaxPipelineBusinessId, taxPipelineBusinessId); | ||
| 271 | - taxPipelineBusinessKeywordRepository.delete(queryWrapper); | ||
| 272 | - ts.forEach(co -> { | ||
| 273 | - DocumentType.validateDocumentType(co.getDocumentType()); | ||
| 274 | - TaxPipelineBusinessKeyword taxPipelineBusinessKeyword = JsonUtils.convertValue(co, TaxPipelineBusinessKeyword.class); | ||
| 275 | - taxPipelineBusinessKeywordRepository.insert(taxPipelineBusinessKeyword); | ||
| 276 | - }); | ||
| 277 | - } | ||
| 278 | - ); | 273 | + Long taxPipelineBusinessId = ts.getFirst().getTaxPipelineBusinessId(); |
| 274 | + LambdaQueryWrapper<TaxPipelineBusinessKeyword> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 275 | + queryWrapper.eq(TaxPipelineBusinessKeyword::getTaxPipelineBusinessId, taxPipelineBusinessId); | ||
| 276 | + taxPipelineBusinessKeywordRepository.delete(queryWrapper); | ||
| 277 | + ts.forEach(co -> { | ||
| 278 | + DocumentType.validateDocumentType(co.getDocumentType()); | ||
| 279 | + TaxPipelineBusinessKeyword taxPipelineBusinessKeyword = JsonUtils.convertValue(co, TaxPipelineBusinessKeyword.class); | ||
| 280 | + taxPipelineBusinessKeywordRepository.insert(taxPipelineBusinessKeyword); | ||
| 281 | + }); | ||
| 282 | + }); | ||
| 279 | } | 283 | } |
| 280 | 284 | ||
| 281 | /** | 285 | /** |
| @@ -289,4 +293,33 @@ public class TaxPipelineBusinessConfigService { | @@ -289,4 +293,33 @@ public class TaxPipelineBusinessConfigService { | ||
| 289 | queryWrapper.eq(TaxPipelineBusinessKeyword::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | 293 | queryWrapper.eq(TaxPipelineBusinessKeyword::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); |
| 290 | return taxPipelineBusinessKeywordRepository.selectList(queryWrapper).stream().map(item -> JsonUtils.convertValue(item, TaxPipelineBusinessKeywordVO.class)).toList(); | 294 | return taxPipelineBusinessKeywordRepository.selectList(queryWrapper).stream().map(item -> JsonUtils.convertValue(item, TaxPipelineBusinessKeywordVO.class)).toList(); |
| 291 | } | 295 | } |
| 296 | + | ||
| 297 | + | ||
| 298 | + /** | ||
| 299 | + * 按租户、管道和业务查询 | ||
| 300 | + * | ||
| 301 | + * @param group 群 | ||
| 302 | + * @param entity 实体 | ||
| 303 | + * @param pipelineCode 管道代码 | ||
| 304 | + * @param businessCode 业务代码 | ||
| 305 | + * @return {@link List }<{@link PipelineBusinessKeyword }> | ||
| 306 | + */ | ||
| 307 | + @Override | ||
| 308 | + public List<PipelineBusinessKeyword> queryByTenantAndPipelineAndBusiness(String group, String entity, String pipelineCode, String businessCode) { | ||
| 309 | + Long tenantId = taxTenantService.getTenantId(group, entity); | ||
| 310 | + TaxPipelineVO byTenantIdAndCode = taxPipelineService.getByTenantIdAndCode(tenantId, pipelineCode); | ||
| 311 | + LambdaQueryWrapper<TaxPipelineBusiness> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 312 | + queryWrapper.eq(TaxPipelineBusiness::getPipelineId, byTenantIdAndCode.getId()); | ||
| 313 | + queryWrapper.eq(TaxPipelineBusiness::getBusinessCode, businessCode); | ||
| 314 | + TaxPipelineBusiness taxPipelineBusiness = taxPipelineBusinessRepository.selectOne(queryWrapper); | ||
| 315 | + Optional.ofNullable(taxPipelineBusiness).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION)); | ||
| 316 | + LambdaQueryWrapper<TaxPipelineBusinessKeyword> wrapper = new LambdaQueryWrapper<>(); | ||
| 317 | + wrapper.eq(TaxPipelineBusinessKeyword::getTaxPipelineBusinessId, taxPipelineBusiness.getId()); | ||
| 318 | + return taxPipelineBusinessKeywordRepository.selectList(wrapper).stream().map(item -> { | ||
| 319 | + PipelineBusinessKeyword pipelineBusinessKeyword = JsonUtils.convertValue(item, PipelineBusinessKeyword.class); | ||
| 320 | + pipelineBusinessKeyword.setDocumentFieldTypeEnum(DocumentFieldType.from(item.getDocumentFieldType())); | ||
| 321 | + pipelineBusinessKeyword.setDocumentValueWayTypeEnum(DocumentValueWayType.from(item.getDocumentValueWay())); | ||
| 322 | + return pipelineBusinessKeyword; | ||
| 323 | + }).toList(); | ||
| 324 | + } | ||
| 292 | } | 325 | } |