1. 新增外部系统编码部门编码关联管理

2. 新增统一的 api 对外门户管理
3. 修正各个模块的 api 命名
This commit is contained in:
chenbowen
2025-10-17 17:40:46 +08:00
parent ce8e06d2a3
commit 78bc88b7a6
106 changed files with 4200 additions and 1377 deletions

View File

@@ -140,11 +140,6 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-scripting</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<!-- Reactive HTTP client for internal REST orchestration -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -0,0 +1,79 @@
package com.zt.plat.module.databus.controller.admin.gateway;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.databus.controller.admin.gateway.convert.ApiClientCredentialConvert;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialPageReqVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialRespVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialSaveReqVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialSimpleRespVO;
import com.zt.plat.module.databus.dal.dataobject.gateway.ApiClientCredentialDO;
import com.zt.plat.module.databus.service.gateway.ApiClientCredentialService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - API 客户端凭证")
@RestController
@RequestMapping("/databus/gateway/credential")
@RequiredArgsConstructor
@Validated
public class ApiClientCredentialController {
private final ApiClientCredentialService credentialService;
@GetMapping("/page")
@Operation(summary = "分页查询客户端凭证")
public CommonResult<PageResult<ApiClientCredentialRespVO>> page(ApiClientCredentialPageReqVO reqVO) {
PageResult<ApiClientCredentialDO> page = credentialService.getPage(reqVO);
return success(ApiClientCredentialConvert.INSTANCE.convertPage(page));
}
@GetMapping("/get")
@Operation(summary = "查询凭证详情")
public CommonResult<ApiClientCredentialRespVO> get(@RequestParam("id") Long id) {
ApiClientCredentialDO credential = credentialService.get(id);
return success(ApiClientCredentialConvert.INSTANCE.convert(credential));
}
@PostMapping("/create")
@Operation(summary = "新增客户端凭证")
public CommonResult<Long> create(@Valid @RequestBody ApiClientCredentialSaveReqVO reqVO) {
return success(credentialService.create(reqVO));
}
@PutMapping("/update")
@Operation(summary = "更新客户端凭证")
public CommonResult<Boolean> update(@Valid @RequestBody ApiClientCredentialSaveReqVO reqVO) {
credentialService.update(reqVO);
return success(Boolean.TRUE);
}
@DeleteMapping("/delete")
@Operation(summary = "删除客户端凭证")
public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
credentialService.delete(id);
return success(Boolean.TRUE);
}
@GetMapping("/list-simple")
@Operation(summary = "获取启用的凭证列表(精简)")
public CommonResult<List<ApiClientCredentialSimpleRespVO>> listSimple() {
List<ApiClientCredentialDO> list = credentialService.listEnabled();
return success(ApiClientCredentialConvert.INSTANCE.convertSimpleList(list));
}
}

View File

@@ -1,84 +0,0 @@
package com.zt.plat.module.databus.controller.admin.gateway;
import com.zt.plat.framework.common.exception.util.ServiceExceptionUtil;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.databus.controller.admin.gateway.convert.ApiPolicyAuthConvert;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicyPageReqVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicyRespVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicySaveReqVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicySimpleRespVO;
import com.zt.plat.module.databus.dal.dataobject.gateway.ApiPolicyAuthDO;
import com.zt.plat.module.databus.service.gateway.ApiPolicyAuthService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import static com.zt.plat.module.databus.service.gateway.impl.GatewayServiceErrorCodeConstants.API_POLICY_NOT_FOUND;
@Tag(name = "管理后台 - 网关认证策略")
@RestController
@RequestMapping("/databus/gateway/policy/auth")
@RequiredArgsConstructor
@Validated
public class ApiPolicyAuthController {
private final ApiPolicyAuthService authService;
@GetMapping("/page")
@Operation(summary = "分页查询认证策略")
public CommonResult<PageResult<ApiPolicyRespVO>> getAuthPolicyPage(@Valid ApiPolicyPageReqVO reqVO) {
PageResult<ApiPolicyAuthDO> pageResult = authService.getPage(reqVO);
return success(ApiPolicyAuthConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/{id}")
@Operation(summary = "查询认证策略详情")
public CommonResult<ApiPolicyRespVO> getAuthPolicy(@PathVariable("id") Long id) {
ApiPolicyAuthDO policy = authService.get(id)
.orElseThrow(() -> ServiceExceptionUtil.exception(API_POLICY_NOT_FOUND));
return success(ApiPolicyAuthConvert.INSTANCE.convert(policy));
}
@GetMapping("/simple-list")
@Operation(summary = "获取认证策略精简列表")
public CommonResult<List<ApiPolicySimpleRespVO>> getAuthPolicySimpleList() {
List<ApiPolicyAuthDO> list = authService.getSimpleList();
return success(ApiPolicyAuthConvert.INSTANCE.convertSimpleList(list));
}
@PostMapping
@Operation(summary = "创建认证策略")
public CommonResult<Long> createAuthPolicy(@Valid @RequestBody ApiPolicySaveReqVO reqVO) {
Long id = authService.create(reqVO);
return success(id);
}
@PutMapping
@Operation(summary = "更新认证策略")
public CommonResult<Boolean> updateAuthPolicy(@Valid @RequestBody ApiPolicySaveReqVO reqVO) {
authService.update(reqVO);
return success(Boolean.TRUE);
}
@DeleteMapping("/{id}")
@Operation(summary = "删除认证策略")
public CommonResult<Boolean> deleteAuthPolicy(@PathVariable("id") Long id) {
authService.delete(id);
return success(Boolean.TRUE);
}
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.databus.controller.admin.gateway.convert;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialRespVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.credential.ApiClientCredentialSimpleRespVO;
import com.zt.plat.module.databus.dal.dataobject.gateway.ApiClientCredentialDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.stream.Collectors;
@Mapper
public interface ApiClientCredentialConvert {
ApiClientCredentialConvert INSTANCE = Mappers.getMapper(ApiClientCredentialConvert.class);
ApiClientCredentialRespVO convert(ApiClientCredentialDO bean);
List<ApiClientCredentialRespVO> convertList(List<ApiClientCredentialDO> list);
default PageResult<ApiClientCredentialRespVO> convertPage(PageResult<ApiClientCredentialDO> page) {
if (page == null) {
return PageResult.empty();
}
PageResult<ApiClientCredentialRespVO> result = new PageResult<>();
result.setList(convertList(page.getList()));
result.setTotal(page.getTotal());
return result;
}
default List<ApiClientCredentialSimpleRespVO> convertSimpleList(List<ApiClientCredentialDO> list) {
return list == null ? List.of() : list.stream().map(item -> {
ApiClientCredentialSimpleRespVO vo = new ApiClientCredentialSimpleRespVO();
vo.setId(item.getId());
vo.setAppId(item.getAppId());
vo.setAppName(item.getAppName());
return vo;
}).collect(Collectors.toList());
}
}

View File

@@ -1,25 +0,0 @@
package com.zt.plat.module.databus.controller.admin.gateway.convert;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicyRespVO;
import com.zt.plat.module.databus.controller.admin.gateway.vo.policy.ApiPolicySimpleRespVO;
import com.zt.plat.module.databus.dal.dataobject.gateway.ApiPolicyAuthDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ApiPolicyAuthConvert {
ApiPolicyAuthConvert INSTANCE = Mappers.getMapper(ApiPolicyAuthConvert.class);
ApiPolicyRespVO convert(ApiPolicyAuthDO bean);
List<ApiPolicyRespVO> convertList(List<ApiPolicyAuthDO> list);
PageResult<ApiPolicyRespVO> convertPage(PageResult<ApiPolicyAuthDO> page);
List<ApiPolicySimpleRespVO> convertSimpleList(List<ApiPolicyAuthDO> list);
}

View File

@@ -0,0 +1,19 @@
package com.zt.plat.module.databus.controller.admin.gateway.vo.credential;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Schema(description = "管理后台 - API 客户端凭证分页查询 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ApiClientCredentialPageReqVO extends PageParam {
@Schema(description = "关键字,匹配 appId 或名称", example = "databus-app")
private String keyword;
@Schema(description = "是否启用")
private Boolean enabled;
}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.databus.controller.admin.gateway.vo.credential;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - API 客户端凭证 Response VO")
@Data
public class ApiClientCredentialRespVO {
@Schema(description = "记录编号", example = "1024")
private Long id;
@Schema(description = "应用标识", example = "databus-app")
private String appId;
@Schema(description = "应用名称", example = "数据总线默认应用")
private String appName;
@Schema(description = "加密密钥", example = "MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=")
private String encryptionKey;
@Schema(description = "加密算法", example = "AES")
private String encryptionType;
@Schema(description = "签名算法", example = "MD5")
private String signatureType;
@Schema(description = "是否启用", example = "true")
private Boolean enabled;
@Schema(description = "备注", example = "默认应用凭证")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "最后更新时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.databus.controller.admin.gateway.vo.credential;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - API 客户端凭证保存 Request VO")
@Data
public class ApiClientCredentialSaveReqVO {
@Schema(description = "记录编号,仅更新时必填", example = "1024")
private Long id;
@Schema(description = "应用标识", example = "databus-app")
@NotBlank(message = "应用标识不能为空")
private String appId;
@Schema(description = "应用名称", example = "数据总线默认应用")
private String appName;
@Schema(description = "加密密钥", example = "MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=")
@NotBlank(message = "加密密钥不能为空")
private String encryptionKey;
@Schema(description = "加密算法", example = "AES")
@NotBlank(message = "加密算法不能为空")
private String encryptionType;
@Schema(description = "签名算法", example = "MD5")
@NotBlank(message = "签名算法不能为空")
private String signatureType;
@Schema(description = "是否启用", example = "true")
@NotNull(message = "启用状态不能为空")
private Boolean enabled;
@Schema(description = "备注", example = "默认应用凭证")
private String remark;
}

View File

@@ -0,0 +1,19 @@
package com.zt.plat.module.databus.controller.admin.gateway.vo.credential;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - API 客户端凭证精简 Response VO")
@Data
public class ApiClientCredentialSimpleRespVO {
@Schema(description = "记录编号", example = "1024")
private Long id;
@Schema(description = "应用标识", example = "databus-app")
private String appId;
@Schema(description = "应用名称", example = "数据总线默认应用")
private String appName;
}

Some files were not shown because too many files have changed in this diff Show More