Merge branch 'refs/heads/zt-test' into test
# Conflicts: # zt-module-infra/zt-module-infra-server/src/main/resources/application.yaml
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package com.zt.plat.module.databus.api.provider;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.databus.api.data.DatabusUserDeptData;
|
||||
import com.zt.plat.module.databus.api.dto.CursorPageReqDTO;
|
||||
import com.zt.plat.module.databus.api.dto.CursorPageResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Databus 用户-部门关系数据提供者 API
|
||||
* <p>
|
||||
* 供 Databus 调用,获取用户-部门关联数据用于全量/增量同步
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@FeignClient(name = "${databus.provider.user-dept.service:system-server}")
|
||||
@Tag(name = "RPC 服务 - Databus 用户-部门关系数据提供者")
|
||||
public interface DatabusUserDeptProviderApi {
|
||||
|
||||
String PREFIX = "/rpc/databus/user-dept";
|
||||
|
||||
/**
|
||||
* 游标分页查询用户-部门关系数据(用于全量同步)
|
||||
*
|
||||
* @param reqDTO 游标分页请求
|
||||
* @return 用户-部门关系数据分页结果
|
||||
*/
|
||||
@PostMapping(PREFIX + "/page-by-cursor")
|
||||
@Operation(summary = "游标分页查询用户-部门关系数据")
|
||||
CommonResult<CursorPageResult<DatabusUserDeptData>> getPageByCursor(@RequestBody CursorPageReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 根据ID查询用户-部门关系详情(用于增量同步)
|
||||
*
|
||||
* @param id 关系ID
|
||||
* @return 用户-部门关系数据
|
||||
*/
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "查询用户-部门关系详情")
|
||||
@Parameter(name = "id", description = "关系ID", required = true, example = "1001")
|
||||
CommonResult<DatabusUserDeptData> getById(@RequestParam("id") Long id);
|
||||
|
||||
/**
|
||||
* 批量查询用户-部门关系详情(用于增量同步批量获取)
|
||||
*
|
||||
* @param ids 关系ID列表
|
||||
* @return 用户-部门关系数据列表
|
||||
*/
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "批量查询用户-部门关系详情")
|
||||
@Parameter(name = "ids", description = "关系ID列表", required = true, example = "1001,1002,1003")
|
||||
CommonResult<List<DatabusUserDeptData>> getListByIds(@RequestParam("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 统计用户-部门关系总数(用于全量同步进度计算)
|
||||
*
|
||||
* @param tenantId 租户ID(可选)
|
||||
* @return 用户-部门关系总数
|
||||
*/
|
||||
@GetMapping(PREFIX + "/count")
|
||||
@Operation(summary = "统计用户-部门关系总数")
|
||||
@Parameter(name = "tenantId", description = "租户ID", example = "1")
|
||||
CommonResult<Long> count(@RequestParam(value = "tenantId", required = false) Long tenantId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.zt.plat.module.databus.api.provider;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.databus.api.data.DatabusUserPostData;
|
||||
import com.zt.plat.module.databus.api.dto.CursorPageReqDTO;
|
||||
import com.zt.plat.module.databus.api.dto.CursorPageResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Databus 用户-岗位关系数据提供者 API
|
||||
* <p>
|
||||
* 供 Databus 调用,获取用户-岗位关联数据用于全量/增量同步
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@FeignClient(name = "${databus.provider.user-post.service:system-server}")
|
||||
@Tag(name = "RPC 服务 - Databus 用户-岗位关系数据提供者")
|
||||
public interface DatabusUserPostProviderApi {
|
||||
|
||||
String PREFIX = "/rpc/databus/user-post";
|
||||
|
||||
/**
|
||||
* 游标分页查询用户-岗位关系数据(用于全量同步)
|
||||
*
|
||||
* @param reqDTO 游标分页请求
|
||||
* @return 用户-岗位关系数据分页结果
|
||||
*/
|
||||
@PostMapping(PREFIX + "/page-by-cursor")
|
||||
@Operation(summary = "游标分页查询用户-岗位关系数据")
|
||||
CommonResult<CursorPageResult<DatabusUserPostData>> getPageByCursor(@RequestBody CursorPageReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 根据ID查询用户-岗位关系详情(用于增量同步)
|
||||
*
|
||||
* @param id 关系ID
|
||||
* @return 用户-岗位关系数据
|
||||
*/
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "查询用户-岗位关系详情")
|
||||
@Parameter(name = "id", description = "关系ID", required = true, example = "1001")
|
||||
CommonResult<DatabusUserPostData> getById(@RequestParam("id") Long id);
|
||||
|
||||
/**
|
||||
* 批量查询用户-岗位关系详情(用于增量同步批量获取)
|
||||
*
|
||||
* @param ids 关系ID列表
|
||||
* @return 用户-岗位关系数据列表
|
||||
*/
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "批量查询用户-岗位关系详情")
|
||||
@Parameter(name = "ids", description = "关系ID列表", required = true, example = "1001,1002,1003")
|
||||
CommonResult<List<DatabusUserPostData>> getListByIds(@RequestParam("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 统计用户-岗位关系总数(用于全量同步进度计算)
|
||||
*
|
||||
* @param tenantId 租户ID(可选)
|
||||
* @return 用户-岗位关系总数
|
||||
*/
|
||||
@GetMapping(PREFIX + "/count")
|
||||
@Operation(summary = "统计用户-岗位关系总数")
|
||||
@Parameter(name = "tenantId", description = "租户ID", example = "1")
|
||||
CommonResult<Long> count(@RequestParam(value = "tenantId", required = false) Long tenantId);
|
||||
|
||||
}
|
||||
@@ -185,6 +185,11 @@
|
||||
<version>4.12.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-spring-boot-starter-databus-client</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.web.util.ContentCachingResponseWrapper;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -304,15 +305,28 @@ public class GatewaySecurityFilter extends OncePerRequestFilter {
|
||||
.build()
|
||||
.getQueryParams();
|
||||
params.forEach((key, values) -> {
|
||||
if (!StringUtils.hasText(key) || "signature".equalsIgnoreCase(key)) {
|
||||
String decodedKey = URLDecoder.decode(key, StandardCharsets.UTF_8);
|
||||
if (!StringUtils.hasText(decodedKey) || "signature".equalsIgnoreCase(decodedKey)) {
|
||||
return;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
target.put(key, "");
|
||||
} else if (values.size() == 1) {
|
||||
target.put(key, values.get(0));
|
||||
target.put(decodedKey, "");
|
||||
return;
|
||||
}
|
||||
// 对每一个 value 做 URL 解码,确保与客户端原文签名一致
|
||||
List<String> decodedValues = values.stream()
|
||||
.map(val -> URLDecoder.decode(val, StandardCharsets.UTF_8))
|
||||
.toList();
|
||||
boolean allNullLiteral = decodedValues.stream()
|
||||
.allMatch(v -> "null".equals(v));
|
||||
if (allNullLiteral) {
|
||||
// 过滤掉仅包含字符串 "null" 的参数
|
||||
return;
|
||||
}
|
||||
if (decodedValues.size() == 1) {
|
||||
target.put(decodedKey, decodedValues.get(0));
|
||||
} else {
|
||||
target.put(key, String.join(",", values));
|
||||
target.put(decodedKey, String.join(",", decodedValues));
|
||||
}
|
||||
});
|
||||
} catch (IllegalArgumentException ex) {
|
||||
|
||||
@@ -4,9 +4,13 @@ import com.zt.plat.framework.common.biz.system.oauth2.OAuth2TokenCommonApi;
|
||||
import com.zt.plat.module.databus.api.provider.DatabusDeptProviderApi;
|
||||
import com.zt.plat.module.databus.api.provider.DatabusPostProviderApi;
|
||||
import com.zt.plat.module.databus.api.provider.DatabusUserProviderApi;
|
||||
import com.zt.plat.module.databus.api.provider.DatabusUserDeptProviderApi;
|
||||
import com.zt.plat.module.databus.api.provider.DatabusUserPostProviderApi;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.PostApi;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import com.zt.plat.module.system.api.userdept.UserDeptApi;
|
||||
import com.zt.plat.module.system.api.userpost.UserPostApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -21,9 +25,12 @@ import org.springframework.context.annotation.Configuration;
|
||||
DatabusDeptProviderApi.class,
|
||||
DatabusUserProviderApi.class,
|
||||
DatabusPostProviderApi.class,
|
||||
PostApi.class,
|
||||
DeptApi.class,
|
||||
AdminUserApi.class,
|
||||
DatabusUserDeptProviderApi.class,
|
||||
DatabusUserPostProviderApi.class,
|
||||
PostApi.class,
|
||||
DeptApi.class,
|
||||
UserDeptApi.class,
|
||||
UserPostApi.class,
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user