Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
422b6007
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,发现更多精彩内容 >>
提交
422b6007
编写于
9月 08, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加流程附件拷贝到已完成工作接口
上级
c68aff61
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
356 addition
and
0 deletion
+356
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
...e/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
+183
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java
...m/assemble/surface/jaxrs/attachment/AttachmentAction.java
+18
-0
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Attachment.java
...com/x/processplatform/core/entity/content/Attachment.java
+17
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/attachment/ActionCopyToWorkCompleted.java
...rocessing/jaxrs/attachment/ActionCopyToWorkCompleted.java
+120
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/attachment/AttachmentAction.java
...service/processing/jaxrs/attachment/AttachmentAction.java
+18
-0
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
0 → 100644
浏览文件 @
422b6007
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
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.Applications
;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.x_processplatform_service_processing
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
java.util.ArrayList
;
import
java.util.List
;
class
ActionCopyToWorkCompleted
extends
BaseAction
{
@ActionLogger
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCopyToWorkCompleted
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
workCompletedId
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
new
ArrayList
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
WorkCompleted
workCompleted
=
null
;
Req
req
=
new
Req
();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
workCompleted
=
emc
.
flag
(
workCompletedId
,
WorkCompleted
.
class
);
if
((
null
==
workCompleted
)){
throw
new
ExceptionEntityNotExist
(
workCompletedId
,
WorkCompleted
.
class
);
}
if
(!
business
.
canManageApplicationOrProcess
(
effectivePerson
,
workCompleted
.
getApplication
(),
workCompleted
.
getProcess
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
if
(
ListTools
.
isNotEmpty
(
wi
.
getAttachmentList
()))
{
for
(
WiAttachment
w
:
wi
.
getAttachmentList
())
{
Attachment
o
=
emc
.
find
(
w
.
getId
(),
Attachment
.
class
);
if
(
null
==
o
)
{
throw
new
ExceptionEntityNotExist
(
w
.
getId
(),
Attachment
.
class
);
}
if
(!
business
.
readableWithJob
(
effectivePerson
,
o
.
getJob
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
o
.
getJob
());
}
ReqAttachment
q
=
new
ReqAttachment
();
q
.
setId
(
o
.
getId
());
q
.
setName
(
w
.
getName
());
q
.
setSite
(
w
.
getSite
());
req
.
getAttachmentList
().
add
(
q
);
}
}
}
if
(
ListTools
.
isNotEmpty
(
req
.
getAttachmentList
()))
{
wos
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"attachment"
,
"copy"
,
"workcompleted"
,
workCompleted
.
getId
()),
req
,
workCompleted
.
getJob
())
.
getDataAsList
(
Wo
.
class
);
}
result
.
setData
(
wos
);
return
result
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"附件对象"
)
private
List
<
WiAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
WiAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
WiAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
public
static
class
ReqAttachment
extends
GsonPropertyObject
{
private
String
id
;
private
String
name
;
private
String
site
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getSite
()
{
return
site
;
}
public
void
setSite
(
String
site
)
{
this
.
site
=
site
;
}
}
public
static
class
Req
extends
GsonPropertyObject
{
List
<
ReqAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
ReqAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
ReqAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
public
static
class
WiAttachment
extends
GsonPropertyObject
{
private
String
id
;
private
String
name
;
private
String
site
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getSite
()
{
return
site
;
}
public
void
setSite
(
String
site
)
{
this
.
site
=
site
;
}
}
public
static
class
Wo
extends
WoId
{
}
public
static
class
WoWorkControl
extends
WorkControl
{
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java
浏览文件 @
422b6007
...
@@ -598,6 +598,24 @@ public class AttachmentAction extends StandardJaxrsAction {
...
@@ -598,6 +598,24 @@ public class AttachmentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
@JaxrsMethodDescribe
(
value
=
"由指定的工作拷贝附件."
,
action
=
ActionCopyToWorkCompleted
.
class
)
@POST
@Path
(
"copy/workcompleted/{workCompletedId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
copyToWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"已完成工作标识"
)
@PathParam
(
"workCompletedId"
)
String
workCompletedId
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionCopyToWorkCompleted
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionCopyToWorkCompleted
().
execute
(
effectivePerson
,
workCompletedId
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"更新附件."
,
action
=
ActionChangeSite
.
class
)
@JaxrsMethodDescribe
(
value
=
"更新附件."
,
action
=
ActionChangeSite
.
class
)
@GET
@GET
@Path
(
"{id}/work/{workId}/change/site/{site}"
)
@Path
(
"{id}/work/{workId}/change/site/{site}"
)
...
...
o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/Attachment.java
浏览文件 @
422b6007
...
@@ -92,6 +92,23 @@ public class Attachment extends StorageObject {
...
@@ -92,6 +92,23 @@ public class Attachment extends StorageObject {
this
.
setActivityType
(
work
.
getActivityType
());
this
.
setActivityType
(
work
.
getActivityType
());
}
}
public
Attachment
(
WorkCompleted
work
,
String
person
,
String
site
)
{
this
.
setCompleted
(
true
);
this
.
setWork
(
work
.
getWork
());
this
.
setWorkCompleted
(
work
.
getId
());
this
.
setPerson
(
person
);
this
.
setLastUpdatePerson
(
person
);
this
.
setSite
(
site
);
/** 用于判断目录的值 */
this
.
setWorkCreateTime
(
work
.
getStartTime
()
!=
null
?
work
.
getStartTime
()
:
new
Date
());
this
.
setApplication
(
work
.
getApplication
());
this
.
setProcess
(
work
.
getProcess
());
this
.
setJob
(
work
.
getJob
());
this
.
setActivity
(
work
.
getActivity
());
this
.
setActivityName
(
work
.
getActivityName
());
}
/** 更新运行方法 */
/** 更新运行方法 */
@Override
@Override
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/attachment/ActionCopyToWorkCompleted.java
0 → 100644
浏览文件 @
422b6007
package
com.x.processplatform.service.processing.jaxrs.attachment
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.ActionLogger
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.executor.ProcessPlatformExecutorFactory
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.service.processing.ThisApplication
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
/**
*
* @author zhour 复制指定的附件到work,仅拷贝内容,并清除其他附带的信息
*/
class
ActionCopyToWorkCompleted
extends
BaseAction
{
@ActionLogger
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCopyToWorkCompleted
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
workCompletedId
,
JsonElement
jsonElement
)
throws
Exception
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
String
executorSeed
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
WorkCompleted
work
=
emc
.
fetch
(
workCompletedId
,
WorkCompleted
.
class
,
ListTools
.
toList
(
WorkCompleted
.
job_FIELDNAME
));
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
workCompletedId
,
WorkCompleted
.
class
);
}
executorSeed
=
work
.
getJob
();
}
Callable
<
ActionResult
<
List
<
Wo
>>>
callable
=
new
Callable
<
ActionResult
<
List
<
Wo
>>>()
{
public
ActionResult
<
List
<
Wo
>>
call
()
throws
Exception
{
List
<
Wo
>
wos
=
new
ArrayList
<>();
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
WorkCompleted
work
=
emc
.
find
(
workCompletedId
,
WorkCompleted
.
class
);
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
workCompletedId
,
WorkCompleted
.
class
);
}
List
<
Attachment
>
adds
=
new
ArrayList
<>();
for
(
WiAttachment
w
:
ListTools
.
trim
(
wi
.
getAttachmentList
(),
true
,
true
))
{
Attachment
o
=
emc
.
find
(
w
.
getId
(),
Attachment
.
class
);
if
(
null
==
o
)
{
throw
new
ExceptionEntityNotExist
(
w
.
getId
(),
Attachment
.
class
);
}
StorageMapping
fromStorageMapping
=
ThisApplication
.
context
().
storageMappings
()
.
get
(
Attachment
.
class
,
o
.
getStorage
());
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
byte
[]
bs
=
o
.
readContent
(
fromStorageMapping
);
Attachment
attachment
=
new
Attachment
(
work
,
effectivePerson
.
getDistinguishedName
(),
w
.
getSite
());
attachment
.
saveContent
(
mapping
,
bs
,
w
.
getName
());
adds
.
add
(
attachment
);
}
if
(!
adds
.
isEmpty
())
{
emc
.
beginTransaction
(
Attachment
.
class
);
for
(
Attachment
o
:
adds
)
{
emc
.
persist
(
o
,
CheckPersistType
.
all
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
o
.
getId
());
wos
.
add
(
wo
);
}
emc
.
commit
();
}
}
result
.
setData
(
wos
);
return
result
;
}
};
return
ProcessPlatformExecutorFactory
.
get
(
executorSeed
).
submit
(
callable
).
get
();
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"附件对象"
)
private
List
<
WiAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
WiAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
WiAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
public
static
class
WiAttachment
extends
Attachment
{
private
static
final
long
serialVersionUID
=
5623475924507252797L
;
}
public
static
class
Wo
extends
WoId
{
}
}
\ No newline at end of file
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/attachment/AttachmentAction.java
浏览文件 @
422b6007
...
@@ -143,4 +143,22 @@ public class AttachmentAction extends StandardJaxrsAction {
...
@@ -143,4 +143,22 @@ public class AttachmentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
@JaxrsMethodDescribe
(
value
=
"由指定的工作拷贝附件."
,
action
=
ActionCopyToWorkCompleted
.
class
)
@POST
@Path
(
"copy/workcompleted/{workCompletedId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
copyToWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作标识"
)
@PathParam
(
"workCompletedId"
)
String
workCompletedId
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionCopyToWorkCompleted
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionCopyToWorkCompleted
().
execute
(
effectivePerson
,
workCompletedId
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录