Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
5c8075f2
o2oa
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa
通知
339
Star
10
Fork
6
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
5c8075f2
编写于
7月 07, 2020
作者:
O
o2null
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/add-manager-empower' into 'develop'
[用户授权]管理员 增加、删除、修改授权 See merge request o2oa/o2oa!1054
上级
4d077f07
0cc1476b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
242 addition
and
2 deletion
+242
-2
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerCreate.java
.../assemble/personal/jaxrs/empower/ActionManagerCreate.java
+73
-0
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerDelete.java
.../assemble/personal/jaxrs/empower/ActionManagerDelete.java
+40
-0
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerEdit.java
...on/assemble/personal/jaxrs/empower/ActionManagerEdit.java
+75
-0
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/EmpowerAction.java
...zation/assemble/personal/jaxrs/empower/EmpowerAction.java
+54
-2
未找到文件。
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerCreate.java
0 → 100644
浏览文件 @
5c8075f2
package
com.x.organization.assemble.personal.jaxrs.empower
;
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.entity.JpaObject
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.cache.ApplicationCache
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.organization.assemble.personal.Business
;
import
com.x.organization.core.entity.accredit.Empower
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionManagerCreate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManagerCreate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
effectivePerson
.
isManager
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Business
business
=
new
Business
(
emc
);
Empower
empower
=
Wi
.
copier
.
copy
(
wi
);
this
.
check
(
business
,
empower
);
String
fromPerson
=
this
.
getPersonDNWithIdentityDN
(
business
,
empower
.
getFromIdentity
());
if
(
StringUtils
.
isEmpty
(
fromPerson
))
{
throw
new
ExceptionPersonNotExistWithIdentity
(
empower
.
getFromIdentity
());
}
else
{
empower
.
setFromPerson
(
fromPerson
);
}
String
toPerson
=
this
.
getPersonDNWithIdentityDN
(
business
,
empower
.
getToIdentity
());
if
(
StringUtils
.
isEmpty
(
toPerson
))
{
throw
new
ExceptionPersonNotExistWithIdentity
(
empower
.
getToIdentity
());
}
else
{
empower
.
setToPerson
(
toPerson
);
}
emc
.
beginTransaction
(
Empower
.
class
);
emc
.
persist
(
empower
,
CheckPersistType
.
all
);
emc
.
commit
();
ApplicationCache
.
notify
(
Empower
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
empower
.
getId
());
result
.
setData
(
wo
);
}
return
result
;
}
}
public
static
class
Wi
extends
Empower
{
private
static
final
long
serialVersionUID
=
-
4315296543575928054L
;
static
WrapCopier
<
Wi
,
Empower
>
copier
=
WrapCopierFactory
.
wi
(
Wi
.
class
,
Empower
.
class
,
null
,
JpaObject
.
FieldsUnmodify
);
}
public
static
class
Wo
extends
WoId
{
}
}
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerDelete.java
0 → 100644
浏览文件 @
5c8075f2
package
com.x.organization.assemble.personal.jaxrs.empower
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.cache.ApplicationCache
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
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.WrapBoolean
;
import
com.x.organization.core.entity.accredit.Empower
;
class
ActionManagerDelete
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Empower
empower
=
emc
.
find
(
id
,
Empower
.
class
);
if
(
null
==
empower
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Empower
.
class
);
}
if
(
effectivePerson
.
isManager
())
{
emc
.
beginTransaction
(
Empower
.
class
);
emc
.
remove
(
empower
,
CheckRemoveType
.
all
);
emc
.
commit
();
ApplicationCache
.
notify
(
Empower
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
}
return
result
;
}
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/ActionManagerEdit.java
0 → 100644
浏览文件 @
5c8075f2
package
com.x.organization.assemble.personal.jaxrs.empower
;
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.entity.JpaObject
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.cache.ApplicationCache
;
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.WoId
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.organization.assemble.personal.Business
;
import
com.x.organization.core.entity.accredit.Empower
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionManagerEdit
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManagerEdit
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Business
business
=
new
Business
(
emc
);
Empower
empower
=
emc
.
find
(
id
,
Empower
.
class
);
if
(
null
==
empower
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Empower
.
class
);
}
if
(
effectivePerson
.
isManager
()){
Wi
.
copier
.
copy
(
wi
,
empower
);
this
.
check
(
business
,
empower
);
String
fromPerson
=
this
.
getPersonDNWithIdentityDN
(
business
,
empower
.
getFromIdentity
());
if
(
StringUtils
.
isEmpty
(
fromPerson
))
{
throw
new
ExceptionPersonNotExistWithIdentity
(
empower
.
getFromIdentity
());
}
else
{
empower
.
setFromPerson
(
fromPerson
);
}
String
toPerson
=
this
.
getPersonDNWithIdentityDN
(
business
,
empower
.
getToIdentity
());
if
(
StringUtils
.
isEmpty
(
toPerson
))
{
throw
new
ExceptionPersonNotExistWithIdentity
(
empower
.
getToIdentity
());
}
else
{
empower
.
setToPerson
(
toPerson
);
}
emc
.
beginTransaction
(
Empower
.
class
);
emc
.
check
(
empower
,
CheckPersistType
.
all
);
emc
.
commit
();
ApplicationCache
.
notify
(
Empower
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
empower
.
getId
());
result
.
setData
(
wo
);
}
return
result
;
}
}
public
static
class
Wi
extends
Empower
{
private
static
final
long
serialVersionUID
=
200222480341620744L
;
static
WrapCopier
<
Wi
,
Empower
>
copier
=
WrapCopierFactory
.
wi
(
Wi
.
class
,
Empower
.
class
,
null
,
JpaObject
.
FieldsUnmodify
);
}
public
static
class
Wo
extends
WoId
{
}
}
o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/empower/EmpowerAction.java
浏览文件 @
5c8075f2
...
...
@@ -195,13 +195,48 @@ public class EmpowerAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员创建授权"
,
action
=
ActionManagerCreate
.
class
)
@Path
(
"manager"
)
@POST
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerCreate
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionManagerCreate
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerCreate
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员更新授权"
,
action
=
ActionManagerEdit
.
class
)
@PUT
@Path
(
"manager/{id}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerEdit
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionManagerEdit
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerEdit
().
execute
(
effectivePerson
,
id
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"更新授权"
,
action
=
ActionEdit
.
class
)
@PUT
@Path
(
"{id}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
edit
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
,
JsonElement
jsonElement
)
{
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionEdit
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
...
...
@@ -212,7 +247,6 @@ public class EmpowerAction extends StandardJaxrsAction {
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"删除授权"
,
action
=
ActionDelete
.
class
)
@DELETE
@Path
(
"{id}"
)
...
...
@@ -231,6 +265,24 @@ public class EmpowerAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员删除授权"
,
action
=
ActionManagerDelete
.
class
)
@DELETE
@Path
(
"/manager/{id}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerDelete
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
ActionManagerDelete
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerDelete
().
execute
(
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"启用授权"
,
action
=
ActionEnable
.
class
)
@GET
@Path
(
"{id}/enable"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录