Commit e8cc8b30b9d4aa4546f1163f90cc0b96562342a3
1 parent
a5d09a5d
feat(storage): 新增业务流水线配置功能
- 新增业务流水线API接口,支持获取商家信息 - 新增业务流水线请求与响应模型类 - 实现业务流水线服务逻辑,包括参数校验与异常处理 - 扩展业务配置相关实体类及数据访问层- 增加业务扩展信息的增删改查功能 - 完善业务流水线配置重复性校验逻辑 - 提供根据租户ID和编码查询流水线信息方法
Showing
18 changed files
with
677 additions
and
10 deletions
tax-storage/src/main/java/com/diligrp/tax/storage/api/PipelineBusinessApi.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.api; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.api.request.PipelineBusinessRequest; | ||
| 4 | +import com.diligrp.tax.storage.api.service.PipelineBusinessService; | ||
| 5 | +import com.diligrp.tax.storage.message.Message; | ||
| 6 | +import jakarta.annotation.Resource; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @Author: zhangmeiyang | ||
| 13 | + * @CreateTime: 2025-11-13 18:14 | ||
| 14 | + * @Version: todo | ||
| 15 | + */ | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("remote/tax/pipeline/info") | ||
| 18 | +public class PipelineBusinessApi { | ||
| 19 | + | ||
| 20 | + @Resource | ||
| 21 | + private PipelineBusinessService pipelineBusinessService; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 获取商家信息 | ||
| 25 | + * | ||
| 26 | + * @param request 请求 | ||
| 27 | + * @return {@link Message }<{@link ? }> | ||
| 28 | + */ | ||
| 29 | + @RequestMapping("getBusinessInfo") | ||
| 30 | + public Message<?> getBusinessInfo(@RequestBody PipelineBusinessRequest request) { | ||
| 31 | + return Message.success(pipelineBusinessService.getBusinessInfo(request)); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/api/request/PipelineBusinessRequest.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.api.request; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotEmpty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Author: zhangmeiyang | ||
| 8 | + * @CreateTime: 2025-11-13 18:17 | ||
| 9 | + * @Version: todo | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +public class PipelineBusinessRequest { | ||
| 13 | + @NotEmpty | ||
| 14 | + private String group; | ||
| 15 | + @NotEmpty | ||
| 16 | + private String entity; | ||
| 17 | + @NotEmpty | ||
| 18 | + private String pipelineCode; | ||
| 19 | + @NotEmpty | ||
| 20 | + private String systemType; | ||
| 21 | + @NotEmpty | ||
| 22 | + private String businessCode; | ||
| 23 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/api/response/PipelineBusinessResponse.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.api.response; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.type.DocumentType; | ||
| 4 | +import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessExtVO; | ||
| 5 | +import lombok.Getter; | ||
| 6 | +import lombok.Setter; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author: zhangmeiyang | ||
| 12 | + * @CreateTime: 2025-11-13 18:21 | ||
| 13 | + * @Version: todo | ||
| 14 | + */ | ||
| 15 | +@Getter | ||
| 16 | +@Setter | ||
| 17 | +public class PipelineBusinessResponse { | ||
| 18 | + /** | ||
| 19 | + * | ||
| 20 | + */ | ||
| 21 | + private Long id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 账套ID | ||
| 25 | + */ | ||
| 26 | + private Long pipelineId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 业务代码 | ||
| 30 | + */ | ||
| 31 | + private String businessCode; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 业务名称 | ||
| 35 | + */ | ||
| 36 | + private String businessName; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 配置 | ||
| 40 | + */ | ||
| 41 | + private List<String> configs; | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 业务扩展 | ||
| 46 | + */ | ||
| 47 | + private List<TaxPipelineBusinessExtVO> businessExt; | ||
| 48 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/api/service/PipelineBusinessService.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.api.service; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 4 | +import com.diligrp.tax.central.type.SystemType; | ||
| 5 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 6 | +import com.diligrp.tax.storage.api.request.PipelineBusinessRequest; | ||
| 7 | +import com.diligrp.tax.storage.api.response.PipelineBusinessResponse; | ||
| 8 | +import com.diligrp.tax.storage.model.vo.TaxPipelineVO; | ||
| 9 | +import com.diligrp.tax.storage.model.vo.TaxTenantVO; | ||
| 10 | +import com.diligrp.tax.storage.service.TaxPipelineBusinessConfigService; | ||
| 11 | +import com.diligrp.tax.storage.service.TaxPipelineService; | ||
| 12 | +import com.diligrp.tax.storage.service.TaxTenantService; | ||
| 13 | +import jakarta.annotation.Resource; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | + | ||
| 16 | +import java.util.Objects; | ||
| 17 | +import java.util.Optional; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @Author: zhangmeiyang | ||
| 21 | + * @CreateTime: 2025-11-13 18:22 | ||
| 22 | + * @Version: todo | ||
| 23 | + */ | ||
| 24 | +@Service | ||
| 25 | +public class PipelineBusinessService { | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + private TaxTenantService taxTenantService; | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private TaxPipelineService taxPipelineService; | ||
| 32 | + | ||
| 33 | + @Resource | ||
| 34 | + private TaxPipelineBusinessConfigService taxPipelineBusinessConfigService; | ||
| 35 | + | ||
| 36 | + public PipelineBusinessResponse getBusinessInfo(PipelineBusinessRequest request) { | ||
| 37 | + TaxTenantVO tenant = taxTenantService.getTenant(request.getGroup(), request.getEntity()); | ||
| 38 | + TaxPipelineVO taxPipelineVO = taxPipelineService.getByTenantIdAndCode(tenant.getId(), request.getPipelineCode()); | ||
| 39 | + Optional.ofNullable(request.getSystemType()).ifPresent(SystemType::validateSystemCode); | ||
| 40 | + if (!Objects.equals(SystemType.from(request.getSystemType()), SystemType.from(taxPipelineVO.getSystemCode()))) { | ||
| 41 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, "系统类型不匹配"); | ||
| 42 | + } | ||
| 43 | + return taxPipelineBusinessConfigService.getByPipelineIdAndBusinessCode(taxPipelineVO.getId(), request.getBusinessCode()); | ||
| 44 | + } | ||
| 45 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/controller/TaxPipelineBusinessConfigController.java
| @@ -4,6 +4,8 @@ import com.diligrp.tax.storage.Valid; | @@ -4,6 +4,8 @@ import com.diligrp.tax.storage.Valid; | ||
| 4 | import com.diligrp.tax.storage.message.Message; | 4 | import com.diligrp.tax.storage.message.Message; |
| 5 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessCO; | 5 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessCO; |
| 6 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; | 6 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; |
| 7 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessExtCO; | ||
| 8 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessExtDefaultDataCO; | ||
| 7 | import com.diligrp.tax.storage.service.TaxPipelineBusinessConfigService; | 9 | import com.diligrp.tax.storage.service.TaxPipelineBusinessConfigService; |
| 8 | import jakarta.annotation.Resource; | 10 | import jakarta.annotation.Resource; |
| 9 | import org.springframework.validation.annotation.Validated; | 11 | import org.springframework.validation.annotation.Validated; |
| @@ -83,4 +85,64 @@ public class TaxPipelineBusinessConfigController { | @@ -83,4 +85,64 @@ public class TaxPipelineBusinessConfigController { | ||
| 83 | taxPipelineBusinessConfigService.saveBusinessDocument(co); | 85 | taxPipelineBusinessConfigService.saveBusinessDocument(co); |
| 84 | return Message.success(); | 86 | return Message.success(); |
| 85 | } | 87 | } |
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 保存业务扩展信息 | ||
| 91 | + * | ||
| 92 | + * @param co 公司 | ||
| 93 | + * @return {@link Message }<{@link ? }> | ||
| 94 | + */ | ||
| 95 | + @RequestMapping("/ext/saveBusinessExt") | ||
| 96 | + public Message<?> saveBusinessExt(@RequestBody @Validated(value = Valid.Create.class) TaxPipelineBusinessExtCO co) { | ||
| 97 | + taxPipelineBusinessConfigService.saveBusinessExt(co); | ||
| 98 | + return Message.success(); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 设置业务分机数据 | ||
| 103 | + * | ||
| 104 | + * @param co 公司 | ||
| 105 | + * @return {@link Message }<{@link ? }> | ||
| 106 | + */ | ||
| 107 | + @RequestMapping("/ext/updateBusinessExt") | ||
| 108 | + public Message<?> setBusinessExtData(@RequestBody @Validated(value = Valid.Update.class) TaxPipelineBusinessExtCO co) { | ||
| 109 | + taxPipelineBusinessConfigService.updateBusinessExt(co); | ||
| 110 | + return Message.success(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 设置默认业务扩展数据 | ||
| 115 | + * | ||
| 116 | + * @param co 公司 | ||
| 117 | + * @return {@link Message }<{@link ? }> | ||
| 118 | + */ | ||
| 119 | + @RequestMapping("/ext/setDefaultBusinessExtData") | ||
| 120 | + public Message<?> setDefaultBusinessExtData(@RequestBody @Validated(value = Valid.Update.class) TaxPipelineBusinessExtDefaultDataCO co) { | ||
| 121 | + taxPipelineBusinessConfigService.setDefaultBusinessExtData(co); | ||
| 122 | + return Message.success(); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 删除业务扩展 | ||
| 127 | + * | ||
| 128 | + * @param co 公司 | ||
| 129 | + * @return {@link Message }<{@link ? }> | ||
| 130 | + */ | ||
| 131 | + @RequestMapping("/ext/deleteBusinessExt") | ||
| 132 | + public Message<?> deleteBusinessExt(@RequestBody @Validated(value = Valid.Update.class) TaxPipelineBusinessExtCO co) { | ||
| 133 | + taxPipelineBusinessConfigService.deleteBusinessExt(co); | ||
| 134 | + return Message.success(); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * 刷新业务分机数据 | ||
| 139 | + * | ||
| 140 | + * @param co 公司 | ||
| 141 | + * @return {@link Message }<{@link ? }> | ||
| 142 | + */ | ||
| 143 | + @RequestMapping("/ext/refreshBusinessExtData") | ||
| 144 | + public Message<?> refreshBusinessExtData(@RequestBody @Validated(value = Valid.Update.class) TaxPipelineBusinessExtCO co) { | ||
| 145 | + taxPipelineBusinessConfigService.refreshBusinessExtData(co); | ||
| 146 | + return Message.success(); | ||
| 147 | + } | ||
| 86 | } | 148 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineBusinessExt.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_business_ext | ||
| 13 | + */ | ||
| 14 | +@TableName(value ="tax_pipeline_business_ext") | ||
| 15 | +@Data | ||
| 16 | +public class TaxPipelineBusinessExt { | ||
| 17 | + /** | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + @TableId(type = IdType.AUTO) | ||
| 21 | + private Long id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 业务ID | ||
| 25 | + */ | ||
| 26 | + @TableField(value = "tax_pipeline_business_id") | ||
| 27 | + private Long taxPipelineBusinessId; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 扩展名字 | ||
| 31 | + */ | ||
| 32 | + @TableField(value = "ext_name") | ||
| 33 | + private String extName; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 扩展编码 | ||
| 37 | + */ | ||
| 38 | + @TableField(value = "ext_code") | ||
| 39 | + private String extCode; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 扩展默认数据 | ||
| 43 | + */ | ||
| 44 | + @TableField(value = "ext_default_data") | ||
| 45 | + private String extDefaultData; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 创建时间 | ||
| 49 | + */ | ||
| 50 | + @TableField(value = "created_time") | ||
| 51 | + private LocalDateTime createdTime; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 更新时间 | ||
| 55 | + */ | ||
| 56 | + @TableField(value = "modified_time") | ||
| 57 | + private LocalDateTime modifiedTime; | ||
| 58 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineBusinessExtData.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_business_ext_data | ||
| 15 | + */ | ||
| 16 | +@TableName(value = "tax_pipeline_business_ext_data") | ||
| 17 | +@Data | ||
| 18 | +public class TaxPipelineBusinessExtData { | ||
| 19 | + /** | ||
| 20 | + * | ||
| 21 | + */ | ||
| 22 | + @TableId(type = IdType.AUTO) | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 业务扩展表ID | ||
| 27 | + */ | ||
| 28 | + @TableField(value = "tax_pipeline_business_ext_id") | ||
| 29 | + private Long taxPipelineBusinessExtId; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 扩展数据 | ||
| 33 | + */ | ||
| 34 | + @TableField(value = "ext_data") | ||
| 35 | + private String extData; | ||
| 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/model/co/TaxPipelineBusinessCO.java
| @@ -4,14 +4,16 @@ import com.diligrp.tax.storage.Valid; | @@ -4,14 +4,16 @@ import com.diligrp.tax.storage.Valid; | ||
| 4 | import com.diligrp.tax.storage.message.PageQuery; | 4 | import com.diligrp.tax.storage.message.PageQuery; |
| 5 | import jakarta.validation.constraints.NotEmpty; | 5 | import jakarta.validation.constraints.NotEmpty; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | -import lombok.Data; | 7 | +import lombok.Getter; |
| 8 | +import lombok.Setter; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * 账套业务配置 | 11 | * 账套业务配置 |
| 11 | * | 12 | * |
| 12 | * @TableName tax_pipeline_business | 13 | * @TableName tax_pipeline_business |
| 13 | */ | 14 | */ |
| 14 | -@Data | 15 | +@Getter |
| 16 | +@Setter | ||
| 15 | public class TaxPipelineBusinessCO extends PageQuery { | 17 | public class TaxPipelineBusinessCO extends PageQuery { |
| 16 | /** | 18 | /** |
| 17 | * | 19 | * |
| @@ -22,7 +24,7 @@ public class TaxPipelineBusinessCO extends PageQuery { | @@ -22,7 +24,7 @@ public class TaxPipelineBusinessCO extends PageQuery { | ||
| 22 | /** | 24 | /** |
| 23 | * 账套ID | 25 | * 账套ID |
| 24 | */ | 26 | */ |
| 25 | - @NotNull(groups = {Valid.Read.class}) | 27 | + @NotNull(groups = {Valid.Create.class, Valid.Update.class, Valid.Read.class}) |
| 26 | private Long pipelineId; | 28 | private Long pipelineId; |
| 27 | 29 | ||
| 28 | /** | 30 | /** |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineBusinessConfigCO.java
| @@ -3,7 +3,8 @@ package com.diligrp.tax.storage.model.co; | @@ -3,7 +3,8 @@ package com.diligrp.tax.storage.model.co; | ||
| 3 | import com.diligrp.tax.storage.Valid; | 3 | import com.diligrp.tax.storage.Valid; |
| 4 | import jakarta.validation.constraints.NotEmpty; | 4 | import jakarta.validation.constraints.NotEmpty; |
| 5 | import jakarta.validation.constraints.NotNull; | 5 | import jakarta.validation.constraints.NotNull; |
| 6 | -import lombok.Data; | 6 | +import lombok.Getter; |
| 7 | +import lombok.Setter; | ||
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| @@ -12,7 +13,8 @@ import java.util.List; | @@ -12,7 +13,8 @@ import java.util.List; | ||
| 12 | * | 13 | * |
| 13 | * @TableName tax_pipeline_business_config | 14 | * @TableName tax_pipeline_business_config |
| 14 | */ | 15 | */ |
| 15 | -@Data | 16 | +@Getter |
| 17 | +@Setter | ||
| 16 | public class TaxPipelineBusinessConfigCO { | 18 | public class TaxPipelineBusinessConfigCO { |
| 17 | /** | 19 | /** |
| 18 | * | 20 | * |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineBusinessExtCO.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.co; | ||
| 2 | + | ||
| 3 | +import com.diligrp.tax.storage.Valid; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Getter; | ||
| 7 | +import lombok.Setter; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @Author: zhangmeiyang | ||
| 13 | + * @CreateTime: 2025-11-13 17:50 | ||
| 14 | + * @Version: todo | ||
| 15 | + */ | ||
| 16 | +@Getter | ||
| 17 | +@Setter | ||
| 18 | +public class TaxPipelineBusinessExtCO { | ||
| 19 | + | ||
| 20 | + @NotNull(groups = {Valid.Update.class}) | ||
| 21 | + private Long id; | ||
| 22 | + /** | ||
| 23 | + * 业务ID | ||
| 24 | + */ | ||
| 25 | + @NotNull(groups = {Valid.Create.class, Valid.Update.class}) | ||
| 26 | + private Long taxPipelineBusinessId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 扩展名字 | ||
| 30 | + */ | ||
| 31 | + @NotEmpty(groups = {Valid.Create.class}) | ||
| 32 | + private String extName; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 扩展编码 | ||
| 36 | + */ | ||
| 37 | + @NotEmpty(groups = {Valid.Create.class}) | ||
| 38 | + private String extCode; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 扩展可选数据 | ||
| 42 | + */ | ||
| 43 | + @NotEmpty(groups = {Valid.Create.class, Valid.Update.class}) | ||
| 44 | + private List<String> extDatas; | ||
| 45 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineBusinessExtDefaultDataCO.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.co; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotEmpty; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Getter; | ||
| 6 | +import lombok.Setter; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author: zhangmeiyang | ||
| 10 | + * @CreateTime: 2025-11-13 17:50 | ||
| 11 | + * @Version: todo | ||
| 12 | + */ | ||
| 13 | +@Getter | ||
| 14 | +@Setter | ||
| 15 | +public class TaxPipelineBusinessExtDefaultDataCO { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * id | ||
| 19 | + */ | ||
| 20 | + @NotNull | ||
| 21 | + private Long id; | ||
| 22 | + /** | ||
| 23 | + * 业务ID | ||
| 24 | + */ | ||
| 25 | + @NotNull | ||
| 26 | + private Long taxPipelineBusinessId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 扩展默认数据 | ||
| 30 | + */ | ||
| 31 | + @NotEmpty | ||
| 32 | + private String extDefaultData; | ||
| 33 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessConfigVO.java
| 1 | package com.diligrp.tax.storage.model.vo; | 1 | package com.diligrp.tax.storage.model.vo; |
| 2 | 2 | ||
| 3 | -import lombok.Data; | 3 | +import lombok.Getter; |
| 4 | +import lombok.Setter; | ||
| 4 | 5 | ||
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 6 | 7 | ||
| 7 | -@Data | 8 | +@Getter |
| 9 | +@Setter | ||
| 8 | public class TaxPipelineBusinessConfigVO { | 10 | public class TaxPipelineBusinessConfigVO { |
| 9 | /** | 11 | /** |
| 10 | * | 12 | * |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessExtVO.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.vo; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | +import lombok.Setter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 账套业务配置 | ||
| 8 | + * | ||
| 9 | + * @TableName tax_pipeline_business_ext | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@Setter | ||
| 13 | +public class TaxPipelineBusinessExtVO { | ||
| 14 | + /** | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 业务ID | ||
| 21 | + */ | ||
| 22 | + private Long taxPipelineBusinessId; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 扩展名字 | ||
| 26 | + */ | ||
| 27 | + private String extName; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 扩展编码 | ||
| 31 | + */ | ||
| 32 | + private String extCode; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 扩展默认数据 | ||
| 36 | + */ | ||
| 37 | + private String extDefaultData; | ||
| 38 | +} |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessVO.java
| 1 | package com.diligrp.tax.storage.model.vo; | 1 | package com.diligrp.tax.storage.model.vo; |
| 2 | 2 | ||
| 3 | -import lombok.Data; | 3 | +import lombok.Getter; |
| 4 | +import lombok.Setter; | ||
| 4 | 5 | ||
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 6 | import java.util.List; | 7 | import java.util.List; |
| @@ -10,7 +11,8 @@ import java.util.List; | @@ -10,7 +11,8 @@ import java.util.List; | ||
| 10 | * | 11 | * |
| 11 | * @TableName tax_pipeline_business | 12 | * @TableName tax_pipeline_business |
| 12 | */ | 13 | */ |
| 13 | -@Data | 14 | +@Getter |
| 15 | +@Setter | ||
| 14 | public class TaxPipelineBusinessVO { | 16 | public class TaxPipelineBusinessVO { |
| 15 | /** | 17 | /** |
| 16 | * | 18 | * |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineBusinessExtDataRepository.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.TaxPipelineBusinessExtData; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author dili | ||
| 9 | + * @description 针对表【tax_pipeline_business_ext(账套业务配置)】的数据库操作Mapper | ||
| 10 | + * @createDate 2025-11-13 17:38:05 | ||
| 11 | + * @Entity com.diligrp.tax.storage.domain.TaxPipelineBusinessExt | ||
| 12 | + */ | ||
| 13 | +@Repository | ||
| 14 | +public interface TaxPipelineBusinessExtDataRepository extends BaseMapper<TaxPipelineBusinessExtData> { | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineBusinessExtRepository.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.TaxPipelineBusinessExt; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author dili | ||
| 9 | + * @description 针对表【tax_pipeline_business_ext(账套业务配置)】的数据库操作Mapper | ||
| 10 | + * @createDate 2025-11-13 17:38:05 | ||
| 11 | + * @Entity com.diligrp.tax.storage.domain.TaxPipelineBusinessExt | ||
| 12 | + */ | ||
| 13 | +@Repository | ||
| 14 | +public interface TaxPipelineBusinessExtRepository extends BaseMapper<TaxPipelineBusinessExt> { | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineBusinessConfigService.java
| @@ -3,21 +3,32 @@ package com.diligrp.tax.storage.service; | @@ -3,21 +3,32 @@ package com.diligrp.tax.storage.service; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | 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.type.DocumentType; | 7 | import com.diligrp.tax.central.type.DocumentType; |
| 8 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 7 | import com.diligrp.tax.central.utils.JsonUtils; | 9 | import com.diligrp.tax.central.utils.JsonUtils; |
| 10 | +import com.diligrp.tax.storage.api.response.PipelineBusinessResponse; | ||
| 8 | import com.diligrp.tax.storage.domain.TaxPipelineBusiness; | 11 | import com.diligrp.tax.storage.domain.TaxPipelineBusiness; |
| 9 | import com.diligrp.tax.storage.domain.TaxPipelineBusinessConfig; | 12 | import com.diligrp.tax.storage.domain.TaxPipelineBusinessConfig; |
| 13 | +import com.diligrp.tax.storage.domain.TaxPipelineBusinessExt; | ||
| 14 | +import com.diligrp.tax.storage.domain.TaxPipelineBusinessExtData; | ||
| 10 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessCO; | 15 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessCO; |
| 11 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; | 16 | import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; |
| 17 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessExtCO; | ||
| 18 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessExtDefaultDataCO; | ||
| 12 | import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessConfigVO; | 19 | import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessConfigVO; |
| 20 | +import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessExtVO; | ||
| 13 | import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessVO; | 21 | import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessVO; |
| 14 | import com.diligrp.tax.storage.repo.TaxPipelineBusinessConfigRepository; | 22 | import com.diligrp.tax.storage.repo.TaxPipelineBusinessConfigRepository; |
| 23 | +import com.diligrp.tax.storage.repo.TaxPipelineBusinessExtDataRepository; | ||
| 24 | +import com.diligrp.tax.storage.repo.TaxPipelineBusinessExtRepository; | ||
| 15 | import com.diligrp.tax.storage.repo.TaxPipelineBusinessRepository; | 25 | import com.diligrp.tax.storage.repo.TaxPipelineBusinessRepository; |
| 16 | import jakarta.annotation.Resource; | 26 | import jakarta.annotation.Resource; |
| 17 | import org.springframework.stereotype.Service; | 27 | import org.springframework.stereotype.Service; |
| 18 | import org.springframework.transaction.annotation.Transactional; | 28 | import org.springframework.transaction.annotation.Transactional; |
| 19 | 29 | ||
| 20 | import java.util.List; | 30 | import java.util.List; |
| 31 | +import java.util.Optional; | ||
| 21 | 32 | ||
| 22 | /** | 33 | /** |
| 23 | * @Author: zhangmeiyang | 34 | * @Author: zhangmeiyang |
| @@ -33,6 +44,12 @@ public class TaxPipelineBusinessConfigService { | @@ -33,6 +44,12 @@ public class TaxPipelineBusinessConfigService { | ||
| 33 | @Resource | 44 | @Resource |
| 34 | private TaxPipelineBusinessRepository taxPipelineBusinessRepository; | 45 | private TaxPipelineBusinessRepository taxPipelineBusinessRepository; |
| 35 | 46 | ||
| 47 | + @Resource | ||
| 48 | + private TaxPipelineBusinessExtRepository taxPipelineBusinessExtRepository; | ||
| 49 | + | ||
| 50 | + @Resource | ||
| 51 | + private TaxPipelineBusinessExtDataRepository taxPipelineBusinessExtDataRepository; | ||
| 52 | + | ||
| 36 | /** | 53 | /** |
| 37 | * 保存业务类型 | 54 | * 保存业务类型 |
| 38 | * | 55 | * |
| @@ -40,6 +57,12 @@ public class TaxPipelineBusinessConfigService { | @@ -40,6 +57,12 @@ public class TaxPipelineBusinessConfigService { | ||
| 40 | */ | 57 | */ |
| 41 | @Transactional | 58 | @Transactional |
| 42 | public void saveBusiness(TaxPipelineBusinessCO co) { | 59 | public void saveBusiness(TaxPipelineBusinessCO co) { |
| 60 | + LambdaQueryWrapper<TaxPipelineBusiness> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 61 | + queryWrapper.eq(TaxPipelineBusiness::getPipelineId, co.getPipelineId()); | ||
| 62 | + queryWrapper.eq(TaxPipelineBusiness::getBusinessCode, co.getBusinessCode()); | ||
| 63 | + Optional.ofNullable(taxPipelineBusinessRepository.selectOne(queryWrapper)).ifPresent(taxPipelineBusiness -> { | ||
| 64 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, "业务编码重复"); | ||
| 65 | + }); | ||
| 43 | taxPipelineBusinessRepository.insert(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); | 66 | taxPipelineBusinessRepository.insert(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); |
| 44 | } | 67 | } |
| 45 | 68 | ||
| @@ -50,6 +73,12 @@ public class TaxPipelineBusinessConfigService { | @@ -50,6 +73,12 @@ public class TaxPipelineBusinessConfigService { | ||
| 50 | */ | 73 | */ |
| 51 | @Transactional | 74 | @Transactional |
| 52 | public void updateBusiness(TaxPipelineBusinessCO co) { | 75 | public void updateBusiness(TaxPipelineBusinessCO co) { |
| 76 | + LambdaQueryWrapper<TaxPipelineBusiness> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 77 | + queryWrapper.eq(TaxPipelineBusiness::getPipelineId, co.getPipelineId()); | ||
| 78 | + queryWrapper.eq(TaxPipelineBusiness::getBusinessCode, co.getBusinessCode()); | ||
| 79 | + Optional.ofNullable(taxPipelineBusinessRepository.selectOne(queryWrapper)).ifPresent(taxPipelineBusiness -> { | ||
| 80 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, "业务编码重复"); | ||
| 81 | + }); | ||
| 53 | taxPipelineBusinessRepository.updateById(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); | 82 | taxPipelineBusinessRepository.updateById(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); |
| 54 | } | 83 | } |
| 55 | 84 | ||
| @@ -104,4 +133,132 @@ public class TaxPipelineBusinessConfigService { | @@ -104,4 +133,132 @@ public class TaxPipelineBusinessConfigService { | ||
| 104 | taxPipelineBusinessConfigRepository.insert(save); | 133 | taxPipelineBusinessConfigRepository.insert(save); |
| 105 | }); | 134 | }); |
| 106 | } | 135 | } |
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * 保存业务文档扩展 | ||
| 139 | + * | ||
| 140 | + * @param co 公司 | ||
| 141 | + */ | ||
| 142 | + @Transactional | ||
| 143 | + public void saveBusinessExt(TaxPipelineBusinessExtCO co) { | ||
| 144 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 145 | + queryWrapper.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | ||
| 146 | + queryWrapper.eq(TaxPipelineBusinessExt::getExtCode, co.getExtCode()); | ||
| 147 | + TaxPipelineBusinessExt taxPipelineBusinessExt1 = taxPipelineBusinessExtRepository.selectOne(queryWrapper); | ||
| 148 | + Optional.ofNullable(taxPipelineBusinessExt1).ifPresent(taxPipelineBusinessExt -> { | ||
| 149 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS, "业务扩展编码重复"); | ||
| 150 | + }); | ||
| 151 | + TaxPipelineBusinessExt taxPipelineBusinessExt = JsonUtils.convertValue(co, TaxPipelineBusinessExt.class); | ||
| 152 | + taxPipelineBusinessExtRepository.insert(taxPipelineBusinessExt); | ||
| 153 | + Optional.ofNullable(co.getExtDatas()).ifPresent(extDatas -> extDatas.forEach(e -> { | ||
| 154 | + var extData = new TaxPipelineBusinessExtData(); | ||
| 155 | + extData.setTaxPipelineBusinessExtId(taxPipelineBusinessExt.getId()); | ||
| 156 | + extData.setExtData(e); | ||
| 157 | + taxPipelineBusinessExtDataRepository.insert(extData); | ||
| 158 | + })); | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + /** | ||
| 162 | + * 更新业务扩展 | ||
| 163 | + * | ||
| 164 | + * @param co 公司 | ||
| 165 | + */ | ||
| 166 | + @Transactional | ||
| 167 | + public void updateBusinessExt(TaxPipelineBusinessExtCO co) { | ||
| 168 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 169 | + queryWrapper.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | ||
| 170 | + queryWrapper.eq(TaxPipelineBusinessExt::getId, co.getId()); | ||
| 171 | + TaxPipelineBusinessExt taxPipelineBusinessExt = taxPipelineBusinessExtRepository.selectOne(queryWrapper); | ||
| 172 | + Optional.ofNullable(taxPipelineBusinessExt).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "业务扩展信息不存在")); | ||
| 173 | + Optional.ofNullable(co.getExtName()).ifPresent(taxPipelineBusinessExt::setExtName); | ||
| 174 | + Optional.ofNullable(co.getExtCode()).ifPresent(taxPipelineBusinessExt::setExtCode); | ||
| 175 | + taxPipelineBusinessExtRepository.updateById(taxPipelineBusinessExt); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + /** | ||
| 179 | + * 设置默认业务扩展数据 | ||
| 180 | + * | ||
| 181 | + * @param co 公司 | ||
| 182 | + */ | ||
| 183 | + @Transactional | ||
| 184 | + public void setDefaultBusinessExtData(TaxPipelineBusinessExtDefaultDataCO co) { | ||
| 185 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 186 | + queryWrapper.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | ||
| 187 | + queryWrapper.eq(TaxPipelineBusinessExt::getId, co.getId()); | ||
| 188 | + TaxPipelineBusinessExt taxPipelineBusinessExt = taxPipelineBusinessExtRepository.selectOne(queryWrapper); | ||
| 189 | + Optional.ofNullable(taxPipelineBusinessExt).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "业务扩展信息不存在")); | ||
| 190 | + taxPipelineBusinessExt.setExtDefaultData(co.getExtDefaultData()); | ||
| 191 | + taxPipelineBusinessExtRepository.updateById(taxPipelineBusinessExt); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + /** | ||
| 195 | + * 删除业务扩展 | ||
| 196 | + * | ||
| 197 | + * @param co 公司 | ||
| 198 | + */ | ||
| 199 | + @Transactional | ||
| 200 | + public void deleteBusinessExt(TaxPipelineBusinessExtCO co) { | ||
| 201 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 202 | + queryWrapper.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | ||
| 203 | + queryWrapper.eq(TaxPipelineBusinessExt::getId, co.getId()); | ||
| 204 | + taxPipelineBusinessExtRepository.delete(queryWrapper); | ||
| 205 | + LambdaQueryWrapper<TaxPipelineBusinessExtData> extDataQueryWrapper = new LambdaQueryWrapper<>(); | ||
| 206 | + extDataQueryWrapper.eq(TaxPipelineBusinessExtData::getTaxPipelineBusinessExtId, co.getId()); | ||
| 207 | + taxPipelineBusinessExtDataRepository.delete(extDataQueryWrapper); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + /** | ||
| 211 | + * 刷新业务扩展数据 | ||
| 212 | + * | ||
| 213 | + * @param co 公司 | ||
| 214 | + */ | ||
| 215 | + @Transactional | ||
| 216 | + public void refreshBusinessExtData(TaxPipelineBusinessExtCO co) { | ||
| 217 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 218 | + queryWrapper.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | ||
| 219 | + queryWrapper.eq(TaxPipelineBusinessExt::getId, co.getId()); | ||
| 220 | + TaxPipelineBusinessExt taxPipelineBusinessExt = taxPipelineBusinessExtRepository.selectOne(queryWrapper); | ||
| 221 | + Optional.ofNullable(taxPipelineBusinessExt).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "业务扩展信息不存在")); | ||
| 222 | + LambdaQueryWrapper<TaxPipelineBusinessExtData> extDataQueryWrapper = new LambdaQueryWrapper<>(); | ||
| 223 | + extDataQueryWrapper.eq(TaxPipelineBusinessExtData::getTaxPipelineBusinessExtId, co.getId()); | ||
| 224 | + taxPipelineBusinessExtDataRepository.delete(extDataQueryWrapper); | ||
| 225 | + Optional.ofNullable(co.getExtDatas()).ifPresent(extDatas -> extDatas.forEach(e -> { | ||
| 226 | + var extData = new TaxPipelineBusinessExtData(); | ||
| 227 | + extData.setTaxPipelineBusinessExtId(co.getId()); | ||
| 228 | + extData.setExtData(e); | ||
| 229 | + taxPipelineBusinessExtDataRepository.insert(extData); | ||
| 230 | + })); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 按管道 ID 和业务代码获取 | ||
| 235 | + * | ||
| 236 | + * @param pipelineId 管道 ID | ||
| 237 | + * @param businessCode 业务代码 | ||
| 238 | + * @return {@link PipelineBusinessResponse } | ||
| 239 | + */ | ||
| 240 | + public PipelineBusinessResponse getByPipelineIdAndBusinessCode(Long pipelineId, String businessCode) { | ||
| 241 | + LambdaQueryWrapper<TaxPipelineBusiness> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 242 | + queryWrapper.eq(TaxPipelineBusiness::getPipelineId, pipelineId); | ||
| 243 | + queryWrapper.eq(TaxPipelineBusiness::getBusinessCode, businessCode); | ||
| 244 | + TaxPipelineBusiness taxPipelineBusiness = taxPipelineBusinessRepository.selectOne(queryWrapper); | ||
| 245 | + // 查询业务信息 | ||
| 246 | + Optional.ofNullable(taxPipelineBusiness).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "业务信息不存在")); | ||
| 247 | + LambdaQueryWrapper<TaxPipelineBusinessConfig> queryWrapper1 = new LambdaQueryWrapper<>(); | ||
| 248 | + queryWrapper1.eq(TaxPipelineBusinessConfig::getTaxPipelineBusinessId, taxPipelineBusiness.getId()); | ||
| 249 | + List<TaxPipelineBusinessConfig> taxPipelineBusinessConfigs = taxPipelineBusinessConfigRepository.selectList(queryWrapper1); | ||
| 250 | + // 获取业务配置单据信息 | ||
| 251 | + LambdaQueryWrapper<TaxPipelineBusinessExt> queryWrapper2 = new LambdaQueryWrapper<>(); | ||
| 252 | + queryWrapper2.eq(TaxPipelineBusinessExt::getTaxPipelineBusinessId, taxPipelineBusiness.getId()); | ||
| 253 | + List<TaxPipelineBusinessExt> taxPipelineBusinessExts = taxPipelineBusinessExtRepository.selectList(queryWrapper2); | ||
| 254 | + //获取业务扩展信息 | ||
| 255 | + PipelineBusinessResponse pipelineBusinessResponse = new PipelineBusinessResponse(); | ||
| 256 | + pipelineBusinessResponse.setId(taxPipelineBusiness.getId()); | ||
| 257 | + pipelineBusinessResponse.setPipelineId(taxPipelineBusiness.getPipelineId()); | ||
| 258 | + pipelineBusinessResponse.setBusinessCode(taxPipelineBusiness.getBusinessCode()); | ||
| 259 | + pipelineBusinessResponse.setBusinessName(taxPipelineBusiness.getBusinessName()); | ||
| 260 | + pipelineBusinessResponse.setConfigs(taxPipelineBusinessConfigs.stream().map(TaxPipelineBusinessConfig::getDocumentType).toList()); | ||
| 261 | + pipelineBusinessResponse.setBusinessExt(taxPipelineBusinessExts.stream().map(item -> JsonUtils.convertValue(item, TaxPipelineBusinessExtVO.class)).toList()); | ||
| 262 | + return pipelineBusinessResponse; | ||
| 263 | + } | ||
| 107 | } | 264 | } |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineService.java
| @@ -3,6 +3,7 @@ package com.diligrp.tax.storage.service; | @@ -3,6 +3,7 @@ package com.diligrp.tax.storage.service; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 4 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 5 | import com.diligrp.tax.central.type.SystemType; | 5 | import com.diligrp.tax.central.type.SystemType; |
| 6 | +import com.diligrp.tax.central.type.TaxSystemType; | ||
| 6 | import com.diligrp.tax.central.utils.JsonUtils; | 7 | import com.diligrp.tax.central.utils.JsonUtils; |
| 7 | import com.diligrp.tax.storage.domain.TaxPipeline; | 8 | import com.diligrp.tax.storage.domain.TaxPipeline; |
| 8 | import com.diligrp.tax.storage.model.co.TaxPipelineCO; | 9 | import com.diligrp.tax.storage.model.co.TaxPipelineCO; |
| @@ -11,6 +12,7 @@ import com.diligrp.tax.storage.model.vo.TaxTenantVO; | @@ -11,6 +12,7 @@ import com.diligrp.tax.storage.model.vo.TaxTenantVO; | ||
| 11 | import com.diligrp.tax.storage.repo.TaxPipelineRepository; | 12 | import com.diligrp.tax.storage.repo.TaxPipelineRepository; |
| 12 | import com.diligrp.tax.storage.type.StateType; | 13 | import com.diligrp.tax.storage.type.StateType; |
| 13 | import jakarta.annotation.Resource; | 14 | import jakarta.annotation.Resource; |
| 15 | +import jakarta.validation.constraints.NotEmpty; | ||
| 14 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 15 | import org.springframework.transaction.annotation.Transactional; | 17 | import org.springframework.transaction.annotation.Transactional; |
| 16 | 18 | ||
| @@ -40,6 +42,13 @@ public class TaxPipelineService { | @@ -40,6 +42,13 @@ public class TaxPipelineService { | ||
| 40 | @Transactional | 42 | @Transactional |
| 41 | public void save(TaxPipelineCO taxPipelineCO) { | 43 | public void save(TaxPipelineCO taxPipelineCO) { |
| 42 | TaxTenantVO tenant = taxTenantService.getTenant(taxPipelineCO.getGroup(), taxPipelineCO.getEntity()); | 44 | TaxTenantVO tenant = taxTenantService.getTenant(taxPipelineCO.getGroup(), taxPipelineCO.getEntity()); |
| 45 | + LambdaQueryWrapper<TaxPipeline> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 46 | + queryWrapper.eq(TaxPipeline::getTenantId, tenant.getId()); | ||
| 47 | + queryWrapper.eq(TaxPipeline::getCode, taxPipelineCO.getCode()); | ||
| 48 | + TaxPipeline taxPipeline1 = taxPipelineRepository.selectOne(queryWrapper); | ||
| 49 | + Optional.ofNullable(taxPipeline1).ifPresent(taxPipeline -> { | ||
| 50 | + throw new TaxAgentServiceException(TaxSystemType.ABNORMAL_PARAMETERS,"当前账套编码已存在"); | ||
| 51 | + }); | ||
| 43 | taxPipelineCO.setTenantId(tenant.getId()); | 52 | taxPipelineCO.setTenantId(tenant.getId()); |
| 44 | SystemType.validateSystemCode(taxPipelineCO.getSystemCode()); | 53 | SystemType.validateSystemCode(taxPipelineCO.getSystemCode()); |
| 45 | TaxPipeline taxPipeline = JsonUtils.convertValue(taxPipelineCO, TaxPipeline.class); | 54 | TaxPipeline taxPipeline = JsonUtils.convertValue(taxPipelineCO, TaxPipeline.class); |
| @@ -48,7 +57,11 @@ public class TaxPipelineService { | @@ -48,7 +57,11 @@ public class TaxPipelineService { | ||
| 48 | } | 57 | } |
| 49 | 58 | ||
| 50 | 59 | ||
| 51 | - | 60 | + /** |
| 61 | + * 更新 | ||
| 62 | + * | ||
| 63 | + * @param taxPipelineCO 税务管道公司 | ||
| 64 | + */ | ||
| 52 | @Transactional | 65 | @Transactional |
| 53 | public void update(TaxPipelineCO taxPipelineCO) { | 66 | public void update(TaxPipelineCO taxPipelineCO) { |
| 54 | SystemType.validateSystemCode(taxPipelineCO.getSystemCode()); | 67 | SystemType.validateSystemCode(taxPipelineCO.getSystemCode()); |
| @@ -93,4 +106,19 @@ public class TaxPipelineService { | @@ -93,4 +106,19 @@ public class TaxPipelineService { | ||
| 93 | taxPipeline.setState(stateType.value); | 106 | taxPipeline.setState(stateType.value); |
| 94 | taxPipelineRepository.updateById(taxPipeline); | 107 | taxPipelineRepository.updateById(taxPipeline); |
| 95 | } | 108 | } |
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 按租户 ID 和代码获取 | ||
| 112 | + * | ||
| 113 | + * @param id id | ||
| 114 | + * @param pipelineCode 管道代码 | ||
| 115 | + * @return {@link TaxPipelineVO } | ||
| 116 | + */ | ||
| 117 | + public TaxPipelineVO getByTenantIdAndCode(Long id, @NotEmpty String pipelineCode) { | ||
| 118 | + LambdaQueryWrapper<TaxPipeline> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 119 | + queryWrapper.eq(TaxPipeline::getTenantId, id); | ||
| 120 | + queryWrapper.eq(TaxPipeline::getCode, pipelineCode); | ||
| 121 | + TaxPipeline taxPipeline = taxPipelineRepository.selectOne(queryWrapper); | ||
| 122 | + return JsonUtils.convertValue(taxPipeline, TaxPipelineVO.class); | ||
| 123 | + } | ||
| 96 | } | 124 | } |