Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
f6500f2a
o2oa
项目概览
此号慢热型
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6500f2a
编写于
11月 30, 2020
作者:
O
o2null
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改为统一的业务逻辑
上级
f9b79c2b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
104 addition
and
12 deletion
+104
-12
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ActionUpdateWithWorkCompleted.java
.../processing/jaxrs/data/ActionUpdateWithWorkCompleted.java
+23
-12
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/BaseAction.java
...essplatform/service/processing/jaxrs/data/BaseAction.java
+81
-0
未找到文件。
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ActionUpdateWithWorkCompleted.java
浏览文件 @
f6500f2a
...
@@ -11,14 +11,17 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
...
@@ -11,14 +11,17 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.gson.XGsonBuilder
;
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.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.jaxrs.data.ActionUpdateWithWork.Wo
;
class
ActionUpdateWithWorkCompleted
extends
BaseAction
{
class
ActionUpdateWithWorkCompleted
extends
BaseAction
{
...
@@ -31,6 +34,11 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
...
@@ -31,6 +34,11 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
Wo
wo
=
new
Wo
();
Wo
wo
=
new
Wo
();
String
executorSeed
=
null
;
String
executorSeed
=
null
;
// 防止提交空数据清空data
if
(
null
==
jsonElement
||
(!
jsonElement
.
isJsonObject
()))
{
throw
new
ExceptionNotJsonObject
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
WorkCompleted
workCompleted
=
emc
.
fetch
(
id
,
WorkCompleted
.
class
,
WorkCompleted
workCompleted
=
emc
.
fetch
(
id
,
WorkCompleted
.
class
,
ListTools
.
toList
(
WorkCompleted
.
job_FIELDNAME
));
ListTools
.
toList
(
WorkCompleted
.
job_FIELDNAME
));
...
@@ -40,16 +48,11 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
...
@@ -40,16 +48,11 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
executorSeed
=
workCompleted
.
getJob
();
executorSeed
=
workCompleted
.
getJob
();
}
}
Callable
<
String
>
callable
=
new
Callable
<
String
>()
{
Callable
<
ActionResult
<
Wo
>>
callable
=
new
Callable
<
ActionResult
<
Wo
>>()
{
public
String
call
()
throws
Exception
{
public
ActionResult
<
Wo
>
call
()
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
/** 防止提交空数据清空data */
if
(
null
==
jsonElement
||
(!
jsonElement
.
isJsonObject
()))
{
throw
new
ExceptionNotJsonObject
();
}
if
(
jsonElement
.
getAsJsonObject
().
entrySet
().
isEmpty
())
{
throw
new
ExceptionEmptyData
();
}
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
WorkCompleted
workCompleted
=
emc
.
find
(
id
,
WorkCompleted
.
class
);
WorkCompleted
workCompleted
=
emc
.
find
(
id
,
WorkCompleted
.
class
);
if
(
null
==
workCompleted
)
{
if
(
null
==
workCompleted
)
{
...
@@ -58,11 +61,19 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
...
@@ -58,11 +61,19 @@ class ActionUpdateWithWorkCompleted extends BaseAction {
if
(
BooleanUtils
.
isTrue
(
workCompleted
.
getMerged
()))
{
if
(
BooleanUtils
.
isTrue
(
workCompleted
.
getMerged
()))
{
throw
new
ExceptionModifyMerged
(
workCompleted
.
getId
());
throw
new
ExceptionModifyMerged
(
workCompleted
.
getId
());
}
}
wo
.
setId
(
workCompleted
.
getId
());
updateData
(
business
,
workCompleted
,
jsonElement
);
JsonElement
source
=
getData
(
business
,
workCompleted
.
getJob
());
JsonElement
merge
=
XGsonBuilder
.
merge
(
jsonElement
,
source
);
/* 先更新title和serial,再更新DataItem,因为旧的DataItem中也有title和serial数据. */
updateTitleSerial
(
business
,
workCompleted
,
merge
);
updateData
(
business
,
workCompleted
,
merge
);
/* updateTitleSerial 和 updateData 方法内进行了提交 */
/* updateTitleSerial 和 updateData 方法内进行了提交 */
wo
.
setId
(
workCompleted
.
getId
());
}
}
return
""
;
result
.
setData
(
wo
);
return
result
;
}
}
};
};
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/BaseAction.java
浏览文件 @
f6500f2a
...
@@ -91,6 +91,41 @@ abstract class BaseAction extends StandardJaxrsAction {
...
@@ -91,6 +91,41 @@ abstract class BaseAction extends StandardJaxrsAction {
}
}
}
}
// 将data中的Title 和 serial 字段同步到work中
void
updateTitleSerial
(
Business
business
,
WorkCompleted
workCompleted
,
JsonElement
jsonElement
)
throws
Exception
{
String
title
=
XGsonBuilder
.
extractString
(
jsonElement
,
WorkCompleted
.
title_FIELDNAME
);
String
serial
=
XGsonBuilder
.
extractString
(
jsonElement
,
WorkCompleted
.
serial_FIELDNAME
);
// 如果有数据就将数据覆盖到work task taskCompleted read readCompleted review 中
if
(((
null
!=
title
)
&&
(!
Objects
.
equals
(
title
,
workCompleted
.
getTitle
())))
||
((
null
!=
serial
)
&&
(!
Objects
.
equals
(
serial
,
workCompleted
.
getSerial
()))))
{
business
.
entityManagerContainer
().
beginTransaction
(
WorkCompleted
.
class
);
business
.
entityManagerContainer
().
beginTransaction
(
Task
.
class
);
business
.
entityManagerContainer
().
beginTransaction
(
TaskCompleted
.
class
);
business
.
entityManagerContainer
().
beginTransaction
(
Read
.
class
);
business
.
entityManagerContainer
().
beginTransaction
(
ReadCompleted
.
class
);
business
.
entityManagerContainer
().
beginTransaction
(
Review
.
class
);
List
<
Task
>
tasks
=
business
.
entityManagerContainer
().
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
workCompleted
.
getJob
());
List
<
TaskCompleted
>
taskCompleteds
=
business
.
entityManagerContainer
().
listEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
workCompleted
.
getJob
());
List
<
Read
>
reads
=
business
.
entityManagerContainer
().
listEqual
(
Read
.
class
,
Read
.
job_FIELDNAME
,
workCompleted
.
getJob
());
List
<
ReadCompleted
>
readCompleteds
=
business
.
entityManagerContainer
().
listEqual
(
ReadCompleted
.
class
,
ReadCompleted
.
job_FIELDNAME
,
workCompleted
.
getJob
());
List
<
Review
>
reviews
=
business
.
entityManagerContainer
().
listEqual
(
Review
.
class
,
Review
.
job_FIELDNAME
,
workCompleted
.
getJob
());
this
.
updateTitle
(
title
,
workCompleted
,
tasks
,
taskCompleteds
,
reads
,
readCompleteds
,
reviews
);
this
.
updateSerial
(
serial
,
workCompleted
,
tasks
,
taskCompleteds
,
reads
,
readCompleteds
,
reviews
);
// 这里必须先提交掉,不然后面的获取会得到不一致的状态
// <openjpa-2.4.3-SNAPSHOT-r422266:1777109 nonfatal user error>
// org.apache.openjpa.persistence.InvalidStateException: Opera tion attempted on
// a deleted instance.
business
.
entityManagerContainer
().
commit
();
}
}
private
void
updateTitle
(
String
title
,
Work
work
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
private
void
updateTitle
(
String
title
,
Work
work
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
if
((
null
!=
title
)
&&
(!
Objects
.
equals
(
title
,
work
.
getTitle
())))
{
if
((
null
!=
title
)
&&
(!
Objects
.
equals
(
title
,
work
.
getTitle
())))
{
...
@@ -114,6 +149,30 @@ abstract class BaseAction extends StandardJaxrsAction {
...
@@ -114,6 +149,30 @@ abstract class BaseAction extends StandardJaxrsAction {
}
}
private
void
updateTitle
(
String
title
,
WorkCompleted
workCompleted
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
if
((
null
!=
title
)
&&
(!
Objects
.
equals
(
title
,
workCompleted
.
getTitle
())))
{
workCompleted
.
setTitle
(
title
);
for
(
Task
o
:
tasks
)
{
o
.
setTitle
(
title
);
}
for
(
TaskCompleted
o
:
taskCompleteds
)
{
o
.
setTitle
(
title
);
}
for
(
Read
o
:
reads
)
{
o
.
setTitle
(
title
);
}
for
(
ReadCompleted
o
:
readCompleteds
)
{
o
.
setTitle
(
title
);
}
for
(
Review
o
:
reviews
)
{
o
.
setTitle
(
title
);
}
}
}
private
void
updateSerial
(
String
serial
,
Work
work
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
private
void
updateSerial
(
String
serial
,
Work
work
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
if
((
null
!=
serial
)
&&
(!
Objects
.
equals
(
serial
,
work
.
getSerial
())))
{
if
((
null
!=
serial
)
&&
(!
Objects
.
equals
(
serial
,
work
.
getSerial
())))
{
...
@@ -135,6 +194,28 @@ abstract class BaseAction extends StandardJaxrsAction {
...
@@ -135,6 +194,28 @@ abstract class BaseAction extends StandardJaxrsAction {
}
}
}
}
}
}
private
void
updateSerial
(
String
serial
,
WorkCompleted
workCompleted
,
List
<
Task
>
tasks
,
List
<
TaskCompleted
>
taskCompleteds
,
List
<
Read
>
reads
,
List
<
ReadCompleted
>
readCompleteds
,
List
<
Review
>
reviews
)
{
if
((
null
!=
serial
)
&&
(!
Objects
.
equals
(
serial
,
workCompleted
.
getSerial
())))
{
workCompleted
.
setSerial
(
serial
);
for
(
Task
o
:
tasks
)
{
o
.
setSerial
(
serial
);
}
for
(
TaskCompleted
o
:
taskCompleteds
)
{
o
.
setSerial
(
serial
);
}
for
(
Read
o
:
reads
)
{
o
.
setSerial
(
serial
);
}
for
(
ReadCompleted
o
:
readCompleteds
)
{
o
.
setSerial
(
serial
);
}
for
(
Review
o
:
reviews
)
{
o
.
setSerial
(
serial
);
}
}
}
void
updateData
(
Business
business
,
Work
work
,
JsonElement
jsonElement
,
String
...
paths
)
throws
Exception
{
void
updateData
(
Business
business
,
Work
work
,
JsonElement
jsonElement
,
String
...
paths
)
throws
Exception
{
JsonObject
jsonObject
=
jsonElement
.
getAsJsonObject
();
JsonObject
jsonObject
=
jsonElement
.
getAsJsonObject
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录