Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
8e2e2c07
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
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,发现更多精彩内容 >>
提交
8e2e2c07
编写于
12月 17, 2021
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
内容管理员增加文档是否已阅和已阅记录分页查询接口
上级
c77e832a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
172 addition
and
0 deletion
+172
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryHasViewDocument.java
...le/control/jaxrs/document/ActionQueryHasViewDocument.java
+34
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListViewRecordPaging.java
...ntrol/jaxrs/document/ActionQueryListViewRecordPaging.java
+100
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentViewRecordAction.java
...mble/control/jaxrs/document/DocumentViewRecordAction.java
+38
-0
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryHasViewDocument.java
0 → 100644
浏览文件 @
8e2e2c07
package
com.x.cms.assemble.control.jaxrs.document
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.cms.core.entity.DocumentViewRecord
;
/**
* @author sword
*/
public
class
ActionQueryHasViewDocument
extends
BaseAction
{
protected
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
docId
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
false
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Long
count
=
emc
.
countEqualAndEqual
(
DocumentViewRecord
.
class
,
DocumentViewRecord
.
documentId_FIELDNAME
,
docId
,
DocumentViewRecord
.
viewerName_FIELDNAME
,
effectivePerson
.
getDistinguishedName
());
if
(
count
!=
null
&&
count
>
0
){
wo
.
setValue
(
true
);
}
}
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListViewRecordPaging.java
0 → 100644
浏览文件 @
8e2e2c07
package
com.x.cms.assemble.control.jaxrs.document
;
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.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.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.cms.assemble.control.Business
;
import
com.x.cms.core.entity.DocumentViewRecord
;
import
com.x.cms.core.entity.DocumentViewRecord_
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Tuple
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.List
;
class
ActionQueryListViewRecordPaging
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Predicate
p
=
this
.
toFilterPredicate
(
effectivePerson
,
business
,
wi
);
List
<
Wo
>
wos
=
wos
=
emc
.
fetchDescPaging
(
DocumentViewRecord
.
class
,
Wo
.
copier
,
p
,
page
,
size
,
DocumentViewRecord
.
createTime_FIELDNAME
);
result
.
setData
(
wos
);
result
.
setCount
(
emc
.
count
(
DocumentViewRecord
.
class
,
p
));
return
result
;
}
}
private
Predicate
toFilterPredicate
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
DocumentViewRecord
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Tuple
>
cq
=
cb
.
createQuery
(
Tuple
.
class
);
Root
<
DocumentViewRecord
>
root
=
cq
.
from
(
DocumentViewRecord
.
class
);
Predicate
p
=
cb
.
conjunction
();
if
(
StringUtils
.
isNotEmpty
(
wi
.
getDocId
())){
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
DocumentViewRecord_
.
documentId
),
wi
.
getDocId
()));
}
String
person
=
wi
.
getViewerName
();
if
(
StringUtils
.
isNotEmpty
(
person
)){
person
=
business
.
organization
().
person
().
get
(
person
);
if
(
StringUtils
.
isBlank
(
person
)){
person
=
wi
.
getViewerName
();
}
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
DocumentViewRecord_
.
viewerName
),
person
));
}
return
p
;
}
public
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"信息文档ID"
)
private
String
docId
;
@FieldDescribe
(
"阅读人"
)
private
String
viewerName
;
public
String
getDocId
()
{
return
docId
;
}
public
void
setDocId
(
String
docId
)
{
this
.
docId
=
docId
;
}
public
String
getViewerName
()
{
return
viewerName
;
}
public
void
setViewerName
(
String
viewerName
)
{
this
.
viewerName
=
viewerName
;
}
}
public
static
class
Wo
extends
DocumentViewRecord
{
private
static
final
long
serialVersionUID
=
236759724445785414L
;
static
WrapCopier
<
DocumentViewRecord
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
DocumentViewRecord
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
DocumentViewRecord
.
class
,
true
,
true
),
null
);
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentViewRecordAction.java
浏览文件 @
8e2e2c07
...
...
@@ -109,4 +109,42 @@ public class DocumentViewRecordAction extends StandardJaxrsAction{
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"根据文档ID查询当前用户是否有阅读记录."
,
action
=
ActionQueryHasViewDocument
.
class
)
@GET
@Path
(
"document/{docId}/has/view"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
hasViewDocument
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"信息文档ID"
)
@PathParam
(
"docId"
)
String
docId
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
ActionQueryHasViewDocument
.
Wo
>
result
=
null
;
try
{
result
=
new
ActionQueryHasViewDocument
().
execute
(
effectivePerson
,
docId
);
}
catch
(
Exception
e
)
{
result
=
new
ActionResult
<>();
result
.
error
(
e
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"分页查询阅读记录."
,
action
=
ActionQueryListViewRecordPaging
.
class
)
@POST
@Path
(
"list/install/log/paging/{page}/size/{size}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listPaging
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"分页"
)
@PathParam
(
"page"
)
Integer
page
,
@JaxrsParameterDescribe
(
"每页数量"
)
@PathParam
(
"size"
)
Integer
size
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionQueryListViewRecordPaging
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionQueryListViewRecordPaging
().
execute
(
effectivePerson
,
page
,
size
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
,
jsonElement
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录