Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
ecd61a17
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,发现更多精彩内容 >>
提交
ecd61a17
编写于
10月 14, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加管理员下载附件
上级
77f05c17
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
261 addition
and
39 deletion
+261
-39
o2server/configSample/node_127.0.0.1.json
o2server/configSample/node_127.0.0.1.json
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageDownload.java
...semble/surface/jaxrs/attachment/ActionManageDownload.java
+67
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageDownloadStream.java
.../surface/jaxrs/attachment/ActionManageDownloadStream.java
+60
-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
+48
-12
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java
...form/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java
+59
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/BaseAction.java
...in/java/com/x/program/center/jaxrs/invoke/BaseAction.java
+26
-26
未找到文件。
o2server/configSample/node_127.0.0.1.json
浏览文件 @
ecd61a17
...
...
@@ -108,7 +108,7 @@
"###excludes"
:
"在此节点上不存储的类,和includes一起设置实际存储的类,可以使用通配符*###"
,
"###jmxEnable"
:
"是否启动jmx,如果启用,可以通过本地的jmx客户端进行访问,不支持远程jmx客户端.###"
,
"###cacheSize"
:
"H2数据库缓存大小,设置H2用于作为缓存的内存大小,以M作为单位,这里默认为512M.###"
,
"###logLevel"
:
"默认日志级别###"
,
"###logLevel"
:
"默认日志级别
,FATAL, ERROR, WARN, INFO, TRACE. 完成的配置为DefaultLevel
\u
003dWARN, Tool
\u
003dTRACE, Enhance
\u
003dTRACE, METADATA
\u
003dTRACE, Runtime
\u
003dTRACE, Query
\u
003dTRACE, DataCache
\u
003dTRACE, JDBC
\u
003dTRACE, SQL
\u
003dTRACE
###"
,
"###maxTotal"
:
"最大使用连接数###"
,
"###maxIdle"
:
"最大空闲连接数###"
,
"###statEnable"
:
"启用统计,默认启用###"
,
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageDownload.java
0 → 100644
浏览文件 @
ecd61a17
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.util.Optional
;
import
org.apache.commons.io.FilenameUtils
;
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.config.Config
;
import
com.x.base.core.project.config.ProcessPlatform.WorkCompletedExtensionEvent
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.connection.CipherConnectionAction
;
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.jaxrs.WoFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkCompletedControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
/**
* 管理员下载
*
* @author zhour
*
*/
class
ActionManageDownload
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Attachment
attachment
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
attachment
=
emc
.
find
(
id
,
Attachment
.
class
);
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
if
(
BooleanUtils
.
isNotTrue
(
business
.
canManageApplicationOrProcess
(
effectivePerson
,
attachment
.
getApplication
(),
attachment
.
getProcess
())))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
attachment
);
}
}
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
Attachment
.
class
,
attachment
.
getStorage
());
String
fileName
=
attachment
.
getName
()
+
(
StringUtils
.
isNotEmpty
(
attachment
.
getExtension
())
?
"."
+
attachment
.
getExtension
()
:
""
);
byte
[]
bytes
=
attachment
.
readContent
(
mapping
);
Wo
wo
=
new
Wo
(
bytes
,
this
.
contentType
(
false
,
fileName
),
this
.
contentDisposition
(
false
,
fileName
));
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WoFile
{
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
super
(
bytes
,
contentType
,
contentDisposition
);
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageDownloadStream.java
0 → 100644
浏览文件 @
ecd61a17
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
org.apache.commons.io.FilenameUtils
;
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.config.StorageMapping
;
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.jaxrs.WoFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
/**
* 管理员下载
*
* @author zhour
*
*/
class
ActionManageDownloadStream
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Attachment
attachment
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
attachment
=
emc
.
find
(
id
,
Attachment
.
class
);
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
if
(
BooleanUtils
.
isNotTrue
(
business
.
canManageApplicationOrProcess
(
effectivePerson
,
attachment
.
getApplication
(),
attachment
.
getProcess
())))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
attachment
);
}
}
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
Attachment
.
class
,
attachment
.
getStorage
());
String
fileName
=
attachment
.
getName
()
+
(
StringUtils
.
isNotEmpty
(
attachment
.
getExtension
())
?
"."
+
attachment
.
getExtension
()
:
""
);
byte
[]
bytes
=
attachment
.
readContent
(
mapping
);
Wo
wo
=
new
Wo
(
bytes
,
this
.
contentType
(
true
,
fileName
),
this
.
contentDisposition
(
true
,
fileName
));
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WoFile
{
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
super
(
bytes
,
contentType
,
contentDisposition
);
}
}
}
\ No newline at end of file
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java
浏览文件 @
ecd61a17
...
...
@@ -18,6 +18,12 @@ import javax.ws.rs.container.Suspended;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
org.apache.commons.lang3.StringUtils
;
import
org.glassfish.jersey.media.multipart.FormDataBodyPart
;
import
org.glassfish.jersey.media.multipart.FormDataContentDisposition
;
import
org.glassfish.jersey.media.multipart.FormDataMultiPart
;
import
org.glassfish.jersey.media.multipart.FormDataParam
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
...
...
@@ -30,12 +36,6 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
org.apache.commons.lang3.StringUtils
;
import
org.glassfish.jersey.media.multipart.FormDataBodyPart
;
import
org.glassfish.jersey.media.multipart.FormDataContentDisposition
;
import
org.glassfish.jersey.media.multipart.FormDataMultiPart
;
import
org.glassfish.jersey.media.multipart.FormDataParam
;
@Path
(
"attachment"
)
@JaxrsDescribe
(
"附件操作"
)
public
class
AttachmentAction
extends
StandardJaxrsAction
{
...
...
@@ -103,7 +103,8 @@ public class AttachmentAction extends StandardJaxrsAction {
@Path
(
"{id}/workorworkcompleted/{workOrWorkCompleted}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
getWithWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
getWithWorkOrWorkCompleted
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"工作或已完成工作标识"
)
@PathParam
(
"workOrWorkCompleted"
)
String
workOrWorkCompleted
,
@JaxrsParameterDescribe
(
"附件标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
ActionGetWithWorkOrWorkCompleted
.
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -604,7 +605,8 @@ public class AttachmentAction extends StandardJaxrsAction {
@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
)
{
@JaxrsParameterDescribe
(
"已完成工作标识"
)
@PathParam
(
"workCompletedId"
)
String
workCompletedId
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionCopyToWorkCompleted
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
...
...
@@ -932,6 +934,40 @@ public class AttachmentAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员角色下载附件"
,
action
=
ActionManageDownload
.
class
)
@GET
@Path
(
"download/{id}/manage"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
manageDownload
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"附件标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
ActionManageDownload
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManageDownload
().
execute
(
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"管理员角色下载附件,stream"
,
action
=
ActionManageDownloadStream
.
class
)
@GET
@Path
(
"download/{id}/manage/stream"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
manageDownloadStream
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"附件标识"
)
@PathParam
(
"id"
)
String
id
)
{
ActionResult
<
ActionManageDownloadStream
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManageDownloadStream
().
execute
(
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"html转pdf工具类,转换后通过downloadTransfer接口下载"
,
action
=
ActionHtmlToPdf
.
class
)
@POST
@Path
(
"html/to/pdf"
)
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java
0 → 100644
浏览文件 @
ecd61a17
package
com.x.processplatform.assemble.surface.jaxrs.snap
;
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.project.Applications
;
import
com.x.base.core.project.x_processplatform_service_processing
;
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.jaxrs.WoId
;
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.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.element.Activity
;
class
ActionTypeAbandoned
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionTypeAbandoned
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workId
)
throws
Exception
{
String
job
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Work
work
=
emc
.
find
(
workId
,
Work
.
class
);
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
workId
,
Work
.
class
);
}
job
=
work
.
getJob
();
Activity
activity
=
business
.
getActivity
(
work
.
getActivity
(),
work
.
getActivityType
());
if
(
BooleanUtils
.
isNotTrue
(
business
.
canManageApplicationOrProcess
(
effectivePerson
,
work
.
getApplication
(),
work
.
getProcess
()))
&&
((!
business
.
editable
(
effectivePerson
,
work
))
||
(
BooleanUtils
.
isNotTrue
(
activity
.
getAllowSuspend
()))))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
}
Wo
wo
=
ThisApplication
.
context
().
applications
()
.
getQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"snap"
,
"work"
,
workId
,
"type"
,
"abandoned"
),
job
)
.
getData
(
Wo
.
class
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
-
2577413577740827608L
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/invoke/BaseAction.java
浏览文件 @
ecd61a17
...
...
@@ -10,31 +10,31 @@ import com.x.program.center.core.entity.Invoke;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
private
static
String
COMMENT
=
""
;
private
static
final
Pattern
COMMENT_REGEX
=
Pattern
.
compile
(
"^\\/\\*(\\s|.)*?\\*\\/"
);
static
{
COMMENT
=
"/*"
+
StringUtils
.
LF
;
COMMENT
+=
"* resources.getEntityManagerContainer() // 实体管理容器."
+
StringUtils
.
LF
;
COMMENT
+=
"* resources.getContext() //上下文根."
+
StringUtils
.
LF
;
COMMENT
+=
"* resources.getOrganization() //组织访问接口."
+
StringUtils
.
LF
;
COMMENT
+=
"* requestText //请求内容."
+
StringUtils
.
LF
;
COMMENT
+=
"* request //请求对象."
+
StringUtils
.
LF
;
COMMENT
+=
"*/"
+
StringUtils
.
LF
;
}
protected
void
addComment
(
Invoke
invoke
)
{
if
(
StringUtils
.
isEmpty
(
invoke
.
getText
()))
{
invoke
.
setText
(
COMMENT
);
}
else
{
Matcher
m
=
COMMENT_REGEX
.
matcher
(
invoke
.
getText
());
if
(
m
.
find
())
{
invoke
.
setText
(
COMMENT
+
m
.
replaceFirst
(
""
));
}
else
{
invoke
.
setText
(
COMMENT
+
invoke
.
getText
());
}
}
}
//
private static String COMMENT = "";
//
//
private static final Pattern COMMENT_REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
//
//
static {
//
COMMENT = "/*" + StringUtils.LF;
//
COMMENT += "* resources.getEntityManagerContainer() // 实体管理容器." + StringUtils.LF;
//
COMMENT += "* resources.getContext() //上下文根." + StringUtils.LF;
//
COMMENT += "* resources.getOrganization() //组织访问接口." + StringUtils.LF;
//
COMMENT += "* requestText //请求内容." + StringUtils.LF;
//
COMMENT += "* request //请求对象." + StringUtils.LF;
//
COMMENT += "*/" + StringUtils.LF;
//
}
//
//
protected void addComment(Invoke invoke) {
//
if (StringUtils.isEmpty(invoke.getText())) {
//
invoke.setText(COMMENT);
//
} else {
//
Matcher m = COMMENT_REGEX.matcher(invoke.getText());
//
if (m.find()) {
//
invoke.setText(COMMENT + m.replaceFirst(""));
//
} else {
//
invoke.setText(COMMENT + invoke.getText());
//
}
//
}
//
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录