Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
dd868cfc
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,发现更多精彩内容 >>
提交
dd868cfc
编写于
6月 30, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加流程移动端可启动标识
上级
b5f103a9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
136 addition
and
40 deletion
+136
-40
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/factory/element/ProcessFactory.java
...form/assemble/surface/factory/element/ProcessFactory.java
+0
-29
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionListWithPersonWithApplicationFilter.java
...rs/process/ActionListWithPersonWithApplicationFilter.java
+123
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ProcessAction.java
...latform/assemble/surface/jaxrs/process/ProcessAction.java
+8
-6
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Process.java
...va/com/x/processplatform/core/entity/element/Process.java
+5
-5
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/factory/element/ProcessFactory.java
浏览文件 @
dd868cfc
...
...
@@ -187,35 +187,6 @@ public class ProcessFactory extends ElementFactory {
return
em
.
createQuery
(
cq
).
getResultList
();
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
public
List
<
String
>
listStartableWithApplicationTerminalMobile
(
EffectivePerson
effectivePerson
,
List
<
String
>
identities
,
List
<
String
>
units
,
Application
application
)
throws
Exception
{
EntityManager
em
=
this
.
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
();
if
(
effectivePerson
.
isNotManager
()
&&
(!
this
.
business
().
organization
().
person
().
hasRole
(
effectivePerson
,
OrganizationDefinition
.
Manager
,
OrganizationDefinition
.
ProcessPlatformManager
)))
{
p
=
cb
.
and
(
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableIdentityList
)),
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableUnitList
)));
p
=
cb
.
or
(
p
,
cb
.
equal
(
root
.
get
(
Process_
.
creatorPerson
),
effectivePerson
.
getDistinguishedName
()));
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
))));
// 不指名仅在client端可启动那么可启动
p
=
cb
.
and
(
p
,
cb
.
or
(
cb
.
isNull
(
root
.
get
(
Process_
.
startableTerminal
)),
cb
.
notEqual
(
root
.
get
(
Process_
.
startableTerminal
),
Process
.
DEFAULTSTARTABLETERMINAL_CLIENT
)));
cq
.
select
(
root
.
get
(
Process_
.
id
)).
where
(
p
).
distinct
(
true
);
return
em
.
createQuery
(
cq
).
getResultList
();
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
public
boolean
startable
(
EffectivePerson
effectivePerson
,
List
<
String
>
identities
,
List
<
String
>
units
,
Process
process
)
throws
Exception
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionListWithPersonWithApplication
TerminalMobile
.java
→
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionListWithPersonWithApplication
Filter
.java
浏览文件 @
dd868cfc
...
...
@@ -3,24 +3,41 @@ package com.x.processplatform.assemble.surface.jaxrs.process;
import
java.util.ArrayList
;
import
java.util.List
;
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
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.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.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
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.organization.OrganizationDefinition
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.SortTools
;
import
com.x.processplatform.assemble.surface.Business
;
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.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionListWithPersonWithApplication
TerminalMobile
extends
BaseAction
{
class
ActionListWithPersonWithApplication
Filter
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
applicationFlag
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
applicationFlag
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
List
<
Wo
>
wos
=
new
ArrayList
<>();
...
...
@@ -35,8 +52,7 @@ class ActionListWithPersonWithApplicationTerminalMobile extends BaseAction {
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
List
<
String
>
ids
=
business
.
process
().
listStartableWithApplicationTerminalMobile
(
effectivePerson
,
identities
,
units
,
application
);
List
<
String
>
ids
=
list
(
business
,
effectivePerson
,
identities
,
units
,
application
,
wi
);
for
(
String
id
:
ids
)
{
wos
.
add
(
Wo
.
copier
.
copy
(
business
.
process
().
pick
(
id
)));
}
...
...
@@ -46,6 +62,44 @@ class ActionListWithPersonWithApplicationTerminalMobile extends BaseAction {
}
}
public
List
<
String
>
list
(
Business
business
,
EffectivePerson
effectivePerson
,
List
<
String
>
identities
,
List
<
String
>
units
,
Application
application
,
Wi
wi
)
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
();
if
(
effectivePerson
.
isNotManager
()
&&
(
BooleanUtils
.
isTrue
(
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
OrganizationDefinition
.
Manager
,
OrganizationDefinition
.
ProcessPlatformManager
))))
{
p
=
cb
.
and
(
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableIdentityList
)),
cb
.
isEmpty
(
root
.
get
(
Process_
.
startableUnitList
)));
p
=
cb
.
or
(
p
,
cb
.
equal
(
root
.
get
(
Process_
.
creatorPerson
),
effectivePerson
.
getDistinguishedName
()));
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
))));
if
(
StringUtils
.
equals
(
wi
.
getStartableTerminal
(),
Process
.
STARTABLETERMINAL_CLIENT
))
{
p
=
cb
.
and
(
p
,
cb
.
or
(
cb
.
isNull
(
root
.
get
(
Process_
.
startableTerminal
)),
cb
.
equal
(
root
.
get
(
Process_
.
startableTerminal
),
Process
.
STARTABLETERMINAL_CLIENT
),
cb
.
equal
(
root
.
get
(
Process_
.
startableTerminal
),
Process
.
STARTABLETERMINAL_ALL
)));
}
else
if
(
StringUtils
.
equals
(
wi
.
getStartableTerminal
(),
Process
.
STARTABLETERMINAL_MOBILE
))
{
p
=
cb
.
and
(
p
,
cb
.
or
(
cb
.
isNull
(
root
.
get
(
Process_
.
startableTerminal
)),
cb
.
equal
(
root
.
get
(
Process_
.
startableTerminal
),
Process
.
STARTABLETERMINAL_MOBILE
),
cb
.
equal
(
root
.
get
(
Process_
.
startableTerminal
),
Process
.
STARTABLETERMINAL_ALL
)));
}
cq
.
select
(
root
.
get
(
Process_
.
id
)).
where
(
p
).
distinct
(
true
);
return
em
.
createQuery
(
cq
).
getResultList
();
}
public
static
class
Wo
extends
Process
{
private
static
final
long
serialVersionUID
=
1521228691441978462L
;
...
...
@@ -53,4 +107,17 @@ class ActionListWithPersonWithApplicationTerminalMobile extends BaseAction {
static
WrapCopier
<
Process
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Process
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"可启动流程终端类型,可选值 client,mobile,all"
)
private
String
startableTerminal
;
public
String
getStartableTerminal
()
{
return
startableTerminal
;
}
public
void
setStartableTerminal
(
String
startableTerminal
)
{
this
.
startableTerminal
=
startableTerminal
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ProcessAction.java
浏览文件 @
dd868cfc
...
...
@@ -100,18 +100,20 @@ public class ProcessAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"根据指定Application
获取mobile端可启动的流程."
,
action
=
ActionListWithPersonWithApplicationTerminalMobile
.
class
)
@JaxrsMethodDescribe
(
value
=
"根据指定Application
和指定条件获取可启动的流程."
,
action
=
ActionListWithPersonWithApplicationFilter
.
class
)
@GET
@Path
(
"list/application/{applicationFlag}/
terminal/mobile
"
)
@Path
(
"list/application/{applicationFlag}/
filter
"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithPersonWithApplication
TerminalMobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
public
void
listWithPersonWithApplication
Filter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"应用标识"
)
@PathParam
(
"applicationFlag"
)
String
applicationFlag
)
{
ActionResult
<
List
<
ActionListWithPersonWithApplicationTerminalMobile
.
Wo
>>
result
=
new
ActionResult
<>();
@JaxrsParameterDescribe
(
"应用标识"
)
@PathParam
(
"applicationFlag"
)
String
applicationFlag
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionListWithPersonWithApplicationFilter
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithPersonWithApplicationTerminalMobile
().
execute
(
effectivePerson
,
applicationFlag
);
result
=
new
ActionListWithPersonWithApplicationFilter
().
execute
(
effectivePerson
,
applicationFlag
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Process.java
浏览文件 @
dd868cfc
...
...
@@ -46,12 +46,12 @@ public class Process extends SliceJpaObject {
public
static
final
String
SERIALPHASE_ARRIVE
=
"arrive"
;
public
static
final
String
SERIALPHASE_INQUIRE
=
"inquire"
;
public
static
final
String
DEFAULT
STARTMODE_DRAFT
=
"draft"
;
public
static
final
String
DEFAULT
STARTMODE_INSTANCE
=
"instance"
;
public
static
final
String
STARTMODE_DRAFT
=
"draft"
;
public
static
final
String
STARTMODE_INSTANCE
=
"instance"
;
public
static
final
String
DEFAULT
STARTABLETERMINAL_CLIENT
=
"client"
;
public
static
final
String
DEFAULT
STARTABLETERMINAL_MOBILE
=
"mobile"
;
public
static
final
String
DEFAULT
STARTABLETERMINAL_ALL
=
"all"
;
public
static
final
String
STARTABLETERMINAL_CLIENT
=
"client"
;
public
static
final
String
STARTABLETERMINAL_MOBILE
=
"mobile"
;
public
static
final
String
STARTABLETERMINAL_ALL
=
"all"
;
public
String
getId
()
{
return
id
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录