Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
b77fdb3f
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,发现更多精彩内容 >>
提交
b77fdb3f
编写于
5月 13, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加extend.add 服务
上级
44c3c2df
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
2798 addition
and
824 deletion
+2798
-824
o2server/x_base_core_project/src/main/java/com/x/base/core/project/exception/ExceptionDeprecatedAction.java
...ase/core/project/exception/ExceptionDeprecatedAction.java
+13
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/processplatform/ManualTaskIdentityMatrix.java
...ore/project/processplatform/ManualTaskIdentityMatrix.java
+230
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ExceptionExtend.java
...platform/assemble/surface/jaxrs/task/ExceptionExtend.java
+13
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Extend.java
...processplatform/assemble/surface/jaxrs/task/V2Extend.java
+258
-0
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
+21
-18
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/TaskCompleted.java
.../x/processplatform/core/entity/content/TaskCompleted.java
+6
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
.../java/com/x/processplatform/core/entity/content/Work.java
+33
-13
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java
...x/processplatform/core/entity/content/WorkProperties.java
+12
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java
...om/x/processplatform/core/entity/element/Application.java
+16
-1
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ApplicationProperties.java
...ssplatform/core/entity/element/ApplicationProperties.java
+12
-1
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Manual.java
...ava/com/x/processplatform/core/entity/element/Manual.java
+13
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ManualMode.java
...com/x/processplatform/core/entity/element/ManualMode.java
+1
-1
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ManualTaskIdentityMatrix.java
...latform/core/entity/element/ManualTaskIdentityMatrix.java
+0
-88
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
+15
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ProcessProperties.java
...rocessplatform/core/entity/element/ProcessProperties.java
+11
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java
.../x/processplatform/core/express/ProcessingAttributes.java
+4
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2AddAfterWi.java
...e/express/service/processing/jaxrs/task/V2AddAfterWi.java
+46
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2AddBeforeWi.java
.../express/service/processing/jaxrs/task/V2AddBeforeWi.java
+46
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2ExtendWi.java
...ore/express/service/processing/jaxrs/task/V2ExtendWi.java
+46
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionAppend.java
...splatform/service/processing/jaxrs/task/ActionAppend.java
+10
-2
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionDelete.java
...splatform/service/processing/jaxrs/task/ActionDelete.java
+2
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionGrab.java
...essplatform/service/processing/jaxrs/task/ActionGrab.java
+1
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionReset.java
...ssplatform/service/processing/jaxrs/task/ActionReset.java
+104
-125
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/TaskAction.java
...essplatform/service/processing/jaxrs/task/TaskAction.java
+74
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2AddAfter.java
...essplatform/service/processing/jaxrs/task/V2AddAfter.java
+116
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2AddBefore.java
...ssplatform/service/processing/jaxrs/task/V2AddBefore.java
+116
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Extend.java
...ocessplatform/service/processing/jaxrs/task/V2Extend.java
+116
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Remove.java
...ocessplatform/service/processing/jaxrs/task/V2Remove.java
+98
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Reset.java
...rocessplatform/service/processing/jaxrs/task/V2Reset.java
+13
-3
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionAddSplit.java
...latform/service/processing/jaxrs/work/ActionAddSplit.java
+2
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionManualAppendIdentity.java
...ice/processing/jaxrs/work/ActionManualAppendIdentity.java
+12
-3
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionRollback.java
...latform/service/processing/jaxrs/work/ActionRollback.java
+269
-304
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2AddSplit.java
...essplatform/service/processing/jaxrs/work/V2AddSplit.java
+2
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Retract.java
...cessplatform/service/processing/jaxrs/work/V2Retract.java
+3
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Rollback.java
...essplatform/service/processing/jaxrs/work/V2Rollback.java
+3
-3
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AbstractProcessor.java
...tform/service/processing/processor/AbstractProcessor.java
+7
-3
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AeiObjects.java
...cessplatform/service/processing/processor/AeiObjects.java
+7
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor.java
.../service/processing/processor/manual/ManualProcessor.java
+225
-253
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor2.java
...service/processing/processor/manual/ManualProcessor2.java
+822
-0
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/exception/ExceptionDeprecatedAction.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.base.core.project.exception
;
public
class
ExceptionDeprecatedAction
extends
LanguagePromptException
{
private
static
final
long
serialVersionUID
=
8181296584823275140L
;
public
static
String
defaultMessage
=
"action is deprecated, see {}."
;
public
ExceptionDeprecatedAction
(
String
action
)
{
super
(
defaultMessage
,
action
);
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/processplatform/ManualTaskIdentityMatrix.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.base.core.project.processplatform
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.commons.collections.ListUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.Gson
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.tools.ListTools
;
public
class
ManualTaskIdentityMatrix
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
5107066526414421883L
;
private
Matrix
matrix
=
new
Matrix
();
public
static
ManualTaskIdentityMatrix
concreteSingleRow
(
List
<
String
>
list
)
{
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
new
ManualTaskIdentityMatrix
();
Row
row
=
new
Row
();
for
(
String
str
:
list
)
{
if
(
StringUtils
.
isNotBlank
(
str
))
{
row
.
add
(
str
);
}
}
if
(!
row
.
isEmpty
())
{
manualTaskIdentityMatrix
.
matrix
.
add
(
row
);
}
return
manualTaskIdentityMatrix
;
}
public
static
ManualTaskIdentityMatrix
concreteMultiRow
(
List
<
String
>
list
)
{
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
new
ManualTaskIdentityMatrix
();
for
(
String
str
:
list
)
{
if
(
StringUtils
.
isNotBlank
(
str
))
{
Row
row
=
new
Row
();
row
.
add
(
str
);
manualTaskIdentityMatrix
.
matrix
.
add
(
row
);
}
}
return
manualTaskIdentityMatrix
;
}
public
ManualTaskIdentityMatrix
extend
(
String
identity
,
boolean
replace
,
List
<
String
>
list
)
{
for
(
Row
row
:
matrix
)
{
int
idx
=
row
.
indexOf
(
identity
);
if
(
idx
>
0
)
{
row
.
addAll
(
idx
+
1
,
list
);
if
(
replace
)
{
row
.
remove
(
idx
);
}
break
;
}
}
return
this
;
}
public
ManualTaskIdentityMatrix
extend
(
String
identity
,
boolean
replace
,
String
...
arr
)
{
return
this
.
extend
(
identity
,
replace
,
Arrays
.
asList
(
arr
));
}
public
ManualTaskIdentityMatrix
add
(
String
identity
,
boolean
after
,
boolean
replace
,
List
<
String
>
list
)
{
int
rowpos
=
0
;
int
colpos
=
-
1
;
for
(
Row
row
:
matrix
)
{
colpos
=
row
.
indexOf
(
identity
);
if
(
colpos
>
-
1
)
{
break
;
}
else
{
rowpos
++;
}
}
if
(
replace
&&
(
colpos
>
-
1
))
{
matrix
.
get
(
rowpos
).
remove
(
colpos
);
}
if
(
after
)
{
rowpos
++;
}
for
(
String
str
:
list
)
{
Row
row
=
new
Row
();
row
.
add
(
str
);
matrix
.
add
(
rowpos
++,
row
);
}
compact
();
return
this
;
}
public
ManualTaskIdentityMatrix
add
(
String
identity
,
boolean
after
,
boolean
replace
,
String
...
arr
)
{
return
this
.
add
(
identity
,
after
,
replace
,
Arrays
.
asList
(
arr
));
}
public
void
clear
()
{
this
.
matrix
.
clear
();
}
public
boolean
isEmpty
()
{
compact
();
return
matrix
.
isEmpty
();
}
public
ManualTaskIdentityMatrix
remove
(
String
identity
)
{
matrix
.
stream
().
forEach
(
row
->
row
.
remove
(
identity
));
compact
();
return
this
;
}
public
ManualTaskIdentityMatrix
remove
(
Collection
<
String
>
identities
)
{
matrix
.
stream
().
forEach
(
row
->
row
.
removeAll
(
identities
));
compact
();
return
this
;
}
/**
* 工作处理完成,如果在行中有用户直接删除行
*
* @param identity
* @return
*/
public
List
<
String
>
completed
(
String
identity
)
{
List
<
String
>
list
=
new
ArrayList
<>();
matrix
.
stream
().
forEach
(
row
->
{
if
(
row
.
contains
(
identity
))
{
list
.
addAll
(
row
);
row
.
clear
();
}
});
compact
();
return
ListTools
.
trim
(
list
,
true
,
true
);
}
/**
* 工作处理完成,如果在行中有用户直接删除行
*
* @param identities
* @return
*/
public
List
<
String
>
completed
(
List
<
String
>
identities
)
{
List
<
String
>
list
=
new
ArrayList
<>();
matrix
.
stream
().
forEach
(
row
->
{
if
(!
ListUtils
.
intersection
(
identities
,
row
).
isEmpty
())
{
list
.
addAll
(
row
);
row
.
clear
();
}
});
compact
();
return
ListTools
.
trim
(
list
,
true
,
true
);
}
public
ManualTaskIdentityMatrix
replace
(
String
source
,
String
target
)
{
matrix
.
stream
().
forEach
(
row
->
row
.
replaceAll
(
s
->
StringUtils
.
equalsIgnoreCase
(
s
,
source
)
?
target
:
s
));
compact
();
return
this
;
}
public
List
<
String
>
read
()
{
return
isEmpty
()
?
new
ArrayList
<>()
:
new
ArrayList
<>(
matrix
.
get
(
0
));
}
public
List
<
String
>
flat
()
{
List
<
String
>
list
=
new
ArrayList
<>();
this
.
matrix
.
stream
().
forEach
(
row
->
row
.
stream
().
forEach
(
list:
:
add
));
return
list
;
}
public
ManualTaskIdentityMatrix
reduce
(
String
identity
)
{
matrix
.
stream
().
forEach
(
row
->
{
if
(
row
.
contains
(
identity
))
{
row
.
clear
();
row
.
add
(
identity
);
}
});
compact
();
return
this
;
}
private
void
compact
()
{
Iterator
<
Row
>
rowIterator
=
matrix
.
iterator
();
while
(
rowIterator
.
hasNext
())
{
Row
row
=
rowIterator
.
next
();
Iterator
<
String
>
cellIterator
=
row
.
iterator
();
while
(
cellIterator
.
hasNext
())
{
if
(
StringUtils
.
isEmpty
(
cellIterator
.
next
()))
{
cellIterator
.
remove
();
}
}
List
<
String
>
trim
=
ListTools
.
trim
(
row
,
true
,
true
);
row
.
clear
();
row
.
addAll
(
trim
);
if
(
row
.
isEmpty
())
{
rowIterator
.
remove
();
}
}
}
public
static
class
Matrix
extends
LinkedList
<
Row
>
{
private
static
final
long
serialVersionUID
=
-
53740621980996248L
;
}
public
static
class
Row
extends
LinkedList
<
String
>
{
private
static
final
long
serialVersionUID
=
4774108881630629L
;
}
public
static
ManualTaskIdentityMatrix
fromJson
(
String
json
)
{
ManualTaskIdentityMatrix
o
=
new
ManualTaskIdentityMatrix
();
o
.
matrix
=
(
new
Gson
()).
fromJson
(
json
,
Matrix
.
class
);
return
o
;
}
public
String
toJson
()
{
return
(
new
Gson
()).
toJson
(
this
.
matrix
);
}
public
static
void
main
(
String
[]
args
)
{
String
json
=
"[['A','B','C','D'],['E','F'],['G'],['H'],['I','J'],['K','L','M']]"
;
ManualTaskIdentityMatrix
matrix
=
ManualTaskIdentityMatrix
.
fromJson
(
json
);
matrix
.
reduce
(
"C"
);
matrix
.
replace
(
"C"
,
"E"
);
System
.
out
.
println
(
matrix
.
toJson
());
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/ExceptionExtend.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.assemble.surface.jaxrs.task
;
import
com.x.base.core.project.exception.LanguagePromptException
;
class
ExceptionExtend
extends
LanguagePromptException
{
private
static
final
long
serialVersionUID
=
-
5515077418025884395L
;
ExceptionExtend
(
String
id
)
{
super
(
"扩充待办人失败, task:{}."
,
id
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/V2Extend.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.assemble.surface.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
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.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
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.StringTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
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.TaskCompleted
;
import
com.x.processplatform.core.entity.content.Task_
;
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.express.ProcessingAttributes
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2ExtendWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProcessing
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity
;
import
com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity
;
public
class
V2Extend
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
V2Extend
.
class
);
// 当前提交的串号
private
final
String
series
=
StringTools
.
uniqueToken
();
// 新加入的身份列表
private
List
<
String
>
identites
=
new
ArrayList
<>();
// 新创建的待办标识列表
private
List
<
String
>
newTasks
=
new
ArrayList
<>();
// 当前待办转成已办得到的已办id
private
String
taskCompletedId
;
// 已经存在的待办标识列表
private
List
<
String
>
existTaskIds
=
new
ArrayList
<>();
// 输入
private
Wi
wi
;
// 本操作创建的记录
private
Record
record
;
// 当前执行用户
private
EffectivePerson
effectivePerson
;
// 根据输入得到的待办
private
Task
task
=
null
;
// 根据待办获取的工作
private
Work
work
=
null
;
// 当前待办的workLog
private
WorkLog
workLog
=
null
;
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
}
this
.
init
(
effectivePerson
,
jsonElement
);
this
.
extend
(
this
.
task
,
wi
.
getReplace
(),
identites
);
if
(
BooleanUtils
.
isTrue
(
wi
.
getReplace
()))
{
taskCompletedId
=
this
.
processingTask
(
this
.
task
);
}
this
.
processingWork
(
this
.
task
);
this
.
record
(
task
,
workLog
);
if
(
StringUtils
.
isNotEmpty
(
taskCompletedId
))
{
this
.
updateTaskCompleted
();
}
this
.
updateTask
();
return
result
();
}
private
void
init
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
this
.
effectivePerson
=
effectivePerson
;
this
.
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
this
.
task
=
emc
.
find
(
wi
.
getTask
(),
Task
.
class
);
if
(
null
==
task
)
{
throw
new
ExceptionEntityNotExist
(
wi
.
getTask
(),
Task
.
class
);
}
this
.
work
=
emc
.
find
(
task
.
getWork
(),
Work
.
class
);
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
this
.
workLog
=
emc
.
firstEqualAndEqual
(
WorkLog
.
class
,
WorkLog
.
job_FIELDNAME
,
task
.
getJob
(),
WorkLog
.
fromActivityToken_FIELDNAME
,
task
.
getActivityToken
());
if
(
null
==
workLog
)
{
throw
new
ExceptionEntityNotExist
(
WorkLog
.
class
);
}
WoControl
control
=
business
.
getControl
(
effectivePerson
,
task
,
WoControl
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
control
.
getAllowReset
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
task
);
}
this
.
existTaskIds
=
emc
.
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
task
.
getJob
(),
Task
.
activity_FIELDNAME
,
task
.
getActivity
());
this
.
identites
=
business
.
organization
().
identity
().
list
(
wi
.
getIdentityList
());
// 在新扩充待办人员中去除已经有待办人员
this
.
identites
=
ListUtils
.
subtract
(
this
.
identites
,
ListTools
.
toList
(
task
.
getIdentity
()));
if
(
ListTools
.
isEmpty
(
identites
))
{
throw
new
ExceptionIdentityEmpty
();
}
}
}
private
void
extend
(
Task
task
,
Boolean
replace
,
List
<
String
>
identites
)
throws
Exception
{
V2ExtendWi
req
=
new
V2ExtendWi
();
req
.
setTask
(
task
.
getId
());
req
.
setReplace
(
replace
);
req
.
setIdentityList
(
identites
);
WrapBoolean
resp
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"task"
,
"extend"
),
req
,
task
.
getJob
())
.
getData
(
WrapBoolean
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
resp
.
getValue
()))
{
throw
new
ExceptionExtend
(
task
.
getId
());
}
}
private
String
processingTask
(
Task
task
)
throws
Exception
{
WrapProcessing
req
=
new
WrapProcessing
();
req
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_EXTEND
);
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
putQuery
(
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"task"
,
task
.
getId
(),
"processing"
),
req
,
task
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isEmpty
(
resp
.
getId
()))
{
throw
new
ExceptionTaskProcessing
(
task
.
getId
());
}
else
{
return
resp
.
getId
();
}
}
private
void
processingWork
(
Task
task
)
throws
Exception
{
ProcessingAttributes
req
=
new
ProcessingAttributes
();
req
.
setType
(
ProcessingAttributes
.
TYPE_TASKEXTEND
);
req
.
setSeries
(
this
.
series
);
WoId
resp
=
ThisApplication
.
context
().
applications
()
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"work"
,
task
.
getWork
(),
"processing"
),
req
,
task
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isEmpty
(
resp
.
getId
()))
{
throw
new
ExceptionWorkProcessing
(
task
.
getWork
());
}
}
private
void
record
(
Task
task
,
WorkLog
workLog
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
final
List
<
String
>
nextTaskIdentities
=
new
ArrayList
<>();
this
.
record
=
new
Record
(
workLog
,
task
);
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
task
.
getJob
());
if
(
null
!=
workCompleted
)
{
record
.
setCompleted
(
true
);
record
.
setWorkCompleted
(
workCompleted
.
getId
());
}
record
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
record
.
setType
(
Record
.
TYPE_RESET
);
List
<
String
>
ids
=
emc
.
idsEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
task
.
getJob
(),
Task
.
activity_FIELDNAME
,
task
.
getActivity
());
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
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
());
}
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"
,
task
.
getJob
()),
record
,
task
.
getJob
())
.
getData
(
WoId
.
class
);
if
(
StringUtils
.
isBlank
(
resp
.
getId
()))
{
throw
new
ExceptionExtend
(
task
.
getId
());
}
}
private
void
updateTaskCompleted
()
throws
Exception
{
/* 记录下一处理人信息 */
WrapUpdateNextTaskIdentity
req
=
new
WrapUpdateNextTaskIdentity
();
req
.
getTaskCompletedList
().
add
(
this
.
taskCompletedId
);
req
.
setNextTaskIdentityList
(
record
.
getProperties
().
getNextManualTaskIdentityList
());
ThisApplication
.
context
().
applications
()
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"taskcompleted"
,
"next"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
.
getData
(
WrapBoolean
.
class
);
}
private
void
updateTask
()
throws
Exception
{
/* 记录上一处理人信息 */
if
(
ListTools
.
isNotEmpty
(
newTasks
))
{
WrapUpdatePrevTaskIdentity
req
=
new
WrapUpdatePrevTaskIdentity
();
req
.
setTaskList
(
newTasks
);
req
.
setPrevTaskIdentity
(
task
.
getIdentity
());
req
.
getPrevTaskIdentityList
().
add
(
task
.
getIdentity
());
ThisApplication
.
context
().
applications
()
.
putQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"task"
,
"prev"
,
"task"
,
"identity"
),
req
,
task
.
getJob
())
.
getData
(
WrapBoolean
.
class
);
}
}
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
V2ExtendWi
{
private
static
final
long
serialVersionUID
=
-
3241215869441470402L
;
}
public
static
class
WoControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
-
8781558581462660831L
;
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
4883624438858385234L
;
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Record.java
浏览文件 @
b77fdb3f
...
@@ -38,55 +38,58 @@ import com.x.processplatform.core.entity.element.ActivityType;
...
@@ -38,55 +38,58 @@ import com.x.processplatform.core.entity.element.ActivityType;
@Inheritance
(
strategy
=
InheritanceType
.
TABLE_PER_CLASS
)
@Inheritance
(
strategy
=
InheritanceType
.
TABLE_PER_CLASS
)
public
class
Record
extends
SliceJpaObject
{
public
class
Record
extends
SliceJpaObject
{
private
static
final
long
serialVersionUID
=
8673378766635237050L
;
/* 正常流转 */
/* 正常流转 */
public
final
static
String
TYPE_CURRENTTASK
=
"currentTask"
;
public
static
final
String
TYPE_CURRENTTASK
=
"currentTask"
;
/* 正常流转 */
/* 正常流转 */
public
final
static
String
TYPE_TASK
=
"task"
;
public
static
final
String
TYPE_TASK
=
"task"
;
/* 转交流转 */
/* 转交流转 */
public
final
static
String
TYPE_APPENDTASK
=
"appendTask"
;
public
static
final
String
TYPE_APPENDTASK
=
"appendTask"
;
/* 回退流转 */
/* 回退流转 */
public
final
static
String
TYPE_BACK
=
"back"
;
public
static
final
String
TYPE_BACK
=
"back"
;
/* 调度 */
/* 调度 */
public
final
static
String
TYPE_REROUTE
=
"reroute"
;
public
static
final
String
TYPE_REROUTE
=
"reroute"
;
/* 撤回 */
/* 撤回 */
public
final
static
String
TYPE_RETRACT
=
"retract"
;
public
static
final
String
TYPE_RETRACT
=
"retract"
;
/* 回滚 */
/* 回滚 */
public
final
static
String
TYPE_ROLLBACK
=
"rollback"
;
public
static
final
String
TYPE_ROLLBACK
=
"rollback"
;
/* 重置 */
/* 重置 */
public
final
static
String
TYPE_RESET
=
"reset"
;
public
static
final
String
TYPE_RESET
=
"reset"
;
/* 增加分支 */
/* 增加分支 */
public
final
static
String
TYPE_ADDSPLIT
=
"addSplit"
;
public
static
final
String
TYPE_ADDSPLIT
=
"addSplit"
;
/* 催办 */
/* 催办 */
public
final
static
String
TYPE_URGE
=
"urge"
;
public
static
final
String
TYPE_URGE
=
"urge"
;
/* 超时 */
/* 超时 */
public
final
static
String
TYPE_EXPIRE
=
"expire"
;
public
static
final
String
TYPE_EXPIRE
=
"expire"
;
/* 待阅 */
/* 待阅 */
public
final
static
String
TYPE_READ
=
"read"
;
public
static
final
String
TYPE_READ
=
"read"
;
/* 授权 */
/* 授权 */
public
final
static
String
TYPE_EMPOWER
=
"empower"
;
public
static
final
String
TYPE_EMPOWER
=
"empower"
;
/* 超时自动流转 */
/* 超时自动流转 */
public
final
static
String
TYPE_PASSEXPIRED
=
"passExpired"
;
public
static
final
String
TYPE_PASSEXPIRED
=
"passExpired"
;
/* 外部调用流转 */
/* 外部调用流转 */
public
final
static
String
TYPE_SERVICE
=
"service"
;
public
static
final
String
TYPE_SERVICE
=
"service"
;
/*
定制意见
*/
/*
待办扩充
*/
public
final
static
String
TYPE_CUSTOM
=
"custom
"
;
public
static
final
String
TYPE_TASKEXTEND
=
"taskExtend
"
;
private
static
final
long
serialVersionUID
=
8673378766635237050L
;
/* 定制意见 */
public
static
final
String
TYPE_CUSTOM
=
"custom"
;
private
static
final
String
TABLE
=
PersistenceProperties
.
Content
.
Record
.
table
;
private
static
final
String
TABLE
=
PersistenceProperties
.
Content
.
Record
.
table
;
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/TaskCompleted.java
浏览文件 @
b77fdb3f
...
@@ -80,6 +80,12 @@ public class TaskCompleted extends SliceJpaObject implements ProjectionInterface
...
@@ -80,6 +80,12 @@ public class TaskCompleted extends SliceJpaObject implements ProjectionInterface
public
static
final
String
PROCESSINGTYPE_BEAPPENDEDTASK
=
"beAppendedTask"
;
public
static
final
String
PROCESSINGTYPE_BEAPPENDEDTASK
=
"beAppendedTask"
;
/* 授权,授权给他人处理 */
/* 授权,授权给他人处理 */
public
static
final
String
PROCESSINGTYPE_EMPOWER
=
"empower"
;
public
static
final
String
PROCESSINGTYPE_EMPOWER
=
"empower"
;
/* 扩充办理人 */
public
static
final
String
PROCESSINGTYPE_EXTEND
=
"extend"
;
/* 前添加处理人 */
public
static
final
String
PROCESSINGTYPE_ADDBEFORE
=
"addBefore"
;
/* 后添加处理人 */
public
static
final
String
PROCESSINGTYPE_ADDAFTER
=
"addAfter"
;
public
String
getId
()
{
public
String
getId
()
{
return
id
;
return
id
;
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Work.java
浏览文件 @
b77fdb3f
...
@@ -38,6 +38,7 @@ import com.x.base.core.entity.annotation.ContainerEntity;
...
@@ -38,6 +38,7 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.DateTools
;
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
;
...
@@ -51,6 +52,13 @@ import com.x.processplatform.core.entity.element.ActivityType;
...
@@ -51,6 +52,13 @@ import com.x.processplatform.core.entity.element.ActivityType;
+
JpaObject
.
DefaultUniqueConstraintSuffix
,
columnNames
=
{
JpaObject
.
IDCOLUMN
,
+
JpaObject
.
DefaultUniqueConstraintSuffix
,
columnNames
=
{
JpaObject
.
IDCOLUMN
,
JpaObject
.
CREATETIMECOLUMN
,
JpaObject
.
UPDATETIMECOLUMN
,
JpaObject
.
SEQUENCECOLUMN
})
})
JpaObject
.
CREATETIMECOLUMN
,
JpaObject
.
UPDATETIMECOLUMN
,
JpaObject
.
SEQUENCECOLUMN
})
})
@Inheritance
(
strategy
=
InheritanceType
.
TABLE_PER_CLASS
)
@Inheritance
(
strategy
=
InheritanceType
.
TABLE_PER_CLASS
)
/**
* 7.2.0版本 增加manualTaskIdentityMatrix
*
* @author ray
*
*/
public
class
Work
extends
SliceJpaObject
implements
ProjectionInterface
{
public
class
Work
extends
SliceJpaObject
implements
ProjectionInterface
{
private
static
final
long
serialVersionUID
=
7668822947307502058L
;
private
static
final
long
serialVersionUID
=
7668822947307502058L
;
...
@@ -84,10 +92,10 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -84,10 +92,10 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this
.
title
=
StringTools
.
utf8SubString
(
this
.
getProperties
().
getTitle
(),
length_255B
-
3
)
+
"..."
;
this
.
title
=
StringTools
.
utf8SubString
(
this
.
getProperties
().
getTitle
(),
length_255B
-
3
)
+
"..."
;
}
}
// 填入处理人文本
// 填入处理人文本
if
(
ListTools
.
isEmpty
(
this
.
manualTaskIdentityList
))
{
if
(
ListTools
.
isEmpty
(
this
.
getManualTaskIdentityMatrix
().
flat
()
))
{
this
.
manualTaskIdentityText
=
""
;
this
.
manualTaskIdentityText
=
""
;
}
else
{
}
else
{
String
text
=
StringUtils
.
join
(
OrganizationDefinition
.
name
(
manualTaskIdentityList
),
","
);
String
text
=
StringUtils
.
join
(
OrganizationDefinition
.
name
(
this
.
getManualTaskIdentityMatrix
().
flat
()
),
","
);
text
=
StringTools
.
utf8SubString
(
text
,
length_255B
);
text
=
StringTools
.
utf8SubString
(
text
,
length_255B
);
this
.
setManualTaskIdentityText
(
text
);
this
.
setManualTaskIdentityText
(
text
);
}
}
...
@@ -101,6 +109,7 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -101,6 +109,7 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this
.
splitValueList
=
this
.
getProperties
().
getSplitValueList
();
this
.
splitValueList
=
this
.
getProperties
().
getSplitValueList
();
this
.
embedTargetJob
=
this
.
getProperties
().
getEmbedTargetJob
();
this
.
embedTargetJob
=
this
.
getProperties
().
getEmbedTargetJob
();
this
.
embedCompleted
=
this
.
getProperties
().
getEmbedCompleted
();
this
.
embedCompleted
=
this
.
getProperties
().
getEmbedCompleted
();
this
.
manualTaskIdentityMatrix
=
this
.
getProperties
().
getManualTaskIdentityMatrix
();
}
}
/* 更新运行方法 */
/* 更新运行方法 */
...
@@ -181,6 +190,18 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -181,6 +190,18 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this
.
embedCompleted
=
embedCompleted
;
this
.
embedCompleted
=
embedCompleted
;
}
}
public
ManualTaskIdentityMatrix
getManualTaskIdentityMatrix
()
{
if
(
null
==
this
.
manualTaskIdentityMatrix
)
{
this
.
setManualTaskIdentityMatrix
(
new
ManualTaskIdentityMatrix
());
}
return
this
.
manualTaskIdentityMatrix
;
}
public
void
setManualTaskIdentityMatrix
(
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
)
{
this
.
manualTaskIdentityMatrix
=
manualTaskIdentityMatrix
;
this
.
getProperties
().
setManualTaskIdentityMatrix
(
manualTaskIdentityMatrix
);
}
@Transient
@Transient
@FieldDescribe
(
"要拆分的值"
)
@FieldDescribe
(
"要拆分的值"
)
private
List
<
String
>
splitValueList
;
private
List
<
String
>
splitValueList
;
...
@@ -193,6 +214,11 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -193,6 +214,11 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
@FieldDescribe
(
"子流程返回标识."
)
@FieldDescribe
(
"子流程返回标识."
)
private
String
embedCompleted
;
private
String
embedCompleted
;
public
static
final
String
MANUALTASKIDENTITYMATRIX_FIELDNAME
=
"manualTaskIdentityMatrix"
;
@FieldDescribe
(
"待办身份矩阵."
)
@Transient
private
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
;
public
static
final
String
job_FIELDNAME
=
"job"
;
public
static
final
String
job_FIELDNAME
=
"job"
;
@FieldDescribe
(
"工作"
)
@FieldDescribe
(
"工作"
)
@Column
(
length
=
JpaObject
.
length_id
,
name
=
ColumnNamePrefix
+
job_FIELDNAME
)
@Column
(
length
=
JpaObject
.
length_id
,
name
=
ColumnNamePrefix
+
job_FIELDNAME
)
...
@@ -894,9 +920,7 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -894,9 +920,7 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this
.
activityType
=
activityType
;
this
.
activityType
=
activityType
;
}
}
public
List
<
String
>
getManualTaskIdentityList
()
{
return
manualTaskIdentityList
;
}
public
ActivityType
getDestinationActivityType
()
{
public
ActivityType
getDestinationActivityType
()
{
return
destinationActivityType
;
return
destinationActivityType
;
...
@@ -1006,14 +1030,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -1006,14 +1030,6 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
this
.
manualTaskIdentityText
=
manualTaskIdentityText
;
this
.
manualTaskIdentityText
=
manualTaskIdentityText
;
}
}
// public String getTitleLob() {
// return titleLob;
// }
// public void setTitleLob(String titleLob) {
// this.titleLob = titleLob;
// }
public
String
getStringValue01
()
{
public
String
getStringValue01
()
{
return
stringValue01
;
return
stringValue01
;
}
}
...
@@ -1277,5 +1293,9 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
...
@@ -1277,5 +1293,9 @@ public class Work extends SliceJpaObject implements ProjectionInterface {
public
void
setManualTaskIdentityList
(
List
<
String
>
manualTaskIdentityList
)
{
public
void
setManualTaskIdentityList
(
List
<
String
>
manualTaskIdentityList
)
{
this
.
manualTaskIdentityList
=
manualTaskIdentityList
;
this
.
manualTaskIdentityList
=
manualTaskIdentityList
;
}
}
public
List
<
String
>
getManualTaskIdentityList
()
{
return
manualTaskIdentityList
;
}
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkProperties.java
浏览文件 @
b77fdb3f
...
@@ -7,6 +7,7 @@ import java.util.Map;
...
@@ -7,6 +7,7 @@ import java.util.Map;
import
com.x.base.core.entity.JsonProperties
;
import
com.x.base.core.entity.JsonProperties
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
public
class
WorkProperties
extends
JsonProperties
{
public
class
WorkProperties
extends
JsonProperties
{
...
@@ -39,6 +40,17 @@ public class WorkProperties extends JsonProperties {
...
@@ -39,6 +40,17 @@ public class WorkProperties extends JsonProperties {
@FieldDescribe
(
"拆分值列表"
)
@FieldDescribe
(
"拆分值列表"
)
private
List
<
String
>
splitValueList
=
new
ArrayList
<>();
private
List
<
String
>
splitValueList
=
new
ArrayList
<>();
@FieldDescribe
(
"待办身份矩阵"
)
private
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
new
ManualTaskIdentityMatrix
();
public
ManualTaskIdentityMatrix
getManualTaskIdentityMatrix
()
{
return
manualTaskIdentityMatrix
;
}
public
void
setManualTaskIdentityMatrix
(
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
)
{
this
.
manualTaskIdentityMatrix
=
manualTaskIdentityMatrix
;
}
public
List
<
String
>
getManualForceTaskIdentityList
()
{
public
List
<
String
>
getManualForceTaskIdentityList
()
{
if
(
this
.
manualForceTaskIdentityList
==
null
)
{
if
(
this
.
manualForceTaskIdentityList
==
null
)
{
this
.
manualForceTaskIdentityList
=
new
ArrayList
<>();
this
.
manualForceTaskIdentityList
=
new
ArrayList
<>();
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java
浏览文件 @
b77fdb3f
...
@@ -79,6 +79,7 @@ public class Application extends SliceJpaObject {
...
@@ -79,6 +79,7 @@ public class Application extends SliceJpaObject {
public
void
postLoad
()
{
public
void
postLoad
()
{
if
(
null
!=
this
.
properties
)
{
if
(
null
!=
this
.
properties
)
{
this
.
defaultForm
=
this
.
getProperties
().
getDefaultForm
();
this
.
defaultForm
=
this
.
getProperties
().
getDefaultForm
();
this
.
maintenanceIdentity
=
this
.
getProperties
().
getMaintenanceIdentity
();
}
}
}
}
...
@@ -117,6 +118,20 @@ public class Application extends SliceJpaObject {
...
@@ -117,6 +118,20 @@ public class Application extends SliceJpaObject {
this
.
getProperties
().
setDefaultForm
(
defaultForm
);
this
.
getProperties
().
setDefaultForm
(
defaultForm
);
}
}
public
static
final
String
MAINTENANCEIDENTITY_FIELDNAME
=
"maintenanceIdentity"
;
@FieldDescribe
(
"流程维护身份,如果无法找到处理身份默认的流程处理身份."
)
@Transient
private
String
maintenanceIdentity
;
public
String
getMaintenanceIdentity
()
{
return
maintenanceIdentity
;
}
public
void
setMaintenanceIdentity
(
String
maintenanceIdentity
)
{
this
.
maintenanceIdentity
=
maintenanceIdentity
;
this
.
getProperties
().
setMaintenanceIdentity
(
maintenanceIdentity
);
}
public
static
final
String
name_FIELDNAME
=
"name"
;
public
static
final
String
name_FIELDNAME
=
"name"
;
@Flag
@Flag
@FieldDescribe
(
"名称."
)
@FieldDescribe
(
"名称."
)
...
@@ -169,7 +184,7 @@ public class Application extends SliceJpaObject {
...
@@ -169,7 +184,7 @@ public class Application extends SliceJpaObject {
@PersistentCollection
(
fetch
=
FetchType
.
EAGER
)
@PersistentCollection
(
fetch
=
FetchType
.
EAGER
)
@ContainerTable
(
name
=
TABLE
+
ContainerTableNameMiddle
@ContainerTable
(
name
=
TABLE
+
ContainerTableNameMiddle
+
availableGroupList_FIELDNAME
,
joinIndex
=
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
availableGroupList_FIELDNAME
,
joinIndex
=
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
availableGroupList_FIELDNAME
+
JoinIndexNameSuffix
))
+
availableGroupList_FIELDNAME
+
JoinIndexNameSuffix
))
@OrderColumn
(
name
=
ORDERCOLUMNCOLUMN
)
@OrderColumn
(
name
=
ORDERCOLUMNCOLUMN
)
@ElementColumn
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
availableGroupList_FIELDNAME
)
@ElementColumn
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
availableGroupList_FIELDNAME
)
@ElementIndex
(
name
=
TABLE
+
IndexNameMiddle
+
availableGroupList_FIELDNAME
+
ElementIndexNameSuffix
)
@ElementIndex
(
name
=
TABLE
+
IndexNameMiddle
+
availableGroupList_FIELDNAME
+
ElementIndexNameSuffix
)
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ApplicationProperties.java
浏览文件 @
b77fdb3f
...
@@ -6,10 +6,21 @@ import com.x.base.core.project.annotation.FieldDescribe;
...
@@ -6,10 +6,21 @@ import com.x.base.core.project.annotation.FieldDescribe;
public
class
ApplicationProperties
extends
JsonProperties
{
public
class
ApplicationProperties
extends
JsonProperties
{
private
static
final
long
serialVersionUID
=
8342746214747017734L
;
private
static
final
long
serialVersionUID
=
8342746214747017734L
;
@FieldDescribe
(
"应用默认表单"
)
@FieldDescribe
(
"应用默认表单"
)
private
String
defaultForm
;
private
String
defaultForm
;
@FieldDescribe
(
"流程维护身份,如果无法找到处理身份默认的流程处理身份."
)
private
String
maintenanceIdentity
;
public
String
getMaintenanceIdentity
()
{
return
maintenanceIdentity
;
}
public
void
setMaintenanceIdentity
(
String
maintenanceIdentity
)
{
this
.
maintenanceIdentity
=
maintenanceIdentity
;
}
public
String
getDefaultForm
()
{
public
String
getDefaultForm
()
{
return
defaultForm
;
return
defaultForm
;
}
}
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Manual.java
浏览文件 @
b77fdb3f
...
@@ -34,6 +34,7 @@ import com.x.base.core.entity.annotation.ContainerEntity;
...
@@ -34,6 +34,7 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import
com.x.base.core.entity.annotation.Flag
;
import
com.x.base.core.entity.annotation.Flag
;
import
com.x.base.core.entity.annotation.IdReference
;
import
com.x.base.core.entity.annotation.IdReference
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.processplatform.core.entity.PersistenceProperties
;
import
com.x.processplatform.core.entity.PersistenceProperties
;
@Entity
@Entity
...
@@ -109,6 +110,18 @@ public class Manual extends Activity {
...
@@ -109,6 +110,18 @@ public class Manual extends Activity {
this
.
properties
.
setCustomData
(
customData
);
this
.
properties
.
setCustomData
(
customData
);
}
}
public
ManualTaskIdentityMatrix
identitiesToManualTaskIdentityMatrix
(
List
<
String
>
identities
)
{
switch
(
this
.
getManualMode
())
{
case
parallel:
case
queue:
return
ManualTaskIdentityMatrix
.
concreteMultiRow
(
identities
);
case
single:
case
grab:
default
:
return
ManualTaskIdentityMatrix
.
concreteSingleRow
(
identities
);
}
}
@FieldDescribe
(
"分组."
)
@FieldDescribe
(
"分组."
)
@CheckPersist
(
allowEmpty
=
true
)
@CheckPersist
(
allowEmpty
=
true
)
@Column
(
length
=
JpaObject
.
length_255B
,
name
=
ColumnNamePrefix
+
group_FIELDNAME
)
@Column
(
length
=
JpaObject
.
length_255B
,
name
=
ColumnNamePrefix
+
group_FIELDNAME
)
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ManualMode.java
浏览文件 @
b77fdb3f
...
@@ -3,7 +3,7 @@ package com.x.processplatform.core.entity.element;
...
@@ -3,7 +3,7 @@ package com.x.processplatform.core.entity.element;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.JpaObject
;
/**
/**
* 节点方式
,单人活动,并行, 顺序执行,
抢办
* 节点方式
:单人活动,并行,顺序执行,
抢办
*/
*/
public
enum
ManualMode
{
public
enum
ManualMode
{
single
,
parallel
,
queue
,
grab
;
single
,
parallel
,
queue
,
grab
;
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ManualTaskIdentityMatrix.java
已删除
100644 → 0
浏览文件 @
44c3c2df
package
com.x.processplatform.core.entity.element
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
ManualTaskIdentityMatrix
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
5107066526414421883L
;
private
List
<
List
<
String
>>
matrix
=
new
ArrayList
<>();
public
static
ManualTaskIdentityMatrix
concteteAsColumn
(
List
<
String
>
list
)
{
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
new
ManualTaskIdentityMatrix
();
for
(
String
str
:
list
)
{
if
(
StringUtils
.
isNotBlank
(
str
))
{
List
<
String
>
row
=
new
ArrayList
<>();
row
.
add
(
str
);
manualTaskIdentityMatrix
.
matrix
.
add
(
row
);
}
}
return
manualTaskIdentityMatrix
;
}
public
static
ManualTaskIdentityMatrix
concteteAsRow
(
List
<
String
>
list
)
{
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
new
ManualTaskIdentityMatrix
();
List
<
String
>
row
=
new
ArrayList
<>();
for
(
String
str
:
list
)
{
if
(
StringUtils
.
isNotBlank
(
str
))
{
row
.
add
(
str
);
}
}
if
(!
row
.
isEmpty
())
{
manualTaskIdentityMatrix
.
matrix
.
add
(
row
);
}
return
manualTaskIdentityMatrix
;
}
public
void
clear
()
{
this
.
matrix
.
clear
();
}
public
boolean
isEmpty
()
{
compact
();
return
matrix
.
isEmpty
();
}
public
boolean
remove
(
String
identity
)
{
boolean
tag
=
false
;
for
(
List
<
String
>
list
:
matrix
)
{
tag
=
list
.
remove
(
identity
)
||
tag
;
}
compact
();
return
tag
;
}
public
ManualTaskIdentityMatrix
replace
(
String
source
,
String
target
)
{
for
(
List
<
String
>
list
:
this
.
matrix
)
{
list
.
replaceAll
(
s
->
StringUtils
.
equalsIgnoreCase
(
s
,
source
)
?
target
:
s
);
}
compact
();
return
this
;
}
private
void
compact
()
{
for
(
List
<
String
>
row
:
matrix
)
{
Iterator
<
String
>
cell
=
row
.
iterator
();
while
(
cell
.
hasNext
())
{
String
value
=
cell
.
next
();
if
(
StringUtils
.
isEmpty
(
value
))
{
cell
.
remove
();
}
}
}
Iterator
<
List
<
String
>>
row
=
matrix
.
iterator
();
while
(
row
.
hasNext
())
{
List
<
String
>
value
=
row
.
next
();
if
(
null
==
value
||
value
.
isEmpty
())
{
row
.
remove
();
}
}
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Process.java
浏览文件 @
b77fdb3f
...
@@ -96,6 +96,20 @@ public class Process extends SliceJpaObject {
...
@@ -96,6 +96,20 @@ public class Process extends SliceJpaObject {
}
}
}
}
public
static
final
String
MAINTENANCEIDENTITY_FIELDNAME
=
"maintenanceIdentity"
;
@FieldDescribe
(
"流程维护身份,如果无法找到处理身份默认的流程处理身份."
)
@Transient
private
String
maintenanceIdentity
;
public
String
getMaintenanceIdentity
()
{
return
maintenanceIdentity
;
}
public
void
setMaintenanceIdentity
(
String
maintenanceIdentity
)
{
this
.
maintenanceIdentity
=
maintenanceIdentity
;
this
.
getProperties
().
setMaintenanceIdentity
(
maintenanceIdentity
);
}
public
static
final
String
UPDATETABLEENABLE_FIELDNAME
=
"updateTableEnable"
;
public
static
final
String
UPDATETABLEENABLE_FIELDNAME
=
"updateTableEnable"
;
@FieldDescribe
(
"启用同步到自建表."
)
@FieldDescribe
(
"启用同步到自建表."
)
@Transient
@Transient
...
@@ -202,6 +216,7 @@ public class Process extends SliceJpaObject {
...
@@ -202,6 +216,7 @@ public class Process extends SliceJpaObject {
this
.
manualStayScriptText
=
this
.
getProperties
().
getManualStayScriptText
();
this
.
manualStayScriptText
=
this
.
getProperties
().
getManualStayScriptText
();
this
.
updateTableEnable
=
this
.
getProperties
().
getUpdateTableEnable
();
this
.
updateTableEnable
=
this
.
getProperties
().
getUpdateTableEnable
();
this
.
updateTableList
=
this
.
getProperties
().
getUpdateTableList
();
this
.
updateTableList
=
this
.
getProperties
().
getUpdateTableList
();
this
.
maintenanceIdentity
=
this
.
getProperties
().
getMaintenanceIdentity
();
}
}
}
}
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/ProcessProperties.java
浏览文件 @
b77fdb3f
...
@@ -33,6 +33,17 @@ public class ProcessProperties extends JsonProperties {
...
@@ -33,6 +33,17 @@ public class ProcessProperties extends JsonProperties {
@FieldDescribe
(
"同步到自建表."
)
@FieldDescribe
(
"同步到自建表."
)
private
List
<
String
>
updateTableList
;
private
List
<
String
>
updateTableList
;
@FieldDescribe
(
"流程维护身份,如果无法找到处理身份默认的流程处理身份."
)
private
String
maintenanceIdentity
;
public
String
getMaintenanceIdentity
()
{
return
maintenanceIdentity
;
}
public
void
setMaintenanceIdentity
(
String
maintenanceIdentity
)
{
this
.
maintenanceIdentity
=
maintenanceIdentity
;
}
public
Boolean
getUpdateTableEnable
()
{
public
Boolean
getUpdateTableEnable
()
{
return
updateTableEnable
;
return
updateTableEnable
;
}
}
...
...
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/ProcessingAttributes.java
浏览文件 @
b77fdb3f
...
@@ -23,6 +23,10 @@ public class ProcessingAttributes extends GsonPropertyObject {
...
@@ -23,6 +23,10 @@ public class ProcessingAttributes extends GsonPropertyObject {
public
static
final
String
TYPE_RETRACT
=
"retract"
;
public
static
final
String
TYPE_RETRACT
=
"retract"
;
public
static
final
String
TYPE_ROLLBACK
=
"rollback"
;
public
static
final
String
TYPE_ROLLBACK
=
"rollback"
;
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_TASKADDBEFORE
=
"taskAddBefore"
;
public
static
final
String
TYPE_TASKADDAFTER
=
"taskAddAfter"
;
private
Integer
loop
=
1
;
private
Integer
loop
=
1
;
@FieldDescribe
(
"强制从arrive开始"
)
@FieldDescribe
(
"强制从arrive开始"
)
...
...
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2AddAfterWi.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.core.express.service.processing.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
V2AddAfterWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3293122515327864483L
;
@FieldDescribe
(
"身份"
)
private
List
<
String
>
identityList
=
new
ArrayList
<>();
@FieldDescribe
(
"是否执行替换"
)
private
Boolean
replace
;
@FieldDescribe
(
"是否删除"
)
private
String
task
;
public
List
<
String
>
getIdentityList
()
{
return
identityList
;
}
public
void
setIdentityList
(
List
<
String
>
identityList
)
{
this
.
identityList
=
identityList
;
}
public
Boolean
getReplace
()
{
return
replace
;
}
public
void
setReplace
(
Boolean
replace
)
{
this
.
replace
=
replace
;
}
public
String
getTask
()
{
return
task
;
}
public
void
setTask
(
String
task
)
{
this
.
task
=
task
;
}
}
\ No newline at end of file
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2AddBeforeWi.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.core.express.service.processing.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
V2AddBeforeWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3293122515327864483L
;
@FieldDescribe
(
"身份"
)
private
List
<
String
>
identityList
=
new
ArrayList
<>();
@FieldDescribe
(
"是否执行替换"
)
private
Boolean
replace
;
@FieldDescribe
(
"是否删除"
)
private
String
task
;
public
List
<
String
>
getIdentityList
()
{
return
identityList
;
}
public
void
setIdentityList
(
List
<
String
>
identityList
)
{
this
.
identityList
=
identityList
;
}
public
Boolean
getReplace
()
{
return
replace
;
}
public
void
setReplace
(
Boolean
replace
)
{
this
.
replace
=
replace
;
}
public
String
getTask
()
{
return
task
;
}
public
void
setTask
(
String
task
)
{
this
.
task
=
task
;
}
}
\ No newline at end of file
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/service/processing/jaxrs/task/V2ExtendWi.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.core.express.service.processing.jaxrs.task
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
V2ExtendWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3293122515327864483L
;
@FieldDescribe
(
"身份"
)
private
List
<
String
>
identityList
=
new
ArrayList
<>();
@FieldDescribe
(
"是否执行替换"
)
private
Boolean
replace
;
@FieldDescribe
(
"是否删除"
)
private
String
task
;
public
List
<
String
>
getIdentityList
()
{
return
identityList
;
}
public
void
setIdentityList
(
List
<
String
>
identityList
)
{
this
.
identityList
=
identityList
;
}
public
Boolean
getReplace
()
{
return
replace
;
}
public
void
setReplace
(
Boolean
replace
)
{
this
.
replace
=
replace
;
}
public
String
getTask
()
{
return
task
;
}
public
void
setTask
(
String
task
)
{
this
.
task
=
task
;
}
}
\ No newline at end of file
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionAppend.java
浏览文件 @
b77fdb3f
...
@@ -150,12 +150,20 @@ class ActionAppend extends BaseAction {
...
@@ -150,12 +150,20 @@ class ActionAppend extends BaseAction {
o
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_BEAPPENDEDTASK
);
o
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_BEAPPENDEDTASK
);
}
}
}
}
Manual
manual
=
(
Manual
)
business
.
element
().
get
(
work
.
getActivity
(),
ActivityType
.
manual
);
if
(
null
==
manual
)
{
throw
new
ExceptionEntityNotExist
(
work
.
getActivity
(),
Manual
.
class
);
}
wo
.
getValueList
().
addAll
(
new
ArrayList
<>(
identities
));
wo
.
getValueList
().
addAll
(
new
ArrayList
<>(
identities
));
identities
=
ListUtils
.
sum
(
identities
=
ListUtils
.
sum
(
ListUtils
.
subtract
(
work
.
getManualTaskIdentityList
(),
ListTools
.
toList
(
task
.
getIdentity
())),
identities
);
ListUtils
.
subtract
(
work
.
getManualTaskIdentityMatrix
().
flat
(),
ListTools
.
toList
(
task
.
getIdentity
())),
identities
);
identities
=
business
.
organization
().
identity
().
list
(
ListTools
.
trim
(
identities
,
true
,
true
));
identities
=
business
.
organization
().
identity
().
list
(
ListTools
.
trim
(
identities
,
true
,
true
));
emc
.
beginTransaction
(
Work
.
class
);
emc
.
beginTransaction
(
Work
.
class
);
work
.
setManualTaskIdentityList
(
identities
);
// work.setManualTaskIdentityList(identities);
work
.
setManualTaskIdentityMatrix
(
manual
.
identitiesToManualTaskIdentityMatrix
(
identities
));
for
(
TaskIdentity
taskIdentity
:
taskIdentities
)
{
for
(
TaskIdentity
taskIdentity
:
taskIdentities
)
{
if
(
BooleanUtils
.
isNotTrue
(
taskIdentity
.
getIgnoreEmpower
())
if
(
BooleanUtils
.
isNotTrue
(
taskIdentity
.
getIgnoreEmpower
())
&&
StringUtils
.
isNotEmpty
(
taskIdentity
.
getFromIdentity
()))
{
&&
StringUtils
.
isNotEmpty
(
taskIdentity
.
getFromIdentity
()))
{
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionDelete.java
浏览文件 @
b77fdb3f
...
@@ -52,7 +52,8 @@ class ActionDelete extends BaseAction {
...
@@ -52,7 +52,8 @@ class ActionDelete extends BaseAction {
emc
.
beginTransaction
(
Task
.
class
);
emc
.
beginTransaction
(
Task
.
class
);
emc
.
beginTransaction
(
Work
.
class
);
emc
.
beginTransaction
(
Work
.
class
);
emc
.
remove
(
task
,
CheckRemoveType
.
all
);
emc
.
remove
(
task
,
CheckRemoveType
.
all
);
work
.
getManualTaskIdentityList
().
remove
(
task
.
getIdentity
());
// work.getManualTaskIdentityList().remove(task.getIdentity());
work
.
getManualTaskIdentityMatrix
().
remove
(
task
.
getIdentity
());
emc
.
commit
();
emc
.
commit
();
MessageFactory
.
task_delete
(
task
);
MessageFactory
.
task_delete
(
task
);
wo
.
setId
(
task
.
getId
());
wo
.
setId
(
task
.
getId
());
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionGrab.java
浏览文件 @
b77fdb3f
...
@@ -71,7 +71,7 @@ class ActionGrab extends BaseAction {
...
@@ -71,7 +71,7 @@ class ActionGrab extends BaseAction {
MessageFactory
.
task_delete
(
o
);
MessageFactory
.
task_delete
(
o
);
}
}
}
}
work
.
setManualTaskIdentityList
(
ListTools
.
toList
(
task
.
getIdentity
()
));
work
.
getManualTaskIdentityMatrix
().
reduce
(
task
.
getIdentity
(
));
emc
.
commit
();
emc
.
commit
();
wo
.
setId
(
task
.
getId
());
wo
.
setId
(
task
.
getId
());
result
.
setData
(
wo
);
result
.
setData
(
wo
);
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/ActionReset.java
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.task
;
package
com.x.processplatform.service.processing.jaxrs.task
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.project.exception.ExceptionDeprecatedAction
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
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.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.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.express.ProcessingAttributes
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.MessageFactory
;
import
com.x.processplatform.service.processing.Processing
;
@Deprecated
class
ActionReset
extends
BaseAction
{
class
ActionReset
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionReset
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionReset
.
class
);
...
@@ -40,106 +17,108 @@ class ActionReset extends BaseAction {
...
@@ -40,106 +17,108 @@ class ActionReset extends BaseAction {
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
throw
new
ExceptionDeprecatedAction
(
V2Reset
.
class
.
getName
());
Wo
wo
=
new
Wo
();
final
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
// ActionResult<Wo> result = new ActionResult<>();
String
executorSeed
=
null
;
// Wo wo = new Wo();
// final Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
// String executorSeed = null;
Task
task
=
emc
.
fetch
(
id
,
Task
.
class
,
ListTools
.
toList
(
Task
.
job_FIELDNAME
));
//
if
(
null
==
task
)
{
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
throw
new
ExceptionEntityNotExist
(
id
,
Task
.
class
);
// Task task = emc.fetch(id, Task.class, ListTools.toList(Task.job_FIELDNAME));
}
// if (null == task) {
executorSeed
=
task
.
getJob
();
// throw new ExceptionEntityNotExist(id, Task.class);
}
// }
// executorSeed = task.getJob();
Callable
<
String
>
callable
=
new
Callable
<
String
>()
{
// }
public
String
call
()
throws
Exception
{
//
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
// Callable<String> callable = new Callable<String>() {
Business
business
=
new
Business
(
emc
);
// public String call() throws Exception {
Task
task
=
emc
.
find
(
id
,
Task
.
class
);
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
if
(
null
==
task
)
{
// Business business = new Business(emc);
throw
new
ExceptionEntityNotExist
(
id
,
Task
.
class
);
// Task task = emc.find(id, Task.class);
}
// if (null == task) {
Work
work
=
emc
.
find
(
task
.
getWork
(),
Work
.
class
);
// throw new ExceptionEntityNotExist(id, Task.class);
if
(
null
==
work
)
{
// }
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
// Work work = emc.find(task.getWork(), Work.class);
}
// if (null == work) {
// throw new ExceptionEntityNotExist(task.getWork(), Work.class);
// 检查reset人员
// }
List
<
String
>
identites
=
ListTools
//
.
trim
(
business
.
organization
().
identity
().
list
(
wi
.
getIdentityList
()),
true
,
true
);
// // 检查reset人员
// List<String> identites = ListTools
// 在新增待办人员中删除当前的处理人
// .trim(business.organization().identity().list(wi.getIdentityList()), true, true);
identites
=
ListUtils
.
subtract
(
identites
,
ListTools
.
toList
(
task
.
getIdentity
()));
//
// // 在新增待办人员中删除当前的处理人
if
(
identites
.
isEmpty
())
{
// identites = ListUtils.subtract(identites, ListTools.toList(task.getIdentity()));
throw
new
ExceptionResetEmpty
();
//
}
// if (identites.isEmpty()) {
emc
.
beginTransaction
(
Work
.
class
);
// throw new ExceptionResetEmpty();
List
<
String
>
os
=
ListTools
.
trim
(
work
.
getManualTaskIdentityList
(),
true
,
true
);
// }
if
(
BooleanUtils
.
isNotTrue
(
wi
.
getKeep
()))
{
// emc.beginTransaction(Work.class);
Date
now
=
new
Date
();
// List<String> os = ListTools.trim(work.getManualTaskIdentityList(), true, true);
Long
duration
=
Config
.
workTime
().
betweenMinutes
(
task
.
getStartTime
(),
now
);
// if (BooleanUtils.isNotTrue(wi.getKeep())) {
TaskCompleted
taskCompleted
=
new
TaskCompleted
(
task
,
TaskCompleted
.
PROCESSINGTYPE_RESET
,
now
,
// Date now = new Date();
duration
);
// Long duration = Config.workTime().betweenMinutes(task.getStartTime(), now);
emc
.
beginTransaction
(
TaskCompleted
.
class
);
// TaskCompleted taskCompleted = new TaskCompleted(task, TaskCompleted.PROCESSINGTYPE_RESET, now,
emc
.
beginTransaction
(
Task
.
class
);
// duration);
emc
.
persist
(
taskCompleted
,
CheckPersistType
.
all
);
// emc.beginTransaction(TaskCompleted.class);
emc
.
remove
(
task
,
CheckRemoveType
.
all
);
// emc.beginTransaction(Task.class);
os
.
remove
(
task
.
getIdentity
());
// emc.persist(taskCompleted, CheckPersistType.all);
MessageFactory
.
taskCompleted_create
(
taskCompleted
);
// emc.remove(task, CheckRemoveType.all);
MessageFactory
.
task_delete
(
task
);
// os.remove(task.getIdentity());
}
// MessageFactory.taskCompleted_create(taskCompleted);
os
=
ListUtils
.
union
(
os
,
identites
);
// MessageFactory.task_delete(task);
work
.
setManualTaskIdentityList
(
ListTools
.
trim
(
os
,
true
,
true
));
// }
emc
.
check
(
work
,
CheckPersistType
.
all
);
// os = ListUtils.union(os, identites);
emc
.
commit
();
// work.setManualTaskIdentityList(ListTools.trim(os, true, true));
ProcessingAttributes
processingAttributes
=
new
ProcessingAttributes
();
// emc.check(work, CheckPersistType.all);
processingAttributes
.
setDebugger
(
effectivePerson
.
getDebugger
());
// emc.commit();
Processing
processing
=
new
Processing
(
processingAttributes
);
// ProcessingAttributes processingAttributes = new ProcessingAttributes();
processing
.
processing
(
work
.
getId
());
// processingAttributes.setDebugger(effectivePerson.getDebugger());
wo
.
setId
(
task
.
getId
());
// Processing processing = new Processing(processingAttributes);
result
.
setData
(
wo
);
// processing.processing(work.getId());
}
// wo.setId(task.getId());
return
""
;
// result.setData(wo);
}
// }
};
// return "";
// }
ProcessPlatformExecutorFactory
.
get
(
executorSeed
).
submit
(
callable
).
get
(
300
,
TimeUnit
.
SECONDS
);
// };
//
return
result
;
// ProcessPlatformExecutorFactory.get(executorSeed).submit(callable).get(300, TimeUnit.SECONDS);
}
//
// return result;
public
static
class
CallWrap
{
// }
String
job
;
//
}
// public static class CallWrap {
// String job;
public
static
class
Wi
extends
GsonPropertyObject
{
// }
//
private
static
final
long
serialVersionUID
=
-
563586484778909479L
;
// public static class Wi extends GsonPropertyObject {
//
@FieldDescribe
(
"身份"
)
// private static final long serialVersionUID = -563586484778909479L;
private
List
<
String
>
identityList
;
//
// @FieldDescribe("身份")
@FieldDescribe
(
"保留自身待办."
)
// private List<String> identityList;
private
Boolean
keep
;
//
// @FieldDescribe("保留自身待办.")
public
List
<
String
>
getIdentityList
()
{
// private Boolean keep;
return
identityList
;
//
}
// public List<String> getIdentityList() {
// return identityList;
public
void
setIdentityList
(
List
<
String
>
identityList
)
{
// }
this
.
identityList
=
identityList
;
//
}
// public void setIdentityList(List<String> identityList) {
// this.identityList = identityList;
public
Boolean
getKeep
()
{
// }
return
keep
;
//
}
// public Boolean getKeep() {
// return keep;
public
void
setKeep
(
Boolean
keep
)
{
// }
this
.
keep
=
keep
;
//
}
// public void setKeep(Boolean keep) {
// this.keep = keep;
// }
}
}
public
static
class
Wo
extends
WoId
{
public
static
class
Wo
extends
WoId
{
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/TaskAction.java
浏览文件 @
b77fdb3f
...
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.DELETE
;
import
javax.ws.rs.DELETE
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.POST
;
import
javax.ws.rs.PUT
;
import
javax.ws.rs.PUT
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.PathParam
;
...
@@ -264,4 +265,76 @@ public class TaskAction extends StandardJaxrsAction {
...
@@ -264,4 +265,76 @@ public class TaskAction extends StandardJaxrsAction {
}
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
}
@JaxrsMethodDescribe
(
value
=
"V2_在指定待办位置扩充处理人."
,
action
=
V2Extend
.
class
)
@POST
@Path
(
"v2/extend"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
v2Extend
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
V2Extend
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
V2Extend
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"V2_在指定待办位置前新增处理人."
,
action
=
V2AddBefore
.
class
)
@POST
@Path
(
"v2/add/before"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
v2AddBefore
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
V2AddBefore
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
V2AddBefore
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"V2_在指定待办位置后新增处理人."
,
action
=
V2AddAfter
.
class
)
@POST
@Path
(
"v2/add/after"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
v2AddAfter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
V2AddAfter
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
V2AddAfter
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"V2_删除指定待办处理人."
,
action
=
V2Remove
.
class
)
@DELETE
@Path
(
"v2/{id}/remove"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
V2Remove
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
V2Remove
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
V2Remove
().
execute
(
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2AddAfter.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.task
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
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.annotation.CheckPersistType
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2AddAfterWi
;
class
V2AddAfter
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
V2AddAfter
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
final
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
}
Task
task
=
getTask
(
wi
.
getTask
());
if
(
null
==
task
)
{
throw
new
ExceptionEntityNotExist
(
wi
.
getTask
(),
Task
.
class
);
}
if
(
null
==
this
.
getWork
(
task
.
getWork
()))
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
return
ProcessPlatformExecutorFactory
.
get
(
task
.
getJob
())
.
submit
(
new
CallableImpl
(
task
.
getWork
(),
task
.
getIdentity
(),
wi
.
getReplace
(),
wi
.
getIdentityList
()))
.
get
(
300
,
TimeUnit
.
SECONDS
);
}
private
Task
getTask
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Task
.
class
,
ListTools
.
toList
(
Task
.
job_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
work_FIELDNAME
));
}
}
private
Work
getWork
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Work
.
class
,
ListTools
.
toList
());
}
}
private
class
CallableImpl
implements
Callable
<
ActionResult
<
Wo
>>
{
private
String
id
;
private
String
identity
;
private
Boolean
replace
;
private
List
<
String
>
identities
;
CallableImpl
(
String
id
,
String
identity
,
Boolean
replace
,
List
<
String
>
identities
)
{
this
.
id
=
id
;
this
.
identity
=
identity
;
this
.
replace
=
replace
;
this
.
identities
=
identities
;
}
@Override
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
Work
.
class
);
Work
work
=
emc
.
find
(
this
.
id
,
Work
.
class
);
ManualTaskIdentityMatrix
matrix
=
work
.
getManualTaskIdentityMatrix
();
matrix
.
addAfter
(
identity
,
replace
,
identities
);
work
.
setManualTaskIdentityMatrix
(
matrix
);
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
commit
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
V2AddAfterWi
{
private
static
final
long
serialVersionUID
=
-
3542693358569393097L
;
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
6457473592503074552L
;
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2AddBefore.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.task
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
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.annotation.CheckPersistType
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2AddBeforeWi
;
class
V2AddBefore
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
V2AddBefore
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
final
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
}
Task
task
=
getTask
(
wi
.
getTask
());
if
(
null
==
task
)
{
throw
new
ExceptionEntityNotExist
(
wi
.
getTask
(),
Task
.
class
);
}
if
(
null
==
this
.
getWork
(
task
.
getWork
()))
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
return
ProcessPlatformExecutorFactory
.
get
(
task
.
getJob
())
.
submit
(
new
CallableImpl
(
task
.
getWork
(),
task
.
getIdentity
(),
wi
.
getReplace
(),
wi
.
getIdentityList
()))
.
get
(
300
,
TimeUnit
.
SECONDS
);
}
private
Task
getTask
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Task
.
class
,
ListTools
.
toList
(
Task
.
job_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
work_FIELDNAME
));
}
}
private
Work
getWork
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Work
.
class
,
ListTools
.
toList
());
}
}
private
class
CallableImpl
implements
Callable
<
ActionResult
<
Wo
>>
{
private
String
id
;
private
String
identity
;
private
Boolean
replace
;
private
List
<
String
>
identities
;
CallableImpl
(
String
id
,
String
identity
,
Boolean
replace
,
List
<
String
>
identities
)
{
this
.
id
=
id
;
this
.
identity
=
identity
;
this
.
replace
=
replace
;
this
.
identities
=
identities
;
}
@Override
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
Work
.
class
);
Work
work
=
emc
.
find
(
this
.
id
,
Work
.
class
);
ManualTaskIdentityMatrix
matrix
=
work
.
getManualTaskIdentityMatrix
();
matrix
.
addBefore
(
identity
,
replace
,
identities
);
work
.
setManualTaskIdentityMatrix
(
matrix
);
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
commit
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
V2AddBeforeWi
{
private
static
final
long
serialVersionUID
=
-
3542693358569393097L
;
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
6457473592503074552L
;
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Extend.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.task
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
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.annotation.CheckPersistType
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2ExtendWi
;
class
V2Extend
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
V2Extend
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
final
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
}
Task
task
=
getTask
(
wi
.
getTask
());
if
(
null
==
task
)
{
throw
new
ExceptionEntityNotExist
(
wi
.
getTask
(),
Task
.
class
);
}
if
(
null
==
this
.
getWork
(
task
.
getWork
()))
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
return
ProcessPlatformExecutorFactory
.
get
(
task
.
getJob
())
.
submit
(
new
CallableImpl
(
task
.
getWork
(),
task
.
getIdentity
(),
wi
.
getReplace
(),
wi
.
getIdentityList
()))
.
get
(
300
,
TimeUnit
.
SECONDS
);
}
private
Task
getTask
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Task
.
class
,
ListTools
.
toList
(
Task
.
job_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
work_FIELDNAME
));
}
}
private
Work
getWork
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Work
.
class
,
ListTools
.
toList
());
}
}
private
class
CallableImpl
implements
Callable
<
ActionResult
<
Wo
>>
{
private
String
id
;
private
String
identity
;
private
Boolean
replace
;
private
List
<
String
>
identities
;
CallableImpl
(
String
id
,
String
identity
,
Boolean
replace
,
List
<
String
>
identities
)
{
this
.
id
=
id
;
this
.
identity
=
identity
;
this
.
replace
=
replace
;
this
.
identities
=
identities
;
}
@Override
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
Work
.
class
);
Work
work
=
emc
.
find
(
this
.
id
,
Work
.
class
);
ManualTaskIdentityMatrix
matrix
=
work
.
getManualTaskIdentityMatrix
();
matrix
.
extend
(
identity
,
replace
,
identities
);
// work.setManualTaskIdentityMatrix(matrix);
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
commit
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
V2ExtendWi
{
private
static
final
long
serialVersionUID
=
8207729800479548859L
;
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
6457473592503074552L
;
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Remove.java
0 → 100644
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.task
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.Work
;
class
V2Remove
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
V2Remove
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
}
Task
task
=
getTask
(
id
);
if
(
null
==
task
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Task
.
class
);
}
if
(
null
==
this
.
getWork
(
task
.
getWork
()))
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
return
ProcessPlatformExecutorFactory
.
get
(
task
.
getJob
())
.
submit
(
new
CallableImpl
(
task
.
getWork
(),
task
.
getIdentity
())).
get
(
300
,
TimeUnit
.
SECONDS
);
}
private
Task
getTask
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Task
.
class
,
ListTools
.
toList
(
Task
.
job_FIELDNAME
,
Task
.
identity_FIELDNAME
,
Task
.
work_FIELDNAME
));
}
}
private
Work
getWork
(
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
return
emc
.
fetch
(
id
,
Work
.
class
,
ListTools
.
toList
());
}
}
private
class
CallableImpl
implements
Callable
<
ActionResult
<
Wo
>>
{
private
String
id
;
private
String
identity
;
CallableImpl
(
String
id
,
String
identity
)
{
this
.
id
=
id
;
this
.
identity
=
identity
;
}
@Override
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
Work
.
class
);
Work
work
=
emc
.
find
(
this
.
id
,
Work
.
class
);
ManualTaskIdentityMatrix
matrix
=
work
.
getManualTaskIdentityMatrix
();
matrix
.
remove
(
identity
);
work
.
setManualTaskIdentityMatrix
(
matrix
);
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
commit
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
6457473592503074552L
;
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/task/V2Reset.java
浏览文件 @
b77fdb3f
...
@@ -21,6 +21,8 @@ import com.x.base.core.project.logger.LoggerFactory;
...
@@ -21,6 +21,8 @@ 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.processplatform.core.entity.content.Task
;
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.element.ActivityType
;
import
com.x.processplatform.core.entity.element.Manual
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResetWi
;
import
com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResetWi
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.Business
;
...
@@ -55,6 +57,13 @@ class V2Reset extends BaseAction {
...
@@ -55,6 +57,13 @@ class V2Reset extends BaseAction {
if
(
null
==
work
)
{
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
throw
new
ExceptionEntityNotExist
(
task
.
getWork
(),
Work
.
class
);
}
}
Manual
manual
=
(
Manual
)
business
.
element
().
get
(
work
.
getActivity
(),
ActivityType
.
manual
);
if
(
null
==
manual
)
{
throw
new
ExceptionEntityNotExist
(
work
.
getActivity
(),
Manual
.
class
);
}
/* 检查reset人员 */
/* 检查reset人员 */
List
<
String
>
identites
=
ListTools
.
trim
(
business
.
organization
().
identity
().
list
(
wi
.
getIdentityList
()),
List
<
String
>
identites
=
ListTools
.
trim
(
business
.
organization
().
identity
().
list
(
wi
.
getIdentityList
()),
true
,
true
);
true
,
true
);
...
@@ -64,7 +73,7 @@ class V2Reset extends BaseAction {
...
@@ -64,7 +73,7 @@ class V2Reset extends BaseAction {
}
}
emc
.
beginTransaction
(
Work
.
class
);
emc
.
beginTransaction
(
Work
.
class
);
List
<
String
>
os
=
ListTools
.
trim
(
work
.
getManualTaskIdentity
Lis
t
(),
true
,
true
);
List
<
String
>
os
=
ListTools
.
trim
(
work
.
getManualTaskIdentity
Matrix
().
fla
t
(),
true
,
true
);
os
=
ListUtils
.
sum
(
os
,
identites
);
os
=
ListUtils
.
sum
(
os
,
identites
);
/* 在新增待办人员中删除当前的处理人 */
/* 在新增待办人员中删除当前的处理人 */
...
@@ -75,8 +84,9 @@ class V2Reset extends BaseAction {
...
@@ -75,8 +84,9 @@ class V2Reset extends BaseAction {
if
(
ListTools
.
isEmpty
(
os
))
{
if
(
ListTools
.
isEmpty
(
os
))
{
throw
new
ExceptionResetEmpty
();
throw
new
ExceptionResetEmpty
();
}
}
work
.
setManualTaskIdentityMatrix
(
work
.
setManualTaskIdentityList
(
ListTools
.
trim
(
os
,
true
,
true
));
manual
.
identitiesToManualTaskIdentityMatrix
(
ListTools
.
trim
(
os
,
true
,
true
)));
// work.setManualTaskIdentityList(ListTools.trim(os, true, true));
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
check
(
work
,
CheckPersistType
.
all
);
emc
.
commit
();
emc
.
commit
();
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionAddSplit.java
浏览文件 @
b77fdb3f
...
@@ -115,7 +115,8 @@ class ActionAddSplit extends BaseAction {
...
@@ -115,7 +115,8 @@ class ActionAddSplit extends BaseAction {
workCopy
.
setSplitToken
(
arrived
.
getSplitToken
());
workCopy
.
setSplitToken
(
arrived
.
getSplitToken
());
workCopy
.
setSplitting
(
from
.
getSplitting
());
workCopy
.
setSplitting
(
from
.
getSplitting
());
workCopy
.
setSplitValue
(
splitValue
);
workCopy
.
setSplitValue
(
splitValue
);
workCopy
.
getManualTaskIdentityList
().
clear
();
// workCopy.getManualTaskIdentityList().clear();
workCopy
.
getManualTaskIdentityMatrix
().
clear
();
workCopy
.
setBeforeExecuted
(
false
);
workCopy
.
setBeforeExecuted
(
false
);
workCopy
.
setDestinationActivity
(
null
);
workCopy
.
setDestinationActivity
(
null
);
workCopy
.
setDestinationActivityType
(
null
);
workCopy
.
setDestinationActivityType
(
null
);
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionManualAppendIdentity.java
浏览文件 @
b77fdb3f
...
@@ -26,6 +26,7 @@ import com.x.base.core.project.tools.ListTools;
...
@@ -26,6 +26,7 @@ import com.x.base.core.project.tools.ListTools;
import
com.x.processplatform.core.entity.content.Review
;
import
com.x.processplatform.core.entity.content.Review
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.element.ActivityType
;
import
com.x.processplatform.core.entity.element.ActivityType
;
import
com.x.processplatform.core.entity.element.Manual
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.Business
;
class
ActionManualAppendIdentity
extends
BaseAction
{
class
ActionManualAppendIdentity
extends
BaseAction
{
...
@@ -167,12 +168,20 @@ class ActionManualAppendIdentity extends BaseAction {
...
@@ -167,12 +168,20 @@ class ActionManualAppendIdentity extends BaseAction {
throw
new
ExceptionNotManual
(
work
.
getActivity
());
throw
new
ExceptionNotManual
(
work
.
getActivity
());
}
}
Manual
manual
=
(
Manual
)
business
.
element
().
get
(
work
.
getActivity
(),
ActivityType
.
manual
);
if
(
null
==
manual
)
{
throw
new
ExceptionEntityNotExist
(
work
.
getActivity
(),
Manual
.
class
);
}
List
<
String
>
taskIdentities
=
business
.
organization
().
identity
().
list
(
wi
.
getTaskIdentityList
());
List
<
String
>
taskIdentities
=
business
.
organization
().
identity
().
list
(
wi
.
getTaskIdentityList
());
taskIdentities
=
ListUtils
.
subtract
(
taskIdentities
,
work
.
getManualTaskIdentityList
());
taskIdentities
=
ListUtils
.
subtract
(
taskIdentities
,
work
.
getManualTaskIdentityMatrix
().
flat
());
work
.
setManualTaskIdentityMatrix
(
manual
.
identitiesToManualTaskIdentityMatrix
(
taskIdentities
));
work
.
setManualTaskIdentityList
(
//
work.setManualTaskIdentityList(
ListUtils
.
sum
(
work
.
getManualTaskIdentityList
(),
wi
.
getTaskIdentityList
()));
//
ListUtils.sum(work.getManualTaskIdentityList(), wi.getTaskIdentityList()));
List
<
Review
>
addReviews
=
new
ArrayList
<>();
List
<
Review
>
addReviews
=
new
ArrayList
<>();
for
(
String
identity
:
taskIdentities
)
{
for
(
String
identity
:
taskIdentities
)
{
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/ActionRollback.java
浏览文件 @
b77fdb3f
package
com.x.processplatform.service.processing.jaxrs.work
;
package
com.x.processplatform.service.processing.jaxrs.work
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.commons.lang3.BooleanUtils
;
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.project.exception.ExceptionDeprecatedAction
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
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.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.processplatform.core.entity.content.Read
;
import
com.x.processplatform.core.entity.content.ReadCompleted
;
import
com.x.processplatform.core.entity.content.Record
;
import
com.x.processplatform.core.entity.content.Review
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.content.WorkStatus
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Process
;
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.service.processing.Business
;
import
com.x.processplatform.service.processing.MessageFactory
;
import
com.x.processplatform.service.processing.ThisApplication
;
class
ActionRollback
extends
BaseAction
{
class
ActionRollback
extends
BaseAction
{
...
@@ -51,276 +15,277 @@ class ActionRollback extends BaseAction {
...
@@ -51,276 +15,277 @@ class ActionRollback extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
throw
new
ExceptionDeprecatedAction
(
V2Rollback
.
class
.
getName
());
Wo
wo
=
new
Wo
();
// Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
// Wo wo = new Wo();
String
workId
=
null
;
//
String
job
=
null
;
// String workId = null;
String
executorSeed
=
null
;
// String job = null;
// String executorSeed = null;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
//
Work
work
=
emc
.
fetch
(
id
,
Work
.
class
,
ListTools
.
toList
(
Work
.
job_FIELDNAME
));
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
if
(
null
==
work
)
{
// Work work = emc.fetch(id, Work.class, ListTools.toList(Work.job_FIELDNAME));
throw
new
ExceptionEntityNotExist
(
id
,
Work
.
class
);
// if (null == work) {
}
// throw new ExceptionEntityNotExist(id, Work.class);
executorSeed
=
work
.
getJob
();
// }
workId
=
work
.
getId
();
// executorSeed = work.getJob();
job
=
work
.
getJob
();
// workId = work.getId();
}
// job = work.getJob();
// }
Callable
<
ActionResult
<
Wo
>>
callable
=
new
Callable
<
ActionResult
<
Wo
>>()
{
//
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
// Callable<ActionResult<Wo>> callable = new Callable<ActionResult<Wo>>() {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
// public ActionResult<Wo> call() throws Exception {
Business
business
=
new
Business
(
emc
);
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Work
work
=
emc
.
find
(
id
,
Work
.
class
);
// Business business = new Business(emc);
if
(
null
==
work
)
{
// Work work = emc.find(id, Work.class);
throw
new
ExceptionEntityNotExist
(
id
,
Work
.
class
);
// if (null == work) {
}
// throw new ExceptionEntityNotExist(id, Work.class);
Application
application
=
business
.
element
().
get
(
work
.
getApplication
(),
Application
.
class
);
// }
if
(
null
==
application
)
{
// Application application = business.element().get(work.getApplication(), Application.class);
throw
new
ExceptionEntityNotExist
(
work
.
getApplication
(),
Application
.
class
);
// if (null == application) {
}
// throw new ExceptionEntityNotExist(work.getApplication(), Application.class);
Process
process
=
business
.
element
().
get
(
work
.
getProcess
(),
Process
.
class
);
// }
if
(
null
==
process
)
{
// Process process = business.element().get(work.getProcess(), Process.class);
throw
new
ExceptionEntityNotExist
(
work
.
getProcess
(),
Process
.
class
);
// if (null == process) {
}
// throw new ExceptionEntityNotExist(work.getProcess(), Process.class);
WorkLog
workLog
=
emc
.
find
(
wi
.
getWorkLog
(),
WorkLog
.
class
);
// }
if
(
null
==
workLog
)
{
// WorkLog workLog = emc.find(wi.getWorkLog(), WorkLog.class);
throw
new
ExceptionEntityNotExist
(
wi
.
getWorkLog
(),
WorkLog
.
class
);
// if (null == workLog) {
}
// throw new ExceptionEntityNotExist(wi.getWorkLog(), WorkLog.class);
if
(
BooleanUtils
.
isTrue
(
workLog
.
getSplitting
()))
{
// }
throw
new
ExceptionSplittingNotRollback
(
work
.
getId
(),
workLog
.
getId
());
// if (BooleanUtils.isTrue(workLog.getSplitting())) {
}
// throw new ExceptionSplittingNotRollback(work.getId(), workLog.getId());
Activity
activity
=
business
.
element
().
getActivity
(
workLog
.
getFromActivity
());
// }
if
(
null
==
activity
)
{
// Activity activity = business.element().getActivity(workLog.getFromActivity());
throw
new
ExceptionActivityNotExist
(
workLog
.
getFromActivity
());
// if (null == activity) {
}
// throw new ExceptionActivityNotExist(workLog.getFromActivity());
// }
List
<
WorkLog
>
workLogs
=
emc
.
listEqual
(
WorkLog
.
class
,
WorkLog
.
job_FIELDNAME
,
workLog
.
getJob
());
//
// List<WorkLog> workLogs = emc.listEqual(WorkLog.class, WorkLog.job_FIELDNAME, workLog.getJob());
WorkLogTree
workLogTree
=
new
WorkLogTree
(
workLogs
);
//
// WorkLogTree workLogTree = new WorkLogTree(workLogs);
Node
node
=
workLogTree
.
find
(
workLog
);
//
// Node node = workLogTree.find(workLog);
Nodes
nodes
=
workLogTree
.
rootTo
(
node
);
//
// Nodes nodes = workLogTree.rootTo(node);
emc
.
beginTransaction
(
Work
.
class
);
//
emc
.
beginTransaction
(
WorkLog
.
class
);
// emc.beginTransaction(Work.class);
emc
.
beginTransaction
(
Task
.
class
);
// emc.beginTransaction(WorkLog.class);
emc
.
beginTransaction
(
TaskCompleted
.
class
);
// emc.beginTransaction(Task.class);
emc
.
beginTransaction
(
Read
.
class
);
// emc.beginTransaction(TaskCompleted.class);
emc
.
beginTransaction
(
ReadCompleted
.
class
);
// emc.beginTransaction(Read.class);
emc
.
beginTransaction
(
Review
.
class
);
// emc.beginTransaction(ReadCompleted.class);
// emc.beginTransaction(Review.class);
rollbackWork
(
work
,
workLog
);
//
// rollbackWork(work, workLog);
rollbackForm
(
business
,
work
,
node
,
application
);
//
// rollbackForm(business, work, node, application);
disconnectWorkLog
(
work
,
workLog
);
//
// disconnectWorkLog(work, workLog);
rollbackTask
(
business
,
emc
.
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
()));
//
// rollbackTask(business, emc.listEqual(Task.class, Task.job_FIELDNAME, work.getJob()));
rollbackTaskCompleted
(
business
,
work
,
nodes
,
workLog
,
//
emc
.
listEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
work
.
getJob
()));
// rollbackTaskCompleted(business, work, nodes, workLog,
// emc.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, work.getJob()));
rollbackRead
(
business
,
work
,
nodes
,
workLog
,
//
emc
.
listEqual
(
Read
.
class
,
Read
.
job_FIELDNAME
,
work
.
getJob
()));
// rollbackRead(business, work, nodes, workLog,
// emc.listEqual(Read.class, Read.job_FIELDNAME, work.getJob()));
rollbackReadCompleted
(
business
,
work
,
nodes
,
workLog
,
//
emc
.
listEqual
(
ReadCompleted
.
class
,
ReadCompleted
.
job_FIELDNAME
,
work
.
getJob
()));
// rollbackReadCompleted(business, work, nodes, workLog,
// emc.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, work.getJob()));
rollbackReview
(
business
,
nodes
,
emc
.
listEqual
(
Review
.
class
,
Review
.
job_FIELDNAME
,
work
.
getJob
()));
//
// rollbackReview(business, nodes, emc.listEqual(Review.class, Review.job_FIELDNAME, work.getJob()));
rollbackRecord
(
business
,
nodes
,
emc
.
listEqual
(
Record
.
class
,
Record
.
job_FIELDNAME
,
work
.
getJob
()));
//
// rollbackRecord(business, nodes, emc.listEqual(Record.class, Record.job_FIELDNAME, work.getJob()));
rollbackWorkLog
(
business
,
work
,
nodes
,
workLogs
);
//
// rollbackWorkLog(business, work, nodes, workLogs);
emc
.
commit
();
//
wo
.
setId
(
work
.
getId
());
// emc.commit();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
// wo.setId(work.getId());
result
.
setData
(
wo
);
// ActionResult<Wo> result = new ActionResult<>();
return
result
;
// result.setData(wo);
}
// return result;
}
// }
};
// }
// };
ActionResult
<
Wo
>
result
=
ProcessPlatformExecutorFactory
.
get
(
executorSeed
).
submit
(
callable
).
get
(
300
,
//
TimeUnit
.
SECONDS
);
// ActionResult<Wo> result = ProcessPlatformExecutorFactory.get(executorSeed).submit(callable).get(300,
// TimeUnit.SECONDS);
ThisApplication
.
context
().
applications
().
putQuery
(
x_processplatform_service_processing
.
class
,
//
Applications
.
joinQueryUri
(
"work"
,
workId
,
"processing"
),
null
,
job
);
// ThisApplication.context().applications().putQuery(x_processplatform_service_processing.class,
// Applications.joinQueryUri("work", workId, "processing"), null, job);
return
result
;
//
// return result;
}
private
void
rollbackWork
(
Work
work
,
WorkLog
workLog
)
{
work
.
setSplitting
(
false
);
work
.
setActivityName
(
workLog
.
getFromActivityName
());
work
.
setActivity
(
workLog
.
getFromActivity
());
work
.
setActivityAlias
(
workLog
.
getFromActivityAlias
());
work
.
setActivityArrivedTime
(
workLog
.
getFromTime
());
work
.
setActivityDescription
(
""
);
work
.
setActivityToken
(
workLog
.
getFromActivityToken
());
work
.
setActivityType
(
workLog
.
getFromActivityType
());
// 清除掉当前的待办人准备重新生成
work
.
getManualTaskIdentityList
().
clear
();
work
.
setWorkStatus
(
WorkStatus
.
processing
);
}
private
void
rollbackForm
(
Business
business
,
Work
work
,
Node
node
,
Application
application
)
throws
Exception
{
String
id
=
""
;
List
<
Node
>
list
=
new
ArrayList
<>();
List
<
Node
>
temp
=
new
ArrayList
<>();
list
.
add
(
node
);
do
{
temp
.
clear
();
for
(
Node
n
:
list
)
{
Activity
activity
=
business
.
element
().
getActivity
(
n
.
getWorkLog
().
getFromActivity
());
id
=
activity
.
getForm
();
if
(
StringUtils
.
isNotEmpty
(
id
))
{
Form
form
=
business
.
element
().
get
(
id
,
Form
.
class
);
if
(
null
!=
form
)
{
work
.
setForm
(
id
);
}
return
;
}
else
{
temp
.
addAll
(
node
.
parents
());
}
}
list
.
clear
();
list
.
addAll
(
temp
);
}
while
(!
list
.
isEmpty
());
if
(
StringUtils
.
isNotEmpty
(
application
.
getDefaultForm
()))
{
Form
form
=
business
.
element
().
get
(
application
.
getDefaultForm
(),
Form
.
class
);
if
(
null
!=
form
)
{
work
.
setForm
(
id
);
}
}
}
private
void
disconnectWorkLog
(
Work
work
,
WorkLog
workLog
)
{
workLog
.
setConnected
(
false
);
workLog
.
setArrivedActivity
(
""
);
workLog
.
setArrivedActivityAlias
(
""
);
workLog
.
setArrivedActivityName
(
""
);
workLog
.
setArrivedActivityToken
(
""
);
workLog
.
setArrivedActivityType
(
null
);
workLog
.
setArrivedTime
(
null
);
workLog
.
setDuration
(
0L
);
workLog
.
setWorkCompleted
(
""
);
workLog
.
setWork
(
work
.
getId
());
}
private
void
rollbackTask
(
Business
business
,
List
<
Task
>
list
)
throws
Exception
{
for
(
Task
o
:
list
)
{
business
.
entityManagerContainer
().
remove
(
o
);
MessageFactory
.
task_delete
(
o
);
}
}
private
void
rollbackTaskCompleted
(
Business
business
,
Work
work
,
Nodes
nodes
,
WorkLog
workLog
,
List
<
TaskCompleted
>
list
)
throws
Exception
{
for
(
TaskCompleted
o
:
list
)
{
if
(!
nodes
.
containsWorkLogWithActivityToken
(
o
.
getActivityToken
())
||
StringUtils
.
equals
(
o
.
getActivityToken
(),
workLog
.
getFromActivityToken
()))
{
business
.
entityManagerContainer
().
remove
(
o
);
MessageFactory
.
taskCompleted_delete
(
o
);
}
else
{
o
.
setCompleted
(
false
);
o
.
setWorkCompleted
(
""
);
o
.
setWork
(
work
.
getId
());
}
}
}
private
void
rollbackRead
(
Business
business
,
Work
work
,
Nodes
nodes
,
WorkLog
workLog
,
List
<
Read
>
list
)
throws
Exception
{
for
(
Read
o
:
list
)
{
if
(!
nodes
.
containsWorkLogWithActivityToken
(
o
.
getActivityToken
())
||
StringUtils
.
equals
(
o
.
getActivityToken
(),
workLog
.
getFromActivityToken
()))
{
business
.
entityManagerContainer
().
remove
(
o
);
MessageFactory
.
read_delete
(
o
);
}
else
{
o
.
setCompleted
(
false
);
o
.
setWorkCompleted
(
""
);
o
.
setWork
(
work
.
getId
());
}
}
}
private
void
rollbackReadCompleted
(
Business
business
,
Work
work
,
Nodes
nodes
,
WorkLog
workLog
,
List
<
ReadCompleted
>
list
)
throws
Exception
{
for
(
ReadCompleted
o
:
list
)
{
if
(!
nodes
.
containsWorkLogWithActivityToken
(
o
.
getActivityToken
())
||
StringUtils
.
equals
(
o
.
getActivityToken
(),
workLog
.
getFromActivityToken
()))
{
business
.
entityManagerContainer
().
remove
(
o
);
MessageFactory
.
readCompleted_delete
(
o
);
}
else
{
o
.
setCompleted
(
false
);
o
.
setWorkCompleted
(
""
);
o
.
setWork
(
work
.
getId
());
}
}
}
private
void
rollbackReview
(
Business
business
,
Nodes
nodes
,
List
<
Review
>
list
)
throws
Exception
{
Date
date
=
nodes
.
latestArrivedTime
();
if
(
null
!=
date
)
{
for
(
Review
o
:
list
)
{
if
(
null
!=
o
.
getStartTime
()
&&
o
.
getStartTime
().
after
(
date
))
{
business
.
entityManagerContainer
().
remove
(
o
);
MessageFactory
.
review_delete
(
o
);
}
else
{
o
.
setCompleted
(
false
);
o
.
setCompletedTime
(
null
);
o
.
setCompletedTimeMonth
(
""
);
o
.
setWorkCompleted
(
""
);
}
}
}
}
private
void
rollbackRecord
(
Business
business
,
Nodes
nodes
,
List
<
Record
>
list
)
throws
Exception
{
Date
date
=
nodes
.
latestArrivedTime
();
if
(
null
!=
date
)
{
for
(
Record
o
:
list
)
{
if
(
null
!=
o
.
getCreateTime
()
&&
o
.
getCreateTime
().
after
(
date
))
{
business
.
entityManagerContainer
().
remove
(
o
);
}
}
}
}
private
void
rollbackWorkLog
(
Business
business
,
Work
work
,
Nodes
nodes
,
List
<
WorkLog
>
list
)
throws
Exception
{
for
(
WorkLog
o
:
list
)
{
if
(!
nodes
.
containsWorkLog
(
o
))
{
business
.
entityManagerContainer
().
remove
(
o
);
}
else
{
o
.
setCompleted
(
false
);
o
.
setWorkCompleted
(
""
);
o
.
setWork
(
work
.
getId
());
}
}
}
public
static
class
Wi
extends
ProcessingAttributes
{
private
static
final
long
serialVersionUID
=
-
8317517462483674906L
;
@FieldDescribe
(
"工作日志标识"
)
private
String
workLog
;
public
String
getWorkLog
()
{
return
workLog
;
}
public
void
setWorkLog
(
String
workLog
)
{
this
.
workLog
=
workLog
;
}
}
}
// private void rollbackWork(Work work, WorkLog workLog) {
// work.setSplitting(false);
// work.setActivityName(workLog.getFromActivityName());
// work.setActivity(workLog.getFromActivity());
// work.setActivityAlias(workLog.getFromActivityAlias());
// work.setActivityArrivedTime(workLog.getFromTime());
// work.setActivityDescription("");
// work.setActivityToken(workLog.getFromActivityToken());
// work.setActivityType(workLog.getFromActivityType());
// // 清除掉当前的待办人准备重新生成
// work.getManualTaskIdentityList().clear();
// work.setWorkStatus(WorkStatus.processing);
// }
//
// private void rollbackForm(Business business, Work work, Node node, Application application) throws Exception {
// String id = "";
// List<Node> list = new ArrayList<>();
// List<Node> temp = new ArrayList<>();
// list.add(node);
// do {
// temp.clear();
// for (Node n : list) {
// Activity activity = business.element().getActivity(n.getWorkLog().getFromActivity());
// id = activity.getForm();
// if (StringUtils.isNotEmpty(id)) {
// Form form = business.element().get(id, Form.class);
// if (null != form) {
// work.setForm(id);
// }
// return;
// } else {
// temp.addAll(node.parents());
// }
// }
// list.clear();
// list.addAll(temp);
// } while (!list.isEmpty());
// if (StringUtils.isNotEmpty(application.getDefaultForm())) {
// Form form = business.element().get(application.getDefaultForm(), Form.class);
// if (null != form) {
// work.setForm(id);
// }
// }
// }
//
// private void disconnectWorkLog(Work work, WorkLog workLog) {
// workLog.setConnected(false);
// workLog.setArrivedActivity("");
// workLog.setArrivedActivityAlias("");
// workLog.setArrivedActivityName("");
// workLog.setArrivedActivityToken("");
// workLog.setArrivedActivityType(null);
// workLog.setArrivedTime(null);
// workLog.setDuration(0L);
// workLog.setWorkCompleted("");
// workLog.setWork(work.getId());
// }
//
// private void rollbackTask(Business business, List<Task> list) throws Exception {
// for (Task o : list) {
// business.entityManagerContainer().remove(o);
// MessageFactory.task_delete(o);
// }
// }
//
// private void rollbackTaskCompleted(Business business, Work work, Nodes nodes, WorkLog workLog,
// List<TaskCompleted> list) throws Exception {
// for (TaskCompleted o : list) {
// if (!nodes.containsWorkLogWithActivityToken(o.getActivityToken())
// || StringUtils.equals(o.getActivityToken(), workLog.getFromActivityToken())) {
// business.entityManagerContainer().remove(o);
// MessageFactory.taskCompleted_delete(o);
// } else {
// o.setCompleted(false);
// o.setWorkCompleted("");
// o.setWork(work.getId());
// }
// }
// }
//
// private void rollbackRead(Business business, Work work, Nodes nodes, WorkLog workLog, List<Read> list)
// throws Exception {
// for (Read o : list) {
// if (!nodes.containsWorkLogWithActivityToken(o.getActivityToken())
// || StringUtils.equals(o.getActivityToken(), workLog.getFromActivityToken())) {
// business.entityManagerContainer().remove(o);
// MessageFactory.read_delete(o);
// } else {
// o.setCompleted(false);
// o.setWorkCompleted("");
// o.setWork(work.getId());
// }
// }
// }
//
// private void rollbackReadCompleted(Business business, Work work, Nodes nodes, WorkLog workLog,
// List<ReadCompleted> list) throws Exception {
// for (ReadCompleted o : list) {
// if (!nodes.containsWorkLogWithActivityToken(o.getActivityToken())
// || StringUtils.equals(o.getActivityToken(), workLog.getFromActivityToken())) {
// business.entityManagerContainer().remove(o);
// MessageFactory.readCompleted_delete(o);
// } else {
// o.setCompleted(false);
// o.setWorkCompleted("");
// o.setWork(work.getId());
// }
// }
// }
//
// private void rollbackReview(Business business, Nodes nodes, List<Review> list) throws Exception {
// Date date = nodes.latestArrivedTime();
// if (null != date) {
// for (Review o : list) {
// if (null != o.getStartTime() && o.getStartTime().after(date)) {
// business.entityManagerContainer().remove(o);
// MessageFactory.review_delete(o);
// } else {
// o.setCompleted(false);
// o.setCompletedTime(null);
// o.setCompletedTimeMonth("");
// o.setWorkCompleted("");
// }
// }
// }
// }
//
// private void rollbackRecord(Business business, Nodes nodes, List<Record> list) throws Exception {
// Date date = nodes.latestArrivedTime();
// if (null != date) {
// for (Record o : list) {
// if (null != o.getCreateTime() && o.getCreateTime().after(date)) {
// business.entityManagerContainer().remove(o);
// }
// }
// }
// }
//
// private void rollbackWorkLog(Business business, Work work, Nodes nodes, List<WorkLog> list) throws Exception {
// for (WorkLog o : list) {
// if (!nodes.containsWorkLog(o)) {
// business.entityManagerContainer().remove(o);
// } else {
// o.setCompleted(false);
// o.setWorkCompleted("");
// o.setWork(work.getId());
// }
// }
// }
//
// public static class Wi extends ProcessingAttributes {
//
// private static final long serialVersionUID = -8317517462483674906L;
//
// @FieldDescribe("工作日志标识")
// private String workLog;
//
// public String getWorkLog() {
// return workLog;
// }
//
// public void setWorkLog(String workLog) {
// this.workLog = workLog;
// }
//
// }
//
public
static
class
Wo
extends
WoId
{
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
3836331836701686038L
;
private
static
final
long
serialVersionUID
=
3836331836701686038L
;
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2AddSplit.java
浏览文件 @
b77fdb3f
...
@@ -106,7 +106,8 @@ class V2AddSplit extends BaseAction {
...
@@ -106,7 +106,8 @@ class V2AddSplit extends BaseAction {
workCopy
.
setSplitToken
(
arrived
.
getSplitToken
());
workCopy
.
setSplitToken
(
arrived
.
getSplitToken
());
workCopy
.
setSplitting
(
from
.
getSplitting
());
workCopy
.
setSplitting
(
from
.
getSplitting
());
workCopy
.
setSplitValue
(
splitValue
);
workCopy
.
setSplitValue
(
splitValue
);
workCopy
.
getManualTaskIdentityList
().
clear
();
// workCopy.getManualTaskIdentityList().clear();
workCopy
.
getManualTaskIdentityMatrix
().
clear
();
workCopy
.
setBeforeExecuted
(
false
);
workCopy
.
setBeforeExecuted
(
false
);
workCopy
.
setDestinationActivity
(
null
);
workCopy
.
setDestinationActivity
(
null
);
workCopy
.
setDestinationActivityType
(
null
);
workCopy
.
setDestinationActivityType
(
null
);
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Retract.java
浏览文件 @
b77fdb3f
...
@@ -20,6 +20,7 @@ import com.x.base.core.project.http.EffectivePerson;
...
@@ -20,6 +20,7 @@ import com.x.base.core.project.http.EffectivePerson;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
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.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Read
;
import
com.x.processplatform.core.entity.content.Read
;
import
com.x.processplatform.core.entity.content.ReadCompleted
;
import
com.x.processplatform.core.entity.content.ReadCompleted
;
...
@@ -118,7 +119,8 @@ class V2Retract extends BaseAction {
...
@@ -118,7 +119,8 @@ class V2Retract extends BaseAction {
taskCompleted
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_RETRACT
);
taskCompleted
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_RETRACT
);
List
<
String
>
manualTaskIdentityList
=
new
ArrayList
<>();
List
<
String
>
manualTaskIdentityList
=
new
ArrayList
<>();
manualTaskIdentityList
.
add
(
taskCompleted
.
getIdentity
());
manualTaskIdentityList
.
add
(
taskCompleted
.
getIdentity
());
work
.
setManualTaskIdentityList
(
manualTaskIdentityList
);
// work.setManualTaskIdentityList(manualTaskIdentityList);
work
.
setManualTaskIdentityMatrix
(
ManualTaskIdentityMatrix
.
concreteMultiRow
(
manualTaskIdentityList
));
// 发送消息
// 发送消息
sendRemoveMessages
(
removeTasks
,
removeTaskCompleteds
,
removeReads
,
removeReadCompleteds
);
sendRemoveMessages
(
removeTasks
,
removeTaskCompleteds
,
removeReads
,
removeReadCompleteds
);
emc
.
commit
();
emc
.
commit
();
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/V2Rollback.java
浏览文件 @
b77fdb3f
...
@@ -114,13 +114,13 @@ class V2Rollback extends BaseAction {
...
@@ -114,13 +114,13 @@ class V2Rollback extends BaseAction {
for
(
TaskCompleted
o
:
taskCompleteds
)
{
for
(
TaskCompleted
o
:
taskCompleteds
)
{
if
(
BooleanUtils
.
isTrue
(
o
.
getJoinInquire
()))
{
if
(
BooleanUtils
.
isTrue
(
o
.
getJoinInquire
()))
{
// o.setProcessingType(TaskCompleted.PROCESSINGTYPE_ROLLBACK);
emc
.
remove
(
o
,
CheckRemoveType
.
all
);
emc
.
remove
(
o
,
CheckRemoveType
.
all
);
}
}
manualTaskIdentityList
.
add
(
o
.
getIdentity
());
manualTaskIdentityList
.
add
(
o
.
getIdentity
());
}
}
work
.
getProperties
()
work
.
setManualTaskIdentityList
(
ListTools
.
trim
(
manualTaskIdentityList
,
true
,
true
));
.
setManualForceTaskIdentityList
(
ListTools
.
trim
(
manualTaskIdentityList
,
true
,
true
));
// work.setManualTaskIdentityList(ListTools.trim(manualTaskIdentityList, true, true));
emc
.
commit
();
emc
.
commit
();
}
}
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AbstractProcessor.java
浏览文件 @
b77fdb3f
...
@@ -63,7 +63,7 @@ public abstract class AbstractProcessor extends AbstractBaseProcessor {
...
@@ -63,7 +63,7 @@ public abstract class AbstractProcessor extends AbstractBaseProcessor {
AeiObjects
aeiObjects
=
new
AeiObjects
(
this
.
business
(),
work
,
activity
,
processingConfigurator
,
AeiObjects
aeiObjects
=
new
AeiObjects
(
this
.
business
(),
work
,
activity
,
processingConfigurator
,
processingAttributes
);
processingAttributes
);
// 清空可能的Manual活动预期人员
// 清空可能的Manual活动预期人员
this
.
arriveCleanManualTaskIdentity
List
(
aeiObjects
);
this
.
arriveCleanManualTaskIdentity
Matrix
(
aeiObjects
);
// 清空可能的Manual活动授权信息
// 清空可能的Manual活动授权信息
this
.
arriveCleanManualEmpowerMap
(
aeiObjects
);
this
.
arriveCleanManualEmpowerMap
(
aeiObjects
);
// 计算是否经过人工节点
// 计算是否经过人工节点
...
@@ -108,8 +108,12 @@ public abstract class AbstractProcessor extends AbstractBaseProcessor {
...
@@ -108,8 +108,12 @@ public abstract class AbstractProcessor extends AbstractBaseProcessor {
}
}
}
}
private
void
arriveCleanManualTaskIdentityList
(
AeiObjects
aeiObjects
)
{
// private void arriveCleanManualTaskIdentityList(AeiObjects aeiObjects) {
aeiObjects
.
getWork
().
setManualTaskIdentityList
(
new
ArrayList
<>());
// aeiObjects.getWork().setManualTaskIdentityList(new ArrayList<>());
// }
private
void
arriveCleanManualTaskIdentityMatrix
(
AeiObjects
aeiObjects
)
{
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
().
clear
();
}
}
private
void
arriveCleanManualEmpowerMap
(
AeiObjects
aeiObjects
)
{
private
void
arriveCleanManualEmpowerMap
(
AeiObjects
aeiObjects
)
{
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AeiObjects.java
浏览文件 @
b77fdb3f
...
@@ -320,6 +320,13 @@ public class AeiObjects extends GsonPropertyObject {
...
@@ -320,6 +320,13 @@ public class AeiObjects extends GsonPropertyObject {
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
public
List
<
TaskCompleted
>
getJoinInquireTaskCompletedsWithActivityToken
(
String
activityToken
)
throws
Exception
{
return
this
.
getTaskCompleteds
().
stream
()
.
filter
(
o
->
StringUtils
.
equalsIgnoreCase
(
activityToken
,
o
.
getActivityToken
())
&&
BooleanUtils
.
isNotFalse
(
o
.
getJoinInquire
()))
.
collect
(
Collectors
.
toList
());
}
public
List
<
Read
>
getReads
()
throws
Exception
{
public
List
<
Read
>
getReads
()
throws
Exception
{
if
(
null
==
this
.
reads
)
{
if
(
null
==
this
.
reads
)
{
this
.
reads
=
this
.
business
.
entityManagerContainer
().
listEqual
(
Read
.
class
,
Read
.
job_FIELDNAME
,
this
.
reads
=
this
.
business
.
entityManagerContainer
().
listEqual
(
Read
.
class
,
Read
.
job_FIELDNAME
,
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor.java
浏览文件 @
b77fdb3f
...
@@ -16,6 +16,7 @@ import javax.script.Bindings;
...
@@ -16,6 +16,7 @@ import javax.script.Bindings;
import
javax.script.CompiledScript
;
import
javax.script.CompiledScript
;
import
javax.script.ScriptContext
;
import
javax.script.ScriptContext
;
import
org.apache.commons.beanutils.PropertyUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
...
@@ -28,6 +29,7 @@ import com.x.base.core.project.config.Config;
...
@@ -28,6 +29,7 @@ import com.x.base.core.project.config.Config;
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.organization.EmpowerLog
;
import
com.x.base.core.project.organization.EmpowerLog
;
import
com.x.base.core.project.processplatform.ManualTaskIdentityMatrix
;
import
com.x.base.core.project.scripting.JsonScriptingExecutor
;
import
com.x.base.core.project.scripting.JsonScriptingExecutor
;
import
com.x.base.core.project.scripting.ScriptingFactory
;
import
com.x.base.core.project.scripting.ScriptingFactory
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.DateTools
;
...
@@ -56,6 +58,8 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -56,6 +58,8 @@ public class ManualProcessor extends AbstractManualProcessor {
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ManualProcessor
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ManualProcessor
.
class
);
private
static
final
String
DEPRECATED_WORK_FIELD_MANUALTASKIDENTITYLIST
=
"manualTaskIdentityList"
;
public
ManualProcessor
(
EntityManagerContainer
entityManagerContainer
)
throws
Exception
{
public
ManualProcessor
(
EntityManagerContainer
entityManagerContainer
)
throws
Exception
{
super
(
entityManagerContainer
);
super
(
entityManagerContainer
);
}
}
...
@@ -65,93 +69,109 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -65,93 +69,109 @@ public class ManualProcessor extends AbstractManualProcessor {
// 发送ProcessingSignal
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
manualArrive
(
aeiObjects
.
getWork
().
getActivityToken
(),
manual
));
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
manualArrive
(
aeiObjects
.
getWork
().
getActivityToken
(),
manual
));
// 根据manual计算出来的活动处理人
// 根据manual计算出来的活动处理人
List
<
String
>
identities
=
calculateTaskIdentities
(
aeiObjects
,
manual
);
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
=
manual
.
identitiesToManualTaskIdentityMatrix
(
calculateTaskIdentities
(
aeiObjects
,
manual
));
// 启用同类工作相同活动节点合并,如果有合并的工作,那么直接返回这个工作.
// 启用同类工作相同活动节点合并,如果有合并的工作,那么直接返回这个工作.
Work
merge
=
this
.
arrivingMergeSameJob
(
aeiObjects
,
manual
,
identities
);
Optional
<
Work
>
mergeWork
=
this
.
arrivingMergeSameJob
(
aeiObjects
,
manual
,
manualTaskIdentityMatrix
);
if
(
null
!=
merge
)
{
if
(
mergeWork
.
isPresent
()
)
{
return
merge
;
return
merge
Work
.
get
()
;
}
}
this
.
arrivingPassSame
(
aeiObjects
,
identities
);
this
.
arrivingPassSame
(
aeiObjects
,
manualTaskIdentityMatrix
);
aeiObjects
.
getWork
().
setManualTaskIdentity
List
(
new
ArrayList
<>(
identities
)
);
aeiObjects
.
getWork
().
setManualTaskIdentity
Matrix
(
manualTaskIdentityMatrix
);
return
aeiObjects
.
getWork
();
return
aeiObjects
.
getWork
();
}
}
private
Work
arrivingMergeSameJob
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
String
>
identities
)
throws
Exception
{
private
Optional
<
Work
>
arrivingMergeSameJob
(
AeiObjects
aeiObjects
,
Manual
manual
,
ManualTaskIdentityMatrix
manualTaskIdentityMatrix
)
throws
Exception
{
if
(!
BooleanUtils
.
isTrue
(
manual
.
getManualMergeSameJobActivity
()))
{
if
(!
BooleanUtils
.
isTrue
(
manual
.
getManualMergeSameJobActivity
()))
{
return
null
;
return
Optional
.
empty
()
;
}
}
List
<
String
>
exists
=
this
.
arrivingSameJobActivityExistIdentities
(
aeiObjects
,
manual
);
List
<
String
>
exists
=
this
.
arrivingSameJobActivityExistIdentities
(
aeiObjects
,
manual
);
if
(
ListTools
.
isNotEmpty
(
exists
))
{
if
(
ListTools
.
isNotEmpty
(
exists
))
{
Work
other
=
aeiObjects
.
getWorks
().
stream
()
Optional
<
Work
>
other
=
aeiObjects
.
getWorks
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getJob
(),
o
.
getJob
())
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getJob
(),
o
.
getJob
())
&&
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivity
(),
o
.
getActivity
())
&&
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivity
(),
o
.
getActivity
())
&&
(!
Objects
.
equals
(
aeiObjects
.
getWork
(),
o
)))
&&
(!
Objects
.
equals
(
aeiObjects
.
getWork
(),
o
)))
.
findFirst
()
.
orElse
(
null
)
;
.
findFirst
();
if
(
null
!=
other
)
{
if
(
other
.
isPresent
()
)
{
identities
.
removeAll
(
exists
);
manualTaskIdentityMatrix
.
remove
(
exists
);
if
(
ListTools
.
isEmpty
(
identities
))
{
if
(
manualTaskIdentityMatrix
.
isEmpty
(
))
{
this
.
mergeTaskCompleted
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeTaskCompleted
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
this
.
mergeRead
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeRead
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
this
.
mergeReadCompleted
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeReadCompleted
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
this
.
mergeReview
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeReview
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
this
.
mergeAttachment
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeAttachment
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
this
.
mergeWorkLog
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
);
this
.
mergeWorkLog
(
aeiObjects
,
aeiObjects
.
getWork
(),
other
.
get
()
);
if
(
ListTools
.
size
(
aeiObjects
.
getWork
().
getSplitTokenList
())
>
ListTools
if
(
ListTools
.
size
(
aeiObjects
.
getWork
().
getSplitTokenList
())
>
ListTools
.
size
(
other
.
getSplitTokenList
()))
{
.
size
(
other
.
get
().
get
SplitTokenList
()))
{
other
.
setSplitTokenList
(
aeiObjects
.
getWork
().
getSplitTokenList
());
other
.
get
().
setSplitTokenList
(
aeiObjects
.
getWork
().
getSplitTokenList
());
other
.
setSplitToken
(
aeiObjects
.
getWork
().
getSplitToken
());
other
.
get
().
setSplitToken
(
aeiObjects
.
getWork
().
getSplitToken
());
other
.
setSplitValue
(
aeiObjects
.
getWork
().
getSplitValue
());
other
.
get
().
setSplitValue
(
aeiObjects
.
getWork
().
getSplitValue
());
other
.
setSplitting
(
true
);
other
.
get
().
setSplitting
(
true
);
}
}
aeiObjects
.
getUpdateWorks
().
add
(
other
);
aeiObjects
.
getUpdateWorks
().
add
(
other
.
get
()
);
aeiObjects
.
getDeleteWorks
().
add
(
aeiObjects
.
getWork
());
aeiObjects
.
getDeleteWorks
().
add
(
aeiObjects
.
getWork
());
return
other
;
return
other
;
}
}
}
}
}
}
return
null
;
return
Optional
.
empty
()
;
}
}
private
void
arrivingPassSame
(
AeiObjects
aeiObjects
,
List
<
String
>
identities
)
throws
Exception
{
private
void
arrivingPassSame
(
AeiObjects
aeiObjects
,
ManualTaskIdentityMatrix
matrix
)
throws
Exception
{
// 查找是否有passSameTarget设置
// 查找是否有passSameTarget设置
Route
route
=
aeiObjects
.
getRoutes
().
stream
().
filter
(
o
->
BooleanUtils
.
isTrue
(
o
.
getPassSameTarget
()))
if
(
BooleanUtils
.
isTrue
(
aeiObjects
.
getProcessingAttributes
().
ifForceJoinAtArrive
()))
{
.
findFirst
().
orElse
(
null
);
return
;
}
Optional
<
Route
>
route
=
aeiObjects
.
getRoutes
().
stream
().
filter
(
o
->
BooleanUtils
.
isTrue
(
o
.
getPassSameTarget
()))
.
findFirst
();
// 如果有passSameTarget,有到达ArriveWorkLog,不是调度到这个节点的
// 如果有passSameTarget,有到达ArriveWorkLog,不是调度到这个节点的
if
((
null
!=
route
)
&&
(
null
!=
aeiObjects
.
getArriveWorkLog
(
aeiObjects
.
getWork
()))
if
(
route
.
isPresent
()
&&
(
null
!=
aeiObjects
.
getArriveWorkLog
(
aeiObjects
.
getWork
())))
{
&&
(!
aeiObjects
.
getProcessingAttributes
().
ifForceJoinAtArrive
()))
{
WorkLog
workLog
=
findPassSameTargetWorkLog
(
aeiObjects
);
WorkLog
workLog
=
findPassSameTargetWorkLog
(
aeiObjects
);
if
(
null
==
workLog
)
{
if
(
null
==
workLog
)
{
return
;
return
;
}
}
LOGGER
.
debug
(
"pass same target work:{}, workLog:{}."
,
aeiObjects:
:
getWork
,
workLog:
:
toString
);
LOGGER
.
debug
(
"pass same target work:{}, workLog:{}."
,
aeiObjects:
:
getWork
,
workLog:
:
toString
);
for
(
TaskCompleted
o
:
aeiObjects
.
getJoinInquireTaskCompleteds
())
{
List
<
String
>
identities
=
matrix
.
flat
();
if
(
StringUtils
.
equals
(
o
.
getActivityToken
(),
workLog
.
getArrivedActivityToken
()))
{
aeiObjects
.
getJoinInquireTaskCompletedsWithActivityToken
(
workLog
.
getArrivedActivityToken
()).
stream
()
List
<
String
>
values
=
ListUtils
.
intersection
(
identities
,
.
forEach
(
o
->
{
aeiObjects
.
business
().
organization
().
identity
().
listWithPerson
(
o
.
getPerson
()));
try
{
if
(!
values
.
isEmpty
())
{
List
<
String
>
values
=
ListUtils
.
intersection
(
identities
,
TaskCompleted
obj
=
new
TaskCompleted
(
aeiObjects
.
getWork
(),
route
,
o
);
aeiObjects
.
business
().
organization
().
identity
().
listWithPerson
(
o
.
getPerson
()));
obj
.
setIdentity
(
values
.
get
(
0
));
if
(!
values
.
isEmpty
())
{
obj
.
setUnit
(
aeiObjects
.
business
().
organization
().
unit
().
getWithIdentity
(
obj
.
getIdentity
()));
TaskCompleted
taskCompleted
=
arrivingPassSameCreateTaskCompleted
(
aeiObjects
,
obj
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_SAMETARGET
);
route
.
get
(),
o
,
values
.
get
(
0
));
obj
.
setRouteName
(
route
.
getName
());
aeiObjects
.
getCreateTaskCompleteds
().
add
(
taskCompleted
);
obj
.
setOpinion
(
route
.
getOpinion
());
matrix
.
completed
(
values
);
Date
now
=
new
Date
();
}
obj
.
setStartTime
(
now
);
}
catch
(
Exception
e
)
{
obj
.
setStartTimeMonth
(
DateTools
.
format
(
now
,
DateTools
.
format_yyyyMM
));
LOGGER
.
error
(
e
);
obj
.
setCompletedTime
(
now
);
}
obj
.
setCompletedTimeMonth
(
DateTools
.
format
(
now
,
DateTools
.
format_yyyyMM
));
});
obj
.
setDuration
(
0L
);
obj
.
setExpired
(
false
);
obj
.
setExpireTime
(
null
);
obj
.
setTask
(
null
);
obj
.
setLatest
(
true
);
aeiObjects
.
getCreateTaskCompleteds
().
add
(
obj
);
}
}
}
}
}
}
}
private
TaskCompleted
arrivingPassSameCreateTaskCompleted
(
AeiObjects
aeiObjects
,
Route
route
,
TaskCompleted
o
,
String
identity
)
throws
Exception
{
TaskCompleted
taskCompleted
=
new
TaskCompleted
(
aeiObjects
.
getWork
(),
route
,
o
);
taskCompleted
.
setIdentity
(
identity
);
taskCompleted
.
setUnit
(
aeiObjects
.
business
().
organization
().
unit
().
getWithIdentity
(
taskCompleted
.
getIdentity
()));
taskCompleted
.
setProcessingType
(
TaskCompleted
.
PROCESSINGTYPE_SAMETARGET
);
taskCompleted
.
setRouteName
(
route
.
getName
());
taskCompleted
.
setOpinion
(
route
.
getOpinion
());
Date
now
=
new
Date
();
taskCompleted
.
setStartTime
(
now
);
taskCompleted
.
setStartTimeMonth
(
DateTools
.
format
(
now
,
DateTools
.
format_yyyyMM
));
taskCompleted
.
setCompletedTime
(
now
);
taskCompleted
.
setCompletedTimeMonth
(
DateTools
.
format
(
now
,
DateTools
.
format_yyyyMM
));
taskCompleted
.
setDuration
(
0L
);
taskCompleted
.
setExpired
(
false
);
taskCompleted
.
setExpireTime
(
null
);
taskCompleted
.
setTask
(
null
);
taskCompleted
.
setLatest
(
true
);
return
taskCompleted
;
}
// 计算处理人
// 计算处理人
private
List
<
String
>
calculateTaskIdentities
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
private
List
<
String
>
calculateTaskIdentities
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
TaskIdentities
taskIdentities
=
new
TaskIdentities
();
TaskIdentities
taskIdentities
=
new
TaskIdentities
();
...
@@ -173,7 +193,8 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -173,7 +193,8 @@ public class ManualProcessor extends AbstractManualProcessor {
}
}
if
(
taskIdentities
.
isEmpty
())
{
if
(
taskIdentities
.
isEmpty
())
{
taskIdentities
=
TranslateTaskIdentityTools
.
translate
(
aeiObjects
,
manual
);
taskIdentities
=
TranslateTaskIdentityTools
.
translate
(
aeiObjects
,
manual
);
this
.
ifTaskIdentitiesEmptyForceToCreatorOrMaintenance
(
aeiObjects
,
manual
,
taskIdentities
);
this
.
ifTaskIdentitiesEmptyForceToCreatorOrMaintenance
(
aeiObjects
,
taskIdentities
);
// 处理授权
this
.
writeToEmpowerMap
(
aeiObjects
,
taskIdentities
);
this
.
writeToEmpowerMap
(
aeiObjects
,
taskIdentities
);
}
}
return
taskIdentities
.
identities
();
return
taskIdentities
.
identities
();
...
@@ -216,30 +237,36 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -216,30 +237,36 @@ public class ManualProcessor extends AbstractManualProcessor {
}
}
}
}
// 如果活动没有找到任何可用的处理人,那么强制设置处理人为文档创建者,或者配置的 maintenanceIdentity
/**
private
void
ifTaskIdentitiesEmptyForceToCreatorOrMaintenance
(
AeiObjects
aeiObjects
,
Manual
manual
,
* 如果没能计算到活动处理人,那么按照流程维护人,应用维护人,工作创建者,平台维护人顺序查找处理人
TaskIdentities
taskIdentities
)
throws
Exception
{
*
* @param aeiObjects
* @param manual
* @param taskIdentities
* @throws Exception
*/
private
void
ifTaskIdentitiesEmptyForceToCreatorOrMaintenance
(
AeiObjects
aeiObjects
,
TaskIdentities
taskIdentities
)
throws
Exception
{
if
(
taskIdentities
.
isEmpty
())
{
if
(
taskIdentities
.
isEmpty
())
{
String
identity
=
aeiObjects
.
business
().
organization
().
identity
()
String
identity
=
aeiObjects
.
business
().
organization
().
identity
()
.
get
(
aeiObjects
.
getWork
().
getCreatorIdentity
());
.
get
(
aeiObjects
.
getProcess
().
getMaintenanceIdentity
());
if
(
StringUtils
.
isNotEmpty
(
identity
))
{
if
(
StringUtils
.
isEmpty
(
identity
))
{
LOGGER
.
info
(
"{}[{}]未能找到指定的处理人, 标题:{}, id:{}, 强制指定处理人为活动的创建身份:{}."
,
aeiObjects
.
getProcess
()::
getName
,
identity
=
aeiObjects
.
business
().
organization
().
identity
()
manual:
:
getName
,
aeiObjects
.
getWork
()::
getTitle
,
aeiObjects
.
getWork
()::
getId
,
.
get
(
aeiObjects
.
getApplication
().
getMaintenanceIdentity
());
identity:
:
toString
);
}
taskIdentities
.
addIdentity
(
identity
);
if
(
StringUtils
.
isEmpty
(
identity
))
{
}
else
{
identity
=
aeiObjects
.
business
().
organization
().
identity
()
.
get
(
aeiObjects
.
getWork
().
getCreatorIdentity
());
}
if
(
StringUtils
.
isEmpty
(
identity
))
{
identity
=
aeiObjects
.
business
().
organization
().
identity
()
identity
=
aeiObjects
.
business
().
organization
().
identity
()
.
get
(
Config
.
processPlatform
().
getMaintenanceIdentity
());
.
get
(
Config
.
processPlatform
().
getMaintenanceIdentity
());
if
(
StringUtils
.
isNotEmpty
(
identity
))
{
LOGGER
.
info
(
"{}[{}]未能找到指定的处理人, 也没有能找到工作创建人, 标题:{}, id:{}, 强制指定处理人为系统维护身份:{}."
,
aeiObjects
.
getProcess
()::
getName
,
manual:
:
getName
,
aeiObjects
.
getWork
()::
getTitle
,
aeiObjects
.
getWork
()::
getId
,
identity:
:
toString
);
taskIdentities
.
addIdentity
(
identity
);
}
else
{
throw
new
ExceptionExpectedEmpty
(
aeiObjects
.
getWork
().
getTitle
(),
aeiObjects
.
getWork
().
getId
(),
aeiObjects
.
getActivity
().
getName
(),
aeiObjects
.
getActivity
().
getId
());
}
}
}
if
(
StringUtils
.
isEmpty
(
identity
))
{
throw
new
ExceptionExpectedEmpty
(
aeiObjects
.
getWork
().
getTitle
(),
aeiObjects
.
getWork
().
getId
(),
aeiObjects
.
getActivity
().
getName
(),
aeiObjects
.
getActivity
().
getId
());
}
taskIdentities
.
addIdentity
(
identity
);
}
}
}
}
...
@@ -297,42 +324,95 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -297,42 +324,95 @@ public class ManualProcessor extends AbstractManualProcessor {
@Override
@Override
protected
List
<
Work
>
executing
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
protected
List
<
Work
>
executing
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
List
<
Work
>
results
=
new
ArrayList
<>();
List
<
Work
>
results
=
new
ArrayList
<>();
boolean
passThrough
=
false
;
Object
o
;
List
<
String
>
identities
=
aeiObjects
.
business
().
organization
().
identity
()
ManualTaskIdentityMatrix
matrix
=
executingManualTaskIdentityMatrix
(
aeiObjects
,
manual
);
.
list
(
aeiObjects
.
getWork
().
getManualTaskIdentityList
()
);
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!@@@@@@@@@@@@@@@"
);
if
(
identities
.
isEmpty
())
{
System
.
out
.
println
(
gson
.
toJson
(
matrix
));
identities
=
calculateTaskIdentities
(
aeiObjects
,
manual
);
System
.
out
.
println
(
matrix
.
hashCode
()
+
":"
+
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
().
hashCode
()
);
LOGGER
.
info
(
"工作设置的处理人已经全部无效,重新计算当前环节所有处理人进行处理,标题:{}, id:{}, 设置的处理人:{}."
,
aeiObjects
.
getWork
()::
getTitle
,
System
.
out
.
println
(
gson
.
toJson
(
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
()));
aeiObjects
.
getWork
()::
getId
,
identities:
:
toString
);
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!@@@@@@@@@@@@@@@"
);
// 后面进行了identitis.remove()这里必须用一个新对象包装
List
<
TaskCompleted
>
taskCompleteds
=
aeiObjects
aeiObjects
.
getWork
().
setManualTaskIdentityList
(
new
ArrayList
<>(
identities
));
.
getJoinInquireTaskCompletedsWithActivityToken
(
aeiObjects
.
getWork
().
getActivityToken
(
));
}
executingCompletedIdentityInTaskCompleteds
(
aeiObjects
,
matrix
,
taskCompleteds
);
// 发送ProcessingSignal
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
manualExecute
(
aeiObjects
.
getWork
().
getActivityToken
(),
manual
,
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
manualExecute
(
aeiObjects
.
getWork
().
getActivityToken
(),
manual
,
Objects
.
toString
(
manual
.
getManualMode
(),
""
),
identities
));
Objects
.
toString
(
manual
.
getManualMode
(),
""
),
matrix
.
flat
()));
switch
(
manual
.
getManualMode
())
{
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!before"
);
case
single:
System
.
out
.
println
(
gson
.
toJson
(
matrix
));
passThrough
=
this
.
single
(
aeiObjects
,
manual
,
identities
);
System
.
out
.
println
(
matrix
.
hashCode
()
+
":"
+
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
().
hashCode
());
break
;
System
.
out
.
println
(
gson
.
toJson
(
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
()));
case
parallel:
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!before"
);
passThrough
=
this
.
parallel
(
aeiObjects
,
manual
,
identities
);
if
(
matrix
.
isEmpty
())
{
break
;
case
queue:
passThrough
=
this
.
queue
(
aeiObjects
,
manual
,
identities
);
break
;
case
grab:
passThrough
=
this
.
single
(
aeiObjects
,
manual
,
identities
);
break
;
default
:
throw
new
ExceptionManualModeError
(
manual
.
getId
());
}
if
(
passThrough
)
{
results
.
add
(
aeiObjects
.
getWork
());
results
.
add
(
aeiObjects
.
getWork
());
}
else
{
switch
(
manual
.
getManualMode
())
{
case
parallel:
this
.
parallel
(
aeiObjects
,
manual
,
matrix
,
taskCompleteds
);
break
;
case
queue:
this
.
queue
(
aeiObjects
,
manual
,
matrix
,
taskCompleteds
);
break
;
case
grab:
case
single:
default
:
this
.
single
(
aeiObjects
,
manual
,
matrix
,
taskCompleteds
);
}
// 可能在处理过程中删除了所有的待办,比如有优先路由
if
(
matrix
.
isEmpty
())
{
results
.
add
(
aeiObjects
.
getWork
());
}
}
}
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!after"
);
System
.
out
.
println
(
gson
.
toJson
(
matrix
));
System
.
out
.
println
(
matrix
.
hashCode
()
+
":"
+
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
().
hashCode
());
System
.
out
.
println
(
gson
.
toJson
(
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
()));
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!after"
);
// aeiObjects.getWork().setManualTaskIdentityMatrix(matrix);
return
results
;
return
results
;
}
}
@SuppressWarnings
(
"unchecked"
)
private
ManualTaskIdentityMatrix
executingManualTaskIdentityMatrix
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
ManualTaskIdentityMatrix
matrix
=
aeiObjects
.
getWork
().
getManualTaskIdentityMatrix
();
if
(
matrix
.
isEmpty
())
{
List
<
String
>
identities
=
new
ArrayList
<>();
// 兼容7.2.0之前的版本
if
(
PropertyUtils
.
isReadable
(
aeiObjects
.
getWork
(),
DEPRECATED_WORK_FIELD_MANUALTASKIDENTITYLIST
))
{
identities
.
addAll
((
List
<
String
>)
PropertyUtils
.
getProperty
(
aeiObjects
.
getWork
(),
DEPRECATED_WORK_FIELD_MANUALTASKIDENTITYLIST
));
identities
=
aeiObjects
.
business
().
organization
().
identity
().
list
(
identities
);
}
if
(
identities
.
isEmpty
()
&&
aeiObjects
.
getJoinInquireTaskCompletedsWithActivityToken
(
aeiObjects
.
getWork
().
getActivityToken
()).
isEmpty
())
{
identities
=
calculateTaskIdentities
(
aeiObjects
,
manual
);
LOGGER
.
info
(
"工作设置的处理人已经全部无效,且没有已办,重新计算当前环节所有处理人进行处理,标题:{}, id:{}, 设置的处理人:{}."
,
aeiObjects
.
getWork
()::
getTitle
,
aeiObjects
.
getWork
()::
getId
,
identities:
:
toString
);
matrix
=
manual
.
identitiesToManualTaskIdentityMatrix
(
identities
);
// 重新绑定到对象上.
aeiObjects
.
getWork
().
setManualTaskIdentityMatrix
(
matrix
);
}
}
return
matrix
;
}
private
void
executingCompletedIdentityInTaskCompleteds
(
AeiObjects
aeiObjects
,
ManualTaskIdentityMatrix
matrix
,
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
if
(!
matrix
.
isEmpty
())
{
List
<
String
>
identities
=
matrix
.
flat
();
List
<
String
>
people
=
ListTools
.
extractProperty
(
taskCompleteds
,
TaskCompleted
.
person_FIELDNAME
,
String
.
class
,
true
,
true
);
taskCompleteds
.
stream
().
forEach
(
o
->
identities
.
removeAll
(
matrix
.
completed
(
o
.
getIdentity
())));
if
(!
identities
.
isEmpty
())
{
aeiObjects
.
business
().
organization
().
person
().
listPairIdentity
(
identities
).
stream
().
forEach
(
p
->
{
if
(
people
.
contains
(
p
.
getPerson
()))
{
matrix
.
completed
(
p
.
getIdentity
());
}
});
}
}
}
@Override
@Override
protected
void
executingCommitted
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
Work
>
works
)
throws
Exception
{
protected
void
executingCommitted
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
Work
>
works
)
throws
Exception
{
// Manual Work 还没有处理完 发生了停留,出发了停留事件
// Manual Work 还没有处理完 发生了停留,出发了停留事件
...
@@ -374,12 +454,9 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -374,12 +454,9 @@ public class ManualProcessor extends AbstractManualProcessor {
results
.
add
(
aeiObjects
.
getRoutes
().
get
(
0
));
results
.
add
(
aeiObjects
.
getRoutes
().
get
(
0
));
}
else
if
(
aeiObjects
.
getRoutes
().
size
()
>
1
)
{
}
else
if
(
aeiObjects
.
getRoutes
().
size
()
>
1
)
{
// 存在多条路由
// 存在多条路由
List
<
TaskCompleted
>
taskCompletedList
=
aeiObjects
.
getJoinInquireTaskCompleteds
().
stream
()
List
<
TaskCompleted
>
taskCompleteds
=
aeiObjects
.
filter
(
o
->
StringUtils
.
equals
(
o
.
getActivityToken
(),
aeiObjects
.
getWork
().
getActivityToken
())
.
getJoinInquireTaskCompletedsWithActivityToken
(
aeiObjects
.
getWork
().
getActivityToken
());
&&
aeiObjects
.
getWork
().
getManualTaskIdentityList
().
contains
(
o
.
getIdentity
()))
String
name
=
this
.
choiceRouteName
(
taskCompleteds
,
aeiObjects
.
getRoutes
());
.
collect
(
Collectors
.
toList
());
String
name
=
this
.
choiceRouteName
(
taskCompletedList
,
aeiObjects
.
getRoutes
());
for
(
Route
o
:
aeiObjects
.
getRoutes
())
{
for
(
Route
o
:
aeiObjects
.
getRoutes
())
{
if
(
o
.
getName
().
equalsIgnoreCase
(
name
))
{
if
(
o
.
getName
().
equalsIgnoreCase
(
name
))
{
results
.
add
(
o
);
results
.
add
(
o
);
...
@@ -441,169 +518,64 @@ public class ManualProcessor extends AbstractManualProcessor {
...
@@ -441,169 +518,64 @@ public class ManualProcessor extends AbstractManualProcessor {
return
optional
.
isPresent
()
?
optional
.
get
().
getKey
()
:
null
;
return
optional
.
isPresent
()
?
optional
.
get
().
getKey
()
:
null
;
}
}
private
boolean
single
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
String
>
identities
)
throws
Exception
{
// 是否有优先路由
boolean
passThrough
=
false
;
private
void
single
(
AeiObjects
aeiObjects
,
Manual
manual
,
ManualTaskIdentityMatrix
matrix
,
Long
count
=
aeiObjects
.
getJoinInquireTaskCompleteds
().
stream
()
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
.
filter
(
o
->
(
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
())
if
(
soleDirect
(
aeiObjects
,
taskCompleteds
))
{
&&
(
identities
.
contains
(
o
.
getIdentity
()))))
matrix
.
clear
();
.
count
();
if
(
count
>
0
)
{
// 已经确定要通过此节点,清除可能是多余的待办
aeiObjects
.
getTasks
().
stream
().
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getId
(),
o
.
getWork
()))
.
forEach
(
o
->
{
// 如果启用了将未处理待办转待阅,那么进行转换
if
(
BooleanUtils
.
isTrue
(
manual
.
getManualUncompletedTaskToRead
()))
{
aeiObjects
.
getCreateReads
()
.
add
(
new
Read
(
aeiObjects
.
getWork
(),
o
.
getIdentity
(),
o
.
getUnit
(),
o
.
getPerson
()));
}
aeiObjects
.
deleteTask
(
o
);
});
// 所有预计的处理人中已经有已办,这个环节已经产生了已办,可以离开换个环节。
passThrough
=
true
;
}
else
{
}
else
{
// 取到期望的待办人员,由于要进行处理需要转换成可读写List
task
(
aeiObjects
,
manual
,
matrix
.
read
());
if
(
ListTools
.
isEmpty
(
identities
))
{
throw
new
ExceptionExpectedEmpty
(
aeiObjects
.
getWork
().
getTitle
(),
aeiObjects
.
getWork
().
getId
(),
manual
.
getName
(),
manual
.
getId
());
}
// 删除多余的待办
aeiObjects
.
getTasks
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
())
&&
(!
ListTools
.
contains
(
identities
,
o
.
getIdentity
())))
.
forEach
(
aeiObjects:
:
deleteTask
);
// 将待办已经产生的人从预期值中删除
aeiObjects
.
getTasks
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
())
&&
(
ListTools
.
contains
(
identities
,
o
.
getIdentity
())))
.
forEach
(
o
->
identities
.
remove
(
o
.
getIdentity
()));
// 这里剩余的应该是没有生成待办的人员
if
(!
identities
.
isEmpty
())
{
for
(
String
identity
:
identities
)
{
aeiObjects
.
createTask
(
this
.
createTask
(
aeiObjects
,
manual
,
identity
));
}
}
}
}
return
passThrough
;
}
}
private
boolean
parallel
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
String
>
identities
)
throws
Exception
{
private
void
parallel
(
AeiObjects
aeiObjects
,
Manual
manual
,
ManualTaskIdentityMatrix
matrix
,
boolean
passThrough
=
false
;
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
// 取得本环节已经处理的已办
// 是否有优先路由
List
<
TaskCompleted
>
taskCompleteds
=
this
.
listJoinInquireTaskCompleted
(
aeiObjects
,
identities
);
if
(
soleDirect
(
aeiObjects
,
taskCompleteds
))
{
// 存在优先路由,如果有人选择了优先路由那么直接流转.需要判断是否启用了soleDirect
matrix
.
clear
();
Route
soleRoute
=
aeiObjects
.
getRoutes
().
stream
().
filter
(
r
->
BooleanUtils
.
isTrue
(
r
.
getSoleDirect
()))
.
findFirst
().
orElse
(
null
);
if
(
null
!=
soleRoute
)
{
TaskCompleted
soleTaskCompleted
=
taskCompleteds
.
stream
()
.
filter
(
t
->
BooleanUtils
.
isTrue
(
t
.
getJoinInquire
())
&&
StringUtils
.
equals
(
t
.
getRouteName
(),
soleRoute
.
getName
()))
.
findFirst
().
orElse
(
null
);
if
(
null
!=
soleTaskCompleted
)
{
this
.
parallelSoleTaskCompleted
(
aeiObjects
);
return
true
;
}
}
// 将已经处理的人从期望值中移除
aeiObjects
.
getJoinInquireTaskCompleteds
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
()))
.
forEach
(
o
->
identities
.
remove
(
o
.
getIdentity
()));
// 清空可能的多余的待办
aeiObjects
.
getTasks
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
())
&&
(!
ListTools
.
contains
(
identities
,
o
.
getIdentity
())))
.
forEach
(
aeiObjects:
:
deleteTask
);
if
(
identities
.
isEmpty
())
{
// 所有人已经处理完成。
passThrough
=
true
;
}
else
{
}
else
{
passThrough
=
false
;
task
(
aeiObjects
,
manual
,
matrix
.
flat
());
// 先清空已经有待办的身份
aeiObjects
.
getTasks
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
()))
.
forEach
(
o
->
identities
.
remove
(
o
.
getIdentity
()));
// 这里剩余的应该是没有生成待办的人员
if
(!
identities
.
isEmpty
())
{
for
(
String
identity
:
identities
)
{
aeiObjects
.
createTask
(
this
.
createTask
(
aeiObjects
,
manual
,
identity
));
}
}
}
}
return
passThrough
;
}
}
// 并行环节下如果有优先路由,那么直接走优先路由,处理的时候需要晴空所有代办
private
void
queue
(
AeiObjects
aeiObjects
,
Manual
manual
,
ManualTaskIdentityMatrix
matrix
,
private
void
parallelSoleTaskCompleted
(
AeiObjects
aeiObjects
)
throws
Exception
{
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
// 清空可能的多余的待办
if
(
soleDirect
(
aeiObjects
,
taskCompleteds
))
{
aeiObjects
.
getTasks
().
stream
()
matrix
.
clear
();
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
()))
.
forEach
(
aeiObjects:
:
deleteTask
);
}
private
boolean
queue
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
String
>
identities
)
throws
Exception
{
boolean
passThrough
=
false
;
List
<
TaskCompleted
>
taskCompleteds
=
this
.
listJoinInquireTaskCompleted
(
aeiObjects
,
identities
);
// 存在优先路由
if
(
queueHasSole
(
aeiObjects
,
taskCompleteds
))
{
return
true
;
}
// 存在优先路由结束,将已经处理的人从期望值中移除
queueRemoveTaskCompletedFromIdentities
(
identities
,
taskCompleteds
);
if
(
identities
.
isEmpty
())
{
// 所有人已经处理完成。
passThrough
=
true
;
}
else
{
}
else
{
passThrough
=
false
;
task
(
aeiObjects
,
manual
,
matrix
.
read
());
String
identity
=
identities
.
get
(
0
);
// 还有人没有处理,开始判断待办,取到本环节的所有待办,理论上只能有一条待办
boolean
find
=
false
;
for
(
Task
t
:
aeiObjects
.
getTasks
())
{
if
(
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
t
.
getActivityToken
()))
{
if
(!
StringUtils
.
equals
(
t
.
getIdentity
(),
identity
))
{
aeiObjects
.
deleteTask
(
t
);
}
else
{
find
=
true
;
}
}
}
// 当前处理人没有待办
if
(!
find
)
{
aeiObjects
.
createTask
(
this
.
createTask
(
aeiObjects
,
manual
,
identity
));
}
}
}
return
passThrough
;
}
}
private
boolean
queueHasSole
(
AeiObjects
aeiObjects
,
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
private
boolean
soleDirect
(
AeiObjects
aeiObjects
,
List
<
TaskCompleted
>
taskCompleteds
)
throws
Exception
{
Route
soleRoute
=
aeiObjects
.
getRoutes
().
stream
().
filter
(
r
->
BooleanUtils
.
isTrue
(
r
.
getSoleDirect
()))
// 存在优先路由,如果有人选择了优先路由那么直接流转.需要判断是否启用了soleDirect
.
findFirst
().
orElse
(
null
);
Optional
<
Route
>
route
=
aeiObjects
.
getRoutes
().
stream
().
filter
(
r
->
BooleanUtils
.
isTrue
(
r
.
getSoleDirect
()))
if
(
null
!=
soleRoute
)
{
.
findFirst
();
TaskCompleted
soleTaskCompleted
=
taskCompleteds
.
stream
()
if
(
route
.
isPresent
())
{
.
filter
(
t
->
BooleanUtils
.
isTrue
(
t
.
getJoinInquire
())
Optional
<
TaskCompleted
>
taskCompleted
=
taskCompleteds
.
stream
()
&&
StringUtils
.
equals
(
t
.
getRouteName
(),
soleRoute
.
getName
()))
.
filter
(
t
->
StringUtils
.
equals
(
t
.
getRouteName
(),
route
.
get
().
getName
())).
findFirst
();
.
findFirst
().
orElse
(
null
);
if
(
taskCompleted
.
isPresent
())
{
if
(
null
!=
soleTaskCompleted
)
{
return
true
;
return
true
;
}
}
}
}
return
false
;
return
false
;
}
}
private
void
queueRemoveTaskCompletedFromIdentities
(
List
<
String
>
identities
,
List
<
TaskCompleted
>
taskCompleteds
)
{
private
void
task
(
AeiObjects
aeiObjects
,
Manual
manual
,
List
<
String
>
identities
)
throws
Exception
{
for
(
TaskCompleted
o
:
taskCompleteds
)
{
String
activityToken
=
aeiObjects
.
getWork
().
getActivityToken
();
identities
.
remove
(
o
.
getIdentity
());
aeiObjects
.
getTasks
().
stream
().
filter
(
t
->
StringUtils
.
equalsIgnoreCase
(
t
.
getActivityToken
(),
activityToken
))
.
forEach
(
t
->
{
if
(!
identities
.
contains
(
t
.
getIdentity
()))
{
aeiObjects
.
deleteTask
(
t
);
}
else
{
identities
.
remove
(
t
.
getIdentity
());
}
});
for
(
String
identity
:
identities
)
{
aeiObjects
.
createTask
(
this
.
createTask
(
aeiObjects
,
manual
,
identity
));
}
}
}
}
// 所有有效的已办,去除 reset,retract,appendTask
private
List
<
TaskCompleted
>
listJoinInquireTaskCompleted
(
AeiObjects
aeiObjects
,
List
<
String
>
identities
)
throws
Exception
{
return
aeiObjects
.
getJoinInquireTaskCompleteds
().
stream
()
.
filter
(
o
->
StringUtils
.
equals
(
aeiObjects
.
getWork
().
getActivityToken
(),
o
.
getActivityToken
())
&&
identities
.
contains
(
o
.
getIdentity
())
&&
BooleanUtils
.
isTrue
(
o
.
getJoinInquire
()))
.
collect
(
Collectors
.
toList
());
}
@Override
@Override
protected
void
inquiringCommitted
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
protected
void
inquiringCommitted
(
AeiObjects
aeiObjects
,
Manual
manual
)
throws
Exception
{
// nothing
// nothing
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/manual/ManualProcessor2.java
0 → 100644
浏览文件 @
b77fdb3f
//package com.x.processplatform.service.processing.processor.manual;
//
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Comparator;
//import java.util.Date;
//import java.util.LinkedHashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Map.Entry;
//import java.util.Objects;
//import java.util.Optional;
//import java.util.stream.Collectors;
//
//import javax.script.Bindings;
//import javax.script.CompiledScript;
//import javax.script.ScriptContext;
//
//import org.apache.commons.collections4.ListUtils;
//import org.apache.commons.lang3.BooleanUtils;
//import org.apache.commons.lang3.ObjectUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.commons.lang3.time.DateUtils;
//
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.entity.JpaObject;
//import com.x.base.core.project.config.Config;
//import com.x.base.core.project.logger.Logger;
//import com.x.base.core.project.logger.LoggerFactory;
//import com.x.base.core.project.organization.EmpowerLog;
//import com.x.base.core.project.scripting.JsonScriptingExecutor;
//import com.x.base.core.project.scripting.ScriptingFactory;
//import com.x.base.core.project.tools.DateTools;
//import com.x.base.core.project.tools.ListTools;
//import com.x.base.core.project.tools.NumberTools;
//import com.x.base.core.project.utils.time.WorkTime;
//import com.x.processplatform.core.entity.content.Read;
//import com.x.processplatform.core.entity.content.Task;
//import com.x.processplatform.core.entity.content.TaskCompleted;
//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.entity.element.Route;
//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.log.Signal;
//import com.x.processplatform.service.processing.Business;
//import com.x.processplatform.service.processing.WorkContext;
//import com.x.processplatform.service.processing.processor.AeiObjects;
//
///**
// * @author Zhou Rui
// */
//public class ManualProcessor2 extends AbstractManualProcessor {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(ManualProcessor2.class);
//
// public ManualProcessor2(EntityManagerContainer entityManagerContainer) throws Exception {
// super(entityManagerContainer);
// }
//
//
//
// @Override
// protected Work arriving(AeiObjects aeiObjects, Manual manual) throws Exception {
// // 发送ProcessingSignal
// aeiObjects.getProcessingAttributes().push(Signal.manualArrive(aeiObjects.getWork().getActivityToken(), manual));
// // 根据manual计算出来的活动处理人
// List<String> identities = calculateTaskIdentities(aeiObjects, manual);
// // 启用同类工作相同活动节点合并,如果有合并的工作,那么直接返回这个工作.
// Work merge = this.arrivingMergeSameJob(aeiObjects, manual, identities);
// if (null != merge) {
// return merge;
// }
// this.arrivingPassSame(aeiObjects, identities);
// aeiObjects.getWork().setManualTaskIdentityList(new ArrayList<>(identities));
// return aeiObjects.getWork();
// }
//
// private Work arrivingMergeSameJob(AeiObjects aeiObjects, Manual manual, List<String> identities) throws Exception {
// if (!BooleanUtils.isTrue(manual.getManualMergeSameJobActivity())) {
// return null;
// }
// List<String> exists = this.arrivingSameJobActivityExistIdentities(aeiObjects, manual);
// if (ListTools.isNotEmpty(exists)) {
// Work other = aeiObjects.getWorks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getJob(), o.getJob())
// && StringUtils.equals(aeiObjects.getWork().getActivity(), o.getActivity())
// && (!Objects.equals(aeiObjects.getWork(), o)))
// .findFirst().orElse(null);
// if (null != other) {
// identities.removeAll(exists);
// if (ListTools.isEmpty(identities)) {
// this.mergeTaskCompleted(aeiObjects, aeiObjects.getWork(), other);
// this.mergeRead(aeiObjects, aeiObjects.getWork(), other);
// this.mergeReadCompleted(aeiObjects, aeiObjects.getWork(), other);
// this.mergeReview(aeiObjects, aeiObjects.getWork(), other);
// this.mergeAttachment(aeiObjects, aeiObjects.getWork(), other);
// this.mergeWorkLog(aeiObjects, aeiObjects.getWork(), other);
// if (ListTools.size(aeiObjects.getWork().getSplitTokenList()) > ListTools
// .size(other.getSplitTokenList())) {
// other.setSplitTokenList(aeiObjects.getWork().getSplitTokenList());
// other.setSplitToken(aeiObjects.getWork().getSplitToken());
// other.setSplitValue(aeiObjects.getWork().getSplitValue());
// other.setSplitting(true);
// }
// aeiObjects.getUpdateWorks().add(other);
// aeiObjects.getDeleteWorks().add(aeiObjects.getWork());
// return other;
// }
// }
// }
// return null;
// }
//
// private void arrivingPassSame(AeiObjects aeiObjects, List<String> identities) throws Exception {
// // 查找是否有passSameTarget设置
// Route route = aeiObjects.getRoutes().stream().filter(o -> BooleanUtils.isTrue(o.getPassSameTarget()))
// .findFirst().orElse(null);
// // 如果有passSameTarget,有到达ArriveWorkLog,不是调度到这个节点的
// if ((null != route) && (null != aeiObjects.getArriveWorkLog(aeiObjects.getWork()))
// && (!aeiObjects.getProcessingAttributes().ifForceJoinAtArrive())) {
// WorkLog workLog = findPassSameTargetWorkLog(aeiObjects);
// if (null == workLog) {
// return;
// }
// LOGGER.debug("pass same target work:{}, workLog:{}.", aeiObjects::getWork, workLog::toString);
// for (TaskCompleted o : aeiObjects.getJoinInquireTaskCompleteds()) {
// if (StringUtils.equals(o.getActivityToken(), workLog.getArrivedActivityToken())) {
// List<String> values = ListUtils.intersection(identities,
// aeiObjects.business().organization().identity().listWithPerson(o.getPerson()));
// if (!values.isEmpty()) {
// TaskCompleted obj = new TaskCompleted(aeiObjects.getWork(), route, o);
// obj.setIdentity(values.get(0));
// obj.setUnit(aeiObjects.business().organization().unit().getWithIdentity(obj.getIdentity()));
// obj.setProcessingType(TaskCompleted.PROCESSINGTYPE_SAMETARGET);
// obj.setRouteName(route.getName());
// obj.setOpinion(route.getOpinion());
// Date now = new Date();
// obj.setStartTime(now);
// obj.setStartTimeMonth(DateTools.format(now, DateTools.format_yyyyMM));
// obj.setCompletedTime(now);
// obj.setCompletedTimeMonth(DateTools.format(now, DateTools.format_yyyyMM));
// obj.setDuration(0L);
// obj.setExpired(false);
// obj.setExpireTime(null);
// obj.setTask(null);
// obj.setLatest(true);
// aeiObjects.getCreateTaskCompleteds().add(obj);
// }
// }
// }
// }
// }
//
// // 计算处理人
// private List<String> calculateTaskIdentities(AeiObjects aeiObjects, Manual manual) throws Exception {
// TaskIdentities taskIdentities = new TaskIdentities();
// // 先计算强制处理人
// if (!aeiObjects.getWork().getProperties().getManualForceTaskIdentityList().isEmpty()) {
// List<String> identities = new ArrayList<>();
// identities.addAll(aeiObjects.getWork().getProperties().getManualForceTaskIdentityList());
// identities = aeiObjects.business().organization().identity().list(identities);
// if (ListTools.isNotEmpty(identities)) {
// taskIdentities.addIdentities(identities);
// }
// }
// // 计算退回的结果
// if (taskIdentities.isEmpty()) {
// Route route = aeiObjects.business().element().get(aeiObjects.getWork().getDestinationRoute(), Route.class);
// if ((null != route) && (StringUtils.equals(route.getType(), Route.TYPE_BACK))) {
// calculateRouteTypeBack(aeiObjects, manual, taskIdentities);
// }
// }
// if (taskIdentities.isEmpty()) {
// taskIdentities = TranslateTaskIdentityTools.translate(aeiObjects, manual);
// this.ifTaskIdentitiesEmptyForceToCreatorOrMaintenance(aeiObjects, manual, taskIdentities);
// this.writeToEmpowerMap(aeiObjects, taskIdentities);
// }
// return taskIdentities.identities();
// }
//
// private void calculateRouteTypeBack(AeiObjects aeiObjects, Manual manual, TaskIdentities taskIdentities)
// throws Exception {
// List<String> identities = new ArrayList<>();
// List<WorkLog> workLogs = new ArrayList<>();
// workLogs.addAll(aeiObjects.getUpdateWorkLogs());
// workLogs.addAll(aeiObjects.getCreateWorkLogs());
// for (WorkLog o : aeiObjects.getWorkLogs()) {
// if (!workLogs.contains(o)) {
// workLogs.add(o);
// }
// }
// WorkLogTree tree = new WorkLogTree(workLogs);
// Node node = tree.location(aeiObjects.getWork());
// if (null != node) {
// calculateRouteTypeBackIdentityByTaskCompleted(aeiObjects, manual, taskIdentities, identities, tree, node);
// }
// }
//
// private void calculateRouteTypeBackIdentityByTaskCompleted(AeiObjects aeiObjects, Manual manual,
// TaskIdentities taskIdentities, List<String> identities, WorkLogTree tree, Node node) throws Exception {
// for (Node n : tree.up(node)) {
// if (StringUtils.equals(manual.getId(), n.getWorkLog().getFromActivity())) {
// for (TaskCompleted t : aeiObjects.getTaskCompleteds()) {
// if (StringUtils.equals(n.getWorkLog().getFromActivityToken(), t.getActivityToken())
// && BooleanUtils.isTrue(t.getJoinInquire())) {
// identities.add(t.getIdentity());
// }
// }
// break;
// }
// }
// identities = aeiObjects.business().organization().identity().list(identities);
// if (ListTools.isNotEmpty(identities)) {
// taskIdentities.addIdentities(identities);
// }
// }
//
// // 如果活动没有找到任何可用的处理人,那么强制设置处理人为文档创建者,或者配置的 maintenanceIdentity
// private void ifTaskIdentitiesEmptyForceToCreatorOrMaintenance(AeiObjects aeiObjects, Manual manual,
// TaskIdentities taskIdentities) throws Exception {
// if (taskIdentities.isEmpty()) {
// String identity = aeiObjects.business().organization().identity()
// .get(aeiObjects.getWork().getCreatorIdentity());
// if (StringUtils.isNotEmpty(identity)) {
// LOGGER.info("{}[{}]未能找到指定的处理人, 标题:{}, id:{}, 强制指定处理人为活动的创建身份:{}.", aeiObjects.getProcess()::getName,
// manual::getName, aeiObjects.getWork()::getTitle, aeiObjects.getWork()::getId,
// identity::toString);
// taskIdentities.addIdentity(identity);
// } else {
// identity = aeiObjects.business().organization().identity()
// .get(Config.processPlatform().getMaintenanceIdentity());
// if (StringUtils.isNotEmpty(identity)) {
// LOGGER.info("{}[{}]未能找到指定的处理人, 也没有能找到工作创建人, 标题:{}, id:{}, 强制指定处理人为系统维护身份:{}.",
// aeiObjects.getProcess()::getName, manual::getName, aeiObjects.getWork()::getTitle,
// aeiObjects.getWork()::getId, identity::toString);
// taskIdentities.addIdentity(identity);
// } else {
// throw new ExceptionExpectedEmpty(aeiObjects.getWork().getTitle(), aeiObjects.getWork().getId(),
// aeiObjects.getActivity().getName(), aeiObjects.getActivity().getId());
// }
// }
// }
// }
//
// // 更新授权,通过surface创建且workThroughManual=false 代表是草稿,那么不需要授权.
//
// private void writeToEmpowerMap(AeiObjects aeiObjects, TaskIdentities taskIdentities) throws Exception {
// // 先清空EmpowerMap
// aeiObjects.getWork().getProperties().setManualEmpowerMap(new LinkedHashMap<>());
// if (!(StringUtils.equals(aeiObjects.getWork().getWorkCreateType(), Work.WORKCREATETYPE_SURFACE)
// && BooleanUtils.isFalse(aeiObjects.getWork().getWorkThroughManual()))) {
// List<String> values = taskIdentities.identities();
// values = ListUtils.subtract(values, aeiObjects.getProcessingAttributes().getIgnoreEmpowerIdentityList());
// taskIdentities.empower(aeiObjects.business().organization().empower().listWithIdentityObject(
// aeiObjects.getWork().getApplication(), aeiObjects.getProcess().getEdition(),
// aeiObjects.getWork().getProcess(), aeiObjects.getWork().getId(), values));
// for (TaskIdentity taskIdentity : taskIdentities) {
// if (StringUtils.isNotEmpty(taskIdentity.getFromIdentity())) {
// aeiObjects.getWork().getProperties().getManualEmpowerMap().put(taskIdentity.getIdentity(),
// taskIdentity.getFromIdentity());
// }
// }
// }
// }
//
// private WorkLog findPassSameTargetWorkLog(AeiObjects aeiObjects) throws Exception {
// WorkLogTree tree = new WorkLogTree(aeiObjects.getWorkLogs());
// List<WorkLog> parents = tree.parents(aeiObjects.getArriveWorkLog(aeiObjects.getWork()));
// LOGGER.debug("pass same target rollback parents:{}.", parents::toString);
// WorkLog workLog = null;
// for (WorkLog o : parents) {
// // choice, agent, invoke, service, delay, embed 继续向上查找manual
// ActivityType arrivedActivityType = o.getArrivedActivityType();
// if (Objects.equals(ActivityType.manual, arrivedActivityType)
// || Objects.equals(ActivityType.begin, arrivedActivityType)
// || Objects.equals(ActivityType.cancel, arrivedActivityType)
// // || Objects.equals(ActivityType.embed, arrivedActivityType)
// || Objects.equals(ActivityType.end, arrivedActivityType)
// || Objects.equals(ActivityType.merge, arrivedActivityType)
// || Objects.equals(ActivityType.parallel, arrivedActivityType)
// || Objects.equals(ActivityType.split, arrivedActivityType)) {
// if (Objects.equals(ActivityType.manual, arrivedActivityType)) {
// workLog = o;
// }
// break;
// }
// }
// return workLog;
// }
//
// @Override
// protected void arrivingCommitted(AeiObjects aeiObjects, Manual manual) throws Exception {
// // nothing
// }
//
// @Override
// protected List<Work> executing(AeiObjects aeiObjects, Manual manual) throws Exception {
// List<Work> results = new ArrayList<>();
// boolean passThrough = false;
// List<String> identities = aeiObjects.business().organization().identity()
// .list(aeiObjects.getWork().getManualTaskIdentityList());
// if (identities.isEmpty()) {
// identities = calculateTaskIdentities(aeiObjects, manual);
// LOGGER.info("工作设置的处理人已经全部无效,重新计算当前环节所有处理人进行处理,标题:{}, id:{}, 设置的处理人:{}.", aeiObjects.getWork()::getTitle,
// aeiObjects.getWork()::getId, identities::toString);
// // 后面进行了identitis.remove()这里必须用一个新对象包装
// aeiObjects.getWork().setManualTaskIdentityList(new ArrayList<>(identities));
// }
// // 发送ProcessingSignal
// aeiObjects.getProcessingAttributes().push(Signal.manualExecute(aeiObjects.getWork().getActivityToken(), manual,
// Objects.toString(manual.getManualMode(), ""), identities));
// switch (manual.getManualMode()) {
// case single:
// passThrough = this.single(aeiObjects, manual, identities);
// break;
// case parallel:
// passThrough = this.parallel(aeiObjects, manual, identities);
// break;
// case queue:
// passThrough = this.queue(aeiObjects, manual, identities);
// break;
// case grab:
// passThrough = this.single(aeiObjects, manual, identities);
// break;
// default:
// throw new ExceptionManualModeError(manual.getId());
// }
//
// if (passThrough) {
// results.add(aeiObjects.getWork());
// }
// return results;
// }
//
// @Override
// protected void executingCommitted(AeiObjects aeiObjects, Manual manual, List<Work> works) throws Exception {
// // Manual Work 还没有处理完 发生了停留,出发了停留事件
// if ((ListTools.isEmpty(works)) && (!aeiObjects.getCreateTasks().isEmpty())) {
// boolean hasManualStayScript = this.hasManualStayScript(manual);
// boolean processHasManualStayScript = this.hasManualStayScript(aeiObjects.getProcess());
// if (hasManualStayScript || processHasManualStayScript) {
// ScriptContext scriptContext = aeiObjects.scriptContext();
// Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
// WorkContext workContext = (WorkContext) bindings.get(ScriptingFactory.BINDING_NAME_WORKCONTEXT);
// // 只有一条待办绑定到task
// if (aeiObjects.getCreateTasks().size() == 1) {
// workContext.bindTask(aeiObjects.getCreateTasks().get(0));
// }
// if (processHasManualStayScript) {
// JsonScriptingExecutor
// .eval(aeiObjects.business().element().getCompiledScript(aeiObjects.getApplication().getId(),
// aeiObjects.getProcess(), Business.EVENT_MANUALSTAY), scriptContext);
// }
// if (hasManualStayScript) {
// JsonScriptingExecutor
// .eval(aeiObjects.business().element().getCompiledScript(aeiObjects.getApplication().getId(),
// aeiObjects.getActivity(), Business.EVENT_MANUALSTAY), scriptContext);
// }
// // 解除绑定
// workContext.bindTask(null);
// }
// }
// }
//
// @Override
// protected List<Route> inquiring(AeiObjects aeiObjects, Manual manual) throws Exception {
// // 发送ProcessingSignal
// aeiObjects.getProcessingAttributes()
// .push(Signal.manualInquire(aeiObjects.getWork().getActivityToken(), manual));
// List<Route> results = new ArrayList<>();
// // 仅有单条路由
// if (aeiObjects.getRoutes().size() == 1) {
// results.add(aeiObjects.getRoutes().get(0));
// } else if (aeiObjects.getRoutes().size() > 1) {
// // 存在多条路由
// List<TaskCompleted> taskCompletedList = aeiObjects.getJoinInquireTaskCompleteds().stream()
// .filter(o -> StringUtils.equals(o.getActivityToken(), aeiObjects.getWork().getActivityToken())
// && aeiObjects.getWork().getManualTaskIdentityList().contains(o.getIdentity()))
// .collect(Collectors.toList());
//
// String name = this.choiceRouteName(taskCompletedList, aeiObjects.getRoutes());
// for (Route o : aeiObjects.getRoutes()) {
// if (o.getName().equalsIgnoreCase(name)) {
// results.add(o);
// break;
// }
// }
// }
//
// if (!results.isEmpty()) {
// // 清理掉强制的指定的处理人
// aeiObjects.getWork().getProperties().setManualForceTaskIdentityList(new ArrayList<>());
// }
//
// return results;
// }
//
// // 通过已办存根选择某条路由
// private String choiceRouteName(List<TaskCompleted> list, List<Route> routes) throws Exception {
// String result = "";
// List<String> names = new ArrayList<>();
// ListTools.trim(list, false, false).stream().forEach(o -> names.add(o.getRouteName()));
// // 进行优先路由的判断
// // 已经开始选择路由,如果选择了soleDirect那么就直接返回了,如果没有选择这个路由在进行sole的判断,顺序是 soleDirct -> sole
// // -> max.
// Route soleRoute = routes.stream().filter(o -> BooleanUtils.isTrue(o.getSoleDirect())).findFirst().orElse(null);
// if ((null != soleRoute) && names.contains(soleRoute.getName())) {
// result = soleRoute.getName();
// } else {
// soleRoute = routes.stream().filter(o -> BooleanUtils.isTrue(o.getSole())).findFirst().orElse(null);
// if ((null != soleRoute) && names.contains(soleRoute.getName())) {
// result = soleRoute.getName();
// } else {
// // 进行默认的策略,选择占比多的
// result = maxCountOrLatest(list);
// }
// }
// if (StringUtils.isEmpty(result)) {
// throw new ExceptionChoiceRouteNameError(
// ListTools.extractProperty(list, JpaObject.id_FIELDNAME, String.class, false, false));
// }
// return result;
// }
//
// private String maxCountOrLatest(List<TaskCompleted> list) {
// Map<String, List<TaskCompleted>> map = list.stream()
// .collect(Collectors.groupingBy(TaskCompleted::getRouteName));
// Optional<Entry<String, List<TaskCompleted>>> optional = map.entrySet().stream().min((o1, o2) -> {
// int c = o2.getValue().size() - o1.getValue().size();
// if (c == 0) {
// Date d1 = o1.getValue().stream().sorted(Comparator.comparing(TaskCompleted::getCreateTime).reversed())
// .findFirst().get().getCreateTime();
// Date d2 = o2.getValue().stream().sorted(Comparator.comparing(TaskCompleted::getCreateTime).reversed())
// .findFirst().get().getCreateTime();
// return ObjectUtils.compare(d2, d1);
// } else {
// return c;
// }
// });
// return optional.isPresent() ? optional.get().getKey() : null;
// }
//
// private boolean single(AeiObjects aeiObjects, Manual manual, List<String> identities) throws Exception {
// boolean passThrough = false;
// Long count = aeiObjects.getJoinInquireTaskCompleteds().stream()
// .filter(o -> (StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
// && (identities.contains(o.getIdentity()))))
// .count();
// if (count > 0) {
// // 已经确定要通过此节点,清除可能是多余的待办
// aeiObjects.getTasks().stream().filter(o -> StringUtils.equals(aeiObjects.getWork().getId(), o.getWork()))
// .forEach(o -> {
// // 如果启用了将未处理待办转待阅,那么进行转换
// if (BooleanUtils.isTrue(manual.getManualUncompletedTaskToRead())) {
// aeiObjects.getCreateReads()
// .add(new Read(aeiObjects.getWork(), o.getIdentity(), o.getUnit(), o.getPerson()));
// }
// aeiObjects.deleteTask(o);
// });
// // 所有预计的处理人中已经有已办,这个环节已经产生了已办,可以离开换个环节。
// passThrough = true;
// } else {
// // 取到期望的待办人员,由于要进行处理需要转换成可读写List
// if (ListTools.isEmpty(identities)) {
// throw new ExceptionExpectedEmpty(aeiObjects.getWork().getTitle(), aeiObjects.getWork().getId(),
// manual.getName(), manual.getId());
// }
// // 删除多余的待办
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
// && (!ListTools.contains(identities, o.getIdentity())))
// .forEach(aeiObjects::deleteTask);
// // 将待办已经产生的人从预期值中删除
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
// && (ListTools.contains(identities, o.getIdentity())))
// .forEach(o -> identities.remove(o.getIdentity()));
// // 这里剩余的应该是没有生成待办的人员
// if (!identities.isEmpty()) {
// for (String identity : identities) {
// aeiObjects.createTask(this.createTask(aeiObjects, manual, identity));
// }
// }
// }
// return passThrough;
// }
//
// private boolean parallel(AeiObjects aeiObjects, Manual manual, List<String> identities) throws Exception {
// boolean passThrough = false;
// // 取得本环节已经处理的已办
// List<TaskCompleted> taskCompleteds = this.listJoinInquireTaskCompleted(aeiObjects, identities);
// // 存在优先路由,如果有人选择了优先路由那么直接流转.需要判断是否启用了soleDirect
// Route soleRoute = aeiObjects.getRoutes().stream().filter(r -> BooleanUtils.isTrue(r.getSoleDirect()))
// .findFirst().orElse(null);
// if (null != soleRoute) {
// TaskCompleted soleTaskCompleted = taskCompleteds.stream()
// .filter(t -> BooleanUtils.isTrue(t.getJoinInquire())
// && StringUtils.equals(t.getRouteName(), soleRoute.getName()))
// .findFirst().orElse(null);
// if (null != soleTaskCompleted) {
// this.parallelSoleTaskCompleted(aeiObjects);
// return true;
// }
// }
// // 将已经处理的人从期望值中移除
// aeiObjects.getJoinInquireTaskCompleteds().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken()))
// .forEach(o -> identities.remove(o.getIdentity()));
// // 清空可能的多余的待办
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
// && (!ListTools.contains(identities, o.getIdentity())))
// .forEach(aeiObjects::deleteTask);
// if (identities.isEmpty()) {
// // 所有人已经处理完成。
// passThrough = true;
// } else {
// passThrough = false;
// // 先清空已经有待办的身份
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken()))
// .forEach(o -> identities.remove(o.getIdentity()));
// // 这里剩余的应该是没有生成待办的人员
// if (!identities.isEmpty()) {
// for (String identity : identities) {
// aeiObjects.createTask(this.createTask(aeiObjects, manual, identity));
// }
// }
// }
// return passThrough;
// }
//
// // 并行环节下如果有优先路由,那么直接走优先路由,处理的时候需要晴空所有代办
// private void parallelSoleTaskCompleted(AeiObjects aeiObjects) throws Exception {
// // 清空可能的多余的待办
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken()))
// .forEach(aeiObjects::deleteTask);
// }
//
// private boolean queue(AeiObjects aeiObjects, Manual manual, List<String> identities) throws Exception {
// boolean passThrough = false;
// List<TaskCompleted> taskCompleteds = this.listJoinInquireTaskCompleted(aeiObjects, identities);
// // 存在优先路由
// if (queueHasSole(aeiObjects, taskCompleteds)) {
// return true;
// }
// // 存在优先路由结束,将已经处理的人从期望值中移除
// queueRemoveTaskCompletedFromIdentities(identities, taskCompleteds);
// if (identities.isEmpty()) {
// // 所有人已经处理完成。
// passThrough = true;
// } else {
// passThrough = false;
// String identity = identities.get(0);
// // 还有人没有处理,开始判断待办,取到本环节的所有待办,理论上只能有一条待办
// boolean find = false;
// for (Task t : aeiObjects.getTasks()) {
// if (StringUtils.equals(aeiObjects.getWork().getActivityToken(), t.getActivityToken())) {
// if (!StringUtils.equals(t.getIdentity(), identity)) {
// aeiObjects.deleteTask(t);
// } else {
// find = true;
// }
// }
// }
// // 当前处理人没有待办
// if (!find) {
// aeiObjects.createTask(this.createTask(aeiObjects, manual, identity));
// }
// }
// return passThrough;
//
// }
//
// private boolean queueHasSole(AeiObjects aeiObjects, List<TaskCompleted> taskCompleteds) throws Exception {
// Route soleRoute = aeiObjects.getRoutes().stream().filter(r -> BooleanUtils.isTrue(r.getSoleDirect()))
// .findFirst().orElse(null);
// if (null != soleRoute) {
// TaskCompleted soleTaskCompleted = taskCompleteds.stream()
// .filter(t -> BooleanUtils.isTrue(t.getJoinInquire())
// && StringUtils.equals(t.getRouteName(), soleRoute.getName()))
// .findFirst().orElse(null);
// if (null != soleTaskCompleted) {
// return true;
// }
// }
// return false;
// }
//
// private void queueRemoveTaskCompletedFromIdentities(List<String> identities, List<TaskCompleted> taskCompleteds) {
// for (TaskCompleted o : taskCompleteds) {
// identities.remove(o.getIdentity());
// }
// }
//
// // 所有有效的已办,去除 reset,retract,appendTask
// private List<TaskCompleted> listJoinInquireTaskCompleted(AeiObjects aeiObjects, List<String> identities)
// throws Exception {
// return aeiObjects.getJoinInquireTaskCompleteds().stream()
// .filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getActivityToken())
// && identities.contains(o.getIdentity()) && BooleanUtils.isTrue(o.getJoinInquire()))
// .collect(Collectors.toList());
// }
//
// @Override
// protected void inquiringCommitted(AeiObjects aeiObjects, Manual manual) throws Exception {
// // nothing
// }
//
// private void calculateExpire(AeiObjects aeiObjects, Manual manual, Task task) throws Exception {
// if (null != manual.getTaskExpireType()) {
// switch (manual.getTaskExpireType()) {
// case never:
// this.expireNever(task);
// break;
// case appoint:
// this.expireAppoint(manual, task);
// break;
// case script:
// this.expireScript(aeiObjects, manual, task);
// break;
// default:
// break;
// }
// }
// // 如果work有截至时间
// if (null != aeiObjects.getWork().getExpireTime()) {
// if (null == task.getExpireTime()) {
// task.setExpireTime(aeiObjects.getWork().getExpireTime());
// } else {
// if (task.getExpireTime().after(aeiObjects.getWork().getExpireTime())) {
// task.setExpireTime(aeiObjects.getWork().getExpireTime());
// }
// }
// }
// // 已经有过期时间了,那么设置催办时间
// if (null != task.getExpireTime()) {
// task.setUrgeTime(DateUtils.addHours(task.getExpireTime(), -2));
// } else {
// task.setExpired(false);
// task.setUrgeTime(null);
// task.setUrged(false);
// }
// }
//
// // 从不过期
// private void expireNever(Task task) {
// task.setExpireTime(null);
// }
//
// private void expireAppoint(Manual manual, Task task) throws Exception {
// if (BooleanUtils.isTrue(manual.getTaskExpireWorkTime())) {
// this.expireAppointWorkTime(task, manual);
// } else {
// this.expireAppointNaturalDay(task, manual);
// }
// }
//
// private void expireAppointWorkTime(Task task, Manual manual) throws Exception {
// Integer m = 0;
// WorkTime wt = Config.workTime();
// if (BooleanUtils.isTrue(NumberTools.greaterThan(manual.getTaskExpireDay(), 0))) {
// m += manual.getTaskExpireDay() * wt.minutesOfWorkDay();
// }
// if (BooleanUtils.isTrue(NumberTools.greaterThan(manual.getTaskExpireHour(), 0))) {
// m += manual.getTaskExpireHour() * 60;
// }
// if (m > 0) {
// Date expire = wt.forwardMinutes(new Date(), m);
// task.setExpireTime(expire);
// } else {
// task.setExpireTime(null);
// }
// }
//
// private void expireAppointNaturalDay(Task task, Manual manual) {
// Integer m = 0;
// if (BooleanUtils.isTrue(NumberTools.greaterThan(manual.getTaskExpireDay(), 0))) {
// m += manual.getTaskExpireDay() * 60 * 24;
// }
// if (BooleanUtils.isTrue(NumberTools.greaterThan(manual.getTaskExpireHour(), 0))) {
// m += manual.getTaskExpireHour() * 60;
// }
// if (m > 0) {
// Calendar cl = Calendar.getInstance();
// cl.add(Calendar.MINUTE, m);
// task.setExpireTime(cl.getTime());
// } else {
// task.setExpireTime(null);
// }
// }
//
// private void expireScript(AeiObjects aeiObjects, Manual manual, Task task) throws Exception {
// ExpireScriptResult expire = new ExpireScriptResult();
// ScriptContext scriptContext = aeiObjects.scriptContext();
// CompiledScript cs = aeiObjects.business().element().getCompiledScript(aeiObjects.getWork().getApplication(),
// manual, Business.EVENT_MANUALTASKEXPIRE);
// scriptContext.getBindings(ScriptContext.ENGINE_SCOPE).put(ScriptingFactory.BINDING_NAME_EXPIRE, expire);
// JsonScriptingExecutor.eval(cs, scriptContext, ExpireScriptResult.class, o -> {
// if (null != o) {
// expire.setDate(o.getDate());
// expire.setHour(o.getHour());
// expire.setWorkHour(o.getWorkHour());
// }
// });
// if (BooleanUtils.isTrue(NumberTools.greaterThan(expire.getWorkHour(), 0))) {
// Integer m = 0;
// m += expire.getWorkHour() * 60;
// if (m > 0) {
// task.setExpireTime(Config.workTime().forwardMinutes(new Date(), m));
// } else {
// task.setExpireTime(null);
// }
// } else if (BooleanUtils.isTrue(NumberTools.greaterThan(expire.getHour(), 0))) {
// Integer m = 0;
// m += expire.getHour() * 60;
// if (m > 0) {
// Calendar cl = Calendar.getInstance();
// cl.add(Calendar.MINUTE, m);
// task.setExpireTime(cl.getTime());
// } else {
// task.setExpireTime(null);
// }
// } else if (null != expire.getDate()) {
// task.setExpireTime(expire.getDate());
// } else {
// task.setExpireTime(null);
// }
// }
//
// private Task createTask(AeiObjects aeiObjects, Manual manual, String identity) throws Exception {
// String fromIdentity = aeiObjects.getWork().getProperties().getManualEmpowerMap().get(identity);
// String person = aeiObjects.business().organization().person().getWithIdentity(identity);
// String unit = aeiObjects.business().organization().unit().getWithIdentity(identity);
// Task task = new Task(aeiObjects.getWork(), identity, person, unit, fromIdentity, new Date(), null,
// aeiObjects.getRoutes(), manual.getAllowRapid());
// // 是第一条待办,进行标记,调度过的待办都标记为非第一个待办
// if (BooleanUtils.isTrue(aeiObjects.getProcessingAttributes().getForceJoinAtArrive())) {
// task.setFirst(false);
// } else {
// task.setFirst(ListTools.isEmpty(aeiObjects.getJoinInquireTaskCompleteds()));
// }
// this.calculateExpire(aeiObjects, manual, task);
// if (StringUtils.isNotEmpty(fromIdentity)) {
// aeiObjects.business().organization().empowerLog()
// .log(this.createEmpowerLog(aeiObjects.getWork(), fromIdentity, identity));
// String fromPerson = aeiObjects.business().organization().person().getWithIdentity(fromIdentity);
// String fromUnit = aeiObjects.business().organization().unit().getWithIdentity(fromIdentity);
// TaskCompleted empowerTaskCompleted = new TaskCompleted(aeiObjects.getWork());
// empowerTaskCompleted.setProcessingType(TaskCompleted.PROCESSINGTYPE_EMPOWER);
// empowerTaskCompleted.setIdentity(fromIdentity);
// empowerTaskCompleted.setUnit(fromUnit);
// empowerTaskCompleted.setPerson(fromPerson);
// empowerTaskCompleted.setEmpowerToIdentity(identity);
// aeiObjects.createTaskCompleted(empowerTaskCompleted);
// Read empowerRead = new Read(aeiObjects.getWork(), fromIdentity, fromUnit, fromPerson);
// aeiObjects.createRead(empowerRead);
// }
// return task;
// }
//
// private EmpowerLog createEmpowerLog(Work work, String fromIdentity, String toIdentity) {
// return new EmpowerLog().setApplication(work.getApplication()).setApplicationAlias(work.getApplicationAlias())
// .setApplicationName(work.getApplicationName()).setProcess(work.getProcess())
// .setProcessAlias(work.getProcessAlias()).setProcessName(work.getProcessName()).setTitle(work.getTitle())
// .setWork(work.getId()).setJob(work.getJob()).setFromIdentity(fromIdentity).setToIdentity(toIdentity)
// .setActivity(work.getActivity()).setActivityAlias(work.getActivityAlias())
// .setActivityName(work.getActivityName()).setEmpowerTime(new Date());
// }
//
// private List<String> arrivingSameJobActivityExistIdentities(AeiObjects aeiObjects, Manual manual) throws Exception {
// List<String> exists = new ArrayList<>();
// aeiObjects.getTasks().stream()
// .filter(o -> StringUtils.equals(o.getActivity(), manual.getId())
// && StringUtils.equals(o.getJob(), aeiObjects.getWork().getJob()))
// .forEach(o -> exists.add(o.getIdentity()));
// return exists;
// }
//
// public class ExpireScriptResult {
// Integer hour;
// Integer workHour;
// Date date;
//
// public Integer getHour() {
// return hour;
// }
//
// public void setHour(Integer hour) {
// this.hour = hour;
// }
//
// public Integer getWorkHour() {
// return workHour;
// }
//
// public void setWorkHour(Integer workHour) {
// this.workHour = workHour;
// }
//
// public Date getDate() {
// return date;
// }
//
// public void setDate(Date date) {
// this.date = date;
// }
//
// public void setDate(String str) {
// try {
// this.date = DateTools.parse(str);
// } catch (Exception e) {
// LOGGER.error(e);
// }
// }
//
// }
//}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录