Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
891a0a62
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,发现更多精彩内容 >>
提交
891a0a62
编写于
11月 12, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cms增加获取doc的data接口(无权限限制)
上级
4a1b71bd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
128 addition
and
4 deletion
+128
-4
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocumentData.java
...le/control/jaxrs/document/ActionQueryGetDocumentData.java
+100
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListDocumentData.java
...e/control/jaxrs/document/ActionQueryListDocumentData.java
+5
-4
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java
...x/cms/assemble/control/jaxrs/document/DocumentAction.java
+23
-0
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocumentData.java
0 → 100644
浏览文件 @
891a0a62
package
com.x.cms.assemble.control.jaxrs.document
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.cache.Cache
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.cms.core.entity.Document
;
import
com.x.cms.core.entity.content.Data
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
public
class
ActionQueryGetDocumentData
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionQueryGetDocumentData
.
class
);
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
getDocumentQueryResult
(
id
);
result
.
setData
(
wo
);
return
result
;
}
private
Wo
getDocumentQueryResult
(
String
id
)
throws
Exception
{
Wo
wo
=
null
;
Cache
.
CacheKey
cacheKey
=
new
Cache
.
CacheKey
(
this
.
getClass
(),
id
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
wo
=
(
Wo
)
optional
.
get
();
}
else
{
Document
document
=
documentQueryService
.
get
(
id
);
wo
=
new
Wo
();
if
(
document
!=
null
)
{
WoDocument
woOutDocument
=
WoDocument
.
copier
.
copy
(
document
);
wo
.
setDocId
(
document
.
getId
());
wo
.
setDocument
(
woOutDocument
);
wo
.
setData
(
documentQueryService
.
getDocumentData
(
document
));
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wo
);
}
}
return
wo
;
}
public
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"文档ID."
)
private
String
docId
;
@FieldDescribe
(
"作为输出的CMS文档数据对象."
)
private
WoDocument
document
;
@FieldDescribe
(
"文档所有数据信息."
)
private
Data
data
;
public
String
getDocId
()
{
return
docId
;
}
public
void
setDocId
(
String
docId
)
{
this
.
docId
=
docId
;
}
public
WoDocument
getDocument
()
{
return
document
;
}
public
void
setDocument
(
WoDocument
document
)
{
this
.
document
=
document
;
}
public
Data
getData
()
{
return
data
;
}
public
void
setData
(
Data
data
)
{
this
.
data
=
data
;
}
}
public
static
class
WoDocument
extends
Document
{
private
static
final
long
serialVersionUID
=
-
5076990764713538973L
;
public
static
List
<
String
>
Excludes
=
new
ArrayList
<
String
>();
public
static
WrapCopier
<
Document
,
WoDocument
>
copier
=
WrapCopierFactory
.
wo
(
Document
.
class
,
WoDocument
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListDocumentData.java
浏览文件 @
891a0a62
...
...
@@ -46,10 +46,11 @@ public class ActionQueryListDocumentData extends BaseAction {
List
<
Wo
>
wos
=
new
ArrayList
<>();
Wo
wo
=
null
;
List
<
Document
>
docs
=
documentQueryService
.
list
(
ids
);
List
<
String
>
unitNames
=
userManagerService
.
listUnitNamesWithPerson
(
effectivePerson
.
getDistinguishedName
());
List
<
String
>
groupNames
=
userManagerService
.
listGroupNamesByPerson
(
effectivePerson
.
getDistinguishedName
());
//先不考虑阅读权限的问题
/*List<String> unitNames = userManagerService.listUnitNamesWithPerson(effectivePerson.getDistinguishedName());
List<String> groupNames = userManagerService.listGroupNamesByPerson(effectivePerson.getDistinguishedName());*/
for
(
Document
document
:
docs
){
if
(
this
.
hasReadPermission
(
business
,
document
,
unitNames
,
groupNames
,
effectivePerson
,
null
))
{
//
if(this.hasReadPermission(business, document, unitNames, groupNames, effectivePerson, null)) {
Cache
.
CacheKey
cacheKey
=
new
Cache
.
CacheKey
(
this
.
getClass
(),
document
.
getId
());
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
...
...
@@ -63,7 +64,7 @@ public class ActionQueryListDocumentData extends BaseAction {
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wo
);
}
wos
.
add
(
wo
);
}
//
}
}
return
wos
;
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java
浏览文件 @
891a0a62
...
...
@@ -695,4 +695,27 @@ public class DocumentAction extends StandardJaxrsAction{
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"查看文档数据."
,
action
=
ActionQueryGetDocumentData
.
class
)
@GET
@Path
(
"{id}/document/data"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
query_getDocumentData
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"信息文档ID"
)
@PathParam
(
"id"
)
String
id
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
ActionQueryGetDocumentData
.
Wo
>
result
=
new
ActionResult
<>();
Boolean
check
=
true
;
if
(
check
){
try
{
result
=
new
ActionQueryGetDocumentData
().
execute
(
request
,
effectivePerson
,
id
);
}
catch
(
Exception
e
)
{
result
=
new
ActionResult
<>();
result
.
error
(
e
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
}
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录