Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
b8110e30
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,发现更多精彩内容 >>
提交
b8110e30
编写于
6月 09, 2021
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加cms操作日志分页查询接口
上级
4be08292
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
163 addition
and
13 deletion
+163
-13
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/log/ActionListPaging.java
...om/x/cms/assemble/control/jaxrs/log/ActionListPaging.java
+131
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/log/LogAction.java
.../java/com/x/cms/assemble/control/jaxrs/log/LogAction.java
+32
-13
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/log/ActionListPaging.java
0 → 100644
浏览文件 @
b8110e30
package
com.x.cms.assemble.control.jaxrs.log
;
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.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.cms.assemble.control.Business
;
import
com.x.cms.core.entity.Log
;
import
com.x.cms.core.entity.Log_
;
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
ActionListPaging
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
EntityManager
em
=
emc
.
get
(
Log
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Tuple
>
cq
=
cb
.
createQuery
(
Tuple
.
class
);
Root
<
Log
>
root
=
cq
.
from
(
Log
.
class
);
Predicate
p
=
cb
.
conjunction
();
if
(
ListTools
.
isNotEmpty
(
wi
.
getAppIdList
()))
{
p
=
cb
.
and
(
p
,
root
.
get
(
Log_
.
appId
).
in
(
wi
.
getAppIdList
()));
}
if
(
ListTools
.
isNotEmpty
(
wi
.
getCategoryIdList
()))
{
p
=
cb
.
and
(
p
,
root
.
get
(
Log_
.
categoryId
).
in
(
wi
.
getCategoryIdList
()));
}
if
(
ListTools
.
isNotEmpty
(
wi
.
getOperatorList
()))
{
List
<
String
>
person_ids
=
business
.
organization
().
person
().
list
(
wi
.
getOperatorList
());
if
(
ListTools
.
isNotEmpty
(
person_ids
))
{
p
=
cb
.
and
(
p
,
root
.
get
(
Log_
.
operatorUid
).
in
(
person_ids
));
}
}
if
(
StringUtils
.
isNotBlank
(
wi
.
getOperationType
()))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Log_
.
operationType
),
wi
.
getOperationType
()));
}
if
(
StringUtils
.
isNoneBlank
(
wi
.
getKey
()))
{
String
key
=
StringTools
.
escapeSqlLikeKey
(
wi
.
getKey
());
p
=
cb
.
and
(
p
,
cb
.
like
(
root
.
get
(
Log_
.
description
),
"%"
+
key
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
}
List
<
Wo
>
wos
=
emc
.
fetchDescPaging
(
Log
.
class
,
Wo
.
copier
,
p
,
page
,
size
,
Log
.
sequence_FIELDNAME
);
result
.
setData
(
wos
);
result
.
setCount
(
emc
.
count
(
Log
.
class
,
p
));
return
result
;
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
1713805760437845242L
;
@FieldDescribe
(
"用于过滤条件的栏目ID列表."
)
private
List
<
String
>
appIdList
;
@FieldDescribe
(
"用于过滤条件的分类ID列表."
)
private
List
<
String
>
categoryIdList
;
@FieldDescribe
(
"用于过滤条件的操作者列表."
)
private
List
<
String
>
operatorList
;
@FieldDescribe
(
"用于过滤条件的操作列别."
)
private
String
operationType
;
@FieldDescribe
(
"用于标题搜索的关键字."
)
private
String
key
;
public
List
<
String
>
getAppIdList
()
{
return
appIdList
;
}
public
void
setAppIdList
(
List
<
String
>
appIdList
)
{
this
.
appIdList
=
appIdList
;
}
public
List
<
String
>
getCategoryIdList
()
{
return
categoryIdList
;
}
public
void
setCategoryIdList
(
List
<
String
>
categoryIdList
)
{
this
.
categoryIdList
=
categoryIdList
;
}
public
List
<
String
>
getOperatorList
()
{
return
operatorList
;
}
public
void
setOperatorList
(
List
<
String
>
operatorList
)
{
this
.
operatorList
=
operatorList
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getOperationType
()
{
return
operationType
;
}
public
void
setOperationType
(
String
operationType
)
{
this
.
operationType
=
operationType
;
}
}
public
static
class
Wo
extends
Log
{
private
static
final
long
serialVersionUID
=
-
5076990764713538973L
;
public
static
WrapCopier
<
Log
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Log
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/log/LogAction.java
浏览文件 @
b8110e30
...
...
@@ -37,7 +37,7 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"list/level/{operationLevel}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listLogByOperationLevel
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
listLogByOperationLevel
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"操作级别"
)
@PathParam
(
"operationLevel"
)
String
operationLevel
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListByLevel
.
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -56,7 +56,7 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"list/app/{appId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listLogByAppId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
listLogByAppId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"栏目ID"
)
@PathParam
(
"appId"
)
String
appId
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListByAppId
.
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -75,7 +75,7 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"list/category/{categoryId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listLogByCategoryId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
listLogByCategoryId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"分类ID"
)
@PathParam
(
"categoryId"
)
String
categoryId
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListByCategory
.
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -94,7 +94,7 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"list/document/{documentId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listLogByDocumentId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
listLogByDocumentId
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"文档ID"
)
@PathParam
(
"documentId"
)
String
documentId
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListByDocument
.
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -113,7 +113,7 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"{id}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
get
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
public
void
get
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"日志ID"
)
@PathParam
(
"id"
)
String
id
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
ActionGet
.
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -132,8 +132,8 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"filter/list/{id}/next/{count}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listNextWithFilter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"最后一条信息ID,如果是第一页,则可以用(0)代替"
)
@PathParam
(
"id"
)
String
id
,
public
void
listNextWithFilter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"最后一条信息ID,如果是第一页,则可以用(0)代替"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"每页显示的条目数量"
)
@PathParam
(
"count"
)
Integer
count
,
JsonElement
jsonElement
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
...
...
@@ -145,7 +145,7 @@ public class LogAction extends StandardJaxrsAction {
Exception
exception
=
new
ExceptionServiceLogic
(
e
,
"系统在查询所有CMS表单时发生异常。"
);
result
.
error
(
exception
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
...
...
@@ -154,9 +154,9 @@ public class LogAction extends StandardJaxrsAction {
@Path
(
"filter/list/{id}/prev/{count}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listPrevWithFilter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"最后一条信息ID,如果是第一页,则可以用(0)代替"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"每页显示的条目数量"
)
@PathParam
(
"count"
)
Integer
count
,
public
void
listPrevWithFilter
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"最后一条信息ID,如果是第一页,则可以用(0)代替"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"每页显示的条目数量"
)
@PathParam
(
"count"
)
Integer
count
,
JsonElement
jsonElement
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListPrevWithFilter
.
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -167,7 +167,26 @@ public class LogAction extends StandardJaxrsAction {
Exception
exception
=
new
ExceptionServiceLogic
(
e
,
"系统在查询所有CMS表单时发生异常。"
);
result
.
error
(
exception
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"按条件对日志分页显示."
,
action
=
ActionListPaging
.
class
)
@POST
@Path
(
"list/filter/{page}/size/{size}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listFilterPaging
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"分页"
)
@PathParam
(
"page"
)
Integer
page
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"size"
)
Integer
size
,
JsonElement
jsonElement
)
{
ActionResult
<
List
<
ActionListPaging
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListPaging
().
execute
(
effectivePerson
,
page
,
size
,
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录