Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
9b3882d3
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,发现更多精彩内容 >>
提交
9b3882d3
编写于
11月 03, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加sftp支持
上级
010d5d12
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
1312 addition
and
1101 deletion
+1312
-1101
o2server/configSample/vfs.json
o2server/configSample/vfs.json
+3
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
...t/src/main/java/com/x/base/core/entity/StorageObject.java
+21
-67
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java
...src/main/java/com/x/base/core/entity/StorageProtocol.java
+2
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java
.../src/main/java/com/x/base/core/project/config/Config.java
+17
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Vfs.java
...ect/src/main/java/com/x/base/core/project/config/Vfs.java
+20
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java
...se/core/project/x_processplatform_service_processing.java
+3
-1
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java
.../java/com/x/server/console/server/web/WebServerTools.java
+10
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java
...rocessplatform/assemble/surface/jaxrs/form/ActionGet.java
+43
-43
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java
...platform/assemble/surface/jaxrs/form/ActionGetMobile.java
+43
-43
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java
...assemble/surface/jaxrs/form/ActionGetWithApplication.java
+51
-51
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java
...le/surface/jaxrs/form/ActionGetWithApplicationMobile.java
+49
-49
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
.../surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
+164
-164
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
...ce/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
+162
-162
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java
...ocessplatform/assemble/surface/jaxrs/form/BaseAction.java
+15
-192
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java
...ocessplatform/assemble/surface/jaxrs/form/FormAction.java
+119
-100
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java
.../x/processplatform/assemble/surface/jaxrs/form/V2Get.java
+73
-50
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java
...cessplatform/assemble/surface/jaxrs/form/V2GetMobile.java
+73
-59
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java
...emble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java
+14
-4
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java
...surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java
+18
-5
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java
...platform/core/entity/content/WorkCompletedProperties.java
+138
-103
o2server/x_processplatform_service_processing/pom.xml
o2server/x_processplatform_service_processing/pom.xml
+4
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/workcompleted/ActionMerge.java
...m/service/processing/jaxrs/workcompleted/ActionMerge.java
+138
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/end/EndProcessor.java
...atform/service/processing/processor/end/EndProcessor.java
+131
-5
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/SelectEntries.java
...ain/java/com/x/query/core/express/plan/SelectEntries.java
+1
-1
未找到文件。
o2server/configSample/vfs.json
浏览文件 @
9b3882d3
...
...
@@ -4,5 +4,8 @@
},
"ftps"
:
{
"passive"
:
true
},
"sftp"
:
{
"passive"
:
true
}
}
\ No newline at end of file
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
浏览文件 @
9b3882d3
...
...
@@ -117,14 +117,6 @@ public abstract class StorageObject extends SliceJpaObject {
return
this
.
updateContent
(
mapping
,
input
);
}
// /** 更新Content内容 */
// public Long updateContent(StorageMapping mapping, byte[] bytes) throws
// Exception {
// try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
// return updateContent(mapping, bais);
// }
// }
/** 更新Content内容 */
public
Long
updateContent
(
StorageMapping
mapping
,
byte
[]
bytes
,
String
name
)
throws
Exception
{
try
(
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
bytes
))
{
...
...
@@ -148,64 +140,6 @@ public abstract class StorageObject extends SliceJpaObject {
/** 更新Content内容 */
public
Long
updateContent
(
StorageMapping
mapping
,
InputStream
input
)
throws
Exception
{
return
updateContent
(
mapping
,
IOUtils
.
toByteArray
(
input
));
// long length = -1L;
// FileSystemManager manager = this.getFileSystemManager();
// String prefix = this.getPrefix(mapping);
// String path = this.path();
// if (StringUtils.isEmpty(path)) {
// throw new Exception("path can not be empty.");
// }
// FileSystemOptions options = this.getOptions(mapping);
// try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
// /* 由于可以在传输过程中取消传输,先拷贝到内存 */
// IOUtils.copyLarge(input, baos);
// FileObject fo = null;
// OutputStream output = null;
// try {
// /*
// * 需要进行两次判断,在前端使用nginx分发的情况下,可能同时触发多个文件的上传,多个文件同时上传可能会同时创建文件的存储目录,会在后台导致错误
// * org.apache.commons.vfs2.FileSystemException: Could not create folder
// *
// "ftp://processPlatform:***@o2.server01.com:20040/20200601/1beb018a-5009-4baa-a9ef-7e903f9d48ef".
// * 这种情况下再次发起请求尝试获取文件可以解决这个问题.
// */
// try {
// fo = manager.resolveFile(prefix + PATHSEPARATOR + path, options);
// output = fo.getContent().getOutputStream();
// } catch (FileSystemException fse) {
// // 此段代码全部关闭对象,并要进行webdav判断进行关闭。
// if (null != output) {
// output.close();
// }
// if (null != fo) {
// if (!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) {
// /* webdav关闭会试图去关闭commons.httpClient */
// manager.closeFileSystem(fo.getFileSystem());
// }
// fo.close();
// }
// fo = manager.resolveFile(prefix + PATHSEPARATOR + path, options);
// output = fo.getContent().getOutputStream();
// }
// length = IOUtils.copyLarge(new ByteArrayInputStream(baos.toByteArray()),
// output);
// this.setLength(length);
// if (!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) {
// /* webdav关闭会试图去关闭commons.httpClient */
// manager.closeFileSystem(fo.getFileSystem());
// }
// } finally {
// if (null != output) {
// output.close();
// }
// if (null != fo) {
// fo.close();
// }
// }
// }
// this.setStorage(mapping.getName());
// this.setLastUpdateTime(new Date());
// return length;
}
/** 更新Content内容 */
...
...
@@ -229,7 +163,8 @@ public abstract class StorageObject extends SliceJpaObject {
OutputStream
output
=
fo
.
getContent
().
getOutputStream
())
{
length
=
IOUtils
.
copyLarge
(
new
ByteArrayInputStream
(
bytes
),
output
);
this
.
setLength
(
length
);
if
(!
Objects
.
equals
(
StorageProtocol
.
webdav
,
mapping
.
getProtocol
()))
{
if
((!
Objects
.
equals
(
StorageProtocol
.
webdav
,
mapping
.
getProtocol
()))
&&
(!
Objects
.
equals
(
StorageProtocol
.
sftp
,
mapping
.
getProtocol
())))
{
/* webdav关闭会试图去关闭commons.httpClient */
manager
.
closeFileSystem
(
fo
.
getFileSystem
());
}
...
...
@@ -339,6 +274,12 @@ public abstract class StorageObject extends SliceJpaObject {
+
URLEncoder
.
encode
(
mapping
.
getPassword
(),
DefaultCharset
.
name
)
+
"@"
+
mapping
.
getHost
()
+
":"
+
mapping
.
getPort
();
break
;
case
sftp:
// ftps://[ username[: password]@] hostname[: port][ relative-path]
prefix
=
"sftp://"
+
URLEncoder
.
encode
(
mapping
.
getUsername
(),
DefaultCharset
.
name
)
+
":"
+
URLEncoder
.
encode
(
mapping
.
getPassword
(),
DefaultCharset
.
name
)
+
"@"
+
mapping
.
getHost
()
+
":"
+
mapping
.
getPort
();
break
;
case
cifs:
// smb://[ username[: password]@] hostname[: port][ absolute-path]
prefix
=
"smb://"
+
URLEncoder
.
encode
(
mapping
.
getUsername
(),
DefaultCharset
.
name
)
+
":"
...
...
@@ -369,6 +310,19 @@ public abstract class StorageObject extends SliceJpaObject {
switch
(
mapping
.
getProtocol
())
{
// bzip2,file, ftp, ftps, gzip, hdfs, http, https, jar, ram, res, sftp,
// tar, temp, webdav, zip, cifs, mime;
case
sftp:
FtpFileSystemConfigBuilder
sftpBuilder
=
FtpFileSystemConfigBuilder
.
getInstance
();
sftpBuilder
.
setPassiveMode
(
opts
,
Config
.
vfs
().
getSftp
().
getPassive
());
/** 强制不校验IP */
sftpBuilder
.
setRemoteVerification
(
opts
,
false
);
sftpBuilder
.
setFileType
(
opts
,
FtpFileType
.
BINARY
);
sftpBuilder
.
setConnectTimeout
(
opts
,
10000
);
sftpBuilder
.
setSoTimeout
(
opts
,
10000
);
sftpBuilder
.
setControlEncoding
(
opts
,
DefaultCharset
.
name
);
// By default, the path is relative to the user's home directory. This can be
// changed with:
sftpBuilder
.
setUserDirIsRoot
(
opts
,
false
);
break
;
case
ftp:
FtpFileSystemConfigBuilder
ftpBuilder
=
FtpFileSystemConfigBuilder
.
getInstance
();
/*
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java
浏览文件 @
9b3882d3
package
com.x.base.core.entity
;
public
enum
StorageProtocol
{
ftp
,
ftps
,
webdav
,
cifs
,
file
;
ftp
,
ftps
,
webdav
,
cifs
,
file
,
sftp
;
public
static
final
int
length
=
JpaObject
.
length_16B
;
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java
浏览文件 @
9b3882d3
...
...
@@ -88,6 +88,7 @@ public class Config {
public
static
final
String
DIR_COMMONS_TESS4J_TESSDATA
=
"commons/tess4j/tessdata"
;
public
static
final
String
DIR_COMMONS_EXT
=
"commons/ext"
;
public
static
final
String
DIR_CONFIG
=
"config"
;
public
static
final
String
DIR_CONFIG_COVERTOWEBSERVER
=
"config/coverToWebServer"
;
public
static
final
String
DIR_CONFIGSAMPLE
=
"configSample"
;
public
static
final
String
DIR_CUSTOM
=
"custom"
;
public
static
final
String
DIR_CUSTOM_JARS
=
"custom/jars"
;
...
...
@@ -470,6 +471,22 @@ public class Config {
return
path
;
}
public
static
Path
path_config_coverToWebServer
(
Boolean
force
)
throws
Exception
{
Path
path
=
Paths
.
get
(
base
(),
DIR_CONFIG_COVERTOWEBSERVER
);
if
(!
Files
.
exists
(
path
))
{
Files
.
createDirectories
(
path
);
}
return
path
;
}
public
static
Path
path_servers_webServer
(
Boolean
force
)
throws
Exception
{
Path
path
=
Paths
.
get
(
base
(),
DIR_SERVERS_WEBSERVER
);
if
(!
Files
.
exists
(
path
))
{
Files
.
createDirectories
(
path
);
}
return
path
;
}
public
static
synchronized
void
flush
()
{
INSTANCE
=
null
;
}
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Vfs.java
浏览文件 @
9b3882d3
...
...
@@ -8,10 +8,15 @@ public class Vfs extends ConfigObject {
private
Ftp
ftp
=
new
Ftp
();
private
Ftps
ftps
=
new
Ftps
();
private
Sftp
sftp
=
new
Sftp
();
public
Vfs
()
{
}
public
Sftp
getSftp
()
{
return
((
null
!=
this
.
sftp
)
?
this
.
sftp
:
new
Sftp
());
}
public
Ftp
getFtp
()
{
return
((
null
!=
this
.
ftp
)
?
this
.
ftp
:
new
Ftp
());
}
...
...
@@ -24,6 +29,21 @@ public class Vfs extends ConfigObject {
return
new
Vfs
();
}
public
static
class
Sftp
extends
ConfigObject
{
@FieldDescribe
(
"是否启用被动方式传输,默认true"
)
private
Boolean
passive
=
true
;
public
Boolean
getPassive
()
{
return
(!
BooleanUtils
.
isFalse
(
this
.
passive
));
}
public
void
setPassive
(
Boolean
passive
)
{
this
.
passive
=
passive
;
}
}
public
static
class
Ftp
extends
ConfigObject
{
@FieldDescribe
(
"是否启用被动方式传输,默认true"
)
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java
浏览文件 @
9b3882d3
...
...
@@ -29,9 +29,11 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.processplatform.core.entity.element.Form"
,
"com.x.processplatform.core.entity.element.FormField"
,
"com.x.processplatform.core.entity.element.Embed"
,
"com.x.processplatform.core.entity.element.Mapping"
,
"com.x.processplatform.core.entity.log.SignalStackLog"
,
"com.x.query.core.entity.Item"
,
"com.x.cms.core.entity.element.Script"
,
"com.x.portal.core.entity.Script"
,
"com.x.query.dynamic.entity.*"
},
storageTypes
=
{
StorageType
.
processPlatform
},
storeJars
=
{
"x_organization_core_entity"
,
"x_organization_core_express"
,
"x_processplatform_core_entity"
,
"x_processplatform_core_express"
,
"x_query_core_entity"
},
dynamicJars
=
{
"x_query_dynamic_entity"
})
"x_processplatform_core_express"
,
"x_query_core_entity"
,
"x_cms_core_entity"
,
"x_portal_core_entity"
},
dynamicJars
=
{
"x_query_dynamic_entity"
})
public
class
x_processplatform_service_processing
extends
Deployable
{
}
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java
浏览文件 @
9b3882d3
...
...
@@ -4,7 +4,7 @@ import java.io.File;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.
Paths
;
import
java.nio.file.
StandardCopyOption
;
import
java.util.ArrayList
;
import
java.util.EnumSet
;
import
java.util.HashMap
;
...
...
@@ -62,6 +62,8 @@ public class WebServerTools extends JettySeverTools {
createIndexPage
();
// copyDefaultHtml
copyDefaultHtml
();
// 覆盖 webServer
coverToWebServer
();
QueuedThreadPool
threadPool
=
new
QueuedThreadPool
();
threadPool
.
setMinThreads
(
WEBSERVER_THREAD_POOL_SIZE_MIN
);
...
...
@@ -289,4 +291,11 @@ public class WebServerTools extends JettySeverTools {
FileUtils
.
write
(
file
,
buffer
.
toString
(),
DefaultCharset
.
name
);
}
}
private
static
void
coverToWebServer
()
throws
Exception
{
Path
p
=
Config
.
path_config_coverToWebServer
(
true
);
if
(
Files
.
exists
(
p
))
{
FileUtils
.
copyDirectory
(
p
.
toFile
(),
Config
.
path_servers_webServer
(
true
).
toFile
());
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.element.Form
;
class
ActionGet
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
flag
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Form
form
=
business
.
form
().
pick
(
flag
);
if
(
null
==
form
)
{
throw
new
ExceptionEntityNotExist
(
flag
,
Form
.
class
);
}
Wo
wo
=
new
Wo
();
wo
.
setData
(
form
.
getDataOrMobileData
());
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
String
data
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
}
//
package com.x.processplatform.assemble.surface.jaxrs.form;
//
//
import com.x.base.core.container.EntityManagerContainer;
//
import com.x.base.core.container.factory.EntityManagerContainerFactory;
//
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.processplatform.assemble.surface.Business;
//
import com.x.processplatform.core.entity.element.Form;
//
//
class ActionGet extends BaseAction {
//
//
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
//
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//
ActionResult<Wo> result = new ActionResult<>();
//
Business business = new Business(emc);
//
Form form = business.form().pick(flag);
//
if (null == form) {
//
throw new ExceptionEntityNotExist(flag, Form.class);
//
}
//
Wo wo = new Wo();
//
wo.setData(form.getDataOrMobileData());
//
result.setData(wo);
//
return result;
//
}
//
}
//
//
public static class Wo extends GsonPropertyObject {
//
//
private String data;
//
//
public String getData() {
//
return data;
//
}
//
//
public void setData(String data) {
//
this.data = data;
//
}
//
//
}
//
//
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.element.Form
;
class
ActionGetMobile
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
flag
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Form
form
=
business
.
form
().
pick
(
flag
);
if
(
null
==
form
)
{
throw
new
ExceptionEntityNotExist
(
flag
,
Form
.
class
);
}
Wo
wo
=
new
Wo
();
wo
.
setData
(
form
.
getMobileDataOrData
());
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
String
data
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
}
//
package com.x.processplatform.assemble.surface.jaxrs.form;
//
//
import com.x.base.core.container.EntityManagerContainer;
//
import com.x.base.core.container.factory.EntityManagerContainerFactory;
//
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.processplatform.assemble.surface.Business;
//
import com.x.processplatform.core.entity.element.Form;
//
//
class ActionGetMobile extends BaseAction {
//
//
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
//
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//
ActionResult<Wo> result = new ActionResult<>();
//
Business business = new Business(emc);
//
Form form = business.form().pick(flag);
//
if (null == form) {
//
throw new ExceptionEntityNotExist(flag, Form.class);
//
}
//
Wo wo = new Wo();
//
wo.setData(form.getMobileDataOrData());
//
result.setData(wo);
//
return result;
//
}
//
}
//
//
public static class Wo extends GsonPropertyObject {
//
//
private String data;
//
//
public String getData() {
//
return data;
//
}
//
//
public void setData(String data) {
//
this.data = data;
//
}
//
//
}
//
//
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Form
;
class
ActionGetWithApplication
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
applicationFlag
,
String
flag
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Application
application
=
business
.
application
().
pick
(
applicationFlag
);
if
(
null
==
application
)
{
throw
new
ExceptionEntityNotExist
(
applicationFlag
,
Application
.
class
);
}
Form
form
=
business
.
form
().
pick
(
application
,
flag
);
// Wo wo = Wo.copier.copy(form);
Wo
wo
=
new
Wo
();
wo
.
setData
(
form
.
getDataOrMobileData
());
result
.
setData
(
wo
);
return
result
;
}
}
// public static class Wo extends Form {
//
// private static final long serialVersionUID = 1541438199059150837L;
//
// static WrapCopier<Form, Wo> copier = WrapCopierFactory.wo(Form.class, Wo.class, null,
// JpaObject.FieldsInvisible);
//package com.x.processplatform.assemble.surface.jaxrs.form;
//
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.container.factory.EntityManagerContainerFactory;
//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.processplatform.assemble.surface.Business;
//import com.x.processplatform.core.entity.element.Application;
//import com.x.processplatform.core.entity.element.Form;
//
//class ActionGetWithApplication extends BaseAction {
//
// ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// ActionResult<Wo> result = new ActionResult<>();
// Business business = new Business(emc);
// Application application = business.application().pick(applicationFlag);
// if (null == application) {
// throw new ExceptionEntityNotExist(applicationFlag, Application.class);
// }
// Form form = business.form().pick(application, flag);
// // Wo wo = Wo.copier.copy(form);
// Wo wo = new Wo();
// wo.setData(form.getDataOrMobileData());
// result.setData(wo);
// return result;
// }
// }
//
//// public static class Wo extends Form {
////
//// private static final long serialVersionUID = 1541438199059150837L;
////
//// static WrapCopier<Form, Wo> copier = WrapCopierFactory.wo(Form.class, Wo.class, null,
//// JpaObject.FieldsInvisible);
////
//// }
// public static class Wo extends GsonPropertyObject {
//
// private String data;
//
// public String getData() {
// return data;
// }
//
// public void setData(String data) {
// this.data = data;
// }
//
// }
public
static
class
Wo
extends
GsonPropertyObject
{
private
String
data
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
}
//}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
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.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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Form
;
class
ActionGetWithApplicationMobile
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
applicationFlag
,
String
flag
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Application
application
=
business
.
application
().
pick
(
applicationFlag
);
if
(
null
==
application
)
{
throw
new
ExceptionEntityNotExist
(
applicationFlag
,
Application
.
class
);
}
Form
form
=
business
.
form
().
pick
(
application
,
flag
);
//Wo wo = Wo.copier.copy(form);
Wo
wo
=
new
Wo
();
wo
.
setData
(
form
.
getMobileDataOrData
());
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
String
data
;
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
}
//
package com.x.processplatform.assemble.surface.jaxrs.form;
//
//
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.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.processplatform.assemble.surface.Business;
//
import com.x.processplatform.core.entity.element.Application;
//
import com.x.processplatform.core.entity.element.Form;
//
//
class ActionGetWithApplicationMobile extends BaseAction {
//
//
ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
//
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//
ActionResult<Wo> result = new ActionResult<>();
//
Business business = new Business(emc);
//
Application application = business.application().pick(applicationFlag);
//
if (null == application) {
//
throw new ExceptionEntityNotExist(applicationFlag, Application.class);
//
}
//
Form form = business.form().pick(application, flag);
//
//Wo wo = Wo.copier.copy(form);
//
Wo wo = new Wo();
//
wo.setData(form.getMobileDataOrData());
//
result.setData(wo);
//
return result;
//
}
//
}
//
//
public static class Wo extends GsonPropertyObject {
//
//
private String data;
//
//
public String getData() {
//
return data;
//
}
//
//
public void setData(String data) {
//
this.data = data;
//
}
//
//
}
//
//
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
java.util.Map.Entry
;
import
java.util.concurrent.CompletableFuture
;
import
org.apache.commons.lang3.BooleanUtils
;
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.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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DateTools
;
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.content.WorkCompletedProperties
;
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
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGetWithWorkOrWorkCompleted
.
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
);
CompletableFuture
<
Wo
>
_wo
=
CompletableFuture
.
supplyAsync
(()
->
{
Wo
wo
=
null
;
try
{
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
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
wo
;
});
CompletableFuture
<
Boolean
>
_control
=
CompletableFuture
.
supplyAsync
(()
->
{
Boolean
value
=
false
;
try
{
value
=
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
value
;
});
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
result
.
setData
(
_wo
.
get
());
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
(
toWoFormDataOrMobileData
(
form
));
wo
.
setFastETag
(
DateTools
.
format
(
form
.
getUpdateTime
())
+
form
.
getId
());
related
(
business
,
wo
,
form
);
}
}
return
wo
;
}
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
(
toWoFormDataOrMobileData
(
form
));
wo
.
setFastETag
(
DateTools
.
format
(
form
.
getUpdateTime
())
+
form
.
getId
());
related
(
business
,
wo
,
form
);
}
}
else
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
wo
.
setForm
(
toWoFormDataOrMobileData
(
workCompleted
.
getProperties
().
getForm
()));
if
(
StringUtils
.
isNotBlank
(
workCompleted
.
getProperties
().
getForm
().
getData
()))
{
workCompleted
.
getProperties
().
getRelatedFormList
()
.
forEach
(
o
->
wo
.
getRelatedFormMap
().
put
(
o
.
getId
(),
toWoFormDataOrMobileData
(
o
)));
}
else
{
workCompleted
.
getProperties
().
getMobileRelatedFormList
()
.
forEach
(
o
->
wo
.
getRelatedFormMap
().
put
(
o
.
getId
(),
toWoFormMobileDataOrData
(
o
)));
}
}
workCompleted
.
getProperties
().
getRelatedScriptList
().
stream
()
.
forEach
(
o
->
wo
.
getRelatedScriptMap
().
put
(
o
.
getId
(),
toWoScript
(
o
)));
return
wo
;
}
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getData
()))
{
for
(
String
relatedFormId
:
form
.
getProperties
().
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoFormDataOrMobileData
(
relatedForm
));
}
}
}
else
{
for
(
String
mobileRelatedFormId
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
Form
mobileRelatedForm
=
business
.
form
().
pick
(
mobileRelatedFormId
);
if
(
null
!=
mobileRelatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
mobileRelatedFormId
,
toWoFormMobileDataOrData
(
mobileRelatedForm
));
}
}
}
relatedScript
(
business
,
wo
,
form
);
}
protected
void
relatedScript
(
Business
business
,
AbstractWo
wo
,
Form
form
)
throws
Exception
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
Script
.
TYPE_PROCESSPLATFORM
:
Script
relatedScript
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedScript
));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
relatedCmsScript
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedCmsScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedCmsScript
));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
relatedPortalScript
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedPortalScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedPortalScript
));
}
break
;
default
:
break
;
}
}
}
public
static
class
Wo
extends
AbstractWo
{
}
}
\ No newline at end of file
//package com.x.processplatform.assemble.surface.jaxrs.form;
//
//import java.util.Map.Entry;
//import java.util.concurrent.CompletableFuture;
//
//import org.apache.commons.lang3.BooleanUtils;
//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.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.logger.Logger;
//import com.x.base.core.project.logger.LoggerFactory;
//import com.x.base.core.project.tools.DateTools;
//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.content.WorkCompletedProperties;
//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 {
//
// private static Logger logger = LoggerFactory.getLogger(ActionGetWithWorkOrWorkCompleted.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);
//
// CompletableFuture<Wo> _wo = CompletableFuture.supplyAsync(() -> {
// Wo wo = null;
// try {
// 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));
// }
// } catch (Exception e) {
// logger.error(e);
// }
// return wo;
// });
//
// CompletableFuture<Boolean> _control = CompletableFuture.supplyAsync(() -> {
// Boolean value = false;
// try {
// value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted,
// new ExceptionEntityNotExist(workOrWorkCompleted));
// } catch (Exception e) {
// logger.error(e);
// }
// return value;
// });
//
// if (BooleanUtils.isFalse(_control.get())) {
// throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted);
// }
//
// result.setData(_wo.get());
// 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(toWoFormDataOrMobileData(form));
// wo.setFastETag(DateTools.format(form.getUpdateTime()) + form.getId());
// related(business, wo, form);
// }
// }
// return wo;
// }
//
// 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(toWoFormDataOrMobileData(form));
// wo.setFastETag(DateTools.format(form.getUpdateTime()) + form.getId());
// related(business, wo, form);
// }
// } else if (null != workCompleted.getProperties().getForm()) {
// wo.setForm(toWoFormDataOrMobileData(workCompleted.getProperties().getForm()));
// if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getData())) {
// workCompleted.getProperties().getRelatedFormList()
// .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o)));
// } else {
// workCompleted.getProperties().getMobileRelatedFormList()
// .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o)));
// }
// }
// workCompleted.getProperties().getRelatedScriptList().stream()
// .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o)));
// return wo;
// }
//
// private void related(Business business, Wo wo, Form form) throws Exception {
// if (StringUtils.isNotBlank(form.getData())) {
// for (String relatedFormId : form.getProperties().getRelatedFormList()) {
// Form relatedForm = business.form().pick(relatedFormId);
// if (null != relatedForm) {
// wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm));
// }
// }
// } else {
// for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) {
// Form mobileRelatedForm = business.form().pick(mobileRelatedFormId);
// if (null != mobileRelatedForm) {
// wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(mobileRelatedForm));
// }
// }
// }
// relatedScript(business, wo, form);
// }
//
// protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception {
// for (Entry<String, String> entry : form.getProperties().getRelatedScriptMap().entrySet()) {
// switch (entry.getValue()) {
// case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM:
// Script relatedScript = business.script().pick(entry.getKey());
// if (null != relatedScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript));
// }
// break;
// case WorkCompletedProperties.Script.TYPE_CMS:
// com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey());
// if (null != relatedCmsScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript));
// }
// break;
// case WorkCompletedProperties.Script.TYPE_PORTAL:
// com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey());
// if (null != relatedPortalScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript));
// }
// break;
// default:
// break;
// }
// }
// }
//
// public static class Wo extends AbstractWo {
//
// }
//
//}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
java.util.Map.Entry
;
import
java.util.concurrent.CompletableFuture
;
import
org.apache.commons.lang3.BooleanUtils
;
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.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.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.content.WorkCompletedProperties
;
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
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGetWithWorkOrWorkCompletedMobile
.
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
);
CompletableFuture
<
Wo
>
_wo
=
CompletableFuture
.
supplyAsync
(()
->
{
Wo
wo
=
null
;
try
{
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
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
wo
;
});
CompletableFuture
<
Boolean
>
_control
=
CompletableFuture
.
supplyAsync
(()
->
{
Boolean
value
=
false
;
try
{
value
=
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
value
;
});
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
result
.
setData
(
_wo
.
get
());
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
(
toWoFormMobileDataOrData
(
form
));
related
(
business
,
wo
,
form
);
}
}
return
wo
;
}
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
(
toWoFormMobileDataOrData
(
form
));
related
(
business
,
wo
,
form
);
}
}
else
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
wo
.
setForm
(
toWoFormMobileDataOrData
(
workCompleted
.
getProperties
().
getForm
()));
if
(
StringUtils
.
isNotBlank
(
workCompleted
.
getProperties
().
getForm
().
getMobileData
()))
{
workCompleted
.
getProperties
().
getMobileRelatedFormList
()
.
forEach
(
o
->
wo
.
getRelatedFormMap
().
put
(
o
.
getId
(),
toWoFormMobileDataOrData
(
o
)));
}
else
{
workCompleted
.
getProperties
().
getRelatedFormList
()
.
forEach
(
o
->
wo
.
getRelatedFormMap
().
put
(
o
.
getId
(),
toWoFormDataOrMobileData
(
o
)));
}
}
workCompleted
.
getProperties
().
getRelatedScriptList
().
stream
()
.
forEach
(
o
->
wo
.
getRelatedScriptMap
().
put
(
o
.
getId
(),
toWoScript
(
o
)));
return
wo
;
}
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getMobileData
()))
{
for
(
String
mobileRelatedFormId
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
mobileRelatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
mobileRelatedFormId
,
toWoFormMobileDataOrData
(
relatedForm
));
}
}
}
else
{
for
(
String
relatedFormId
:
form
.
getProperties
().
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoFormDataOrMobileData
(
relatedForm
));
}
}
}
relatedScript
(
business
,
wo
,
form
);
}
protected
void
relatedScript
(
Business
business
,
AbstractWo
wo
,
Form
form
)
throws
Exception
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getMobileRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
Script
.
TYPE_PROCESSPLATFORM
:
Script
relatedScript
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedScript
));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
relatedCmsScript
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedCmsScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedCmsScript
));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
relatedPortalScript
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedPortalScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedPortalScript
));
}
break
;
default
:
break
;
}
}
}
public
static
class
Wo
extends
AbstractWo
{
}
}
\ No newline at end of file
//package com.x.processplatform.assemble.surface.jaxrs.form;
//
//import java.util.Map.Entry;
//import java.util.concurrent.CompletableFuture;
//
//import org.apache.commons.lang3.BooleanUtils;
//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.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.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.content.WorkCompletedProperties;
//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 {
//
// private static Logger logger = LoggerFactory.getLogger(ActionGetWithWorkOrWorkCompletedMobile.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);
//
// CompletableFuture<Wo> _wo = CompletableFuture.supplyAsync(() -> {
// Wo wo = null;
// try {
// 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));
// }
// } catch (Exception e) {
// logger.error(e);
// }
// return wo;
// });
//
// CompletableFuture<Boolean> _control = CompletableFuture.supplyAsync(() -> {
// Boolean value = false;
// try {
// value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted,
// new ExceptionEntityNotExist(workOrWorkCompleted));
// } catch (Exception e) {
// logger.error(e);
// }
// return value;
// });
//
// if (BooleanUtils.isFalse(_control.get())) {
// throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted);
// }
//
// result.setData(_wo.get());
// 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(toWoFormMobileDataOrData(form));
// related(business, wo, form);
// }
// }
// return wo;
// }
//
// 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(toWoFormMobileDataOrData(form));
// related(business, wo, form);
// }
// } else if (null != workCompleted.getProperties().getForm()) {
// wo.setForm(toWoFormMobileDataOrData(workCompleted.getProperties().getForm()));
// if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getMobileData())) {
// workCompleted.getProperties().getMobileRelatedFormList()
// .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o)));
// } else {
// workCompleted.getProperties().getRelatedFormList()
// .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o)));
// }
// }
// workCompleted.getProperties().getRelatedScriptList().stream()
// .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o)));
// return wo;
// }
//
// private void related(Business business, Wo wo, Form form) throws Exception {
// if (StringUtils.isNotBlank(form.getMobileData())) {
// for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) {
// Form relatedForm = business.form().pick(mobileRelatedFormId);
// if (null != relatedForm) {
// wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(relatedForm));
// }
// }
// } else {
// for (String relatedFormId : form.getProperties().getRelatedFormList()) {
// Form relatedForm = business.form().pick(relatedFormId);
// if (null != relatedForm) {
// wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm));
// }
// }
// }
// relatedScript(business, wo, form);
// }
//
// protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception {
// for (Entry<String, String> entry : form.getProperties().getMobileRelatedScriptMap().entrySet()) {
// switch (entry.getValue()) {
// case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM:
// Script relatedScript = business.script().pick(entry.getKey());
// if (null != relatedScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript));
// }
// break;
// case WorkCompletedProperties.Script.TYPE_CMS:
// com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey());
// if (null != relatedCmsScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript));
// }
// break;
// case WorkCompletedProperties.Script.TYPE_PORTAL:
// com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey());
// if (null != relatedPortalScript) {
// wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript));
// }
// break;
// default:
// break;
// }
// }
// }
//
// public static class Wo extends AbstractWo {
//
// }
//
//}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java
浏览文件 @
9b3882d3
...
...
@@ -3,230 +3,53 @@ package com.x.processplatform.assemble.surface.jaxrs.form;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.x.base.core.project.cache.ApplicationCache
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.cache.Cache.CacheCategory
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.jaxrs.WoFastETag
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
import
net.sf.ehcache.Ehcache
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
protected
static
Ehcache
CACHE
=
ApplicationCache
.
instance
().
getCache
(
Form
.
class
,
Script
.
class
,
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
,
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
protected
WoForm
toWoFormDataOrMobileData
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setCategory
(
form
.
getCategory
());
wo
.
setApplication
(
form
.
getApplication
());
wo
.
setHasMobile
(
form
.
getHasMobile
());
wo
.
setData
(
form
.
getDataOrMobileData
());
return
wo
;
}
protected
WoForm
toWoFormMobileDataOrData
(
Form
form
)
{
WoForm
wo
=
new
WoForm
();
wo
.
setId
(
form
.
getId
());
wo
.
setName
(
form
.
getName
());
wo
.
setAlias
(
form
.
getAlias
());
wo
.
setCategory
(
form
.
getCategory
());
wo
.
setApplication
(
form
.
getApplication
());
wo
.
setHasMobile
(
form
.
getHasMobile
());
wo
.
setData
(
form
.
getMobileDataOrData
());
return
wo
;
}
protected
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
;
}
protected
WoScript
toWoScript
(
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
script
)
{
WoScript
wo
=
new
WoScript
();
wo
.
setId
(
script
.
getId
());
wo
.
setName
(
script
.
getName
());
wo
.
setAlias
(
script
.
getAlias
());
wo
.
setText
(
script
.
getText
());
return
wo
;
}
protected
WoScript
toWoScript
(
com
.
x
.
portal
.
core
.
entity
.
Script
script
)
{
WoScript
wo
=
new
WoScript
();
wo
.
setId
(
script
.
getId
());
wo
.
setName
(
script
.
getName
());
wo
.
setAlias
(
script
.
getAlias
());
wo
.
setText
(
script
.
getText
());
return
wo
;
}
protected
WoScript
toWoScript
(
WorkCompletedProperties
.
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
;
private
String
category
;
private
String
application
;
private
Boolean
hasMobile
;
public
String
getCategory
()
{
return
category
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
public
String
getApplication
()
{
return
application
;
}
public
void
setApplication
(
String
application
)
{
this
.
application
=
application
;
}
public
Boolean
getHasMobile
()
{
return
hasMobile
;
}
public
void
setHasMobile
(
Boolean
hasMobile
)
{
this
.
hasMobile
=
hasMobile
;
}
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
;
}
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
;
}
}
CacheCategory
cacheCategory
=
new
CacheCategory
(
Form
.
class
,
Script
.
class
,
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
,
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
public
static
class
AbstractWo
extends
WoFastETag
{
private
String
id
;
private
static
final
long
serialVersionUID
=
9043017746047829883L
;
private
Wo
Form
form
;
private
Related
Form
form
;
private
Map
<
String
,
Wo
Form
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
Related
Form
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
Wo
Script
>
relatedScriptMap
=
new
HashMap
<>();
private
Map
<
String
,
Related
Script
>
relatedScriptMap
=
new
HashMap
<>();
public
Wo
Form
getForm
()
{
public
Related
Form
getForm
()
{
return
form
;
}
public
void
setForm
(
Wo
Form
form
)
{
public
void
setForm
(
Related
Form
form
)
{
this
.
form
=
form
;
}
public
Map
<
String
,
Wo
Form
>
getRelatedFormMap
()
{
public
Map
<
String
,
Related
Form
>
getRelatedFormMap
()
{
return
relatedFormMap
;
}
public
void
setRelatedFormMap
(
Map
<
String
,
Wo
Form
>
relatedFormMap
)
{
public
void
setRelatedFormMap
(
Map
<
String
,
Related
Form
>
relatedFormMap
)
{
this
.
relatedFormMap
=
relatedFormMap
;
}
public
Map
<
String
,
Wo
Script
>
getRelatedScriptMap
()
{
public
Map
<
String
,
Related
Script
>
getRelatedScriptMap
()
{
return
relatedScriptMap
;
}
public
void
setRelatedScriptMap
(
Map
<
String
,
Wo
Script
>
relatedScriptMap
)
{
public
void
setRelatedScriptMap
(
Map
<
String
,
Related
Script
>
relatedScriptMap
)
{
this
.
relatedScriptMap
=
relatedScriptMap
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java
浏览文件 @
9b3882d3
...
...
@@ -28,111 +28,130 @@ public class FormAction extends StandardJaxrsAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
FormAction
.
class
);
@JaxrsMethodDescribe
(
value
=
"根据工作或完成工作标识获取表单."
,
action
=
ActionGetWithWorkOrWorkCompleted
.
class
)
@GET
@Path
(
"workorworkcompleted/{workOrWorkCompleted}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getWithWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
ActionGetWithWorkOrWorkCompleted
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithWorkOrWorkCompleted
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//
@JaxrsMethodDescribe(value = "根据工作或完成工作标识获取表单.", action = ActionGetWithWorkOrWorkCompleted.class)
//
@GET
//
@Path("workorworkcompleted/{workOrWorkCompleted}")
//
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
//
@Consumes(MediaType.APPLICATION_JSON)
//
public void getWithWorkOrWorkCompleted(@Suspended final AsyncResponse asyncResponse,
//
@Context HttpServletRequest request,
//
@JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) {
//
ActionResult<ActionGetWithWorkOrWorkCompleted.Wo> result = new ActionResult<>();
//
EffectivePerson effectivePerson = this.effectivePerson(request);
//
try {
//
result = new ActionGetWithWorkOrWorkCompleted().execute(effectivePerson, workOrWorkCompleted);
//
} catch (Exception e) {
//
logger.error(e, effectivePerson, request, null);
//
result.error(e);
//
}
//
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
//
}
@JaxrsMethodDescribe
(
value
=
"根据工作或完成工作标识获取移动表单."
,
action
=
ActionGetWithWorkOrWorkCompletedMobile
.
class
)
@GET
@Path
(
"workorworkcompleted/{workOrWorkCompleted}/mobile"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getWithWorkOrWorkCompletedMobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
ActionGetWithWorkOrWorkCompletedMobile
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithWorkOrWorkCompletedMobile
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//
@JaxrsMethodDescribe(value = "根据工作或完成工作标识获取移动表单.", action = ActionGetWithWorkOrWorkCompletedMobile.class)
//
@GET
//
@Path("workorworkcompleted/{workOrWorkCompleted}/mobile")
//
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
//
@Consumes(MediaType.APPLICATION_JSON)
//
public void getWithWorkOrWorkCompletedMobile(@Suspended final AsyncResponse asyncResponse,
//
@Context HttpServletRequest request,
//
@JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) {
//
ActionResult<ActionGetWithWorkOrWorkCompletedMobile.Wo> result = new ActionResult<>();
//
EffectivePerson effectivePerson = this.effectivePerson(request);
//
try {
//
result = new ActionGetWithWorkOrWorkCompletedMobile().execute(effectivePerson, workOrWorkCompleted);
//
} catch (Exception e) {
//
logger.error(e, effectivePerson, request, null);
//
result.error(e);
//
}
//
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
//
}
@JaxrsMethodDescribe
(
value
=
"获取表单."
,
action
=
ActionGet
.
class
)
@GET
@Path
(
"{flag}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
get
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"表单标识"
)
@PathParam
(
"flag"
)
String
flag
)
{
ActionResult
<
ActionGet
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGet
().
execute
(
effectivePerson
,
flag
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//
@JaxrsMethodDescribe(value = "获取表单.", action = ActionGet.class)
//
@GET
//
@Path("{flag}")
//
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
//
@Consumes(MediaType.APPLICATION_JSON)
//
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
//
@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
//
ActionResult<ActionGet.Wo> result = new ActionResult<>();
//
EffectivePerson effectivePerson = this.effectivePerson(request);
//
try {
//
result = new ActionGet().execute(effectivePerson, flag);
//
} catch (Exception e) {
//
logger.error(e, effectivePerson, request, null);
//
result.error(e);
//
}
//
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
//
}
@JaxrsMethodDescribe
(
value
=
"获取移动端表单."
,
action
=
ActionGetMobile
.
class
)
@GET
@Path
(
"{flag}/mobile"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getMobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"表单标识"
)
@PathParam
(
"flag"
)
String
flag
)
{
ActionResult
<
ActionGetMobile
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetMobile
().
execute
(
effectivePerson
,
flag
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//
@JaxrsMethodDescribe(value = "获取移动端表单.", action = ActionGetMobile.class)
//
@GET
//
@Path("{flag}/mobile")
//
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
//
@Consumes(MediaType.APPLICATION_JSON)
//
public void getMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
//
@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
//
ActionResult<ActionGetMobile.Wo> result = new ActionResult<>();
//
EffectivePerson effectivePerson = this.effectivePerson(request);
//
try {
//
result = new ActionGetMobile().execute(effectivePerson, flag);
//
} catch (Exception e) {
//
logger.error(e, effectivePerson, request, null);
//
result.error(e);
//
}
//
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
//
}
@JaxrsMethodDescribe
(
value
=
"根据标识和应用标识获取表单."
,
action
=
ActionGetWithApplication
.
class
)
@GET
@Path
(
"{flag}/application/{applicationFlag}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getWithApplication
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"表单标识"
)
@PathParam
(
"flag"
)
String
flag
,
@JaxrsParameterDescribe
(
"应用标识"
)
@PathParam
(
"applicationFlag"
)
String
applicationFlag
)
{
ActionResult
<
ActionGetWithApplication
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithApplication
().
execute
(
effectivePerson
,
applicationFlag
,
flag
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
// @JaxrsMethodDescribe(value = "根据标识和应用标识获取表单.", action = ActionGetWithApplication.class)
// @GET
// @Path("{flag}/application/{applicationFlag}")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// public void getWithApplication(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
// @JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
// @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
// ActionResult<ActionGetWithApplication.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionGetWithApplication().execute(effectivePerson, applicationFlag, flag);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
// @JaxrsMethodDescribe(value = "根据标识和应用标识获取移动端表单.", action = ActionGetWithApplicationMobile.class)
// @GET
// @Path("{flag}/application/{applicationFlag}/mobile")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// public void getWithApplicationMobile(@Suspended final AsyncResponse asyncResponse,
// @Context HttpServletRequest request, @JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
// @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
// ActionResult<ActionGetWithApplicationMobile.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionGetWithApplicationMobile().execute(effectivePerson, applicationFlag, flag);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
@JaxrsMethodDescribe
(
value
=
"
根据标识和应用标识获取移动端表单."
,
action
=
ActionGetWithApplicationMobile
.
class
)
@JaxrsMethodDescribe
(
value
=
"
查询表单,如果有表单那么返回表单id,如果表单不存在且是已完成工作,那么返回storeForm."
,
action
=
V2LookupWorkOrWorkCompleted
.
class
)
@GET
@Path
(
"
{flag}/application/{applicationFlag}/mobile
"
)
@Path
(
"
v2/lookup/workorworkcompleted/{workOrWorkCompleted}
"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getWithApplicationMobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"表单标识"
)
@PathParam
(
"flag"
)
String
flag
,
@JaxrsParameterDescribe
(
"
应用标识"
)
@PathParam
(
"applicationFlag"
)
String
applicationFlag
)
{
ActionResult
<
ActionGetWithApplicationMobile
.
Wo
>
result
=
new
ActionResult
<>();
public
void
V2LookupWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"
工作或已完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
V2LookupWorkOrWorkCompleted
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithApplicationMobile
().
execute
(
effectivePerson
,
applicationFlag
,
flag
);
result
=
new
V2LookupWorkOrWorkCompleted
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
...
...
@@ -140,18 +159,18 @@ public class FormAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"查询表单,如果有表单那么返回表单id,如果
使用的是combine的表单直接返回内容."
,
action
=
V2LookupWorkOrWorkCompleted
.
class
)
@JaxrsMethodDescribe
(
value
=
"查询表单,如果有表单那么返回表单id,如果
表单不存在且是已完成工作,那么返回storeFormMobile."
,
action
=
V2LookupWorkOrWorkCompletedMobile
.
class
)
@GET
@Path
(
"v2/lookup/workorworkcompleted/{workOrWorkCompleted}"
)
@Path
(
"v2/lookup/workorworkcompleted/{workOrWorkCompleted}
/mobile
"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
V2LookupWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
public
void
V2LookupWorkOrWorkCompleted
Mobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或已完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
V2LookupWorkOrWorkCompleted
.
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
V2LookupWorkOrWorkCompleted
Mobile
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
V2LookupWorkOrWorkCompleted
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
result
=
new
V2LookupWorkOrWorkCompleted
Mobile
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.O
bjects
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.O
ptional
;
import
java.util.TreeMap
;
import
java.util.concurrent.CompletableFuture
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
...
...
@@ -14,6 +17,8 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
...
...
@@ -25,62 +30,80 @@ class V2Get extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Form
form
=
emc
.
find
(
id
,
Form
.
class
);
if
(
Objects
.
isNull
(
form
))
{
throw
new
ExceptionEntityNotExist
(
id
,
Form
.
class
);
}
Wo
wo
=
new
Wo
();
wo
.
setForm
(
toWoFormDataOrMobileData
(
form
)
);
related
(
business
,
wo
,
form
);
CacheKey
cacheKey
=
new
CacheKey
(
this
.
getClass
(),
id
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
result
.
setData
((
Wo
)
optional
.
get
());
}
else
{
Wo
wo
=
this
.
get
(
business
,
id
);
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wo
);
result
.
setData
(
wo
);
}
return
result
;
}
}
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getData
()))
{
for
(
String
relatedFormId
:
form
.
getProperties
().
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoFormDataOrMobileData
(
relatedForm
));
}
}
}
else
{
for
(
String
mobileRelatedFormId
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
Form
mobileRelatedForm
=
business
.
form
().
pick
(
mobileRelatedFormId
);
if
(
null
!=
mobileRelatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
mobileRelatedFormId
,
toWoFormMobileDataOrData
(
mobileRelatedForm
));
}
}
}
relatedScript
(
business
,
wo
,
form
);
private
Wo
get
(
Business
business
,
String
id
)
throws
Exception
{
Form
form
=
business
.
form
().
pick
(
id
);
if
(
null
==
form
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Form
.
class
);
}
protected
void
relatedScript
(
Business
business
,
AbstractWo
wo
,
Form
form
)
throws
Exception
{
Wo
wo
=
new
Wo
();
wo
.
setFastETag
(
form
.
getId
()
+
form
.
getLastUpdateTime
().
getTime
());
wo
.
setForm
(
new
RelatedForm
(
form
,
form
.
getDataOrMobileData
()));
CompletableFuture
<
Map
<
String
,
RelatedForm
>>
_relatedForm
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<
String
,
RelatedForm
>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getRelatedFormList
())
{
_f
=
business
.
form
().
pick
(
_id
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getDataOrMobileData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
CompletableFuture
<
Map
<
String
,
RelatedScript
>>
_relatedScript
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<
String
,
RelatedScript
>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
Script
.
TYPE_PROCESSPLATFORM
:
Script
relatedScript
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
relatedCmsScript
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedCmsScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedCmsScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
relatedPortalScript
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedPortalScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedPortalScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_p
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_p
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_p
.
getId
(),
_p
.
getName
(),
_p
.
getAlias
(),
_p
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
wo
.
setRelatedFormMap
(
_relatedForm
.
get
());
wo
.
setRelatedScriptMap
(
_relatedScript
.
get
());
return
wo
;
}
public
static
class
Wo
extends
AbstractWo
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java
浏览文件 @
9b3882d3
package
com.x.processplatform.assemble.surface.jaxrs.form
;
import
java.util.
Objects
;
import
java.util.
Map
;
import
java.util.Map.Entry
;
import
java.util.Optional
;
import
java.util.TreeMap
;
import
java.util.concurrent.CompletableFuture
;
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.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
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.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.PropertyTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.form.ActionGetWithWorkOrWorkCompletedMobile.Wo
;
import
com.x.processplatform.assemble.surface.jaxrs.form.BaseAction.AbstractWo
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.element.Activity
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
...
...
@@ -34,62 +30,80 @@ class V2GetMobile extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Form
form
=
emc
.
find
(
id
,
Form
.
class
);
if
(
Objects
.
isNull
(
form
))
{
throw
new
ExceptionEntityNotExist
(
id
,
Form
.
class
);
}
Wo
wo
=
new
Wo
();
wo
.
setForm
(
toWoFormMobileDataOrData
(
form
)
);
related
(
business
,
wo
,
form
);
CacheKey
cacheKey
=
new
CacheKey
(
this
.
getClass
(),
id
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
result
.
setData
((
Wo
)
optional
.
get
());
}
else
{
Wo
wo
=
this
.
get
(
business
,
id
);
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wo
);
result
.
setData
(
wo
);
}
return
result
;
}
}
private
void
related
(
Business
business
,
Wo
wo
,
Form
form
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
form
.
getMobileData
()))
{
for
(
String
mobileRelatedFormId
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
mobileRelatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
mobileRelatedFormId
,
toWoFormMobileDataOrData
(
relatedForm
));
}
}
}
else
{
for
(
String
relatedFormId
:
form
.
getProperties
().
getRelatedFormList
())
{
Form
relatedForm
=
business
.
form
().
pick
(
relatedFormId
);
if
(
null
!=
relatedForm
)
{
wo
.
getRelatedFormMap
().
put
(
relatedFormId
,
toWoFormDataOrMobileData
(
relatedForm
));
}
}
}
relatedScript
(
business
,
wo
,
form
);
private
Wo
get
(
Business
business
,
String
id
)
throws
Exception
{
Form
form
=
business
.
form
().
pick
(
id
);
if
(
null
==
form
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Form
.
class
);
}
protected
void
relatedScript
(
Business
business
,
AbstractWo
wo
,
Form
form
)
throws
Exception
{
Wo
wo
=
new
Wo
();
wo
.
setFastETag
(
form
.
getId
()
+
form
.
getLastUpdateTime
().
getTime
());
wo
.
setForm
(
new
RelatedForm
(
form
,
form
.
getMobileDataOrData
()));
CompletableFuture
<
Map
<
String
,
RelatedForm
>>
_relatedForm
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<
String
,
RelatedForm
>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
_f
=
business
.
form
().
pick
(
_id
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getMobileDataOrData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
CompletableFuture
<
Map
<
String
,
RelatedScript
>>
_relatedScript
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<
String
,
RelatedScript
>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getMobileRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
Script
.
TYPE_PROCESSPLATFORM
:
Script
relatedScript
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
business
.
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
relatedCmsScript
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedCmsScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedCmsScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
business
.
cms
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
Script
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
relatedPortalScript
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
relatedPortalScript
)
{
wo
.
getRelatedScriptMap
().
put
(
entry
.
getKey
(),
toWoScript
(
relatedPortalScript
));
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_p
=
business
.
portal
().
script
().
pick
(
entry
.
getKey
());
if
(
null
!=
_p
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_p
.
getId
(),
_p
.
getName
(),
_p
.
getAlias
(),
_p
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
wo
.
setRelatedFormMap
(
_relatedForm
.
get
());
wo
.
setRelatedScriptMap
(
_relatedScript
.
get
());
return
wo
;
}
public
static
class
Wo
extends
AbstractWo
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java
浏览文件 @
9b3882d3
...
...
@@ -19,7 +19,7 @@ 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.content.WorkCompletedProperties.
Adapt
Form
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.
Store
Form
;
import
com.x.processplatform.core.entity.element.Activity
;
class
V2LookupWorkOrWorkCompleted
extends
BaseAction
{
...
...
@@ -89,15 +89,25 @@ class V2LookupWorkOrWorkCompleted extends BaseAction {
Wo
wo
=
new
Wo
();
if
(
null
!=
business
.
form
().
pick
(
workCompleted
.
getForm
()))
{
wo
.
setId
(
workCompleted
.
getForm
());
}
else
if
(
null
!=
workCompleted
.
getProperties
().
getForm
())
{
AdaptForm
adapt
=
workCompleted
.
getProperties
().
adaptForm
(
false
);
wo
=
XGsonBuilder
.
convert
(
adapt
,
Wo
.
class
);
}
else
if
(
null
!=
workCompleted
.
getProperties
().
get
Store
Form
())
{
StoreForm
storeForm
=
workCompleted
.
getProperties
().
getStoreForm
(
);
wo
=
XGsonBuilder
.
convert
(
storeForm
,
Wo
.
class
);
}
return
wo
;
}
public
static
class
Wo
extends
AbstractWo
{
private
String
id
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java
浏览文件 @
9b3882d3
...
...
@@ -17,10 +17,9 @@ 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.V2LookupWorkOrWorkCompleted.Wo
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.
Adapt
Form
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.
Store
Form
;
import
com.x.processplatform.core.entity.element.Activity
;
class
V2LookupWorkOrWorkCompletedMobile
extends
BaseAction
{
...
...
@@ -31,6 +30,10 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
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
);
}
CompletableFuture
<
Wo
>
_wo
=
CompletableFuture
.
supplyAsync
(()
->
{
Wo
wo
=
new
Wo
();
...
...
@@ -86,15 +89,25 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
Wo
wo
=
new
Wo
();
if
(
null
!=
business
.
form
().
pick
(
workCompleted
.
getForm
()))
{
wo
.
setId
(
workCompleted
.
getForm
());
}
else
if
(
null
!=
workCompleted
.
getProperties
().
get
Form
())
{
AdaptForm
adapt
=
workCompleted
.
getProperties
().
adaptForm
(
true
);
wo
=
XGsonBuilder
.
convert
(
adapt
,
Wo
.
class
);
}
else
if
(
null
!=
workCompleted
.
getProperties
().
get
StoreFormMobile
())
{
StoreForm
storeForm
=
workCompleted
.
getProperties
().
getStoreFormMobile
(
);
wo
=
XGsonBuilder
.
convert
(
storeForm
,
Wo
.
class
);
}
return
wo
;
}
public
static
class
Wo
extends
AbstractWo
{
private
String
id
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
}
\ No newline at end of file
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java
浏览文件 @
9b3882d3
...
...
@@ -9,6 +9,7 @@ import com.x.base.core.entity.JsonProperties;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
public
class
WorkCompletedProperties
extends
JsonProperties
{
...
...
@@ -31,19 +32,10 @@ public class WorkCompletedProperties extends JsonProperties {
private
List
<
WorkLog
>
workLogList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作Form"
)
private
Form
f
orm
;
private
StoreForm
storeF
orm
;
@FieldDescribe
(
"合并工作relatedFormList"
)
private
List
<
Form
>
relatedFormList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作relatedScriptList"
)
private
List
<
Script
>
relatedScriptList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作mobileRelatedFormList"
)
private
List
<
Form
>
mobileRelatedFormList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作mobileRelatedFormList"
)
private
List
<
Script
>
mobileRelatedScriptList
=
new
ArrayList
<>();
@FieldDescribe
(
"合并工作Form,移动端."
)
private
StoreForm
storeFormMobile
;
@FieldDescribe
(
"标题"
)
private
String
title
;
...
...
@@ -80,46 +72,6 @@ public class WorkCompletedProperties extends JsonProperties {
this
.
title
=
title
;
}
public
Form
getForm
()
{
return
form
;
}
public
void
setForm
(
Form
form
)
{
this
.
form
=
form
;
}
public
List
<
Form
>
getRelatedFormList
()
{
return
relatedFormList
;
}
public
List
<
Script
>
getRelatedScriptList
()
{
return
relatedScriptList
;
}
public
void
setRelatedFormList
(
List
<
Form
>
relatedFormList
)
{
this
.
relatedFormList
=
relatedFormList
;
}
public
void
setRelatedScriptList
(
List
<
Script
>
relatedScriptList
)
{
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
;
}
public
List
<
TaskCompleted
>
getTaskCompletedList
()
{
return
taskCompletedList
;
}
...
...
@@ -144,94 +96,94 @@ public class WorkCompletedProperties extends JsonProperties {
this
.
reviewList
=
reviewList
;
}
public
AdaptForm
adaptForm
(
boolean
mobile
)
throws
Exception
{
AdaptForm
adapt
=
new
AdaptForm
();
if
(
null
!=
this
.
form
)
{
public
StoreForm
storeForm
(
boolean
mobile
)
throws
Exception
{
if
(
mobile
)
{
Form
f
=
new
Form
();
this
.
form
.
copyTo
(
f
,
Form
.
data_FIELDNAME
,
Form
.
mobileData_FIELDNAME
);
f
.
setData
(
form
.
getMobileDataOrData
());
adapt
.
setForm
(
f
);
for
(
Form
o
:
this
.
getMobileRelatedFormList
())
{
Form
m
=
new
Form
();
o
.
copyTo
(
m
,
true
,
Form
.
data_FIELDNAME
,
Form
.
mobileData_FIELDNAME
);
m
.
setData
(
o
.
getMobileDataOrData
());
adapt
.
getRelatedFormMap
().
put
(
o
.
getId
(),
m
);
}
for
(
Script
o
:
this
.
getMobileRelatedScriptList
())
{
Script
s
=
new
Script
();
o
.
copyTo
(
s
,
true
);
adapt
.
getRelatedScriptMap
().
put
(
o
.
getId
(),
s
);
}
return
this
.
getStoreFormMobile
();
}
else
{
Form
f
=
new
Form
();
this
.
form
.
copyTo
(
f
,
Form
.
data_FIELDNAME
,
Form
.
mobileData_FIELDNAME
);
f
.
setData
(
form
.
getDataOrMobileData
());
adapt
.
setForm
(
f
);
for
(
Form
o
:
this
.
getRelatedFormList
())
{
Form
m
=
new
Form
();
o
.
copyTo
(
m
,
true
,
Form
.
data_FIELDNAME
,
Form
.
mobileData_FIELDNAME
);
m
.
setData
(
o
.
getDataOrMobileData
());
adapt
.
getRelatedFormMap
().
put
(
o
.
getId
(),
m
);
return
this
.
getStoreForm
();
}
for
(
Script
o
:
this
.
getRelatedScriptList
())
{
Script
s
=
new
Script
();
o
.
copyTo
(
s
,
true
);
adapt
.
getRelatedScriptMap
().
put
(
o
.
getId
(),
s
);
}
public
StoreForm
getStoreForm
()
{
return
storeForm
;
}
public
void
setStoreForm
(
StoreForm
storeForm
)
{
this
.
storeForm
=
storeForm
;
}
return
adapt
;
public
StoreForm
getStoreFormMobile
()
{
return
storeFormMobile
;
}
public
static
class
AdaptForm
extends
GsonPropertyObject
{
public
void
setStoreFormMobile
(
StoreForm
storeFormMobile
)
{
this
.
storeFormMobile
=
storeFormMobile
;
}
private
Form
form
;
public
static
class
StoreForm
extends
GsonPropertyObject
{
private
Map
<
String
,
Form
>
relatedFormMap
=
new
HashMap
<>()
;
private
static
final
long
serialVersionUID
=
6402145056972301805L
;
private
Map
<
String
,
Script
>
relatedScriptMap
=
new
HashMap
<>()
;
private
RelatedForm
form
;
public
Form
getForm
()
{
private
Map
<
String
,
RelatedForm
>
relatedFormMap
=
new
HashMap
<>();
private
Map
<
String
,
RelatedScript
>
relatedScriptMap
=
new
HashMap
<>();
public
RelatedForm
getForm
()
{
return
form
;
}
public
void
setForm
(
Form
form
)
{
public
void
setForm
(
Related
Form
form
)
{
this
.
form
=
form
;
}
public
Map
<
String
,
Form
>
getRelatedFormMap
()
{
public
Map
<
String
,
Related
Form
>
getRelatedFormMap
()
{
return
relatedFormMap
;
}
public
void
setRelatedFormMap
(
Map
<
String
,
Form
>
relatedFormMap
)
{
public
void
setRelatedFormMap
(
Map
<
String
,
Related
Form
>
relatedFormMap
)
{
this
.
relatedFormMap
=
relatedFormMap
;
}
public
Map
<
String
,
Script
>
getRelatedScriptMap
()
{
public
Map
<
String
,
Related
Script
>
getRelatedScriptMap
()
{
return
relatedScriptMap
;
}
public
void
setRelatedScriptMap
(
Map
<
String
,
Script
>
relatedScriptMap
)
{
public
void
setRelatedScriptMap
(
Map
<
String
,
Related
Script
>
relatedScriptMap
)
{
this
.
relatedScriptMap
=
relatedScriptMap
;
}
}
public
static
class
Script
extends
GsonPropertyObject
{
public
static
class
RelatedScript
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
4695405501650343555L
;
public
static
final
String
TYPE_PROCESSPLATFORM
=
"processPlatform"
;
public
static
final
String
TYPE_CMS
=
"cms"
;
public
static
final
String
TYPE_PORTAL
=
"portal"
;
public
RelatedScript
()
{
}
public
RelatedScript
(
String
id
,
String
name
,
String
alias
,
String
text
,
String
type
)
{
this
.
id
=
id
;
this
.
alias
=
alias
;
this
.
name
=
name
;
this
.
text
=
text
;
this
.
type
=
type
;
}
private
String
type
;
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
type
;
private
String
text
;
public
String
getId
()
{
...
...
@@ -276,4 +228,87 @@ public class WorkCompletedProperties extends JsonProperties {
}
public
static
class
RelatedForm
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
8345275108890011204L
;
public
RelatedForm
()
{
}
public
RelatedForm
(
Form
form
,
String
data
)
{
this
.
id
=
form
.
getId
();
this
.
alias
=
form
.
getAlias
();
this
.
name
=
form
.
getName
();
this
.
category
=
form
.
getCategory
();
this
.
application
=
form
.
getApplication
();
this
.
hasMobile
=
form
.
getHasMobile
();
this
.
data
=
data
;
}
private
String
id
;
private
String
alias
;
private
String
name
;
private
String
category
;
private
String
application
;
private
Boolean
hasMobile
;
private
String
data
;
public
String
getCategory
()
{
return
category
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
public
String
getApplication
()
{
return
application
;
}
public
void
setApplication
(
String
application
)
{
this
.
application
=
application
;
}
public
Boolean
getHasMobile
()
{
return
hasMobile
;
}
public
void
setHasMobile
(
Boolean
hasMobile
)
{
this
.
hasMobile
=
hasMobile
;
}
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
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
}
}
o2server/x_processplatform_service_processing/pom.xml
浏览文件 @
9b3882d3
...
...
@@ -36,6 +36,10 @@
<groupId>
o2oa
</groupId>
<artifactId>
x_processplatform_core_express
</artifactId>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_portal_core_entity
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/workcompleted/ActionMerge.java
浏览文件 @
9b3882d3
...
...
@@ -4,6 +4,9 @@ import java.util.ArrayList;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
...
...
@@ -30,7 +33,13 @@ import com.x.processplatform.core.entity.content.Record;
import
com.x.processplatform.core.entity.content.Review
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.StoreForm
;
import
com.x.processplatform.core.entity.content.WorkLog
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.query.core.entity.Item
;
...
...
@@ -80,6 +89,19 @@ class ActionMerge extends BaseAction {
List
<
Read
>
reads
=
new
ArrayList
<>();
List
<
DocumentVersion
>
documentVersions
=
new
ArrayList
<>();
if
(
null
!=
workCompleted
)
{
Form
form
=
business
.
element
().
get
(
workCompleted
.
getForm
(),
Form
.
class
);
if
(
null
!=
form
)
{
StoreForm
storeForm
=
new
StoreForm
();
StoreForm
storeFormMobile
=
new
StoreForm
();
storeForm
.
setForm
(
new
RelatedForm
(
form
,
form
.
getDataOrMobileData
()));
storeFormMobile
.
setForm
(
new
RelatedForm
(
form
,
form
.
getMobileDataOrData
()));
CompletableFuture
.
allOf
(
relateForm
(
business
,
form
,
storeForm
),
relateScript
(
business
,
form
,
storeForm
),
relateFormMobile
(
business
,
form
,
storeForm
),
relateScriptMobile
(
business
,
form
,
storeForm
)).
get
();
workCompleted
.
getProperties
().
setStoreForm
(
storeForm
);
workCompleted
.
getProperties
().
setStoreFormMobile
(
storeFormMobile
);
}
CompletableFuture
.
allOf
(
mergeItem
(
business
,
workCompleted
,
items
),
mergeTaskCompleted
(
business
,
workCompleted
,
taskCompleteds
),
mergeReadCompleted
(
business
,
workCompleted
,
readCompleteds
),
...
...
@@ -339,6 +361,122 @@ class ActionMerge extends BaseAction {
}
});
}
private
CompletableFuture
<
Void
>
relateForm
(
Business
business
,
Form
form
,
StoreForm
storeForm
)
{
return
CompletableFuture
.
runAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getRelatedFormList
())
{
_f
=
business
.
element
().
get
(
_id
,
Form
.
class
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getDataOrMobileData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
storeForm
.
setRelatedFormMap
(
map
);
});
}
private
CompletableFuture
<
Void
>
relateScript
(
Business
business
,
Form
form
,
StoreForm
storeForm
)
{
return
CompletableFuture
.
runAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
business
.
element
().
get
(
entry
.
getKey
(),
Script
.
class
);
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
business
.
element
().
get
(
entry
.
getKey
(),
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_portal
=
business
.
element
().
get
(
entry
.
getKey
(),
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
);
if
(
null
!=
_portal
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_portal
.
getId
(),
_portal
.
getName
(),
_portal
.
getAlias
(),
_portal
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
storeForm
.
setRelatedScriptMap
(
map
);
});
}
private
CompletableFuture
<
Void
>
relateFormMobile
(
Business
business
,
Form
form
,
StoreForm
storeForm
)
{
return
CompletableFuture
.
runAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
_f
=
business
.
element
().
get
(
_id
,
Form
.
class
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getMobileDataOrData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
storeForm
.
setRelatedFormMap
(
map
);
});
}
private
CompletableFuture
<
Void
>
relateScriptMobile
(
Business
business
,
Form
form
,
StoreForm
storeForm
)
{
return
CompletableFuture
.
runAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getMobileRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
business
.
element
().
get
(
entry
.
getKey
(),
Script
.
class
);
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
business
.
element
().
get
(
entry
.
getKey
(),
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_portal
=
business
.
element
().
get
(
entry
.
getKey
(),
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
);
if
(
null
!=
_portal
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_portal
.
getId
(),
_portal
.
getName
(),
_portal
.
getAlias
(),
_portal
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
storeForm
.
setRelatedScriptMap
(
map
);
});
}
}
}
\ No newline at end of file
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/end/EndProcessor.java
浏览文件 @
9b3882d3
...
...
@@ -4,6 +4,10 @@ import java.util.ArrayList;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
java.util.concurrent.CompletableFuture
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -14,9 +18,14 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties.StoreForm
;
import
com.x.processplatform.core.entity.element.End
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Route
;
import
com.x.processplatform.core.entity.element.Script
;
import
com.x.processplatform.core.entity.log.Signal
;
import
com.x.processplatform.service.processing.Business
;
import
com.x.processplatform.service.processing.processor.AeiObjects
;
...
...
@@ -66,7 +75,7 @@ public class EndProcessor extends AbstractEndProcessor {
aeiObjects
.
getDeleteWorkLogs
().
add
(
obj
);
});
}
else
{
WorkCompleted
workCompleted
=
this
.
createWorkCompleted
(
aeiObjects
.
getWork
(),
end
);
WorkCompleted
workCompleted
=
this
.
createWorkCompleted
(
aeiObjects
,
aeiObjects
.
getWork
(),
end
);
workCompleted
.
setAllowRollback
(
end
.
getAllowRollback
());
aeiObjects
.
getCreateWorkCompleteds
().
add
(
workCompleted
);
aeiObjects
.
getTasks
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteTasks
().
add
(
o
));
...
...
@@ -167,7 +176,7 @@ public class EndProcessor extends AbstractEndProcessor {
}
/* 根据work和data创建最终保存的workCompleted */
private
WorkCompleted
createWorkCompleted
(
Work
work
,
End
end
)
throws
Exception
{
private
WorkCompleted
createWorkCompleted
(
AeiObjects
aeiObjects
,
Work
work
,
End
end
)
throws
Exception
{
Date
completedTime
=
new
Date
();
Long
duration
=
Config
.
workTime
().
betweenMinutes
(
work
.
getStartTime
(),
completedTime
);
WorkCompleted
workCompleted
=
new
WorkCompleted
(
work
,
completedTime
,
duration
);
...
...
@@ -176,9 +185,126 @@ public class EndProcessor extends AbstractEndProcessor {
workCompleted
.
setActivityDescription
(
end
.
getDescription
());
workCompleted
.
setActivityName
(
end
.
getName
());
if
(
StringUtils
.
isNotEmpty
(
work
.
getForm
()))
{
Form
form
=
this
.
entityManagerContainer
().
find
(
work
.
getForm
(),
Form
.
class
);
this
.
entityManagerContainer
().
get
(
Form
.
class
).
detach
(
form
);
workCompleted
.
getProperties
().
setForm
(
form
);
Form
form
=
(
aeiObjects
.
business
().
element
().
get
(
work
.
getForm
(),
Form
.
class
));
if
(
null
!=
form
)
{
StoreForm
storeForm
=
new
StoreForm
();
StoreForm
storeFormMobile
=
new
StoreForm
();
storeForm
.
setForm
(
new
RelatedForm
(
form
,
form
.
getDataOrMobileData
()));
storeFormMobile
.
setForm
(
new
RelatedForm
(
form
,
form
.
getMobileDataOrData
()));
CompletableFuture
<
Map
<
String
,
RelatedForm
>>
_relatedForm
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getRelatedFormList
())
{
_f
=
aeiObjects
.
business
().
element
().
get
(
_id
,
Form
.
class
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getDataOrMobileData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
CompletableFuture
<
Map
<
String
,
RelatedScript
>>
_relatedScript
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getRelatedScriptMap
().
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
aeiObjects
.
business
().
element
().
get
(
entry
.
getKey
(),
Script
.
class
);
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
aeiObjects
.
business
().
element
()
.
get
(
entry
.
getKey
(),
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_portal
=
aeiObjects
.
business
().
element
()
.
get
(
entry
.
getKey
(),
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
);
if
(
null
!=
_portal
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_portal
.
getId
(),
_portal
.
getName
(),
_portal
.
getAlias
(),
_portal
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
CompletableFuture
<
Map
<
String
,
RelatedForm
>>
_relatedFormMobile
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedForm
>
map
=
new
TreeMap
<>();
try
{
Form
_f
;
for
(
String
_id
:
form
.
getProperties
().
getMobileRelatedFormList
())
{
_f
=
aeiObjects
.
business
().
element
().
get
(
_id
,
Form
.
class
);
if
(
null
!=
_f
)
{
map
.
put
(
_id
,
new
RelatedForm
(
_f
,
_f
.
getMobileDataOrData
()));
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
CompletableFuture
<
Map
<
String
,
RelatedScript
>>
_relatedScriptMobile
=
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
RelatedScript
>
map
=
new
TreeMap
<>();
try
{
for
(
Entry
<
String
,
String
>
entry
:
form
.
getProperties
().
getMobileRelatedScriptMap
()
.
entrySet
())
{
switch
(
entry
.
getValue
())
{
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PROCESSPLATFORM
:
Script
_pp
=
aeiObjects
.
business
().
element
().
get
(
entry
.
getKey
(),
Script
.
class
);
if
(
null
!=
_pp
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_pp
.
getId
(),
_pp
.
getName
(),
_pp
.
getAlias
(),
_pp
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_CMS
:
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
_cms
=
aeiObjects
.
business
().
element
()
.
get
(
entry
.
getKey
(),
com
.
x
.
cms
.
core
.
entity
.
element
.
Script
.
class
);
if
(
null
!=
_cms
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_cms
.
getId
(),
_cms
.
getName
(),
_cms
.
getAlias
(),
_cms
.
getText
(),
entry
.
getValue
()));
}
break
;
case
WorkCompletedProperties
.
RelatedScript
.
TYPE_PORTAL
:
com
.
x
.
portal
.
core
.
entity
.
Script
_portal
=
aeiObjects
.
business
().
element
()
.
get
(
entry
.
getKey
(),
com
.
x
.
portal
.
core
.
entity
.
Script
.
class
);
if
(
null
!=
_portal
)
{
map
.
put
(
entry
.
getKey
(),
new
RelatedScript
(
_portal
.
getId
(),
_portal
.
getName
(),
_portal
.
getAlias
(),
_portal
.
getText
(),
entry
.
getValue
()));
}
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
return
map
;
});
storeForm
.
setRelatedFormMap
(
_relatedForm
.
get
());
storeForm
.
setRelatedScriptMap
(
_relatedScript
.
get
());
storeFormMobile
.
setRelatedFormMap
(
_relatedFormMobile
.
get
());
storeFormMobile
.
setRelatedScriptMap
(
_relatedScriptMobile
.
get
());
workCompleted
.
getProperties
().
setStoreForm
(
storeForm
);
workCompleted
.
getProperties
().
setStoreFormMobile
(
storeFormMobile
);
}
}
return
workCompleted
;
}
...
...
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/SelectEntries.java
浏览文件 @
9b3882d3
...
...
@@ -16,7 +16,7 @@ public class SelectEntries extends TreeList<SelectEntry> {
public
Boolean
emptyColumnCode
()
{
for
(
SelectEntry
en
:
this
)
{
if
(
StringUtils
.
isNot
Empty
(
en
.
code
))
{
if
(
StringUtils
.
isNot
Blank
(
en
.
code
))
{
return
false
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录