Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
4e168c48
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
4e168c48
编写于
1月 08, 2021
作者:
O
o2null
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加invoke安全令牌
上级
2d36a19f
变更
71
隐藏空白更改
内联
并排
Showing
71 changed file
with
880 addition
and
1397 deletion
+880
-1397
o2server/x_base_core_project/src/main/java/com/x/base/core/project/gson/GsonPropertyObject.java
...java/com/x/base/core/project/gson/GsonPropertyObject.java
+1
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/Message.java
...rc/main/java/com/x/base/core/project/message/Message.java
+2
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/PmsMessage.java
...main/java/com/x/base/core/project/message/PmsMessage.java
+16
-1
o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java
...r/src/main/java/com/x/program/center/ThisApplication.java
+0
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/ActionApplication.java
...in/java/com/x/program/center/jaxrs/ActionApplication.java
+0
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/adminlogin/WrapInAdminLogin.java
...m/x/program/center/jaxrs/adminlogin/WrapInAdminLogin.java
+0
-37
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/adminlogin/WrapOutAdminLogin.java
.../x/program/center/jaxrs/adminlogin/WrapOutAdminLogin.java
+0
-48
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/ActionUpdate.java
...n/java/com/x/program/center/jaxrs/agent/ActionUpdate.java
+2
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/AgentAction.java
...in/java/com/x/program/center/jaxrs/agent/AgentAction.java
+3
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/BaseAction.java
...ain/java/com/x/program/center/jaxrs/agent/BaseAction.java
+1
-33
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionCurrentStyle.java
...m/x/program/center/jaxrs/appstyle/ActionCurrentStyle.java
+7
-4
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionCurrentUpdate.java
.../x/program/center/jaxrs/appstyle/ActionCurrentUpdate.java
+1
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLaunchLogo.java
.../program/center/jaxrs/appstyle/ActionImageLaunchLogo.java
+2
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLaunchLogoErase.java
...ram/center/jaxrs/appstyle/ActionImageLaunchLogoErase.java
+2
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLoginAvatar.java
...program/center/jaxrs/appstyle/ActionImageLoginAvatar.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLoginAvatarErase.java
...am/center/jaxrs/appstyle/ActionImageLoginAvatarErase.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoBlur.java
...rogram/center/jaxrs/appstyle/ActionImageMenuLogoBlur.java
+5
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoBlurErase.java
...m/center/jaxrs/appstyle/ActionImageMenuLogoBlurErase.java
+5
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoFocus.java
...ogram/center/jaxrs/appstyle/ActionImageMenuLogoFocus.java
+5
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoFocusErase.java
.../center/jaxrs/appstyle/ActionImageMenuLogoFocusErase.java
+7
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageProcessDefault.java
...gram/center/jaxrs/appstyle/ActionImageProcessDefault.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageProcessDefaultErase.java
...center/jaxrs/appstyle/ActionImageProcessDefaultErase.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageSetupAboutLogo.java
...gram/center/jaxrs/appstyle/ActionImageSetupAboutLogo.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageSetupAboutLogoErase.java
...center/jaxrs/appstyle/ActionImageSetupAboutLogoErase.java
+4
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/AppStyleAction.java
...a/com/x/program/center/jaxrs/appstyle/AppStyleAction.java
+0
-37
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/BaseAction.java
.../java/com/x/program/center/jaxrs/appstyle/BaseAction.java
+2
-4
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/cachedispatch/ActionDispatch.java
.../x/program/center/jaxrs/cachedispatch/ActionDispatch.java
+32
-24
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionCreate.java
...java/com/x/program/center/jaxrs/captcha/ActionCreate.java
+3
-16
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionList.java
...n/java/com/x/program/center/jaxrs/captcha/ActionList.java
+1
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionValidate.java
...va/com/x/program/center/jaxrs/captcha/ActionValidate.java
+3
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/CaptchaAction.java
...ava/com/x/program/center/jaxrs/captcha/CaptchaAction.java
+8
-7
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/center/ActionListMetricsDataTable.java
...ogram/center/jaxrs/center/ActionListMetricsDataTable.java
+0
-390
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionList.java
...main/java/com/x/program/center/jaxrs/code/ActionList.java
+1
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionCode.java
...n/java/com/x/program/center/jaxrs/collect/ActionCode.java
+3
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionConnect.java
...ava/com/x/program/center/jaxrs/collect/ActionConnect.java
+3
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionControllerMobile.java
.../program/center/jaxrs/collect/ActionControllerMobile.java
+3
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionDelete.java
...java/com/x/program/center/jaxrs/collect/ActionDelete.java
+4
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionExist.java
.../java/com/x/program/center/jaxrs/collect/ActionExist.java
+3
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionLogin.java
.../java/com/x/program/center/jaxrs/collect/ActionLogin.java
+1
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionRegist.java
...java/com/x/program/center/jaxrs/collect/ActionRegist.java
+3
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionResetPassword.java
...m/x/program/center/jaxrs/collect/ActionResetPassword.java
+2
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionUpdate.java
...java/com/x/program/center/jaxrs/collect/ActionUpdate.java
+3
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionUpdateUnit.java
.../com/x/program/center/jaxrs/collect/ActionUpdateUnit.java
+3
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidate.java
...va/com/x/program/center/jaxrs/collect/ActionValidate.java
+5
-12
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidateCodeAnswer.java
...rogram/center/jaxrs/collect/ActionValidateCodeAnswer.java
+8
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidateDirect.java
.../x/program/center/jaxrs/collect/ActionValidateDirect.java
+3
-3
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidatePassword.java
.../program/center/jaxrs/collect/ActionValidatePassword.java
+5
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
...ava/com/x/program/center/jaxrs/command/ActionCommand.java
+75
-69
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionGet.java
...in/java/com/x/program/center/jaxrs/command/ActionGet.java
+38
-40
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUninstall.java
...a/com/x/program/center/jaxrs/command/ActionUninstall.java
+49
-43
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUploadFile.java
.../com/x/program/center/jaxrs/command/ActionUploadFile.java
+70
-61
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ActionList.java
...in/java/com/x/program/center/jaxrs/config/ActionList.java
+28
-34
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/BaseAction.java
...in/java/com/x/program/center/jaxrs/config/BaseAction.java
+8
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecute.java
...java/com/x/program/center/jaxrs/invoke/ActionExecute.java
+4
-142
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecute2.java
...ava/com/x/program/center/jaxrs/invoke/ActionExecute2.java
+0
-171
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecuteToken.java
...com/x/program/center/jaxrs/invoke/ActionExecuteToken.java
+72
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionToken.java
...n/java/com/x/program/center/jaxrs/invoke/ActionToken.java
+68
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/BaseAction.java
...in/java/com/x/program/center/jaxrs/invoke/BaseAction.java
+150
-28
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionEnableToken.java
...m/x/program/center/jaxrs/invoke/ExceptionEnableToken.java
+12
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenExpired.java
.../x/program/center/jaxrs/invoke/ExceptionTokenExpired.java
+12
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenNameEmpty.java
.../program/center/jaxrs/invoke/ExceptionTokenNameEmpty.java
+12
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenNameNotMatch.java
...ogram/center/jaxrs/invoke/ExceptionTokenNameNotMatch.java
+12
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/InvokeAction.java
.../java/com/x/program/center/jaxrs/invoke/InvokeAction.java
+37
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/pms/ActionCreate.java
...ain/java/com/x/program/center/jaxrs/pms/ActionCreate.java
+6
-2
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/prompterrorlog/PromptErrorLogAction.java
...ram/center/jaxrs/prompterrorlog/PromptErrorLogAction.java
+4
-4
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/qiyeweixin/QiyeweixinAction.java
...m/x/program/center/jaxrs/qiyeweixin/QiyeweixinAction.java
+2
-9
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/schedule/ActionFire.java
.../java/com/x/program/center/jaxrs/schedule/ActionFire.java
+5
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/ActionTest1.java
...ain/java/com/x/program/center/jaxrs/test/ActionTest1.java
+0
-19
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/BaseAction.java
...main/java/com/x/program/center/jaxrs/test/BaseAction.java
+0
-7
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/TestAction.java
...main/java/com/x/program/center/jaxrs/test/TestAction.java
+0
-47
o2server/x_program_center_core_entity/src/main/java/com/x/program/center/core/entity/Invoke.java
...rc/main/java/com/x/program/center/core/entity/Invoke.java
+34
-6
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/gson/GsonPropertyObject.java
浏览文件 @
4e168c48
...
...
@@ -3,6 +3,7 @@ package com.x.base.core.project.gson;
import
com.x.base.core.project.bean.PropertyObject
;
public
abstract
class
GsonPropertyObject
extends
PropertyObject
{
public
String
toString
()
{
try
{
return
XGsonBuilder
.
toJson
(
this
);
...
...
@@ -12,5 +13,4 @@ public abstract class GsonPropertyObject extends PropertyObject {
return
null
;
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/Message.java
浏览文件 @
4e168c48
...
...
@@ -4,4 +4,6 @@ import com.x.base.core.project.gson.GsonPropertyObject;
public
abstract
class
Message
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
5130507110305826798L
;
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/PmsMessage.java
浏览文件 @
4e168c48
package
com.x.base.core.project.message
;
import
com.x.base.core.project.annotation.FieldDescribe
;
public
class
PmsMessage
extends
Message
{
private
static
final
long
serialVersionUID
=
2038077554351155648L
;
@FieldDescribe
(
"账号"
)
private
String
account
;
@FieldDescribe
(
"组织"
)
private
String
unit
;
@FieldDescribe
(
"密码"
)
private
String
password
;
@FieldDescribe
(
"ticker"
)
private
String
ticker
;
@FieldDescribe
(
"文本"
)
private
String
text
;
@FieldDescribe
(
"标题"
)
private
String
title
;
public
String
getAccount
()
{
...
...
@@ -57,4 +72,4 @@ public class PmsMessage extends Message {
this
.
title
=
title
;
}
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java
浏览文件 @
4e168c48
...
...
@@ -53,8 +53,6 @@ public class ThisApplication {
public
static
final
List
<
Object
>
qiyeweixinSyncOrganizationCallbackRequest
=
new
ArrayList
<>();
public
static
Map
<
String
,
Map
<
String
,
LinkedTreeMap
>>
metricsReportMap
=
new
ConcurrentHashMap
<>();
public
static
void
init
()
{
try
{
CacheManager
.
init
(
context
.
clazz
().
getSimpleName
());
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/ActionApplication.java
浏览文件 @
4e168c48
...
...
@@ -31,7 +31,6 @@ import com.x.program.center.jaxrs.pms.PmsAction;
import
com.x.program.center.jaxrs.prompterrorlog.PromptErrorLogAction
;
import
com.x.program.center.jaxrs.qiyeweixin.QiyeweixinAction
;
import
com.x.program.center.jaxrs.schedule.ScheduleAction
;
import
com.x.program.center.jaxrs.test.TestAction
;
import
com.x.program.center.jaxrs.unexpectederrorlog.UnexpectedErrorLogAction
;
import
com.x.program.center.jaxrs.validation.ValidationAction
;
import
com.x.program.center.jaxrs.warnlog.WarnLogAction
;
...
...
@@ -69,7 +68,6 @@ public class ActionApplication extends AbstractActionApplication {
classes
.
add
(
AuthenticationAction
.
class
);
classes
.
add
(
ValidationAction
.
class
);
classes
.
add
(
DataStructureAction
.
class
);
classes
.
add
(
TestAction
.
class
);
classes
.
add
(
OutputAction
.
class
);
classes
.
add
(
InputAction
.
class
);
classes
.
add
(
MarketAction
.
class
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/adminlogin/WrapInAdminLogin.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.adminlogin
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
WrapInAdminLogin
extends
GsonPropertyObject
{
private
String
credential
;
private
String
password
;
private
String
code
;
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getCredential
()
{
return
credential
;
}
public
void
setCredential
(
String
credential
)
{
this
.
credential
=
credential
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/adminlogin/WrapOutAdminLogin.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.adminlogin
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.TokenType
;
public
class
WrapOutAdminLogin
extends
GsonPropertyObject
{
public
static
List
<
String
>
Excludes
=
new
ArrayList
<>(
JpaObject
.
FieldsInvisible
);
private
TokenType
tokenType
;
private
String
token
;
private
String
name
;
static
{
Excludes
.
add
(
"password"
);
}
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
TokenType
getTokenType
()
{
return
tokenType
;
}
public
void
setTokenType
(
TokenType
tokenType
)
{
this
.
tokenType
=
tokenType
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/ActionUpdate.java
浏览文件 @
4e168c48
...
...
@@ -18,8 +18,8 @@ class ActionUpdate extends BaseAction {
FormDataContentDisposition
disposition
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
/
* 判断当前用户是否有权限访问 */
if
(!
business
.
serviceControlAble
(
effectivePerson
))
{
/
/ 判断当前用户是否有权限访问
if
(!
business
.
serviceControlAble
(
effectivePerson
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getDistinguishedName
());
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -31,7 +31,6 @@ class ActionUpdate extends BaseAction {
String
text
=
new
String
(
bytes
,
DefaultCharset
.
name
);
emc
.
beginTransaction
(
Agent
.
class
);
agent
.
setText
(
text
);
// this.addComment(agent);
emc
.
commit
();
wo
.
setId
(
agent
.
getId
());
result
.
setData
(
wo
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/AgentAction.java
浏览文件 @
4e168c48
...
...
@@ -53,7 +53,7 @@ public class AgentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取对象."
,
action
=
ActionGet
.
class
)
@JaxrsMethodDescribe
(
value
=
"获取
代理
对象."
,
action
=
ActionGet
.
class
)
@GET
@Path
(
"{flag}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
@@ -71,7 +71,7 @@ public class AgentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"启用
对象
."
,
action
=
ActionEnable
.
class
)
@JaxrsMethodDescribe
(
value
=
"启用
代理
."
,
action
=
ActionEnable
.
class
)
@GET
@Path
(
"{flag}/enable"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
@@ -89,7 +89,7 @@ public class AgentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"禁用
对象
."
,
action
=
ActionDisable
.
class
)
@JaxrsMethodDescribe
(
value
=
"禁用
代理
."
,
action
=
ActionDisable
.
class
)
@GET
@Path
(
"{flag}/disable"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/agent/BaseAction.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.agent
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.program.center.core.entity.Agent
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
// private static String COMMENT = "";
//
// private static final Pattern COMMENT_REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
//
// static {
// COMMENT = "/*" + StringUtils.LF;
// COMMENT += "* resources.getEntityManagerContainer() // 实体管理容器." + StringUtils.LF;
// COMMENT += "* resources.getContext() //上下文根." + StringUtils.LF;
// COMMENT += "* resources.getOrganization() //组织访问接口." + StringUtils.LF;
// COMMENT += "* requestText //请求内容." + StringUtils.LF;
// COMMENT += "* request //请求对象." + StringUtils.LF;
// COMMENT += "*/" + StringUtils.LF;
// }
//
// protected void addComment(Agent agent) {
// if (StringUtils.isEmpty(agent.getText())) {
// agent.setText(COMMENT);
// } else {
// Matcher m = COMMENT_REGEX.matcher(agent.getText());
// if (m.find()) {
// agent.setText(COMMENT + m.replaceFirst(""));
// } else {
// agent.setText(COMMENT + agent.getText());
// }
// }
// }
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionCurrentStyle.java
浏览文件 @
4e168c48
...
...
@@ -33,7 +33,7 @@ import com.x.program.center.Business;
class
ActionCurrentStyle
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effective
p
erson
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effective
P
erson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
...
...
@@ -43,11 +43,11 @@ class ActionCurrentStyle extends BaseAction {
Portal
portal
=
business
.
entityManagerContainer
().
flag
(
appStyle
.
getIndexPortal
(),
Portal
.
class
);
if
(
null
!=
portal
&&
StringUtils
.
isNotEmpty
(
portal
.
getFirstPage
()))
{
Page
page
=
business
.
entityManagerContainer
().
find
(
portal
.
getFirstPage
(),
Page
.
class
);
/
* 设置了indexPortal就不判断hasMobile */
/
/ 设置了indexPortal就不判断hasMobile
if
(
null
!=
page
)
{
wo
.
setIndexType
(
AppStyle
.
INDEXTYPE_PORTAL
);
wo
.
setIndexPortal
(
portal
.
getId
());
/
** 兼容值后期废弃 */
/
/ 兼容值后期废弃
wo
.
setIndexId
(
portal
.
getId
());
}
}
...
...
@@ -60,7 +60,10 @@ class ActionCurrentStyle extends BaseAction {
}
public
static
class
Wo
extends
AppStyle
{
/** 兼容值后期废弃 */
private
static
final
long
serialVersionUID
=
1100871693389441652L
;
// 兼容值后期废弃
private
String
indexId
;
static
WrapCopier
<
AppStyle
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
AppStyle
.
class
,
Wo
.
class
,
null
,
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionCurrentUpdate.java
浏览文件 @
4e168c48
...
...
@@ -17,7 +17,7 @@ import com.x.program.center.Business;
class
ActionCurrentUpdate
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effective
p
erson
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effective
P
erson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLaunchLogo.java
浏览文件 @
4e168c48
...
...
@@ -41,13 +41,13 @@ class ActionImageLaunchLogo extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
launch_logo
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_launch_logo
));
}).
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLaunchLogoErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,12 @@ class ActionImageLaunchLogoErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_launch_logo
));
}).
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLoginAvatar.java
浏览文件 @
4e168c48
...
...
@@ -41,13 +41,12 @@ class ActionImageLoginAvatar extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
login_avatar
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_login_avatar
));
}).
collect
(
Collectors
.
toSet
());
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_login_avatar
)))
.
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageLoginAvatarErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,11 @@ class ActionImageLoginAvatarErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_login_avatar
));
}).
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_login_avatar
)))
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoBlur.java
浏览文件 @
4e168c48
...
...
@@ -41,13 +41,13 @@ class ActionImageMenuLogoBlur extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
index_bottom_menu_logo_blur
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
()
.
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_blur
));
})
.
collect
(
Collectors
.
toSet
());
images
=
images
.
stream
()
.
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_blur
)))
.
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoBlurErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,12 @@ class ActionImageMenuLogoBlurErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
()
.
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_blur
));
})
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
images
=
images
.
stream
()
.
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_blur
)))
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoFocus.java
浏览文件 @
4e168c48
...
...
@@ -41,13 +41,13 @@ class ActionImageMenuLogoFocus extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
index_bottom_menu_logo_focus
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
()
.
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_focus
));
})
.
collect
(
Collectors
.
toSet
());
images
=
images
.
stream
()
.
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_focus
)))
.
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageMenuLogoFocusErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,12 @@ class ActionImageMenuLogoFocusErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
()
.
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_focus
));
})
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
images
=
images
.
stream
()
.
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_index_bottom_menu_logo_focus
)))
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
@@ -36,5 +36,7 @@ class ActionImageMenuLogoFocusErase extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
870322288184688112L
;
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageProcessDefault.java
浏览文件 @
4e168c48
...
...
@@ -39,13 +39,12 @@ class ActionImageProcessDefault extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
process_default
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_process_default
));
}).
collect
(
Collectors
.
toSet
());
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_process_default
)))
.
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageProcessDefaultErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,11 @@ class ActionImageProcessDefaultErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_process_default
));
}).
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_process_default
)))
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageSetupAboutLogo.java
浏览文件 @
4e168c48
...
...
@@ -39,13 +39,12 @@ class ActionImageSetupAboutLogo extends BaseAction {
String
value
=
Base64
.
encodeBase64String
(
baos
.
toByteArray
());
Image
o
=
Image
.
setup_about_logo
();
o
.
setValue
(
value
);
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_setup_about_logo
));
}).
collect
(
Collectors
.
toSet
());
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_setup_about_logo
)))
.
collect
(
Collectors
.
toSet
());
images
.
add
(
o
);
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
Config
.
appStyle
().
setImages
(
new
TreeSet
<>(
images
));
Config
.
appStyle
().
save
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/ActionImageSetupAboutLogoErase.java
浏览文件 @
4e168c48
...
...
@@ -20,12 +20,11 @@ class ActionImageSetupAboutLogoErase extends BaseAction {
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getName
());
}
/
* 由于getImages设置了检查,所以只能对images进行处理 */
/
/ 由于getImages设置了检查,所以只能对images进行处理
Set
<
Image
>
images
=
Config
.
appStyle
().
getImages
();
images
=
images
.
stream
().
filter
(
img
->
{
return
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_setup_about_logo
));
}).
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
Image
>(
images
));
images
=
images
.
stream
().
filter
(
img
->
(!
StringUtils
.
equals
(
img
.
getName
(),
Image
.
name_setup_about_logo
)))
.
collect
(
Collectors
.
toSet
());
Config
.
appStyle
().
setImages
(
new
TreeSet
<
>(
images
));
Config
.
appStyle
().
save
();
Config
.
flush
();
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/AppStyleAction.java
浏览文件 @
4e168c48
...
...
@@ -158,25 +158,6 @@ public class AppStyleAction extends BaseAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
// @JaxrsMethodDescribe(value = "设置图片:所有应用中出现的人员头像默认图片,120x120.", action = ActionImagePeopleAvatarDefault.class)
// @PUT
// @Path("image/people/avatar/default")
// @Consumes(MediaType.MULTIPART_FORM_DATA)
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// public void imagePeopleAvatarDefault(@Suspended final AsyncResponse asyncResponse,
// @Context HttpServletRequest request, @FormDataParam(FILE_FIELD) final byte[] bytes,
// @JaxrsParameterDescribe("图片文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
// ActionResult<ActionImagePeopleAvatarDefault.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionImagePeopleAvatarDefault().execute(effectivePerson, bytes, disposition);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
@JaxrsMethodDescribe
(
value
=
"设置图片:流程、应用的默认图片,90x90."
,
action
=
ActionImageProcessDefault
.
class
)
@PUT
@Path
(
"image/process/default"
)
...
...
@@ -287,24 +268,6 @@ public class AppStyleAction extends BaseAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
// @JaxrsMethodDescribe(value = "设置图片:所有应用中出现的人员头像默认图片.", action = ActionImagePeopleAvatarDefaultErase.class)
// @GET
// @Path("image/people/avatar/default/erase")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// public void imagePeopleAvatarDefaultErase(@Suspended final AsyncResponse asyncResponse,
// @Context HttpServletRequest request) {
// ActionResult<ActionImagePeopleAvatarDefaultErase.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionImagePeopleAvatarDefaultErase().execute(effectivePerson);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
@JaxrsMethodDescribe
(
value
=
"设置图片:流程、应用的默认图片."
,
action
=
ActionImageProcessDefaultErase
.
class
)
@GET
@Path
(
"image/process/default/erase"
)
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/appstyle/BaseAction.java
浏览文件 @
4e168c48
...
...
@@ -34,7 +34,7 @@ abstract class BaseAction extends StandardJaxrsAction {
.
collect
(
Collectors
.
toList
());
return
os
;
}
else
{
return
new
ArrayList
<
Portal
>();
return
new
ArrayList
<>();
}
}
...
...
@@ -44,9 +44,7 @@ abstract class BaseAction extends StandardJaxrsAction {
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Page
>
root
=
cq
.
from
(
Page
.
class
);
Predicate
p
=
cb
.
conjunction
();
// Predicate p = cb.equal(root.get(Page_.hasMobile), true);
List
<
String
>
os
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Page_
.
id
)).
where
(
p
)).
getResultList
();
return
os
;
return
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Page_
.
id
)).
where
(
p
)).
getResultList
();
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/cachedispatch/ActionDispatch.java
浏览文件 @
4e168c48
...
...
@@ -30,30 +30,7 @@ class ActionDispatch extends BaseAction {
Map
<
String
,
List
<
String
>>
map
=
(
Map
<
String
,
List
<
String
>>)
Config
.
resource
(
Config
.
RESOURCE_CONTAINERENTITIES
);
for
(
Entry
<
String
,
List
<
String
>>
entry
:
map
.
entrySet
())
{
if
(
entry
.
getValue
().
contains
(
wi
.
getClassName
()))
{
List
<
Application
>
apps
=
ThisApplication
.
context
().
applications
().
get
(
entry
.
getKey
());
if
(
ListTools
.
isNotEmpty
(
apps
))
{
apps
.
stream
().
forEach
(
o
->
{
String
url
=
o
.
getUrlJaxrsRoot
()
+
"cache"
;
logger
.
debug
(
"dispatch cache request to : {}"
,
url
);
try
{
CipherConnectionAction
.
put
(
effectivePerson
.
getDebugger
(),
url
,
wi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
else
{
logger
.
debug
(
"{}通知center更新自身缓存=={}"
,
wi
.
getClassName
(),
entry
.
getKey
());
List
<
Entry
<
String
,
CenterServer
>>
centerList
=
Config
.
nodes
().
centerServers
().
orderedEntry
();
for
(
Entry
<
String
,
CenterServer
>
centerEntry
:
centerList
)
{
try
{
CipherConnectionAction
.
put
(
effectivePerson
.
getDebugger
(),
Config
.
url_x_program_center_jaxrs
(
centerEntry
,
"cache"
),
wi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
dispatch
(
effectivePerson
,
wi
,
entry
,
ThisApplication
.
context
().
applications
().
get
(
entry
.
getKey
()));
}
}
Wo
wo
=
new
Wo
();
...
...
@@ -62,11 +39,42 @@ class ActionDispatch extends BaseAction {
return
result
;
}
private
void
dispatch
(
EffectivePerson
effectivePerson
,
Wi
wi
,
Entry
<
String
,
List
<
String
>>
entry
,
List
<
Application
>
apps
)
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
apps
))
{
apps
.
stream
().
forEach
(
o
->
{
String
url
=
o
.
getUrlJaxrsRoot
()
+
"cache"
;
logger
.
debug
(
"dispatch cache request to : {}"
,
url
);
try
{
CipherConnectionAction
.
put
(
effectivePerson
.
getDebugger
(),
url
,
wi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
else
{
logger
.
debug
(
"{}通知center更新自身缓存:{}"
,
wi
.
getClassName
(),
entry
.
getKey
());
List
<
Entry
<
String
,
CenterServer
>>
centerList
=
Config
.
nodes
().
centerServers
().
orderedEntry
();
for
(
Entry
<
String
,
CenterServer
>
centerEntry
:
centerList
)
{
try
{
CipherConnectionAction
.
put
(
effectivePerson
.
getDebugger
(),
Config
.
url_x_program_center_jaxrs
(
centerEntry
,
"cache"
),
wi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
public
static
class
Wi
extends
WrapClearCacheRequest
{
private
static
final
long
serialVersionUID
=
2433450688317735973L
;
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
7259210154112758607L
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionCreate.java
浏览文件 @
4e168c48
...
...
@@ -9,6 +9,7 @@ import org.apache.commons.codec.binary.Base64;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
...
...
@@ -20,15 +21,6 @@ class ActionCreate extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCreate
.
class
);
// // 验证码颜色
// private Color _CodeColor = Color.BLACK;
// // 使用字体名字
// private String _FontName = "System";
// // 使用字体类型
// private int _FontType = Font.BOLD;
// // 使用字体大小
// private int _FontSize = 40;
ActionResult
<
Wo
>
execute
(
Integer
width
,
Integer
height
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -38,13 +30,6 @@ class ActionCreate extends BaseAction {
if
(
width
<=
30
&&
width
>
800
)
{
width
=
30
;
}
// List<Font> fontList = new ArrayList<Font>();
// List<Color> colorList = new ArrayList<Color>();
// colorList.add(_CodeColor);
// fontList.add(new Font(_FontName, _FontType, _FontSize));
//
// WordRenderer dwr = new ColoredEdgesWordRenderer(colorList, fontList);
nl
.
captcha
.
Captcha
o
=
new
nl
.
captcha
.
Captcha
.
Builder
(
width
,
height
).
addText
(
new
NumbersAnswerProducer
(
4
))
.
addNoise
().
addNoise
().
build
();
emc
.
beginTransaction
(
Captcha
.
class
);
...
...
@@ -65,8 +50,10 @@ class ActionCreate extends BaseAction {
public
static
class
Wo
{
@FieldDescribe
(
"标识"
)
private
String
id
;
@FieldDescribe
(
"图像"
)
private
String
image
;
public
String
getImage
()
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionList.java
浏览文件 @
4e168c48
...
...
@@ -34,8 +34,7 @@ class ActionList extends BaseAction {
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Captcha
>
cq
=
cb
.
createQuery
(
Captcha
.
class
);
Root
<
Captcha
>
root
=
cq
.
from
(
Captcha
.
class
);
List
<
Captcha
>
list
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
return
list
;
return
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
}
public
static
class
Wo
extends
Captcha
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/ActionValidate.java
浏览文件 @
4e168c48
...
...
@@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -13,7 +14,7 @@ class ActionValidate extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
answer
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
if
(
effectivePerson
.
isNotManager
())
{
throw
new
Exception
(
"insufficient permissions."
);
throw
new
Exception
AccessDenied
(
effectivePerson
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
...
...
@@ -21,7 +22,7 @@ class ActionValidate extends BaseAction {
if
(
null
==
captcha
)
{
wo
.
setValue
(
false
);
}
else
{
B
oolean
match
=
this
.
check
(
captcha
.
getAnswer
(),
answer
);
b
oolean
match
=
this
.
check
(
captcha
.
getAnswer
(),
answer
);
if
(
match
)
{
emc
.
beginTransaction
(
Captcha
.
class
);
emc
.
remove
(
captcha
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/captcha/CaptchaAction.java
浏览文件 @
4e168c48
...
...
@@ -54,11 +54,12 @@ public class CaptchaAction extends StandardJaxrsAction {
public
void
create
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@PathParam
(
"width"
)
Integer
width
,
@PathParam
(
"height"
)
Integer
height
)
{
ActionResult
<
ActionCreate
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionCreate
().
execute
(
width
,
height
);
}
catch
(
Throwable
th
)
{
th
.
printStackTrace
(
);
result
.
error
(
th
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
...
...
@@ -71,12 +72,12 @@ public class CaptchaAction extends StandardJaxrsAction {
public
void
validate
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@PathParam
(
"id"
)
String
id
,
@PathParam
(
"answer"
)
String
answer
)
{
ActionResult
<
ActionValidate
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
result
=
new
ActionValidate
().
execute
(
effectivePerson
,
id
,
answer
);
}
catch
(
Throwable
th
)
{
th
.
printStackTrace
(
);
result
.
error
(
th
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/center/ActionListMetricsDataTable.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.center
;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.program.center.ThisApplication
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
class
ActionListMetricsDataTable
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
new
ArrayList
<>();
Wo
wo
=
null
;
//遍历map里所有的数据,组织成list返回
LinkedTreeMap
metricsTimerReport
=
null
;
Map
<
String
,
LinkedTreeMap
>
serverReportMap
=
null
;
Map
<
String
,
Map
<
String
,
LinkedTreeMap
>>
metricsReportMap
=
ThisApplication
.
metricsReportMap
;
if
(
metricsReportMap
!=
null
&&
!
metricsReportMap
.
isEmpty
()
){
Iterator
<
Map
.
Entry
<
String
,
Map
<
String
,
LinkedTreeMap
>>>
serverMap_entries
=
metricsReportMap
.
entrySet
().
iterator
();
while
(
serverMap_entries
.
hasNext
())
{
Map
.
Entry
<
String
,
Map
<
String
,
LinkedTreeMap
>>
serverMap_entry
=
serverMap_entries
.
next
();
serverReportMap
=
serverMap_entry
.
getValue
();
if
(
serverReportMap
!=
null
&&
!
serverReportMap
.
isEmpty
()
){
Iterator
<
Map
.
Entry
<
String
,
LinkedTreeMap
>>
entries
=
serverReportMap
.
entrySet
().
iterator
();
while
(
entries
.
hasNext
())
{
wo
=
new
Wo
();
wo
.
setServerName
(
serverMap_entry
.
getKey
()
);
Map
.
Entry
<
String
,
LinkedTreeMap
>
entry
=
entries
.
next
();
metricsTimerReport
=
entry
.
getValue
();
if
(
metricsTimerReport
!=
null
){
wo
.
setTargetClassName
(
(
String
)
metricsTimerReport
.
get
(
"targetClassName"
)
);
wo
.
setTargetContextName
(
(
String
)
metricsTimerReport
.
get
(
"targetContextName"
)
);
wo
.
setTargetContextCNName
(
(
String
)
metricsTimerReport
.
get
(
"targetContextCNName"
)
);
wo
.
setDateTime
(
(
String
)
metricsTimerReport
.
get
(
"dateTime"
)
);
wo
.
setCount
(
(
Double
)
metricsTimerReport
.
get
(
"count"
)
);
wo
.
setMean_call
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"mean_rate"
)).
get
(
"rate"
)
);
wo
.
setMean_call_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"mean_rate"
)).
get
(
"unit"
)
);
wo
.
setM1_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"m1_rate"
)).
get
(
"rate"
)
);
wo
.
setM1_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"m1_rate"
)).
get
(
"unit"
)
);
wo
.
setM5_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"m5_rate"
)).
get
(
"rate"
)
);
wo
.
setM5_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"m5_rate"
)).
get
(
"unit"
)
);
wo
.
setM15_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"m15_rate"
)).
get
(
"rate"
)
);
wo
.
setM15_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"m15_rate"
)).
get
(
"unit"
)
);
wo
.
setStddev_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"stddev"
)).
get
(
"rate"
)
);
wo
.
setStddev_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"stddev"
)).
get
(
"unit"
)
);
wo
.
setMean_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"mean"
)).
get
(
"rate"
)
);
wo
.
setMean_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"mean"
)).
get
(
"unit"
)
);
wo
.
setMin_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"min"
)).
get
(
"rate"
)
);
wo
.
setMin_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"min"
)).
get
(
"unit"
)
);
wo
.
setMax_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"max"
)).
get
(
"rate"
)
);
wo
.
setMax_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"max"
)).
get
(
"unit"
)
);
wo
.
setP50_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p50"
)).
get
(
"rate"
)
);
wo
.
setP50_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p50"
)).
get
(
"unit"
)
);
wo
.
setP75_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p75"
)).
get
(
"rate"
)
);
wo
.
setP75_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p75"
)).
get
(
"unit"
)
);
wo
.
setP95_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p95"
)).
get
(
"rate"
)
);
wo
.
setP95_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p95"
)).
get
(
"unit"
)
);
wo
.
setP98_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p98"
)).
get
(
"rate"
)
);
wo
.
setP98_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p98"
)).
get
(
"unit"
)
);
wo
.
setP99_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p99"
)).
get
(
"rate"
)
);
wo
.
setP99_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p99"
)).
get
(
"unit"
)
);
wo
.
setP999_rate
(
(
Double
)((
Map
)
metricsTimerReport
.
get
(
"p999"
)).
get
(
"rate"
)
);
wo
.
setP999_rate_unit
(
(
String
)((
Map
)
metricsTimerReport
.
get
(
"p999"
)).
get
(
"unit"
)
);
wos
.
add
(
wo
);
}
}
}
}
}
result
.
setData
(
wos
);
return
result
;
}
public
static
class
Wo
{
private
String
serverName
;
private
String
targetContextName
;
private
String
targetContextCNName
;
private
String
targetClassName
;
private
String
dateTime
;
private
double
count
;
private
double
mean_call
;
private
String
mean_call_unit
;
private
double
m1_rate
;
private
String
m1_rate_unit
;
private
double
m5_rate
;
private
String
m5_rate_unit
;
private
double
m15_rate
;
private
String
m15_rate_unit
;
private
double
min_rate
;
private
String
min_rate_unit
;
private
double
max_rate
;
private
String
max_rate_unit
;
private
double
mean_rate
;
private
String
mean_rate_unit
;
private
double
stddev_rate
;
private
String
stddev_rate_unit
;
private
double
p50_rate
;
private
String
p50_rate_unit
;
private
double
p75_rate
;
private
String
p75_rate_unit
;
private
double
p95_rate
;
private
String
p95_rate_unit
;
private
double
p98_rate
;
private
String
p98_rate_unit
;
private
double
p99_rate
;
private
String
p99_rate_unit
;
private
double
p999_rate
;
private
String
p999_rate_unit
;
public
String
getServerName
()
{
return
this
.
serverName
;
}
public
void
setServerName
(
final
String
serverName
)
{
this
.
serverName
=
serverName
;
}
public
String
getTargetContextName
()
{
return
this
.
targetContextName
;
}
public
void
setTargetContextName
(
final
String
targetContextName
)
{
this
.
targetContextName
=
targetContextName
;
}
public
String
getTargetContextCNName
()
{
return
this
.
targetContextCNName
;
}
public
void
setTargetContextCNName
(
final
String
targetContextCNName
)
{
this
.
targetContextCNName
=
targetContextCNName
;
}
public
String
getTargetClassName
()
{
return
this
.
targetClassName
;
}
public
void
setTargetClassName
(
final
String
targetClassName
)
{
this
.
targetClassName
=
targetClassName
;
}
public
String
getDateTime
()
{
return
this
.
dateTime
;
}
public
void
setDateTime
(
final
String
dateTime
)
{
this
.
dateTime
=
dateTime
;
}
public
double
getCount
()
{
return
this
.
count
;
}
public
void
setCount
(
final
double
count
)
{
this
.
count
=
count
;
}
public
double
getMean_call
()
{
return
this
.
mean_call
;
}
public
void
setMean_call
(
final
double
mean_call
)
{
this
.
mean_call
=
mean_call
;
}
public
String
getMean_call_unit
()
{
return
this
.
mean_call_unit
;
}
public
void
setMean_call_unit
(
final
String
mean_call_unit
)
{
this
.
mean_call_unit
=
mean_call_unit
;
}
public
double
getM1_rate
()
{
return
this
.
m1_rate
;
}
public
void
setM1_rate
(
final
double
m1_rate
)
{
this
.
m1_rate
=
m1_rate
;
}
public
String
getM1_rate_unit
()
{
return
this
.
m1_rate_unit
;
}
public
void
setM1_rate_unit
(
final
String
m1_rate_unit
)
{
this
.
m1_rate_unit
=
m1_rate_unit
;
}
public
double
getM5_rate
()
{
return
this
.
m5_rate
;
}
public
void
setM5_rate
(
final
double
m5_rate
)
{
this
.
m5_rate
=
m5_rate
;
}
public
String
getM5_rate_unit
()
{
return
this
.
m5_rate_unit
;
}
public
void
setM5_rate_unit
(
final
String
m5_rate_unit
)
{
this
.
m5_rate_unit
=
m5_rate_unit
;
}
public
double
getM15_rate
()
{
return
this
.
m15_rate
;
}
public
void
setM15_rate
(
final
double
m15_rate
)
{
this
.
m15_rate
=
m15_rate
;
}
public
String
getM15_rate_unit
()
{
return
this
.
m15_rate_unit
;
}
public
void
setM15_rate_unit
(
final
String
m15_rate_unit
)
{
this
.
m15_rate_unit
=
m15_rate_unit
;
}
public
double
getMin_rate
()
{
return
this
.
min_rate
;
}
public
void
setMin_rate
(
final
double
min_rate
)
{
this
.
min_rate
=
min_rate
;
}
public
String
getMin_rate_unit
()
{
return
this
.
min_rate_unit
;
}
public
void
setMin_rate_unit
(
final
String
min_rate_unit
)
{
this
.
min_rate_unit
=
min_rate_unit
;
}
public
double
getMax_rate
()
{
return
this
.
max_rate
;
}
public
void
setMax_rate
(
final
double
max_rate
)
{
this
.
max_rate
=
max_rate
;
}
public
String
getMax_rate_unit
()
{
return
this
.
max_rate_unit
;
}
public
void
setMax_rate_unit
(
final
String
max_rate_unit
)
{
this
.
max_rate_unit
=
max_rate_unit
;
}
public
double
getMean_rate
()
{
return
this
.
mean_rate
;
}
public
void
setMean_rate
(
final
double
mean_rate
)
{
this
.
mean_rate
=
mean_rate
;
}
public
String
getMean_rate_unit
()
{
return
this
.
mean_rate_unit
;
}
public
void
setMean_rate_unit
(
final
String
mean_rate_unit
)
{
this
.
mean_rate_unit
=
mean_rate_unit
;
}
public
double
getStddev_rate
()
{
return
this
.
stddev_rate
;
}
public
void
setStddev_rate
(
final
double
stddev_rate
)
{
this
.
stddev_rate
=
stddev_rate
;
}
public
String
getStddev_rate_unit
()
{
return
this
.
stddev_rate_unit
;
}
public
void
setStddev_rate_unit
(
final
String
stddev_rate_unit
)
{
this
.
stddev_rate_unit
=
stddev_rate_unit
;
}
public
double
getP50_rate
()
{
return
this
.
p50_rate
;
}
public
void
setP50_rate
(
final
double
p50_rate
)
{
this
.
p50_rate
=
p50_rate
;
}
public
String
getP50_rate_unit
()
{
return
this
.
p50_rate_unit
;
}
public
void
setP50_rate_unit
(
final
String
p50_rate_unit
)
{
this
.
p50_rate_unit
=
p50_rate_unit
;
}
public
double
getP75_rate
()
{
return
this
.
p75_rate
;
}
public
void
setP75_rate
(
final
double
p75_rate
)
{
this
.
p75_rate
=
p75_rate
;
}
public
String
getP75_rate_unit
()
{
return
this
.
p75_rate_unit
;
}
public
void
setP75_rate_unit
(
final
String
p75_rate_unit
)
{
this
.
p75_rate_unit
=
p75_rate_unit
;
}
public
double
getP95_rate
()
{
return
this
.
p95_rate
;
}
public
void
setP95_rate
(
final
double
p95_rate
)
{
this
.
p95_rate
=
p95_rate
;
}
public
String
getP95_rate_unit
()
{
return
this
.
p95_rate_unit
;
}
public
void
setP95_rate_unit
(
final
String
p95_rate_unit
)
{
this
.
p95_rate_unit
=
p95_rate_unit
;
}
public
double
getP98_rate
()
{
return
this
.
p98_rate
;
}
public
void
setP98_rate
(
final
double
p98_rate
)
{
this
.
p98_rate
=
p98_rate
;
}
public
String
getP98_rate_unit
()
{
return
this
.
p98_rate_unit
;
}
public
void
setP98_rate_unit
(
final
String
p98_rate_unit
)
{
this
.
p98_rate_unit
=
p98_rate_unit
;
}
public
double
getP99_rate
()
{
return
this
.
p99_rate
;
}
public
void
setP99_rate
(
final
double
p99_rate
)
{
this
.
p99_rate
=
p99_rate
;
}
public
String
getP99_rate_unit
()
{
return
this
.
p99_rate_unit
;
}
public
void
setP99_rate_unit
(
final
String
p99_rate_unit
)
{
this
.
p99_rate_unit
=
p99_rate_unit
;
}
public
double
getP999_rate
()
{
return
this
.
p999_rate
;
}
public
void
setP999_rate
(
final
double
p999_rate
)
{
this
.
p999_rate
=
p999_rate
;
}
public
String
getP999_rate_unit
()
{
return
this
.
p999_rate_unit
;
}
public
void
setP999_rate_unit
(
final
String
p999_rate_unit
)
{
this
.
p999_rate_unit
=
p999_rate_unit
;
}
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionList.java
浏览文件 @
4e168c48
...
...
@@ -34,8 +34,7 @@ class ActionList extends BaseAction {
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Code
>
cq
=
cb
.
createQuery
(
Code
.
class
);
Root
<
Code
>
root
=
cq
.
from
(
Code
.
class
);
List
<
Code
>
list
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
return
list
;
return
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
}
public
static
class
Wo
extends
Code
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionCode.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
...
...
@@ -11,7 +13,7 @@ class ActionCode extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(!
Config
.
person
().
isMobile
(
mobile
))
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionConnect.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -9,7 +11,7 @@ class ActionConnect extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
wo
.
setValue
(
false
);
}
result
.
setData
(
wo
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionControllerMobile.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -7,7 +9,7 @@ class ActionControllerMobile extends BaseAction {
ActionResult
<
Wo
>
execute
(
String
name
,
String
mobile
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionDelete.java
浏览文件 @
4e168c48
...
...
@@ -9,12 +9,13 @@ import org.apache.commons.lang3.StringUtils;
class
ActionDelete
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
name
,
String
mobile
,
String
codeAnswer
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
name
,
String
mobile
,
String
codeAnswer
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
!
this
.
exist
(
name
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
exist
(
name
)
))
{
throw
new
ExceptionNameNotExist
(
name
);
}
if
(!
Config
.
person
().
isMobile
(
mobile
))
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionExist.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -7,7 +9,7 @@ class ActionExist extends BaseAction {
ActionResult
<
Wo
>
execute
(
String
name
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
Wo
wo
=
new
Wo
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionLogin.java
浏览文件 @
4e168c48
...
...
@@ -27,7 +27,7 @@ class ActionLogin extends BaseAction {
if
(
BooleanUtils
.
isFalse
(
Config
.
collect
().
getEnable
())){
throw
new
ExceptionDisable
();
}
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionRegist.java
浏览文件 @
4e168c48
...
...
@@ -28,10 +28,10 @@ class ActionRegist extends BaseAction {
String
password
=
wi
.
getPassword
();
String
mobile
=
wi
.
getMobile
();
String
codeAnswer
=
wi
.
getCodeAnswer
();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
this
.
exist
(
name
))
{
if
(
BooleanUtils
.
isTrue
(
this
.
exist
(
name
)
))
{
throw
new
ExceptionNameExist
(
name
);
}
if
(!
password
.
matches
(
Person
.
DEFAULT_PASSWORDREGEX
))
{
...
...
@@ -51,7 +51,7 @@ class ActionRegist extends BaseAction {
Config
.
collect
().
setPassword
(
password
);
Config
.
collect
().
save
();
this
.
configFlush
(
effectivePerson
);
/
* 人员和应用市场同步 */
/
/ 人员和应用市场同步
ThisApplication
.
context
().
scheduleLocal
(
CollectPerson
.
class
);
ThisApplication
.
context
().
scheduleLocal
(
CollectMarket
.
class
);
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionResetPassword.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.schedule.CollectMarket
;
import
com.x.program.center.schedule.CollectPerson
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -25,10 +22,10 @@ class ActionResetPassword extends BaseAction {
String
password
=
wi
.
getPassword
();
String
mobile
=
wi
.
getMobile
();
String
codeAnswer
=
wi
.
getCodeAnswer
();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
!
this
.
exist
(
name
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
exist
(
name
)
))
{
throw
new
ExceptionNameNotExist
(
name
);
}
if
(!
password
.
matches
(
Person
.
DEFAULT_PASSWORDREGEX
))
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionUpdate.java
浏览文件 @
4e168c48
...
...
@@ -12,17 +12,17 @@ class ActionUpdate extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
WrapInCollect
wrapIn
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
()
))
{
throw
new
ExceptionModifyConfig
();
}
if
(
BooleanUtils
.
isTrue
(
wrapIn
.
getEnable
()))
{
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
StringUtils
.
isEmpty
(
wrapIn
.
getName
()))
{
throw
new
ExceptionNameEmpty
();
}
if
(
!
this
.
validate
(
wrapIn
.
getName
(),
wrapIn
.
getPassword
(
)))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
validate
(
wrapIn
.
getName
(),
wrapIn
.
getPassword
()
)))
{
throw
new
ExceptionInvalidCredential
();
}
Config
.
collect
().
setEnable
(
true
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionUpdateUnit.java
浏览文件 @
4e168c48
...
...
@@ -18,17 +18,17 @@ class ActionUpdateUnit extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
()
))
{
throw
new
ExceptionModifyConfig
();
}
String
name
=
wi
.
getName
();
String
mobile
=
wi
.
getMobile
();
String
codeAnswer
=
wi
.
getCodeAnswer
();
String
newName
=
wi
.
getNewName
();
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
!
this
.
exist
(
name
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
exist
(
name
)
))
{
throw
new
ExceptionNameNotExist
(
name
);
}
if
(!
Config
.
person
().
isMobile
(
mobile
))
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidate.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.schedule.CollectMarket
;
import
com.x.program.center.schedule.CollectPerson
;
import
org.apache.commons.lang3.BooleanUtils
;
class
ActionValidate
extends
BaseAction
{
...
...
@@ -14,20 +12,15 @@ class ActionValidate extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
wo
.
setValue
(
false
);
}
if
(
BooleanUtils
.
isFalse
(
Config
.
collect
().
getEnable
()))
{
if
(
BooleanUtils
.
isFalse
(
Config
.
collect
().
getEnable
()))
{
wo
.
setValue
(
false
);
}
if
(
!
this
.
validate
(
Config
.
collect
().
getName
(),
Config
.
collect
().
getPassword
(
)))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
validate
(
Config
.
collect
().
getName
(),
Config
.
collect
().
getPassword
()
)))
{
wo
.
setValue
(
false
);
}
/*if (BooleanUtils.isTrue(wo.getValue())) {
*//* 人员和应用市场同步 *//*
ThisApplication.context().scheduleLocal(CollectPerson.class);
ThisApplication.context().scheduleLocal(CollectMarket.class);
}*/
result
.
setData
(
wo
);
return
result
;
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidateCodeAnswer.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.collect
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
...
...
@@ -23,10 +25,10 @@ class ActionValidateCodeAnswer extends BaseAction {
if
(
StringUtils
.
isEmpty
(
codeAnswer
))
{
throw
new
CodeAnswerEmptyException
();
}
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
if
(
!
this
.
validateCodeAnswer
(
mobile
,
codeAnswer
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
validateCodeAnswer
(
mobile
,
codeAnswer
)
))
{
wo
.
setValue
(
false
);
}
result
.
setData
(
wo
);
...
...
@@ -35,8 +37,12 @@ class ActionValidateCodeAnswer extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
2372766347222201401L
;
@FieldDescribe
(
"手机号码"
)
private
String
mobile
;
@FieldDescribe
(
"短信认证码"
)
private
String
codeAnswer
;
public
String
getMobile
()
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidateDirect.java
浏览文件 @
4e168c48
...
...
@@ -16,13 +16,13 @@ class ActionValidateDirect extends BaseAction {
ActionResult
<
Wo
>
execute
(
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
!
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
nodes
().
centerServers
().
first
().
getValue
().
getConfigApiEnable
()
))
{
throw
new
ExceptionModifyConfig
();
}
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
if
(
!
this
.
connect
(
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
connect
()
))
{
throw
new
ExceptionUnableConnect
();
}
String
name
=
wi
.
getName
();
...
...
@@ -33,7 +33,7 @@ class ActionValidateDirect extends BaseAction {
if
(
StringUtils
.
isEmpty
(
password
))
{
throw
new
ExceptionPasswordEmpty
();
}
if
(
!
this
.
validate
(
name
,
password
))
{
if
(
BooleanUtils
.
isNotTrue
(
this
.
validate
(
name
,
password
)
))
{
wo
.
setValue
(
false
);
}
if
(
BooleanUtils
.
isTrue
(
wo
.
getValue
()))
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/collect/ActionValidatePassword.java
浏览文件 @
4e168c48
...
...
@@ -20,16 +20,20 @@ class ActionValidatePassword extends BaseAction {
}
if
(!
password
.
matches
(
Person
.
DEFAULT_PASSWORDREGEX
))
{
wo
.
setValue
(
Person
.
DEFAULT_PASSWORDREGEXHINT
);
}
}
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wi
extends
Collect
{
private
static
final
long
serialVersionUID
=
2474013087563030882L
;
}
public
static
class
Wo
extends
WrapString
{
private
static
final
long
serialVersionUID
=
-
4278484613148265915L
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionCommand.java
浏览文件 @
4e168c48
...
...
@@ -30,41 +30,46 @@ public class ActionCommand extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCommand
.
class
);
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
String
ctl
=
wi
.
getCtl
();
String
nodeName
=
wi
.
getNodeName
()
;
String
nodeName
=
wi
.
getNodeName
();
Wo
wo
=
null
;
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
//生成key文件
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
//
生成key文件
wo
=
executeCommand
(
ctl
,
Config
.
node
(),
nodes
.
get
(
Config
.
node
()).
nodeAgentPort
());
//同步key文件
for
(
String
node
:
nodes
.
keySet
()){
//其他服务器
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
boolean
Syncflag
=
executeSyncFile
(
"config/public.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"config/private.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"servers/webServer/x_desktop/res/config/config.json"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
// 同步key文件
for
(
String
node
:
nodes
.
keySet
())
{
// 其他服务器
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
())
{
boolean
Syncflag
=
executeSyncFile
(
"config/public.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"config/private.key"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
Syncflag
=
executeSyncFile
(
"servers/webServer/x_desktop/res/config/config.json"
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
}
}
}
}
else
{
//先其他服务器再当前服务器
for
(
String
node
:
nodes
.
keySet
()){
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()))
{
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
node
);
}
else
{
// 先其他服务器再当前服务器
for
(
String
node
:
nodes
.
keySet
())
{
if
(!
node
.
equalsIgnoreCase
(
Config
.
node
()))
{
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
());
}
}
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
Config
.
node
());
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
Config
.
node
());
wo
=
executeCommand
(
ctl
,
Config
.
node
(),
nodes
.
get
(
Config
.
node
()).
nodeAgentPort
());
}
}
else
{
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
nodeName
);
}
else
{
logger
.
print
(
"{} executeCommand {} on node {}"
,
effectivePerson
.
getDistinguishedName
(),
ctl
,
nodeName
);
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
wi
.
getNodePort
()));
}
...
...
@@ -72,7 +77,7 @@ public class ActionCommand extends BaseAction {
return
result
;
}
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
Wo
wo
=
new
Wo
();
wo
.
setNode
(
nodeName
);
wo
.
setStatus
(
"success"
);
...
...
@@ -80,14 +85,14 @@ public class ActionCommand extends BaseAction {
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"command:"
+
ctl
);
commandObject
.
put
(
"command"
,
"command:"
+
ctl
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
String
createEncrypt
=
dis
.
readUTF
();
logger
.
info
(
createEncrypt
);
}
...
...
@@ -101,60 +106,58 @@ public class ActionCommand extends BaseAction {
return
wo
;
}
private
boolean
executeSyncFile
(
String
syncFilePath
,
String
nodeName
,
int
nodePort
)
{
boolean
syncFileFlag
=
false
;
File
syncFile
;
InputStream
fileInputStream
=
null
;
private
boolean
executeSyncFile
(
String
syncFilePath
,
String
nodeName
,
int
nodePort
){
boolean
syncFileFlag
=
false
;
File
syncFile
;
InputStream
fileInputStream
=
null
;
try
(
Socket
socket
=
new
Socket
(
nodeName
,
nodePort
))
{
try
(
Socket
socket
=
new
Socket
(
nodeName
,
nodePort
))
{
syncFile
=
new
File
(
Config
.
base
(),
syncFilePath
);
fileInputStream
=
new
FileInputStream
(
syncFile
);
syncFile
=
new
File
(
Config
.
base
(),
syncFilePath
);
fileInputStream
=
new
FileInputStream
(
syncFile
);
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
DataOutputStream
dos
=
null
;
DataInputStream
dis
=
null
;
try
{
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
DataOutputStream
dos
=
null
;
DataInputStream
dis
=
null
;
try
{
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"syncFile:"
+
syncFilePath
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"syncFile:"
+
syncFilePath
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
dos
.
writeUTF
(
syncFilePath
);
dos
.
flush
();
dos
.
writeUTF
(
syncFilePath
);
logger
.
info
(
"同步文件starting......."
);
byte
[]
bytes
=
new
byte
[
1024
];
int
length
=
0
;
while
((
length
=
fileInputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
dos
.
write
(
bytes
,
0
,
length
);
dos
.
flush
();
logger
.
info
(
"同步文件starting......."
);
byte
[]
bytes
=
new
byte
[
1024
];
int
length
=
0
;
while
((
length
=
fileInputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
dos
.
write
(
bytes
,
0
,
length
);
dos
.
flush
();
}
logger
.
info
(
"同步文件end......."
);
}
finally
{
dos
.
close
();
dis
.
close
();
socket
.
close
();
fileInputStream
.
close
();
}
logger
.
info
(
"同步文件end......."
);
syncFileFlag
=
true
;
}
catch
(
Exception
ex
)
{
logger
.
error
(
ex
);
syncFileFlag
=
false
;
}
finally
{
dos
.
close
();
dis
.
close
();
socket
.
close
();
fileInputStream
.
close
();
}
return
syncFileFlag
;
syncFileFlag
=
true
;
}
catch
(
Exception
ex
)
{
logger
.
error
(
ex
);
syncFileFlag
=
false
;
}
return
syncFileFlag
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"命令名称"
)
private
String
ctl
;
@FieldDescribe
(
"服务器地址(*代表多台应用服务器)"
)
...
...
@@ -165,18 +168,23 @@ public class ActionCommand extends BaseAction {
public
String
getCtl
()
{
return
ctl
;
}
public
void
setCtl
(
String
ctl
)
{
this
.
ctl
=
ctl
;
}
public
String
getNodeName
()
{
return
nodeName
;
}
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
;
}
public
String
getNodePort
()
{
return
nodePort
;
}
public
void
setNodePort
(
String
nodePort
)
{
this
.
nodePort
=
nodePort
;
}
...
...
@@ -216,6 +224,4 @@ public class ActionCommand extends BaseAction {
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionGet.java
浏览文件 @
4e168c48
...
...
@@ -9,44 +9,42 @@ import com.x.base.core.project.http.ActionResult;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.config.Node
;
/
*获取服器信息列表*/
/
/获取服器信息列表
class
ActionGet
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
currentIP
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Nodes
nodes
=
Config
.
nodes
();
if
(
null
==
nodes
)
{
throw
new
ExceptionEntityNotExist
(
currentIP
,
"Nodes"
);
}
List
<
NodeInfo
>
nodeInfoList
=
new
ArrayList
<>();
for
(
String
key:
nodes
.
keySet
()){
NodeInfo
nodeInfo
=
new
NodeInfo
();
if
(
key
.
equalsIgnoreCase
(
"127.0.0.1"
))
{
nodeInfo
.
setNodeAddress
(
currentIP
);
}
else
{
nodeInfo
.
setNodeAddress
(
key
);
}
nodeInfo
.
setNode
(
nodes
.
get
(
key
));
nodeInfoList
.
add
(
nodeInfo
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Nodes
nodes
=
Config
.
nodes
();
if
(
null
==
nodes
)
{
throw
new
ExceptionEntityNotExist
(
currentIP
,
"Nodes"
);
}
List
<
NodeInfo
>
nodeInfoList
=
new
ArrayList
<>();
for
(
String
key
:
nodes
.
keySet
())
{
NodeInfo
nodeInfo
=
new
NodeInfo
();
if
(
key
.
equalsIgnoreCase
(
"127.0.0.1"
))
{
nodeInfo
.
setNodeAddress
(
currentIP
);
}
else
{
nodeInfo
.
setNodeAddress
(
key
);
}
Wo
wo
=
new
Wo
();
wo
.
setNodeList
(
nodeInfoList
);
result
.
setData
(
wo
);
return
result
;
nodeInfo
.
setNode
(
nodes
.
get
(
key
));
nodeInfoList
.
add
(
nodeInfo
);
}
Wo
wo
=
new
Wo
();
wo
.
setNodeList
(
nodeInfoList
);
result
.
setData
(
wo
);
return
result
;
}
public
class
NodeInfo
{
public
class
NodeInfo
{
private
String
nodeAddress
;
private
Node
node
;
private
Node
node
;
public
String
getNodeAddress
()
{
return
nodeAddress
;
}
...
...
@@ -61,20 +59,20 @@ public class NodeInfo{
public
void
setNode
(
Node
node
)
{
this
.
node
=
node
;
}
}
public
static
class
Wo
{
}
}
public
static
class
Wo
{
private
List
<
NodeInfo
>
nodeList
;
public
List
<
NodeInfo
>
getNodeList
()
{
return
nodeList
;
}
public
void
setNodeList
(
List
<
NodeInfo
>
nodeList
)
{
this
.
nodeList
=
nodeList
;
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUninstall.java
浏览文件 @
4e168c48
...
...
@@ -26,46 +26,47 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.Crypto
;
public
class
ActionUninstall
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CommandAction
.
class
);
public
class
ActionUninstall
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CommandAction
.
class
);
public
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
ctl
,
String
nodeName
,
String
nodePort
,
String
fileName
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
String
curServer
=
request
.
getLocalAddr
();
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
logger
.
info
(
"先其他服务器"
);
for
(
String
node
:
nodes
.
keySet
()){
//先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
())
{
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
(),
fileName
);
for
(
String
node
:
nodes
.
keySet
())
{
//
先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
())
{
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
(),
fileName
);
}
}
}
logger
.
info
(
"后当前服务器"
);
for
(
String
node
:
nodes
.
keySet
())
{
//后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
fileName
);
}
for
(
String
node
:
nodes
.
keySet
())
{
// 后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
())
{
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
fileName
);
}
}
}
}
else
{
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
nodePort
),
fileName
);
}
else
{
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
nodePort
),
fileName
);
}
result
.
setData
(
wo
);
return
result
;
}
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
Integer
nodePort
,
String
fileName
)
{
// TODO Auto-generated method stub
Wo
wo
=
new
Wo
();
...
...
@@ -75,21 +76,21 @@ public class ActionUninstall extends BaseAction {
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
DataOutputStream
dos
=
null
;
DataInputStream
dis
=
null
;
DataInputStream
dis
=
null
;
try
{
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"uninstall:"
+
ctl
);
commandObject
.
put
(
"command"
,
"uninstall:"
+
ctl
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
dos
.
writeUTF
(
fileName
);
dos
.
flush
();
}
finally
{
}
finally
{
dos
.
close
();
dis
.
close
();
socket
.
close
();
...
...
@@ -97,40 +98,47 @@ public class ActionUninstall extends BaseAction {
}
catch
(
Exception
ex
)
{
wo
.
setStatus
(
"fail"
);
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
wo
.
setTime
(
df
.
format
(
new
Date
()));
return
wo
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
4865686912072669195L
;
@FieldDescribe
(
"命令"
)
private
String
ctl
;
@FieldDescribe
(
"节点"
)
private
String
nodeName
;
@FieldDescribe
(
"端口"
)
private
String
nodePort
;
public
String
getCtl
()
{
return
ctl
;
}
public
void
setCtl
(
String
ctl
)
{
this
.
ctl
=
ctl
;
}
public
String
getNodeName
()
{
return
nodeName
;
}
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
;
}
public
String
getNodePort
()
{
return
nodePort
;
}
public
void
setNodePort
(
String
nodePort
)
{
this
.
nodePort
=
nodePort
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"执行时间"
)
private
String
time
;
@FieldDescribe
(
"执行结束"
)
...
...
@@ -141,11 +149,11 @@ public class ActionUninstall extends BaseAction {
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getNode
()
{
return
node
;
}
...
...
@@ -163,6 +171,4 @@ public class ActionUninstall extends BaseAction {
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/command/ActionUploadFile.java
浏览文件 @
4e168c48
...
...
@@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.glassfish.jersey.media.multipart.FormDataContentDisposition
;
...
...
@@ -25,53 +26,57 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.Crypto
;
public
class
ActionUploadFile
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CommandAction
.
class
);
public
class
ActionUploadFile
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CommandAction
.
class
);
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
ctl
,
String
nodeName
,
String
nodePort
,
InputStream
fileInputStream
,
FormDataContentDisposition
disposition
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
String
curServer
=
request
.
getLocalAddr
();
ByteArrayInputStream
byteArrayInputStream
=
null
;
byte
[]
byteArray
=
IOUtil
.
readBytesFromOtherInputStream
(
fileInputStream
);
fileInputStream
.
close
();
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
logger
.
info
(
"先其他服务器"
);
for
(
String
node
:
nodes
.
keySet
()){
//先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
()){
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
ctl
,
String
nodeName
,
String
nodePort
,
InputStream
fileInputStream
,
FormDataContentDisposition
disposition
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
String
curServer
=
request
.
getLocalAddr
();
ByteArrayInputStream
byteArrayInputStream
=
null
;
byte
[]
byteArray
=
IOUtil
.
readBytesFromOtherInputStream
(
fileInputStream
);
fileInputStream
.
close
();
if
(
nodeName
.
equalsIgnoreCase
(
"*"
))
{
Nodes
nodes
=
Config
.
nodes
();
logger
.
info
(
"先其他服务器"
);
for
(
String
node
:
nodes
.
keySet
())
{
// 先其他服务器
if
(!
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
node
).
getApplication
().
getEnable
()
||
nodes
.
get
(
node
).
getCenter
().
getEnable
())
{
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
node
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
}
logger
.
info
(
"后当前服务器"
);
for
(
String
node
:
nodes
.
keySet
())
{
//后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
()){
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
}
logger
.
info
(
"后当前服务器"
);
for
(
String
node
:
nodes
.
keySet
())
{
// 后当前服务器
if
(
node
.
equalsIgnoreCase
(
curServer
))
{
if
(
nodes
.
get
(
curServer
).
getApplication
().
getEnable
()
||
nodes
.
get
(
curServer
).
getCenter
().
getEnable
())
{
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
logger
.
info
(
"node="
+
node
);
wo
=
executeCommand
(
ctl
,
node
,
nodes
.
get
(
curServer
).
nodeAgentPort
(),
byteArrayInputStream
,
disposition
);
}
}
}
else
{
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
nodePort
),
byteArrayInputStream
,
disposition
);
}
result
.
setData
(
wo
);
return
result
;
}
else
{
byteArrayInputStream
=
new
ByteArrayInputStream
(
byteArray
);
wo
=
executeCommand
(
ctl
,
nodeName
,
Integer
.
parseInt
(
nodePort
),
byteArrayInputStream
,
disposition
);
}
result
.
setData
(
wo
);
return
result
;
}
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
,
InputStream
fileInputStream
,
FormDataContentDisposition
disposition
)
throws
Exception
{
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
,
InputStream
fileInputStream
,
FormDataContentDisposition
disposition
)
throws
Exception
{
Wo
wo
=
new
Wo
();
wo
.
setNode
(
nodeName
);
wo
.
setStatus
(
"success"
);
...
...
@@ -79,30 +84,30 @@ public class ActionUploadFile extends BaseAction {
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
DataOutputStream
dos
=
null
;
DataInputStream
dis
=
null
;
DataInputStream
dis
=
null
;
try
{
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
dis
=
new
DataInputStream
(
socket
.
getInputStream
());
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"redeploy:"
+
ctl
);
commandObject
.
put
(
"command"
,
"redeploy:"
+
ctl
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
dos
.
writeUTF
(
disposition
.
getFileName
());
dos
.
flush
();
logger
.
info
(
"发送文件starting......."
);
byte
[]
bytes
=
new
byte
[
1024
];
int
length
=
0
;
while
((
length
=
fileInputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
int
length
=
0
;
while
((
length
=
fileInputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
dos
.
write
(
bytes
,
0
,
length
);
dos
.
flush
();
}
logger
.
info
(
"发送文件end."
);
}
finally
{
}
finally
{
dos
.
close
();
dis
.
close
();
socket
.
close
();
...
...
@@ -111,39 +116,46 @@ public class ActionUploadFile extends BaseAction {
}
catch
(
Exception
ex
)
{
wo
.
setStatus
(
"fail"
);
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
wo
.
setTime
(
df
.
format
(
new
Date
()));
return
wo
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"命令"
)
private
String
ctl
;
@FieldDescribe
(
"节点"
)
private
String
nodeName
;
@FieldDescribe
(
"端口"
)
private
String
nodePort
;
public
String
getCtl
()
{
return
ctl
;
}
public
void
setCtl
(
String
ctl
)
{
this
.
ctl
=
ctl
;
}
public
String
getNodeName
()
{
return
nodeName
;
}
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
;
}
public
String
getNodePort
()
{
return
nodePort
;
}
public
void
setNodePort
(
String
nodePort
)
{
this
.
nodePort
=
nodePort
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"执行时间"
)
private
String
time
;
@FieldDescribe
(
"执行结束"
)
...
...
@@ -154,11 +166,11 @@ public class ActionUploadFile extends BaseAction {
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getNode
()
{
return
node
;
}
...
...
@@ -175,8 +187,5 @@ public class ActionUploadFile extends BaseAction {
this
.
status
=
status
;
}
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ActionList.java
浏览文件 @
4e168c48
...
...
@@ -29,60 +29,58 @@ import java.util.Map;
public
class
ActionList
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionList
.
class
);
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
File
manifestFile
=
new
File
(
Config
.
base
(),
"configSample/manifest.cfg"
);
File
manifestFile
=
new
File
(
Config
.
base
(),
"configSample/manifest.cfg"
);
Wo
wo
=
new
Wo
();
if
(
manifestFile
.
exists
())
{
if
(
manifestFile
.
isFile
())
{
if
(
manifestFile
.
exists
())
{
if
(
manifestFile
.
isFile
())
{
String
json
=
FileUtils
.
readFileToString
(
manifestFile
,
DefaultCharset
.
charset
);
FileFilter
fileFilter
=
new
WildcardFileFilter
(
"node_*.json"
);
File
[]
files
=
Config
.
dir_config
().
listFiles
(
fileFilter
);
if
(
null
!=
files
&&
files
.
length
>
0
)
{
String
strNode
=
""
;
String
strNode
=
""
;
JsonParser
parser
=
new
JsonParser
();
JsonObject
jsonObj
=
parser
.
parse
(
json
).
getAsJsonObject
();
jsonObj
.
remove
(
"node_127.0.0.1.json"
);
for
(
File
o
:
files
)
{
String
name
=
StringUtils
.
substringBetween
(
o
.
getName
(),
"node_"
,
".json"
);
jsonObj
.
addProperty
(
o
.
getName
().
toString
(),
name
+
"应用节点配置"
);
jsonObj
.
addProperty
(
o
.
getName
().
toString
(),
name
+
"应用节点配置"
);
}
wo
.
setConfig
(
jsonObj
.
toString
());
wo
.
setConfig
(
jsonObj
.
toString
());
}
else
{
wo
.
setConfig
(
json
);
wo
.
setConfig
(
json
);
}
}
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
wo
.
setTime
(
df
.
format
(
new
Date
()));
wo
.
setStatus
(
"success"
);
result
.
setData
(
wo
);
return
result
;
}
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
synchronized
private
Wo
executeCommand
(
String
ctl
,
String
nodeName
,
int
nodePort
)
throws
Exception
{
Wo
wo
=
new
Wo
();
//wo.setNode(nodeName);
//
wo.setNode(nodeName);
wo
.
setStatus
(
"success"
);
try
(
Socket
socket
=
new
Socket
(
nodeName
,
nodePort
))
{
socket
.
setKeepAlive
(
true
);
socket
.
setSoTimeout
(
5000
);
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
socket
.
getOutputStream
());
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
DataInputStream
dis
=
new
DataInputStream
(
socket
.
getInputStream
()))
{
Map
<
String
,
Object
>
commandObject
=
new
HashMap
<>();
commandObject
.
put
(
"command"
,
"command:"
+
ctl
);
commandObject
.
put
(
"command"
,
"command:"
+
ctl
);
commandObject
.
put
(
"credential"
,
Crypto
.
rsaEncrypt
(
"o2@"
,
Config
.
publicKey
()));
dos
.
writeUTF
(
XGsonBuilder
.
toJson
(
commandObject
));
dos
.
flush
();
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
if
(
ctl
.
indexOf
(
"create encrypt"
)
>
-
1
)
{
String
createEncrypt
=
dis
.
readUTF
();
logger
.
info
(
createEncrypt
);
}
...
...
@@ -95,30 +93,28 @@ public class ActionList extends BaseAction {
wo
.
setTime
(
df
.
format
(
new
Date
()));
return
wo
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
1525143709803057966L
;
@FieldDescribe
(
"执行时间"
)
private
String
time
;
@FieldDescribe
(
"执行结果"
)
private
String
status
;
@FieldDescribe
(
"config文件列表"
)
private
String
config
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getStatus
()
{
return
status
;
}
...
...
@@ -126,7 +122,7 @@ public class ActionList extends BaseAction {
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getConfig
()
{
return
config
;
}
...
...
@@ -135,7 +131,5 @@ public class ActionList extends BaseAction {
this
.
config
=
config
;
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/BaseAction.java
浏览文件 @
4e168c48
...
...
@@ -2,7 +2,7 @@ package com.x.program.center.jaxrs.config;
import
java.util.List
;
import
com.x.base.core.project.
Applications
;
import
com.x.base.core.project.
annotation.FieldDescribe
;
import
com.x.base.core.project.cache.ApplicationCache
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.CipherConnectionAction
;
...
...
@@ -10,15 +10,21 @@ import com.x.base.core.project.gson.GsonPropertyObject;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.program.center.ThisApplication
;
import
net.sf.ehcache.Ehcache
;
class
BaseAction
extends
StandardJaxrsAction
{
public
static
class
AbstractWoProxy
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
4901521017475819615L
;
@FieldDescribe
(
"http协议"
)
private
String
httpProtocol
;
@FieldDescribe
(
"center服务器"
)
private
Center
center
;
@FieldDescribe
(
"web服务器"
)
private
Web
web
;
private
List
<
Application
>
applicationList
;
...
...
@@ -160,6 +166,7 @@ class BaseAction extends StandardJaxrsAction {
private
String
node
;
private
long
lastPoint
;
public
long
getLastPoint
()
{
return
lastPoint
;
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecute.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.script.Bindings
;
import
javax.script.CompiledScript
;
import
javax.script.ScriptContext
;
import
javax.script.SimpleScriptContext
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoContentType
;
import
com.x.base.core.project.jaxrs.WoSeeOther
;
import
com.x.base.core.project.jaxrs.WoTemporaryRedirect
;
import
com.x.base.core.project.jaxrs.WoText
;
import
com.x.base.core.project.jaxrs.WoValue
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.script.AbstractResources
;
import
com.x.base.core.project.script.ScriptFactory
;
import
com.x.base.core.project.webservices.WebservicesClient
;
import
com.x.organization.core.express.Organization
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.Invoke
;
class
ActionExecute
extends
BaseAction
{
...
...
@@ -55,7 +35,7 @@ class ActionExecute extends BaseAction {
if
(!
BooleanUtils
.
isTrue
(
invoke
.
getEnable
()))
{
throw
new
ExceptionNotEnable
(
invoke
.
getName
());
}
if
(
StringUtils
.
isNotEmpty
(
invoke
.
getRemoteAddrRegex
()))
{
Matcher
matcher
=
Pattern
.
compile
(
invoke
.
getRemoteAddrRegex
()).
matcher
(
request
.
getRemoteAddr
());
if
(!
matcher
.
find
())
{
...
...
@@ -63,128 +43,10 @@ class ActionExecute extends BaseAction {
}
}
ActionResult
<
Object
>
result
=
new
ActionResult
<>();
CompiledScript
compiledScript
=
this
.
getCompiledScript
(
cacheCategory
,
invoke
);
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
Resources
resources
=
new
Resources
();
// 此方法不用装载emc
// resources.setEntityManagerContainer(emc);
resources
.
setContext
(
ThisApplication
.
context
());
resources
.
setOrganization
(
new
Organization
(
ThisApplication
.
context
()));
resources
.
setWebservicesClient
(
new
WebservicesClient
());
resources
.
setApplications
(
ThisApplication
.
context
().
applications
());
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_RESOURCES
,
resources
);
bindings
.
put
(
"requestText"
,
gson
.
toJson
(
jsonElement
));
bindings
.
put
(
"request"
,
request
);
bindings
.
put
(
"effectivePerson"
,
effectivePerson
);
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_APPLICATIONS
,
ThisApplication
.
context
().
applications
());
CustomResponse
customResponse
=
new
CustomResponse
();
bindings
.
put
(
"customResponse"
,
customResponse
);
Wo
wo
=
new
Wo
();
try
{
ScriptFactory
.
initialServiceScriptText
().
eval
(
scriptContext
);
Object
o
=
compiledScript
.
eval
(
scriptContext
);
if
(
StringUtils
.
equals
(
"seeOther"
,
customResponse
.
type
))
{
WoSeeOther
woSeeOther
=
new
WoSeeOther
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woSeeOther
);
}
else
if
(
StringUtils
.
equals
(
"temporaryRedirect"
,
customResponse
.
type
))
{
WoTemporaryRedirect
woTemporaryRedirect
=
new
WoTemporaryRedirect
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woTemporaryRedirect
);
}
else
{
if
(
null
!=
customResponse
.
value
)
{
if
(
StringUtils
.
isNotEmpty
(
customResponse
.
contentType
))
{
result
.
setData
(
new
WoContentType
(
customResponse
.
value
,
customResponse
.
contentType
));
}
else
if
(
customResponse
.
value
instanceof
WoText
)
{
result
.
setData
(
customResponse
.
value
);
}
else
{
wo
.
setValue
(
customResponse
.
value
);
result
.
setData
(
wo
);
}
}
else
{
wo
.
setValue
(
o
);
result
.
setData
(
wo
);
}
}
}
catch
(
Exception
e
)
{
throw
new
ExceptionExecuteError
(
invoke
.
getName
(),
e
);
}
return
result
;
}
private
Invoke
get
(
CacheCategory
cacheCategory
,
String
flag
)
throws
Exception
{
CacheKey
cacheKey
=
new
CacheKey
(
ActionExecute
.
class
,
flag
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
return
(
Invoke
)
optional
.
get
();
}
else
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Invoke
invoke
=
emc
.
flag
(
flag
,
Invoke
.
class
);
if
(
null
!=
invoke
)
{
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
invoke
);
}
return
invoke
;
}
}
}
private
CompiledScript
getCompiledScript
(
CacheCategory
cacheCategory
,
Invoke
invoke
)
throws
Exception
{
CacheKey
cacheKey
=
new
CacheKey
(
ActionExecute
.
class
,
"CompiledScript"
,
invoke
.
getId
());
CompiledScript
compiledScript
=
null
;
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
compiledScript
=
(
CompiledScript
)
optional
.
get
();
}
else
{
compiledScript
=
ScriptFactory
.
compile
(
invoke
.
getText
());
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
compiledScript
);
}
return
compiledScript
;
}
public
static
class
CustomResponse
{
protected
String
type
=
null
;
protected
Object
value
;
protected
String
contentType
;
public
void
seeOther
(
String
url
)
{
this
.
type
=
"seeOther"
;
this
.
value
=
url
;
}
public
void
temporaryRedirect
(
String
url
)
{
this
.
type
=
"temporaryRedirect"
;
this
.
value
=
url
;
}
public
void
setBody
(
Object
obj
)
{
this
.
value
=
obj
;
}
public
void
setBody
(
Object
obj
,
String
contentType
)
{
this
.
value
=
obj
;
this
.
contentType
=
contentType
;
}
}
public
static
class
Wo
extends
WoValue
{
private
static
final
long
serialVersionUID
=
-
2253926744723217590L
;
}
public
static
class
Resources
extends
AbstractResources
{
private
Organization
organization
;
public
Organization
getOrganization
()
{
return
organization
;
}
public
void
setOrganization
(
Organization
organization
)
{
this
.
organization
=
organization
;
if
(
BooleanUtils
.
isTrue
(
invoke
.
getEnableToken
()))
{
throw
new
ExceptionEnableToken
(
invoke
.
getName
());
}
return
executeInvoke
(
request
,
effectivePerson
,
jsonElement
,
cacheCategory
,
invoke
);
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecute2.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.invoke
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.script.Bindings
;
import
javax.script.CompiledScript
;
import
javax.script.ScriptContext
;
import
javax.script.SimpleScriptContext
;
import
javax.servlet.http.HttpServletRequest
;
import
com.x.base.core.project.cache.CacheManager
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoContentType
;
import
com.x.base.core.project.jaxrs.WoSeeOther
;
import
com.x.base.core.project.jaxrs.WoTemporaryRedirect
;
import
com.x.base.core.project.jaxrs.WoText
;
import
com.x.base.core.project.jaxrs.WoValue
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.script.AbstractResources
;
import
com.x.base.core.project.script.ScriptFactory
;
import
com.x.base.core.project.webservices.WebservicesClient
;
import
com.x.organization.core.express.Organization
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.Invoke
;
class
ActionExecute2
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionExecute2
.
class
);
ActionResult
<
Object
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
flag
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Object
>
result
=
new
ActionResult
<>();
Invoke
invoke
=
emc
.
flag
(
flag
,
Invoke
.
class
);
if
(
null
==
invoke
)
{
throw
new
ExceptionInvokeNotExist
(
flag
);
}
if
(!
BooleanUtils
.
isTrue
(
invoke
.
getEnable
()))
{
throw
new
ExceptionNotEnable
(
invoke
.
getName
());
}
if
(
StringUtils
.
isNotEmpty
(
invoke
.
getRemoteAddrRegex
()))
{
Matcher
matcher
=
Pattern
.
compile
(
invoke
.
getRemoteAddrRegex
()).
matcher
(
request
.
getRemoteAddr
());
if
(!
matcher
.
find
())
{
throw
new
ExceptionInvalidRemoteAddr
(
request
.
getRemoteAddr
(),
invoke
.
getName
());
}
}
emc
.
beginTransaction
(
Invoke
.
class
);
invoke
.
setLastStartTime
(
new
Date
());
emc
.
commit
();
CacheCategory
cacheCategory
=
new
CacheCategory
(
Invoke
.
class
);
CacheKey
cacheKey
=
new
CacheKey
(
ActionExecute2
.
class
,
invoke
.
getId
());
CompiledScript
compiledScript
=
null
;
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
compiledScript
=
(
CompiledScript
)
optional
.
get
();
}
else
{
compiledScript
=
ScriptFactory
.
compile
(
invoke
.
getText
());
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
compiledScript
);
}
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
Resources
resources
=
new
Resources
();
resources
.
setEntityManagerContainer
(
emc
);
resources
.
setContext
(
ThisApplication
.
context
());
resources
.
setOrganization
(
new
Organization
(
ThisApplication
.
context
()));
resources
.
setWebservicesClient
(
new
WebservicesClient
());
resources
.
setApplications
(
ThisApplication
.
context
().
applications
());
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_RESOURCES
,
resources
);
bindings
.
put
(
"requestText"
,
gson
.
toJson
(
jsonElement
));
bindings
.
put
(
"request"
,
request
);
bindings
.
put
(
"effectivePerson"
,
effectivePerson
);
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_APPLICATIONS
,
ThisApplication
.
context
().
applications
());
CustomResponse
customResponse
=
new
CustomResponse
();
bindings
.
put
(
"customResponse"
,
customResponse
);
Wo
wo
=
new
Wo
();
try
{
ScriptFactory
.
initialServiceScriptText
().
eval
(
scriptContext
);
Object
o
=
compiledScript
.
eval
(
scriptContext
);
if
(
StringUtils
.
equals
(
"seeOther"
,
customResponse
.
type
))
{
WoSeeOther
woSeeOther
=
new
WoSeeOther
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woSeeOther
);
}
else
if
(
StringUtils
.
equals
(
"temporaryRedirect"
,
customResponse
.
type
))
{
WoTemporaryRedirect
woTemporaryRedirect
=
new
WoTemporaryRedirect
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woTemporaryRedirect
);
}
else
{
if
(
null
!=
customResponse
.
value
)
{
if
(
StringUtils
.
isNotEmpty
(
customResponse
.
contentType
))
{
result
.
setData
(
new
WoContentType
(
customResponse
.
value
,
customResponse
.
contentType
));
}
else
if
(
customResponse
.
value
instanceof
WoText
)
{
result
.
setData
(
customResponse
.
value
);
}
else
{
wo
.
setValue
(
customResponse
.
value
);
result
.
setData
(
wo
);
}
}
else
{
wo
.
setValue
(
o
);
result
.
setData
(
wo
);
}
}
}
catch
(
Exception
e
)
{
throw
new
ExceptionExecuteError
(
invoke
.
getName
(),
e
);
}
emc
.
beginTransaction
(
Invoke
.
class
);
invoke
.
setLastEndTime
(
new
Date
());
emc
.
check
(
invoke
,
CheckPersistType
.
all
);
emc
.
commit
();
return
result
;
}
}
public
static
class
CustomResponse
{
protected
String
type
=
null
;
protected
Object
value
;
protected
String
contentType
;
public
void
seeOther
(
String
url
)
{
this
.
type
=
"seeOther"
;
this
.
value
=
url
;
}
public
void
temporaryRedirect
(
String
url
)
{
this
.
type
=
"temporaryRedirect"
;
this
.
value
=
url
;
}
public
void
setBody
(
Object
obj
)
{
this
.
value
=
obj
;
}
public
void
setBody
(
Object
obj
,
String
contentType
)
{
this
.
value
=
obj
;
this
.
contentType
=
contentType
;
}
}
public
static
class
Wo
extends
WoValue
{
}
public
static
class
Resources
extends
AbstractResources
{
private
Organization
organization
;
public
Organization
getOrganization
()
{
return
organization
;
}
public
void
setOrganization
(
Organization
organization
)
{
this
.
organization
=
organization
;
}
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionExecuteToken.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
java.net.URLDecoder
;
import
java.util.Date
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.Crypto
;
import
com.x.program.center.core.entity.Invoke
;
class
ActionExecuteToken
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionExecuteToken
.
class
);
private
static
final
String
SPLIT
=
"#"
;
ActionResult
<
Object
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
flag
,
String
token
,
JsonElement
jsonElement
)
throws
Exception
{
CacheCategory
cacheCategory
=
new
CacheCategory
(
Invoke
.
class
);
Invoke
invoke
=
this
.
get
(
cacheCategory
,
flag
);
if
(
null
==
invoke
)
{
throw
new
ExceptionEntityNotExist
(
flag
,
Invoke
.
class
);
}
if
(!
BooleanUtils
.
isTrue
(
invoke
.
getEnable
()))
{
throw
new
ExceptionNotEnable
(
invoke
.
getName
());
}
if
(
StringUtils
.
isNotEmpty
(
invoke
.
getRemoteAddrRegex
()))
{
Matcher
matcher
=
Pattern
.
compile
(
invoke
.
getRemoteAddrRegex
()).
matcher
(
request
.
getRemoteAddr
());
if
(!
matcher
.
find
())
{
throw
new
ExceptionInvalidRemoteAddr
(
request
.
getRemoteAddr
(),
invoke
.
getName
());
}
}
String
content
=
Crypto
.
decrypt
(
token
,
invoke
.
getKey
());
String
name
=
URLDecoder
.
decode
(
StringUtils
.
substringBefore
(
content
,
SPLIT
),
"UTF-8"
);
String
timeString
=
StringUtils
.
substringAfter
(
content
,
SPLIT
);
if
(
StringUtils
.
isEmpty
(
name
))
{
throw
new
ExceptionTokenNameEmpty
();
}
if
(!
StringUtils
.
equalsIgnoreCase
(
name
,
invoke
.
getName
()))
{
throw
new
ExceptionTokenNameNotMatch
(
name
);
}
Date
date
=
new
Date
(
Long
.
parseLong
(
timeString
));
Date
now
=
new
Date
();
if
(
Math
.
abs
((
now
.
getTime
()
-
date
.
getTime
()))
>=
(
60000
*
15
))
{
throw
new
ExceptionTokenExpired
();
}
return
executeInvoke
(
request
,
effectivePerson
,
jsonElement
,
cacheCategory
,
invoke
);
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ActionToken.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
java.util.Date
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapString
;
import
com.x.base.core.project.tools.Crypto
;
class
ActionToken
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Wo
wo
=
new
Wo
();
String
value
=
wi
.
getName
()
+
"#"
+
wi
.
getDate
().
getTime
();
wo
.
setValue
(
Crypto
.
encrypt
(
value
,
wi
.
getKey
()));
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
251331390296713913L
;
@FieldDescribe
(
"名称"
)
private
String
name
;
@FieldDescribe
(
"时间,如果为空那么采用当前时间."
)
private
Date
date
;
public
Date
getDate
()
{
return
(
this
.
date
==
null
)
?
new
Date
()
:
this
.
date
;
}
@FieldDescribe
(
"密钥"
)
private
String
key
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
void
setDate
(
Date
date
)
{
this
.
date
=
date
;
}
}
public
static
class
Wo
extends
WrapString
{
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/BaseAction.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.Objects
;
import
java.util.Optional
;
import
javax.script.Bindings
;
import
javax.script.CompiledScript
;
import
javax.script.ScriptContext
;
import
javax.script.SimpleScriptContext
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.jaxrs.WoContentType
;
import
com.x.base.core.project.jaxrs.WoSeeOther
;
import
com.x.base.core.project.jaxrs.WoTemporaryRedirect
;
import
com.x.base.core.project.jaxrs.WoText
;
import
com.x.base.core.project.jaxrs.WoValue
;
import
com.x.base.core.project.script.AbstractResources
;
import
com.x.base.core.project.script.ScriptFactory
;
import
com.x.base.core.project.webservices.WebservicesClient
;
import
com.x.organization.core.express.Organization
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.Invoke
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
// private static String COMMENT = "";
//
// private static final Pattern COMMENT_REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
//
// static {
// COMMENT = "/*" + StringUtils.LF;
// COMMENT += "* resources.getEntityManagerContainer() // 实体管理容器." + StringUtils.LF;
// COMMENT += "* resources.getContext() //上下文根." + StringUtils.LF;
// COMMENT += "* resources.getOrganization() //组织访问接口." + StringUtils.LF;
// COMMENT += "* requestText //请求内容." + StringUtils.LF;
// COMMENT += "* request //请求对象." + StringUtils.LF;
// COMMENT += "*/" + StringUtils.LF;
// }
//
// protected void addComment(Invoke invoke) {
// if (StringUtils.isEmpty(invoke.getText())) {
// invoke.setText(COMMENT);
// } else {
// Matcher m = COMMENT_REGEX.matcher(invoke.getText());
// if (m.find()) {
// invoke.setText(COMMENT + m.replaceFirst(""));
// } else {
// invoke.setText(COMMENT + invoke.getText());
// }
// }
// }
protected
ActionResult
<
Object
>
executeInvoke
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
,
CacheCategory
cacheCategory
,
Invoke
invoke
)
throws
Exception
,
ExceptionExecuteError
{
ActionResult
<
Object
>
result
=
new
ActionResult
<>();
CompiledScript
compiledScript
=
this
.
getCompiledScript
(
cacheCategory
,
invoke
);
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
Resources
resources
=
new
Resources
();
resources
.
setContext
(
ThisApplication
.
context
());
resources
.
setOrganization
(
new
Organization
(
ThisApplication
.
context
()));
resources
.
setWebservicesClient
(
new
WebservicesClient
());
resources
.
setApplications
(
ThisApplication
.
context
().
applications
());
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_RESOURCES
,
resources
);
bindings
.
put
(
"requestText"
,
gson
.
toJson
(
jsonElement
));
bindings
.
put
(
"request"
,
request
);
bindings
.
put
(
"effectivePerson"
,
effectivePerson
);
bindings
.
put
(
ScriptFactory
.
BINDING_NAME_APPLICATIONS
,
ThisApplication
.
context
().
applications
());
CustomResponse
customResponse
=
new
CustomResponse
();
bindings
.
put
(
"customResponse"
,
customResponse
);
Wo
wo
=
new
Wo
();
try
{
ScriptFactory
.
initialServiceScriptText
().
eval
(
scriptContext
);
Object
o
=
compiledScript
.
eval
(
scriptContext
);
if
(
StringUtils
.
equals
(
"seeOther"
,
customResponse
.
type
))
{
WoSeeOther
woSeeOther
=
new
WoSeeOther
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woSeeOther
);
}
else
if
(
StringUtils
.
equals
(
"temporaryRedirect"
,
customResponse
.
type
))
{
WoTemporaryRedirect
woTemporaryRedirect
=
new
WoTemporaryRedirect
(
Objects
.
toString
(
customResponse
.
value
,
""
));
result
.
setData
(
woTemporaryRedirect
);
}
else
{
if
(
null
!=
customResponse
.
value
)
{
if
(
StringUtils
.
isNotEmpty
(
customResponse
.
contentType
))
{
result
.
setData
(
new
WoContentType
(
customResponse
.
value
,
customResponse
.
contentType
));
}
else
if
(
customResponse
.
value
instanceof
WoText
)
{
result
.
setData
(
customResponse
.
value
);
}
else
{
wo
.
setValue
(
customResponse
.
value
);
result
.
setData
(
wo
);
}
}
else
{
wo
.
setValue
(
o
);
result
.
setData
(
wo
);
}
}
}
catch
(
Exception
e
)
{
throw
new
ExceptionExecuteError
(
invoke
.
getName
(),
e
);
}
return
result
;
}
protected
CompiledScript
getCompiledScript
(
CacheCategory
cacheCategory
,
Invoke
invoke
)
throws
Exception
{
CacheKey
cacheKey
=
new
CacheKey
(
ActionExecuteToken
.
class
,
"CompiledScript"
,
invoke
.
getId
());
CompiledScript
compiledScript
=
null
;
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
compiledScript
=
(
CompiledScript
)
optional
.
get
();
}
else
{
compiledScript
=
ScriptFactory
.
compile
(
invoke
.
getText
());
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
compiledScript
);
}
return
compiledScript
;
}
protected
Invoke
get
(
CacheCategory
cacheCategory
,
String
flag
)
throws
Exception
{
CacheKey
cacheKey
=
new
CacheKey
(
ActionExecuteToken
.
class
,
flag
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
return
(
Invoke
)
optional
.
get
();
}
else
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Invoke
invoke
=
emc
.
flag
(
flag
,
Invoke
.
class
);
if
(
null
!=
invoke
)
{
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
invoke
);
}
return
invoke
;
}
}
}
public
static
class
CustomResponse
{
protected
String
type
=
null
;
protected
Object
value
;
protected
String
contentType
;
public
void
seeOther
(
String
url
)
{
this
.
type
=
"seeOther"
;
this
.
value
=
url
;
}
public
void
temporaryRedirect
(
String
url
)
{
this
.
type
=
"temporaryRedirect"
;
this
.
value
=
url
;
}
public
void
setBody
(
Object
obj
)
{
this
.
value
=
obj
;
}
public
void
setBody
(
Object
obj
,
String
contentType
)
{
this
.
value
=
obj
;
this
.
contentType
=
contentType
;
}
}
public
static
class
Wo
extends
WoValue
{
private
static
final
long
serialVersionUID
=
-
2253926744723217590L
;
}
public
static
class
Resources
extends
AbstractResources
{
private
Organization
organization
;
public
Organization
getOrganization
()
{
return
organization
;
}
public
void
setOrganization
(
Organization
organization
)
{
this
.
organization
=
organization
;
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionEnableToken.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
com.x.base.core.project.exception.PromptException
;
class
ExceptionEnableToken
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
3287459468603291619L
;
ExceptionEnableToken
(
String
name
)
{
super
(
"接口已经启用了令牌认证,请使用令牌认证调用接口访问: {}."
,
name
);
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenExpired.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
com.x.base.core.project.exception.PromptException
;
class
ExceptionTokenExpired
extends
PromptException
{
private
static
final
long
serialVersionUID
=
4132300948670472899L
;
ExceptionTokenExpired
()
{
super
(
"token超时."
);
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenNameEmpty.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
com.x.base.core.project.exception.PromptException
;
class
ExceptionTokenNameEmpty
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
3287459468603291619L
;
ExceptionTokenNameEmpty
()
{
super
(
"令牌错误,名称为空."
);
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/ExceptionTokenNameNotMatch.java
0 → 100644
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.invoke
;
import
com.x.base.core.project.exception.PromptException
;
class
ExceptionTokenNameNotMatch
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
3287459468603291619L
;
ExceptionTokenNameNotMatch
(
String
name
)
{
super
(
"令牌名称不匹配:{}."
,
name
);
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/InvokeAction.java
浏览文件 @
4e168c48
...
...
@@ -3,7 +3,6 @@ package com.x.program.center.jaxrs.invoke;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.DELETE
;
import
javax.ws.rs.GET
;
...
...
@@ -161,4 +160,41 @@ public class InvokeAction extends StandardJaxrsAction {
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"进行认证后执行调用接口,认证令牌格式'name#1970年毫秒数'经过3des加密,加密密钥为key值,有效时间15分钟."
,
action
=
ActionExecuteToken
.
class
)
@POST
@Path
(
"{flag}/token/{token}/execute"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
executeToken
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"flag"
)
String
flag
,
@JaxrsParameterDescribe
(
"令牌"
)
@PathParam
(
"token"
)
String
token
,
JsonElement
jsonElement
)
{
ActionResult
<
Object
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionExecuteToken
().
execute
(
request
,
effectivePerson
,
flag
,
token
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"生成令牌."
,
action
=
ActionToken
.
class
)
@POST
@Path
(
"token"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
token
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionToken
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionToken
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/pms/ActionCreate.java
浏览文件 @
4e168c48
package
com.x.program.center.jaxrs.pms
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ConnectionAction
;
...
...
@@ -19,7 +21,7 @@ class ActionCreate extends BaseAction {
Wi
wi
=
gson
.
fromJson
(
jsonElement
,
Wi
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
false
);
if
(
Config
.
collect
().
getEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
Config
.
collect
().
getEnable
()
))
{
wi
.
setUnit
(
Config
.
collect
().
getName
());
wi
.
setPassword
(
Config
.
collect
().
getPassword
());
String
url
=
Config
.
collect
().
url
()
+
"/o2_collect_assemble/jaxrs/collect/pushmessage/transfer"
;
...
...
@@ -33,7 +35,9 @@ class ActionCreate extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
}
static
class
Wi
extends
PmsMessage
{
public
static
class
Wi
extends
PmsMessage
{
private
static
final
long
serialVersionUID
=
6030343450444369146L
;
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/prompterrorlog/PromptErrorLogAction.java
浏览文件 @
4e168c48
...
...
@@ -136,7 +136,7 @@ public class PromptErrorLogAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示指定
应用当前用户的Task对象
,下一页."
,
action
=
ActionListNextWithLoggerName
.
class
)
@JaxrsMethodDescribe
(
value
=
"列示指定
loggerName错误
,下一页."
,
action
=
ActionListNextWithLoggerName
.
class
)
@GET
@Path
(
"list/{id}/next/{count}/loggername/{loggerName}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
@@ -156,7 +156,7 @@ public class PromptErrorLogAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示指定
应用当前用户的Task对象
,上一页."
,
action
=
ActionListPrevWithLoggerName
.
class
)
@JaxrsMethodDescribe
(
value
=
"列示指定
loggerName错误
,上一页."
,
action
=
ActionListPrevWithLoggerName
.
class
)
@GET
@Path
(
"list/{id}/prev/{count}/loggername/{loggerName}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
@@ -176,7 +176,7 @@ public class PromptErrorLogAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示指定
应用当前用户的Task对象
,下一页."
,
action
=
ActionListNextWithExceptionClass
.
class
)
@JaxrsMethodDescribe
(
value
=
"列示指定
exceptionClass错误
,下一页."
,
action
=
ActionListNextWithExceptionClass
.
class
)
@GET
@Path
(
"list/{id}/next/{count}/exceptionclass/{exceptionClass}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
@@ -196,7 +196,7 @@ public class PromptErrorLogAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示指定
应用当前用户的Task对象
,上一页."
,
action
=
ActionListPrevWithExceptionClass
.
class
)
@JaxrsMethodDescribe
(
value
=
"列示指定
exceptionClass错误
,上一页."
,
action
=
ActionListPrevWithExceptionClass
.
class
)
@GET
@Path
(
"list/{id}/prev/{count}/exceptionclass/{exceptionClass}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/qiyeweixin/QiyeweixinAction.java
浏览文件 @
4e168c48
...
...
@@ -70,22 +70,18 @@ public class QiyeweixinAction extends StandardJaxrsAction {
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
syncOrganizationCallbackEncodingAESKeyGet
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
@Context
HttpServletRequest
request
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
ActionCallbackAESKey
.
Wo
>
result
=
new
ActionResult
<>();
try
{
result
=
new
ActionCallbackAESKey
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
// @Path("sync/organization/callback")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// msg_signature=ASDFQWEXZCVAQFASDFASDFSS×tamp=13500001234&nonce=123412323&echostr=ENCRYPT_STR
@JaxrsMethodDescribe
(
value
=
"接收企业微信通讯录变更回调的验证请求."
,
action
=
ActionSyncOrganizationCallbackGet
.
class
)
@GET
public
void
syncOrganizationCallbackGet
(
@Suspended
final
AsyncResponse
asyncResponse
,
...
...
@@ -104,9 +100,6 @@ public class QiyeweixinAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//@Path("sync/organization/callback")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe
(
value
=
"接收企业微信通讯录变更回调."
,
action
=
ActionSyncOrganizationCallbackPost
.
class
)
@POST
public
void
syncOrganizationCallbackPost
(
@Suspended
final
AsyncResponse
asyncResponse
,
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/schedule/ActionFire.java
浏览文件 @
4e168c48
...
...
@@ -9,6 +9,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.Application
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.connection.CipherConnectionAction
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
...
...
@@ -64,8 +65,12 @@ class ActionFire extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
5415760454523560472L
;
@FieldDescribe
(
"节点"
)
private
String
node
;
@FieldDescribe
(
"应用"
)
private
String
application
;
@FieldDescribe
(
"任务类"
)
private
String
className
;
public
String
getNode
()
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/ActionTest1.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.test
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
class
ActionTest1
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
return
result
;
}
public
static
class
Wo
extends
GsonPropertyObject
{
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/BaseAction.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.test
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/TestAction.java
已删除
100644 → 0
浏览文件 @
2d36a19f
package
com.x.program.center.jaxrs.test
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.container.AsyncResponse
;
import
javax.ws.rs.container.Suspended
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpMediaType
;
import
com.x.base.core.project.jaxrs.ResponseFactory
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
@Path
(
"test"
)
@JaxrsDescribe
(
"测试"
)
public
class
TestAction
extends
StandardJaxrsAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
TestAction
.
class
);
@GET
@Path
(
"1"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@JaxrsMethodDescribe
(
value
=
"测试,触发Area行政区域同步."
,
action
=
ActionTest1
.
class
)
public
void
test1
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
ActionTest1
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionTest1
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
o2server/x_program_center_core_entity/src/main/java/com/x/program/center/core/entity/Invoke.java
浏览文件 @
4e168c48
...
...
@@ -13,6 +13,7 @@ import javax.persistence.Lob;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.openjpa.persistence.jdbc.Index
;
import
com.x.base.core.entity.JpaObject
;
...
...
@@ -22,6 +23,7 @@ import com.x.base.core.entity.annotation.CitationNotExist;
import
com.x.base.core.entity.annotation.ContainerEntity
;
import
com.x.base.core.entity.annotation.Flag
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.tools.StringTools
;
@Entity
@ContainerEntity
(
dumpSize
=
1000
,
type
=
ContainerEntity
.
Type
.
content
,
reference
=
ContainerEntity
.
Reference
.
strong
)
...
...
@@ -51,13 +53,11 @@ public class Invoke extends SliceJpaObject {
/* 以上为 JpaObject 默认字段 */
public
void
onPersist
()
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
this
.
key
))
{
this
.
key
=
StringTools
.
uniqueToken
();
}
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
public
static
final
String
name_FIELDNAME
=
"name"
;
@Flag
@FieldDescribe
(
"名称."
)
...
...
@@ -66,12 +66,24 @@ public class Invoke extends SliceJpaObject {
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
name_FIELDNAME
)
private
String
name
;
public
static
final
String
key_FIELDNAME
=
"key"
;
@FieldDescribe
(
"进行验证时使用的key."
)
@Column
(
length
=
JpaObject
.
length_255B
,
name
=
ColumnNamePrefix
+
key_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
)
private
String
key
;
public
static
final
String
enableToken_FIELDNAME
=
"enableToken"
;
@FieldDescribe
(
"进行验证时使用的key."
)
@Column
(
name
=
ColumnNamePrefix
+
enableToken_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
)
private
Boolean
enableToken
=
false
;
public
static
final
String
alias_FIELDNAME
=
"alias"
;
@Flag
@FieldDescribe
(
"别名."
)
@Column
(
length
=
JpaObject
.
length_255B
,
name
=
ColumnNamePrefix
+
alias_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
,
simplyString
=
true
,
citationNotExists
=
/
* 检查在同一应用下不能重名 */
/
/ 检查在同一应用下不能重名
@CitationNotExist
(
fields
=
{
"name"
,
"id"
,
"alias"
},
type
=
Invoke
.
class
))
private
String
alias
;
...
...
@@ -195,4 +207,20 @@ public class Invoke extends SliceJpaObject {
this
.
remoteAddrRegex
=
remoteAddrRegex
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
Boolean
getEnableToken
()
{
return
enableToken
;
}
public
void
setEnableToken
(
Boolean
enableToken
)
{
this
.
enableToken
=
enableToken
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录