Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
eb38c349
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
eb38c349
编写于
7月 17, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加保存时进行映射功能
上级
ac5e19f7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
232 addition
and
32 deletion
+232
-32
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ProcessPlatform.java
.../java/com/x/base/core/project/config/ProcessPlatform.java
+35
-24
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/BaseAction.java
...essplatform/service/processing/jaxrs/data/BaseAction.java
+148
-8
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionDataNotExist.java
.../service/processing/jaxrs/data/ExceptionDataNotExist.java
+14
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionParentNotExist.java
...ervice/processing/jaxrs/data/ExceptionParentNotExist.java
+17
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionUnexpectedData.java
...ervice/processing/jaxrs/data/ExceptionUnexpectedData.java
+18
-0
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ProcessPlatform.java
浏览文件 @
eb38c349
...
...
@@ -2,6 +2,7 @@ package com.x.base.core.project.config;
import
java.io.File
;
import
org.apache.commons.collections4.Get
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -44,6 +45,8 @@ public class ProcessPlatform extends ConfigObject {
public
final
static
Boolean
DEFAULT_DELETEAPPLICATIONINUSE
=
false
;
public
final
static
Boolean
DEFAULT_UPDATEDATAPROJECTIONENABLE
=
false
;
public
static
ProcessPlatform
defaultInstance
()
{
return
new
ProcessPlatform
();
}
...
...
@@ -58,6 +61,7 @@ public class ProcessPlatform extends ConfigObject {
this
.
docToWordDefaultFileName
=
DEFAULT_DOCTOWORDDEFAULTFILENAME
;
this
.
docToWordDefaultSite
=
DEFAULT_DOCTOWORDDEFAULTSITE
;
this
.
executorCount
=
DEFAULT_EXECUTORCOUNT
;
this
.
updateDataProjectionEnable
=
DEFAULT_UPDATEDATAPROJECTIONENABLE
;
this
.
urge
=
new
Urge
();
this
.
expire
=
new
Expire
();
this
.
touchDelay
=
new
TouchDelay
();
...
...
@@ -68,30 +72,6 @@ public class ProcessPlatform extends ConfigObject {
}
@FieldDescribe
(
"维护身份,当工作发生意外错误,无法找到对应的处理人情况下,先尝试将工作分配给创建身份,如果创建身份也不可获取,那么分配给指定人员,默认情况下这个值为空."
)
private
String
maintenanceIdentity
;
@FieldDescribe
(
"表单历史版本保留数量,0为不保留."
)
private
Integer
formVersionCount
;
@FieldDescribe
(
"流程历史版本保留数量,0为不保留."
)
private
Integer
processVersionCount
;
@FieldDescribe
(
"脚本历史版本保留数量,0为不保留."
)
private
Integer
scriptVersionCount
;
@FieldDescribe
(
"HTML版式公文转换成Word文件方式,local,cloud."
)
private
String
docToWordType
;
@FieldDescribe
(
"HTML版式公文转换成Word文件缺省文件名."
)
private
String
docToWordDefaultFileName
;
@FieldDescribe
(
"HTML版式公文转换成Word文件缺省site."
)
private
String
docToWordDefaultSite
;
@FieldDescribe
(
"执行器数量"
)
private
Integer
executorCount
;
public
Integer
getExecutorCount
()
{
return
((
null
==
executorCount
)
||
(
executorCount
<
1
))
?
DEFAULT_EXECUTORCOUNT
:
this
.
executorCount
;
}
...
...
@@ -121,6 +101,37 @@ public class ProcessPlatform extends ConfigObject {
return
StringUtils
.
isEmpty
(
docToWordDefaultSite
)
?
DEFAULT_DOCTOWORDDEFAULTSITE
:
docToWordDefaultSite
;
}
public
Boolean
getUpdateDataProjectionEnable
()
{
return
BooleanUtils
.
isTrue
(
this
.
updateDataProjectionEnable
);
}
@FieldDescribe
(
"维护身份,当工作发生意外错误,无法找到对应的处理人情况下,先尝试将工作分配给创建身份,如果创建身份也不可获取,那么分配给指定人员,默认情况下这个值为空."
)
private
String
maintenanceIdentity
;
@FieldDescribe
(
"表单历史版本保留数量,0为不保留."
)
private
Integer
formVersionCount
;
@FieldDescribe
(
"流程历史版本保留数量,0为不保留."
)
private
Integer
processVersionCount
;
@FieldDescribe
(
"脚本历史版本保留数量,0为不保留."
)
private
Integer
scriptVersionCount
;
@FieldDescribe
(
"HTML版式公文转换成Word文件方式,local,cloud."
)
private
String
docToWordType
;
@FieldDescribe
(
"HTML版式公文转换成Word文件缺省文件名."
)
private
String
docToWordDefaultFileName
;
@FieldDescribe
(
"HTML版式公文转换成Word文件缺省site."
)
private
String
docToWordDefaultSite
;
@FieldDescribe
(
"执行器数量"
)
private
Integer
executorCount
;
@FieldDescribe
(
"更新data数据是否执行映射."
)
private
boolean
updateDataProjectionEnable
;
@FieldDescribe
(
"催办任务设置,发现即将过期时发送提醒消息."
)
private
Urge
urge
;
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/BaseAction.java
浏览文件 @
eb38c349
package
com.x.processplatform.service.processing.jaxrs.data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
com.google.gson.Gson
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonObject
;
import
com.google.gson.reflect.TypeToken
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.dataitem.DataItemConverter
;
import
com.x.base.core.entity.dataitem.ItemCategory
;
import
com.x.base.core.entity.dataitem.ItemType
;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
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.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Data
;
import
com.x.processplatform.core.entity.content.Data.DataWork
;
...
...
@@ -24,11 +29,20 @@ 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.WorkCompleted
;
import
com.x.processplatform.core.entity.element.Process
;
import
com.x.processplatform.core.entity.element.Projection
;
import
com.x.processplatform.core.entity.element.util.ProjectionFactory
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.query.core.entity.Item
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
@ActionLogger
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
BaseAction
.
class
);
protected
Gson
gson
=
XGsonBuilder
.
instance
();
JsonElement
getData
(
Business
business
,
String
job
,
String
...
paths
)
throws
Exception
{
...
...
@@ -150,6 +164,14 @@ abstract class BaseAction extends StandardJaxrsAction {
// 标记数据已经被修改
business
.
entityManagerContainer
().
beginTransaction
(
Work
.
class
);
work
.
setDataChanged
(
true
);
if
(
BooleanUtils
.
isTrue
(
Config
.
processPlatform
().
getUpdateDataProjectionEnable
()))
{
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
);
projection
(
business
,
work
,
XGsonBuilder
.
convert
(
jsonObject
,
Data
.
class
));
}
// 基于前面的原因,这里进行单独提交
business
.
entityManagerContainer
().
commit
();
}
...
...
@@ -181,6 +203,15 @@ abstract class BaseAction extends StandardJaxrsAction {
this
.
fill
(
_o
,
workCompleted
);
business
.
entityManagerContainer
().
persist
(
_o
);
}
if
(
BooleanUtils
.
isTrue
(
Config
.
processPlatform
().
getUpdateDataProjectionEnable
()))
{
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
);
projection
(
business
,
workCompleted
,
XGsonBuilder
.
convert
(
jsonObject
,
Data
.
class
));
}
// 基于前面的原因,这里进行单独提交
business
.
entityManagerContainer
().
commit
();
...
...
@@ -208,7 +239,7 @@ abstract class BaseAction extends StandardJaxrsAction {
Item
parent
=
business
.
item
().
getWithJobWithPath
(
work
.
getJob
(),
parentPaths
[
0
],
parentPaths
[
1
],
parentPaths
[
2
],
parentPaths
[
3
],
parentPaths
[
4
],
parentPaths
[
5
],
parentPaths
[
6
],
parentPaths
[
7
]);
if
(
null
==
parent
)
{
throw
new
Exception
(
"parent not existed."
);
throw
new
Exception
ParentNotExist
(
paths
);
}
Item
cursor
=
business
.
item
().
getWithJobWithPath
(
work
.
getJob
(),
cursorPaths
[
0
],
cursorPaths
[
1
],
cursorPaths
[
2
],
cursorPaths
[
3
],
cursorPaths
[
4
],
cursorPaths
[
5
],
cursorPaths
[
6
],
cursorPaths
[
7
]);
...
...
@@ -236,20 +267,26 @@ abstract class BaseAction extends StandardJaxrsAction {
business
.
entityManagerContainer
().
persist
(
o
);
}
}
else
{
throw
new
Exception
(
"unexpected post data with work"
+
work
+
".path:"
+
StringUtils
.
join
(
paths
,
"."
)
+
"json:"
+
jsonElement
);
throw
new
ExceptionUnexpectedData
(
work
.
getId
(),
paths
,
jsonElement
);
}
// 标记数据已经被修改
business
.
entityManagerContainer
().
beginTransaction
(
Work
.
class
);
work
.
setDataChanged
(
true
);
if
(
BooleanUtils
.
isTrue
(
Config
.
processPlatform
().
getUpdateDataProjectionEnable
()))
{
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
);
projection
(
business
,
work
,
XGsonBuilder
.
convert
(
jsonElement
,
Data
.
class
));
}
business
.
entityManagerContainer
().
commit
();
}
void
deleteData
(
Business
business
,
Work
work
,
String
...
paths
)
throws
Exception
{
List
<
Item
>
exists
=
business
.
item
().
listWithJobWithPath
(
work
.
getJob
(),
paths
);
if
(
exists
.
isEmpty
())
{
throw
new
Exception
(
"data{job:"
+
work
.
getJob
()
+
"} on path:"
+
StringUtils
.
join
(
paths
,
"."
)
+
" is not existed."
);
throw
new
ExceptionDataNotExist
(
work
.
getJob
(),
paths
);
}
business
.
entityManagerContainer
().
beginTransaction
(
Item
.
class
);
for
(
Item
o
:
exists
)
{
...
...
@@ -287,4 +324,107 @@ abstract class BaseAction extends StandardJaxrsAction {
Attachment
.
job_FIELDNAME
,
job
);
}
private
void
projection
(
Business
business
,
Work
work
,
Data
data
)
throws
Exception
{
Process
process
=
business
.
element
().
get
(
work
.
getProcess
(),
Process
.
class
);
if
(
null
!=
process
)
{
List
<
Projection
>
list
=
this
.
listProjection
(
process
);
if
(
ListTools
.
isNotEmpty
(
list
))
{
ProjectionFactory
.
projectionWork
(
list
,
data
,
work
);
business
.
entityManagerContainer
().
listEqualAndNotEqual
(
Work
.
class
,
Work
.
job_FIELDNAME
,
work
.
getJob
(),
JpaObject
.
id_FIELDNAME
,
work
.
getId
()).
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionWork
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
projectionTask
(
business
,
work
.
getJob
(),
data
,
list
);
projectionTaskCompleted
(
business
,
work
.
getJob
(),
data
,
list
);
projectionRead
(
business
,
work
.
getJob
(),
data
,
list
);
projectionReadCompleted
(
business
,
work
.
getJob
(),
data
,
list
);
projectionReview
(
business
,
work
.
getJob
(),
data
,
list
);
}
}
}
private
void
projection
(
Business
business
,
WorkCompleted
workCompleted
,
Data
data
)
throws
Exception
{
Process
process
=
business
.
element
().
get
(
workCompleted
.
getProcess
(),
Process
.
class
);
if
(
null
!=
process
)
{
List
<
Projection
>
list
=
this
.
listProjection
(
process
);
if
(
ListTools
.
isNotEmpty
(
list
))
{
ProjectionFactory
.
projectionWorkCompleted
(
list
,
data
,
workCompleted
);
projectionTaskCompleted
(
business
,
workCompleted
.
getJob
(),
data
,
list
);
projectionRead
(
business
,
workCompleted
.
getJob
(),
data
,
list
);
projectionReadCompleted
(
business
,
workCompleted
.
getJob
(),
data
,
list
);
projectionReview
(
business
,
workCompleted
.
getJob
(),
data
,
list
);
}
}
}
private
void
projectionTask
(
Business
business
,
String
job
,
Data
data
,
List
<
Projection
>
list
)
throws
Exception
{
business
.
entityManagerContainer
().
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
).
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionTask
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
private
void
projectionTaskCompleted
(
Business
business
,
String
job
,
Data
data
,
List
<
Projection
>
list
)
throws
Exception
{
business
.
entityManagerContainer
().
listEqual
(
TaskCompleted
.
class
,
TaskCompleted
.
job_FIELDNAME
,
job
)
.
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionTaskCompleted
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
private
void
projectionRead
(
Business
business
,
String
job
,
Data
data
,
List
<
Projection
>
list
)
throws
Exception
{
business
.
entityManagerContainer
().
listEqual
(
Read
.
class
,
Read
.
job_FIELDNAME
,
job
).
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionRead
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
private
void
projectionReadCompleted
(
Business
business
,
String
job
,
Data
data
,
List
<
Projection
>
list
)
throws
Exception
{
business
.
entityManagerContainer
().
listEqual
(
ReadCompleted
.
class
,
ReadCompleted
.
job_FIELDNAME
,
job
)
.
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionReadCompleted
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
private
void
projectionReview
(
Business
business
,
String
job
,
Data
data
,
List
<
Projection
>
list
)
throws
Exception
{
business
.
entityManagerContainer
().
listEqual
(
Review
.
class
,
Review
.
job_FIELDNAME
,
job
).
forEach
(
o
->
{
try
{
ProjectionFactory
.
projectionReview
(
list
,
data
,
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
public
List
<
Projection
>
listProjection
(
Process
process
)
{
List
<
Projection
>
list
=
new
ArrayList
<>();
String
text
=
process
.
getProjection
();
if
(
XGsonBuilder
.
isJsonArray
(
text
))
{
list
=
XGsonBuilder
.
instance
().
fromJson
(
text
,
new
TypeToken
<
List
<
Projection
>>()
{
}.
getType
());
}
return
list
;
}
}
\ No newline at end of file
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionDataNotExist.java
0 → 100644
浏览文件 @
eb38c349
package
com.x.processplatform.service.processing.jaxrs.data
;
import
com.x.base.core.project.exception.PromptException
;
import
org.apache.commons.lang3.StringUtils
;
class
ExceptionDataNotExist
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
665095222445791960L
;
ExceptionDataNotExist
(
String
job
,
String
[]
paths
)
{
super
(
"data not exist job: {}, path: {}."
,
job
,
StringUtils
.
join
(
paths
,
"."
));
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionParentNotExist.java
0 → 100644
浏览文件 @
eb38c349
package
com.x.processplatform.service.processing.jaxrs.data
;
import
java.util.Objects
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.exception.PromptException
;
import
org.apache.commons.lang3.StringUtils
;
class
ExceptionParentNotExist
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
665095222445791960L
;
ExceptionParentNotExist
(
String
[]
paths
)
{
super
(
"parent not exist: {}."
,
StringUtils
.
join
(
paths
,
"."
));
}
}
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/data/ExceptionUnexpectedData.java
0 → 100644
浏览文件 @
eb38c349
package
com.x.processplatform.service.processing.jaxrs.data
;
import
java.util.Objects
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.exception.PromptException
;
import
org.apache.commons.lang3.StringUtils
;
class
ExceptionUnexpectedData
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
665095222445791960L
;
ExceptionUnexpectedData
(
String
work
,
String
[]
paths
,
JsonElement
jsonElement
)
{
super
(
"unexpected post data with work :{}, path :{}, json :{}."
,
work
,
StringUtils
.
join
(
paths
,
"."
),
Objects
.
toString
(
jsonElement
,
""
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录