Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
ff37826c
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff37826c
编写于
4月 17, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、增加管理员撤回流程接口
上级
2c20e512
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
248 addition
and
0 deletion
+248
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionManagerRetract.java
...orm/assemble/surface/jaxrs/work/ActionManagerRetract.java
+229
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java
...ocessplatform/assemble/surface/jaxrs/work/WorkAction.java
+19
-0
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionManagerRetract.java
0 → 100644
浏览文件 @
ff37826c
package
com.x.processplatform.assemble.surface.jaxrs.work
;
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.Applications
;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.config.Config
;
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.WoId
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.PropertyTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.*
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.element.ActivityType
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Manual
;
import
com.x.processplatform.core.entity.element.util.WorkLogTree
;
import
com.x.processplatform.core.entity.element.util.WorkLogTree.Node
;
import
com.x.processplatform.core.entity.element.util.WorkLogTree.Nodes
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.service.processing.jaxrs.work.V2RetractWi
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
class
ActionManagerRetract
extends
BaseAction
{
@ActionLogger
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManagerRetract
.
class
);
private
WorkLog
workLog
;
private
TaskCompleted
taskCompleted
;
private
Work
work
;
private
String
series
=
StringTools
.
uniqueToken
();
private
Record
record
;
private
List
<
String
>
existTaskIds
=
new
ArrayList
<>();
private
EffectivePerson
effectivePerson
;
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
person
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
this
.
effectivePerson
=
effectivePerson
;
String
distinguishedName
=
business
.
organization
().
person
().
get
(
person
);
work
=
emc
.
find
(
id
,
Work
.
class
);
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Work
.
class
);
}
Application
application
=
business
.
application
().
pick
(
work
.
getApplication
());
if
(
null
==
application
)
{
throw
new
ExceptionEntityNotExist
(
work
.
getApplication
(),
Application
.
class
);
}
if
(!
business
.
application
().
allowControl
(
effectivePerson
,
application
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
Activity
activity
=
business
.
getActivity
(
work
);
if
(
null
==
activity
)
{
throw
new
ExceptionEntityNotExist
(
work
.
getActivity
());
}
WorkLogTree
workLogTree
=
new
WorkLogTree
(
emc
.
listEqual
(
WorkLog
.
class
,
WorkLog
.
job_FIELDNAME
,
work
.
getJob
()));
/* 是否可以召回 */
if
(
PropertyTools
.
getOrElse
(
activity
,
Manual
.
allowRetract_FIELDNAME
,
Boolean
.
class
,
false
))
{
Node
node
=
workLogTree
.
location
(
work
);
if
(
null
!=
node
)
{
Nodes
ups
=
node
.
upTo
(
ActivityType
.
manual
,
ActivityType
.
agent
,
ActivityType
.
choice
,
ActivityType
.
delay
,
ActivityType
.
embed
,
ActivityType
.
invoke
,
ActivityType
.
parallel
,
ActivityType
.
split
);
for
(
Node
o
:
ups
)
{
if
(
business
.
entityManagerContainer
().
countEqualAndEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
person_FIELDNAME
,
distinguishedName
,
TaskCompleted
.
activityToken_FIELDNAME
,
o
.
getWorkLog
().
getFromActivityToken
())
>
0
)
{
workLog
=
o
.
getWorkLog
();
break
;
}
}
}
}
existTaskIds
=
emc
.
idsEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
());
if
(
null
==
workLog
)
{
throw
new
ExceptionRetractNoWorkLog
(
work
.
getId
());
}
if
(
emc
.
countEqualAndEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
work
.
getJob
(),
TaskCompleted
.
activityToken_FIELDNAME
,
work
.
getActivityToken
())
>
0
)
{
throw
new
ExceptionRetractNoneTaskCompleted
(
work
.
getTitle
(),
work
.
getId
());
}
taskCompleted
=
emc
.
firstEqualAndEqualAndEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
workLog
.
getJob
(),
TaskCompleted
.
activityToken_FIELDNAME
,
workLog
.
getFromActivityToken
(),
TaskCompleted
.
person_FIELDNAME
,
distinguishedName
);
if
(
null
==
taskCompleted
)
{
throw
new
ExceptionNoTaskCompletedToRetract
(
workLog
.
getId
(),
distinguishedName
);
}
}
this
.
retract
();
this
.
processing
();
this
.
record
();
result
.
setData
(
Wo
.
copier
.
copy
(
record
));
return
result
;
}
private
void
retract
()
throws
Exception
{
Req
req
=
new
Req
();
req
.
setTaskCompleted
(
taskCompleted
.
getId
());
req
.
setWorkLog
(
workLog
.
getId
());
WrapBoolean
resp
=
ThisApplication
.
context
().
applications
()
.
putQuery
(
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"work"
,
"v2"
,
this
.
work
.
getId
(),
"retract"
),
req
,
work
.
getJob
())
.
getData
(
WrapBoolean
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
resp
.
getValue
()))
{
throw
new
ExceptionRetract
(
this
.
work
.
getId
());
}
}
private
void
processing
()
throws
Exception
{
ProcessingAttributes
req
=
new
ProcessingAttributes
();
req
.
setType
(
ProcessingAttributes
.
TYPE_RETRACT
);
req
.
setSeries
(
series
);
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
putQuery
(
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"work"
,
this
.
work
.
getId
(),
"processing"
),
req
,
work
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
throw
new
ExceptionRetract
(
this
.
work
.
getId
());
}
}
private
void
record
()
throws
Exception
{
record
=
new
Record
(
workLog
);
record
.
setType
(
Record
.
TYPE_RETRACT
);
record
.
getProperties
().
setElapsed
(
Config
.
workTime
().
betweenMinutes
(
record
.
getProperties
().
getStartTime
(),
record
.
getRecordTime
()));
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
work
=
emc
.
find
(
work
.
getId
(),
Work
.
class
);
if
(
null
!=
work
)
{
record
.
setArrivedActivity
(
work
.
getActivity
());
record
.
setArrivedActivityType
(
work
.
getActivityType
());
record
.
setArrivedActivityToken
(
work
.
getActivityToken
());
record
.
setArrivedActivityName
(
work
.
getActivityName
());
record
.
setArrivedActivityAlias
(
work
.
getActivityAlias
());
record
.
setIdentity
(
taskCompleted
.
getIdentity
());
record
.
setPerson
(
taskCompleted
.
getPerson
());
record
.
setUnit
(
taskCompleted
.
getUnit
());
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
List
<
String
>
ids
=
emc
.
idsEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
());
ids
=
ListUtils
.
subtract
(
ids
,
existTaskIds
);
List
<
Task
>
list
=
emc
.
fetch
(
ids
,
Task
.
class
,
ListTools
.
toList
(
Task
.
identity_FIELDNAME
,
Task
.
job_FIELDNAME
,
Task
.
work_FIELDNAME
,
Task
.
activity_FIELDNAME
,
Task
.
activityAlias_FIELDNAME
,
Task
.
activityName_FIELDNAME
,
Task
.
activityToken_FIELDNAME
,
Task
.
activityType_FIELDNAME
,
Task
.
identity_FIELDNAME
));
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
Task:
:
getActivity
,
Collectors
.
toList
())).
entrySet
().
stream
()
.
forEach
(
o
->
{
Task
task
=
o
.
getValue
().
get
(
0
);
NextManual
nextManual
=
new
NextManual
();
nextManual
.
setActivity
(
task
.
getActivity
());
nextManual
.
setActivityAlias
(
task
.
getActivityAlias
());
nextManual
.
setActivityName
(
task
.
getActivityName
());
nextManual
.
setActivityToken
(
task
.
getActivityToken
());
nextManual
.
setActivityType
(
task
.
getActivityType
());
for
(
Task
t
:
o
.
getValue
())
{
nextManual
.
getTaskIdentityList
().
add
(
t
.
getIdentity
());
nextTaskIdentities
.
add
(
t
.
getIdentity
());
}
record
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
});
/* 去重 */
record
.
getProperties
().
setNextManualTaskIdentityList
(
ListTools
.
trim
(
nextTaskIdentities
,
true
,
true
));
}
}
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"record"
,
"job"
,
work
.
getJob
()),
record
,
this
.
work
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
throw
new
ExceptionRetract
(
this
.
work
.
getId
());
}
}
public
static
class
Req
extends
V2RetractWi
{
}
public
static
class
Wo
extends
Record
{
private
static
final
long
serialVersionUID
=
-
5007785846454720742L
;
static
WrapCopier
<
Record
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Record
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java
浏览文件 @
ff37826c
...
...
@@ -995,4 +995,23 @@ public class WorkAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员替代person操作工作召回。"
,
action
=
ActionManagerRetract
.
class
)
@PUT
@Path
(
"v2/{id}/person/{person}/retract/manager"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerRetract
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作标识"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"召回工作已办人员(根据流转记录确认)"
)
@PathParam
(
"person"
)
String
person
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionManagerRetract
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerRetract
().
execute
(
effectivePerson
,
id
,
person
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录