增加客户端负载均衡
This commit is contained in:
parent
365f43fc49
commit
41cbbdb228
33
.fastRequest/config/fastRequestCurrentProjectConfig.json
Normal file
33
.fastRequest/config/fastRequestCurrentProjectConfig.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"apiDocTemplate":"#if (${namingPolicy}=='byDoc')\n$H1 ${methodDescription}\n#else\n$H1 $!{methodName}\n\n$H3 Method description\n\n```\n$!{methodDescription}\n```\n#end\n\n> URL: $!{url}\n>\n> Origin Url: $!{originUrl}\n>\n> Type: $!{methodType}\n\n\n$H3 Request headers\n\n|Header Name| Header Value|\n|---------|------|\n#foreach( $h in ${headerList})\n|$h.type|$h.value|\n#end\n\n$H3 Parameters\n\n$H5 Path parameters\n\n| Parameter | Type | Value | Description |\n|---------|------|------|------------|\n#foreach( $node in ${pathKeyValueList})\n|$node.key|$!{node.type}|$!{node.value}|$!{node.comment}|\n#end\n\n\n$H5 URL parameters\n\n|Required| Parameter | Type | Value | Description |\n|---------|---------|------|------|------------|\n#foreach( $node in ${urlParamsKeyValueList})\n|$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|\n#end\n\n\n$H5 Body parameters\n\n$H6 JSON\n\n```\n${jsonParam}\n```\n\n$H6 JSON document\n\n```\n${jsonParamDocument}\n```\n\n\n$H5 Form URL-Encoded\n|Required| Parameter | Type | Value | Description |\n|---------|---------|------|------|------------|\n#foreach( $node in ${urlEncodedKeyValueList})\n|$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|\n#end\n\n\n$H5 Multipart\n|Required | Parameter | Type | Value | Description |\n|---------|---------|------|------|------------|\n#foreach( $node in ${multipartKeyValueList})\n|$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|\n#end\n\n\n$H3 Response\n\n$H5 Response example\n\n```\n$!{responseExample}\n```\n\n$H5 Response document\n```\n$!{returnDocument}\n```\n\n\n",
|
||||||
|
"apifoxSetting":{
|
||||||
|
"domain":"https://api.apifox.com",
|
||||||
|
"syncAfterSave":false
|
||||||
|
},
|
||||||
|
"dataList":[],
|
||||||
|
"envList":[],
|
||||||
|
"headerList":[],
|
||||||
|
"ignoreParseFieldList":[],
|
||||||
|
"maxDescriptionLength":-1,
|
||||||
|
"pmCollectionId":"",
|
||||||
|
"postScript":"",
|
||||||
|
"preScript":"",
|
||||||
|
"projectList":[],
|
||||||
|
"syncModel":{
|
||||||
|
"branch":"master",
|
||||||
|
"domain":"https://github.com",
|
||||||
|
"enabled":false,
|
||||||
|
"gitToken":"",
|
||||||
|
"namingPolicy":"byDoc",
|
||||||
|
"owner":"",
|
||||||
|
"repo":"",
|
||||||
|
"repoUrl":"",
|
||||||
|
"syncAfterRun":false,
|
||||||
|
"type":"github"
|
||||||
|
},
|
||||||
|
"syncPmAfterSave":false,
|
||||||
|
"urlEncodedKeyValueList":[],
|
||||||
|
"urlParamsKeyValueList":[],
|
||||||
|
"urlSuffix":"",
|
||||||
|
"workspaceId":""
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"apifoxRelationMap":{},
|
||||||
|
"apifoxServerMap":{},
|
||||||
|
"environment":{},
|
||||||
|
"pmRelationMap":{}
|
||||||
|
}
|
@ -77,12 +77,11 @@
|
|||||||
<xercesImpl.version>2.12.2</xercesImpl.version>
|
<xercesImpl.version>2.12.2</xercesImpl.version>
|
||||||
<weixin-java.version>4.6.0</weixin-java.version>
|
<weixin-java.version>4.6.0</weixin-java.version>
|
||||||
<!-- flatlaf -->
|
<!-- flatlaf -->
|
||||||
<flatlaf.version>3.5</flatlaf.version>
|
<flatlaf.version>3.5.2</flatlaf.version>
|
||||||
<!-- jfreechart -->
|
<!-- jfreechart -->
|
||||||
<jfreechart.version>1.5.3</jfreechart.version>
|
<jfreechart.version>1.5.3</jfreechart.version>
|
||||||
<!-- pinyin4j -->
|
<!-- pinyin4j -->
|
||||||
<pinyin4j.version>2.5.1</pinyin4j.version>
|
<pinyin4j.version>2.5.1</pinyin4j.version>
|
||||||
<openfeign.version>13.3</openfeign.version>
|
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -653,44 +652,7 @@
|
|||||||
<version>${jfreechart.version}</version>
|
<version>${jfreechart.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--openfeign-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-core</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-ribbon</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-gson</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-jackson</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-slf4j</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-form</artifactId>
|
|
||||||
<version>${openfeign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 用户类型不匹配,无权限
|
// 用户类型不匹配,无权限
|
||||||
// 注意:只有 /admin-api/* 和 /app-api/* 有 userType,才需要比对用户类型
|
// 注意:只有 /* 和 /app-api/* 有 userType,才需要比对用户类型
|
||||||
// 类似 WebSocket 的 /ws/* 连接地址,是不需要比对用户类型的
|
// 类似 WebSocket 的 /ws/* 连接地址,是不需要比对用户类型的
|
||||||
if (userType != null
|
if (userType != null
|
||||||
&& ObjectUtil.notEqual(accessToken.getUserType(), userType)) {
|
&& ObjectUtil.notEqual(accessToken.getUserType(), userType)) {
|
||||||
|
@ -117,7 +117,7 @@ public class DillonSwaggerAutoConfiguration {
|
|||||||
public static GroupedOpenApi buildGroupedOpenApi(String group, String path) {
|
public static GroupedOpenApi buildGroupedOpenApi(String group, String path) {
|
||||||
return GroupedOpenApi.builder()
|
return GroupedOpenApi.builder()
|
||||||
.group(group)
|
.group(group)
|
||||||
.pathsToMatch("/admin-api/" + path + "/**", "/app-api/" + path + "/**")
|
.pathsToMatch("/" + path + "/**", "/app-api/" + path + "/**")
|
||||||
.addOperationCustomizer((operation, handlerMethod) -> operation
|
.addOperationCustomizer((operation, handlerMethod) -> operation
|
||||||
.addParametersItem(buildTenantHeaderParameter())
|
.addParametersItem(buildTenantHeaderParameter())
|
||||||
.addParametersItem(buildSecurityHeaderParameter()))
|
.addParametersItem(buildSecurityHeaderParameter()))
|
||||||
|
@ -63,7 +63,7 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
|
|||||||
* @return URL 访问地址
|
* @return URL 访问地址
|
||||||
*/
|
*/
|
||||||
protected String formatFileUrl(String domain, String path) {
|
protected String formatFileUrl(String domain, String path) {
|
||||||
return StrUtil.format("{}/admin-api/infra/file/{}/get/{}", domain, getId(), path);
|
return StrUtil.format("{}/infra/file/{}/get/{}", domain, getId(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
### 获取租户编号 /admin-api/system/get-id-by-name
|
### 获取租户编号 /system/get-id-by-name
|
||||||
GET {{baseUrl}}/system/tenant/get-id-by-name?name=芋道源码
|
GET {{baseUrl}}/system/tenant/get-id-by-name?name=芋道源码
|
||||||
|
|
||||||
### 创建租户 /admin-api/system/tenant/create
|
### 创建租户 /system/tenant/create
|
||||||
POST {{baseUrl}}/system/tenant/create
|
POST {{baseUrl}}/system/tenant/create
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Authorization: Bearer {{token}}
|
Authorization: Bearer {{token}}
|
||||||
|
@ -15,45 +15,45 @@ import static com.lw.dillon.admin.framework.common.exception.enums.GlobalErrorCo
|
|||||||
@RestController
|
@RestController
|
||||||
public class DefaultController {
|
public class DefaultController {
|
||||||
|
|
||||||
@RequestMapping("/admin-api/bpm/**")
|
@RequestMapping("/bpm/**")
|
||||||
public CommonResult<Boolean> bpm404() {
|
public CommonResult<Boolean> bpm404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[工作流模块 dillon-module-bpm - 已禁用][参考 https://doc.iocoder.cn/bpm/ 开启]");
|
"[工作流模块 dillon-module-bpm - 已禁用][参考 https://doc.iocoder.cn/bpm/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/admin-api/mp/**")
|
@RequestMapping("/mp/**")
|
||||||
public CommonResult<Boolean> mp404() {
|
public CommonResult<Boolean> mp404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[微信公众号 dillon-module-mp - 已禁用][参考 https://doc.iocoder.cn/mp/build/ 开启]");
|
"[微信公众号 dillon-module-mp - 已禁用][参考 https://doc.iocoder.cn/mp/build/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/admin-api/product/**", // 商品中心
|
@RequestMapping(value = {"/product/**", // 商品中心
|
||||||
"/admin-api/trade/**", // 交易中心
|
"/trade/**", // 交易中心
|
||||||
"/admin-api/promotion/**"}) // 营销中心
|
"/promotion/**"}) // 营销中心
|
||||||
public CommonResult<Boolean> mall404() {
|
public CommonResult<Boolean> mall404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[商城系统 dillon-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]");
|
"[商城系统 dillon-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/admin-api/erp/**")
|
@RequestMapping("/erp/**")
|
||||||
public CommonResult<Boolean> erp404() {
|
public CommonResult<Boolean> erp404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[ERP 模块 dillon-module-erp - 已禁用][参考 https://doc.iocoder.cn/erp/build/ 开启]");
|
"[ERP 模块 dillon-module-erp - 已禁用][参考 https://doc.iocoder.cn/erp/build/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/admin-api/crm/**")
|
@RequestMapping("/crm/**")
|
||||||
public CommonResult<Boolean> crm404() {
|
public CommonResult<Boolean> crm404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[CRM 模块 dillon-module-crm - 已禁用][参考 https://doc.iocoder.cn/crm/build/ 开启]");
|
"[CRM 模块 dillon-module-crm - 已禁用][参考 https://doc.iocoder.cn/crm/build/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/admin-api/report/**"})
|
@RequestMapping(value = {"/report/**"})
|
||||||
public CommonResult<Boolean> report404() {
|
public CommonResult<Boolean> report404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[报表模块 dillon-module-report - 已禁用][参考 https://doc.iocoder.cn/report/ 开启]");
|
"[报表模块 dillon-module-report - 已禁用][参考 https://doc.iocoder.cn/report/ 开启]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/admin-api/pay/**"})
|
@RequestMapping(value = {"/pay/**"})
|
||||||
public CommonResult<Boolean> pay404() {
|
public CommonResult<Boolean> pay404() {
|
||||||
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
||||||
"[支付模块 dillon-module-pay - 已禁用][参考 https://doc.iocoder.cn/pay/build/ 开启]");
|
"[支付模块 dillon-module-pay - 已禁用][参考 https://doc.iocoder.cn/pay/build/ 开启]");
|
||||||
|
@ -170,8 +170,8 @@ dillon:
|
|||||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||||
pay:
|
pay:
|
||||||
order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址
|
order-notify-url: http://yunai.natapp1.cc/pay/notify/order # 支付渠道的【支付】回调地址
|
||||||
refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址
|
refund-notify-url: http://yunai.natapp1.cc/pay/notify/refund # 支付渠道的【退款】回调地址
|
||||||
demo: true # 开启演示模式
|
demo: true # 开启演示模式
|
||||||
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
||||||
|
|
||||||
|
@ -215,8 +215,8 @@ dillon:
|
|||||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||||
pay:
|
pay:
|
||||||
order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址
|
order-notify-url: http://yunai.natapp1.cc/pay/notify/order # 支付渠道的【支付】回调地址
|
||||||
refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址
|
refund-notify-url: http://yunai.natapp1.cc/pay/notify/refund # 支付渠道的【退款】回调地址
|
||||||
access-log: # 访问日志的配置项
|
access-log: # 访问日志的配置项
|
||||||
enable: false
|
enable: false
|
||||||
demo: false # 关闭演示模式
|
demo: false # 关闭演示模式
|
||||||
|
@ -153,7 +153,7 @@ dillon:
|
|||||||
url: http://dashboard.dillon.iocoder.cn # Admin 管理后台 UI 的地址
|
url: http://dashboard.dillon.iocoder.cn # Admin 管理后台 UI 的地址
|
||||||
security:
|
security:
|
||||||
permit-all_urls:
|
permit-all_urls:
|
||||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
- /mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
||||||
websocket:
|
websocket:
|
||||||
enable: true # websocket的开关
|
enable: true # websocket的开关
|
||||||
path: /infra/ws # 路径
|
path: /infra/ws # 路径
|
||||||
@ -184,15 +184,15 @@ dillon:
|
|||||||
tenant: # 多租户相关配置项
|
tenant: # 多租户相关配置项
|
||||||
enable: false
|
enable: false
|
||||||
ignore-urls:
|
ignore-urls:
|
||||||
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
- /system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
||||||
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
|
- /system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
|
||||||
- /admin-api/system/captcha/get # 获取图片验证码,和租户无关
|
- /system/captcha/get # 获取图片验证码,和租户无关
|
||||||
- /admin-api/system/captcha/check # 校验图片验证码,和租户无关
|
- /system/captcha/check # 校验图片验证码,和租户无关
|
||||||
- /admin-api/infra/file/*/get/** # 获取图片,和租户无关
|
- /infra/file/*/get/** # 获取图片,和租户无关
|
||||||
- /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号
|
- /system/sms/callback/* # 短信回调接口,无法带上租户编号
|
||||||
- /admin-api/pay/notify/** # 支付回调通知,不携带租户编号
|
- /pay/notify/** # 支付回调通知,不携带租户编号
|
||||||
- /jmreport/* # 积木报表,无法携带租户编号
|
- /jmreport/* # 积木报表,无法携带租户编号
|
||||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号
|
- /mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号
|
||||||
ignore-tables:
|
ignore-tables:
|
||||||
- system_tenant
|
- system_tenant
|
||||||
- system_tenant_package
|
- system_tenant_package
|
||||||
|
@ -20,37 +20,56 @@
|
|||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<openfeign.version>13.5</openfeign.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!--openfeign-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-core</artifactId>
|
<artifactId>feign-core</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-okhttp</artifactId>
|
<artifactId>feign-okhttp</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-ribbon</artifactId>
|
<artifactId>feign-ribbon</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-gson</artifactId>
|
<artifactId>feign-gson</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-jackson</artifactId>
|
<artifactId>feign-jackson</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-slf4j</artifactId>
|
<artifactId>feign-slf4j</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign.form</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-hystrix</artifactId>
|
||||||
|
<version>${openfeign.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-form</artifactId>
|
<artifactId>feign-form</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>${openfeign.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.netflix.ribbon</groupId>
|
||||||
|
<artifactId>ribbon-httpclient</artifactId>
|
||||||
|
<version>2.7.18</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign.form</groupId>
|
<groupId>io.github.openfeign.form</groupId>
|
||||||
@ -82,6 +101,7 @@
|
|||||||
<version>2.1.0-jdk8-snapshot</version>
|
<version>2.1.0-jdk8-snapshot</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -13,7 +13,7 @@ public interface ApiAccessLogFeign extends BaseFeignApi {
|
|||||||
|
|
||||||
|
|
||||||
// "获得API 访问日志分页")
|
// "获得API 访问日志分页")
|
||||||
@RequestLine("GET /admin-api/infra/api-access-log/page")
|
@RequestLine("GET /infra/api-access-log/page")
|
||||||
CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@QueryMap Map<String,Object> pageReqVO);
|
CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@QueryMap Map<String,Object> pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@ public interface ApiErrorLogFeign extends BaseFeignApi {
|
|||||||
|
|
||||||
// "更新 API 错误日志的状态")
|
// "更新 API 错误日志的状态")
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/infra/api-error-log/update-status?id={id}&processStatus={processStatus}")
|
@RequestLine("PUT /infra/api-error-log/update-status?id={id}&processStatus={processStatus}")
|
||||||
CommonResult<Boolean> updateApiErrorLogProcess(@Param("id") Long id,
|
CommonResult<Boolean> updateApiErrorLogProcess(@Param("id") Long id,
|
||||||
@Param("processStatus") Integer processStatus);
|
@Param("processStatus") Integer processStatus);
|
||||||
|
|
||||||
// "获得 API 错误日志分页")
|
// "获得 API 错误日志分页")
|
||||||
@RequestLine("GET /admin-api/infra/api-error-log/page")
|
@RequestLine("GET /infra/api-error-log/page")
|
||||||
CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@QueryMap Map<String,Object> pageReqVO);
|
CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@QueryMap Map<String,Object> pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,32 +14,32 @@ import java.util.Map;
|
|||||||
public interface ConfigFeign extends BaseFeignApi {
|
public interface ConfigFeign extends BaseFeignApi {
|
||||||
|
|
||||||
//"创建参数配置")
|
//"创建参数配置")
|
||||||
@RequestLine("POST /admin-api/infra/config/create")
|
@RequestLine("POST /infra/config/create")
|
||||||
public CommonResult<Long> createConfig(ConfigSaveReqVO createReqVO);
|
public CommonResult<Long> createConfig(ConfigSaveReqVO createReqVO);
|
||||||
|
|
||||||
//"修改参数配置")
|
//"修改参数配置")
|
||||||
@RequestLine("PUT /admin-api/infra/config/update")
|
@RequestLine("PUT /infra/config/update")
|
||||||
public CommonResult<Boolean> updateConfig(ConfigSaveReqVO updateReqVO);
|
public CommonResult<Boolean> updateConfig(ConfigSaveReqVO updateReqVO);
|
||||||
|
|
||||||
//"删除参数配置")
|
//"删除参数配置")
|
||||||
@RequestLine("DELETE /admin-api/infra/config/delete?id={id}")
|
@RequestLine("DELETE /infra/config/delete?id={id}")
|
||||||
public CommonResult<Boolean> deleteConfig(@Param("id") Long id);
|
public CommonResult<Boolean> deleteConfig(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得参数配置")
|
//"获得参数配置")
|
||||||
@RequestLine("GET /admin-api/infra/config/get?id={id}")
|
@RequestLine("GET /infra/config/get?id={id}")
|
||||||
public CommonResult<ConfigRespVO> getConfig(@Param("id") Long id);
|
public CommonResult<ConfigRespVO> getConfig(@Param("id") Long id);
|
||||||
|
|
||||||
//"根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
//"根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
||||||
@RequestLine("GET /admin-api/infra/config/get-value-by-key?key={key}")
|
@RequestLine("GET /infra/config/get-value-by-key?key={key}")
|
||||||
public CommonResult<String> getConfigKey(@Param("key") String key);
|
public CommonResult<String> getConfigKey(@Param("key") String key);
|
||||||
|
|
||||||
//"根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
//"根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
||||||
@RequestLine("GET /admin-api/infra/config/get-by-key?key={key}")
|
@RequestLine("GET /infra/config/get-by-key?key={key}")
|
||||||
public CommonResult<ConfigRespVO> getConfig(@Param("key") String key);
|
public CommonResult<ConfigRespVO> getConfig(@Param("key") String key);
|
||||||
|
|
||||||
|
|
||||||
//"获取参数配置分页")
|
//"获取参数配置分页")
|
||||||
@RequestLine("GET /admin-api/infra/config/page")
|
@RequestLine("GET /infra/config/page")
|
||||||
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@QueryMap Map<String, Object> pageReqVO);
|
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@QueryMap Map<String, Object> pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,30 +14,30 @@ import java.util.Map;
|
|||||||
public interface FileConfigFeign extends BaseFeignApi {
|
public interface FileConfigFeign extends BaseFeignApi {
|
||||||
|
|
||||||
//"创建文件配置")
|
//"创建文件配置")
|
||||||
@RequestLine("POST /admin-api/infra/file-config/create")
|
@RequestLine("POST /infra/file-config/create")
|
||||||
CommonResult<Long> createFileConfig( FileConfigSaveReqVO createReqVO);
|
CommonResult<Long> createFileConfig( FileConfigSaveReqVO createReqVO);
|
||||||
|
|
||||||
//"更新文件配置")
|
//"更新文件配置")
|
||||||
@RequestLine("PUT /admin-api/infra/file-config/update")
|
@RequestLine("PUT /infra/file-config/update")
|
||||||
CommonResult<Boolean> updateFileConfig( FileConfigSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateFileConfig( FileConfigSaveReqVO updateReqVO);
|
||||||
|
|
||||||
//"更新文件配置为 Master")
|
//"更新文件配置为 Master")
|
||||||
@RequestLine("PUT /admin-api/infra/file-config/update-master?id={id}")
|
@RequestLine("PUT /infra/file-config/update-master?id={id}")
|
||||||
CommonResult<Boolean> updateFileConfigMaster(@Param("id") Long id);
|
CommonResult<Boolean> updateFileConfigMaster(@Param("id") Long id);
|
||||||
|
|
||||||
//"删除文件配置")
|
//"删除文件配置")
|
||||||
@RequestLine("DELETE /admin-api/infra/file-config/delete?id={id}")
|
@RequestLine("DELETE /infra/file-config/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteFileConfig(@Param("id") Long id);
|
CommonResult<Boolean> deleteFileConfig(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得文件配置")
|
//"获得文件配置")
|
||||||
@RequestLine("GET /admin-api/infra/file-config/get?id={id}")
|
@RequestLine("GET /infra/file-config/get?id={id}")
|
||||||
CommonResult<JsonObject> getFileConfig(@Param("id") Long id);
|
CommonResult<JsonObject> getFileConfig(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得文件配置分页")
|
//"获得文件配置分页")
|
||||||
@RequestLine("GET /admin-api/infra/file-config/page")
|
@RequestLine("GET /infra/file-config/page")
|
||||||
CommonResult<PageResult<JsonObject>> getFileConfigPage(@QueryMap Map<String,Object> map);
|
CommonResult<PageResult<JsonObject>> getFileConfigPage(@QueryMap Map<String,Object> map);
|
||||||
|
|
||||||
//"测试文件配置是否正确")
|
//"测试文件配置是否正确")
|
||||||
@RequestLine("GET /admin-api/infra/file-config/test?id={id}")
|
@RequestLine("GET /infra/file-config/test?id={id}")
|
||||||
CommonResult<String> testFileConfig(@Param("id") Long id) throws Exception;
|
CommonResult<String> testFileConfig(@Param("id") Long id) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -18,29 +18,29 @@ public interface FileFeign extends BaseFeignApi {
|
|||||||
|
|
||||||
|
|
||||||
// "上传文件", description = "模式一:后端上传文件")
|
// "上传文件", description = "模式一:后端上传文件")
|
||||||
@RequestLine("POST /admin-api/infra/file/upload")
|
@RequestLine("POST /infra/file/upload")
|
||||||
@Headers("Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypATHfppjzqwXomVO")
|
@Headers("Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypATHfppjzqwXomVO")
|
||||||
CommonResult<String> uploadFile(@Param("path") String path, @Param("file") File file);
|
CommonResult<String> uploadFile(@Param("path") String path, @Param("file") File file);
|
||||||
|
|
||||||
|
|
||||||
// "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器")
|
// "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器")
|
||||||
@RequestLine("GET /admin-api/infra/file/presigned-url?path={path}")
|
@RequestLine("GET /infra/file/presigned-url?path={path}")
|
||||||
CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@Param("path") String path);
|
CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@Param("path") String path);
|
||||||
|
|
||||||
// "创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件")
|
// "创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件")
|
||||||
@RequestLine("POST /admin-api/infra/file/create")
|
@RequestLine("POST /infra/file/create")
|
||||||
CommonResult<Long> createFile(FileCreateReqVO createReqVO);
|
CommonResult<Long> createFile(FileCreateReqVO createReqVO);
|
||||||
|
|
||||||
// "删除文件")
|
// "删除文件")
|
||||||
@RequestLine("DELETE /admin-api/infra/file/delete?id={id}")
|
@RequestLine("DELETE /infra/file/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteFile(@Param("id") Long id);
|
CommonResult<Boolean> deleteFile(@Param("id") Long id);
|
||||||
|
|
||||||
// "下载文件")
|
// "下载文件")
|
||||||
@RequestLine("GET /admin-api/infra/file/{configId}/get/**")
|
@RequestLine("GET /infra/file/{configId}/get/**")
|
||||||
void getFileContent(@Param("configId") Long configId) throws Exception;
|
void getFileContent(@Param("configId") Long configId) throws Exception;
|
||||||
|
|
||||||
// "获得文件分页")
|
// "获得文件分页")
|
||||||
@RequestLine("GET /admin-api/infra/file/page")
|
@RequestLine("GET /infra/file/page")
|
||||||
CommonResult<PageResult<FileRespVO>> getFilePage(@QueryMap Map<String, Object> pageVO);
|
CommonResult<PageResult<FileRespVO>> getFilePage(@QueryMap Map<String, Object> pageVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,41 +17,41 @@ public interface JobFeign extends BaseFeignApi {
|
|||||||
|
|
||||||
|
|
||||||
// "创建定时任务")
|
// "创建定时任务")
|
||||||
@RequestLine("POST /admin-api/infra/job/create")
|
@RequestLine("POST /infra/job/create")
|
||||||
CommonResult<Long> createJob(JobSaveReqVO createReqVO);
|
CommonResult<Long> createJob(JobSaveReqVO createReqVO);
|
||||||
|
|
||||||
// "更新定时任务")
|
// "更新定时任务")
|
||||||
@RequestLine("PUT /admin-api/infra/job/update")
|
@RequestLine("PUT /infra/job/update")
|
||||||
CommonResult<Boolean> updateJob(JobSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateJob(JobSaveReqVO updateReqVO);
|
||||||
|
|
||||||
// "更新定时任务的状态")
|
// "更新定时任务的状态")
|
||||||
@RequestLine("PUT /admin-api/infra/job/update-status?id={id}&status={status}")
|
@RequestLine("PUT /infra/job/update-status?id={id}&status={status}")
|
||||||
CommonResult<Boolean> updateJobStatus(@Param("id") Long id, @Param("status") Integer status);
|
CommonResult<Boolean> updateJobStatus(@Param("id") Long id, @Param("status") Integer status);
|
||||||
|
|
||||||
// "删除定时任务")
|
// "删除定时任务")
|
||||||
@RequestLine("DELETE /admin-api/infra/job/delete?id={id}")
|
@RequestLine("DELETE /infra/job/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteJob(@Param("id") Long id);
|
CommonResult<Boolean> deleteJob(@Param("id") Long id);
|
||||||
|
|
||||||
// "触发定时任务")
|
// "触发定时任务")
|
||||||
@RequestLine("PUT /admin-api/infra/job/trigger?id={id}")
|
@RequestLine("PUT /infra/job/trigger?id={id}")
|
||||||
CommonResult<Boolean> triggerJob(@Param("id") Long id);
|
CommonResult<Boolean> triggerJob(@Param("id") Long id);
|
||||||
|
|
||||||
// "同步定时任务")
|
// "同步定时任务")
|
||||||
@RequestLine("POST /admin-api/infra/job/sync")
|
@RequestLine("POST /infra/job/sync")
|
||||||
CommonResult<Boolean> syncJob();
|
CommonResult<Boolean> syncJob();
|
||||||
|
|
||||||
// "获得定时任务")
|
// "获得定时任务")
|
||||||
@RequestLine("GET /admin-api/infra/job/get?id={id}")
|
@RequestLine("GET /infra/job/get?id={id}")
|
||||||
CommonResult<JobRespVO> getJob(@Param("id") Long id);
|
CommonResult<JobRespVO> getJob(@Param("id") Long id);
|
||||||
|
|
||||||
// "获得定时任务分页")
|
// "获得定时任务分页")
|
||||||
@RequestLine("GET /admin-api/infra/job/page")
|
@RequestLine("GET /infra/job/page")
|
||||||
CommonResult<PageResult<JobRespVO>> getJobPage(@QueryMap Map<String,Object> pageVO);
|
CommonResult<PageResult<JobRespVO>> getJobPage(@QueryMap Map<String,Object> pageVO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// "获得定时任务的下 n 次执行时间")
|
// "获得定时任务的下 n 次执行时间")
|
||||||
@RequestLine("GET /admin-api/infra/job/get_next_times?id={id}&count={count}")
|
@RequestLine("GET /infra/job/get_next_times?id={id}&count={count}")
|
||||||
CommonResult<List<LocalDateTime>> getJobNextTimes(
|
CommonResult<List<LocalDateTime>> getJobNextTimes(
|
||||||
@Param("id") Long id,
|
@Param("id") Long id,
|
||||||
@Param("count") Integer count);
|
@Param("count") Integer count);
|
||||||
|
@ -14,11 +14,11 @@ public interface JobLogFeign extends BaseFeignApi {
|
|||||||
|
|
||||||
|
|
||||||
//"获得定时任务日志")
|
//"获得定时任务日志")
|
||||||
@RequestLine("GET /admin-api/infra/job-log/get?id={id}")
|
@RequestLine("GET /infra/job-log/get?id={id}")
|
||||||
CommonResult<JobLogRespVO> getJobLog(@Param("id") Long id);
|
CommonResult<JobLogRespVO> getJobLog(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得定时任务日志分页")
|
//"获得定时任务日志分页")
|
||||||
@RequestLine("GET /admin-api/infra/job-log/page")
|
@RequestLine("GET /infra/job-log/page")
|
||||||
CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@QueryMap Map<String,Object> pageVO);
|
CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@QueryMap Map<String,Object> pageVO);
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ import feign.RequestLine;
|
|||||||
|
|
||||||
public interface AuthFeign extends BaseFeignApi {
|
public interface AuthFeign extends BaseFeignApi {
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/auth/login")
|
@RequestLine("POST /system/auth/login")
|
||||||
CommonResult<AuthLoginRespVO> login(AuthLoginReqVO authLoginReqVO);
|
CommonResult<AuthLoginRespVO> login(AuthLoginReqVO authLoginReqVO);
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/auth/logout")
|
@RequestLine("POST /system/auth/logout")
|
||||||
CommonResult<Boolean> logout();
|
CommonResult<Boolean> logout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +21,6 @@ public interface AuthFeign extends BaseFeignApi {
|
|||||||
*
|
*
|
||||||
* @return {@link CommonResult }<{@link AuthPermissionInfoRespVO }>
|
* @return {@link CommonResult }<{@link AuthPermissionInfoRespVO }>
|
||||||
*/
|
*/
|
||||||
@RequestLine("GET /admin-api/system/auth/get-permission-info")
|
@RequestLine("GET /system/auth/get-permission-info")
|
||||||
CommonResult<AuthPermissionInfoRespVO> getPermissionInfo();
|
CommonResult<AuthPermissionInfoRespVO> getPermissionInfo();
|
||||||
}
|
}
|
||||||
|
@ -15,22 +15,22 @@ import java.util.List;
|
|||||||
public interface DeptFeign extends BaseFeignApi {
|
public interface DeptFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/dept/create")
|
@RequestLine("POST /system/dept/create")
|
||||||
CommonResult<Long> createDept( DeptSaveReqVO createReqVO);
|
CommonResult<Long> createDept( DeptSaveReqVO createReqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/dept/update")
|
@RequestLine("PUT /system/dept/update")
|
||||||
CommonResult<Boolean> updateDept( DeptSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateDept( DeptSaveReqVO updateReqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/dept/delete?id={id}")
|
@RequestLine("DELETE /system/dept/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteDept(@Param("id") Long id);
|
CommonResult<Boolean> deleteDept(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dept/list")
|
@RequestLine("GET /system/dept/list")
|
||||||
CommonResult<List<DeptRespVO>> getDeptList(@QueryMap DeptListReqVO reqVO);
|
CommonResult<List<DeptRespVO>> getDeptList(@QueryMap DeptListReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dept/simple-list")
|
@RequestLine("GET /system/dept/simple-list")
|
||||||
CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList();
|
CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList();
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dept/get?id={id}")
|
@RequestLine("GET /system/dept/get?id={id}")
|
||||||
CommonResult<DeptRespVO> getDept(@Param("id") Long id);
|
CommonResult<DeptRespVO> getDept(@Param("id") Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,22 @@ import java.util.Map;
|
|||||||
public interface DictDataFeign extends BaseFeignApi {
|
public interface DictDataFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/dict-data/create")
|
@RequestLine("POST /system/dict-data/create")
|
||||||
CommonResult<Long> createDictData(DictDataSaveReqVO createReqVO);
|
CommonResult<Long> createDictData(DictDataSaveReqVO createReqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/dict-data/update")
|
@RequestLine("PUT /system/dict-data/update")
|
||||||
CommonResult<Boolean> updateDictData(DictDataSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateDictData(DictDataSaveReqVO updateReqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/dict-data/delete?id={id}")
|
@RequestLine("DELETE /system/dict-data/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteDictData(@Param("id") Long id);
|
CommonResult<Boolean> deleteDictData(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-data/simple-list")
|
@RequestLine("GET /system/dict-data/simple-list")
|
||||||
CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList();
|
CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList();
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-data/page")
|
@RequestLine("GET /system/dict-data/page")
|
||||||
CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@QueryMap Map<String,Object> map);
|
CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@QueryMap Map<String,Object> map);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-data/get?id={id}")
|
@RequestLine("GET /system/dict-data/get?id={id}")
|
||||||
CommonResult<DictDataRespVO> getDictData(@Param("id") Long id);
|
CommonResult<DictDataRespVO> getDictData(@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,22 +17,22 @@ import java.util.Map;
|
|||||||
public interface DictTypeFeign extends BaseFeignApi {
|
public interface DictTypeFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/dict-type/create")
|
@RequestLine("POST /system/dict-type/create")
|
||||||
CommonResult<Long> createDictType( DictTypeSaveReqVO createReqVO);
|
CommonResult<Long> createDictType( DictTypeSaveReqVO createReqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/dict-type/update")
|
@RequestLine("PUT /system/dict-type/update")
|
||||||
CommonResult<Boolean> updateDictType( DictTypeSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateDictType( DictTypeSaveReqVO updateReqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/dict-type/delete?id={id}")
|
@RequestLine("DELETE /system/dict-type/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteDictType(@Param("id") Long id);
|
CommonResult<Boolean> deleteDictType(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-type/page")
|
@RequestLine("GET /system/dict-type/page")
|
||||||
CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@QueryMap Map<String,Object> map);
|
CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@QueryMap Map<String,Object> map);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-type/get?id={id}")
|
@RequestLine("GET /system/dict-type/get?id={id}")
|
||||||
CommonResult<DictTypeRespVO> getDictType(@Param("id") Long id);
|
CommonResult<DictTypeRespVO> getDictType(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/dict-type/simple-list")
|
@RequestLine("GET /system/dict-type/simple-list")
|
||||||
// 无需添加权限认证,因为前端全局都需要
|
// 无需添加权限认证,因为前端全局都需要
|
||||||
CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList();
|
CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList();
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@ import java.util.Map;
|
|||||||
public interface LoginLogFeign extends BaseFeignApi {
|
public interface LoginLogFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/login-log/page")
|
@RequestLine("GET /system/login-log/page")
|
||||||
CommonResult<PageResult<LoginLogRespVO>> getLoginLogPage(@QueryMap Map<String, Object> map);
|
CommonResult<PageResult<LoginLogRespVO>> getLoginLogPage(@QueryMap Map<String, Object> map);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/login-log/delete?id={id}")
|
@RequestLine("DELETE /system/login-log/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteLoginLog(@Param("id") Long id);
|
CommonResult<Boolean> deleteLoginLog(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/login-log/clear")
|
@RequestLine("DELETE /system/login-log/clear")
|
||||||
CommonResult<Boolean> clearLoginLog();
|
CommonResult<Boolean> clearLoginLog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,22 +15,22 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface MenuFeign extends BaseFeignApi {
|
public interface MenuFeign extends BaseFeignApi {
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/menu/list")
|
@RequestLine("GET /system/menu/list")
|
||||||
CommonResult<List<MenuRespVO>> getMenuList(@QueryMap MenuListReqVO reqVO);
|
CommonResult<List<MenuRespVO>> getMenuList(@QueryMap MenuListReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/menu/create")
|
@RequestLine("POST /system/menu/create")
|
||||||
CommonResult<Long> createMenu( MenuSaveVO createReqVO);
|
CommonResult<Long> createMenu( MenuSaveVO createReqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/menu/update")
|
@RequestLine("PUT /system/menu/update")
|
||||||
CommonResult<Boolean> updateMenu(MenuSaveVO updateReqVO);
|
CommonResult<Boolean> updateMenu(MenuSaveVO updateReqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/menu/delete?id={id}")
|
@RequestLine("DELETE /system/menu/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteMenu(@Param("id") Long id);
|
CommonResult<Boolean> deleteMenu(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/menu/simple-list")
|
@RequestLine("GET /system/menu/simple-list")
|
||||||
CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList();
|
CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList();
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/menu/get?id={id}")
|
@RequestLine("GET /system/menu/get?id={id}")
|
||||||
CommonResult<MenuRespVO> getMenu(@Param("id") Long id);
|
CommonResult<MenuRespVO> getMenu(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
@ -15,22 +15,22 @@ import java.util.Map;
|
|||||||
public interface NoticeFeign extends BaseFeignApi {
|
public interface NoticeFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/notice/create")
|
@RequestLine("POST /system/notice/create")
|
||||||
CommonResult<Long> createNotice(NoticeSaveReqVO createReqVO);
|
CommonResult<Long> createNotice(NoticeSaveReqVO createReqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/notice/update")
|
@RequestLine("PUT /system/notice/update")
|
||||||
CommonResult<Boolean> updateNotice(NoticeSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateNotice(NoticeSaveReqVO updateReqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/notice/delete?id={id}")
|
@RequestLine("DELETE /system/notice/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteNotice(@Param("id") Long id);
|
CommonResult<Boolean> deleteNotice(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/notice/page")
|
@RequestLine("GET /system/notice/page")
|
||||||
CommonResult<PageResult<NoticeRespVO>> getNoticePage(@QueryMap Map<String,Object> map);
|
CommonResult<PageResult<NoticeRespVO>> getNoticePage(@QueryMap Map<String,Object> map);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/notice/get?id={id}")
|
@RequestLine("GET /system/notice/get?id={id}")
|
||||||
CommonResult<NoticeRespVO> getNotice(@Param("id") Long id);
|
CommonResult<NoticeRespVO> getNotice(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/notice/push?id={id}")
|
@RequestLine("POST /system/notice/push?id={id}")
|
||||||
CommonResult<Boolean> push(@Param("id")Long id);
|
CommonResult<Boolean> push(@Param("id")Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,31 +17,31 @@ public interface NotifyMessageFeign extends BaseFeignApi {
|
|||||||
// ========== 管理所有的站内信 ==========
|
// ========== 管理所有的站内信 ==========
|
||||||
|
|
||||||
//获得站内信")
|
//获得站内信")
|
||||||
@RequestLine("GET /admin-api/system/notify-message/get?id={id}")
|
@RequestLine("GET /system/notify-message/get?id={id}")
|
||||||
CommonResult<NotifyMessageRespVO> getNotifyMessage(@Param("id") Long id);
|
CommonResult<NotifyMessageRespVO> getNotifyMessage(@Param("id") Long id);
|
||||||
|
|
||||||
//获得站内信分页")
|
//获得站内信分页")
|
||||||
@RequestLine("GET /admin-api/system/notify-message/page")
|
@RequestLine("GET /system/notify-message/page")
|
||||||
CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@QueryMap Map<String, Object> pageVO);
|
CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@QueryMap Map<String, Object> pageVO);
|
||||||
|
|
||||||
// ========== 查看自己的站内信 ==========
|
// ========== 查看自己的站内信 ==========
|
||||||
//获得我的站内信分页"
|
//获得我的站内信分页"
|
||||||
@RequestLine("GET /admin-api/system/notify-message/my-page")
|
@RequestLine("GET /system/notify-message/my-page")
|
||||||
CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@QueryMap Map<String, Object> pageVO);
|
CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@QueryMap Map<String, Object> pageVO);
|
||||||
|
|
||||||
//标记站内信为已读")
|
//标记站内信为已读")
|
||||||
@RequestLine("PUT /admin-api/system/notify-message/update-read?ids={ids}")
|
@RequestLine("PUT /system/notify-message/update-read?ids={ids}")
|
||||||
CommonResult<Boolean> updateNotifyMessageRead( @Param("ids")List<Long> ids);
|
CommonResult<Boolean> updateNotifyMessageRead( @Param("ids")List<Long> ids);
|
||||||
|
|
||||||
//标记所有站内信为已读")
|
//标记所有站内信为已读")
|
||||||
@RequestLine("PUT /admin-api/system/notify-message/update-all-read")
|
@RequestLine("PUT /system/notify-message/update-all-read")
|
||||||
CommonResult<Boolean> updateAllNotifyMessageRead();
|
CommonResult<Boolean> updateAllNotifyMessageRead();
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/notify-message/get-unread-list?size={size}")
|
@RequestLine("GET /system/notify-message/get-unread-list?size={size}")
|
||||||
CommonResult<List<NotifyMessageRespVO>> getUnreadNotifyMessageList(@Param("size") Integer size);
|
CommonResult<List<NotifyMessageRespVO>> getUnreadNotifyMessageList(@Param("size") Integer size);
|
||||||
|
|
||||||
//获得当前用户的未读站内信数量")
|
//获得当前用户的未读站内信数量")
|
||||||
@RequestLine("GET /admin-api/system/notify-message/get-unread-count")
|
@RequestLine("GET /system/notify-message/get-unread-count")
|
||||||
CommonResult<Long> getUnreadNotifyMessageCount();
|
CommonResult<Long> getUnreadNotifyMessageCount();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,26 +16,26 @@ import java.util.Map;
|
|||||||
@Tag(name = "管理后台 - 站内信模版")
|
@Tag(name = "管理后台 - 站内信模版")
|
||||||
public interface NotifyTemplateFeign extends BaseFeignApi {
|
public interface NotifyTemplateFeign extends BaseFeignApi {
|
||||||
//"创建站内信模版")
|
//"创建站内信模版")
|
||||||
@RequestLine("POST /admin-api/system/notify-template/create")
|
@RequestLine("POST /system/notify-template/create")
|
||||||
CommonResult<Long> createNotifyTemplate(NotifyTemplateSaveReqVO createReqVO);
|
CommonResult<Long> createNotifyTemplate(NotifyTemplateSaveReqVO createReqVO);
|
||||||
|
|
||||||
//"更新站内信模版")
|
//"更新站内信模版")
|
||||||
@RequestLine("PUT /admin-api/system/notify-template/update")
|
@RequestLine("PUT /system/notify-template/update")
|
||||||
CommonResult<Boolean> updateNotifyTemplate(NotifyTemplateSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateNotifyTemplate(NotifyTemplateSaveReqVO updateReqVO);
|
||||||
|
|
||||||
//"删除站内信模版")
|
//"删除站内信模版")
|
||||||
@RequestLine("DELETE /admin-api/system/notify-template/delete?id={id}")
|
@RequestLine("DELETE /system/notify-template/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteNotifyTemplate(@Param("id") Long id);
|
CommonResult<Boolean> deleteNotifyTemplate(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得站内信模版")
|
//"获得站内信模版")
|
||||||
@RequestLine("GET /admin-api/system/notify-template/get?id={id}")
|
@RequestLine("GET /system/notify-template/get?id={id}")
|
||||||
CommonResult<NotifyTemplateRespVO> getNotifyTemplate(@Param("id") Long id);
|
CommonResult<NotifyTemplateRespVO> getNotifyTemplate(@Param("id") Long id);
|
||||||
|
|
||||||
//"获得站内信模版分页")
|
//"获得站内信模版分页")
|
||||||
@RequestLine("GET /admin-api/system/notify-template/page")
|
@RequestLine("GET /system/notify-template/page")
|
||||||
CommonResult<PageResult<NotifyTemplateRespVO>> getNotifyTemplatePage(@QueryMap Map<String,Object> pageVO);
|
CommonResult<PageResult<NotifyTemplateRespVO>> getNotifyTemplatePage(@QueryMap Map<String,Object> pageVO);
|
||||||
|
|
||||||
//"发送站内信")
|
//"发送站内信")
|
||||||
@RequestLine("POST /admin-api/system/notify-template/send-notify")
|
@RequestLine("POST /system/notify-template/send-notify")
|
||||||
CommonResult<Long> sendNotify(NotifyTemplateSendReqVO sendReqVO);
|
CommonResult<Long> sendNotify(NotifyTemplateSendReqVO sendReqVO);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.lw.ui.request.api.system;
|
||||||
|
|
||||||
|
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||||
|
import com.lw.dillon.admin.framework.common.pojo.PageResult;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientRespVO;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientSaveReqVO;
|
||||||
|
import com.lw.ui.request.api.BaseFeignApi;
|
||||||
|
import feign.Param;
|
||||||
|
import feign.QueryMap;
|
||||||
|
import feign.RequestLine;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface OAuth2ClientFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
|
//(summary = "创建 OAuth2 客户端")
|
||||||
|
@RequestLine("POST /system/oauth2-client/create")
|
||||||
|
CommonResult<Long> createOAuth2Client(OAuth2ClientSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
//(summary = "更新 OAuth2 客户端")
|
||||||
|
@RequestLine("PUT /system/oauth2-client/update")
|
||||||
|
CommonResult<Boolean> updateOAuth2Client(OAuth2ClientSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
//(summary = "删除 OAuth2 客户端")
|
||||||
|
@RequestLine("DELETE /system/oauth2-client/delete")
|
||||||
|
CommonResult<Boolean> deleteOAuth2Client(@Param("id") Long id);
|
||||||
|
|
||||||
|
//(summary = "获得 OAuth2 客户端")
|
||||||
|
@RequestLine("GET /system/oauth2-client/get?id={id}")
|
||||||
|
CommonResult<OAuth2ClientRespVO> getOAuth2Client(@Param("id") Long id);
|
||||||
|
|
||||||
|
//(summary = "获得 OAuth2 客户端分页")
|
||||||
|
@RequestLine("GET /system/oauth2-client/page")
|
||||||
|
CommonResult<PageResult<OAuth2ClientRespVO>> getOAuth2ClientPage(@QueryMap Map<String, Object> params);
|
||||||
|
|
||||||
|
}
|
@ -13,10 +13,10 @@ import java.util.Map;
|
|||||||
public interface OAuth2TokenFeign extends BaseFeignApi {
|
public interface OAuth2TokenFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/oauth2-token/page")
|
@RequestLine("GET /system/oauth2-token/page")
|
||||||
CommonResult<PageResult<OAuth2AccessTokenRespVO>> getAccessTokenPage(@QueryMap Map<String,Object> reqVO);
|
CommonResult<PageResult<OAuth2AccessTokenRespVO>> getAccessTokenPage(@QueryMap Map<String,Object> reqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/oauth2-token/delete?accessToken={accessToken}")
|
@RequestLine("DELETE /system/oauth2-token/delete?accessToken={accessToken}")
|
||||||
CommonResult<Boolean> deleteAccessToken(@Param("accessToken") String accessToken);
|
CommonResult<Boolean> deleteAccessToken(@Param("accessToken") String accessToken);
|
||||||
|
|
||||||
}
|
}
|
@ -14,14 +14,14 @@ import java.util.Map;
|
|||||||
public interface OperateLogFeign extends BaseFeignApi {
|
public interface OperateLogFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/operate-log/page")
|
@RequestLine("GET /system/operate-log/page")
|
||||||
CommonResult<PageResult<OperateLogRespVO>> pageOperateLog(@QueryMap Map<String, Object> map);
|
CommonResult<PageResult<OperateLogRespVO>> pageOperateLog(@QueryMap Map<String, Object> map);
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/operate-log/delete?id={id}")
|
@RequestLine("DELETE /system/operate-log/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteOperateLog(@Param("id") Long id);
|
CommonResult<Boolean> deleteOperateLog(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/operate-log/clear")
|
@RequestLine("DELETE /system/operate-log/clear")
|
||||||
CommonResult<Boolean> clearOperateLog();
|
CommonResult<Boolean> clearOperateLog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,18 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public interface PermissionFeign extends BaseFeignApi {
|
public interface PermissionFeign extends BaseFeignApi {
|
||||||
@RequestLine("GET /admin-api/system/permission/list-role-menus?roleId={roleId}")
|
@RequestLine("GET /system/permission/list-role-menus?roleId={roleId}")
|
||||||
CommonResult<Set<Long>> getRoleMenuList(@Param("roleId") Long roleId);
|
CommonResult<Set<Long>> getRoleMenuList(@Param("roleId") Long roleId);
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/permission/assign-role-menu")
|
@RequestLine("POST /system/permission/assign-role-menu")
|
||||||
CommonResult<Boolean> assignRoleMenu(PermissionAssignRoleMenuReqVO reqVO);
|
CommonResult<Boolean> assignRoleMenu(PermissionAssignRoleMenuReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/permission/assign-role-data-scope")
|
@RequestLine("POST /system/permission/assign-role-data-scope")
|
||||||
CommonResult<Boolean> assignRoleDataScope(PermissionAssignRoleDataScopeReqVO reqVO);
|
CommonResult<Boolean> assignRoleDataScope(PermissionAssignRoleDataScopeReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/permission/list-user-roles?userId={userId}")
|
@RequestLine("GET /system/permission/list-user-roles?userId={userId}")
|
||||||
CommonResult<Set<Long>> listAdminRoles(@Param("userId") Long userId);
|
CommonResult<Set<Long>> listAdminRoles(@Param("userId") Long userId);
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/permission/assign-user-role")
|
@RequestLine("POST /system/permission/assign-user-role")
|
||||||
CommonResult<Boolean> assignUserRole(PermissionAssignUserRoleReqVO reqVO);
|
CommonResult<Boolean> assignUserRole(PermissionAssignUserRoleReqVO reqVO);
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,22 @@ import java.util.Map;
|
|||||||
public interface PostFeign extends BaseFeignApi {
|
public interface PostFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/post/create")
|
@RequestLine("POST /system/post/create")
|
||||||
public CommonResult<Long> createPost(PostSaveReqVO createReqVO) ;
|
public CommonResult<Long> createPost(PostSaveReqVO createReqVO) ;
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/post/update")
|
@RequestLine("PUT /system/post/update")
|
||||||
public CommonResult<Boolean> updatePost( PostSaveReqVO updateReqVO) ;
|
public CommonResult<Boolean> updatePost( PostSaveReqVO updateReqVO) ;
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/post/delete?id={id}")
|
@RequestLine("DELETE /system/post/delete?id={id}")
|
||||||
public CommonResult<Boolean> deletePost(@Param("id") Long id);
|
public CommonResult<Boolean> deletePost(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/post/get?id={id}")
|
@RequestLine("GET /system/post/get?id={id}")
|
||||||
public CommonResult<PostRespVO> getPost(@Param("id") Long id);
|
public CommonResult<PostRespVO> getPost(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/post/simple-list")
|
@RequestLine("GET /system/post/simple-list")
|
||||||
public CommonResult<List<PostSimpleRespVO>> getSimplePostList() ;
|
public CommonResult<List<PostSimpleRespVO>> getSimplePostList() ;
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/post/page")
|
@RequestLine("GET /system/post/page")
|
||||||
public CommonResult<PageResult<PostRespVO>> getPostPage(@QueryMap Map<String,Object> queryMap);
|
public CommonResult<PageResult<PostRespVO>> getPostPage(@QueryMap Map<String,Object> queryMap);
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,26 +19,22 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface RoleFeign extends BaseFeignApi {
|
public interface RoleFeign extends BaseFeignApi {
|
||||||
|
|
||||||
@PostMapping("/create")
|
@RequestLine("POST /system/role/create")
|
||||||
@RequestLine("POST /admin-api/system/role/create")
|
|
||||||
CommonResult<Long> createRole( RoleSaveReqVO createReqVO);
|
CommonResult<Long> createRole( RoleSaveReqVO createReqVO);
|
||||||
|
|
||||||
@PutMapping("/update")
|
@RequestLine("PUT /system/role/update")
|
||||||
@RequestLine("PUT /admin-api/system/role/update")
|
|
||||||
CommonResult<Boolean> updateRole(RoleSaveReqVO updateReqVO);
|
CommonResult<Boolean> updateRole(RoleSaveReqVO updateReqVO);
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@RequestLine("DELETE /system/role/delete?id={id}")
|
||||||
@RequestLine("DELETE /admin-api/system/role/delete?id={id}")
|
|
||||||
CommonResult<Boolean> deleteRole(@Param("id") Long id);
|
CommonResult<Boolean> deleteRole(@Param("id") Long id);
|
||||||
|
|
||||||
@GetMapping("/get")
|
@RequestLine("GET /system/role/get?id={id}")
|
||||||
@RequestLine("GET /admin-api/system/role/get?id={id}")
|
|
||||||
CommonResult<RoleRespVO> getRole(@Param("id") Long id);
|
CommonResult<RoleRespVO> getRole(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/role/page")
|
@RequestLine("GET /system/role/page")
|
||||||
CommonResult<PageResult<RoleRespVO>> getRolePage(@QueryMap Map<String,Object> queryMay);
|
CommonResult<PageResult<RoleRespVO>> getRolePage(@QueryMap Map<String,Object> queryMay);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/role/simple-list")
|
@RequestLine("GET /system/role/simple-list")
|
||||||
CommonResult<List<RoleRespVO>> getSimpleRoleList();
|
CommonResult<List<RoleRespVO>> getSimpleRoleList();
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,28 +14,28 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface UserFeign extends BaseFeignApi {
|
public interface UserFeign extends BaseFeignApi {
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/user/create")
|
@RequestLine("POST /system/user/create")
|
||||||
CommonResult<Long> createUser(UserSaveReqVO reqVO);
|
CommonResult<Long> createUser(UserSaveReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/user/update")
|
@RequestLine("PUT /system/user/update")
|
||||||
CommonResult<Boolean> updateUser(UserSaveReqVO reqVO);
|
CommonResult<Boolean> updateUser(UserSaveReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("DELETE /admin-api/system/user/delete?id={id}")
|
@RequestLine("DELETE /system/user/delete?id={id}")
|
||||||
CommonResult<Boolean> deleteUser(@Param("id") Long id);
|
CommonResult<Boolean> deleteUser(@Param("id") Long id);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/user/update-password")
|
@RequestLine("PUT /system/user/update-password")
|
||||||
CommonResult<Boolean> updateUserPassword(UserUpdatePasswordReqVO reqVO);
|
CommonResult<Boolean> updateUserPassword(UserUpdatePasswordReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/user/update-status")
|
@RequestLine("PUT /system/user/update-status")
|
||||||
CommonResult<Boolean> updateUserStatus(UserUpdateStatusReqVO reqVO);
|
CommonResult<Boolean> updateUserStatus(UserUpdateStatusReqVO reqVO);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/user/page")
|
@RequestLine("GET /system/user/page")
|
||||||
CommonResult<PageResult<UserRespVO>> getUserPage(@QueryMap Map<String,Object> queryMap);
|
CommonResult<PageResult<UserRespVO>> getUserPage(@QueryMap Map<String,Object> queryMap);
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/user/simple-list")
|
@RequestLine("GET /system/user/simple-list")
|
||||||
CommonResult<List<UserSimpleRespVO>> getSimpleUserList();
|
CommonResult<List<UserSimpleRespVO>> getSimpleUserList();
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/user/get?id={id}")
|
@RequestLine("GET /system/user/get?id={id}")
|
||||||
CommonResult<UserRespVO> getUser(@Param("id") Long id);
|
CommonResult<UserRespVO> getUser(@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,18 +13,18 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
public interface UserProfileFeign extends BaseFeignApi {
|
public interface UserProfileFeign extends BaseFeignApi {
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("GET /admin-api/system/user/profile/get")
|
@RequestLine("GET /system/user/profile/get")
|
||||||
CommonResult<UserProfileRespVO> getUserProfile();
|
CommonResult<UserProfileRespVO> getUserProfile();
|
||||||
|
|
||||||
@RequestLine("PUT /admin-api/system/user/profile/update")
|
@RequestLine("PUT /system/user/profile/update")
|
||||||
CommonResult<Boolean> updateUserProfile(UserProfileUpdateReqVO reqVO);
|
CommonResult<Boolean> updateUserProfile(UserProfileUpdateReqVO reqVO);
|
||||||
|
|
||||||
@PutMapping("/update-password")
|
@PutMapping("/update-password")
|
||||||
@RequestLine("PUT /admin-api/system/user/profile/update-password")
|
@RequestLine("PUT /system/user/profile/update-password")
|
||||||
CommonResult<Boolean> updateUserProfilePassword(UserProfileUpdatePasswordReqVO reqVO);
|
CommonResult<Boolean> updateUserProfilePassword(UserProfileUpdatePasswordReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
@RequestLine("POST /admin-api/system/user/profile/update-avatar")
|
@RequestLine("POST /system/user/profile/update-avatar")
|
||||||
CommonResult<String> updateUserAvatar(MultipartFile file) throws Exception;
|
CommonResult<String> updateUserAvatar(MultipartFile file) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<openjfx.version>22.0.2</openjfx.version>
|
<openjfx.version>23.0.1</openjfx.version>
|
||||||
|
|
||||||
<sass.version>1.54.4</sass.version>
|
<sass.version>1.54.4</sass.version>
|
||||||
<atlantafx.version>2.0.1</atlantafx.version>
|
<atlantafx.version>2.0.1</atlantafx.version>
|
||||||
|
@ -1,122 +1,170 @@
|
|||||||
package com.lw.fx.request;
|
package com.lw.fx.request;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.lw.fx.request.feign.interceptor.ForwardedForInterceptor;
|
import com.lw.fx.request.interceptor.ForwardedForInterceptor;
|
||||||
import com.lw.fx.request.feign.interceptor.OkHttpInterceptor;
|
import com.lw.fx.request.interceptor.OkHttpInterceptor;
|
||||||
import com.lw.ui.request.api.BaseFeignApi;
|
import com.lw.fx.request.loadbalancer.PrimaryBackupRule;
|
||||||
import com.lw.ui.request.gson.LocalDateTimeTypeAdapter;
|
import com.lw.ui.request.api.BaseFeignApi;
|
||||||
import com.lw.ui.request.gson.LocalDateTypeAdapter;
|
import com.lw.ui.request.gson.LocalDateTimeTypeAdapter;
|
||||||
import com.lw.ui.request.gson.ZonedDateTimeTypeAdapter;
|
import com.lw.ui.request.gson.LocalDateTypeAdapter;
|
||||||
import feign.AsyncFeign;
|
import com.lw.ui.request.gson.ZonedDateTimeTypeAdapter;
|
||||||
import feign.Feign;
|
import com.netflix.client.ClientFactory;
|
||||||
import feign.Logger;
|
import com.netflix.client.config.IClientConfig;
|
||||||
import feign.Retryer;
|
import com.netflix.config.ConfigurationManager;
|
||||||
import feign.codec.Decoder;
|
import com.netflix.loadbalancer.ILoadBalancer;
|
||||||
import feign.codec.Encoder;
|
import com.netflix.loadbalancer.ZoneAwareLoadBalancer;
|
||||||
import feign.form.spring.SpringFormEncoder;
|
import feign.AsyncFeign;
|
||||||
import feign.gson.GsonDecoder;
|
import feign.Feign;
|
||||||
import feign.gson.GsonEncoder;
|
import feign.Logger;
|
||||||
import feign.jackson.JacksonDecoder;
|
import feign.Retryer;
|
||||||
import feign.okhttp.OkHttpClient;
|
import feign.codec.Decoder;
|
||||||
import feign.querymap.BeanQueryMapEncoder;
|
import feign.codec.Encoder;
|
||||||
import feign.slf4j.Slf4jLogger;
|
import feign.form.spring.SpringFormEncoder;
|
||||||
import okhttp3.ConnectionPool;
|
import feign.gson.GsonDecoder;
|
||||||
|
import feign.gson.GsonEncoder;
|
||||||
import java.time.LocalDate;
|
import feign.jackson.JacksonDecoder;
|
||||||
import java.time.LocalDateTime;
|
import feign.okhttp.OkHttpClient;
|
||||||
import java.time.ZonedDateTime;
|
import feign.querymap.BeanQueryMapEncoder;
|
||||||
import java.util.Map;
|
import feign.ribbon.LBClient;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import feign.ribbon.LBClientFactory;
|
||||||
|
import feign.ribbon.RibbonClient;
|
||||||
public class Request {
|
import feign.slf4j.Slf4jLogger;
|
||||||
|
import okhttp3.ConnectionPool;
|
||||||
private static final Map<String, BaseFeignApi> CONNECTORS = new ConcurrentHashMap<>();
|
|
||||||
private static final String API_URL = "http://127.0.0.1:48080/";
|
import java.time.LocalDate;
|
||||||
private static final int READ_TIME_OUT_MILLIS = 90000;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
// Gson 实例和解码器、编码器
|
import java.util.Map;
|
||||||
private static final Gson GSON = new GsonBuilder()
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
.setPrettyPrinting()
|
|
||||||
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
|
public class Request {
|
||||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter())
|
|
||||||
.registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter())
|
private static final Map<String, BaseFeignApi> CONNECTORS = new ConcurrentHashMap<>();
|
||||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
private static final int READ_TIME_OUT_MILLIS = 90000;
|
||||||
.create();
|
|
||||||
|
// Gson 实例和解码器、编码器
|
||||||
private static final Decoder GSON_DECODER = new GsonDecoder(GSON);
|
private static final Gson GSON = new GsonBuilder()
|
||||||
private static final Encoder GSON_ENCODER = new GsonEncoder(GSON);
|
.setPrettyPrinting()
|
||||||
|
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
|
||||||
private static final okhttp3.OkHttpClient OK_HTTP_CLIENT = createOkHttpClient();
|
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter())
|
||||||
private static final Feign.Builder BUILDER = createFeignBuilder();
|
.registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter())
|
||||||
private static final Feign.Builder FILE_BUILDER = createFileFeignBuilder();
|
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
|
.create();
|
||||||
|
|
||||||
private Request() {
|
private static final Decoder GSON_DECODER = new GsonDecoder(GSON);
|
||||||
// 防止实例化
|
private static final Encoder GSON_ENCODER = new GsonEncoder(GSON);
|
||||||
}
|
|
||||||
|
private static final okhttp3.OkHttpClient OK_HTTP_CLIENT = createOkHttpClient();
|
||||||
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass, int readTimeOut) {
|
private static final Feign.Builder BUILDER = createFeignBuilder();
|
||||||
final String key = connectorClass.getSimpleName() + readTimeOut;
|
private static final Feign.Builder FILE_BUILDER = createFileFeignBuilder();
|
||||||
return (T) CONNECTORS.computeIfAbsent(key, k -> BUILDER.target(connectorClass, API_URL));
|
|
||||||
}
|
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass) {
|
static {
|
||||||
return connector(connectorClass, READ_TIME_OUT_MILLIS);
|
// 防止实例化
|
||||||
}
|
try {
|
||||||
|
// 手动设置 Ribbon 配置
|
||||||
public static <T extends BaseFeignApi> T fileConnector(Class<T> connectorClass) {
|
|
||||||
return FILE_BUILDER.target(connectorClass, API_URL);
|
ConfigurationManager.loadPropertiesFromResources("myService.properties");
|
||||||
}
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to configure Ribbon", e);
|
||||||
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass, int readTimeOut) {
|
}
|
||||||
final String key = connectorClass.getSimpleName() + readTimeOut;
|
}
|
||||||
return (T) CONNECTORS.computeIfAbsent(key, k -> (BaseFeignApi) ASYNC_BUILDER.target(connectorClass, API_URL));
|
|
||||||
}
|
private Request() {
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass) {
|
}
|
||||||
return asyncConnector(connectorClass, READ_TIME_OUT_MILLIS);
|
|
||||||
}
|
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass, int readTimeOut) {
|
||||||
|
final String key = connectorClass.getSimpleName() + readTimeOut;
|
||||||
private static okhttp3.OkHttpClient createOkHttpClient() {
|
return (T) CONNECTORS.computeIfAbsent(key, k -> BUILDER.target(connectorClass, "http://myService"));
|
||||||
return new okhttp3.OkHttpClient.Builder()
|
}
|
||||||
.connectionPool(new ConnectionPool())
|
|
||||||
.addInterceptor(new OkHttpInterceptor())
|
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass) {
|
||||||
.build();
|
return connector(connectorClass, READ_TIME_OUT_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Feign.Builder createFeignBuilder() {
|
|
||||||
return Feign.builder()
|
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass, int readTimeOut) {
|
||||||
.queryMapEncoder(new BeanQueryMapEncoder())
|
final String key = connectorClass.getSimpleName() + readTimeOut;
|
||||||
.decoder(GSON_DECODER)
|
return (T) CONNECTORS.computeIfAbsent(key, k -> (BaseFeignApi) ASYNC_BUILDER.target(connectorClass, "http://myService"));
|
||||||
.encoder(GSON_ENCODER)
|
}
|
||||||
.logger(new Slf4jLogger())
|
|
||||||
.logLevel(Logger.Level.BASIC)
|
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass) {
|
||||||
.client(new OkHttpClient(OK_HTTP_CLIENT))
|
return asyncConnector(connectorClass, READ_TIME_OUT_MILLIS);
|
||||||
.requestInterceptor(new ForwardedForInterceptor())
|
}
|
||||||
.retryer(new Retryer.Default()); // 默认重试策略
|
|
||||||
}
|
private static okhttp3.OkHttpClient createOkHttpClient() {
|
||||||
|
return new okhttp3.OkHttpClient.Builder()
|
||||||
private static AsyncFeign.AsyncBuilder createAsyncFeignBuilder() {
|
.connectionPool(new ConnectionPool())
|
||||||
return AsyncFeign.builder()
|
.addInterceptor(new OkHttpInterceptor())
|
||||||
.queryMapEncoder(new BeanQueryMapEncoder())
|
.build();
|
||||||
.decoder(GSON_DECODER)
|
}
|
||||||
.encoder(GSON_ENCODER)
|
|
||||||
.logger(new Slf4jLogger())
|
private static Feign.Builder createFeignBuilder() {
|
||||||
.logLevel(Logger.Level.FULL)
|
|
||||||
.client(new OkHttpClient(OK_HTTP_CLIENT))
|
return Feign.builder()
|
||||||
.requestInterceptor(new ForwardedForInterceptor())
|
.queryMapEncoder(new BeanQueryMapEncoder())
|
||||||
.retryer(new Retryer.Default()); // 默认重试策略
|
.decoder(GSON_DECODER)
|
||||||
}
|
.encoder(GSON_ENCODER)
|
||||||
|
.logger(new Slf4jLogger())
|
||||||
private static Feign.Builder createFileFeignBuilder() {
|
.logLevel(Logger.Level.BASIC)
|
||||||
|
.client(RibbonClient.builder().delegate(new OkHttpClient(OK_HTTP_CLIENT)).lbClientFactory(new LBClientFactory() {
|
||||||
|
@Override
|
||||||
return Feign.builder()
|
public LBClient create(String clientName) {
|
||||||
.encoder(new SpringFormEncoder())
|
IClientConfig config = ClientFactory.getNamedConfig(clientName);
|
||||||
.decoder(new JacksonDecoder())
|
|
||||||
.requestInterceptor(new ForwardedForInterceptor());
|
ILoadBalancer lb = ClientFactory.getNamedLoadBalancer(clientName);
|
||||||
|
ZoneAwareLoadBalancer zb = (ZoneAwareLoadBalancer) lb;
|
||||||
}
|
// 设置规则:使用 AvailabilityFilteringRule 和 ZoneAvoidanceRule 进行主备切换
|
||||||
}
|
zb.setRule(new PrimaryBackupRule());
|
||||||
|
LBClient lbClient = LBClient.create(lb, config);
|
||||||
|
return lbClient;
|
||||||
|
}
|
||||||
|
}).build())
|
||||||
|
.requestInterceptor(new ForwardedForInterceptor())
|
||||||
|
.retryer(new Retryer.Default()); // 默认重试策略
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AsyncFeign.AsyncBuilder createAsyncFeignBuilder() {
|
||||||
|
return AsyncFeign.builder()
|
||||||
|
.queryMapEncoder(new BeanQueryMapEncoder())
|
||||||
|
.decoder(GSON_DECODER)
|
||||||
|
.encoder(GSON_ENCODER)
|
||||||
|
.logger(new Slf4jLogger())
|
||||||
|
.logLevel(Logger.Level.FULL)
|
||||||
|
.client(new OkHttpClient(OK_HTTP_CLIENT))
|
||||||
|
.requestInterceptor(new ForwardedForInterceptor())
|
||||||
|
.retryer(new Retryer.Default()); // 默认重试策略
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static <T extends BaseFeignApi> T fileConnector(Class<T> connectorClass) {
|
||||||
|
return FILE_BUILDER.target(connectorClass, "http://myService");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Feign.Builder createFileFeignBuilder() {
|
||||||
|
|
||||||
|
|
||||||
|
return Feign.builder()
|
||||||
|
.encoder(new SpringFormEncoder())
|
||||||
|
.decoder(new JacksonDecoder())
|
||||||
|
.client(RibbonClient.builder().delegate(new OkHttpClient(OK_HTTP_CLIENT)).lbClientFactory(new LBClientFactory() {
|
||||||
|
@Override
|
||||||
|
public LBClient create(String clientName) {
|
||||||
|
IClientConfig config = ClientFactory.getNamedConfig(clientName);
|
||||||
|
|
||||||
|
ILoadBalancer lb = ClientFactory.getNamedLoadBalancer(clientName);
|
||||||
|
ZoneAwareLoadBalancer zb = (ZoneAwareLoadBalancer) lb;
|
||||||
|
// 设置规则:使用 AvailabilityFilteringRule 和 ZoneAvoidanceRule 进行主备切换
|
||||||
|
zb.setRule(new PrimaryBackupRule());
|
||||||
|
LBClient lbClient = LBClient.create(lb, config);
|
||||||
|
return lbClient;
|
||||||
|
}
|
||||||
|
}).build())
|
||||||
|
.requestInterceptor(new ForwardedForInterceptor());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
package com.lw.fx.request.feign;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.google.gson.*;
|
|
||||||
import com.google.gson.stream.JsonReader;
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.FileClientConfig;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.db.DBFileClientConfig;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.local.LocalFileClientConfig;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.s3.S3FileClientConfig;
|
|
||||||
import com.lw.dillon.admin.module.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
// TypeAdapter 实现
|
|
||||||
public class FileClientConfigAdapter extends TypeAdapter<FileClientConfig> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(JsonWriter out, FileClientConfig value) throws IOException {
|
|
||||||
out.beginObject();
|
|
||||||
|
|
||||||
out.endObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FileClientConfig read(JsonReader in) throws IOException {
|
|
||||||
JsonObject jsonObject = JsonParser.parseReader(in).getAsJsonObject();
|
|
||||||
String className = jsonObject.get("@class").getAsString();
|
|
||||||
className = StrUtil.subAfter(className, ".", true);
|
|
||||||
|
|
||||||
switch (className) {
|
|
||||||
case "DBFileClientConfig":
|
|
||||||
return new Gson().fromJson(jsonObject, DBFileClientConfig.class);
|
|
||||||
case "FtpFileClientConfig":
|
|
||||||
return new Gson().fromJson(jsonObject, FtpFileClientConfig.class);
|
|
||||||
case "LocalFileClientConfig":
|
|
||||||
return new Gson().fromJson(jsonObject, LocalFileClientConfig.class);
|
|
||||||
case "SftpFileClientConfig":
|
|
||||||
return new Gson().fromJson(jsonObject, SftpFileClientConfig.class);
|
|
||||||
case "S3FileClientConfig":
|
|
||||||
return new Gson().fromJson(jsonObject, S3FileClientConfig.class);
|
|
||||||
default:
|
|
||||||
throw new JsonParseException("未知的 FileClientConfig 类型:" + className);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.lw.fx.request.feign.decoder;
|
|
||||||
|
|
||||||
public class FeignError extends RuntimeException {
|
|
||||||
private String message; // parsed from json
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.lw.fx.request.feign.decoder;
|
|
||||||
|
|
||||||
import feign.Response;
|
|
||||||
import feign.codec.Decoder;
|
|
||||||
import feign.codec.ErrorDecoder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class FeignErrorDecoder implements ErrorDecoder {
|
|
||||||
|
|
||||||
final Decoder decoder;
|
|
||||||
final ErrorDecoder defaultDecoder = new Default();
|
|
||||||
|
|
||||||
public FeignErrorDecoder(Decoder decoder) {
|
|
||||||
this.decoder = decoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Exception decode(String methodKey, Response response) {
|
|
||||||
try {
|
|
||||||
return (Exception) decoder.decode(response, FeignError.class);
|
|
||||||
} catch (IOException fallbackToDefault) {
|
|
||||||
return defaultDecoder.decode(methodKey, response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.lw.fx.request.feign.interceptor;
|
|
||||||
|
|
||||||
import com.lw.fx.store.AppStore;
|
|
||||||
import feign.RequestInterceptor;
|
|
||||||
import feign.RequestTemplate;
|
|
||||||
|
|
||||||
public class ForwardedForInterceptor implements RequestInterceptor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(RequestTemplate template) {
|
|
||||||
|
|
||||||
template.header("Authorization", AppStore.getToken());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.lw.fx.request.interceptor;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.lw.fx.store.AppStore;
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.RequestTemplate;
|
||||||
|
|
||||||
|
public class ForwardedForInterceptor implements RequestInterceptor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(RequestTemplate template) {
|
||||||
|
|
||||||
|
template.header("Authorization", "Bearer " + AppStore.getToken());
|
||||||
|
template.uri("/admin-api" + template.url());
|
||||||
|
if (ObjectUtil.isNotEmpty("1")) {
|
||||||
|
template.header("tenant-id", "1");
|
||||||
|
}else {
|
||||||
|
template.header("tenant-id", "1");
|
||||||
|
}
|
||||||
|
// template.header("tenantName", "DKY-源码");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.lw.fx.request.feign.interceptor;
|
package com.lw.fx.request.interceptor;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.lw.fx.request.loadbalancer;
|
||||||
|
|
||||||
|
import com.netflix.client.config.IClientConfig;
|
||||||
|
import com.netflix.loadbalancer.AbstractLoadBalancerRule;
|
||||||
|
import com.netflix.loadbalancer.Server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PrimaryBackupRule extends AbstractLoadBalancerRule {
|
||||||
|
private int primaryIndex = 0; // 定义第一个服务为优先
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Server choose(Object key) {
|
||||||
|
List<Server> servers = getLoadBalancer().getAllServers();
|
||||||
|
if (servers.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Server primaryServer = servers.get(primaryIndex);
|
||||||
|
if (primaryServer.isAlive()) {
|
||||||
|
return primaryServer; // 优先返回第一个服务
|
||||||
|
} else {
|
||||||
|
// 主机不可用时,选择其他可用服务
|
||||||
|
return servers.stream().filter(Server::isAlive).skip(1).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initWithNiwsConfig(IClientConfig clientConfig) {
|
||||||
|
// 可以配置初始化行为
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
# 最大重试次数(不包括第一次尝试):
|
||||||
|
# 在同一个服务器上,重试的最大次数。默认情况下,Ribbon 会尝试向一个服务器发送请求,直到该服务器出现错误或重试次数超过这个设置的最大值。这里设置为 1,意味着最多会重试一次。
|
||||||
|
myService.ribbon.MaxAutoRetries=1
|
||||||
|
|
||||||
|
# 最大重试次数(不包括第一次服务器):
|
||||||
|
# 在所有可用服务器中,Ribbon 会根据负载均衡策略选择下一个服务器进行请求。此项配置设置最大重试次数,默认情况下,Ribbon 会尝试重新请求下一个服务器,直到超过最大重试次数。设置为 1,表示最多在备份服务器上重试一次。
|
||||||
|
myService.ribbon.MaxAutoRetriesNextServer=1
|
||||||
|
|
||||||
|
# 是否允许对所有操作进行重试:
|
||||||
|
# 这表示是否所有操作(如 GET、POST 等)都可以进行重试。默认为 `false`,即只在连接错误或服务器不可用时重试。设置为 `true` 时,所有请求都会尝试重试,可能用于减少服务不可用时的失败影响。
|
||||||
|
myService.ribbon.OkToRetryOnAllOperations=true
|
||||||
|
|
||||||
|
# 刷新服务器列表的间隔时间(毫秒):
|
||||||
|
# Ribbon 会定期刷新其服务器列表,以便获取最新的可用服务器。如果使用动态服务器列表或注册中心,设置这个值来指定更新频率。设置为 2000 表示每 2 秒刷新一次服务器列表。
|
||||||
|
myService.ribbon.ServerListRefreshInterval=200000
|
||||||
|
|
||||||
|
# 连接超时(毫秒):
|
||||||
|
# 这是 Apache HttpClient 在建立连接时的超时时间。设置为 3000,表示连接建立的最大超时为 3 秒。
|
||||||
|
myService.ribbon.ConnectTimeout=30000
|
||||||
|
|
||||||
|
# 读取超时(毫秒):
|
||||||
|
# 这是 Apache HttpClient 在等待服务器响应时的超时时间。设置为 3000,表示读取数据的最大超时为 3 秒。
|
||||||
|
myService.ribbon.ReadTimeout=30000
|
||||||
|
|
||||||
|
# 初始服务器列表:
|
||||||
|
# 这是 Ribbon 初始时使用的服务器列表,通常是一个以逗号分隔的服务器地址字符串。这里指定了三个服务器:`www.microsoft.com`、`www.yahoo.com`、`www.google.com`,这些服务器在负载均衡器启动时会被作为候选服务器使用。
|
||||||
|
myService.ribbon.listOfServers=http://127.0.0.1:48080,http://127.0.0.1:48081
|
||||||
|
|
||||||
|
|
||||||
|
# 启用 Prime 连接:
|
||||||
|
# 这个配置控制是否启用 Ribbon 的“Prime Connections”特性。Prime 连接指的是 Ribbon 预先连接一些服务器,以提高请求的响应速度。设置为 `true` 表示启用此特性。
|
||||||
|
myService.ribbon.EnablePrimeConnections=true
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
import com.goxr3plus.fxborderlessscene.borderless.BorderlessScene;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.Priority;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class CustomTitleBarWindow extends BorderPane {
|
||||||
|
|
||||||
|
private Stage primaryStage;
|
||||||
|
private HBox titleBar;
|
||||||
|
private Label titleLabel;
|
||||||
|
|
||||||
|
|
||||||
|
public CustomTitleBarWindow(Stage primaryStage) {
|
||||||
|
this.primaryStage = primaryStage;
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
titleBar=new HBox();
|
||||||
|
titleBar.setAlignment(Pos.CENTER_LEFT);
|
||||||
|
titleBar.setStyle("-fx-background-color: #2C3E50; -fx-padding: 10px;");
|
||||||
|
|
||||||
|
titleLabel=new Label("Hello World");
|
||||||
|
titleLabel.setMaxWidth(Double.MAX_VALUE);
|
||||||
|
titleLabel.setStyle("-fx-text-fill: white;");
|
||||||
|
HBox.setHgrow(titleLabel, Priority.ALWAYS);
|
||||||
|
// 创建最小化按钮
|
||||||
|
Button minimizeButton = new Button("_");
|
||||||
|
minimizeButton.setOnAction(event -> {
|
||||||
|
if (minimizeButton.getScene() instanceof BorderlessScene) {
|
||||||
|
((BorderlessScene) minimizeButton.getScene()).minimizeStage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
minimizeButton.setStyle("-fx-background-color: #3498DB; -fx-text-fill: white;");
|
||||||
|
|
||||||
|
// 创建最大化按钮
|
||||||
|
Button maximizeButton = new Button("⬜");
|
||||||
|
maximizeButton.setOnAction(event -> {
|
||||||
|
if (maximizeButton.getScene() instanceof BorderlessScene) {
|
||||||
|
|
||||||
|
((BorderlessScene) maximizeButton.getScene()).maximizeStage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
maximizeButton.setStyle("-fx-background-color: #2ECC71; -fx-text-fill: white;");
|
||||||
|
|
||||||
|
// 创建关闭按钮
|
||||||
|
Button closeButton = new Button("X");
|
||||||
|
closeButton.setOnAction(event -> primaryStage.close());
|
||||||
|
closeButton.setStyle("-fx-background-color: #E74C3C; -fx-text-fill: white;");
|
||||||
|
|
||||||
|
// 将按钮添加到标题栏
|
||||||
|
titleBar.getChildren().addAll(titleLabel,minimizeButton, maximizeButton, closeButton);
|
||||||
|
|
||||||
|
this.setTop(titleBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
import com.sun.jna.Library;
|
||||||
|
import com.sun.jna.Native;
|
||||||
|
import com.sun.jna.Pointer;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class MacOSBlurEffectExample extends Application {
|
||||||
|
|
||||||
|
public interface CocoaLibrary extends Library {
|
||||||
|
CocoaLibrary INSTANCE = Native.load("Cocoa", CocoaLibrary.class);
|
||||||
|
|
||||||
|
Pointer objc_getClass(String className);
|
||||||
|
Pointer sel_registerName(String selector);
|
||||||
|
Pointer objc_msgSend(Pointer receiver, Pointer selector);
|
||||||
|
Pointer objc_msgSend(Pointer receiver, Pointer selector, Pointer arg1);
|
||||||
|
Pointer objc_msgSend(Pointer receiver, Pointer selector, Pointer arg1, Pointer arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pointer nsVisualEffectViewClass;
|
||||||
|
private Pointer nsVisualEffectView;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) {
|
||||||
|
// 创建一个按钮
|
||||||
|
Button button = new Button("点击我");
|
||||||
|
|
||||||
|
// 创建一个StackPane作为根节点
|
||||||
|
StackPane root = new StackPane();
|
||||||
|
root.getChildren().add(button);
|
||||||
|
|
||||||
|
// 创建场景
|
||||||
|
Scene scene = new Scene(root, 600, 400);
|
||||||
|
primaryStage.setTitle("macOS 模糊效果示例");
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.show();
|
||||||
|
|
||||||
|
// 实现模糊效果
|
||||||
|
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
|
||||||
|
applyBlurEffect(primaryStage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyBlurEffect(Stage stage) {
|
||||||
|
// 获取 NSVisualEffectView 类
|
||||||
|
nsVisualEffectViewClass = CocoaLibrary.INSTANCE.objc_getClass("NSVisualEffectView");
|
||||||
|
if (nsVisualEffectViewClass == null) {
|
||||||
|
System.err.println("Failed to get NSVisualEffectView class.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 NSVisualEffectView 的实例
|
||||||
|
Pointer effectView = CocoaLibrary.INSTANCE.objc_msgSend(nsVisualEffectViewClass,
|
||||||
|
CocoaLibrary.INSTANCE.sel_registerName("alloc"));
|
||||||
|
if (effectView == null) {
|
||||||
|
System.err.println("Failed to allocate NSVisualEffectView.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
effectView = CocoaLibrary.INSTANCE.objc_msgSend(effectView,
|
||||||
|
CocoaLibrary.INSTANCE.sel_registerName("initWithFrame:"), Pointer.NULL);
|
||||||
|
if (effectView == null) {
|
||||||
|
System.err.println("Failed to initialize NSVisualEffectView.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置模糊效果
|
||||||
|
CocoaLibrary.INSTANCE.objc_msgSend(effectView,
|
||||||
|
CocoaLibrary.INSTANCE.sel_registerName("setMaterial:"),
|
||||||
|
CocoaLibrary.INSTANCE.objc_msgSend(nsVisualEffectViewClass,
|
||||||
|
CocoaLibrary.INSTANCE.sel_registerName("materialDark")));
|
||||||
|
|
||||||
|
// 在这里将 effectView 添加到 JavaFX 的窗口中,可能需要额外处理
|
||||||
|
// 直接在 JavaFX 窗口中添加可能需要使用 JFXPanel 或 SWT
|
||||||
|
}
|
||||||
|
}
|
67
dillon-ui/dillon-ui-fx/src/test/java/Main.java
Normal file
67
dillon-ui/dillon-ui-fx/src/test/java/Main.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.Priority;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
|
import com.goxr3plus.fxborderlessscene.borderless.BorderlessScene;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testing the application to see if it works
|
||||||
|
*
|
||||||
|
* @author GOXR3PLUS
|
||||||
|
*/
|
||||||
|
public class Main extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
CustomTitleBarWindow windowPane = new CustomTitleBarWindow(primaryStage);
|
||||||
|
windowPane.setCenter(new Button("我是内容"));
|
||||||
|
|
||||||
|
// Constructor using your primary stage and the root Parent of your content.
|
||||||
|
BorderlessScene scene = new BorderlessScene(primaryStage, StageStyle.TRANSPARENT, windowPane, 250, 250);
|
||||||
|
primaryStage.setScene(scene); // Set the scene to your stage and you're done!
|
||||||
|
|
||||||
|
//Close Button
|
||||||
|
Button removeDefaultCSS = new Button("Remove Default Corners CSS");
|
||||||
|
removeDefaultCSS.setOnAction(a -> scene.removeDefaultCSS());
|
||||||
|
|
||||||
|
//remove the default css style
|
||||||
|
scene.removeDefaultCSS();
|
||||||
|
|
||||||
|
// Maximise (on/off) and minimise the application:
|
||||||
|
//scene.maximizeStage();
|
||||||
|
//scene.minimizeStage();
|
||||||
|
|
||||||
|
// To move the window around by pressing a node:
|
||||||
|
scene.setMoveControl(windowPane);
|
||||||
|
|
||||||
|
// To disable resize:
|
||||||
|
//scene.setResizable(false);
|
||||||
|
|
||||||
|
// To switch the content during runtime:
|
||||||
|
//scene.setContent(yourNewParent);
|
||||||
|
|
||||||
|
// Check if maximised:
|
||||||
|
//Boolean bool = scene.isMaximised();
|
||||||
|
|
||||||
|
// Get windowed* size and position:
|
||||||
|
//scene.getWindowedSize();
|
||||||
|
//scene.getWindowedPosition();
|
||||||
|
|
||||||
|
//Show
|
||||||
|
primaryStage.setTitle("Draggable and Undecorated JavaFX Window");
|
||||||
|
primaryStage.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,42 +6,43 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class ReflectionRepaintManager extends RepaintManager {
|
public class ReflectionRepaintManager extends RepaintManager {
|
||||||
public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
|
@Override
|
||||||
|
public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
|
||||||
|
|
||||||
int lastDeltaX = c.getX();
|
int lastDeltaX = c.getX();
|
||||||
int lastDeltaY = c.getY();
|
int lastDeltaY = c.getY();
|
||||||
|
|
||||||
LookAndFeel laf = UIManager.getLookAndFeel();
|
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||||
boolean isDark=false;
|
boolean isDark = false;
|
||||||
if( laf instanceof FlatLaf){
|
if (laf instanceof FlatLaf) {
|
||||||
isDark = ((FlatLaf) laf).isDark();
|
isDark = ((FlatLaf) laf).isDark();
|
||||||
}
|
|
||||||
|
|
||||||
if (isDark) {
|
|
||||||
Container parent = c.getParent();
|
|
||||||
while (parent instanceof JComponent) {
|
|
||||||
if (!parent.isVisible()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent instanceof WScrollPane) {
|
|
||||||
x += lastDeltaX;
|
|
||||||
y += lastDeltaY;
|
|
||||||
|
|
||||||
|
|
||||||
lastDeltaX = lastDeltaY = 0;
|
|
||||||
|
|
||||||
c = (JComponent) parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastDeltaX += parent.getX();
|
|
||||||
lastDeltaY += parent.getY();
|
|
||||||
|
|
||||||
parent = parent.getParent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
super.addDirtyRegion(c, x, y, w, h);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (isDark) {
|
||||||
|
Container parent = c.getParent();
|
||||||
|
while (parent instanceof JComponent) {
|
||||||
|
if (!parent.isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent instanceof WScrollPane) {
|
||||||
|
x += lastDeltaX;
|
||||||
|
y += lastDeltaY;
|
||||||
|
|
||||||
|
|
||||||
|
lastDeltaX = lastDeltaY = 0;
|
||||||
|
|
||||||
|
c = (JComponent) parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastDeltaX += parent.getX();
|
||||||
|
lastDeltaY += parent.getY();
|
||||||
|
|
||||||
|
parent = parent.getParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
super.addDirtyRegion(c, x, y, w, h);
|
||||||
|
}
|
||||||
|
}
|
@ -73,14 +73,16 @@ public class WButton extends JButton {
|
|||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (isEnabled())
|
if (isEnabled()) {
|
||||||
getAnimationStart().restart();
|
getAnimationStart().restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (isEnabled())
|
if (isEnabled()) {
|
||||||
getAnimationStart().restartReverse();
|
getAnimationStart().restartReverse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -480,17 +480,20 @@ public class WOptionPane extends JOptionPane {
|
|||||||
|
|
||||||
Object selectedValue = pane.getValue();
|
Object selectedValue = pane.getValue();
|
||||||
|
|
||||||
if (selectedValue == null)
|
if (selectedValue == null) {
|
||||||
return CLOSED_OPTION;
|
return CLOSED_OPTION;
|
||||||
|
}
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
if (selectedValue instanceof Integer)
|
if (selectedValue instanceof Integer) {
|
||||||
return ((Integer) selectedValue).intValue();
|
return ((Integer) selectedValue).intValue();
|
||||||
|
}
|
||||||
return CLOSED_OPTION;
|
return CLOSED_OPTION;
|
||||||
}
|
}
|
||||||
for (int counter = 0, maxCounter = options.length;
|
for (int counter = 0, maxCounter = options.length;
|
||||||
counter < maxCounter; counter++) {
|
counter < maxCounter; counter++) {
|
||||||
if (options[counter].equals(selectedValue))
|
if (options[counter].equals(selectedValue)) {
|
||||||
return counter;
|
return counter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return CLOSED_OPTION;
|
return CLOSED_OPTION;
|
||||||
}
|
}
|
||||||
@ -985,6 +988,7 @@ public class WOptionPane extends JOptionPane {
|
|||||||
dialog.setLocationRelativeTo(parentComponent);
|
dialog.setLocationRelativeTo(parentComponent);
|
||||||
|
|
||||||
final PropertyChangeListener listener = new PropertyChangeListener() {
|
final PropertyChangeListener listener = new PropertyChangeListener() {
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
// Let the defaultCloseOperation handle the closing
|
// Let the defaultCloseOperation handle the closing
|
||||||
// if the user closed the window without selecting a button
|
// if the user closed the window without selecting a button
|
||||||
@ -1001,15 +1005,16 @@ public class WOptionPane extends JOptionPane {
|
|||||||
WindowAdapter adapter = new WindowAdapter() {
|
WindowAdapter adapter = new WindowAdapter() {
|
||||||
private boolean gotFocus = false;
|
private boolean gotFocus = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void windowClosing(WindowEvent we) {
|
public void windowClosing(WindowEvent we) {
|
||||||
setValue(null);
|
setValue(null);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
removePropertyChangeListener(listener);
|
removePropertyChangeListener(listener);
|
||||||
dialog.getContentPane().removeAll();
|
dialog.getContentPane().removeAll();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void windowGainedFocus(WindowEvent we) {
|
public void windowGainedFocus(WindowEvent we) {
|
||||||
// Once window gets focus, set initial focus
|
// Once window gets focus, set initial focus
|
||||||
if (!gotFocus) {
|
if (!gotFocus) {
|
||||||
@ -1021,6 +1026,7 @@ public class WOptionPane extends JOptionPane {
|
|||||||
dialog.addWindowListener(adapter);
|
dialog.addWindowListener(adapter);
|
||||||
dialog.addWindowFocusListener(adapter);
|
dialog.addWindowFocusListener(adapter);
|
||||||
dialog.addComponentListener(new ComponentAdapter() {
|
dialog.addComponentListener(new ComponentAdapter() {
|
||||||
|
@Override
|
||||||
public void componentShown(ComponentEvent ce) {
|
public void componentShown(ComponentEvent ce) {
|
||||||
// reset value to ensure closing works properly
|
// reset value to ensure closing works properly
|
||||||
setValue(JOptionPane.UNINITIALIZED_VALUE);
|
setValue(JOptionPane.UNINITIALIZED_VALUE);
|
||||||
@ -1032,10 +1038,12 @@ public class WOptionPane extends JOptionPane {
|
|||||||
|
|
||||||
static Window getWindowForComponent(Component parentComponent)
|
static Window getWindowForComponent(Component parentComponent)
|
||||||
throws HeadlessException {
|
throws HeadlessException {
|
||||||
if (parentComponent == null)
|
if (parentComponent == null) {
|
||||||
return getRootFrame();
|
return getRootFrame();
|
||||||
if (parentComponent instanceof Frame || parentComponent instanceof Dialog)
|
}
|
||||||
|
if (parentComponent instanceof Frame || parentComponent instanceof Dialog) {
|
||||||
return (Window) parentComponent;
|
return (Window) parentComponent;
|
||||||
|
}
|
||||||
return WOptionPane.getWindowForComponent(parentComponent.getParent());
|
return WOptionPane.getWindowForComponent(parentComponent.getParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,9 @@ public class BasicCellEditor extends JPanel implements CellEditor, PropertyChang
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of the PropertyChangeListener interface
|
// Implementation of the PropertyChangeListener interface
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("ancestor")
|
if ("ancestor".equals(evt.getPropertyName())
|
||||||
&& evt.getNewValue() != null) {
|
&& evt.getNewValue() != null) {
|
||||||
// Added to table - notify the editor
|
// Added to table - notify the editor
|
||||||
editingStarted(editingEvent);
|
editingStarted(editingEvent);
|
||||||
|
@ -19,6 +19,7 @@ public class CheckHeaderCellRenderer implements TableCellRenderer {
|
|||||||
selectBox = new JCheckBox(tableModel.getColumnName(0));
|
selectBox = new JCheckBox(tableModel.getColumnName(0));
|
||||||
selectBox.setSelected(false);
|
selectBox.setSelected(false);
|
||||||
tableHeader.addMouseListener(new MouseAdapter() {
|
tableHeader.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
if (e.getClickCount() > 0) {
|
if (e.getClickCount() > 0) {
|
||||||
//获得选中列
|
//获得选中列
|
||||||
|
@ -4,10 +4,16 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.lw.swing.request.interceptor.ForwardedForInterceptor;
|
import com.lw.swing.request.interceptor.ForwardedForInterceptor;
|
||||||
import com.lw.swing.request.interceptor.OkHttpInterceptor;
|
import com.lw.swing.request.interceptor.OkHttpInterceptor;
|
||||||
|
import com.lw.swing.request.loadbalancer.PrimaryBackupRule;
|
||||||
import com.lw.ui.request.api.BaseFeignApi;
|
import com.lw.ui.request.api.BaseFeignApi;
|
||||||
import com.lw.ui.request.gson.LocalDateTimeTypeAdapter;
|
import com.lw.ui.request.gson.LocalDateTimeTypeAdapter;
|
||||||
import com.lw.ui.request.gson.LocalDateTypeAdapter;
|
import com.lw.ui.request.gson.LocalDateTypeAdapter;
|
||||||
import com.lw.ui.request.gson.ZonedDateTimeTypeAdapter;
|
import com.lw.ui.request.gson.ZonedDateTimeTypeAdapter;
|
||||||
|
import com.netflix.client.ClientFactory;
|
||||||
|
import com.netflix.client.config.IClientConfig;
|
||||||
|
import com.netflix.config.ConfigurationManager;
|
||||||
|
import com.netflix.loadbalancer.ILoadBalancer;
|
||||||
|
import com.netflix.loadbalancer.ZoneAwareLoadBalancer;
|
||||||
import feign.AsyncFeign;
|
import feign.AsyncFeign;
|
||||||
import feign.Feign;
|
import feign.Feign;
|
||||||
import feign.Logger;
|
import feign.Logger;
|
||||||
@ -20,6 +26,9 @@ import feign.gson.GsonEncoder;
|
|||||||
import feign.jackson.JacksonDecoder;
|
import feign.jackson.JacksonDecoder;
|
||||||
import feign.okhttp.OkHttpClient;
|
import feign.okhttp.OkHttpClient;
|
||||||
import feign.querymap.BeanQueryMapEncoder;
|
import feign.querymap.BeanQueryMapEncoder;
|
||||||
|
import feign.ribbon.LBClient;
|
||||||
|
import feign.ribbon.LBClientFactory;
|
||||||
|
import feign.ribbon.RibbonClient;
|
||||||
import feign.slf4j.Slf4jLogger;
|
import feign.slf4j.Slf4jLogger;
|
||||||
import okhttp3.ConnectionPool;
|
import okhttp3.ConnectionPool;
|
||||||
|
|
||||||
@ -29,6 +38,9 @@ import java.time.ZonedDateTime;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wenli
|
||||||
|
*/
|
||||||
public class Request {
|
public class Request {
|
||||||
|
|
||||||
private static final Map<String, BaseFeignApi> CONNECTORS = new ConcurrentHashMap<>();
|
private static final Map<String, BaseFeignApi> CONNECTORS = new ConcurrentHashMap<>();
|
||||||
@ -52,13 +64,25 @@ public class Request {
|
|||||||
|
|
||||||
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
|
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
|
||||||
|
|
||||||
private Request() {
|
static {
|
||||||
// 防止实例化
|
// 防止实例化
|
||||||
|
try {
|
||||||
|
// 手动设置 Ribbon 配置
|
||||||
|
|
||||||
|
ConfigurationManager.loadPropertiesFromResources("myService.properties");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to configure Ribbon", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Request() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass, int readTimeOut) {
|
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass, int readTimeOut) {
|
||||||
final String key = connectorClass.getSimpleName() + readTimeOut;
|
final String key = connectorClass.getSimpleName() + readTimeOut;
|
||||||
return (T) CONNECTORS.computeIfAbsent(key, k -> BUILDER.target(connectorClass, System.getProperty("app.server.url")));
|
return (T) CONNECTORS.computeIfAbsent(key, k -> BUILDER.target(connectorClass, "http://myService"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass) {
|
public static <T extends BaseFeignApi> T connector(Class<T> connectorClass) {
|
||||||
@ -68,7 +92,7 @@ public class Request {
|
|||||||
|
|
||||||
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass, int readTimeOut) {
|
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass, int readTimeOut) {
|
||||||
final String key = connectorClass.getSimpleName() + readTimeOut;
|
final String key = connectorClass.getSimpleName() + readTimeOut;
|
||||||
return (T) CONNECTORS.computeIfAbsent(key, k -> (BaseFeignApi) ASYNC_BUILDER.target(connectorClass, System.getProperty("app.server.url")));
|
return (T) CONNECTORS.computeIfAbsent(key, k -> (BaseFeignApi) ASYNC_BUILDER.target(connectorClass, "http://myService"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass) {
|
public static <T extends BaseFeignApi> T asyncConnector(Class<T> connectorClass) {
|
||||||
@ -83,13 +107,26 @@ public class Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Feign.Builder createFeignBuilder() {
|
private static Feign.Builder createFeignBuilder() {
|
||||||
|
|
||||||
return Feign.builder()
|
return Feign.builder()
|
||||||
.queryMapEncoder(new BeanQueryMapEncoder())
|
.queryMapEncoder(new BeanQueryMapEncoder())
|
||||||
.decoder(GSON_DECODER)
|
.decoder(GSON_DECODER)
|
||||||
.encoder(GSON_ENCODER)
|
.encoder(GSON_ENCODER)
|
||||||
.logger(new Slf4jLogger())
|
.logger(new Slf4jLogger())
|
||||||
.logLevel(Logger.Level.BASIC)
|
.logLevel(Logger.Level.BASIC)
|
||||||
.client(new OkHttpClient(OK_HTTP_CLIENT))
|
.client(RibbonClient.builder().delegate(new OkHttpClient(OK_HTTP_CLIENT)).lbClientFactory(new LBClientFactory() {
|
||||||
|
@Override
|
||||||
|
public LBClient create(String clientName) {
|
||||||
|
IClientConfig config = ClientFactory.getNamedConfig(clientName);
|
||||||
|
|
||||||
|
ILoadBalancer lb = ClientFactory.getNamedLoadBalancer(clientName);
|
||||||
|
ZoneAwareLoadBalancer zb = (ZoneAwareLoadBalancer) lb;
|
||||||
|
// 设置规则:使用 AvailabilityFilteringRule 和 ZoneAvoidanceRule 进行主备切换
|
||||||
|
zb.setRule(new PrimaryBackupRule());
|
||||||
|
LBClient lbClient = LBClient.create(lb, config);
|
||||||
|
return lbClient;
|
||||||
|
}
|
||||||
|
}).build())
|
||||||
.requestInterceptor(new ForwardedForInterceptor())
|
.requestInterceptor(new ForwardedForInterceptor())
|
||||||
.retryer(new Retryer.Default()); // 默认重试策略
|
.retryer(new Retryer.Default()); // 默认重试策略
|
||||||
}
|
}
|
||||||
@ -108,7 +145,7 @@ public class Request {
|
|||||||
|
|
||||||
|
|
||||||
public static <T extends BaseFeignApi> T fileConnector(Class<T> connectorClass) {
|
public static <T extends BaseFeignApi> T fileConnector(Class<T> connectorClass) {
|
||||||
return FILE_BUILDER.target(connectorClass, System.getProperty("app.server.url"));
|
return FILE_BUILDER.target(connectorClass, "http://myService");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Feign.Builder createFileFeignBuilder() {
|
private static Feign.Builder createFileFeignBuilder() {
|
||||||
@ -117,6 +154,19 @@ public class Request {
|
|||||||
return Feign.builder()
|
return Feign.builder()
|
||||||
.encoder(new SpringFormEncoder())
|
.encoder(new SpringFormEncoder())
|
||||||
.decoder(new JacksonDecoder())
|
.decoder(new JacksonDecoder())
|
||||||
|
.client(RibbonClient.builder().delegate(new OkHttpClient(OK_HTTP_CLIENT)).lbClientFactory(new LBClientFactory() {
|
||||||
|
@Override
|
||||||
|
public LBClient create(String clientName) {
|
||||||
|
IClientConfig config = ClientFactory.getNamedConfig(clientName);
|
||||||
|
|
||||||
|
ILoadBalancer lb = ClientFactory.getNamedLoadBalancer(clientName);
|
||||||
|
ZoneAwareLoadBalancer zb = (ZoneAwareLoadBalancer) lb;
|
||||||
|
// 设置规则:使用 AvailabilityFilteringRule 和 ZoneAvoidanceRule 进行主备切换
|
||||||
|
zb.setRule(new PrimaryBackupRule());
|
||||||
|
LBClient lbClient = LBClient.create(lb, config);
|
||||||
|
return lbClient;
|
||||||
|
}
|
||||||
|
}).build())
|
||||||
.requestInterceptor(new ForwardedForInterceptor());
|
.requestInterceptor(new ForwardedForInterceptor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ public class ForwardedForInterceptor implements RequestInterceptor {
|
|||||||
public void apply(RequestTemplate template) {
|
public void apply(RequestTemplate template) {
|
||||||
|
|
||||||
template.header("Authorization", "Bearer " + AppStore.getAccessToken());
|
template.header("Authorization", "Bearer " + AppStore.getAccessToken());
|
||||||
|
template.uri(System.getProperty("app.server.url.prefix") + template.url());
|
||||||
if (ObjectUtil.isNotEmpty("1")) {
|
if (ObjectUtil.isNotEmpty("1")) {
|
||||||
template.header("tenant-id", "1");
|
template.header("tenant-id", "1");
|
||||||
}else {
|
}else {
|
||||||
|
@ -22,6 +22,7 @@ public class OkHttpInterceptor implements Interceptor {
|
|||||||
@Override
|
@Override
|
||||||
public Response intercept(@NotNull Chain chain) throws IOException {
|
public Response intercept(@NotNull Chain chain) throws IOException {
|
||||||
Request originalRequest = chain.request();
|
Request originalRequest = chain.request();
|
||||||
|
|
||||||
Response response = null;
|
Response response = null;
|
||||||
try {
|
try {
|
||||||
response = chain.proceed(originalRequest);
|
response = chain.proceed(originalRequest);
|
||||||
@ -76,6 +77,7 @@ public class OkHttpInterceptor implements Interceptor {
|
|||||||
|
|
||||||
MainFrame.getInstance().showLogin();
|
MainFrame.getInstance().showLogin();
|
||||||
}
|
}
|
||||||
|
System.err.println("-----------------"+commonResult.getMsg());
|
||||||
WMessage.showMessageError(MainFrame.getInstance(), commonResult.getMsg());
|
WMessage.showMessageError(MainFrame.getInstance(), commonResult.getMsg());
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.lw.swing.request.loadbalancer;
|
||||||
|
|
||||||
|
import com.netflix.client.config.IClientConfig;
|
||||||
|
import com.netflix.loadbalancer.AbstractLoadBalancerRule;
|
||||||
|
import com.netflix.loadbalancer.Server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PrimaryBackupRule extends AbstractLoadBalancerRule {
|
||||||
|
private int primaryIndex = 0; // 定义第一个服务为优先
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Server choose(Object key) {
|
||||||
|
List<Server> servers = getLoadBalancer().getAllServers();
|
||||||
|
if (servers.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Server primaryServer = servers.get(primaryIndex);
|
||||||
|
if (primaryServer.isAlive()) {
|
||||||
|
return primaryServer; // 优先返回第一个服务
|
||||||
|
} else {
|
||||||
|
// 主机不可用时,选择其他可用服务
|
||||||
|
return servers.stream().filter(Server::isAlive).skip(1).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initWithNiwsConfig(IClientConfig clientConfig) {
|
||||||
|
// 可以配置初始化行为
|
||||||
|
}
|
||||||
|
}
|
@ -71,8 +71,9 @@ public class IconLoader {
|
|||||||
private static String resolveFile(String filename) {
|
private static String resolveFile(String filename) {
|
||||||
// iterate over each location, return on first hit
|
// iterate over each location, return on first hit
|
||||||
for (String path : new String[]{"", "famfam/", "fugue/"}) {
|
for (String path : new String[]{"", "famfam/", "fugue/"}) {
|
||||||
if (IconLoader.class.getResource(path + filename) != null)
|
if (IconLoader.class.getResource(path + filename) != null) {
|
||||||
return path + filename;
|
return path + filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if push comes to shove, we let the calling method deal w/ the
|
// if push comes to shove, we let the calling method deal w/ the
|
||||||
|
@ -56,9 +56,9 @@ public class MainPrefs {
|
|||||||
public static void setupLaf(String[] args) {
|
public static void setupLaf(String[] args) {
|
||||||
// set look and feel
|
// set look and feel
|
||||||
try {
|
try {
|
||||||
if (args.length > 0)
|
if (args.length > 0) {
|
||||||
UIManager.setLookAndFeel(args[0]);
|
UIManager.setLookAndFeel(args[0]);
|
||||||
else {
|
} else {
|
||||||
String lafClassName = state.get(KEY_LAF, FlatLightLaf.class.getName());
|
String lafClassName = state.get(KEY_LAF, FlatLightLaf.class.getName());
|
||||||
if (IntelliJTheme.ThemeLaf.class.getName().equals(lafClassName)) {
|
if (IntelliJTheme.ThemeLaf.class.getName().equals(lafClassName)) {
|
||||||
String theme = state.get(KEY_LAF_THEME, "");
|
String theme = state.get(KEY_LAF_THEME, "");
|
||||||
@ -66,24 +66,29 @@ public class MainPrefs {
|
|||||||
// IntelliJTheme.setup(IJThemesPanel.class.getResourceAsStream(IJThemesPanel.THEMES_PACKAGE + theme.substring(RESOURCE_PREFIX.length())));
|
// IntelliJTheme.setup(IJThemesPanel.class.getResourceAsStream(IJThemesPanel.THEMES_PACKAGE + theme.substring(RESOURCE_PREFIX.length())));
|
||||||
} else if (theme.startsWith(FILE_PREFIX)) {
|
} else if (theme.startsWith(FILE_PREFIX)) {
|
||||||
FlatLaf.setup(IntelliJTheme.createLaf(new FileInputStream(theme.substring(FILE_PREFIX.length()))));
|
FlatLaf.setup(IntelliJTheme.createLaf(new FileInputStream(theme.substring(FILE_PREFIX.length()))));
|
||||||
} else
|
} else {
|
||||||
FlatLightLaf.setup();
|
FlatLightLaf.setup();
|
||||||
|
}
|
||||||
|
|
||||||
if (!theme.isEmpty())
|
if (!theme.isEmpty()) {
|
||||||
UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY, theme);
|
UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY, theme);
|
||||||
|
}
|
||||||
} else if (FlatPropertiesLaf.class.getName().equals(lafClassName)) {
|
} else if (FlatPropertiesLaf.class.getName().equals(lafClassName)) {
|
||||||
String theme = state.get(KEY_LAF_THEME, "");
|
String theme = state.get(KEY_LAF_THEME, "");
|
||||||
if (theme.startsWith(FILE_PREFIX)) {
|
if (theme.startsWith(FILE_PREFIX)) {
|
||||||
File themeFile = new File(theme.substring(FILE_PREFIX.length()));
|
File themeFile = new File(theme.substring(FILE_PREFIX.length()));
|
||||||
String themeName = StringUtils.removeTrailing(themeFile.getName(), ".properties");
|
String themeName = StringUtils.removeTrailing(themeFile.getName(), ".properties");
|
||||||
FlatLaf.setup(new FlatPropertiesLaf(themeName, themeFile));
|
FlatLaf.setup(new FlatPropertiesLaf(themeName, themeFile));
|
||||||
} else
|
} else {
|
||||||
FlatLightLaf.setup();
|
FlatLightLaf.setup();
|
||||||
|
}
|
||||||
|
|
||||||
if (!theme.isEmpty())
|
if (!theme.isEmpty()) {
|
||||||
UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY, theme);
|
UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY, theme);
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
UIManager.setLookAndFeel(lafClassName);
|
UIManager.setLookAndFeel(lafClassName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
LoggingFacade.INSTANCE.logSevere(null, ex);
|
LoggingFacade.INSTANCE.logSevere(null, ex);
|
||||||
@ -94,8 +99,9 @@ public class MainPrefs {
|
|||||||
|
|
||||||
// remember active look and feel
|
// remember active look and feel
|
||||||
UIManager.addPropertyChangeListener(e -> {
|
UIManager.addPropertyChangeListener(e -> {
|
||||||
if ("lookAndFeel".equals(e.getPropertyName()))
|
if ("lookAndFeel".equals(e.getPropertyName())) {
|
||||||
state.put(KEY_LAF, UIManager.getLookAndFeel().getClass().getName());
|
state.put(KEY_LAF, UIManager.getLookAndFeel().getClass().getName());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,7 @@ public class SidePane extends WPanel implements Observer {
|
|||||||
super(root);
|
super(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getChild(Object parent, int index) {
|
public Object getChild(Object parent, int index) {
|
||||||
AuthPermissionInfoRespVO.MenuVO parentFile = (AuthPermissionInfoRespVO.MenuVO) parent;
|
AuthPermissionInfoRespVO.MenuVO parentFile = (AuthPermissionInfoRespVO.MenuVO) parent;
|
||||||
List<AuthPermissionInfoRespVO.MenuVO> children = parentFile.getChildren();
|
List<AuthPermissionInfoRespVO.MenuVO> children = parentFile.getChildren();
|
||||||
@ -260,6 +261,7 @@ public class SidePane extends WPanel implements Observer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getChildCount(Object parent) {
|
public int getChildCount(Object parent) {
|
||||||
if (parent instanceof AuthPermissionInfoRespVO.MenuVO) {
|
if (parent instanceof AuthPermissionInfoRespVO.MenuVO) {
|
||||||
List<AuthPermissionInfoRespVO.MenuVO> children = ((AuthPermissionInfoRespVO.MenuVO) parent).getChildren();
|
List<AuthPermissionInfoRespVO.MenuVO> children = ((AuthPermissionInfoRespVO.MenuVO) parent).getChildren();
|
||||||
@ -271,6 +273,7 @@ public class SidePane extends WPanel implements Observer {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getColumnClass(int column) {
|
public Class<?> getColumnClass(int column) {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -280,14 +283,17 @@ public class SidePane extends WPanel implements Observer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getColumnName(int column) {
|
public String getColumnName(int column) {
|
||||||
return "Name";
|
return "Name";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getValueAt(Object node, int column) {
|
public Object getValueAt(Object node, int column) {
|
||||||
if (node instanceof AuthPermissionInfoRespVO.MenuVO) {
|
if (node instanceof AuthPermissionInfoRespVO.MenuVO) {
|
||||||
AuthPermissionInfoRespVO.MenuVO menuVO = (AuthPermissionInfoRespVO.MenuVO) node;
|
AuthPermissionInfoRespVO.MenuVO menuVO = (AuthPermissionInfoRespVO.MenuVO) node;
|
||||||
@ -307,6 +313,7 @@ public class SidePane extends WPanel implements Observer {
|
|||||||
this.modelSupport.fireNewRoot();
|
this.modelSupport.fireNewRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLeaf(Object node) {
|
public boolean isLeaf(Object node) {
|
||||||
if (node instanceof AuthPermissionInfoRespVO.MenuVO) {
|
if (node instanceof AuthPermissionInfoRespVO.MenuVO) {
|
||||||
return ((AuthPermissionInfoRespVO.MenuVO) node).getChildren() == null;
|
return ((AuthPermissionInfoRespVO.MenuVO) node).getChildren() == null;
|
||||||
|
@ -234,7 +234,7 @@ public class DeptEditPane extends JPanel {
|
|||||||
DefaultMutableTreeNode deptRootNode = new DefaultMutableTreeNode("主类目");
|
DefaultMutableTreeNode deptRootNode = new DefaultMutableTreeNode("主类目");
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, deptRootNode); // Root node
|
nodeMap.put(0L, deptRootNode); // Root node
|
||||||
|
|
||||||
CommonResult<java.util.List<DeptSimpleRespVO>> deptSimpleRespVOList = Request.connector(DeptFeign.class).getSimpleDeptList();
|
CommonResult<java.util.List<DeptSimpleRespVO>> deptSimpleRespVOList = Request.connector(DeptFeign.class).getSimpleDeptList();
|
||||||
CommonResult<java.util.List<UserSimpleRespVO>> userSimpleRespVOList = Request.connector(UserFeign.class).getSimpleUserList();
|
CommonResult<java.util.List<UserSimpleRespVO>> userSimpleRespVOList = Request.connector(UserFeign.class).getSimpleUserList();
|
||||||
@ -245,7 +245,7 @@ public class DeptEditPane extends JPanel {
|
|||||||
for (UserSimpleRespVO respVO : userSimpleRespVOList.getData()) {
|
for (UserSimpleRespVO respVO : userSimpleRespVOList.getData()) {
|
||||||
leaderUsers.add(respVO);
|
leaderUsers.add(respVO);
|
||||||
|
|
||||||
if (deptRespVO != null && deptRespVO.getLeaderUserId() == respVO.getId()) {
|
if (deptRespVO != null && deptRespVO.getLeaderUserId().equals(respVO.getId())) {
|
||||||
leaderUserSel = respVO;
|
leaderUserSel = respVO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ public class MenuEditPane extends JPanel {
|
|||||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode("主类目");
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode("主类目");
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, root); // Root node
|
nodeMap.put(0L, root); // Root node
|
||||||
|
|
||||||
CommonResult<List<MenuSimpleRespVO>> menuSimpleRespVOList = Request.connector(MenuFeign.class).getSimpleMenuList();
|
CommonResult<List<MenuSimpleRespVO>> menuSimpleRespVOList = Request.connector(MenuFeign.class).getSimpleMenuList();
|
||||||
|
|
||||||
|
@ -0,0 +1,383 @@
|
|||||||
|
/*
|
||||||
|
* Created by JFormDesigner on Sun Jun 16 15:15:27 CST 2024
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.lw.swing.view.system.oauth2.client;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.lang.Editor;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.jidesoft.swing.CheckBoxList;
|
||||||
|
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.dept.vo.post.PostSimpleRespVO;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientRespVO;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientSaveReqVO;
|
||||||
|
import com.lw.swing.components.WScrollPane;
|
||||||
|
import com.lw.swing.request.Request;
|
||||||
|
import com.lw.swing.store.AppStore;
|
||||||
|
import com.lw.ui.request.api.system.OAuth2ClientFeign;
|
||||||
|
import com.lw.ui.utils.DictTypeEnum;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.ListSelectionEvent;
|
||||||
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wenli
|
||||||
|
*/
|
||||||
|
public class ClientFormPane extends JPanel {
|
||||||
|
private Long id = null;
|
||||||
|
private JPopupMenu authorizedGrantTypesPopupMenu;
|
||||||
|
private CheckBoxList authorizedGrantTypesCheckBoxList;
|
||||||
|
|
||||||
|
public ClientFormPane() {
|
||||||
|
initComponents();
|
||||||
|
initListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||||
|
// Generated using JFormDesigner non-commercial license
|
||||||
|
label16 = new JLabel();
|
||||||
|
clientIdTextField = new JTextField();
|
||||||
|
label17 = new JLabel();
|
||||||
|
secretTextField = new JTextField();
|
||||||
|
label18 = new JLabel();
|
||||||
|
nameTextField = new JTextField();
|
||||||
|
label19 = new JLabel();
|
||||||
|
logoLabel = new JLabel();
|
||||||
|
label20 = new JLabel();
|
||||||
|
scrollPane1 = new JScrollPane();
|
||||||
|
descriptionTextArea = new JTextArea();
|
||||||
|
label21 = new JLabel();
|
||||||
|
statusComboBox = new JComboBox();
|
||||||
|
label22 = new JLabel();
|
||||||
|
accessTokenValiditySecondsSpinner = new JSpinner();
|
||||||
|
label23 = new JLabel();
|
||||||
|
refreshTokenValiditySecondsSpinner = new JSpinner();
|
||||||
|
label24 = new JLabel();
|
||||||
|
authorizedGrantTypesComboBox = new JTextField();
|
||||||
|
label25 = new JLabel();
|
||||||
|
scopesComboBox = new JTextField();
|
||||||
|
label26 = new JLabel();
|
||||||
|
autoApproveScopesComboBox = new JTextField();
|
||||||
|
label27 = new JLabel();
|
||||||
|
redirectUrisComboBox = new JTextField();
|
||||||
|
label28 = new JLabel();
|
||||||
|
authoritiesComboBox = new JTextField();
|
||||||
|
label29 = new JLabel();
|
||||||
|
resourceIdsComboBox = new JTextField();
|
||||||
|
label30 = new JLabel();
|
||||||
|
scrollPane2 = new JScrollPane();
|
||||||
|
additionalInformationTextArea = new JTextArea();
|
||||||
|
|
||||||
|
//======== this ========
|
||||||
|
setLayout(new MigLayout(
|
||||||
|
"fill,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[right]" +
|
||||||
|
"[320:420,grow,fill]",
|
||||||
|
// rows
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]"));
|
||||||
|
|
||||||
|
//---- label16 ----
|
||||||
|
label16.setText("\u5ba2\u6237\u7aef\u7f16\u53f7");
|
||||||
|
add(label16, "cell 0 0");
|
||||||
|
add(clientIdTextField, "cell 1 0");
|
||||||
|
|
||||||
|
//---- label17 ----
|
||||||
|
label17.setText("\u5ba2\u6237\u7aef\u5bc6\u94a5");
|
||||||
|
add(label17, "cell 0 1");
|
||||||
|
add(secretTextField, "cell 1 1");
|
||||||
|
|
||||||
|
//---- label18 ----
|
||||||
|
label18.setText("\u5e94\u7528\u540d");
|
||||||
|
add(label18, "cell 0 2");
|
||||||
|
add(nameTextField, "cell 1 2");
|
||||||
|
|
||||||
|
//---- label19 ----
|
||||||
|
label19.setText("\u5e94\u7528\u56fe\u6807");
|
||||||
|
add(label19, "cell 0 3");
|
||||||
|
|
||||||
|
//---- logoLabel ----
|
||||||
|
logoLabel.setText("text");
|
||||||
|
add(logoLabel, "cell 1 3,alignx center,growx 0");
|
||||||
|
|
||||||
|
//---- label20 ----
|
||||||
|
label20.setText("\u5e94\u7528\u63cf\u8ff0");
|
||||||
|
add(label20, "cell 0 4");
|
||||||
|
|
||||||
|
//======== scrollPane1 ========
|
||||||
|
{
|
||||||
|
scrollPane1.setViewportView(descriptionTextArea);
|
||||||
|
}
|
||||||
|
add(scrollPane1, "cell 1 4");
|
||||||
|
|
||||||
|
//---- label21 ----
|
||||||
|
label21.setText("\u72b6\u6001");
|
||||||
|
add(label21, "cell 0 5");
|
||||||
|
add(statusComboBox, "cell 1 5");
|
||||||
|
|
||||||
|
//---- label22 ----
|
||||||
|
label22.setText("\u8bbf\u95ee\u4ee4\u724c\u7684\u6709\u6548\u671f");
|
||||||
|
add(label22, "cell 0 6");
|
||||||
|
add(accessTokenValiditySecondsSpinner, "cell 1 6");
|
||||||
|
|
||||||
|
//---- label23 ----
|
||||||
|
label23.setText("\u5237\u65b0\u4ee4\u724c\u7684\u6709\u6548\u671f");
|
||||||
|
add(label23, "cell 0 7");
|
||||||
|
add(refreshTokenValiditySecondsSpinner, "cell 1 7");
|
||||||
|
|
||||||
|
//---- label24 ----
|
||||||
|
label24.setText("\u6388\u6743\u7c7b\u578b");
|
||||||
|
add(label24, "cell 0 8");
|
||||||
|
add(authorizedGrantTypesComboBox, "cell 1 8");
|
||||||
|
|
||||||
|
//---- label25 ----
|
||||||
|
label25.setText("\u6388\u6743\u8303\u56f4");
|
||||||
|
add(label25, "cell 0 9");
|
||||||
|
add(scopesComboBox, "cell 1 9");
|
||||||
|
|
||||||
|
//---- label26 ----
|
||||||
|
label26.setText("\u81ea\u52a8\u6388\u6743\u8303\u56f4");
|
||||||
|
add(label26, "cell 0 10");
|
||||||
|
add(autoApproveScopesComboBox, "cell 1 10");
|
||||||
|
|
||||||
|
//---- label27 ----
|
||||||
|
label27.setText("\u53ef\u91cd\u5b9a\u5411\u7684 URI \u5730\u5740");
|
||||||
|
add(label27, "cell 0 11");
|
||||||
|
add(redirectUrisComboBox, "cell 1 11");
|
||||||
|
|
||||||
|
//---- label28 ----
|
||||||
|
label28.setText("\u6743\u9650");
|
||||||
|
add(label28, "cell 0 12");
|
||||||
|
add(authoritiesComboBox, "cell 1 12");
|
||||||
|
|
||||||
|
//---- label29 ----
|
||||||
|
label29.setText("\u8d44\u6e90");
|
||||||
|
add(label29, "cell 0 13");
|
||||||
|
add(resourceIdsComboBox, "cell 1 13");
|
||||||
|
|
||||||
|
//---- label30 ----
|
||||||
|
label30.setText("\u9644\u52a0\u4fe1\u606f");
|
||||||
|
add(label30, "cell 0 14");
|
||||||
|
|
||||||
|
//======== scrollPane2 ========
|
||||||
|
{
|
||||||
|
scrollPane2.setViewportView(additionalInformationTextArea);
|
||||||
|
}
|
||||||
|
add(scrollPane2, "cell 1 14");
|
||||||
|
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
||||||
|
|
||||||
|
authorizedGrantTypesPopupMenu = new JPopupMenu();
|
||||||
|
authorizedGrantTypesCheckBoxList = new CheckBoxList();
|
||||||
|
authorizedGrantTypesCheckBoxList.setClickInCheckBoxOnly(false);
|
||||||
|
authorizedGrantTypesCheckBoxList.setCellRenderer(new DefaultListCellRenderer() {
|
||||||
|
@Override
|
||||||
|
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
|
if (value instanceof DictDataSimpleRespVO) {
|
||||||
|
value = ((DictDataSimpleRespVO) value).getLabel();
|
||||||
|
}
|
||||||
|
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
authorizedGrantTypesCheckBoxList.setFixedCellHeight(35);
|
||||||
|
authorizedGrantTypesPopupMenu.add(new WScrollPane(authorizedGrantTypesCheckBoxList));
|
||||||
|
authorizedGrantTypesComboBox.setEditable(false);
|
||||||
|
statusComboBox.addItem("开启");
|
||||||
|
statusComboBox.addItem("关闭");
|
||||||
|
refreshTokenValiditySecondsSpinner.setModel(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
|
||||||
|
accessTokenValiditySecondsSpinner.setModel(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setValue(OAuth2ClientRespVO respVO) {
|
||||||
|
clientIdTextField.setText(respVO.getClientId());
|
||||||
|
secretTextField.setText(respVO.getSecret());
|
||||||
|
nameTextField.setText(respVO.getName());
|
||||||
|
logoLabel.setText(respVO.getLogo());
|
||||||
|
descriptionTextArea.setText(respVO.getDescription());
|
||||||
|
additionalInformationTextArea.setText(respVO.getAdditionalInformation());
|
||||||
|
accessTokenValiditySecondsSpinner.setValue(respVO.getAccessTokenValiditySeconds() == null ? 0 : respVO.getAccessTokenValiditySeconds());
|
||||||
|
refreshTokenValiditySecondsSpinner.setValue(respVO.getRefreshTokenValiditySeconds() == null ? 0 : respVO.getRefreshTokenValiditySeconds());
|
||||||
|
statusComboBox.setSelectedIndex(ObjectUtil.defaultIfNull(respVO.getStatus(), 0));
|
||||||
|
|
||||||
|
scopesComboBox.setText(Optional.ofNullable(respVO.getScopes()).orElse(Arrays.asList()) // 如果为 null,替换为一个空 List
|
||||||
|
.stream().collect(Collectors.joining(",")));
|
||||||
|
autoApproveScopesComboBox.setText(Optional.ofNullable(respVO.getAutoApproveScopes()).orElse(Arrays.asList()) // 如果为 null,替换为一个空 List
|
||||||
|
.stream().collect(Collectors.joining(",")));
|
||||||
|
redirectUrisComboBox.setText(Optional.ofNullable(respVO.getRedirectUris()).orElse(Arrays.asList()) // 如果为 null,替换为一个空 List
|
||||||
|
.stream().collect(Collectors.joining(",")));
|
||||||
|
authoritiesComboBox.setText(Optional.ofNullable(respVO.getAuthorities()).orElse(Arrays.asList()) // 如果为 null,替换为一个空 List
|
||||||
|
.stream().collect(Collectors.joining(",")));
|
||||||
|
resourceIdsComboBox.setText(Optional.ofNullable(respVO.getResourceIds()).orElse(Arrays.asList()) // 如果为 null,替换为一个空 List
|
||||||
|
.stream().collect(Collectors.joining(",")));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAuth2ClientSaveReqVO getValue() {
|
||||||
|
OAuth2ClientSaveReqVO reqVO = new OAuth2ClientSaveReqVO();
|
||||||
|
reqVO.setId(id);
|
||||||
|
reqVO.setClientId(clientIdTextField.getText());
|
||||||
|
reqVO.setSecret(secretTextField.getText());
|
||||||
|
reqVO.setName(nameTextField.getText());
|
||||||
|
reqVO.setLogo(logoLabel.getText());
|
||||||
|
reqVO.setDescription(descriptionTextArea.getText());
|
||||||
|
reqVO.setAccessTokenValiditySeconds(Convert.toInt(accessTokenValiditySecondsSpinner.getValue()));
|
||||||
|
reqVO.setRefreshTokenValiditySeconds(Convert.toInt(refreshTokenValiditySecondsSpinner.getValue()));
|
||||||
|
reqVO.setStatus(statusComboBox.getSelectedIndex());
|
||||||
|
Object[] types = authorizedGrantTypesCheckBoxList.getCheckBoxListSelectedValues();
|
||||||
|
List<String> stringList = Arrays.stream(types).map(Object::toString) // 转换为 String
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
reqVO.setAuthorizedGrantTypes(stringList);
|
||||||
|
|
||||||
|
|
||||||
|
reqVO.setScopes(Optional.ofNullable(scopesComboBox.getText()).filter(s -> !s.isEmpty()).map(s -> Arrays.stream(s.split(",")).map(String::trim).collect(Collectors.toList())) //
|
||||||
|
.orElse(Collections.emptyList()));
|
||||||
|
reqVO.setAutoApproveScopes(Optional.ofNullable(autoApproveScopesComboBox.getText()).filter(s -> !s.isEmpty()).map(s -> Arrays.stream(s.split(",")).map(String::trim).collect(Collectors.toList())) //
|
||||||
|
.orElse(Collections.emptyList()));
|
||||||
|
reqVO.setRedirectUris(Optional.ofNullable(redirectUrisComboBox.getText()).filter(s -> !s.isEmpty()).map(s -> Arrays.stream(s.split(",")).map(String::trim).collect(Collectors.toList())) //
|
||||||
|
.orElse(Collections.emptyList()));
|
||||||
|
reqVO.setAuthorities(Optional.ofNullable(authoritiesComboBox.getText()).filter(s -> !s.isEmpty()).map(s -> Arrays.stream(s.split(",")).map(String::trim).collect(Collectors.toList())) //
|
||||||
|
.orElse(Collections.emptyList()));
|
||||||
|
reqVO.setResourceIds(Optional.ofNullable(resourceIdsComboBox.getText()).filter(s -> !s.isEmpty()).map(s -> Arrays.stream(s.split(",")).map(String::trim).collect(Collectors.toList())) //
|
||||||
|
.orElse(Collections.emptyList()));
|
||||||
|
|
||||||
|
return reqVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initListeners() {
|
||||||
|
|
||||||
|
authorizedGrantTypesComboBox.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||||
|
showAuthorizedTypePopupMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
authorizedGrantTypesCheckBoxList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
|
@Override
|
||||||
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
|
if (!e.getValueIsAdjusting()) {
|
||||||
|
Object[] objects = authorizedGrantTypesCheckBoxList.getCheckBoxListSelectedValues();
|
||||||
|
authorizedGrantTypesComboBox.setText(ArrayUtil.join(objects, ",", new Editor<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object edit(Object o) {
|
||||||
|
if (o instanceof PostSimpleRespVO) {
|
||||||
|
return ((PostSimpleRespVO) o).getName();
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAuthorizedTypePopupMenu() {
|
||||||
|
authorizedGrantTypesPopupMenu.setPopupSize(authorizedGrantTypesComboBox.getWidth(), 400);
|
||||||
|
authorizedGrantTypesPopupMenu.show(authorizedGrantTypesComboBox, 0, authorizedGrantTypesComboBox.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateData(Long id) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
|
||||||
|
SwingWorker<OAuth2ClientRespVO, OAuth2ClientRespVO> swingWorker = new SwingWorker<OAuth2ClientRespVO, OAuth2ClientRespVO>() {
|
||||||
|
@Override
|
||||||
|
protected OAuth2ClientRespVO doInBackground() throws Exception {
|
||||||
|
OAuth2ClientRespVO auth2ClientRespVO = new OAuth2ClientRespVO();
|
||||||
|
if (id != null) {
|
||||||
|
CommonResult<OAuth2ClientRespVO> userResult = Request.connector(OAuth2ClientFeign.class).getOAuth2Client(id);
|
||||||
|
auth2ClientRespVO = userResult.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return auth2ClientRespVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
setValue(get());
|
||||||
|
List<DictDataSimpleRespVO> dictDataSimpleRespVOList = AppStore.getDictDataList(DictTypeEnum.SYSTEM_OAUTH2_GRANT_TYPE);
|
||||||
|
// 提取所有 label
|
||||||
|
List<String> labels = dictDataSimpleRespVOList.stream().map(DictDataSimpleRespVO::getLabel).collect(Collectors.toList());
|
||||||
|
authorizedGrantTypesCheckBoxList.setModel(new DefaultComboBoxModel(labels.toArray()));
|
||||||
|
authorizedGrantTypesCheckBoxList.setSelectedObjects(get().getAuthorizedGrantTypes().toArray());
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swingWorker.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||||
|
// Generated using JFormDesigner non-commercial license
|
||||||
|
private JLabel label16;
|
||||||
|
private JTextField clientIdTextField;
|
||||||
|
private JLabel label17;
|
||||||
|
private JTextField secretTextField;
|
||||||
|
private JLabel label18;
|
||||||
|
private JTextField nameTextField;
|
||||||
|
private JLabel label19;
|
||||||
|
private JLabel logoLabel;
|
||||||
|
private JLabel label20;
|
||||||
|
private JScrollPane scrollPane1;
|
||||||
|
private JTextArea descriptionTextArea;
|
||||||
|
private JLabel label21;
|
||||||
|
private JComboBox statusComboBox;
|
||||||
|
private JLabel label22;
|
||||||
|
private JSpinner accessTokenValiditySecondsSpinner;
|
||||||
|
private JLabel label23;
|
||||||
|
private JSpinner refreshTokenValiditySecondsSpinner;
|
||||||
|
private JLabel label24;
|
||||||
|
private JTextField authorizedGrantTypesComboBox;
|
||||||
|
private JLabel label25;
|
||||||
|
private JTextField scopesComboBox;
|
||||||
|
private JLabel label26;
|
||||||
|
private JTextField autoApproveScopesComboBox;
|
||||||
|
private JLabel label27;
|
||||||
|
private JTextField redirectUrisComboBox;
|
||||||
|
private JLabel label28;
|
||||||
|
private JTextField authoritiesComboBox;
|
||||||
|
private JLabel label29;
|
||||||
|
private JTextField resourceIdsComboBox;
|
||||||
|
private JLabel label30;
|
||||||
|
private JScrollPane scrollPane2;
|
||||||
|
private JTextArea additionalInformationTextArea;
|
||||||
|
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||||
|
}
|
@ -0,0 +1,189 @@
|
|||||||
|
JFDML JFormDesigner: "8.2.4.0.393" Java: "21.0.5" encoding: "UTF-8"
|
||||||
|
|
||||||
|
new FormModel {
|
||||||
|
contentType: "form/swing"
|
||||||
|
root: new FormRoot {
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "fill,hidemode 3"
|
||||||
|
"$columnConstraints": "[right][320:420,grow,fill]"
|
||||||
|
"$rowConstraints": "[][][][][][][][][][][][][][][]"
|
||||||
|
} ) {
|
||||||
|
name: "this"
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label16"
|
||||||
|
"text": "客户端编号"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "clientIdTextField"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label17"
|
||||||
|
"text": "客户端密钥"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 1"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "secretTextField"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 1"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label18"
|
||||||
|
"text": "应用名"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 2"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "nameTextField"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 2"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label19"
|
||||||
|
"text": "应用图标"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 3"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "logoLabel"
|
||||||
|
"text": "text"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 3,alignx center,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label20"
|
||||||
|
"text": "应用描述"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 4"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
|
name: "scrollPane1"
|
||||||
|
add( new FormComponent( "javax.swing.JTextArea" ) {
|
||||||
|
name: "descriptionTextArea"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 4"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label21"
|
||||||
|
"text": "状态"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 5"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "statusComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 5"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label22"
|
||||||
|
"text": "访问令牌的有效期"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 6"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
|
name: "accessTokenValiditySecondsSpinner"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 6"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label23"
|
||||||
|
"text": "刷新令牌的有效期"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 7"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
|
name: "refreshTokenValiditySecondsSpinner"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 7"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label24"
|
||||||
|
"text": "授权类型"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 8"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "authorizedGrantTypesComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 8"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label25"
|
||||||
|
"text": "授权范围"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 9"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "scopesComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 9"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label26"
|
||||||
|
"text": "自动授权范围"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 10"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "autoApproveScopesComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 10"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label27"
|
||||||
|
"text": "可重定向的 URI 地址"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 11"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "redirectUrisComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 11"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label28"
|
||||||
|
"text": "权限"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 12"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "authoritiesComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 12"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label29"
|
||||||
|
"text": "资源"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 13"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "resourceIdsComboBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 13"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label30"
|
||||||
|
"text": "附加信息"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 14"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
|
name: "scrollPane2"
|
||||||
|
add( new FormComponent( "javax.swing.JTextArea" ) {
|
||||||
|
name: "additionalInformationTextArea"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 14"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( null ) {
|
||||||
|
"location": new java.awt.Point( 0, 0 )
|
||||||
|
"size": new java.awt.Dimension( 615, 570 )
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,442 @@
|
|||||||
|
/*
|
||||||
|
* Created by JFormDesigner on Thu Jun 13 19:52:21 CST 2024
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.lw.swing.view.system.oauth2.client;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||||
|
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||||
|
import com.lw.dillon.admin.framework.common.pojo.PageResult;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientRespVO;
|
||||||
|
import com.lw.dillon.admin.module.system.controller.admin.oauth2.vo.client.OAuth2ClientSaveReqVO;
|
||||||
|
import com.lw.swing.components.*;
|
||||||
|
import com.lw.swing.components.notice.WMessage;
|
||||||
|
import com.lw.swing.components.table.renderer.OptButtonTableCellEditor;
|
||||||
|
import com.lw.swing.components.table.renderer.OptButtonTableCellRenderer;
|
||||||
|
import com.lw.swing.request.Request;
|
||||||
|
import com.lw.swing.view.MainFrame;
|
||||||
|
import com.lw.ui.request.api.system.OAuth2ClientFeign;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.jdesktop.swingx.JXTable;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import static javax.swing.JOptionPane.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wenli
|
||||||
|
*/
|
||||||
|
public class ClientPanel extends JPanel {
|
||||||
|
private String[] COLUMN_ID = {"客户端编号", "客户端密钥","应用名","应用图标", "状态", "访问令牌的有效期","刷新令牌的有效期","授权类型", "创建时间", "操作"};
|
||||||
|
|
||||||
|
private DefaultTableModel tableModel;
|
||||||
|
|
||||||
|
private WPaginationPane paginationPane;
|
||||||
|
|
||||||
|
public ClientPanel() {
|
||||||
|
initComponents();
|
||||||
|
initListeners();
|
||||||
|
updateData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
textField = new JTextField();
|
||||||
|
scrollPane1 = new WScrollPane();
|
||||||
|
centerPane = new JPanel();
|
||||||
|
scrollPane2 = new WScrollPane();
|
||||||
|
table = new JXTable(tableModel = new DefaultTableModel());
|
||||||
|
toolPane = new WPanel();
|
||||||
|
label7 = new JLabel();
|
||||||
|
nameTextField = new JTextField();
|
||||||
|
label8 = new JLabel();
|
||||||
|
codeTextField = new JTextField();
|
||||||
|
label9 = new JLabel();
|
||||||
|
stautsComboBox = new JComboBox();
|
||||||
|
searchBut = new JButton();
|
||||||
|
reseBut = new JButton();
|
||||||
|
newBut = new JButton();
|
||||||
|
|
||||||
|
//======== this ========
|
||||||
|
setOpaque(false);
|
||||||
|
setLayout(new BorderLayout(10, 10));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//======== centerPane ========
|
||||||
|
{
|
||||||
|
centerPane.setOpaque(false);
|
||||||
|
centerPane.setLayout(new BorderLayout(10, 10));
|
||||||
|
|
||||||
|
//======== scrollPane2 ========
|
||||||
|
{
|
||||||
|
tableModel.setColumnIdentifiers(COLUMN_ID);
|
||||||
|
scrollPane2.setViewportView(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
JPanel panel = new WPanel();
|
||||||
|
panel.setLayout(new BorderLayout());
|
||||||
|
panel.add(scrollPane2);
|
||||||
|
paginationPane = new WPaginationPane() {
|
||||||
|
@Override
|
||||||
|
public void setPageIndex(long pageIndex) {
|
||||||
|
super.setPageIndex(pageIndex);
|
||||||
|
updateData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
paginationPane.setOpaque(false);
|
||||||
|
panel.add(paginationPane, BorderLayout.SOUTH);
|
||||||
|
centerPane.add(panel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
//======== toolPane ========
|
||||||
|
{
|
||||||
|
toolPane.setLayout(new MigLayout(
|
||||||
|
"fill,insets 0,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[left]",
|
||||||
|
// rows
|
||||||
|
"[]"));
|
||||||
|
toolPane.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
//---- label7 ----
|
||||||
|
label7.setText("岗位名称");
|
||||||
|
toolPane.add(label7, "cell 0 0");
|
||||||
|
|
||||||
|
//---- postNameTextField ----
|
||||||
|
nameTextField.setColumns(15);
|
||||||
|
toolPane.add(nameTextField, "cell 0 0");
|
||||||
|
|
||||||
|
//---- label8 ----
|
||||||
|
label8.setText("岗位编码");
|
||||||
|
toolPane.add(label8, "cell 0 0");
|
||||||
|
|
||||||
|
//---- phoneTextField ----
|
||||||
|
codeTextField.setColumns(15);
|
||||||
|
toolPane.add(codeTextField, "cell 0 0");
|
||||||
|
|
||||||
|
//---- label9 ----
|
||||||
|
label9.setText("状态");
|
||||||
|
toolPane.add(label9, "cell 0 0");
|
||||||
|
toolPane.add(stautsComboBox, "cell 0 0");
|
||||||
|
|
||||||
|
//---- button1 ----
|
||||||
|
searchBut.setText("\u641c\u7d22");
|
||||||
|
toolPane.add(searchBut, "cell 0 0");
|
||||||
|
|
||||||
|
//---- reseBut ----
|
||||||
|
reseBut.setText("\u91cd\u7f6e");
|
||||||
|
toolPane.add(reseBut, "cell 0 0");
|
||||||
|
|
||||||
|
//---- newBut ----
|
||||||
|
newBut.setText("\u65b0\u589e");
|
||||||
|
toolPane.add(newBut, "cell 0 0");
|
||||||
|
}
|
||||||
|
centerPane.add(toolPane, BorderLayout.NORTH);
|
||||||
|
}
|
||||||
|
add(centerPane, BorderLayout.CENTER);
|
||||||
|
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
||||||
|
|
||||||
|
table.setRowHeight(40);
|
||||||
|
|
||||||
|
|
||||||
|
stautsComboBox.addItem("全部");
|
||||||
|
stautsComboBox.addItem("开启");
|
||||||
|
stautsComboBox.addItem("关闭");
|
||||||
|
|
||||||
|
table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private JToolBar creatBar() {
|
||||||
|
JToolBar optBar = new JToolBar();
|
||||||
|
optBar.setOpaque(false);
|
||||||
|
JButton edit = new JButton("修改");
|
||||||
|
edit.setForeground(UIManager.getColor("App.accentColor"));
|
||||||
|
edit.setIcon(new FlatSVGIcon("icons/xiugai.svg", 15, 15));
|
||||||
|
edit.addActionListener(e -> showEditDialog());
|
||||||
|
edit.setForeground(UIManager.getColor("App.accentColor"));
|
||||||
|
|
||||||
|
JButton del = new JButton("删除");
|
||||||
|
del.setIcon(new FlatSVGIcon("icons/delte.svg", 15, 15));
|
||||||
|
del.addActionListener(e -> del());
|
||||||
|
del.setForeground(UIManager.getColor("app-error-color-5"));
|
||||||
|
|
||||||
|
|
||||||
|
optBar.add(Box.createGlue());
|
||||||
|
optBar.add(edit);
|
||||||
|
optBar.add(del);
|
||||||
|
optBar.add(Box.createGlue());
|
||||||
|
optBar.setPreferredSize(new Dimension(210, 45));
|
||||||
|
return optBar;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initListeners() {
|
||||||
|
|
||||||
|
reseBut.addActionListener(e -> reset());
|
||||||
|
searchBut.addActionListener(e -> updateData());
|
||||||
|
newBut.addActionListener(e -> showAddDialog(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reset() {
|
||||||
|
nameTextField.setText("");
|
||||||
|
codeTextField.setText("");
|
||||||
|
stautsComboBox.setSelectedIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAddDialog(Long id) {
|
||||||
|
ClientFormPane clientFormPane = new ClientFormPane();
|
||||||
|
clientFormPane.updateData(id);
|
||||||
|
int opt = WOptionPane.showOptionDialog(null, clientFormPane, "添加", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
|
||||||
|
if (opt == 0) {
|
||||||
|
add(clientFormPane.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEditDialog() {
|
||||||
|
|
||||||
|
|
||||||
|
int selRow = table.getSelectedRow();
|
||||||
|
Long id = null;
|
||||||
|
if (selRow != -1) {
|
||||||
|
OAuth2ClientRespVO auth2ClientRespVO= (OAuth2ClientRespVO) table.getValueAt(selRow, COLUMN_ID.length-1);
|
||||||
|
id = auth2ClientRespVO.getId();
|
||||||
|
}else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ClientFormPane clientFormPane = new ClientFormPane();
|
||||||
|
clientFormPane.updateData(id);
|
||||||
|
int opt = WOptionPane.showOptionDialog(null, clientFormPane, "修改", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
|
||||||
|
if (opt == 0) {
|
||||||
|
edit(clientFormPane.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
private void add(OAuth2ClientSaveReqVO saveReqVO) {
|
||||||
|
|
||||||
|
SwingWorker<CommonResult<Long>, Object> swingWorker = new SwingWorker<CommonResult<Long>, Object>() {
|
||||||
|
@Override
|
||||||
|
protected CommonResult<Long> doInBackground() throws Exception {
|
||||||
|
return Request.connector(OAuth2ClientFeign.class).createOAuth2Client(saveReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
if (get().isSuccess()) {
|
||||||
|
WMessage.showMessageSuccess(MainFrame.getInstance(),"添加成功!");
|
||||||
|
updateData();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swingWorker.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void edit(OAuth2ClientSaveReqVO saveReqVO) {
|
||||||
|
|
||||||
|
|
||||||
|
SwingWorker<CommonResult<Boolean>, Object> swingWorker = new SwingWorker<CommonResult<Boolean>, Object>() {
|
||||||
|
@Override
|
||||||
|
protected CommonResult<Boolean> doInBackground() throws Exception {
|
||||||
|
return Request.connector(OAuth2ClientFeign.class).updateOAuth2Client(saveReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
if (get().isSuccess()) {
|
||||||
|
WMessage.showMessageSuccess(MainFrame.getInstance(),"修改成功!");
|
||||||
|
|
||||||
|
updateData();
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swingWorker.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void del() {
|
||||||
|
Long id = null;
|
||||||
|
String name = null;
|
||||||
|
|
||||||
|
int selRow = table.getSelectedRow();
|
||||||
|
if (selRow != -1) {
|
||||||
|
OAuth2ClientRespVO auth2ClientRespVO= (OAuth2ClientRespVO) table.getValueAt(selRow, COLUMN_ID.length-1);
|
||||||
|
id = auth2ClientRespVO.getId();
|
||||||
|
name = auth2ClientRespVO.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
int opt = WOptionPane.showOptionDialog(this, "是否确定删除[" + name + "]?", "提示", OK_CANCEL_OPTION, WARNING_MESSAGE, null, null, null);
|
||||||
|
|
||||||
|
if (opt != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long finalId = id;
|
||||||
|
SwingWorker<CommonResult<Boolean>, Object> swingWorker = new SwingWorker<CommonResult<Boolean>, Object>() {
|
||||||
|
@Override
|
||||||
|
protected CommonResult<Boolean> doInBackground() throws Exception {
|
||||||
|
return Request.connector(OAuth2ClientFeign.class).deleteOAuth2Client(finalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
if (get().isSuccess()) {
|
||||||
|
WMessage.showMessageSuccess(MainFrame.getInstance(),"删除成功!");
|
||||||
|
|
||||||
|
updateData();
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swingWorker.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUI() {
|
||||||
|
super.updateUI();
|
||||||
|
if (table != null) {
|
||||||
|
table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateData() {
|
||||||
|
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
queryMap.put("pageNo", paginationPane.getPageIndex());
|
||||||
|
queryMap.put("pageSize", paginationPane.getPageSize());
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(nameTextField.getText())) {
|
||||||
|
queryMap.put("name", nameTextField.getText());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(codeTextField.getText())) {
|
||||||
|
queryMap.put("code", codeTextField.getText());
|
||||||
|
}
|
||||||
|
queryMap.put("status", stautsComboBox.getSelectedIndex() == 0 ? null : (stautsComboBox.getSelectedIndex() == 1 ? 0 : 1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SwingWorker<Vector<Vector>, Long> swingWorker = new SwingWorker<Vector<Vector>, Long>() {
|
||||||
|
@Override
|
||||||
|
protected Vector<Vector> doInBackground() throws Exception {
|
||||||
|
CommonResult<PageResult<OAuth2ClientRespVO>> result = Request.connector(OAuth2ClientFeign.class).getOAuth2ClientPage(queryMap);
|
||||||
|
|
||||||
|
Vector<Vector> tableData = new Vector<>();
|
||||||
|
|
||||||
|
|
||||||
|
if (result.isSuccess()) {
|
||||||
|
|
||||||
|
result.getData().getList().forEach(roleRespVO -> {
|
||||||
|
Vector rowV = new Vector();
|
||||||
|
rowV.add(roleRespVO.getClientId());
|
||||||
|
rowV.add(roleRespVO.getSecret());
|
||||||
|
rowV.add(roleRespVO.getName());
|
||||||
|
rowV.add(roleRespVO.getLogo());
|
||||||
|
rowV.add(roleRespVO.getStatus());
|
||||||
|
rowV.add(roleRespVO.getAccessTokenValiditySeconds());
|
||||||
|
rowV.add(roleRespVO.getRefreshTokenValiditySeconds());
|
||||||
|
rowV.add(roleRespVO.getAuthorizedGrantTypes());
|
||||||
|
rowV.add(DateUtil.format(roleRespVO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
rowV.add(roleRespVO);
|
||||||
|
tableData.add(rowV);
|
||||||
|
});
|
||||||
|
|
||||||
|
publish(result.getData().getTotal());
|
||||||
|
}
|
||||||
|
return tableData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void process(List<Long> chunks) {
|
||||||
|
chunks.forEach(total -> paginationPane.setTotal(total));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
tableModel.setDataVector(get(), new Vector<>(Arrays.asList(COLUMN_ID)));
|
||||||
|
table.getColumn("操作").setCellRenderer(new OptButtonTableCellRenderer(creatBar()));
|
||||||
|
table.getColumn("操作").setCellEditor(new OptButtonTableCellEditor(creatBar()));
|
||||||
|
|
||||||
|
table.getColumn("状态").setCellRenderer(new DefaultTableCellRenderer() {
|
||||||
|
@Override
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
|
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
|
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 10));
|
||||||
|
JLabel label = new JLabel(ObjectUtil.equals(value, 0) ? "开启" : "停用");
|
||||||
|
label.setForeground(ObjectUtil.equals(value, 0) ? new Color(96, 197, 104) : new Color(0xf56c6c));
|
||||||
|
FlatSVGIcon icon = new FlatSVGIcon("icons/yuan.svg", 10, 10);
|
||||||
|
icon.setColorFilter(new FlatSVGIcon.ColorFilter(color -> {
|
||||||
|
return label.getForeground();
|
||||||
|
}));
|
||||||
|
label.setIcon(icon);
|
||||||
|
panel.add(label);
|
||||||
|
panel.setBackground(component.getBackground());
|
||||||
|
panel.setOpaque(isSelected);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swingWorker.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||||
|
// Generated using JFormDesigner non-commercial license
|
||||||
|
private JTextField textField;
|
||||||
|
private JScrollPane scrollPane1;
|
||||||
|
private JPanel centerPane;
|
||||||
|
private JScrollPane scrollPane2;
|
||||||
|
private JTable table;
|
||||||
|
private JPanel toolPane;
|
||||||
|
private JLabel label7;
|
||||||
|
private JTextField nameTextField;
|
||||||
|
private JLabel label8;
|
||||||
|
private JTextField codeTextField;
|
||||||
|
private JLabel label9;
|
||||||
|
private JComboBox stautsComboBox;
|
||||||
|
private JButton searchBut;
|
||||||
|
private JButton reseBut;
|
||||||
|
private JButton newBut;
|
||||||
|
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||||
|
}
|
@ -263,7 +263,7 @@ public class DataPermissionPane extends JPanel {
|
|||||||
DefaultMutableTreeNode deptRoot = new DefaultMutableTreeNode("全部");
|
DefaultMutableTreeNode deptRoot = new DefaultMutableTreeNode("全部");
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, deptRoot); // Root node
|
nodeMap.put(0L, deptRoot); // Root node
|
||||||
|
|
||||||
List<DefaultMutableTreeNode> selNodes = new ArrayList<>();
|
List<DefaultMutableTreeNode> selNodes = new ArrayList<>();
|
||||||
for (DeptSimpleRespVO simpleRespVO : deptResult.getData()) {
|
for (DeptSimpleRespVO simpleRespVO : deptResult.getData()) {
|
||||||
|
@ -211,7 +211,7 @@ public class RoleAssignMenuPane extends JPanel {
|
|||||||
DefaultMutableTreeNode menuRoot = new DefaultMutableTreeNode("全部");
|
DefaultMutableTreeNode menuRoot = new DefaultMutableTreeNode("全部");
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, menuRoot); // Root node
|
nodeMap.put(0L, menuRoot); // Root node
|
||||||
|
|
||||||
java.util.List<DefaultMutableTreeNode> selNodes = new ArrayList<>();
|
java.util.List<DefaultMutableTreeNode> selNodes = new ArrayList<>();
|
||||||
for (MenuSimpleRespVO simpleRespVO : menuResult.getData()) {
|
for (MenuSimpleRespVO simpleRespVO : menuResult.getData()) {
|
||||||
|
@ -111,6 +111,7 @@ public class AssignRolesPane extends JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
roleCheckBoxList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
roleCheckBoxList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
if (!e.getValueIsAdjusting()) {
|
if (!e.getValueIsAdjusting()) {
|
||||||
Object[] objects = roleCheckBoxList.getCheckBoxListSelectedValues();
|
Object[] objects = roleCheckBoxList.getCheckBoxListSelectedValues();
|
||||||
|
@ -219,6 +219,7 @@ public class UserEditPane extends JPanel {
|
|||||||
|
|
||||||
|
|
||||||
postCheckBoxList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
postCheckBoxList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
if (!e.getValueIsAdjusting()) {
|
if (!e.getValueIsAdjusting()) {
|
||||||
Object[] objects = postCheckBoxList.getCheckBoxListSelectedValues();
|
Object[] objects = postCheckBoxList.getCheckBoxListSelectedValues();
|
||||||
@ -278,7 +279,7 @@ public class UserEditPane extends JPanel {
|
|||||||
DefaultMutableTreeNode selectNode = null;
|
DefaultMutableTreeNode selectNode = null;
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, deptRoot); // Root node
|
nodeMap.put(0L, deptRoot); // Root node
|
||||||
|
|
||||||
|
|
||||||
for (DeptSimpleRespVO simpleRespVO : deptResult.getData()) {
|
for (DeptSimpleRespVO simpleRespVO : deptResult.getData()) {
|
||||||
|
@ -487,7 +487,7 @@ public class UserManagementPanel extends JPanel {
|
|||||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode("主类目");
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode("主类目");
|
||||||
// Build the tree
|
// Build the tree
|
||||||
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
Map<Long, DefaultMutableTreeNode> nodeMap = new HashMap<>();
|
||||||
nodeMap.put(0l, root); // Root node
|
nodeMap.put(0L, root); // Root node
|
||||||
|
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
|
@ -2,4 +2,6 @@ app.name=dillon-admin-pro-swing
|
|||||||
app.homepage=${project.parent.url}
|
app.homepage=${project.parent.url}
|
||||||
app.version=${project.version}
|
app.version=${project.version}
|
||||||
app.server.url=http://127.0.0.1:48080/
|
app.server.url=http://127.0.0.1:48080/
|
||||||
|
#访问后端url的前缀
|
||||||
|
app.server.url.prefix=/admin-api
|
||||||
#app.server.url=http://localhost:8080
|
#app.server.url=http://localhost:8080
|
@ -0,0 +1,33 @@
|
|||||||
|
# 最大重试次数(不包括第一次尝试):
|
||||||
|
# 在同一个服务器上,重试的最大次数。默认情况下,Ribbon 会尝试向一个服务器发送请求,直到该服务器出现错误或重试次数超过这个设置的最大值。这里设置为 1,意味着最多会重试一次。
|
||||||
|
myService.ribbon.MaxAutoRetries=1
|
||||||
|
|
||||||
|
# 最大重试次数(不包括第一次服务器):
|
||||||
|
# 在所有可用服务器中,Ribbon 会根据负载均衡策略选择下一个服务器进行请求。此项配置设置最大重试次数,默认情况下,Ribbon 会尝试重新请求下一个服务器,直到超过最大重试次数。设置为 1,表示最多在备份服务器上重试一次。
|
||||||
|
myService.ribbon.MaxAutoRetriesNextServer=1
|
||||||
|
|
||||||
|
# 是否允许对所有操作进行重试:
|
||||||
|
# 这表示是否所有操作(如 GET、POST 等)都可以进行重试。默认为 `false`,即只在连接错误或服务器不可用时重试。设置为 `true` 时,所有请求都会尝试重试,可能用于减少服务不可用时的失败影响。
|
||||||
|
myService.ribbon.OkToRetryOnAllOperations=true
|
||||||
|
|
||||||
|
# 刷新服务器列表的间隔时间(毫秒):
|
||||||
|
# Ribbon 会定期刷新其服务器列表,以便获取最新的可用服务器。如果使用动态服务器列表或注册中心,设置这个值来指定更新频率。设置为 2000 表示每 2 秒刷新一次服务器列表。
|
||||||
|
myService.ribbon.ServerListRefreshInterval=200000
|
||||||
|
|
||||||
|
# 连接超时(毫秒):
|
||||||
|
# 这是 Apache HttpClient 在建立连接时的超时时间。设置为 3000,表示连接建立的最大超时为 3 秒。
|
||||||
|
myService.ribbon.ConnectTimeout=30000
|
||||||
|
|
||||||
|
# 读取超时(毫秒):
|
||||||
|
# 这是 Apache HttpClient 在等待服务器响应时的超时时间。设置为 3000,表示读取数据的最大超时为 3 秒。
|
||||||
|
myService.ribbon.ReadTimeout=30000
|
||||||
|
|
||||||
|
# 初始服务器列表:
|
||||||
|
# 这是 Ribbon 初始时使用的服务器列表,通常是一个以逗号分隔的服务器地址字符串。这里指定了三个服务器:`www.microsoft.com`、`www.yahoo.com`、`www.google.com`,这些服务器在负载均衡器启动时会被作为候选服务器使用。
|
||||||
|
myService.ribbon.listOfServers=http://127.0.0.1:48080,http://127.0.0.1:48081
|
||||||
|
|
||||||
|
|
||||||
|
# 启用 Prime 连接:
|
||||||
|
# 这个配置控制是否启用 Ribbon 的“Prime Connections”特性。Prime 连接指的是 Ribbon 预先连接一些服务器,以提高请求的响应速度。设置为 `true` 表示启用此特性。
|
||||||
|
myService.ribbon.EnablePrimeConnections=true
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user