Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
d045c084
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,发现更多精彩内容 >>
提交
d045c084
编写于
10月 27, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加WoFastETag
上级
6a3e614d
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
431 addition
and
185 deletion
+431
-185
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/ResponseFactory.java
...n/java/com/x/base/core/project/jaxrs/ResponseFactory.java
+26
-12
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFastETag.java
...c/main/java/com/x/base/core/project/jaxrs/WoFastETag.java
+16
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java
...t/src/main/java/com/x/base/core/project/jaxrs/WoFile.java
+1
-2
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java
...t/src/main/java/com/x/base/core/project/jaxrs/WoText.java
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java
...e/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java
+48
-13
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
.../surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
+36
-19
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
...ce/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
+33
-19
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java
...ocessplatform/assemble/surface/jaxrs/form/BaseAction.java
+2
-4
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java
...ocessplatform/assemble/surface/jaxrs/form/FormAction.java
+2
-3
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java
...rface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java
+43
-25
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java
...jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java
+49
-29
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionGet.java
...rocessplatform/assemble/surface/jaxrs/snap/ActionGet.java
+51
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java
...tform/assemble/surface/jaxrs/snap/ActionListMyPaging.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java
...splatform/assemble/surface/jaxrs/snap/ActionListNext.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java
...ble/surface/jaxrs/snap/ActionListNextWithApplication.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java
...ssemble/surface/jaxrs/snap/ActionListNextWithProcess.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java
...splatform/assemble/surface/jaxrs/snap/ActionListPrev.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java
...ble/surface/jaxrs/snap/ActionListPrevWithApplication.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java
...ssemble/surface/jaxrs/snap/ActionListPrevWithProcess.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java
...mble/surface/jaxrs/snap/ActionManageListFilterPaging.java
+1
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java
...orm/assemble/surface/jaxrs/snap/ActionManageListNext.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java
...semble/surface/jaxrs/snap/ActionManageListNextFilter.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java
...orm/assemble/surface/jaxrs/snap/ActionManageListPrev.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java
...semble/surface/jaxrs/snap/ActionManageListPrevFilter.java
+3
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java
...ocessplatform/assemble/surface/jaxrs/snap/BaseAction.java
+14
-5
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java
...ocessplatform/assemble/surface/jaxrs/snap/SnapAction.java
+18
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java
.../surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java
+33
-11
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java
...face/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java
+24
-20
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/ResponseFactory.java
浏览文件 @
d045c084
package
com.x.base.core.project.jaxrs
;
import
java.net.URI
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.zip.CRC32
;
...
...
@@ -81,7 +80,7 @@ public class ResponseFactory {
}
}
else
{
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoFile
))
{
/
* 附件,二进制流文件 */
/
/ 附件,二进制流文件
WoFile
wo
=
(
WoFile
)
result
.
getData
();
EntityTag
tag
=
new
EntityTag
(
etagWoFile
(
wo
));
if
(
notModified
(
request
,
tag
))
{
...
...
@@ -91,14 +90,12 @@ public class ResponseFactory {
.
header
(
Content_Type
,
wo
.
getContentType
()).
header
(
Content_Length
,
wo
.
getBytes
().
length
)
.
header
(
Accept_Ranges
,
"bytes"
).
tag
(
tag
).
build
();
}
else
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoText
))
{
/
* 纯文本text */
/
/ 纯文本text
WoText
wo
=
(
WoText
)
result
.
getData
();
EntityTag
tag
=
new
EntityTag
(
etagWoText
(
wo
));
if
(
notModified
(
request
,
tag
))
{
return
Response
.
notModified
().
tag
(
tag
).
build
();
}
// return
// Response.ok(wo.getText()).type(HttpMediaType.TEXT_PLAIN_UTF_8).tag(tag).build();
return
Response
.
ok
(
wo
.
getText
()).
type
(
wo
.
getContentType
()).
tag
(
tag
).
build
();
}
else
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoContentType
))
{
WoContentType
wo
=
(
WoContentType
)
result
.
getData
();
...
...
@@ -108,10 +105,10 @@ public class ResponseFactory {
}
return
Response
.
ok
(
wo
.
getBody
()).
type
(
wo
.
getContentType
()).
tag
(
tag
).
build
();
}
else
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoCallback
))
{
/
* jsonp callback */
/
/ jsonp callback
return
Response
.
ok
(
callback
((
WoCallback
)
result
.
getData
())).
build
();
}
else
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoSeeOther
))
{
/
* 303 */
/
/ 303
WoSeeOther
wo
=
(
WoSeeOther
)
result
.
getData
();
try
{
return
Response
.
seeOther
(
new
URI
(
wo
.
getUrl
())).
build
();
...
...
@@ -119,7 +116,7 @@ public class ResponseFactory {
return
Response
.
serverError
().
entity
(
Objects
.
toString
(
wo
.
getUrl
(),
""
)).
build
();
}
}
else
if
((
null
!=
result
.
getData
())
&&
(
result
.
getData
()
instanceof
WoTemporaryRedirect
))
{
/
* 304 */
/
/ 304
WoTemporaryRedirect
wo
=
(
WoTemporaryRedirect
)
result
.
getData
();
try
{
return
Response
.
temporaryRedirect
(
new
URI
(
wo
.
getUrl
())).
build
();
...
...
@@ -127,7 +124,7 @@ public class ResponseFactory {
return
Response
.
serverError
().
entity
(
Objects
.
toString
(
wo
.
getUrl
(),
""
)).
build
();
}
}
else
{
/
* default */
/
/ default
EntityTag
tag
=
new
EntityTag
(
etagDefault
(
result
.
getData
()));
if
(
notModified
(
request
,
tag
))
{
return
Response
.
notModified
().
tag
(
tag
).
build
();
...
...
@@ -149,7 +146,11 @@ public class ResponseFactory {
private
static
String
etagWoFile
(
WoFile
wo
)
{
CRC32
crc
=
new
CRC32
();
crc
.
update
(
wo
.
getBytes
());
if
(
StringUtils
.
isNotEmpty
(
wo
.
getFastETag
()))
{
crc
.
update
(
wo
.
getFastETag
().
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
else
{
crc
.
update
(
wo
.
getBytes
());
}
return
crc
.
getValue
()
+
""
;
}
...
...
@@ -161,13 +162,26 @@ public class ResponseFactory {
private
static
String
etagWoText
(
WoText
wo
)
{
CRC32
crc
=
new
CRC32
();
crc
.
update
(
wo
.
getText
().
getBytes
(
DefaultCharset
.
charset_utf_8
));
if
(
StringUtils
.
isNotEmpty
(
wo
.
getFastETag
()))
{
crc
.
update
(
wo
.
getFastETag
().
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
else
{
crc
.
update
(
wo
.
getText
().
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
return
crc
.
getValue
()
+
""
;
}
private
static
String
etagDefault
(
Object
o
)
{
CRC32
crc
=
new
CRC32
();
crc
.
update
(
XGsonBuilder
.
toJson
(
o
).
getBytes
(
DefaultCharset
.
charset_utf_8
));
if
(
o
instanceof
WoFastETag
)
{
WoFastETag
fast
=
((
WoFastETag
)
o
);
if
(
StringUtils
.
isNotEmpty
(
fast
.
getFastETag
()))
{
crc
.
update
(
fast
.
getFastETag
().
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
else
{
crc
.
update
(
XGsonBuilder
.
toJson
(
o
).
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
}
else
{
crc
.
update
(
XGsonBuilder
.
toJson
(
o
).
getBytes
(
DefaultCharset
.
charset_utf_8
));
}
return
crc
.
getValue
()
+
""
;
}
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFastETag.java
0 → 100644
浏览文件 @
d045c084
package
com.x.base.core.project.jaxrs
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
class
WoFastETag
extends
GsonPropertyObject
{
private
String
fastETag
;
public
String
getFastETag
()
{
return
fastETag
;
}
public
void
setFastETag
(
String
fastETag
)
{
this
.
fastETag
=
fastETag
;
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java
浏览文件 @
d045c084
package
com.x.base.core.project.jaxrs
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
public
abstract
class
WoFile
extends
GsonPropertyObject
{
public
abstract
class
WoFile
extends
WoFastETag
{
private
static
final
long
serialVersionUID
=
-
4566232046358204025L
;
@FieldDescribe
(
"说明"
)
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java
浏览文件 @
d045c084
...
...
@@ -6,7 +6,7 @@ import com.x.base.core.project.annotation.FieldDescribe;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.HttpMediaType
;
public
class
WoText
extends
GsonPropertyObject
{
public
class
WoText
extends
WoFastETag
{
public
WoText
()
{
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java
浏览文件 @
d045c084
...
...
@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.control;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
import
org.apache.commons.lang3.BooleanUtils
;
...
...
@@ -50,23 +51,57 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
Wo
wo
=
null
;
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
CompletableFuture
<
Wo
>
_wo
=
CompletableFuture
.
supplyAsync
(()
->
{
Wo
wo
=
null
;
try
{
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
if
(
null
!=
work
)
{
wo
=
this
.
work
(
business
,
effectivePerson
,
work
);
}
else
{
wo
=
this
.
workCompleted
(
business
,
effectivePerson
,
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
(
null
!=
work
)
{
wo
=
this
.
work
(
business
,
effectivePerson
,
work
);
}
else
{
wo
=
this
.
workCompleted
(
business
,
effectivePerson
,
emc
.
flag
(
workOrWorkCompleted
,
WorkCompleted
.
class
));
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
result
.
setData
(
wo
);
result
.
setData
(
_wo
.
get
()
);
return
result
;
// if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted,
// new ExceptionEntityNotExist(workOrWorkCompleted))) {
// throw new ExceptionAccessDenied(effectivePerson);
// }
//
// Wo wo = null;
//
// Work work = emc.find(workOrWorkCompleted, Work.class);
//
// if (null != work) {
// wo = this.work(business, effectivePerson, work);
// } else {
// wo = this.workCompleted(business, effectivePerson, emc.flag(workOrWorkCompleted, WorkCompleted.class));
// }
//
// result.setData(wo);
// return result;
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
d045c084
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.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.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.DateTools
;
import
com.x.base.core.project.tools.PropertyTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Work
;
...
...
@@ -27,29 +28,43 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGetWithWorkOrWorkCompleted
.
class
);
ActionResult
<
JsonElement
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Audit
audit
=
logger
.
audit
(
effectivePerson
);
ActionResult
<
JsonElement
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
JsonElement
wo
=
null
;
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
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
(
null
!=
work
)
{
wo
=
gson
.
toJsonTree
(
this
.
work
(
business
,
work
));
}
else
{
wo
=
gson
.
toJsonTree
(
this
.
workCompleted
(
business
,
emc
.
flag
(
workOrWorkCompleted
,
WorkCompleted
.
class
)));
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
audit
.
log
(
null
,
"查看"
);
result
.
setData
(
wo
);
result
.
setData
(
_wo
.
get
()
);
return
result
;
}
}
...
...
@@ -65,6 +80,7 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
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
);
}
}
...
...
@@ -78,6 +94,7 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
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
())
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java
浏览文件 @
d045c084
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.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.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
;
...
...
@@ -27,29 +27,43 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGetWithWorkOrWorkCompletedMobile
.
class
);
ActionResult
<
JsonElement
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Audit
audit
=
logger
.
audit
(
effectivePerson
);
ActionResult
<
JsonElement
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
JsonElement
wo
=
null
;
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
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
(
null
!=
work
)
{
wo
=
gson
.
toJsonTree
(
this
.
work
(
business
,
work
));
}
else
{
wo
=
gson
.
toJsonTree
(
this
.
workCompleted
(
business
,
emc
.
flag
(
workOrWorkCompleted
,
WorkCompleted
.
class
)));
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
audit
.
log
(
null
,
"查看"
);
result
.
setData
(
wo
);
result
.
setData
(
_wo
.
get
()
);
return
result
;
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java
浏览文件 @
d045c084
...
...
@@ -2,12 +2,11 @@ package com.x.processplatform.assemble.surface.jaxrs.form;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
com.x.base.core.project.cache.ApplicationCache
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.
processplatform.assemble.surface.Business
;
import
com.x.
base.core.project.jaxrs.WoFastETag
;
import
com.x.processplatform.core.entity.content.WorkCompletedProperties
;
import
com.x.processplatform.core.entity.element.Form
;
import
com.x.processplatform.core.entity.element.Script
;
...
...
@@ -186,7 +185,7 @@ abstract class BaseAction extends StandardJaxrsAction {
}
public
static
class
AbstractWo
extends
GsonPropertyObject
{
public
static
class
AbstractWo
extends
WoFastETag
{
private
String
id
;
...
...
@@ -228,7 +227,6 @@ abstract class BaseAction extends StandardJaxrsAction {
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
浏览文件 @
d045c084
...
...
@@ -11,7 +11,6 @@ import javax.ws.rs.container.Suspended;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
import
com.x.base.core.project.annotation.JaxrsParameterDescribe
;
...
...
@@ -37,7 +36,7 @@ public class FormAction extends StandardJaxrsAction {
public
void
getWithWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
JsonElement
>
result
=
new
ActionResult
<>();
ActionResult
<
ActionGetWithWorkOrWorkCompleted
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithWorkOrWorkCompleted
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
...
...
@@ -56,7 +55,7 @@ public class FormAction extends StandardJaxrsAction {
public
void
getWithWorkOrWorkCompletedMobile
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
)
{
ActionResult
<
JsonElement
>
result
=
new
ActionResult
<>();
ActionResult
<
ActionGetWithWorkOrWorkCompletedMobile
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGetWithWorkOrWorkCompletedMobile
().
execute
(
effectivePerson
,
workOrWorkCompleted
);
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java
浏览文件 @
d045c084
...
...
@@ -3,8 +3,11 @@ package com.x.processplatform.assemble.surface.jaxrs.record;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
...
...
@@ -32,35 +35,50 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
String
job
=
business
.
job
().
findWithWork
(
workOrWorkCompleted
);
List
<
Wo
>
wos
=
new
ArrayList
<>();
if
(
null
!=
job
)
{
wos
=
emc
.
fetchEqual
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
);
}
else
{
job
=
business
.
job
().
findWithWorkCompleted
(
workOrWorkCompleted
);
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
job
);
if
(
ListTools
.
isNotEmpty
(
workCompleted
.
getProperties
().
getRecordList
()))
{
wos
=
Wo
.
copier
.
copy
(
workCompleted
.
getProperties
().
getRecordList
());
}
else
{
wos
=
emc
.
fetchEqual
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
);
CompletableFuture
<
List
<
Wo
>>
_wos
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
Wo
>
wos
=
new
ArrayList
<>();
try
{
String
job
=
business
.
job
().
findWithWork
(
workOrWorkCompleted
);
if
(
null
!=
job
)
{
wos
=
emc
.
fetchEqual
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
);
}
else
{
job
=
business
.
job
().
findWithWorkCompleted
(
workOrWorkCompleted
);
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
job
);
if
(
ListTools
.
isNotEmpty
(
workCompleted
.
getProperties
().
getRecordList
()))
{
wos
=
Wo
.
copier
.
copy
(
workCompleted
.
getProperties
().
getRecordList
());
}
else
{
wos
=
emc
.
fetchEqual
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
);
}
}
wos
=
wos
.
stream
().
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrder
)).
collect
(
Collectors
.
toList
());
for
(
Task
task
:
emc
.
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
).
stream
()
.
sorted
(
Comparator
.
comparing
(
Task:
:
getStartTime
)).
collect
(
Collectors
.
toList
()))
{
Record
record
=
this
.
taskToRecord
(
task
);
wos
.
add
(
Wo
.
copier
.
copy
(
record
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
}
wos
=
wos
.
stream
().
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrder
)).
collect
(
Collectors
.
toList
());
return
wos
;
});
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
;
});
for
(
Task
task
:
emc
.
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
).
stream
()
.
sorted
(
Comparator
.
comparing
(
Task:
:
getStartTime
)).
collect
(
Collectors
.
toList
()))
{
Record
record
=
this
.
taskToRecord
(
task
);
wos
.
add
(
Wo
.
copier
.
copy
(
record
));
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
result
.
setData
(
wos
);
result
.
setData
(
_wos
.
get
()
);
return
result
;
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java
浏览文件 @
d045c084
...
...
@@ -3,8 +3,11 @@ package com.x.processplatform.assemble.surface.jaxrs.record;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
...
...
@@ -33,39 +36,56 @@ class ActionListWithWorkOrWorkCompletedPaging extends BaseAction {
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
String
job
=
business
.
job
().
findWithWork
(
workOrWorkCompleted
);
List
<
Wo
>
wos
=
new
ArrayList
<>();
if
(
null
!=
job
)
{
wos
=
emc
.
fetchEqualAscPaging
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
,
page
,
size
,
Record
.
order_FIELDNAME
);
}
else
{
job
=
business
.
job
().
findWithWorkCompleted
(
workOrWorkCompleted
);
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
job
);
if
(
ListTools
.
isNotEmpty
(
workCompleted
.
getProperties
().
getRecordList
()))
{
List
<
Record
>
os
=
workCompleted
.
getProperties
().
getRecordList
();
int
start
=
(
page
-
1
)
*
size
;
start
=
Math
.
min
(
start
,
os
.
size
());
wos
=
Wo
.
copier
.
copy
(
os
.
stream
().
sorted
(
Comparator
.
comparing
(
Record:
:
getOrder
)).
skip
(
start
)
.
limit
(
size
).
collect
(
Collectors
.
toList
()));
}
else
{
wos
=
emc
.
fetchEqualAscPaging
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
,
page
,
size
,
Record
.
order_FIELDNAME
);
CompletableFuture
<
List
<
Wo
>>
_wos
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
Wo
>
wos
=
new
ArrayList
<>();
try
{
String
job
=
business
.
job
().
findWithWork
(
workOrWorkCompleted
);
if
(
null
!=
job
)
{
wos
=
emc
.
fetchEqualAscPaging
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
,
page
,
size
,
Record
.
order_FIELDNAME
);
}
else
{
job
=
business
.
job
().
findWithWorkCompleted
(
workOrWorkCompleted
);
WorkCompleted
workCompleted
=
emc
.
firstEqual
(
WorkCompleted
.
class
,
WorkCompleted
.
job_FIELDNAME
,
job
);
if
(
ListTools
.
isNotEmpty
(
workCompleted
.
getProperties
().
getRecordList
()))
{
List
<
Record
>
os
=
workCompleted
.
getProperties
().
getRecordList
();
int
start
=
(
page
-
1
)
*
size
;
start
=
Math
.
min
(
start
,
os
.
size
());
wos
=
Wo
.
copier
.
copy
(
os
.
stream
().
sorted
(
Comparator
.
comparing
(
Record:
:
getOrder
)).
skip
(
start
)
.
limit
(
size
).
collect
(
Collectors
.
toList
()));
}
else
{
wos
=
emc
.
fetchEqualAscPaging
(
Record
.
class
,
Wo
.
copier
,
Record
.
job_FIELDNAME
,
job
,
page
,
size
,
Record
.
order_FIELDNAME
);
}
}
for
(
Task
task
:
emc
.
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
).
stream
()
.
sorted
(
Comparator
.
comparing
(
Task:
:
getStartTime
)).
collect
(
Collectors
.
toList
()))
{
Record
record
=
this
.
taskToRecord
(
task
);
wos
.
add
(
Wo
.
copier
.
copy
(
record
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
}
return
wos
;
});
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
;
});
for
(
Task
task
:
emc
.
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
).
stream
()
.
sorted
(
Comparator
.
comparing
(
Task:
:
getStartTime
)).
collect
(
Collectors
.
toList
()))
{
Record
record
=
this
.
taskToRecord
(
task
);
wos
.
add
(
Wo
.
copier
.
copy
(
record
));
if
(
BooleanUtils
.
isFalse
(
_control
.
get
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
workOrWorkCompleted
);
}
result
.
setData
(
wos
);
result
.
setData
(
_wos
.
get
()
);
return
result
;
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionGet.java
0 → 100644
浏览文件 @
d045c084
package
com.x.processplatform.assemble.surface.jaxrs.snap
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionGet
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGet
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Snap
snap
=
emc
.
find
(
id
,
Snap
.
class
);
if
(
null
==
snap
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Snap
.
class
);
}
if
(!
allow
(
effectivePerson
,
business
,
snap
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
snap
);
}
result
.
setData
(
Wo
.
copier
.
copy
(
snap
));
}
return
result
;
}
private
boolean
allow
(
EffectivePerson
effectivePerson
,
Business
business
,
Snap
snap
)
throws
Exception
{
return
(
business
.
canManageApplicationOrProcess
(
effectivePerson
,
snap
.
getApplication
(),
snap
.
getProcess
())
||
effectivePerson
.
isNotPerson
(
snap
.
getPerson
()));
}
public
static
class
Wo
extends
Snap
{
private
static
final
long
serialVersionUID
=
-
2577413577740827608L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java
浏览文件 @
d045c084
...
...
@@ -12,6 +12,7 @@ import com.x.base.core.project.bean.WrapCopierFactory;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionListMyPaging
extends
BaseAction
{
...
...
@@ -31,8 +32,8 @@ class ActionListMyPaging extends BaseAction {
private
static
final
long
serialVersionUID
=
2279846765261247910L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java
浏览文件 @
d045c084
...
...
@@ -12,6 +12,7 @@ import com.x.base.core.project.bean.WrapCopierFactory;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionListNext
extends
BaseAction
{
...
...
@@ -28,8 +29,8 @@ class ActionListNext extends BaseAction {
public
static
class
Wo
extends
RankWo
{
private
static
final
long
serialVersionUID
=
6502735971303449356L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java
浏览文件 @
d045c084
...
...
@@ -17,6 +17,7 @@ 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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
import
com.x.processplatform.core.entity.content.Snap
;
import
com.x.processplatform.core.entity.element.Application
;
...
...
@@ -42,8 +43,8 @@ class ActionListNextWithApplication extends BaseAction {
private
static
final
long
serialVersionUID
=
3075270584151179370L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java
浏览文件 @
d045c084
...
...
@@ -13,6 +13,7 @@ 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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
import
com.x.processplatform.core.entity.element.Process
;
...
...
@@ -36,8 +37,8 @@ class ActionListNextWithProcess extends BaseAction {
private
static
final
long
serialVersionUID
=
2988668146783909521L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java
浏览文件 @
d045c084
...
...
@@ -12,6 +12,7 @@ import com.x.base.core.project.bean.WrapCopierFactory;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionListPrev
extends
BaseAction
{
...
...
@@ -28,8 +29,8 @@ class ActionListPrev extends BaseAction {
public
static
class
Wo
extends
RankWo
{
private
static
final
long
serialVersionUID
=
6502735971303449356L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java
浏览文件 @
d045c084
...
...
@@ -13,6 +13,7 @@ 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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
import
com.x.processplatform.core.entity.element.Application
;
...
...
@@ -36,8 +37,8 @@ class ActionListPrevWithApplication extends BaseAction {
private
static
final
long
serialVersionUID
=
3075270584151179370L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java
浏览文件 @
d045c084
...
...
@@ -13,6 +13,7 @@ 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.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
import
com.x.processplatform.core.entity.element.Process
;
...
...
@@ -36,8 +37,8 @@ class ActionListPrevWithProcess extends BaseAction {
private
static
final
long
serialVersionUID
=
2988668146783909521L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisibleIncludeProperites
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java
浏览文件 @
d045c084
...
...
@@ -21,6 +21,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionManageListFilterPaging
extends
BaseAction
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java
浏览文件 @
d045c084
...
...
@@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionManageListNext
extends
BaseAction
{
...
...
@@ -31,8 +32,8 @@ class ActionManageListNext extends BaseAction {
private
static
final
long
serialVersionUID
=
7593097665520980060L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java
浏览文件 @
d045c084
...
...
@@ -16,6 +16,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionManageListNextFilter
extends
BaseAction
{
...
...
@@ -42,8 +43,8 @@ class ActionManageListNextFilter extends BaseAction {
private
static
final
long
serialVersionUID
=
2279846765261247910L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java
浏览文件 @
d045c084
...
...
@@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionManageListPrev
extends
BaseAction
{
...
...
@@ -31,8 +32,8 @@ class ActionManageListPrev extends BaseAction {
private
static
final
long
serialVersionUID
=
7593097665520980060L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java
浏览文件 @
d045c084
...
...
@@ -16,6 +16,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
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.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo
;
import
com.x.processplatform.core.entity.content.Snap
;
class
ActionManageListPrevFilter
extends
BaseAction
{
...
...
@@ -42,8 +43,8 @@ class ActionManageListPrevFilter extends BaseAction {
private
static
final
long
serialVersionUID
=
2279846765261247910L
;
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Snap
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Snap
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Snap
.
class
,
true
,
true
),
null
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java
浏览文件 @
d045c084
...
...
@@ -11,7 +11,6 @@ import javax.persistence.criteria.Root;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.tools.ListTools
;
...
...
@@ -89,8 +88,9 @@ abstract class BaseAction extends StandardJaxrsAction {
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Snap_
.
application
),
application
.
getId
()));
return
p
;
}
protected
Predicate
myProcessFilter
(
EffectivePerson
effectivePerson
,
Business
business
,
Process
process
)
throws
Exception
{
protected
Predicate
myProcessFilter
(
EffectivePerson
effectivePerson
,
Business
business
,
Process
process
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Snap
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Snap
>
cq
=
cb
.
createQuery
(
Snap
.
class
);
...
...
@@ -100,7 +100,6 @@ abstract class BaseAction extends StandardJaxrsAction {
return
p
;
}
protected
class
FilterWi
{
@FieldDescribe
(
"应用id"
)
...
...
@@ -149,10 +148,20 @@ abstract class BaseAction extends StandardJaxrsAction {
}
protected
abstract
static
class
RankWo
extends
GsonPropertyObject
{
protected
abstract
static
class
RankWo
extends
Snap
{
private
Long
rank
;
private
static
final
long
serialVersionUID
=
2279846765261247910L
;
public
Long
getRank
()
{
return
rank
;
}
public
void
setRank
(
Long
rank
)
{
this
.
rank
=
rank
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java
浏览文件 @
d045c084
...
...
@@ -87,6 +87,24 @@ public class SnapAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取快照对象."
,
action
=
ActionGet
.
class
)
@GET
@Path
(
"{id}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
get
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
ActionGet
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGet
().
execute
(
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"删除快照"
,
action
=
ActionDelete
.
class
)
@DELETE
@Path
(
"{id}"
)
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
d045c084
...
...
@@ -45,18 +45,40 @@ class ActionGetWithWorkOrWorkCompleted 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
);
}
Wo
wo
=
null
;
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
if
(
null
!=
work
)
{
wo
=
this
.
work
(
business
,
effectivePerson
,
work
);
}
else
{
wo
=
this
.
workCompleted
(
business
,
effectivePerson
,
emc
.
flag
(
workOrWorkCompleted
,
WorkCompleted
.
class
));
CompletableFuture
<
Wo
>
_wo
=
CompletableFuture
.
supplyAsync
(()
->
{
Wo
wo
=
null
;
try
{
Work
work
=
emc
.
find
(
workOrWorkCompleted
,
Work
.
class
);
if
(
null
!=
work
)
{
wo
=
this
.
work
(
business
,
effectivePerson
,
work
);
}
else
{
wo
=
this
.
workCompleted
(
business
,
effectivePerson
,
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
);
result
.
setData
(
_wo
.
get
());
return
result
;
}
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java
浏览文件 @
d045c084
...
...
@@ -49,33 +49,42 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
Business
business
=
new
Business
(
emc
);
if
(!
business
.
readableWithWorkOrWorkCompleted
(
effectivePerson
,
workOrWorkCompleted
,
new
ExceptionEntityNotExist
(
workOrWorkCompleted
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
final
String
job
=
business
.
job
().
findWithWorkOrWorkCompleted
(
workOrWorkCompleted
);
CompletableFuture
<
List
<
WoTask
>>
future
_tasks
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
WoTask
>>
_tasks
=
CompletableFuture
.
supplyAsync
(()
->
{
return
this
.
tasks
(
business
,
job
);
});
CompletableFuture
<
List
<
WoTaskCompleted
>>
future
_taskCompleteds
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
WoTaskCompleted
>>
_taskCompleteds
=
CompletableFuture
.
supplyAsync
(()
->
{
return
this
.
taskCompleteds
(
business
,
job
);
});
CompletableFuture
<
List
<
WoRead
>>
future
_reads
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
WoRead
>>
_reads
=
CompletableFuture
.
supplyAsync
(()
->
{
return
this
.
reads
(
business
,
job
);
});
CompletableFuture
<
List
<
WoReadCompleted
>>
future
_readCompleteds
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
WoReadCompleted
>>
_readCompleteds
=
CompletableFuture
.
supplyAsync
(()
->
{
return
this
.
readCompleteds
(
business
,
job
);
});
CompletableFuture
<
List
<
WorkLog
>>
future
_workLogs
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
WorkLog
>>
_workLogs
=
CompletableFuture
.
supplyAsync
(()
->
{
return
this
.
workLogs
(
business
,
job
);
});
List
<
WoTask
>
tasks
=
future_tasks
.
get
();
List
<
WoTaskCompleted
>
taskCompleteds
=
future_taskCompleteds
.
get
();
List
<
WoRead
>
reads
=
future_reads
.
get
();
List
<
WoReadCompleted
>
readCompleteds
=
future_readCompleteds
.
get
();
List
<
WorkLog
>
workLogs
=
future_workLogs
.
get
();
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
);
}
List
<
WoTask
>
tasks
=
_tasks
.
get
();
List
<
WoTaskCompleted
>
taskCompleteds
=
_taskCompleteds
.
get
();
List
<
WoRead
>
reads
=
_reads
.
get
();
List
<
WoReadCompleted
>
readCompleteds
=
_readCompleteds
.
get
();
List
<
WorkLog
>
workLogs
=
_workLogs
.
get
();
WorkLogTree
tree
=
new
WorkLogTree
(
workLogs
);
...
...
@@ -137,11 +146,6 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
private
List
<
WoTask
>
tasks
(
Business
business
,
String
job
)
{
List
<
WoTask
>
os
=
new
ArrayList
<>();
try
{
// os = business.entityManagerContainer().fetchEqual(Task.class, WoTask.copier,
// WoTask.job_FIELDNAME, job)
// .stream().sorted(Comparator.comparing(Task::getStartTime,
// Comparator.nullsLast(Date::compareTo)))
// .collect(Collectors.toList());
os
=
WoTask
.
copier
.
copy
(
business
.
entityManagerContainer
().
listEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
job
)
.
stream
().
sorted
(
Comparator
.
comparing
(
Task:
:
getStartTime
,
Comparator
.
nullsLast
(
Date:
:
compareTo
)))
.
collect
(
Collectors
.
toList
()));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录