Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
ca685121
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,发现更多精彩内容 >>
提交
ca685121
编写于
9月 03, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
form add list
上级
65f6204f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
426 addition
and
280 deletion
+426
-280
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
.../surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
+178
-31
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
...ce/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
+179
-32
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetWithWorkOrWorkCompleted.java
...mble/surface/jaxrs/form/V2GetWithWorkOrWorkCompleted.java
+0
-210
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java
...platform/core/entity/content/WorkCompletedProperties.java
+22
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Form.java
.../java/com/x/processplatform/core/entity/element/Form.java
+47
-7
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
ca685121
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
com.x.base.core.project.logger.Audit
;
import
java.util.HashMap
;
import
java.util.Map
;
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.entity.JpaObject
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Audit
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.PropertyTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
class
ActionGetWithWorkOrWorkCompleted
extends
BaseAction
{
...
...
@@ -55,8 +55,8 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
}
}
private
Wo
WorkForm
work
(
Business
business
,
Work
work
)
throws
Exception
{
Wo
WorkForm
wo
=
new
WoWorkForm
();
private
Wo
work
(
Business
business
,
Work
work
)
throws
Exception
{
Wo
wo
=
new
Wo
();
String
id
=
work
.
getForm
();
if
(
StringUtils
.
isEmpty
(
id
))
{
Activity
activity
=
business
.
getActivity
(
work
);
...
...
@@ -65,50 +65,123 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
if
(
StringUtils
.
isNotEmpty
(
id
))
{
Form
form
=
business
.
form
().
pick
(
id
);
if
(
null
!=
form
)
{
wo
=
WoWorkForm
.
copier
.
copy
(
form
);
if
(
StringUtils
.
isEmpty
(
wo
.
getData
())
&&
StringUtils
.
isNotEmpty
(
wo
.
getMobileData
()))
{
wo
.
setData
(
wo
.
getMobileData
());
}
/* 清空移动端表单,减少传输量 */
wo
.
setMobileData
(
""
);
wo
.
setForm
(
toWoForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
return
wo
;
}
private
WoWorkCompletedForm
workCompleted
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
WoWorkCompletedForm
wo
=
new
WoWorkCompletedForm
();
/* 先使用当前库的表单,如果不存在使用储存的表单. */
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getData
()))
{
for
(
String
relatedFormId
:
form
.
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoForm
(
relatedForm
));
}
}
}
else
{
for
(
String
relatedFormId
:
form
.
getMobileRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoMobileForm
(
relatedForm
));
}
}
}
for
(
String
relatedScriptId
:
form
.
getRelatedScriptList
())
{
Script
relatedScript
=
business
.
script
().
pick
(
relatedScriptId
);
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
relatedScriptId
,
toWoScript
(
relatedScript
));
}
}
}
private
Wo
workCompleted
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
Wo
wo
=
new
Wo
();
// 先使用当前库的表单,如果不存在使用储存的表单.
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getForm
()))
{
Form
form
=
business
.
form
().
pick
(
workCompleted
.
getForm
());
if
(
null
!=
form
)
{
if
(
StringUtils
.
isNotEmpty
(
form
.
getData
()))
{
wo
.
setData
(
form
.
getData
());
}
else
if
(
StringUtils
.
isNotEmpty
(
form
.
getMobileData
()))
{
wo
.
setData
(
workCompleted
.
getFormMobileData
());
wo
.
setForm
(
toWoForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
else
{
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
wo
.
form
=
toWoForm
(
workCompleted
.
getProperties
().
getForm
());
}
if
(
StringUtils
.
isNotBlank
(
workCompleted
.
getProperties
().
getForm
().
getData
()))
{
for
(
Form
f
:
workCompleted
.
getProperties
().
getRelatedFormList
())
{
wo
.
getRelatedFormMap
().
put
(
f
.
getId
(),
toWoForm
(
f
));
}
}
else
{
for
(
Form
f
:
workCompleted
.
getProperties
().
getRelatedFormList
())
{
wo
.
getRelatedFormMap
().
put
(
f
.
getId
(),
toWoMobileForm
(
f
));
}
}
}
else
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getFormData
()))
{
wo
.
setData
(
workCompleted
.
getFormData
());
}
else
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getFormMobileData
()))
{
wo
.
setData
(
workCompleted
.
getFormMobileData
());
for
(
Script
s
:
workCompleted
.
getProperties
().
getRelatedScriptList
())
{
wo
.
getRelatedScriptMap
().
put
(
s
.
getId
(),
toWoScript
(
s
));
}
}
return
wo
;
}
public
static
class
WoWorkForm
extends
Form
{
private
static
final
long
serialVersionUID
=
1303951663975390089L
;
static
WrapCopier
<
Form
,
WoWorkForm
>
copier
=
WrapCopierFactory
.
wo
(
Form
.
class
,
WoWorkForm
.
class
,
null
,
ListTools
.
toList
(
JpaObject
.
FieldsInvisible
));
private
WoForm
toWoForm
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setData
(
form
.
getDataOrMobileData
());
return
wo
;
}
private
WoForm
toWoMobileForm
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setData
(
form
.
getMobileDataOrData
());
return
wo
;
}
public
static
class
WoWorkCompletedForm
extends
GsonPropertyObject
{
private
WoScript
toWoScript
(
Script
script
)
{
WoScript
wo
=
new
WoScript
();
wo
.
setId
(
script
.
getId
());
wo
.
setName
(
script
.
getName
());
wo
.
setAlias
(
script
.
getAlias
());
wo
.
setText
(
script
.
getText
());
return
wo
;
}
public
static
class
WoForm
extends
GsonPropertyObject
{
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
data
;
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getData
()
{
return
data
;
}
...
...
@@ -116,6 +189,80 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
public
static
class
WoScript
extends
GsonPropertyObject
{
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
text
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
WoForm
form
;
private
Map
<
String
,
WoForm
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
WoScript
>
relatedScriptMap
=
new
HashMap
<>();
public
WoForm
getForm
()
{
return
form
;
}
public
void
setForm
(
WoForm
form
)
{
this
.
form
=
form
;
}
public
Map
<
String
,
WoForm
>
getRelatedFormMap
()
{
return
relatedFormMap
;
}
public
void
setRelatedFormMap
(
Map
<
String
,
WoForm
>
relatedFormMap
)
{
this
.
relatedFormMap
=
relatedFormMap
;
}
public
Map
<
String
,
WoScript
>
getRelatedScriptMap
()
{
return
relatedScriptMap
;
}
public
void
setRelatedScriptMap
(
Map
<
String
,
WoScript
>
relatedScriptMap
)
{
this
.
relatedScriptMap
=
relatedScriptMap
;
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
浏览文件 @
ca685121
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
com.x.base.core.project.logger.Audit
;
import
java.util.HashMap
;
import
java.util.Map
;
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.entity.JpaObject
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Audit
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.PropertyTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.form.ActionGetWithWorkOrWorkCompleted.WoWorkCompletedForm
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
class
ActionGetWithWorkOrWorkCompletedMobile
extends
BaseAction
{
...
...
@@ -56,8 +55,8 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
}
}
private
Wo
WorkForm
work
(
Business
business
,
Work
work
)
throws
Exception
{
Wo
WorkForm
wo
=
new
WoWorkForm
();
private
Wo
work
(
Business
business
,
Work
work
)
throws
Exception
{
Wo
wo
=
new
Wo
();
String
id
=
work
.
getForm
();
if
(
StringUtils
.
isEmpty
(
id
))
{
Activity
activity
=
business
.
getActivity
(
work
);
...
...
@@ -66,49 +65,123 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
if
(
StringUtils
.
isNotEmpty
(
id
))
{
Form
form
=
business
.
form
().
pick
(
id
);
if
(
null
!=
form
)
{
wo
=
WoWorkForm
.
copier
.
copy
(
form
);
if
(
StringUtils
.
isNotEmpty
(
wo
.
getMobileData
()))
{
wo
.
setData
(
wo
.
getMobileData
());
}
/* 清空移动端表单,减少传输量 */
wo
.
setMobileData
(
""
);
wo
.
setForm
(
toWoMobileForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
return
wo
;
}
private
WoWorkCompletedForm
workCompleted
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
WoWorkCompletedForm
wo
=
new
WoWorkCompletedForm
();
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getFormMobileData
()))
{
wo
.
setData
(
workCompleted
.
getFormMobileData
());
}
else
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getFormData
()))
{
wo
.
setData
(
workCompleted
.
getFormData
());
}
else
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getForm
()))
{
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getMobileData
()))
{
for
(
String
relatedFormId
:
form
.
getMobileRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoMobileForm
(
relatedForm
));
}
}
}
else
{
for
(
String
relatedFormId
:
form
.
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoForm
(
relatedForm
));
}
}
}
for
(
String
relatedScriptId
:
form
.
getRelatedScriptList
())
{
Script
relatedScript
=
business
.
script
().
pick
(
relatedScriptId
);
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
relatedScriptId
,
toWoScript
(
relatedScript
));
}
}
}
private
Wo
workCompleted
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
Wo
wo
=
new
Wo
();
// 先使用当前库的表单,如果不存在使用储存的表单.
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getForm
()))
{
Form
form
=
business
.
form
().
pick
(
workCompleted
.
getForm
());
if
(
null
!=
form
)
{
if
(
StringUtils
.
isNotEmpty
(
form
.
getMobileData
()))
{
wo
.
setData
(
form
.
getMobileData
());
}
else
if
(
StringUtils
.
isNotEmpty
(
form
.
getData
()))
{
wo
.
setData
(
workCompleted
.
getFormData
());
wo
.
setForm
(
toWoMobileForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
else
{
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
wo
.
form
=
toWoMobileForm
(
workCompleted
.
getProperties
().
getForm
());
}
if
(
StringUtils
.
isNotBlank
(
workCompleted
.
getProperties
().
getForm
().
getMobileData
()))
{
for
(
Form
f
:
workCompleted
.
getProperties
().
getMobileRelatedFormList
())
{
wo
.
getRelatedFormMap
().
put
(
f
.
getId
(),
toWoMobileForm
(
f
));
}
}
else
{
for
(
Form
f
:
workCompleted
.
getProperties
().
getRelatedFormList
())
{
wo
.
getRelatedFormMap
().
put
(
f
.
getId
(),
toWoForm
(
f
));
}
}
for
(
Script
s
:
workCompleted
.
getProperties
().
getRelatedScriptList
())
{
wo
.
getRelatedScriptMap
().
put
(
s
.
getId
(),
toWoScript
(
s
));
}
}
return
wo
;
}
public
static
class
WoWorkForm
extends
Form
{
private
static
final
long
serialVersionUID
=
1303951663975390089L
;
static
WrapCopier
<
Form
,
WoWorkForm
>
copier
=
WrapCopierFactory
.
wo
(
Form
.
class
,
WoWorkForm
.
class
,
null
,
ListTools
.
toList
(
JpaObject
.
FieldsInvisible
));
private
WoForm
toWoForm
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setData
(
form
.
getDataOrMobileData
());
return
wo
;
}
private
WoForm
toWoMobileForm
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setData
(
form
.
getMobileDataOrData
());
return
wo
;
}
public
static
class
WoWorkCompletedForm
extends
GsonPropertyObject
{
private
WoScript
toWoScript
(
Script
script
)
{
WoScript
wo
=
new
WoScript
();
wo
.
setId
(
script
.
getId
());
wo
.
setName
(
script
.
getName
());
wo
.
setAlias
(
script
.
getAlias
());
wo
.
setText
(
script
.
getText
());
return
wo
;
}
public
static
class
WoForm
extends
GsonPropertyObject
{
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
data
;
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getData
()
{
return
data
;
}
...
...
@@ -116,6 +189,80 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
public
static
class
WoScript
extends
GsonPropertyObject
{
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
text
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
WoForm
form
;
private
Map
<
String
,
WoForm
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
WoScript
>
relatedScriptMap
=
new
HashMap
<>();
public
WoForm
getForm
()
{
return
form
;
}
public
void
setForm
(
WoForm
form
)
{
this
.
form
=
form
;
}
public
Map
<
String
,
WoForm
>
getRelatedFormMap
()
{
return
relatedFormMap
;
}
public
void
setRelatedFormMap
(
Map
<
String
,
WoForm
>
relatedFormMap
)
{
this
.
relatedFormMap
=
relatedFormMap
;
}
public
Map
<
String
,
WoScript
>
getRelatedScriptMap
()
{
return
relatedScriptMap
;
}
public
void
setRelatedScriptMap
(
Map
<
String
,
WoScript
>
relatedScriptMap
)
{
this
.
relatedScriptMap
=
relatedScriptMap
;
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetWithWorkOrWorkCompleted.java
已删除
100644 → 0
浏览文件 @
65f6204f
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Optional
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.PropertyTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
import
net.sf.ehcache.Element
;
class
V2GetWithWorkOrWorkCompleted
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
V2GetWithWorkOrWorkCompleted
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
Wo
wo
=
null
;
CacheCategory
cacheCategory
=
new
CacheCategory
(
Form
.
class
,
Script
.
class
);
CacheKey
cacheKey
=
new
CacheKey
(
this
.
getClass
(),
workOrWorkCompleted
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
wo
=
(
Wo
)
optional
.
get
();
}
else
{
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
if
(
null
!=
work
)
{
wo
=
this
.
work
(
business
,
work
);
}
else
{
wo
=
this
.
workCompleted
(
business
,
emc
.
flag
(
workOrWorkCompleted
,
WorkCompleted
.
class
));
}
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wo
);
result
.
setData
(
wo
);
}
return
result
;
}
}
private
Wo
work
(
Business
business
,
Work
work
)
throws
Exception
{
Wo
wo
=
new
Wo
();
String
id
=
work
.
getForm
();
if
(
StringUtils
.
isEmpty
(
id
))
{
Activity
activity
=
business
.
getActivity
(
work
);
id
=
PropertyTools
.
getOrElse
(
activity
,
Activity
.
form_FIELDNAME
,
String
.
class
,
""
);
}
if
(
StringUtils
.
isNotEmpty
(
id
))
{
Form
form
=
business
.
form
().
pick
(
id
);
if
(
null
!=
form
)
{
wo
.
setForm
(
toWoForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
return
wo
;
}
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
for
(
String
relatedFormId
:
form
.
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoForm
(
relatedForm
));
}
}
for
(
String
relatedScriptId
:
form
.
getRelatedScriptList
())
{
Script
relatedScript
=
business
.
script
().
pick
(
relatedScriptId
);
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
relatedScriptId
,
toWoScript
(
relatedScript
));
}
}
}
private
Wo
workCompleted
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
Wo
wo
=
new
Wo
();
// 先使用当前库的表单,如果不存在使用储存的表单.
if
(
StringUtils
.
isNotEmpty
(
workCompleted
.
getForm
()))
{
Form
form
=
business
.
form
().
pick
(
workCompleted
.
getForm
());
if
(
null
!=
form
)
{
wo
.
setForm
(
toWoForm
(
form
));
related
(
business
,
wo
,
form
);
}
}
else
{
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
wo
.
form
=
toWoForm
(
workCompleted
.
getProperties
().
getForm
());
}
for
(
Form
f
:
workCompleted
.
getProperties
().
getRelatedFormList
())
{
wo
.
getRelatedFormMap
().
put
(
f
.
getId
(),
toWoForm
(
f
));
}
for
(
Script
s
:
workCompleted
.
getProperties
().
getRelatedScriptList
())
{
wo
.
getRelatedScriptMap
().
put
(
s
.
getId
(),
toWoScript
(
s
));
}
}
return
wo
;
}
private
WoForm
toWoForm
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setData
(
form
.
getDataOrMobileData
());
return
wo
;
}
private
WoScript
toWoScript
(
Script
script
)
{
WoScript
wo
=
new
WoScript
();
wo
.
setId
(
script
.
getId
());
wo
.
setText
(
script
.
getText
());
return
wo
;
}
public
static
class
WoForm
extends
GsonPropertyObject
{
private
String
id
;
private
String
data
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
public
static
class
WoScript
extends
GsonPropertyObject
{
private
String
id
;
private
String
text
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
WoForm
form
;
private
Map
<
String
,
WoForm
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
WoScript
>
relatedScriptMap
=
new
HashMap
<>();
public
WoForm
getForm
()
{
return
form
;
}
public
void
setForm
(
WoForm
form
)
{
this
.
form
=
form
;
}
public
Map
<
String
,
WoForm
>
getRelatedFormMap
()
{
return
relatedFormMap
;
}
public
void
setRelatedFormMap
(
Map
<
String
,
WoForm
>
relatedFormMap
)
{
this
.
relatedFormMap
=
relatedFormMap
;
}
public
Map
<
String
,
WoScript
>
getRelatedScriptMap
()
{
return
relatedScriptMap
;
}
public
void
setRelatedScriptMap
(
Map
<
String
,
WoScript
>
relatedScriptMap
)
{
this
.
relatedScriptMap
=
relatedScriptMap
;
}
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java
浏览文件 @
ca685121
...
...
@@ -28,6 +28,12 @@ public class WorkCompletedProperties extends JsonProperties {
@FieldDescribe
(
"合并工作relatedScriptList"
)
private
List
<
Script
>
relatedScriptList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作mobileRelatedFormList"
)
private
List
<
Form
>
mobileRelatedFormList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作relatedScriptList"
)
private
List
<
Script
>
mobileRelatedScriptList
=
new
ArrayList
<>();
@FieldDescribe
(
"标题"
)
private
String
title
;
...
...
@@ -87,4 +93,20 @@ public class WorkCompletedProperties extends JsonProperties {
this
.
relatedScriptList
=
relatedScriptList
;
}
public
List
<
Form
>
getMobileRelatedFormList
()
{
return
mobileRelatedFormList
;
}
public
void
setMobileRelatedFormList
(
List
<
Form
>
mobileRelatedFormList
)
{
this
.
mobileRelatedFormList
=
mobileRelatedFormList
;
}
public
List
<
Script
>
getMobileRelatedScriptList
()
{
return
mobileRelatedScriptList
;
}
public
void
setMobileRelatedScriptList
(
List
<
Script
>
mobileRelatedScriptList
)
{
this
.
mobileRelatedScriptList
=
mobileRelatedScriptList
;
}
}
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Form.java
浏览文件 @
ca685121
...
...
@@ -16,6 +16,13 @@ import javax.persistence.OrderColumn;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.openjpa.persistence.PersistentCollection
;
import
org.apache.openjpa.persistence.jdbc.ContainerTable
;
import
org.apache.openjpa.persistence.jdbc.ElementColumn
;
import
org.apache.openjpa.persistence.jdbc.ElementIndex
;
import
org.apache.openjpa.persistence.jdbc.Index
;
import
com.x.base.core.entity.AbstractPersistenceProperties
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.SliceJpaObject
;
...
...
@@ -31,13 +38,6 @@ import com.x.base.core.entity.annotation.RestrictFlag;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.processplatform.core.entity.PersistenceProperties
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.openjpa.persistence.PersistentCollection
;
import
org.apache.openjpa.persistence.jdbc.ContainerTable
;
import
org.apache.openjpa.persistence.jdbc.ElementColumn
;
import
org.apache.openjpa.persistence.jdbc.ElementIndex
;
import
org.apache.openjpa.persistence.jdbc.Index
;
@Entity
@ContainerEntity
(
dumpSize
=
5
,
type
=
ContainerEntity
.
Type
.
element
,
reference
=
ContainerEntity
.
Reference
.
strong
)
@Table
(
name
=
PersistenceProperties
.
Element
.
Form
.
table
,
uniqueConstraints
=
{
...
...
@@ -229,6 +229,46 @@ public class Form extends SliceJpaObject {
@CheckPersist
(
allowEmpty
=
true
)
private
List
<
String
>
relatedScriptList
;
public
static
final
String
mobileRelatedFormList_FIELDNAME
=
"mobileRelatedFormList"
;
@FieldDescribe
(
"关联移动表单."
)
@PersistentCollection
(
fetch
=
FetchType
.
EAGER
)
@ContainerTable
(
name
=
TABLE
+
ContainerTableNameMiddle
+
mobileRelatedFormList_FIELDNAME
,
joinIndex
=
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
mobileRelatedFormList_FIELDNAME
+
JoinIndexNameSuffix
))
@OrderColumn
(
name
=
ORDERCOLUMNCOLUMN
)
@ElementColumn
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
mobileRelatedFormList_FIELDNAME
)
@ElementIndex
(
name
=
TABLE
+
IndexNameMiddle
+
mobileRelatedFormList_FIELDNAME
+
ElementIndexNameSuffix
)
@CheckPersist
(
allowEmpty
=
true
)
private
List
<
String
>
mobileRelatedFormList
;
public
static
final
String
mobileRelatedScriptList_FIELDNAME
=
"mobileRelatedScriptList"
;
@FieldDescribe
(
"关联移动脚本."
)
@PersistentCollection
(
fetch
=
FetchType
.
EAGER
)
@ContainerTable
(
name
=
TABLE
+
ContainerTableNameMiddle
+
mobileRelatedScriptList_FIELDNAME
,
joinIndex
=
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
mobileRelatedScriptList_FIELDNAME
+
JoinIndexNameSuffix
))
@OrderColumn
(
name
=
ORDERCOLUMNCOLUMN
)
@ElementColumn
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
mobileRelatedScriptList_FIELDNAME
)
@ElementIndex
(
name
=
TABLE
+
IndexNameMiddle
+
mobileRelatedScriptList_FIELDNAME
+
ElementIndexNameSuffix
)
@CheckPersist
(
allowEmpty
=
true
)
private
List
<
String
>
mobileRelatedScriptList
;
public
List
<
String
>
getMobileRelatedFormList
()
{
return
mobileRelatedFormList
;
}
public
void
setMobileRelatedFormList
(
List
<
String
>
mobileRelatedFormList
)
{
this
.
mobileRelatedFormList
=
mobileRelatedFormList
;
}
public
List
<
String
>
getMobileRelatedScriptList
()
{
return
mobileRelatedScriptList
;
}
public
void
setMobileRelatedScriptList
(
List
<
String
>
mobileRelatedScriptList
)
{
this
.
mobileRelatedScriptList
=
mobileRelatedScriptList
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录