@@ -1,97 +1,10 @@ | |||||
<p align="center"> | |||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png"> | |||||
</p> | |||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.5</h1> | |||||
<h4 align="center">基于SpringBoot+Vue前后端分离的Java快速开发框架</h4> | |||||
<p align="center"> | |||||
<a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a> | |||||
<a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.5-brightgreen.svg"></a> | |||||
<a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a> | |||||
</p> | |||||
## 代理中心 | |||||
### NSGK@2023 | |||||
## 平台简介 | |||||
#### RuoYi v3.8.5 | |||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 | |||||
> [打包脚本](bin/package.bat ':include') | |||||
* 前端采用Vue、Element UI。 | |||||
* 后端采用Spring Boot、Spring Security、Redis & Jwt。 | |||||
* 权限认证使用Jwt,支持多终端认证系统。 | |||||
* 支持加载动态权限菜单,多方式轻松权限控制。 | |||||
* 高效率开发,使用代码生成器可以一键生成前后端代码。 | |||||
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 | |||||
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 | |||||
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) | |||||
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。 | |||||
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip) | |||||
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console) | |||||
> [SDK打包脚本](agentcenter-sdk/build.bat ':include') | |||||
## 内置功能 | |||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 | |||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 | |||||
3. 岗位管理:配置系统用户所属担任职务。 | |||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 | |||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 | |||||
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 | |||||
7. 参数管理:对系统动态配置常用参数。 | |||||
8. 通知公告:系统通知公告信息发布维护。 | |||||
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 | |||||
10. 登录日志:系统登录日志记录查询包含登录异常。 | |||||
11. 在线用户:当前系统中活跃用户状态监控。 | |||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 | |||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 | |||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。 | |||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 | |||||
16. 缓存监控:对系统的缓存信息查询,命令统计等。 | |||||
17. 在线构建器:拖动表单元素生成相应的HTML代码。 | |||||
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 | |||||
## 在线体验 | |||||
- admin/admin123 | |||||
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 | |||||
演示地址:http://vue.ruoyi.vip | |||||
文档地址:http://doc.ruoyi.vip | |||||
## 演示图 | |||||
<table> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td> | |||||
</tr> | |||||
<tr> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td> | |||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td> | |||||
</tr> | |||||
</table> | |||||
## 若依前后端分离交流群 | |||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) 点击按钮入群。 | |||||
> 客户端手动导入: ```mvn install:install-file -Dfile=agentcenter-sdk-1.0.0nsgk1.jar -DgroupId=com.nsgk -DartifactId=agentcenter-sdk -Dversion=1.0.0nsgk1 -Dpackaging=jar``` |
@@ -0,0 +1,14 @@ | |||||
@echo off | |||||
echo. | |||||
echo Build NSGK-agentcenter-SDK | |||||
echo. | |||||
%~d0 | |||||
cd %~dp0 | |||||
call mvn clean package -Dmaven.test.skip=true | |||||
echo Open folder | |||||
start "" %cd%\target | |||||
pause |
@@ -9,7 +9,9 @@ | |||||
<version>1.0.0nsgk1</version> | <version>1.0.0nsgk1</version> | ||||
<packaging>jar</packaging> | <packaging>jar</packaging> | ||||
<name>NSGK agentcenter-sdk</name> | |||||
<description>NS代理中心SDK</description> | <description>NS代理中心SDK</description> | ||||
<url>https://www.nongshen.net</url> | |||||
<properties> | <properties> | ||||
<lombok.version>1.16.18</lombok.version> | <lombok.version>1.16.18</lombok.version> | ||||
@@ -11,8 +11,8 @@ public final class NSMain | |||||
{ | { | ||||
public static void main(String[] args) throws Exception | public static void main(String[] args) throws Exception | ||||
{ | { | ||||
//Test(); | |||||
Test_reflect(); | |||||
Test(); | |||||
//Test_reflect(); | |||||
} | } | ||||
public static void Test_reflect() throws InstantiationException, IllegalAccessException | public static void Test_reflect() throws InstantiationException, IllegalAccessException | ||||
@@ -43,7 +43,7 @@ public final class NSMain | |||||
NSContractionEntity entity; | NSContractionEntity entity; | ||||
NSApiResult result; | NSApiResult result; | ||||
NSSDK.InitClient("http://localhost", (short) 8081, "test", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=="); | |||||
NSSDK.InitClient("http://localhost", (short) 8081, "test", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==", 0); | |||||
client = NSSDK.InstanceClient(); | client = NSSDK.InstanceClient(); | ||||
entity = new NSContractionEntity(); | entity = new NSContractionEntity(); | ||||
@@ -53,6 +53,7 @@ public final class NSMain | |||||
.setBookId(166L) | .setBookId(166L) | ||||
.setOutId(999L) | .setOutId(999L) | ||||
; | ; | ||||
entity.Set("buildingTime", "2000-12-23"); | |||||
result = client.Send(NSProtocol.NS_PROTOCOL_CONTRACTION, entity); | result = client.Send(NSProtocol.NS_PROTOCOL_CONTRACTION, entity); | ||||
System.err.println(result); | System.err.println(result); | ||||
} | } | ||||
@@ -9,14 +9,15 @@ public final class NSSDK | |||||
private static final ThreadLocal<String> _host = new ThreadLocal<>(); | private static final ThreadLocal<String> _host = new ThreadLocal<>(); | ||||
private static final ThreadLocal<Short> _port = new ThreadLocal<>(); | private static final ThreadLocal<Short> _port = new ThreadLocal<>(); | ||||
private static final ThreadLocal<String> _identifier = new ThreadLocal<>(); | private static final ThreadLocal<String> _identifier = new ThreadLocal<>(); | ||||
private static final ThreadLocal<Boolean> _clientInit = new ThreadLocal<>(); | |||||
private static final ThreadLocal<String> _publicKey = new ThreadLocal<>(); | private static final ThreadLocal<String> _publicKey = new ThreadLocal<>(); | ||||
private static final ThreadLocal<Integer> _timeout = new ThreadLocal<>(); | |||||
private static final ThreadLocal<Boolean> _clientInit = new ThreadLocal<>(); | |||||
// server | // server | ||||
private static final ThreadLocal<String> _privateKey = new ThreadLocal<>(); | private static final ThreadLocal<String> _privateKey = new ThreadLocal<>(); | ||||
private static final ThreadLocal<Boolean> _serverInit = new ThreadLocal<>(); | private static final ThreadLocal<Boolean> _serverInit = new ThreadLocal<>(); | ||||
public static boolean InitClient(String host, short port, String identifier, String publicKey) | |||||
public static boolean InitClient(String host, short port, String identifier, String publicKey, int timeout) | |||||
{ | { | ||||
if(NSConv.FALSE(_clientInit.get())) | if(NSConv.FALSE(_clientInit.get())) | ||||
return false; | return false; | ||||
@@ -24,6 +25,7 @@ public final class NSSDK | |||||
_port.set(port); | _port.set(port); | ||||
_identifier.set(identifier); | _identifier.set(identifier); | ||||
_publicKey.set(publicKey); | _publicKey.set(publicKey); | ||||
_timeout.set(timeout); | |||||
_clientInit.set(true); | _clientInit.set(true); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -36,6 +38,7 @@ public final class NSSDK | |||||
_port.remove(); | _port.remove(); | ||||
_identifier.remove(); | _identifier.remove(); | ||||
_publicKey.remove(); | _publicKey.remove(); | ||||
_timeout.set(0); | |||||
_clientInit.set(false); | _clientInit.set(false); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -59,7 +62,7 @@ public final class NSSDK | |||||
{ | { | ||||
if(!NSConv.FALSE(_clientInit.get())) | if(!NSConv.FALSE(_clientInit.get())) | ||||
return null; | return null; | ||||
return new NSSDKClient(_host.get(), _port.get(), _identifier.get(), _publicKey.get()); | |||||
return new NSSDKClient(_host.get(), _port.get(), _identifier.get(), _publicKey.get(), _timeout.get()); | |||||
} | } | ||||
@@ -11,9 +11,8 @@ import com.nsgk.agentcentersdk.network.NSNetworkManager; | |||||
import com.nsgk.agentcentersdk.network.NSNetworkRequest; | import com.nsgk.agentcentersdk.network.NSNetworkRequest; | ||||
import com.nsgk.agentcentersdk.network.NSNetworkResponse; | import com.nsgk.agentcentersdk.network.NSNetworkResponse; | ||||
import com.nsgk.agentcentersdk.utility.NSCrypto; | import com.nsgk.agentcentersdk.utility.NSCrypto; | ||||
import com.nsgk.agentcentersdk.utility.NSStr; | |||||
import java.util.Objects; | |||||
import lombok.Data; | |||||
import lombok.experimental.Accessors; | |||||
// SDK客户端 | // SDK客户端 | ||||
/* | /* | ||||
@@ -28,19 +27,23 @@ import java.util.Objects; | |||||
timestamp: | timestamp: | ||||
data: "" // 加密json | data: "" // 加密json | ||||
*/ | */ | ||||
@Data | |||||
@Accessors(chain = true) | |||||
public final class NSSDKClient | public final class NSSDKClient | ||||
{ | { | ||||
private final String host; | private final String host; | ||||
private final short port; | private final short port; | ||||
private final String identifier; | private final String identifier; | ||||
private final String publicKey; | private final String publicKey; | ||||
private int timeout; | |||||
NSSDKClient(String host, short port, String identifier, String publicKey) | |||||
NSSDKClient(String host, short port, String identifier, String publicKey, int timeout) | |||||
{ | { | ||||
this.host = host; | this.host = host; | ||||
this.port = port; | this.port = port; | ||||
this.identifier = identifier; | this.identifier = identifier; | ||||
this.publicKey = publicKey; | this.publicKey = publicKey; | ||||
this.timeout = timeout; | |||||
} | } | ||||
// 发送请求 | // 发送请求 | ||||
@@ -57,6 +60,7 @@ public final class NSSDKClient | |||||
reportObject = new NSReportObject<>(identifier, protocol, object); | reportObject = new NSReportObject<>(identifier, protocol, object); | ||||
request = new NSNetworkRequest(); | request = new NSNetworkRequest(); | ||||
request.setUrl(BuildUrl(url)); | request.setUrl(BuildUrl(url)); | ||||
request.setTimeout(timeout); | |||||
WriteDataObject(request, reportObject); | WriteDataObject(request, reportObject); | ||||
NSNetworkResponse response = NSNetworkManager.Post(request); | NSNetworkResponse response = NSNetworkManager.Post(request); | ||||
NSErrGlobal.ASSERT(response.IsSuccess(), NSErrno.ERRNO_SYS_HTTP); | NSErrGlobal.ASSERT(response.IsSuccess(), NSErrno.ERRNO_SYS_HTTP); | ||||
@@ -15,5 +15,4 @@ public class NSContractionEntity extends NSEntityBase | |||||
/** 签订日期 */ | /** 签订日期 */ | ||||
private String buildingTime; | private String buildingTime; | ||||
} | } |
@@ -1,17 +1,21 @@ | |||||
package com.nsgk.agentcentersdk.entity; | package com.nsgk.agentcentersdk.entity; | ||||
import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||||
import com.nsgk.agentcentersdk.err.NSErrno; | |||||
import com.nsgk.agentcentersdk.utility.NSArr; | import com.nsgk.agentcentersdk.utility.NSArr; | ||||
import com.nsgk.agentcentersdk.utility.NSReflect; | |||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.lang.reflect.Field; | |||||
import java.util.LinkedHashMap; | import java.util.LinkedHashMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
// 基本实体 | // 基本实体 | ||||
@Data | @Data | ||||
@Accessors(chain = true) | @Accessors(chain = true) | ||||
public abstract class NSEntityBase implements Serializable | |||||
public class NSEntityBase implements Serializable | |||||
{ | { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@@ -65,4 +69,48 @@ public abstract class NSEntityBase implements Serializable | |||||
return def; | return def; | ||||
return (T)parms.getOrDefault(name, def); | return (T)parms.getOrDefault(name, def); | ||||
} | } | ||||
// Set函数为了兼容SDK | |||||
// 不检查类型 | |||||
public <T> boolean Set(String name, T val) | |||||
{ | |||||
Field field; | |||||
try | |||||
{ | |||||
field = NSReflect.FindField(getClass(), name); | |||||
if(null != field) | |||||
{ | |||||
if(!field.isAccessible()) | |||||
field.setAccessible(true); | |||||
field.set(this, val); | |||||
return true; | |||||
} | |||||
} | |||||
catch(Exception e) | |||||
{ | |||||
e.printStackTrace(); | |||||
} | |||||
return NSErrGlobal.ThrowAndReturn(NSErrno.ERRNO_SYS_INVALID_FIELD, false); | |||||
} | |||||
// 检查类型 | |||||
public boolean Set_s(String name, Object val) | |||||
{ | |||||
Field field; | |||||
try | |||||
{ | |||||
field = getClass().getField(name); | |||||
if(field.getType().isAssignableFrom(val.getClass())) | |||||
{ | |||||
return Set(name, val); | |||||
} | |||||
} | |||||
catch(Exception e) | |||||
{ | |||||
e.printStackTrace(); | |||||
} | |||||
return NSErrGlobal.ThrowAndReturn(NSErrno.ERRNO_SYS_INVALID_FIELD, false); | |||||
} | |||||
} | } |
@@ -13,6 +13,7 @@ public final class NSErrno | |||||
public static final int ERRNO_SYS_INVALID_PROTOCOL = 0x01004; | public static final int ERRNO_SYS_INVALID_PROTOCOL = 0x01004; | ||||
public static final int ERRNO_SYS_SIGN_FAIL = 0x01005; | public static final int ERRNO_SYS_SIGN_FAIL = 0x01005; | ||||
public static final int ERRNO_SYS_HTTP = 0x01006; | public static final int ERRNO_SYS_HTTP = 0x01006; | ||||
public static final int ERRNO_SYS_INVALID_FIELD = 0x01007; | |||||
public static final int ERRNO_CLI_PARAMETER_MISSING = 0x03001; | public static final int ERRNO_CLI_PARAMETER_MISSING = 0x03001; | ||||
public static final int ERRNO_CLI_DATA_MISSING = 0x03002; | public static final int ERRNO_CLI_DATA_MISSING = 0x03002; | ||||
@@ -32,6 +33,7 @@ public final class NSErrno | |||||
case ERRNO_SYS_INVALID_PROTOCOL: return "无效协议"; | case ERRNO_SYS_INVALID_PROTOCOL: return "无效协议"; | ||||
case ERRNO_SYS_SIGN_FAIL: return "签名失败"; | case ERRNO_SYS_SIGN_FAIL: return "签名失败"; | ||||
case ERRNO_SYS_HTTP: return "Http请求错误"; | case ERRNO_SYS_HTTP: return "Http请求错误"; | ||||
case ERRNO_SYS_INVALID_FIELD: return "无效字段"; | |||||
case ERRNO_CLI_PARAMETER_MISSING: return "参数缺失"; | case ERRNO_CLI_PARAMETER_MISSING: return "参数缺失"; | ||||
case ERRNO_CLI_DATA_MISSING: return "数据缺失"; | case ERRNO_CLI_DATA_MISSING: return "数据缺失"; | ||||
@@ -18,6 +18,8 @@ public final class NSNetworkManager | |||||
network = CreateRequest(NSHttp.BuildUrl(req.getUrl(), req.getQuery()), "post"); | network = CreateRequest(NSHttp.BuildUrl(req.getUrl(), req.getQuery()), "post"); | ||||
req.getHeaders().forEach(network::header); | req.getHeaders().forEach(network::header); | ||||
network.body(req.getData()); | network.body(req.getData()); | ||||
network.setConnectionTimeout(req.getTimeout()); | |||||
network.setReadTimeout(req.getTimeout()); | |||||
execute = network.execute(); | execute = network.execute(); | ||||
response = new NSNetworkResponse(); | response = new NSNetworkResponse(); | ||||
response.setData(execute.body()); | response.setData(execute.body()); | ||||
@@ -10,4 +10,5 @@ import lombok.experimental.Accessors; | |||||
@Accessors(chain = true) | @Accessors(chain = true) | ||||
public class NSNetworkRequest extends NSNetworkTransport | public class NSNetworkRequest extends NSNetworkTransport | ||||
{ | { | ||||
private int timeout = 0; | |||||
} | } |
@@ -11,7 +11,7 @@ import java.util.Map; | |||||
// Http传输 | // Http传输 | ||||
@Data | @Data | ||||
@Accessors(chain = true) | @Accessors(chain = true) | ||||
public class NSNetworkTransport | |||||
public abstract class NSNetworkTransport | |||||
{ | { | ||||
private String url; | private String url; | ||||
private final Map<String, String> headers = new LinkedHashMap<>(); | private final Map<String, String> headers = new LinkedHashMap<>(); | ||||
@@ -1,8 +1,11 @@ | |||||
package com.nsgk.agentcentersdk.utility; | package com.nsgk.agentcentersdk.utility; | ||||
import java.lang.reflect.Field; | |||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Optional; | |||||
// 反射工具 | // 反射工具 | ||||
public final class NSReflect | public final class NSReflect | ||||
@@ -140,5 +143,59 @@ public final class NSReflect | |||||
} | } | ||||
} | } | ||||
// find first: 不检查类型 | |||||
public static Field FindField(Class<?> clazz, String name) | |||||
{ | |||||
Field[] declaredFields; | |||||
Optional<Field> first; | |||||
Class<?> superclass; | |||||
declaredFields = clazz.getDeclaredFields(); | |||||
first = Arrays.stream(declaredFields).filter((x) -> x.getName().equals(name)).findFirst(); | |||||
if(first.isPresent()) | |||||
return first.get(); | |||||
superclass = clazz.getSuperclass(); | |||||
if(null != superclass) | |||||
return FindField(superclass, name); | |||||
return null; | |||||
} | |||||
// find first: 检查类型, 仅匹配 | |||||
public static Field FindField_s(Class<?> clazz, String name, Class<?> fieldClazz) | |||||
{ | |||||
Field[] declaredFields; | |||||
Optional<Field> first; | |||||
Class<?> superclass; | |||||
declaredFields = clazz.getDeclaredFields(); | |||||
first = Arrays.stream(declaredFields).filter((x) -> x.getName().equals(name) && x.getType().isAssignableFrom(fieldClazz)).findFirst(); | |||||
if(first.isPresent()) | |||||
return first.get(); | |||||
superclass = clazz.getSuperclass(); | |||||
if(null != superclass) | |||||
return FindField(superclass, name); | |||||
return null; | |||||
} | |||||
// find first: 检查类型, 严格 | |||||
public static Field FindField_ss(Class<?> clazz, String name, Class<?> fieldClazz) | |||||
{ | |||||
Field[] declaredFields; | |||||
Optional<Field> first; | |||||
Class<?> superclass; | |||||
declaredFields = clazz.getDeclaredFields(); | |||||
first = Arrays.stream(declaredFields).filter((x) -> x.getName().equals(name) && x.getType().equals(fieldClazz)).findFirst(); | |||||
if(first.isPresent()) | |||||
return first.get(); | |||||
superclass = clazz.getSuperclass(); | |||||
if(null != superclass) | |||||
return FindField(superclass, name); | |||||
return null; | |||||
} | |||||
private NSReflect() {} | private NSReflect() {} | ||||
} | } |
@@ -1,6 +1,6 @@ | |||||
@echo off | @echo off | ||||
echo. | echo. | ||||
echo [信息] 打包Web工程,生成war/jar包文件。 | |||||
echo [锟斤拷息] 锟斤拷锟絎eb锟斤拷锟教o拷锟斤拷锟斤拷war/jar锟斤拷锟侥硷拷锟斤拷 | |||||
echo. | echo. | ||||
%~d0 | %~d0 | ||||
@@ -9,4 +9,7 @@ cd %~dp0 | |||||
cd .. | cd .. | ||||
call mvn clean package -Dmaven.test.skip=true | call mvn clean package -Dmaven.test.skip=true | ||||
echo 锟斤拷目锟斤拷锟侥硷拷锟斤拷 | |||||
start "" %cd%\ruoyi-admin\target | |||||
pause | pause |
@@ -212,6 +212,7 @@ | |||||
</dependencyManagement> | </dependencyManagement> | ||||
<modules> | <modules> | ||||
<module>agentcenter-sdk</module> | |||||
<module>ruoyi-admin</module> | <module>ruoyi-admin</module> | ||||
<module>ruoyi-framework</module> | <module>ruoyi-framework</module> | ||||
<module>ruoyi-system</module> | <module>ruoyi-system</module> | ||||
@@ -236,10 +237,10 @@ | |||||
<groupId>com.google.guava</groupId> | <groupId>com.google.guava</groupId> | ||||
<artifactId>guava</artifactId> | <artifactId>guava</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<!--<dependency> | |||||
<groupId>com.nsgk</groupId> | <groupId>com.nsgk</groupId> | ||||
<artifactId>agentcenter-sdk</artifactId> | <artifactId>agentcenter-sdk</artifactId> | ||||
</dependency> | |||||
</dependency>--> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
@@ -8,7 +8,7 @@ | |||||
<version>3.8.5</version> | <version>3.8.5</version> | ||||
</parent> | </parent> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<packaging>jar</packaging> | |||||
<packaging>war</packaging> | |||||
<artifactId>ruoyi-admin</artifactId> | <artifactId>ruoyi-admin</artifactId> | ||||
<description> | <description> | ||||
@@ -23,8 +23,8 @@ | |||||
<artifactId>ruoyi-common</artifactId> | <artifactId>ruoyi-common</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>com.ruoyi</groupId> | |||||
<artifactId>ruoyi-common</artifactId> | |||||
<groupId>com.nsgk</groupId> | |||||
<artifactId>agentcenter-sdk</artifactId> | |||||
</dependency> | </dependency> | ||||
</dependencies> | </dependencies> | ||||