Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
ed673f54
o2oa
项目概览
weixin_42566577
/
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,发现更多精彩内容 >>
提交
ed673f54
编写于
5月 30, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加matrix返回
上级
e7e55368
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
531 addition
and
297 deletion
+531
-297
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ExceptionRecordProcessing.java
...splatform/assemble/surface/ExceptionRecordProcessing.java
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/RecordBuilder.java
...com/x/processplatform/assemble/surface/RecordBuilder.java
+149
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/TaskBuilder.java
...a/com/x/processplatform/assemble/surface/TaskBuilder.java
+70
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/TaskCompletedBuilder.java
...rocessplatform/assemble/surface/TaskCompletedBuilder.java
+36
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
...latform/assemble/surface/jaxrs/task/ActionProcessing.java
+81
-75
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/BaseAction.java
...ocessplatform/assemble/surface/jaxrs/task/BaseAction.java
+115
-125
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Add.java
.../x/processplatform/assemble/surface/jaxrs/task/V2Add.java
+26
-66
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Reset.java
.../processplatform/assemble/surface/jaxrs/task/V2Reset.java
+11
-15
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2AddManualTaskIdentityMatrix.java
...ble/surface/jaxrs/work/V2AddManualTaskIdentityMatrix.java
+41
-11
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
...ava/com/x/processplatform/core/entity/content/Record.java
+1
-4
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/
jaxrs/task/
ExceptionRecordProcessing.java
→
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ExceptionRecordProcessing.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface
.jaxrs.task
;
package
com.x.processplatform.assemble.surface
;
import
com.x.base.core.project.exception.LanguagePromptException
;
import
com.x.base.core.project.exception.LanguagePromptException
;
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/
jaxrs/task/
RecordBuilder.java
→
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/RecordBuilder.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface
.jaxrs.task
;
package
com.x.processplatform.assemble.surface
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections4.list.UnmodifiableList
;
import
org.apache.commons.collections4.set.ListOrderedSet
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.EntityManagerContainer
;
...
@@ -11,25 +15,29 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
...
@@ -11,25 +15,29 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.element.Activity
;
public
class
RecordBuilder
{
public
class
RecordBuilder
{
private
static
final
List
<
String
>
TASK_FETCH_FIELDS
=
UnmodifiableList
.
unmodifiableList
(
Arrays
.
asList
(
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
));
private
RecordBuilder
()
{
private
RecordBuilder
()
{
// nothing
// nothing
}
}
public
static
Record
ofTaskProcessing
(
String
recordType
,
WorkLog
workLog
,
Task
task
,
String
taskCompletedId
,
public
static
Record
ofTaskProcessing
(
String
recordType
,
WorkLog
workLog
,
Task
task
,
String
taskCompletedId
,
List
<
Task
>
newlyTask
s
)
throws
Exception
{
List
<
String
>
newlyTaskId
s
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
Record
rec
=
new
Record
(
workLog
,
task
);
Record
rec
=
new
Record
(
workLog
,
task
);
...
@@ -55,23 +63,6 @@ public class RecordBuilder {
...
@@ -55,23 +63,6 @@ public class RecordBuilder {
}
}
rec
.
getProperties
().
setElapsed
(
rec
.
getProperties
().
setElapsed
(
Config
.
workTime
().
betweenMinutes
(
rec
.
getProperties
().
getStartTime
(),
rec
.
getRecordTime
()));
Config
.
workTime
().
betweenMinutes
(
rec
.
getProperties
().
getStartTime
(),
rec
.
getRecordTime
()));
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
newlyTasks
.
stream
().
collect
(
Collectors
.
groupingBy
(
Task:
:
getActivity
,
Collectors
.
toList
())).
entrySet
()
.
stream
().
forEach
(
o
->
{
NextManual
nextManual
=
new
NextManual
();
nextManual
.
setActivity
(
o
.
getValue
().
get
(
0
).
getActivity
());
nextManual
.
setActivityAlias
(
o
.
getValue
().
get
(
0
).
getActivityAlias
());
nextManual
.
setActivityName
(
o
.
getValue
().
get
(
0
).
getActivityName
());
nextManual
.
setActivityToken
(
o
.
getValue
().
get
(
0
).
getActivityToken
());
nextManual
.
setActivityType
(
o
.
getValue
().
get
(
0
).
getActivityType
());
for
(
Task
t
:
o
.
getValue
())
{
nextManual
.
getTaskIdentityList
().
add
(
t
.
getIdentity
());
nextTaskIdentities
.
add
(
t
.
getIdentity
());
}
rec
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
});
// 去重
rec
.
getProperties
().
setNextManualTaskIdentityList
(
ListTools
.
trim
(
nextTaskIdentities
,
true
,
true
));
TaskCompleted
taskCompleted
=
emc
.
find
(
taskCompletedId
,
TaskCompleted
.
class
);
TaskCompleted
taskCompleted
=
emc
.
find
(
taskCompletedId
,
TaskCompleted
.
class
);
if
(
null
!=
taskCompleted
)
{
if
(
null
!=
taskCompleted
)
{
// 处理完成后在重新写入待办信息
// 处理完成后在重新写入待办信息
...
@@ -79,10 +70,70 @@ public class RecordBuilder {
...
@@ -79,10 +70,70 @@ public class RecordBuilder {
rec
.
getProperties
().
setRouteName
(
taskCompleted
.
getRouteName
());
rec
.
getProperties
().
setRouteName
(
taskCompleted
.
getRouteName
());
rec
.
getProperties
().
setMediaOpinion
(
taskCompleted
.
getMediaOpinion
());
rec
.
getProperties
().
setMediaOpinion
(
taskCompleted
.
getMediaOpinion
());
}
}
setNextManualListAndNextManualTaskIdentityList
(
business
,
newlyTaskIds
,
rec
);
return
rec
;
return
rec
;
}
}
}
}
public
static
Record
ofWorkProcessing
(
String
recordType
,
WorkLog
workLog
,
EffectivePerson
effectivePerson
,
Activity
destinationActivity
,
List
<
String
>
newlyTaskIds
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Record
rec
=
new
Record
(
workLog
);
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
workLog
.
getJob
());
if
(
null
!=
workCompleted
)
{
rec
.
setCompleted
(
true
);
rec
.
setWorkCompleted
(
workCompleted
.
getId
());
}
rec
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
rec
.
setType
(
recordType
);
rec
.
setArrivedActivity
(
destinationActivity
.
getId
());
rec
.
setArrivedActivityAlias
(
destinationActivity
.
getAlias
());
rec
.
setArrivedActivityName
(
destinationActivity
.
getName
());
rec
.
setArrivedActivityType
(
destinationActivity
.
getActivityType
());
rec
.
getProperties
().
setElapsed
(
Config
.
workTime
().
betweenMinutes
(
rec
.
getProperties
().
getStartTime
(),
rec
.
getRecordTime
()));
/* 需要记录处理人,先查看当前用户有没有之前处理过的信息,如果没有,取默认身份 */
TaskCompleted
existTaskCompleted
=
emc
.
firstEqualAndEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
workLog
.
getJob
(),
TaskCompleted
.
person_FIELDNAME
,
effectivePerson
.
getDistinguishedName
());
rec
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
if
(
null
!=
existTaskCompleted
)
{
rec
.
setIdentity
(
existTaskCompleted
.
getIdentity
());
rec
.
setUnit
(
existTaskCompleted
.
getUnit
());
}
else
{
rec
.
setIdentity
(
business
.
organization
().
identity
().
getMajorWithPerson
(
effectivePerson
.
getDistinguishedName
()));
rec
.
setUnit
(
business
.
organization
().
unit
().
getWithIdentity
(
rec
.
getIdentity
()));
}
setNextManualListAndNextManualTaskIdentityList
(
business
,
newlyTaskIds
,
rec
);
return
rec
;
}
}
private
static
void
setNextManualListAndNextManualTaskIdentityList
(
Business
business
,
List
<
String
>
newlyTaskIds
,
Record
rec
)
throws
Exception
{
Set
<
String
>
identities
=
new
ListOrderedSet
<>();
business
.
entityManagerContainer
().
fetch
(
newlyTaskIds
,
Task
.
class
,
TASK_FETCH_FIELDS
).
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
());
o
.
getValue
().
stream
().
forEach
(
t
->
{
identities
.
add
(
t
.
getIdentity
());
nextManual
.
getTaskIdentityList
().
add
(
t
.
getIdentity
());
});
rec
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
});
rec
.
getProperties
().
setNextManualTaskIdentityList
(
new
ArrayList
<>(
identities
));
}
public
static
String
processing
(
Record
r
)
throws
Exception
{
public
static
String
processing
(
Record
r
)
throws
Exception
{
WoId
resp
=
ThisApplication
.
context
().
applications
()
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
false
,
x_processplatform_service_processing
.
class
,
.
postQuery
(
false
,
x_processplatform_service_processing
.
class
,
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/TaskBuilder.java
0 → 100644
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface
;
import
java.util.Date
;
import
java.util.List
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity.PrevTask
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
public
class
TaskBuilder
{
private
TaskBuilder
()
{
// nothing
}
/**
* 更新待办的上一处理人
*
* @param newlyTaskIds
* @param prevSeriesTaskCompleteds
* @param task
* @throws Exception
*/
public
static
void
updatePrevTaskIdentity
(
List
<
String
>
newlyTaskIds
,
List
<
TaskCompleted
>
prevSeriesTaskCompleteds
,
Task
task
)
throws
Exception
{
// 记录上一处理人信息
if
(
ListTools
.
isNotEmpty
(
newlyTaskIds
))
{
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
req
.
setTaskList
(
newlyTaskIds
);
prevSeriesTaskCompleteds
.
stream
().
forEach
(
o
->
{
PrevTask
prevTask
=
new
PrevTask
();
prevTask
.
setCompletedTime
(
o
.
getCompletedTime
());
prevTask
.
setStartTime
(
o
.
getStartTime
());
prevTask
.
setOpinion
(
o
.
getOpinion
());
prevTask
.
setPerson
(
o
.
getPerson
());
prevTask
.
setIdentity
(
o
.
getIdentity
());
prevTask
.
setUnit
(
o
.
getUnit
());
prevTask
.
setRouteName
(
o
.
getRouteName
());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
req
.
getPrevTaskList
().
add
(
prevTask
);
});
PrevTask
prevTask
=
new
PrevTask
();
prevTask
.
setCompletedTime
(
new
Date
());
prevTask
.
setStartTime
(
task
.
getStartTime
());
prevTask
.
setOpinion
(
task
.
getOpinion
());
prevTask
.
setPerson
(
task
.
getPerson
());
prevTask
.
setIdentity
(
task
.
getIdentity
());
prevTask
.
setUnit
(
task
.
getUnit
());
prevTask
.
setRouteName
(
task
.
getRouteName
());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
req
.
setPrevTaskIdentity
(
prevTask
.
getIdentity
());
req
.
getPrevTaskList
().
add
(
prevTask
);
req
.
setPrevTask
(
prevTask
);
// 去重
req
.
setPrevTaskIdentityList
(
ListTools
.
trim
(
req
.
getPrevTaskIdentityList
(),
true
,
true
));
ThisApplication
.
context
().
applications
()
.
putQuery
(
false
,
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"task"
,
"prev"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
.
getData
(
WrapBoolean
.
class
);
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/TaskCompletedBuilder.java
0 → 100644
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface
;
import
java.util.List
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
public
class
TaskCompletedBuilder
{
private
TaskCompletedBuilder
()
{
// nothing
}
/**
* 更新已经存在已办的下一处理人
*
* @param taskCompletedId
* @param identities
* @param job
* @throws Exception
*/
public
static
void
updateNextTaskIdentity
(
String
taskCompletedId
,
List
<
String
>
identities
,
String
job
)
throws
Exception
{
// 记录下一处理人信息
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
req
.
getTaskCompletedList
().
add
(
taskCompletedId
);
req
.
setNextTaskIdentityList
(
identities
);
ThisApplication
.
context
().
applications
()
.
putQuery
(
false
,
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
job
)
.
getData
(
WrapBoolean
.
class
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ActionProcessing.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface.jaxrs.task
;
package
com.x.processplatform.assemble.surface.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -25,13 +24,14 @@ import com.x.base.core.project.gson.GsonPropertyObject;
...
@@ -25,13 +24,14 @@ import com.x.base.core.project.gson.GsonPropertyObject;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.jaxrs.WrapStringList
;
import
com.x.base.core.project.jaxrs.WrapStringList
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.TaskBuilder
;
import
com.x.processplatform.assemble.surface.TaskCompletedBuilder
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
...
@@ -47,9 +47,6 @@ import com.x.processplatform.core.express.ProcessingAttributes;
...
@@ -47,9 +47,6 @@ import com.x.processplatform.core.express.ProcessingAttributes;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWo
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWo
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapAppend
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapAppend
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity.PrevTask
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.work.ActionProcessingSignalWo
;
import
com.x.processplatform.core.express.service.processing.jaxrs.work.ActionProcessingSignalWo
;
class
ActionProcessing
extends
BaseAction
{
class
ActionProcessing
extends
BaseAction
{
...
@@ -70,7 +67,7 @@ class ActionProcessing extends BaseAction {
...
@@ -70,7 +67,7 @@ class ActionProcessing extends BaseAction {
private
List
<
Task
>
newTasks
=
new
ArrayList
<>();
private
List
<
Task
>
newTasks
=
new
ArrayList
<>();
private
Exception
exception
=
null
;
private
Exception
exception
=
null
;
private
Record
rec
ord
;
private
Record
rec
;
private
String
series
=
StringTools
.
uniqueToken
();
private
String
series
=
StringTools
.
uniqueToken
();
private
static
final
String
TYPE_APPENDTASK
=
"appendTask"
;
private
static
final
String
TYPE_APPENDTASK
=
"appendTask"
;
...
@@ -95,13 +92,14 @@ class ActionProcessing extends BaseAction {
...
@@ -95,13 +92,14 @@ class ActionProcessing extends BaseAction {
}
else
{
}
else
{
processingTask
();
processingTask
();
}
}
wo
=
Wo
.
copier
.
copy
(
rec
ord
);
wo
=
Wo
.
copier
.
copy
(
rec
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
exception
=
e
;
exception
=
e
;
}
finally
{
}
finally
{
try
{
try
{
responeQueue
.
put
(
wo
);
responeQueue
.
put
(
wo
);
}
catch
(
Exception
e
)
{
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
exception
=
e
;
exception
=
e
;
}
}
}
}
...
@@ -129,7 +127,8 @@ class ActionProcessing extends BaseAction {
...
@@ -129,7 +127,8 @@ class ActionProcessing extends BaseAction {
}
}
try
{
try
{
responeQueue
.
put
(
wo
);
responeQueue
.
put
(
wo
);
}
catch
(
Exception
e
)
{
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
exception
=
e
;
exception
=
e
;
}
}
}
}
...
@@ -252,24 +251,24 @@ class ActionProcessing extends BaseAction {
...
@@ -252,24 +251,24 @@ class ActionProcessing extends BaseAction {
this
.
processingUpdateTaskCompleted
();
this
.
processingUpdateTaskCompleted
();
this
.
processingUpdateTask
();
this
.
processingUpdateTask
();
}
else
{
}
else
{
rec
ord
=
new
Record
(
workLog
,
task
);
rec
=
new
Record
(
workLog
,
task
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
// 后续需要记录unitDutyList所以在一个emc中进行计算.
// 后续需要记录unitDutyList所以在一个emc中进行计算.
rec
ord
.
getProperties
()
rec
.
getProperties
()
.
setUnitDutyList
(
business
.
organization
().
unitDuty
().
listNameWithIdentity
(
task
.
getIdentity
()));
.
setUnitDutyList
(
business
.
organization
().
unitDuty
().
listNameWithIdentity
(
task
.
getIdentity
()));
// 记录处理身份的排序号
// 记录处理身份的排序号
rec
ord
.
getProperties
().
setIdentityOrderNumber
(
rec
.
getProperties
().
setIdentityOrderNumber
(
business
.
organization
().
identity
().
getOrderNumber
(
task
.
getIdentity
(),
Integer
.
MAX_VALUE
));
business
.
organization
().
identity
().
getOrderNumber
(
task
.
getIdentity
(),
Integer
.
MAX_VALUE
));
// 记录处理身份所在组织的排序号
// 记录处理身份所在组织的排序号
rec
ord
.
getProperties
().
setUnitOrderNumber
(
rec
.
getProperties
().
setUnitOrderNumber
(
business
.
organization
().
unit
().
getOrderNumber
(
task
.
getUnit
(),
Integer
.
MAX_VALUE
));
business
.
organization
().
unit
().
getOrderNumber
(
task
.
getUnit
(),
Integer
.
MAX_VALUE
));
// 记录处理身份所在组织层级组织排序号
// 记录处理身份所在组织层级组织排序号
rec
ord
.
getProperties
().
setUnitLevelOrderNumber
(
rec
.
getProperties
().
setUnitLevelOrderNumber
(
business
.
organization
().
unit
().
getLevelOrderNumber
(
task
.
getUnit
(),
""
));
business
.
organization
().
unit
().
getLevelOrderNumber
(
task
.
getUnit
(),
""
));
// 记录task中身份所有的组织职务.
// 记录task中身份所有的组织职务.
rec
ord
.
setCompleted
(
true
);
rec
.
setCompleted
(
true
);
rec
ord
.
setType
(
Record
.
TYPE_TASK
);
rec
.
setType
(
Record
.
TYPE_TASK
);
}
}
}
}
}
}
...
@@ -309,29 +308,29 @@ class ActionProcessing extends BaseAction {
...
@@ -309,29 +308,29 @@ class ActionProcessing extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
rec
ord
=
new
Record
(
workLog
,
task
);
rec
=
new
Record
(
workLog
,
task
);
// 获取在record中需要记录的task中身份所有的组织职务.
// 获取在record中需要记录的task中身份所有的组织职务.
rec
ord
.
getProperties
()
rec
.
getProperties
()
.
setUnitDutyList
(
business
.
organization
().
unitDuty
().
listNameWithIdentity
(
task
.
getIdentity
()));
.
setUnitDutyList
(
business
.
organization
().
unitDuty
().
listNameWithIdentity
(
task
.
getIdentity
()));
// 记录处理身份的排序号
// 记录处理身份的排序号
rec
ord
.
getProperties
().
setIdentityOrderNumber
(
rec
.
getProperties
().
setIdentityOrderNumber
(
business
.
organization
().
identity
().
getOrderNumber
(
task
.
getIdentity
(),
Integer
.
MAX_VALUE
));
business
.
organization
().
identity
().
getOrderNumber
(
task
.
getIdentity
(),
Integer
.
MAX_VALUE
));
// 记录处理身份所在组织的排序号
// 记录处理身份所在组织的排序号
rec
ord
.
getProperties
().
setUnitOrderNumber
(
rec
.
getProperties
().
setUnitOrderNumber
(
business
.
organization
().
unit
().
getOrderNumber
(
task
.
getUnit
(),
Integer
.
MAX_VALUE
));
business
.
organization
().
unit
().
getOrderNumber
(
task
.
getUnit
(),
Integer
.
MAX_VALUE
));
// 记录处理身份所在组织层级组织排序号
// 记录处理身份所在组织层级组织排序号
rec
ord
.
getProperties
()
rec
.
getProperties
()
.
setUnitLevelOrderNumber
(
business
.
organization
().
unit
().
getLevelOrderNumber
(
task
.
getUnit
(),
""
));
.
setUnitLevelOrderNumber
(
business
.
organization
().
unit
().
getLevelOrderNumber
(
task
.
getUnit
(),
""
));
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
task
.
getJob
());
task
.
getJob
());
if
(
null
!=
workCompleted
)
{
if
(
null
!=
workCompleted
)
{
rec
ord
.
setCompleted
(
true
);
rec
.
setCompleted
(
true
);
rec
ord
.
setWorkCompleted
(
workCompleted
.
getId
());
rec
.
setWorkCompleted
(
workCompleted
.
getId
());
}
}
rec
ord
.
getProperties
().
setElapsed
(
rec
.
getProperties
().
setElapsed
(
Config
.
workTime
().
betweenMinutes
(
rec
ord
.
getProperties
().
getStartTime
(),
record
.
getRecordTime
()));
Config
.
workTime
().
betweenMinutes
(
rec
.
getProperties
().
getStartTime
(),
rec
.
getRecordTime
()));
rec
ord
.
setType
(
type
);
rec
.
setType
(
type
);
List
<
Task
>
list
=
emc
.
fetchEqualAndEqual
(
Task
.
class
,
List
<
Task
>
list
=
emc
.
fetchEqualAndEqual
(
Task
.
class
,
ListTools
.
toList
(
Task
.
person_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
unit_FIELDNAME
,
ListTools
.
toList
(
Task
.
person_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
unit_FIELDNAME
,
Task
.
job_FIELDNAME
,
Task
.
work_FIELDNAME
,
Task
.
activity_FIELDNAME
,
Task
.
job_FIELDNAME
,
Task
.
work_FIELDNAME
,
Task
.
activity_FIELDNAME
,
...
@@ -351,24 +350,23 @@ class ActionProcessing extends BaseAction {
...
@@ -351,24 +350,23 @@ class ActionProcessing extends BaseAction {
this
.
newTasks
.
add
(
t
);
this
.
newTasks
.
add
(
t
);
nextTaskIdentities
.
add
(
t
.
getIdentity
());
nextTaskIdentities
.
add
(
t
.
getIdentity
());
}
}
rec
ord
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
rec
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
});
});
// 去重
// 去重
rec
ord
.
getProperties
().
setNextManualTaskIdentityList
(
ListTools
.
trim
(
nextTaskIdentities
,
true
,
true
));
rec
.
getProperties
().
setNextManualTaskIdentityList
(
ListTools
.
trim
(
nextTaskIdentities
,
true
,
true
));
TaskCompleted
taskCompleted
=
emc
.
find
(
taskCompletedId
,
TaskCompleted
.
class
);
TaskCompleted
taskCompleted
=
emc
.
find
(
taskCompletedId
,
TaskCompleted
.
class
);
if
(
null
!=
taskCompleted
)
{
if
(
null
!=
taskCompleted
)
{
// 处理完成后在重新写入待办信息
// 处理完成后在重新写入待办信息
rec
ord
.
getProperties
().
setOpinion
(
taskCompleted
.
getOpinion
());
rec
.
getProperties
().
setOpinion
(
taskCompleted
.
getOpinion
());
rec
ord
.
getProperties
().
setRouteName
(
taskCompleted
.
getRouteName
());
rec
.
getProperties
().
setRouteName
(
taskCompleted
.
getRouteName
());
rec
ord
.
getProperties
().
setMediaOpinion
(
taskCompleted
.
getMediaOpinion
());
rec
.
getProperties
().
setMediaOpinion
(
taskCompleted
.
getMediaOpinion
());
}
}
}
}
new
Thread
(()
->
{
new
Thread
(()
->
{
try
{
try
{
WoId
resp
=
ThisApplication
.
context
().
applications
()
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
.
postQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"record"
,
"job"
,
this
.
work
.
getJob
()),
record
,
Applications
.
joinQueryUri
(
"record"
,
"job"
,
this
.
work
.
getJob
()),
rec
,
this
.
task
.
getJob
())
this
.
task
.
getJob
())
.
getData
(
WoId
.
class
);
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
throw
new
ExceptionWorkProcessing
(
this
.
work
.
getId
());
throw
new
ExceptionWorkProcessing
(
this
.
work
.
getId
());
...
@@ -380,52 +378,60 @@ class ActionProcessing extends BaseAction {
...
@@ -380,52 +378,60 @@ class ActionProcessing extends BaseAction {
}
}
private
void
processingUpdateTaskCompleted
()
throws
Exception
{
private
void
processingUpdateTaskCompleted
()
throws
Exception
{
TaskCompletedBuilder
.
updateNextTaskIdentity
(
taskCompletedId
,
rec
.
getProperties
().
getNextManualTaskIdentityList
(),
task
.
getJob
());
// 记录下一处理人信息
// 记录下一处理人信息
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
//
WrapUpdateNextTaskIdentity req = new WrapUpdateNextTaskIdentity();
req
.
getTaskCompletedList
().
add
(
taskCompletedId
);
//
req.getTaskCompletedList().add(taskCompletedId);
req
.
setNextTaskIdentityList
(
record
.
getProperties
().
getNextManualTaskIdentityList
());
// req.setNextTaskIdentityList(rec
.getProperties().getNextManualTaskIdentityList());
ThisApplication
.
context
().
applications
()
//
ThisApplication.context().applications()
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
//
.putQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
//
Applications.joinQueryUri("taskcompleted", "next", "task", "identity"), req, task.getJob())
.
getData
(
WrapBoolean
.
class
);
//
.getData(WrapBoolean.class);
}
}
private
void
processingUpdateTask
()
throws
Exception
{
private
void
processingUpdateTask
()
throws
Exception
{
// 记录上一处理人信息
if
(
ListTools
.
isNotEmpty
(
newTasks
))
{
TaskBuilder
.
updatePrevTaskIdentity
(
newTasks
.
stream
().
map
(
Task:
:
getId
).
collect
(
Collectors
.
toList
()),
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
taskCompleteds
,
task
);
req
.
setTaskList
(
ListTools
.
extractProperty
(
newTasks
,
JpaObject
.
id_FIELDNAME
,
String
.
class
,
true
,
true
));
this
.
taskCompleteds
.
stream
().
forEach
(
o
->
{
// // 记录上一处理人信息
PrevTask
prevTask
=
new
PrevTask
();
// if (ListTools.isNotEmpty(newTasks)) {
prevTask
.
setCompletedTime
(
o
.
getCompletedTime
());
// WrapUpdatePrevTaskIdentity req = new WrapUpdatePrevTaskIdentity();
prevTask
.
setStartTime
(
o
.
getStartTime
());
// req.setTaskList(ListTools.extractProperty(newTasks, JpaObject.id_FIELDNAME, String.class, true, true));
prevTask
.
setOpinion
(
o
.
getOpinion
());
// this.taskCompleteds.stream().forEach(o -> {
prevTask
.
setPerson
(
o
.
getPerson
());
// PrevTask prevTask = new PrevTask();
prevTask
.
setIdentity
(
o
.
getIdentity
());
// prevTask.setCompletedTime(o.getCompletedTime());
prevTask
.
setUnit
(
o
.
getUnit
());
// prevTask.setStartTime(o.getStartTime());
prevTask
.
setRouteName
(
o
.
getRouteName
());
// prevTask.setOpinion(o.getOpinion());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
// prevTask.setPerson(o.getPerson());
req
.
getPrevTaskList
().
add
(
prevTask
);
// prevTask.setIdentity(o.getIdentity());
});
// prevTask.setUnit(o.getUnit());
PrevTask
prevTask
=
new
PrevTask
();
// prevTask.setRouteName(o.getRouteName());
prevTask
.
setCompletedTime
(
new
Date
());
// req.getPrevTaskIdentityList().add(prevTask.getIdentity());
prevTask
.
setStartTime
(
task
.
getStartTime
());
// req.getPrevTaskList().add(prevTask);
prevTask
.
setOpinion
(
task
.
getOpinion
());
// });
prevTask
.
setPerson
(
task
.
getPerson
());
// PrevTask prevTask = new PrevTask();
prevTask
.
setIdentity
(
task
.
getIdentity
());
// prevTask.setCompletedTime(new Date());
prevTask
.
setUnit
(
task
.
getUnit
());
// prevTask.setStartTime(task.getStartTime());
prevTask
.
setRouteName
(
task
.
getRouteName
());
// prevTask.setOpinion(task.getOpinion());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
// prevTask.setPerson(task.getPerson());
req
.
setPrevTaskIdentity
(
prevTask
.
getIdentity
());
// prevTask.setIdentity(task.getIdentity());
req
.
getPrevTaskList
().
add
(
prevTask
);
// prevTask.setUnit(task.getUnit());
req
.
setPrevTask
(
prevTask
);
// prevTask.setRouteName(task.getRouteName());
// 去重
// req.getPrevTaskIdentityList().add(prevTask.getIdentity());
req
.
setPrevTaskIdentityList
(
ListTools
.
trim
(
req
.
getPrevTaskIdentityList
(),
true
,
true
));
// req.setPrevTaskIdentity(prevTask.getIdentity());
ThisApplication
.
context
().
applications
()
// req.getPrevTaskList().add(prevTask);
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
// req.setPrevTask(prevTask);
Applications
.
joinQueryUri
(
"task"
,
"prev"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
// // 去重
.
getData
(
WrapBoolean
.
class
);
// req.setPrevTaskIdentityList(ListTools.trim(req.getPrevTaskIdentityList(), true, true));
}
// ThisApplication.context().applications()
// .putQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
// Applications.joinQueryUri("task", "prev", "task", "identity"), req, task.getJob())
// .getData(WrapBoolean.class);
// }
List
<
Task
>
empowerTasks
=
new
ArrayList
<>();
List
<
Task
>
empowerTasks
=
new
ArrayList
<>();
for
(
Task
o
:
newTasks
)
{
for
(
Task
o
:
newTasks
)
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/BaseAction.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface.jaxrs.task
;
package
com.x.processplatform.assemble.surface.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
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.Applications
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity.PrevTask
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity.PrevTask
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
abstract
class
BaseAction
extends
StandardJaxrsAction
{
/**
//
/**
* 更新指定已办的下一处理人.
//
* 更新指定已办的下一处理人.
*
//
*
* @throws Exception
//
* @throws Exception
*/
//
*/
protected
void
updateNextTaskIdentity
(
String
taskCompletedId
,
List
<
String
>
identities
,
String
job
)
//
protected void updateNextTaskIdentity(String taskCompletedId, List<String> identities, String job)
throws
Exception
{
//
throws Exception {
// 记录下一处理人信息
//
// 记录下一处理人信息
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
//
WrapUpdateNextTaskIdentity req = new WrapUpdateNextTaskIdentity();
req
.
getTaskCompletedList
().
add
(
taskCompletedId
);
//
req.getTaskCompletedList().add(taskCompletedId);
req
.
setNextTaskIdentityList
(
identities
);
//
req.setNextTaskIdentityList(identities);
ThisApplication
.
context
().
applications
()
//
ThisApplication.context().applications()
.
putQuery
(
false
,
x_processplatform_service_processing
.
class
,
//
.putQuery(false, x_processplatform_service_processing.class,
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
job
)
//
Applications.joinQueryUri("taskcompleted", "next", "task", "identity"), req, job)
.
getData
(
WrapBoolean
.
class
);
//
.getData(WrapBoolean.class);
}
//
}
//
protected
void
updatePrevTaskIdentity
(
List
<
String
>
newlyTaskIds
,
List
<
TaskCompleted
>
prevSeriesTaskCompleteds
,
//
protected void updatePrevTaskIdentity(List<String> newlyTaskIds, List<TaskCompleted> prevSeriesTaskCompleteds,
Task
task
)
throws
Exception
{
//
Task task) throws Exception {
// 记录上一处理人信息
//
// 记录上一处理人信息
if
(
ListTools
.
isNotEmpty
(
newlyTaskIds
))
{
//
if (ListTools.isNotEmpty(newlyTaskIds)) {
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
//
WrapUpdatePrevTaskIdentity req = new WrapUpdatePrevTaskIdentity();
req
.
setTaskList
(
newlyTaskIds
);
//
req.setTaskList(newlyTaskIds);
prevSeriesTaskCompleteds
.
stream
().
forEach
(
o
->
{
//
prevSeriesTaskCompleteds.stream().forEach(o -> {
PrevTask
prevTask
=
new
PrevTask
();
//
PrevTask prevTask = new PrevTask();
prevTask
.
setCompletedTime
(
o
.
getCompletedTime
());
//
prevTask.setCompletedTime(o.getCompletedTime());
prevTask
.
setStartTime
(
o
.
getStartTime
());
//
prevTask.setStartTime(o.getStartTime());
prevTask
.
setOpinion
(
o
.
getOpinion
());
//
prevTask.setOpinion(o.getOpinion());
prevTask
.
setPerson
(
o
.
getPerson
());
//
prevTask.setPerson(o.getPerson());
prevTask
.
setIdentity
(
o
.
getIdentity
());
//
prevTask.setIdentity(o.getIdentity());
prevTask
.
setUnit
(
o
.
getUnit
());
//
prevTask.setUnit(o.getUnit());
prevTask
.
setRouteName
(
o
.
getRouteName
());
//
prevTask.setRouteName(o.getRouteName());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
//
req.getPrevTaskIdentityList().add(prevTask.getIdentity());
req
.
getPrevTaskList
().
add
(
prevTask
);
//
req.getPrevTaskList().add(prevTask);
});
//
});
PrevTask
prevTask
=
new
PrevTask
();
//
PrevTask prevTask = new PrevTask();
prevTask
.
setCompletedTime
(
new
Date
());
//
prevTask.setCompletedTime(new Date());
prevTask
.
setStartTime
(
task
.
getStartTime
());
//
prevTask.setStartTime(task.getStartTime());
prevTask
.
setOpinion
(
task
.
getOpinion
());
//
prevTask.setOpinion(task.getOpinion());
prevTask
.
setPerson
(
task
.
getPerson
());
//
prevTask.setPerson(task.getPerson());
prevTask
.
setIdentity
(
task
.
getIdentity
());
//
prevTask.setIdentity(task.getIdentity());
prevTask
.
setUnit
(
task
.
getUnit
());
//
prevTask.setUnit(task.getUnit());
prevTask
.
setRouteName
(
task
.
getRouteName
());
//
prevTask.setRouteName(task.getRouteName());
req
.
getPrevTaskIdentityList
().
add
(
prevTask
.
getIdentity
());
//
req.getPrevTaskIdentityList().add(prevTask.getIdentity());
req
.
setPrevTaskIdentity
(
prevTask
.
getIdentity
());
//
req.setPrevTaskIdentity(prevTask.getIdentity());
req
.
getPrevTaskList
().
add
(
prevTask
);
//
req.getPrevTaskList().add(prevTask);
req
.
setPrevTask
(
prevTask
);
//
req.setPrevTask(prevTask);
// 去重
//
// 去重
req
.
setPrevTaskIdentityList
(
ListTools
.
trim
(
req
.
getPrevTaskIdentityList
(),
true
,
true
));
//
req.setPrevTaskIdentityList(ListTools.trim(req.getPrevTaskIdentityList(), true, true));
ThisApplication
.
context
().
applications
()
//
ThisApplication.context().applications()
.
putQuery
(
false
,
x_processplatform_service_processing
.
class
,
//
.putQuery(false, x_processplatform_service_processing.class,
Applications
.
joinQueryUri
(
"task"
,
"prev"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
//
Applications.joinQueryUri("task", "prev", "task", "identity"), req, task.getJob())
.
getData
(
WrapBoolean
.
class
);
//
.getData(WrapBoolean.class);
}
//
}
//
}
//
}
protected
void
xxxx
(
List
<
Task
>
newlyTasks
,
String
job
)
throws
Exception
{
//
protected void xxxx(List<Task> newlyTasks, String job) throws Exception {
List
<
Task
>
empowerTasks
=
newlyTasks
.
stream
()
//
List<Task> empowerTasks = newlyTasks.stream()
.
filter
(
t
->
StringUtils
.
isNotEmpty
(
t
.
getEmpowerFromIdentity
())
//
.filter(t -> StringUtils.isNotEmpty(t.getEmpowerFromIdentity())
&&
(!
StringUtils
.
equals
(
t
.
getEmpowerFromIdentity
(),
t
.
getIdentity
())))
//
&& (!StringUtils.equals(t.getEmpowerFromIdentity(), t.getIdentity())))
.
collect
(
Collectors
.
toList
());
//
.collect(Collectors.toList());
if
(!
empowerTasks
.
isEmpty
())
{
//
if (!empowerTasks.isEmpty()) {
List
<
Record
>
empowerRecords
=
new
ArrayList
<>();
//
List<Record> empowerRecords = new ArrayList<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
//
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business
business
=
new
Business
(
emc
);
//
Business business = new Business(emc);
for
(
Task
o
:
empowerTasks
)
{
//
for (Task o : empowerTasks) {
empowerRecords
.
add
(
createEmpowerRecord
(
business
,
o
));
//
empowerRecords.add(createEmpowerRecord(business, o));
}
//
}
}
//
}
for
(
Record
r
:
empowerRecords
)
{
//
for (Record r : empowerRecords) {
WoId
resp
=
ThisApplication
.
context
().
applications
()
//
WoId resp = ThisApplication.context().applications()
.
postQuery
(
false
,
x_processplatform_service_processing
.
class
,
//
.postQuery(false, x_processplatform_service_processing.class,
Applications
.
joinQueryUri
(
"record"
,
"job"
,
job
),
r
,
job
)
//
Applications.joinQueryUri("record", "job", job), r, job)
.
getData
(
WoId
.
class
);
//
.getData(WoId.class);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
//
if (StringUtils.isBlank(resp.getId())) {
throw
new
ExceptionEmpowerRecordProcessing
(
job
);
//
throw new ExceptionEmpowerRecordProcessing(job);
}
//
}
}
//
}
}
//
}
}
//
}
private
Record
createEmpowerRecord
(
Business
business
,
Task
task
)
throws
Exception
{
//
private Record createEmpowerRecord(Business business, Task task) throws Exception {
Record
o
=
new
Record
();
//
Record o = new Record();
o
.
setType
(
Record
.
TYPE_EMPOWER
);
//
o.setType(Record.TYPE_EMPOWER);
o
.
setApplication
(
task
.
getApplication
());
//
o.setApplication(task.getApplication());
o
.
setProcess
(
task
.
getProcess
());
//
o.setProcess(task.getProcess());
o
.
setJob
(
task
.
getJob
());
//
o.setJob(task.getJob());
o
.
setCompleted
(
false
);
//
o.setCompleted(false);
o
.
setWork
(
task
.
getWork
());
//
o.setWork(task.getWork());
o
.
setFromActivity
(
task
.
getActivity
());
//
o.setFromActivity(task.getActivity());
o
.
setFromActivityAlias
(
task
.
getActivityAlias
());
//
o.setFromActivityAlias(task.getActivityAlias());
o
.
setFromActivityName
(
task
.
getActivityName
());
//
o.setFromActivityName(task.getActivityName());
o
.
setFromActivityToken
(
task
.
getActivityToken
());
//
o.setFromActivityToken(task.getActivityToken());
o
.
setFromActivityType
(
task
.
getActivityType
());
//
o.setFromActivityType(task.getActivityType());
o
.
setArrivedActivity
(
task
.
getActivity
());
//
o.setArrivedActivity(task.getActivity());
o
.
setArrivedActivityAlias
(
task
.
getActivityAlias
());
//
o.setArrivedActivityAlias(task.getActivityAlias());
o
.
setArrivedActivityName
(
task
.
getActivityName
());
//
o.setArrivedActivityName(task.getActivityName());
o
.
setArrivedActivityToken
(
task
.
getActivityToken
());
//
o.setArrivedActivityToken(task.getActivityToken());
o
.
setArrivedActivityType
(
task
.
getActivityType
());
//
o.setArrivedActivityType(task.getActivityType());
o
.
getProperties
().
setEmpowerToPerson
(
task
.
getPerson
());
//
o.getProperties().setEmpowerToPerson(task.getPerson());
o
.
getProperties
().
setEmpowerToIdentity
(
task
.
getIdentity
());
//
o.getProperties().setEmpowerToIdentity(task.getIdentity());
o
.
getProperties
().
setEmpowerToUnit
(
task
.
getUnit
());
//
o.getProperties().setEmpowerToUnit(task.getUnit());
o
.
setIdentity
(
task
.
getEmpowerFromIdentity
());
//
o.setIdentity(task.getEmpowerFromIdentity());
o
.
setPerson
(
business
.
organization
().
person
().
getWithIdentity
(
o
.
getIdentity
()));
//
o.setPerson(business.organization().person().getWithIdentity(o.getIdentity()));
o
.
setUnit
(
business
.
organization
().
unit
().
getWithIdentity
(
o
.
getIdentity
()));
//
o.setUnit(business.organization().unit().getWithIdentity(o.getIdentity()));
o
.
getProperties
().
setElapsed
(
0L
);
//
o.getProperties().setElapsed(0L);
NextManual
nextManual
=
new
NextManual
();
//
NextManual nextManual = new NextManual();
nextManual
.
setActivity
(
task
.
getActivity
());
//
nextManual.setActivity(task.getActivity());
nextManual
.
setActivityAlias
(
task
.
getActivityAlias
());
//
nextManual.setActivityAlias(task.getActivityAlias());
nextManual
.
setActivityName
(
task
.
getActivityName
());
//
nextManual.setActivityName(task.getActivityName());
nextManual
.
setActivityToken
(
task
.
getActivityToken
());
//
nextManual.setActivityToken(task.getActivityToken());
nextManual
.
setActivityType
(
task
.
getActivityType
());
//
nextManual.setActivityType(task.getActivityType());
o
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
//
o.getProperties().getNextManualList().add(nextManual);
o
.
getProperties
().
getNextManualTaskIdentityList
().
add
(
task
.
getIdentity
());
//
o.getProperties().getNextManualTaskIdentityList().add(task.getIdentity());
return
o
;
//
return o;
}
//
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Add.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface.jaxrs.task
;
package
com.x.processplatform.assemble.surface.jaxrs.task
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
...
@@ -15,6 +15,8 @@ import com.x.base.core.entity.JpaObject;
...
@@ -15,6 +15,8 @@ import com.x.base.core.entity.JpaObject;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.annotation.FieldDescribe
;
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.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
...
@@ -26,14 +28,13 @@ import com.x.base.core.project.logger.LoggerFactory;
...
@@ -26,14 +28,13 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.RecordBuilder
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.RecordProperties.NextManual
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.ProcessingWi
;
...
@@ -49,7 +50,7 @@ public class V2Add extends BaseAction {
...
@@ -49,7 +50,7 @@ public class V2Add extends BaseAction {
// 当前提交的串号
// 当前提交的串号
private
final
String
series
=
StringTools
.
uniqueToken
();
private
final
String
series
=
StringTools
.
uniqueToken
();
// 新创建的待办标识列表
// 新创建的待办标识列表
private
List
<
String
>
newTasks
=
new
ArrayList
<>();
private
List
<
String
>
newTask
Id
s
=
new
ArrayList
<>();
// 当前待办转成已办得到的已办id
// 当前待办转成已办得到的已办id
private
String
taskCompletedId
;
private
String
taskCompletedId
;
// 已经存在的待办标识列表
// 已经存在的待办标识列表
...
@@ -63,7 +64,7 @@ public class V2Add extends BaseAction {
...
@@ -63,7 +64,7 @@ public class V2Add extends BaseAction {
// 当前待办的workLog
// 当前待办的workLog
private
WorkLog
workLog
=
null
;
private
WorkLog
workLog
=
null
;
// 本环节创建的record
// 本环节创建的record
private
Record
concreteRecord
=
null
;
private
Record
rec
=
null
;
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
if
(
LOGGER
.
isDebugEnabled
())
{
if
(
LOGGER
.
isDebugEnabled
())
{
...
@@ -80,7 +81,15 @@ public class V2Add extends BaseAction {
...
@@ -80,7 +81,15 @@ public class V2Add extends BaseAction {
}
}
this
.
processingWork
(
this
.
task
);
this
.
processingWork
(
this
.
task
);
this
.
createRecord
(
task
,
workLog
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
this
.
newTaskIds
=
ListUtils
.
subtract
(
emc
.
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
task
.
getJob
(),
Task
.
work_FIELDNAME
,
task
.
getWork
()),
existTaskIds
);
}
this
.
rec
=
RecordBuilder
.
ofTaskProcessing
(
Record
.
TYPE_TASKADD
,
workLog
,
task
,
taskCompletedId
,
newTaskIds
);
RecordBuilder
.
processing
(
rec
);
if
(
StringUtils
.
isNotEmpty
(
taskCompletedId
))
{
if
(
StringUtils
.
isNotEmpty
(
taskCompletedId
))
{
this
.
updateTaskCompleted
();
this
.
updateTaskCompleted
();
}
}
...
@@ -166,63 +175,11 @@ public class V2Add extends BaseAction {
...
@@ -166,63 +175,11 @@ public class V2Add extends BaseAction {
}
}
}
}
private
void
createRecord
(
Task
task
,
WorkLog
workLog
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
concreteRecord
=
new
Record
(
workLog
,
task
);
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
task
.
getJob
());
if
(
null
!=
workCompleted
)
{
concreteRecord
.
setCompleted
(
true
);
concreteRecord
.
setWorkCompleted
(
workCompleted
.
getId
());
}
concreteRecord
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
concreteRecord
.
setType
(
Record
.
TYPE_TASKADD
);
createRecordAdjust
(
business
,
task
,
concreteRecord
);
}
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"record"
,
"job"
,
task
.
getJob
()),
concreteRecord
,
task
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
throw
new
ExceptionExtend
(
task
.
getId
());
}
}
private
void
createRecordAdjust
(
Business
business
,
Task
task
,
Record
concreteRecord
)
throws
Exception
{
List
<
String
>
ids
=
business
.
entityManagerContainer
().
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
task
.
getJob
(),
Task
.
work_FIELDNAME
,
task
.
getWork
());
ids
=
ListUtils
.
subtract
(
ids
,
existTaskIds
);
List
<
Task
>
list
=
business
.
entityManagerContainer
().
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
));
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
Task:
:
getActivity
,
Collectors
.
toList
())).
entrySet
().
stream
()
.
forEach
(
o
->
{
Task
next
=
o
.
getValue
().
get
(
0
);
NextManual
nextManual
=
new
NextManual
();
nextManual
.
setActivity
(
next
.
getActivity
());
nextManual
.
setActivityAlias
(
next
.
getActivityAlias
());
nextManual
.
setActivityName
(
next
.
getActivityName
());
nextManual
.
setActivityToken
(
next
.
getActivityToken
());
nextManual
.
setActivityType
(
next
.
getActivityType
());
for
(
Task
t
:
o
.
getValue
())
{
nextManual
.
getTaskIdentityList
().
add
(
t
.
getIdentity
());
nextTaskIdentities
.
add
(
t
.
getIdentity
());
}
concreteRecord
.
getProperties
().
getNextManualList
().
add
(
nextManual
);
});
// 去重
concreteRecord
.
getProperties
().
setNextManualTaskIdentityList
(
ListTools
.
trim
(
nextTaskIdentities
,
true
,
true
));
}
private
void
updateTaskCompleted
()
throws
Exception
{
private
void
updateTaskCompleted
()
throws
Exception
{
// 记录下一处理人信息
// 记录下一处理人信息
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
req
.
getTaskCompletedList
().
add
(
this
.
taskCompletedId
);
req
.
getTaskCompletedList
().
add
(
this
.
taskCompletedId
);
req
.
setNextTaskIdentityList
(
concreteRecord
.
getProperties
().
getNextManualTaskIdentityList
());
req
.
setNextTaskIdentityList
(
rec
.
getProperties
().
getNextManualTaskIdentityList
());
ThisApplication
.
context
().
applications
()
ThisApplication
.
context
().
applications
()
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
...
@@ -231,9 +188,9 @@ public class V2Add extends BaseAction {
...
@@ -231,9 +188,9 @@ public class V2Add extends BaseAction {
private
void
updateTask
()
throws
Exception
{
private
void
updateTask
()
throws
Exception
{
// 记录上一处理人信息
// 记录上一处理人信息
if
(
ListTools
.
isNotEmpty
(
newTask
s
))
{
if
(
ListTools
.
isNotEmpty
(
this
.
newTaskId
s
))
{
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
req
.
setTaskList
(
newTask
s
);
req
.
setTaskList
(
this
.
newTaskId
s
);
req
.
setPrevTaskIdentity
(
task
.
getIdentity
());
req
.
setPrevTaskIdentity
(
task
.
getIdentity
());
req
.
getPrevTaskIdentityList
().
add
(
task
.
getIdentity
());
req
.
getPrevTaskIdentityList
().
add
(
task
.
getIdentity
());
ThisApplication
.
context
().
applications
()
ThisApplication
.
context
().
applications
()
...
@@ -243,10 +200,10 @@ public class V2Add extends BaseAction {
...
@@ -243,10 +200,10 @@ public class V2Add extends BaseAction {
}
}
}
}
private
ActionResult
<
Wo
>
result
()
{
private
ActionResult
<
Wo
>
result
()
throws
InstantiationException
,
IllegalAccessException
,
IllegalArgumentException
,
InvocationTargetException
,
NoSuchMethodException
,
SecurityException
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
Wo
wo
=
Wo
.
copier
.
copy
(
this
.
rec
);
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
result
.
setData
(
wo
);
return
result
;
return
result
;
}
}
...
@@ -285,9 +242,12 @@ public class V2Add extends BaseAction {
...
@@ -285,9 +242,12 @@ public class V2Add extends BaseAction {
}
}
public
static
class
Wo
extends
WrapBoolean
{
public
static
class
Wo
extends
Record
{
private
static
final
long
serialVersionUID
=
1416972392523085640L
;
private
static
final
long
serialVersionUID
=
8155067200427920853L
;
static
WrapCopier
<
Record
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Record
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Reset.java
浏览文件 @
ed673f54
...
@@ -27,6 +27,9 @@ import com.x.base.core.project.processplatform.ManualTaskIdentityMatrix;
...
@@ -27,6 +27,9 @@ import com.x.base.core.project.processplatform.ManualTaskIdentityMatrix;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.RecordBuilder
;
import
com.x.processplatform.assemble.surface.TaskBuilder
;
import
com.x.processplatform.assemble.surface.TaskCompletedBuilder
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Record
;
...
@@ -94,22 +97,22 @@ public class V2Reset extends BaseAction {
...
@@ -94,22 +97,22 @@ public class V2Reset extends BaseAction {
this
.
processingWork
();
this
.
processingWork
();
List
<
Task
>
newlyTask
s
=
new
ArrayList
<>();
List
<
String
>
newTaskId
s
=
new
ArrayList
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
newlyTasks
.
addAll
(
emc
.
listEqual
(
Task
.
class
,
Task
.
series_FIELDNAME
,
this
.
series
));
newTaskIds
.
addAll
(
emc
.
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
(),
Task
.
work_FIELDNAME
,
work
.
getId
()));
}
}
Record
rec
=
this
.
processingRecord
(
this
.
workLog
,
this
.
task
,
this
.
taskCompletedId
,
newlyTasks
);
Record
rec
=
RecordBuilder
.
ofWorkProcessing
(
Record
.
TYPE_RESET
,
workLog
,
effectivePerson
,
manual
,
newTaskIds
);
RecordBuilder
.
processing
(
rec
);
if
(
StringUtils
.
isNotEmpty
(
this
.
taskCompletedId
))
{
if
(
StringUtils
.
isNotEmpty
(
this
.
taskCompletedId
))
{
this
.
updateNextTaskIdentity
(
this
.
taskCompletedId
,
rec
.
getProperties
().
getNextManualTaskIdentityList
()
,
TaskCompletedBuilder
.
updateNextTaskIdentity
(
this
.
taskCompletedId
,
task
.
getJob
());
rec
.
getProperties
().
getNextManualTaskIdentityList
(),
task
.
getJob
());
}
}
if
(!
taskCompleteds
.
isEmpty
())
{
if
(!
taskCompleteds
.
isEmpty
())
{
this
.
updatePrevTaskIdentity
(
TaskBuilder
.
updatePrevTaskIdentity
(
newTaskIds
,
taskCompleteds
,
this
.
task
);
ListTools
.
extractField
(
newlyTasks
,
JpaObject
.
id_FIELDNAME
,
String
.
class
,
true
,
true
),
taskCompleteds
,
this
.
task
);
}
}
Wo
wo
=
Wo
.
copier
.
copy
(
rec
);
Wo
wo
=
Wo
.
copier
.
copy
(
rec
);
result
.
setData
(
wo
);
result
.
setData
(
wo
);
...
@@ -206,13 +209,6 @@ public class V2Reset extends BaseAction {
...
@@ -206,13 +209,6 @@ public class V2Reset extends BaseAction {
}
}
}
}
private
Record
processingRecord
(
WorkLog
workLog
,
Task
task
,
String
taskCompletedId
,
List
<
Task
>
newlyTasks
)
throws
Exception
{
Record
r
=
RecordBuilder
.
ofTaskProcessing
(
Record
.
TYPE_RESET
,
workLog
,
task
,
taskCompletedId
,
newlyTasks
);
RecordBuilder
.
processing
(
r
);
return
r
;
}
public
static
class
Wi
extends
V2ResetWi
{
public
static
class
Wi
extends
V2ResetWi
{
private
static
final
long
serialVersionUID
=
5747688678118966913L
;
private
static
final
long
serialVersionUID
=
5747688678118966913L
;
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2AddManualTaskIdentityMatrix.java
浏览文件 @
ed673f54
package
com.x.processplatform.assemble.surface.jaxrs.work
;
package
com.x.processplatform.assemble.surface.jaxrs.work
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
...
@@ -8,8 +9,11 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -8,8 +9,11 @@ import org.apache.commons.lang3.StringUtils;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
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.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.x_processplatform_service_processing
;
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.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
...
@@ -20,9 +24,15 @@ import com.x.base.core.project.logger.Logger;
...
@@ -20,9 +24,15 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.RecordBuilder
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.element.ActivityType
;
import
com.x.processplatform.core.entity.element.Manual
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.service.processing.jaxrs.work.V2AddManualTaskIdentityMatrixWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.work.V2AddManualTaskIdentityMatrixWi
;
...
@@ -39,15 +49,35 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
...
@@ -39,15 +49,35 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
private
Work
work
=
null
;
private
Work
work
=
null
;
// 指定的身份
// 指定的身份
private
String
identity
=
null
;
private
String
identity
=
null
;
// 工作记录
private
WorkLog
workLog
;
// work活动
private
Manual
manual
;
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
if
(
LOGGER
.
isDebugEnabled
())
{
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
}
}
this
.
init
(
effectivePerson
,
id
,
jsonElement
);
this
.
init
(
effectivePerson
,
id
,
jsonElement
);
this
.
add
(
wi
.
getOptionList
(),
wi
.
getRemove
());
this
.
add
(
wi
.
getOptionList
(),
wi
.
getRemove
());
this
.
processingWork
(
work
);
this
.
processingWork
(
work
);
return
result
();
List
<
String
>
newTaskIds
=
new
ArrayList
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
newTaskIds
.
addAll
(
emc
.
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
(),
Task
.
work_FIELDNAME
,
work
.
getId
()));
}
Record
rec
=
RecordBuilder
.
ofWorkProcessing
(
Record
.
TYPE_RESET
,
workLog
,
effectivePerson
,
manual
,
newTaskIds
);
RecordBuilder
.
processing
(
rec
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
rec
);
result
.
setData
(
wo
);
return
result
;
}
}
private
void
init
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
private
void
init
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
...
@@ -59,10 +89,16 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
...
@@ -59,10 +89,16 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
if
(
null
==
work
)
{
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Work
.
class
);
throw
new
ExceptionEntityNotExist
(
id
,
Work
.
class
);
}
}
this
.
workLog
=
business
.
entityManagerContainer
().
firstEqualAndEqual
(
WorkLog
.
class
,
WorkLog
.
job_FIELDNAME
,
work
.
getJob
(),
WorkLog
.
fromActivityToken_FIELDNAME
,
work
.
getActivityToken
());
if
(
null
==
workLog
)
{
throw
new
ExceptionEntityNotExist
(
WorkLog
.
class
);
}
WoControl
control
=
business
.
getControl
(
effectivePerson
,
work
,
WoControl
.
class
);
WoControl
control
=
business
.
getControl
(
effectivePerson
,
work
,
WoControl
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
control
.
getAllowReset
()))
{
if
(
BooleanUtils
.
isNotTrue
(
control
.
getAllowReset
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
}
this
.
manual
=
(
Manual
)
business
.
getActivity
(
work
.
getActivity
(),
ActivityType
.
manual
);
this
.
identity
=
business
.
organization
().
identity
().
get
(
wi
.
getIdentity
());
this
.
identity
=
business
.
organization
().
identity
().
get
(
wi
.
getIdentity
());
}
}
}
}
...
@@ -94,14 +130,6 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
...
@@ -94,14 +130,6 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
}
}
}
}
private
ActionResult
<
Wo
>
result
()
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wi
extends
V2AddManualTaskIdentityMatrixWi
{
public
static
class
Wi
extends
V2AddManualTaskIdentityMatrixWi
{
private
static
final
long
serialVersionUID
=
-
6251874269093504136L
;
private
static
final
long
serialVersionUID
=
-
6251874269093504136L
;
...
@@ -114,10 +142,12 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
...
@@ -114,10 +142,12 @@ class V2AddManualTaskIdentityMatrix extends BaseAction {
}
}
public
static
class
Wo
extends
WrapBoolean
{
public
static
class
Wo
extends
Record
{
private
static
final
long
serialVersionUID
=
8155067200427920853
L
;
private
static
final
long
serialVersionUID
=
242446941132286179
L
;
static
WrapCopier
<
Record
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Record
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
浏览文件 @
ed673f54
...
@@ -84,10 +84,7 @@ public class Record extends SliceJpaObject {
...
@@ -84,10 +84,7 @@ public class Record extends SliceJpaObject {
/* 外部调用流转 */
/* 外部调用流转 */
public
static
final
String
TYPE_SERVICE
=
"service"
;
public
static
final
String
TYPE_SERVICE
=
"service"
;
/* 扩充待办 */
public
static
final
String
TYPE_TASKEXTEND
=
"taskExtend"
;
/* 添加待办 */
/* 添加待办 */
public
static
final
String
TYPE_TASKADD
=
"taskAdd"
;
public
static
final
String
TYPE_TASKADD
=
"taskAdd"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录