Commit a5d09a5d676ae4807ee8979caf909258bdab18c0
1 parent
23576525
feat(storage): 新增账套业务配置管理功能- 新增 TaxPipelineBusiness 和 TaxPipelineBusinessConfig 实体类及对应仓储层接口
- 新增 TaxPipelineBusinessCO、TaxPipelineBusinessConfigCO 数据传输对象- 新增 TaxPipelineBusinessConfigController 控制器,提供业务配置的增删改查接口- 新增 TaxPipelineBusinessConfigService 服务实现业务逻辑处理- 引入分页查询支持,完善业务配置相关 VO 类结构 - 在 GlobalExceptionHandler 中增加对 NoHandlerFoundException 和 NoResourceFoundException 的处理 - 修改 Builder 接口及其子类 CustomerBuilder、ReceiptBuilder 等方法参数类型为 Map<String, Object> - 更新 MessageContext 中 msgBody 字段类型为 Map<String, Object> - 修改 TaxReceiveService 中 originData 存储方式为 JSON 字符串 - 在 TaxSystemType 枚举中新增 NOT_FOUND 类型用于 404 错误响应- 在 TaxTenantController 中新增 call 接口用于调试请求转发测试 - 调整 ServiceEndpointSupport 中 HttpClient 使用方式以提升可读性与维护性
Showing
21 changed files
with
542 additions
and
14 deletions
tax-boot/src/main/java/com/diligrp/tax/boot/service/TaxReceiveService.java
| ... | ... | @@ -14,6 +14,7 @@ import com.diligrp.tax.central.type.DocumentType; |
| 14 | 14 | import com.diligrp.tax.central.type.MappingStateType; |
| 15 | 15 | import com.diligrp.tax.central.type.SystemType; |
| 16 | 16 | import com.diligrp.tax.central.type.TaxSystemType; |
| 17 | +import com.diligrp.tax.central.utils.JsonUtils; | |
| 17 | 18 | import jakarta.annotation.Resource; |
| 18 | 19 | import org.springframework.stereotype.Service; |
| 19 | 20 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -69,7 +70,7 @@ public class TaxReceiveService { |
| 69 | 70 | TaxPipelineMappingCreate create = new TaxPipelineMappingCreate(); |
| 70 | 71 | create.setId(e.getId()); |
| 71 | 72 | create.setTenantId(messageContext.getTenantId()); |
| 72 | - create.setOriginData(messageContext.getMsgBody()); | |
| 73 | + create.setOriginData(JsonUtils.toJsonString(messageContext.getMsgBody())); | |
| 73 | 74 | taxPipelineMappingService.update(create); |
| 74 | 75 | }, () -> { |
| 75 | 76 | TaxPipelineMappingCreate create = new TaxPipelineMappingCreate(); |
| ... | ... | @@ -79,7 +80,7 @@ public class TaxReceiveService { |
| 79 | 80 | create.setSystemDataId(messageContext.getSystemDataId()); |
| 80 | 81 | create.setPipelineDataId(messageContext.getPipelineDataId()); |
| 81 | 82 | create.setState(MappingStateType.SYNCED.value); |
| 82 | - create.setOriginData(messageContext.getMsgBody()); | |
| 83 | + create.setOriginData(JsonUtils.toJsonString(messageContext.getMsgBody())); | |
| 83 | 84 | taxPipelineMappingService.insert(create); |
| 84 | 85 | }); |
| 85 | 86 | |
| ... | ... | @@ -94,7 +95,7 @@ public class TaxReceiveService { |
| 94 | 95 | error.setSystemType(ctx.getSystemType()); |
| 95 | 96 | error.setSystemDataId(ctx.getSystemDataId()); |
| 96 | 97 | error.setPipelineCode(ctx.getPipelineCode()); |
| 97 | - error.setOriginData(ctx.getMsgBody()); | |
| 98 | + error.setOriginData(JsonUtils.toJsonString(ctx.getMsgBody())); | |
| 98 | 99 | error.setState(MappingStateType.SYNC_FAILED.value); |
| 99 | 100 | error.setErrorMessage(e.getMessage()); |
| 100 | 101 | taxMappingErrorService.insert(error); | ... | ... |
tax-central/src/main/java/com/diligrp/tax/central/domain/MessageContext.java
| ... | ... | @@ -6,6 +6,8 @@ import com.diligrp.tax.central.type.SystemType; |
| 6 | 6 | import lombok.Getter; |
| 7 | 7 | import lombok.Setter; |
| 8 | 8 | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 9 | 11 | @Setter |
| 10 | 12 | @Getter |
| 11 | 13 | public class MessageContext { |
| ... | ... | @@ -41,7 +43,7 @@ public class MessageContext { |
| 41 | 43 | /** |
| 42 | 44 | * 消息信息 |
| 43 | 45 | */ |
| 44 | - private String msgBody; | |
| 46 | + private Map<String, Object> msgBody; | |
| 45 | 47 | /** |
| 46 | 48 | * 公文 |
| 47 | 49 | */ | ... | ... |
tax-central/src/main/java/com/diligrp/tax/central/type/TaxSystemType.java
tax-central/src/main/java/com/diligrp/tax/central/utils/ServiceEndpointSupport.java
| ... | ... | @@ -188,7 +188,8 @@ public abstract class ServiceEndpointSupport { |
| 188 | 188 | */ |
| 189 | 189 | protected HttpResult execute(HttpRequest request) { |
| 190 | 190 | try { |
| 191 | - HttpResponse<String> response = getHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); | |
| 191 | + HttpClient client = getHttpClient(); | |
| 192 | + HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); | |
| 192 | 193 | |
| 193 | 194 | HttpResult result = HttpResult.create(); |
| 194 | 195 | result.statusCode = response.statusCode(); | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/Builder.java
| ... | ... | @@ -4,6 +4,8 @@ import com.diligrp.tax.central.domain.BaseDocument; |
| 4 | 4 | import com.diligrp.tax.central.model.TenantPipeline; |
| 5 | 5 | import com.diligrp.tax.central.type.DocumentType; |
| 6 | 6 | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 7 | 9 | /** |
| 8 | 10 | * @Author: zhangmeiyang |
| 9 | 11 | * @CreateTime: 2025-10-30 10:33 |
| ... | ... | @@ -26,5 +28,5 @@ public abstract class Builder<T extends BaseDocument> { |
| 26 | 28 | * @param systemDataId |
| 27 | 29 | * @return {@link T } |
| 28 | 30 | */ |
| 29 | - public abstract T build(String body, TenantPipeline pipeline, String systemDataId); | |
| 31 | + public abstract T build(Map<String, Object> body, TenantPipeline pipeline, String systemDataId); | |
| 30 | 32 | } | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/CustomerBuilder.java
| ... | ... | @@ -45,8 +45,8 @@ public class CustomerBuilder extends Builder<StandardCustomer> { |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | @Override |
| 48 | - public StandardCustomer build(String body, TenantPipeline pipeline, String systemDataId) { | |
| 49 | - StandardCustomer customer = JsonUtils.fromJsonString(body, StandardCustomer.class); | |
| 48 | + public StandardCustomer build(Map<String, Object> body, TenantPipeline pipeline, String systemDataId) { | |
| 49 | + StandardCustomer customer = JsonUtils.convertValue(body, StandardCustomer.class); | |
| 50 | 50 | Optional.ofNullable(customer.getContacts()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请完善联系人信息")); |
| 51 | 51 | Optional.ofNullable(systemDataId).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写系统数据ID")); |
| 52 | 52 | List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/ReceiptBuilder.java
| ... | ... | @@ -38,8 +38,8 @@ public class ReceiptBuilder extends Builder<ReceiptBill> { |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | @Override |
| 41 | - public ReceiptBill build(String body, TenantPipeline pipeline, String systemDataId) { | |
| 42 | - ReceiptBill bill = JsonUtils.fromJsonString(body, ReceiptBill.class); | |
| 41 | + public ReceiptBill build(Map<String, Object> body, TenantPipeline pipeline, String systemDataId) { | |
| 42 | + ReceiptBill bill = JsonUtils.convertValue(body, ReceiptBill.class); | |
| 43 | 43 | Optional.ofNullable(bill.getReceiptItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 44 | 44 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 45 | 45 | List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/ReceivableBuilder.java
| ... | ... | @@ -39,8 +39,8 @@ public class ReceivableBuilder extends Builder<ReceivableBill> { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | @Override |
| 42 | - public ReceivableBill build(String body, TenantPipeline pipeline, String systemDataId) { | |
| 43 | - ReceivableBill bill = JsonUtils.fromJsonString(body, ReceivableBill.class); | |
| 42 | + public ReceivableBill build(Map<String, Object> body, TenantPipeline pipeline, String systemDataId) { | |
| 43 | + ReceivableBill bill = JsonUtils.convertValue(body, ReceivableBill.class); | |
| 44 | 44 | Optional.ofNullable(bill.getReceivableItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 45 | 45 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 46 | 46 | List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); | ... | ... |
tax-doc/src/main/java/com/diligrp/tax/doc/demarcate/kingdee/RefundBuilder.java
| ... | ... | @@ -39,8 +39,8 @@ public class RefundBuilder extends Builder<RefundBill> { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | @Override |
| 42 | - public RefundBill build(String body, TenantPipeline pipeline, String systemDataId) { | |
| 43 | - RefundBill bill = JsonUtils.fromJsonString(body, RefundBill.class); | |
| 42 | + public RefundBill build(Map<String, Object> body, TenantPipeline pipeline, String systemDataId) { | |
| 43 | + RefundBill bill = JsonUtils.convertValue(body, RefundBill.class); | |
| 44 | 44 | Optional.ofNullable(bill.getRefundItems()).orElseThrow(() -> new TaxAgentServiceException(TaxSystemType.MISSING_BUSINESS_INFORMATION, "请填写收款项目")); |
| 45 | 45 | bill.setCreateTime(Optional.ofNullable(bill.getCreateTime()).orElse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
| 46 | 46 | List<TenantPipelineConfig> list = taxTenantService.listByPipelineIdAndDocumentType(pipeline.getId(), markDocument().value); | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/GlobalExceptionHandler.java
| ... | ... | @@ -16,6 +16,8 @@ import org.springframework.web.bind.MethodArgumentNotValidException; |
| 16 | 16 | import org.springframework.web.bind.MissingServletRequestParameterException; |
| 17 | 17 | import org.springframework.web.bind.annotation.ControllerAdvice; |
| 18 | 18 | import org.springframework.web.bind.annotation.ExceptionHandler; |
| 19 | +import org.springframework.web.servlet.NoHandlerFoundException; | |
| 20 | +import org.springframework.web.servlet.resource.NoResourceFoundException; | |
| 19 | 21 | |
| 20 | 22 | import java.util.List; |
| 21 | 23 | import java.util.Set; |
| ... | ... | @@ -116,4 +118,28 @@ public class GlobalExceptionHandler { |
| 116 | 118 | log.error("unknown error :", ex); |
| 117 | 119 | return Message.failure(TaxSystemType.UNKNOWN_ERROR.code, TaxSystemType.UNKNOWN_ERROR.message); |
| 118 | 120 | } |
| 121 | + | |
| 122 | + /** | |
| 123 | + * 未找到处理程序异常处理程序 | |
| 124 | + * | |
| 125 | + * @param ex 系统异常 | |
| 126 | + * @return 响应消息对象 | |
| 127 | + */ | |
| 128 | + @ExceptionHandler(NoHandlerFoundException.class) | |
| 129 | + public Message<?> NoHandlerFoundExceptionHandler(NoHandlerFoundException ex) { | |
| 130 | + log.error("no handler found exception :", ex); | |
| 131 | + return Message.failure(TaxSystemType.NOT_FOUND.code, TaxSystemType.NOT_FOUND.message); | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 未找到处理程序异常处理程序 | |
| 136 | + * | |
| 137 | + * @param ex 系统异常 | |
| 138 | + * @return 响应消息对象 | |
| 139 | + */ | |
| 140 | + @ExceptionHandler(NoResourceFoundException.class) | |
| 141 | + public Message<?> NoResourceFoundExceptionHandler(NoResourceFoundException ex) { | |
| 142 | + log.error("no resource found exception :", ex); | |
| 143 | + return Message.failure(TaxSystemType.NOT_FOUND.code, TaxSystemType.NOT_FOUND.message); | |
| 144 | + } | |
| 119 | 145 | } | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/controller/TaxPipelineBusinessConfigController.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.TaxPipelineBusinessCO; | |
| 6 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; | |
| 7 | +import com.diligrp.tax.storage.service.TaxPipelineBusinessConfigService; | |
| 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-13 15:12 | |
| 18 | + * @Version: todo | |
| 19 | + */ | |
| 20 | +@RestController | |
| 21 | +@RequestMapping("/tax/tenant/pipeline/business/config") | |
| 22 | +public class TaxPipelineBusinessConfigController { | |
| 23 | + | |
| 24 | + @Resource | |
| 25 | + private TaxPipelineBusinessConfigService taxPipelineBusinessConfigService; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 保存业务 | |
| 29 | + * | |
| 30 | + * @param co 公司 | |
| 31 | + * @return {@link Message }<{@link ? }> | |
| 32 | + */ | |
| 33 | + @RequestMapping("/saveBusiness") | |
| 34 | + public Message<?> saveBusiness(@RequestBody @Validated(value = Valid.Create.class) TaxPipelineBusinessCO co) { | |
| 35 | + taxPipelineBusinessConfigService.saveBusiness(co); | |
| 36 | + return Message.success(); | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 更新业务 | |
| 41 | + * | |
| 42 | + * @param co 公司 | |
| 43 | + * @return {@link Message }<{@link ? }> | |
| 44 | + */ | |
| 45 | + @RequestMapping("/updateBusiness") | |
| 46 | + public Message<?> updateBusiness(@RequestBody @Validated(value = Valid.Update.class) TaxPipelineBusinessCO co) { | |
| 47 | + taxPipelineBusinessConfigService.updateBusiness(co); | |
| 48 | + return Message.success(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 删除业务 | |
| 53 | + * | |
| 54 | + * @param id id | |
| 55 | + * @return {@link Message }<{@link ? }> | |
| 56 | + */ | |
| 57 | + @RequestMapping("/deleteBusiness/{id}") | |
| 58 | + public Message<?> deleteBusiness(@PathVariable("id") Long id) { | |
| 59 | + taxPipelineBusinessConfigService.deleteBusiness(id); | |
| 60 | + return Message.success(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 分页查询账套内业务 | |
| 65 | + * | |
| 66 | + * @param co 公司 | |
| 67 | + * @return {@link Message }<{@link ? }> | |
| 68 | + */ | |
| 69 | + @RequestMapping("/pageBusiness") | |
| 70 | + public Message<?> pageBusiness(@RequestBody @Validated(value = Valid.Read.class) TaxPipelineBusinessCO co) { | |
| 71 | + return Message.success(taxPipelineBusinessConfigService.pageBusiness(co)); | |
| 72 | + } | |
| 73 | + | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 保存业务文档 | |
| 77 | + * | |
| 78 | + * @param co 公司 | |
| 79 | + * @return {@link Message }<{@link ? }> | |
| 80 | + */ | |
| 81 | + @RequestMapping("/saveBusinessDocument") | |
| 82 | + public Message<?> saveBusinessDocument(@RequestBody @Validated(value = Valid.Create.class) TaxPipelineBusinessConfigCO co) { | |
| 83 | + taxPipelineBusinessConfigService.saveBusinessDocument(co); | |
| 84 | + return Message.success(); | |
| 85 | + } | |
| 86 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/controller/TaxTenantController.java
| ... | ... | @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 12 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| 13 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 14 | |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 15 | 17 | /** |
| 16 | 18 | * 税务租户 |
| 17 | 19 | * |
| ... | ... | @@ -25,6 +27,12 @@ public class TaxTenantController { |
| 25 | 27 | @Resource |
| 26 | 28 | private TaxTenantService taxTenantService; |
| 27 | 29 | |
| 30 | + | |
| 31 | + @RequestMapping("call") | |
| 32 | + public Message<?> call(@RequestBody Map<String, Object> map) { | |
| 33 | + return Message.success(map); | |
| 34 | + } | |
| 35 | + | |
| 28 | 36 | /** |
| 29 | 37 | * 获取 |
| 30 | 38 | * | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineBusiness.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 | |
| 15 | + */ | |
| 16 | +@TableName(value = "tax_pipeline_business") | |
| 17 | +@Data | |
| 18 | +public class TaxPipelineBusiness { | |
| 19 | + /** | |
| 20 | + * | |
| 21 | + */ | |
| 22 | + @TableId(type = IdType.AUTO) | |
| 23 | + private Long id; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 账套ID | |
| 27 | + */ | |
| 28 | + @TableField(value = "pipeline_id") | |
| 29 | + private Long pipelineId; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 业务代码 | |
| 33 | + */ | |
| 34 | + @TableField(value = "business_code") | |
| 35 | + private String businessCode; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 业务名称 | |
| 39 | + */ | |
| 40 | + @TableField(value = "business_name") | |
| 41 | + private String businessName; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 创建时间 | |
| 45 | + */ | |
| 46 | + @TableField(value = "created_time") | |
| 47 | + private LocalDateTime createdTime; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 更新时间 | |
| 51 | + */ | |
| 52 | + @TableField(value = "modified_time") | |
| 53 | + private LocalDateTime modifiedTime; | |
| 54 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/domain/TaxPipelineBusinessConfig.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_config | |
| 15 | + */ | |
| 16 | +@TableName(value = "tax_pipeline_business_config") | |
| 17 | +@Data | |
| 18 | +public class TaxPipelineBusinessConfig { | |
| 19 | + /** | |
| 20 | + * | |
| 21 | + */ | |
| 22 | + @TableId(type = IdType.AUTO) | |
| 23 | + private Long id; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 业务ID | |
| 27 | + */ | |
| 28 | + @TableField(value = "tax_pipeline_business_id") | |
| 29 | + private Long taxPipelineBusinessId; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 单据配置 | |
| 33 | + */ | |
| 34 | + @TableField(value = "document_type") | |
| 35 | + private String documentType; | |
| 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
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.co; | |
| 2 | + | |
| 3 | +import com.diligrp.tax.storage.Valid; | |
| 4 | +import com.diligrp.tax.storage.message.PageQuery; | |
| 5 | +import jakarta.validation.constraints.NotEmpty; | |
| 6 | +import jakarta.validation.constraints.NotNull; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 账套业务配置 | |
| 11 | + * | |
| 12 | + * @TableName tax_pipeline_business | |
| 13 | + */ | |
| 14 | +@Data | |
| 15 | +public class TaxPipelineBusinessCO extends PageQuery { | |
| 16 | + /** | |
| 17 | + * | |
| 18 | + */ | |
| 19 | + @NotNull(groups = {Valid.Update.class, Valid.Delete.class}) | |
| 20 | + private Long id; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 账套ID | |
| 24 | + */ | |
| 25 | + @NotNull(groups = {Valid.Read.class}) | |
| 26 | + private Long pipelineId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 业务代码 | |
| 30 | + */ | |
| 31 | + @NotEmpty(groups = {Valid.Create.class, Valid.Update.class}) | |
| 32 | + private String businessCode; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 业务名称 | |
| 36 | + */ | |
| 37 | + @NotEmpty(groups = {Valid.Create.class, Valid.Update.class}) | |
| 38 | + private String businessName; | |
| 39 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/model/co/TaxPipelineBusinessConfigCO.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.Data; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 账套业务配置 | |
| 12 | + * | |
| 13 | + * @TableName tax_pipeline_business_config | |
| 14 | + */ | |
| 15 | +@Data | |
| 16 | +public class TaxPipelineBusinessConfigCO { | |
| 17 | + /** | |
| 18 | + * | |
| 19 | + */ | |
| 20 | + private Long id; | |
| 21 | + | |
| 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, Valid.Update.class}) | |
| 32 | + private List<String> documentTypes; | |
| 33 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessConfigVO.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.vo; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | + | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | + | |
| 7 | +@Data | |
| 8 | +public class TaxPipelineBusinessConfigVO { | |
| 9 | + /** | |
| 10 | + * | |
| 11 | + */ | |
| 12 | + private Long id; | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 业务ID | |
| 16 | + */ | |
| 17 | + private Long taxPipelineBusinessId; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 单据配置 | |
| 21 | + */ | |
| 22 | + private String documentType; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 创建时间 | |
| 26 | + */ | |
| 27 | + private LocalDateTime createdTime; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新时间 | |
| 31 | + */ | |
| 32 | + private LocalDateTime modifiedTime; | |
| 33 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/model/vo/TaxPipelineBusinessVO.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.model.vo; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | + | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 账套业务配置 | |
| 10 | + * | |
| 11 | + * @TableName tax_pipeline_business | |
| 12 | + */ | |
| 13 | +@Data | |
| 14 | +public class TaxPipelineBusinessVO { | |
| 15 | + /** | |
| 16 | + * | |
| 17 | + */ | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 账套ID | |
| 22 | + */ | |
| 23 | + private Long pipelineId; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 业务代码 | |
| 27 | + */ | |
| 28 | + private String businessCode; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 业务名称 | |
| 32 | + */ | |
| 33 | + private String businessName; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 创建时间 | |
| 37 | + */ | |
| 38 | + private LocalDateTime createdTime; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 更新时间 | |
| 42 | + */ | |
| 43 | + private LocalDateTime modifiedTime; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 配置 | |
| 47 | + */ | |
| 48 | + private List<TaxPipelineBusinessConfigVO> configs; | |
| 49 | +} | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineBusinessConfigRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | |
| 2 | + | |
| 3 | +import com.diligrp.tax.storage.domain.TaxPipelineBusinessConfig; | |
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | + | |
| 7 | +/** | |
| 8 | +* @author dili | |
| 9 | +* @description 针对表【tax_pipeline_business_config(账套业务配置)】的数据库操作Mapper | |
| 10 | +* @createDate 2025-11-13 14:58:05 | |
| 11 | +* @Entity com.diligrp.tax.storage.domain.TaxPipelineBusinessConfig | |
| 12 | +*/ | |
| 13 | +@Repository | |
| 14 | +public interface TaxPipelineBusinessConfigRepository extends BaseMapper<TaxPipelineBusinessConfig> { | |
| 15 | + | |
| 16 | +} | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/repo/TaxPipelineBusinessRepository.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.repo; | |
| 2 | + | |
| 3 | +import com.diligrp.tax.storage.domain.TaxPipelineBusiness; | |
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 5 | + | |
| 6 | +/** | |
| 7 | +* @author dili | |
| 8 | +* @description 针对表【tax_pipeline_business(账套业务配置)】的数据库操作Mapper | |
| 9 | +* @createDate 2025-11-13 14:58:05 | |
| 10 | +* @Entity com.diligrp.tax.storage.domain.TaxPipelineBusiness | |
| 11 | +*/ | |
| 12 | +public interface TaxPipelineBusinessRepository extends BaseMapper<TaxPipelineBusiness> { | |
| 13 | + | |
| 14 | +} | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | ... | ... |
tax-storage/src/main/java/com/diligrp/tax/storage/service/TaxPipelineBusinessConfigService.java
0 → 100644
| 1 | +package com.diligrp.tax.storage.service; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 6 | +import com.diligrp.tax.central.type.DocumentType; | |
| 7 | +import com.diligrp.tax.central.utils.JsonUtils; | |
| 8 | +import com.diligrp.tax.storage.domain.TaxPipelineBusiness; | |
| 9 | +import com.diligrp.tax.storage.domain.TaxPipelineBusinessConfig; | |
| 10 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessCO; | |
| 11 | +import com.diligrp.tax.storage.model.co.TaxPipelineBusinessConfigCO; | |
| 12 | +import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessConfigVO; | |
| 13 | +import com.diligrp.tax.storage.model.vo.TaxPipelineBusinessVO; | |
| 14 | +import com.diligrp.tax.storage.repo.TaxPipelineBusinessConfigRepository; | |
| 15 | +import com.diligrp.tax.storage.repo.TaxPipelineBusinessRepository; | |
| 16 | +import jakarta.annotation.Resource; | |
| 17 | +import org.springframework.stereotype.Service; | |
| 18 | +import org.springframework.transaction.annotation.Transactional; | |
| 19 | + | |
| 20 | +import java.util.List; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * @Author: zhangmeiyang | |
| 24 | + * @CreateTime: 2025-11-13 15:15 | |
| 25 | + * @Version: todo | |
| 26 | + */ | |
| 27 | +@Service | |
| 28 | +public class TaxPipelineBusinessConfigService { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private TaxPipelineBusinessConfigRepository taxPipelineBusinessConfigRepository; | |
| 32 | + | |
| 33 | + @Resource | |
| 34 | + private TaxPipelineBusinessRepository taxPipelineBusinessRepository; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 保存业务类型 | |
| 38 | + * | |
| 39 | + * @param co 公司 | |
| 40 | + */ | |
| 41 | + @Transactional | |
| 42 | + public void saveBusiness(TaxPipelineBusinessCO co) { | |
| 43 | + taxPipelineBusinessRepository.insert(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 更新业务 | |
| 48 | + * | |
| 49 | + * @param co 公司 | |
| 50 | + */ | |
| 51 | + @Transactional | |
| 52 | + public void updateBusiness(TaxPipelineBusinessCO co) { | |
| 53 | + taxPipelineBusinessRepository.updateById(JsonUtils.convertValue(co, TaxPipelineBusiness.class)); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 删除业务 | |
| 58 | + * | |
| 59 | + * @param id id | |
| 60 | + */ | |
| 61 | + @Transactional | |
| 62 | + public void deleteBusiness(Long id) { | |
| 63 | + taxPipelineBusinessRepository.deleteById(id); | |
| 64 | + LambdaQueryWrapper<TaxPipelineBusinessConfig> queryWrapper = new LambdaQueryWrapper<>(); | |
| 65 | + queryWrapper.eq(TaxPipelineBusinessConfig::getTaxPipelineBusinessId, id); | |
| 66 | + taxPipelineBusinessConfigRepository.delete(queryWrapper); | |
| 67 | + } | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 分页查询账套内业务 | |
| 71 | + * | |
| 72 | + * @param co 公司 | |
| 73 | + * @return {@link IPage }<{@link TaxPipelineBusinessVO }> | |
| 74 | + */ | |
| 75 | + public IPage<TaxPipelineBusinessVO> pageBusiness(TaxPipelineBusinessCO co) { | |
| 76 | + LambdaQueryWrapper<TaxPipelineBusiness> queryWrapper = new LambdaQueryWrapper<>(); | |
| 77 | + queryWrapper.eq(TaxPipelineBusiness::getPipelineId, co.getPipelineId()); | |
| 78 | + Page<TaxPipelineBusiness> page = taxPipelineBusinessRepository.selectPage(Page.of(co.getPageNumber(), co.getPageSize()), queryWrapper); | |
| 79 | + return page.convert(item -> { | |
| 80 | + TaxPipelineBusinessVO pipelineBusiness = JsonUtils.convertValue(item, TaxPipelineBusinessVO.class); | |
| 81 | + LambdaQueryWrapper<TaxPipelineBusinessConfig> wrapper = new LambdaQueryWrapper<>(); | |
| 82 | + wrapper.eq(TaxPipelineBusinessConfig::getTaxPipelineBusinessId, item.getId()); | |
| 83 | + List<TaxPipelineBusinessConfig> configs = taxPipelineBusinessConfigRepository.selectList(wrapper); | |
| 84 | + pipelineBusiness.setConfigs(configs.stream().map(e -> JsonUtils.convertValue(e, TaxPipelineBusinessConfigVO.class)).toList()); | |
| 85 | + return pipelineBusiness; | |
| 86 | + }); | |
| 87 | + } | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * 保存业务文档 | |
| 91 | + * | |
| 92 | + * @param co 公司 | |
| 93 | + */ | |
| 94 | + @Transactional | |
| 95 | + public void saveBusinessDocument(TaxPipelineBusinessConfigCO co) { | |
| 96 | + LambdaQueryWrapper<TaxPipelineBusinessConfig> queryWrapper = new LambdaQueryWrapper<>(); | |
| 97 | + queryWrapper.eq(TaxPipelineBusinessConfig::getTaxPipelineBusinessId, co.getTaxPipelineBusinessId()); | |
| 98 | + taxPipelineBusinessConfigRepository.delete(queryWrapper); | |
| 99 | + co.getDocumentTypes().forEach(documentType -> { | |
| 100 | + DocumentType.validateDocumentType(documentType); | |
| 101 | + var save = new TaxPipelineBusinessConfig(); | |
| 102 | + save.setTaxPipelineBusinessId(co.getTaxPipelineBusinessId()); | |
| 103 | + save.setDocumentType(documentType); | |
| 104 | + taxPipelineBusinessConfigRepository.insert(save); | |
| 105 | + }); | |
| 106 | + } | |
| 107 | +} | ... | ... |