Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
5efbb244
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5efbb244
编写于
11月 17, 2020
作者:
hlwwx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'1.编译时增加合并api.json功能2.configSample/manifest.cfg增加web相关配置'
上级
8b9780e5
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
960 addition
and
33 deletion
+960
-33
o2server/configSample/manifest.cfg
o2server/configSample/manifest.cfg
+2
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiAllBuilder.java
...ava/com/x/base/core/project/annotation/ApiAllBuilder.java
+910
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java
...n/java/com/x/base/core/project/annotation/ApiBuilder.java
+30
-32
o2server/x_program_center/pom.xml
o2server/x_program_center/pom.xml
+18
-0
未找到文件。
o2server/configSample/manifest.cfg
浏览文件 @
5efbb244
...
...
@@ -33,5 +33,6 @@
"vfs.json":"虚拟文件存储配置",
"welink.json":"华为WeLink配置",
"workTime.json":"工作时间配置",
"zhengwuDingding.json":"政务钉钉配置"
"zhengwuDingding.json":"政务钉钉配置",
"web.json":"前端相关配置"
}
\ No newline at end of file
o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiAllBuilder.java
0 → 100644
浏览文件 @
5efbb244
此差异已折叠。
点击以展开。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java
浏览文件 @
5efbb244
...
...
@@ -9,11 +9,9 @@ import java.util.ArrayList;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
...
...
@@ -63,22 +61,45 @@ public class ApiBuilder {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ApiBuilder
.
class
);
public
static
void
main
(
String
[]
args
)
throws
IOException
{
//System.out.println("ApiBuilder......");
File
basedir
=
new
File
(
args
[
0
]);
File
sourcedir
=
new
File
(
args
[
1
]);
File
dir
=
new
File
(
basedir
,
"src/main/webapp/describe"
);
FileUtils
.
forceMkdir
(
dir
);
ApiBuilder
builder
=
new
ApiBuilder
();
builder
.
scan
(
dir
);
//FileUtils.copyDirectory(sourcedir, new File(dir, "sources"));
String
filePath
=
args
[
0
];
String
fileName
=
filePath
.
substring
(
filePath
.
lastIndexOf
(
File
.
separator
),
filePath
.
length
());
filePath
=
filePath
.
substring
(
0
,
filePath
.
lastIndexOf
(
File
.
separator
));
filePath
=
filePath
+
File
.
separator
+
"x_program_center"
;
dir
=
new
File
(
filePath
,
"src/main/webapp/describe/api"
);
FileUtils
.
forceMkdir
(
dir
);
builder
.
scan
(
dir
,
fileName
);
}
private
void
scan
(
File
dir
,
String
fileName
)
{
try
{
List
<
JaxrsClass
>
jaxrsClasses
=
new
ArrayList
<>();
List
<
Class
<?>>
classes
=
this
.
scanJaxrsClass
();
for
(
Class
<?>
clz
:
classes
)
{
if
(
StandardJaxrsAction
.
class
.
isAssignableFrom
(
clz
))
{
jaxrsClasses
.
add
(
this
.
jaxrsClass
(
clz
));
}
}
LinkedHashMap
<
String
,
List
<?>>
map
=
new
LinkedHashMap
<>();
jaxrsClasses
=
jaxrsClasses
.
stream
().
sorted
(
Comparator
.
comparing
(
JaxrsClass:
:
getName
))
.
collect
(
Collectors
.
toList
());
map
.
put
(
"jaxrs"
,
jaxrsClasses
);
File
file
=
new
File
(
dir
,
fileName
+
".json"
);
FileUtils
.
writeStringToFile
(
file
,
XGsonBuilder
.
toJson
(
map
),
DefaultCharset
.
charset
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
scan
(
File
dir
)
{
try
{
List
<
JaxrsClass
>
jaxrsClasses
=
new
ArrayList
<>();
...
...
@@ -123,23 +144,13 @@ public class ApiBuilder {
logger
.
print
(
"describe class:{}."
,
clz
.
getName
());
JaxrsDescribe
jaxrsDescribe
=
clz
.
getAnnotation
(
JaxrsDescribe
.
class
);
JaxrsClass
jaxrsClass
=
new
JaxrsClass
();
//jaxrsClass.setClassName(clz.getName());
jaxrsClass
.
setName
(
clz
.
getSimpleName
());
//jaxrsClass.setDescription(jaxrsDescribe.value());
for
(
Method
method
:
clz
.
getMethods
())
{
JaxrsMethodDescribe
jaxrsMethodDescribe
=
method
.
getAnnotation
(
JaxrsMethodDescribe
.
class
);
if
(
null
!=
jaxrsMethodDescribe
)
{
/*
Map<String, JaxrsApiMethod> map = new HashMap<String,JaxrsApiMethod>();
map.put(method.getName(), this.jaxrsApiMethod(clz, method));
jaxrsClass.getMethods().add(map);
*/
jaxrsClass
.
getMethods
().
add
(
this
.
jaxrsApiMethod
(
clz
,
method
));
}
}
//jaxrsClass.setMethods(this.getSortData("name",jaxrsClass.getMethods()));
}
return
jaxrsClass
;
}
...
...
@@ -152,7 +163,6 @@ public class ApiBuilder {
this
.
keyName
=
keyName
;
}
public
int
compare
(
Map
<
String
,
JaxrsApiMethod
>
mp1
,
Map
<
String
,
JaxrsApiMethod
>
mp2
)
{
System
.
out
.
println
(
"this.keyName="
+
mp1
.
keySet
().
toArray
()[
0
]);
String
d1
=
mp1
.
keySet
().
toArray
()[
0
].
toString
();
String
d2
=
mp2
.
keySet
().
toArray
()[
0
].
toString
();
return
d2
.
compareTo
(
d1
);
...
...
@@ -167,9 +177,7 @@ public class ApiBuilder {
JaxrsMethodDescribe
jaxrsMethodDescribe
=
method
.
getAnnotation
(
JaxrsMethodDescribe
.
class
);
JaxrsApiMethod
jaxrsMethod
=
new
JaxrsApiMethod
();
jaxrsMethod
.
setName
(
method
.
getName
());
//jaxrsMethod.setDescription(jaxrsMethodDescribe.value());
Class
<?>
actionClass
=
jaxrsMethodDescribe
.
action
();
//jaxrsMethod.setClassName(actionClass.getName());
if
(
null
!=
method
.
getAnnotation
(
GET
.
class
))
{
jaxrsMethod
.
setMethod
(
"GET"
);
}
else
if
(
null
!=
method
.
getAnnotation
(
POST
.
class
))
{
...
...
@@ -541,23 +549,13 @@ public class ApiBuilder {
public
String
getName
()
{
return
name
;
}
/*
private List<Map<String,JaxrsApiMethod>> methods = new ArrayList<Map<String,JaxrsApiMethod>>();
public List<Map<String, JaxrsApiMethod>> getMethods() {
return methods;
}
public void setMethods(List<Map<String, JaxrsApiMethod>> methods) {
this.methods = methods;
}
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
public
class
JaxrsApiMethod
{
//private List<JaxsApiMethodProperty> name = new ArrayList<>();
private
String
name
;
private
String
uri
;
private
String
method
;
...
...
o2server/x_program_center/pom.xml
浏览文件 @
5efbb244
...
...
@@ -95,6 +95,24 @@
</arguments>
</configuration>
</execution>
<execution>
<id>
apiAllBuilder
</id>
<phase>
prepare-package
</phase>
<goals>
<goal>
java
</goal>
</goals>
<configuration>
<addOutputToClasspath>
true
</addOutputToClasspath>
<includePluginDependencies>
true
</includePluginDependencies>
<includeProjectDependencies>
true
</includeProjectDependencies>
<mainClass>
com.x.base.core.project.annotation.ApiAllBuilder
</mainClass>
<arguments>
<argument>
${basedir}
</argument>
<argument>
${project.build.sourceDirectory}
</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>
checkAssemble
</id>
<phase>
prepare-package
</phase>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录