Merge branch 'dev' into test
This commit is contained in:
@@ -16,11 +16,17 @@ import java.nio.charset.Charset;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLParameters;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可直接运行的示例,演示如何使用 appId=test 与对应密钥调用本地 Databus API。
|
* 可直接运行的示例,演示如何使用 appId=test 与对应密钥调用本地 Databus API。
|
||||||
@@ -37,12 +43,12 @@ public final class DatabusApiInvocationExample {
|
|||||||
// private static final String TARGET_API = "http://172.16.46.63:30081/admin-api/databus/api/portal/callback/v1";
|
// private static final String TARGET_API = "http://172.16.46.63:30081/admin-api/databus/api/portal/callback/v1";
|
||||||
// private static final String TARGET_API = "http://172.16.46.195:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
// private static final String TARGET_API = "http://172.16.46.195:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
||||||
// private static final String TARGET_API = "http://172.16.46.195:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
// private static final String TARGET_API = "http://172.16.46.195:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
||||||
|
private static final String TARGET_API = "https://jygk.chncopper.com:30078/admin-api/databus/api/portal/lgstOpenApi/v1";
|
||||||
// private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/callback/v1";
|
// private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/callback/v1";
|
||||||
private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
// private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/lgstOpenApi/v1";
|
||||||
// private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/testcbw/456";
|
// private static final String TARGET_API = "http://localhost:48080/admin-api/databus/api/portal/testcbw/456";
|
||||||
private static final HttpClient HTTP_CLIENT = HttpClient.newBuilder()
|
// ⚠️ 仅用于联调:信任所有证书 + 关闭主机名校验,生产环境请改为受信 CA 或自定义 truststore。
|
||||||
.connectTimeout(Duration.ofSeconds(5))
|
private static final HttpClient HTTP_CLIENT = buildUnsafeHttpClient();
|
||||||
.build();
|
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
private static final PrintStream OUT = buildConsolePrintStream();
|
private static final PrintStream OUT = buildConsolePrintStream();
|
||||||
public static final String ZT_APP_ID = "ZT-App-Id";
|
public static final String ZT_APP_ID = "ZT-App-Id";
|
||||||
@@ -55,6 +61,45 @@ public final class DatabusApiInvocationExample {
|
|||||||
private DatabusApiInvocationExample() {
|
private DatabusApiInvocationExample() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅用于联调:信任所有证书并关闭主机名校验,生产环境请使用受信 CA 或自定义 truststore。
|
||||||
|
*/
|
||||||
|
private static HttpClient buildUnsafeHttpClient() {
|
||||||
|
try {
|
||||||
|
TrustManager[] trustAll = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new X509Certificate[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
sslContext.init(null, trustAll, new SecureRandom());
|
||||||
|
|
||||||
|
SSLParameters sslParameters = new SSLParameters();
|
||||||
|
// 关闭主机名校验
|
||||||
|
sslParameters.setEndpointIdentificationAlgorithm("");
|
||||||
|
|
||||||
|
return HttpClient.newBuilder()
|
||||||
|
.sslContext(sslContext)
|
||||||
|
.sslParameters(sslParameters)
|
||||||
|
.connectTimeout(Duration.ofSeconds(5))
|
||||||
|
.build();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new IllegalStateException("Failed to build unsafe HttpClient", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
OUT.println("=== GET 请求示例 ===");
|
OUT.println("=== GET 请求示例 ===");
|
||||||
// executeGetExample();
|
// executeGetExample();
|
||||||
|
|||||||
@@ -36,4 +36,13 @@ public class DeptSaveReqDTO {
|
|||||||
@Schema(description = "状态,见 CommonStatusEnum 枚举0 开启 1 关闭", example = "0")
|
@Schema(description = "状态,见 CommonStatusEnum 枚举0 开启 1 关闭", example = "0")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统标识,用于建立编码映射", example = "ERP")
|
||||||
|
private String externalSystemCode;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统组织编码,用于建立映射", example = "ERP-001")
|
||||||
|
private String externalDeptCode;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统组织名称", example = "ERP总部")
|
||||||
|
private String externalDeptName;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,6 @@ public interface DictTypeConstants {
|
|||||||
String SMS_SEND_STATUS = "system_sms_send_status"; // 短信发送状态
|
String SMS_SEND_STATUS = "system_sms_send_status"; // 短信发送状态
|
||||||
String SMS_RECEIVE_STATUS = "system_sms_receive_status"; // 短信接收状态
|
String SMS_RECEIVE_STATUS = "system_sms_receive_status"; // 短信接收状态
|
||||||
|
|
||||||
|
String DEPT_EXTERNAL_SYSTEM = "system_dept_external_system"; // 部门外部系统标识
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ public class DeptSaveReqVO {
|
|||||||
@Size(max = 50, message = "部门编码长度不能超过 50 个字符")
|
@Size(max = 50, message = "部门编码长度不能超过 50 个字符")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统标识,用于建立编码映射", example = "ERP")
|
||||||
|
private String externalSystemCode;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统组织编码,用于建立映射", example = "ERP-001")
|
||||||
|
private String externalDeptCode;
|
||||||
|
|
||||||
|
@Schema(description = "外部系统组织名称", example = "ERP总部")
|
||||||
|
private String externalDeptName;
|
||||||
|
|
||||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "ZT")
|
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "ZT")
|
||||||
@NotBlank(message = "部门名称不能为空")
|
@NotBlank(message = "部门名称不能为空")
|
||||||
@Size(max = 30, message = "部门名称长度不能超过 30 个字符")
|
@Size(max = 30, message = "部门名称长度不能超过 30 个字符")
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public interface DeptExternalCodeMapper extends BaseMapperX<DeptExternalCodeDO>
|
|||||||
return selectList(DeptExternalCodeDO::getDeptId, deptId);
|
return selectList(DeptExternalCodeDO::getDeptId, deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default int deleteByDeptId(Long deptId) {
|
||||||
|
return delete(DeptExternalCodeDO::getDeptId, deptId);
|
||||||
|
}
|
||||||
|
|
||||||
default List<DeptExternalCodeDO> selectListBySystemCode(String systemCode) {
|
default List<DeptExternalCodeDO> selectListBySystemCode(String systemCode) {
|
||||||
return selectList(DeptExternalCodeDO::getSystemCode, systemCode);
|
return selectList(DeptExternalCodeDO::getSystemCode, systemCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,14 @@ public interface RedisKeyConstants {
|
|||||||
*/
|
*/
|
||||||
String DEPT_CHILDREN_ID_LIST = "dept_children_ids";
|
String DEPT_CHILDREN_ID_LIST = "dept_children_ids";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定部门的外部组织编码映射列表缓存
|
||||||
|
* <p>
|
||||||
|
* KEY 格式:dept_external_code_list:{deptId}
|
||||||
|
* VALUE 数据类型:String 映射列表
|
||||||
|
*/
|
||||||
|
String DEPT_EXTERNAL_CODE_LIST = "dept_external_code_list";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色的缓存
|
* 角色的缓存
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -49,6 +49,26 @@ public interface DeptExternalCodeService {
|
|||||||
*/
|
*/
|
||||||
List<DeptExternalCodeDO> getDeptExternalCodeListByDeptId(Long deptId);
|
List<DeptExternalCodeDO> getDeptExternalCodeListByDeptId(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门与外部系统保存/更新映射(存在则更新,不存在则创建)
|
||||||
|
*
|
||||||
|
* @param deptId 本系统部门 ID
|
||||||
|
* @param systemCode 外部系统标识
|
||||||
|
* @param externalDeptCode 外部系统组织编码
|
||||||
|
* @param externalDeptName 外部系统组织名称(可选)
|
||||||
|
* @param status 状态,默认启用
|
||||||
|
* @return 映射记录 ID
|
||||||
|
*/
|
||||||
|
Long saveOrUpdateDeptExternalCode(Long deptId, String systemCode, String externalDeptCode, String externalDeptName,
|
||||||
|
Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门删除全部外部编码映射
|
||||||
|
*
|
||||||
|
* @param deptId 部门编号
|
||||||
|
*/
|
||||||
|
void deleteDeptExternalCodesByDeptId(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据外部系统与外部组织编码查询映射
|
* 根据外部系统与外部组织编码查询映射
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user