Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
1f46351c
o2oa
项目概览
此号慢热型
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f46351c
编写于
6月 28, 2020
作者:
S
st
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[流程管理]增加管理员接口,根据传入用户,获取可见的Application,并绑定其可见的Porcess
上级
f78b5912
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
219 addition
and
0 deletion
+219
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/application/ActionManageListWithPersonComplex.java
.../jaxrs/application/ActionManageListWithPersonComplex.java
+201
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/application/ApplicationAction.java
...assemble/surface/jaxrs/application/ApplicationAction.java
+18
-0
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/application/ActionManageListWithPersonComplex.java
0 → 100644
浏览文件 @
1f46351c
package
com.x.processplatform.assemble.surface.jaxrs.application
;
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.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Application_
;
import
com.x.processplatform.core.entity.element.Process
;
import
com.x.processplatform.core.entity.element.Process_
;
import
org.apache.commons.collections4.ListUtils
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.ArrayList
;
import
java.util.List
;
class
ActionManageListWithPersonComplex
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
person
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
new
ArrayList
<>();
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isManager
()){
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
person
);
/** 去除部门以及上级部门,如果设置了一级部门可用,那么一级部门下属的二级部门也可用 */
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPersonSupNested
(
person
);
List
<
String
>
roles
=
business
.
organization
().
role
().
listWithPerson
(
person
);
List
<
String
>
ids
=
this
.
list
(
business
,
effectivePerson
,
roles
,
identities
,
units
);
for
(
String
id
:
ids
)
{
Application
o
=
business
.
application
().
pick
(
id
);
if
(
null
!=
o
)
{
Wo
wo
=
Wo
.
copier
.
copy
(
o
);
wo
.
setProcessList
(
this
.
referenceProcess
(
business
,
effectivePerson
,
identities
,
units
,
o
));
wos
.
add
(
wo
);
}
}
wos
=
business
.
application
().
sort
(
wos
);
result
.
setData
(
wos
);
}
return
result
;
}
}
public
static
class
Wo
extends
Application
{
private
static
final
long
serialVersionUID
=
1176431364379021779L
;
static
WrapCopier
<
Application
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Application
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
@FieldDescribe
(
"流程对象"
)
private
List
<
WoProcess
>
processList
;
@FieldDescribe
(
"是否可编辑"
)
private
Boolean
allowControl
;
public
Boolean
getAllowControl
()
{
return
allowControl
;
}
public
void
setAllowControl
(
Boolean
allowControl
)
{
this
.
allowControl
=
allowControl
;
}
public
List
<
WoProcess
>
getProcessList
()
{
return
processList
;
}
public
void
setProcessList
(
List
<
WoProcess
>
processList
)
{
this
.
processList
=
processList
;
}
}
public
static
class
WoProcess
extends
Process
{
private
static
final
long
serialVersionUID
=
8239383153729965245L
;
public
static
List
<
String
>
Excludes
=
new
ArrayList
<>(
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Process
,
WoProcess
>
copier
=
WrapCopierFactory
.
wo
(
Process
.
class
,
WoProcess
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
/**
* 从可见的application中获取一份ids<br/>
* 从可启动的process中获取一份ids <br/>
* 两份ids的交集,这样避免列示只有application没有可以启动process的应用
*/
private
List
<
String
>
list
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
roles
,
List
<
String
>
identities
,
List
<
String
>
units
)
throws
Exception
{
List
<
String
>
ids
=
this
.
listFromApplication
(
business
,
effectivePerson
,
roles
,
identities
,
units
);
List
<
String
>
fromProcessIds
=
this
.
listFromProcess
(
business
,
effectivePerson
,
roles
,
identities
,
units
);
return
ListUtils
.
intersection
(
ids
,
fromProcessIds
);
}
private
List
<
String
>
listFromApplication
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
roles
,
List
<
String
>
identities
,
List
<
String
>
units
)
throws
Exception
{
List
<
String
>
list
=
new
ArrayList
<>();
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Application
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Application
>
root
=
cq
.
from
(
Application
.
class
);
Predicate
p
=
cb
.
and
(
cb
.
isEmpty
(
root
.
get
(
Application_
.
availableIdentityList
)),
cb
.
isEmpty
(
root
.
get
(
Application_
.
availableUnitList
)));
if
(
ListTools
.
isNotEmpty
(
identities
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Application_
.
availableIdentityList
).
in
(
identities
));
}
if
(
ListTools
.
isNotEmpty
(
units
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Application_
.
availableUnitList
).
in
(
units
));
}
cq
.
where
(
p
);
list
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Application_
.
id
)).
distinct
(
true
)).
getResultList
();
return
list
;
}
/**
*
* 从Process中获取可以启动的Process的application.
*/
private
List
<
String
>
listFromProcess
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
roles
,
List
<
String
>
identities
,
List
<
String
>
units
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Process
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Process
>
root
=
cq
.
from
(
Process
.
class
);
Predicate
p
=
cb
.
conjunction
();
p
=
cb
.
and
(
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableIdentityList
)),
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableUnitList
)));
if
(
ListTools
.
isNotEmpty
(
identities
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Process_
.
startableIdentityList
).
in
(
identities
));
}
if
(
ListTools
.
isNotEmpty
(
units
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Process_
.
startableUnitList
).
in
(
units
));
}
cq
.
select
(
root
.
get
(
Process_
.
application
)).
distinct
(
true
).
where
(
p
);
return
em
.
createQuery
(
cq
).
getResultList
();
}
private
List
<
WoProcess
>
referenceProcess
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
identities
,
List
<
String
>
units
,
Application
application
)
throws
Exception
{
List
<
String
>
ids
=
this
.
listStartableWithApplication
(
business
,
effectivePerson
,
identities
,
units
,
application
);
List
<
WoProcess
>
wos
=
new
ArrayList
<>();
for
(
String
id
:
ids
)
{
WoProcess
o
=
WoProcess
.
copier
.
copy
(
business
.
process
().
pick
(
id
));
wos
.
add
(
o
);
}
wos
=
business
.
process
().
sort
(
wos
);
return
wos
;
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
private
List
<
String
>
listStartableWithApplication
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
identities
,
List
<
String
>
units
,
Application
application
)
throws
Exception
{
List
<
String
>
list
=
new
ArrayList
<>();
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Process
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Process
>
root
=
cq
.
from
(
Process
.
class
);
Predicate
p
=
cb
.
conjunction
();
p
=
cb
.
and
(
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableIdentityList
)),
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableUnitList
)));
if
(
ListTools
.
isNotEmpty
(
identities
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Process_
.
startableIdentityList
).
in
(
identities
));
}
if
(
ListTools
.
isNotEmpty
(
units
))
{
p
=
cb
.
or
(
p
,
root
.
get
(
Process_
.
startableUnitList
).
in
(
units
));
}
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Process_
.
application
),
application
.
getId
()));
p
=
cb
.
and
(
p
,
cb
.
or
(
cb
.
isTrue
(
root
.
get
(
Process_
.
editionEnable
)),
cb
.
isNull
(
root
.
get
(
Process_
.
editionEnable
))));
cq
.
select
(
root
.
get
(
Process_
.
id
)).
where
(
p
).
distinct
(
true
);
list
=
em
.
createQuery
(
cq
).
getResultList
();
return
list
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/application/ApplicationAction.java
浏览文件 @
1f46351c
...
...
@@ -102,6 +102,24 @@ public class ApplicationAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"根据传入用户,获取可见的Application,并绑定其可见的Porcess"
,
action
=
ActionManageListWithPersonComplex
.
class
)
@GET
@Path
(
"list/complex/manage/{person}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
manageListWithPersonComplex
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"用户"
)
@PathParam
(
"person"
)
String
person
)
{
ActionResult
<
List
<
ActionManageListWithPersonComplex
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManageListWithPersonComplex
().
execute
(
effectivePerson
,
person
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"仅获取指定Application的Icon,没有权限限制"
,
action
=
ActionGetIcon
.
class
)
@GET
@Path
(
"{flag}/icon"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录