Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
a2353354
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,发现更多精彩内容 >>
提交
a2353354
编写于
5月 26, 2022
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
内容管理分类增加可管理的分类列表接口
上级
27a74a25
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
112 addition
and
0 deletion
+112
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionListManage.java
...assemble/control/jaxrs/categoryinfo/ActionListManage.java
+94
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java
...semble/control/jaxrs/categoryinfo/CategoryInfoAction.java
+18
-0
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionListManage.java
0 → 100644
浏览文件 @
a2353354
package
com.x.cms.assemble.control.jaxrs.categoryinfo
;
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.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.exception.ExceptionEntityNotExist
;
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.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.SortTools
;
import
com.x.cms.assemble.control.Business
;
import
com.x.cms.core.entity.AppInfo
;
import
com.x.cms.core.entity.CategoryInfo
;
import
com.x.cms.core.entity.CategoryInfo_
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 获取可管理的分类
* @author sword
*/
public
class
ActionListManage
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListManage
.
class
);
protected
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
appId
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
logger
.
debug
(
effectivePerson
.
getDistinguishedName
());
Cache
.
CacheKey
cacheKey
=
new
Cache
.
CacheKey
(
this
.
getClass
(),
appId
,
effectivePerson
.
getDistinguishedName
());
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
result
.
setData
((
List
<
Wo
>)
optional
.
get
());
}
else
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
AppInfo
appInfo
=
emc
.
find
(
appId
,
AppInfo
.
class
);
if
(
appInfo
==
null
){
throw
new
ExceptionEntityNotExist
(
appId
);
}
List
<
CategoryInfo
>
categoryInfoList
;
if
(
business
.
isManager
(
effectivePerson
)){
categoryInfoList
=
emc
.
listEqual
(
CategoryInfo
.
class
,
CategoryInfo
.
appId_FIELDNAME
,
appId
);
}
else
{
List
<
String
>
unitList
=
business
.
organization
().
unit
().
listWithPersonSupNested
(
effectivePerson
.
getDistinguishedName
());
List
<
String
>
groupList
=
business
.
organization
().
group
().
listWithPerson
(
effectivePerson
.
getDistinguishedName
());
if
(
appInfoServiceAdv
.
isAppInfoManager
(
appInfo
,
effectivePerson
.
getDistinguishedName
(),
unitList
,
groupList
)){
categoryInfoList
=
emc
.
listEqual
(
CategoryInfo
.
class
,
CategoryInfo
.
appId_FIELDNAME
,
appId
);
}
else
{
EntityManager
em
=
emc
.
get
(
CategoryInfo
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
CategoryInfo
>
cq
=
cb
.
createQuery
(
CategoryInfo
.
class
);
Root
<
CategoryInfo
>
root
=
cq
.
from
(
CategoryInfo
.
class
);
Predicate
qp
=
cb
.
equal
(
root
.
get
(
CategoryInfo_
.
appId
),
appId
);
Predicate
p
=
cb
.
isMember
(
effectivePerson
.
getDistinguishedName
(),
root
.
get
(
CategoryInfo_
.
manageablePersonList
));
if
(
ListTools
.
isNotEmpty
(
unitList
)){
p
=
cb
.
or
(
p
,
root
.
get
(
CategoryInfo_
.
manageableUnitList
).
in
(
unitList
));
}
if
(
ListTools
.
isNotEmpty
(
groupList
)){
p
=
cb
.
or
(
p
,
root
.
get
(
CategoryInfo_
.
manageableGroupList
).
in
(
groupList
));
}
qp
=
cb
.
and
(
qp
,
p
);
categoryInfoList
=
em
.
createQuery
(
cq
.
where
(
qp
)).
getResultList
();
}
}
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
categoryInfoList
);
SortTools
.
asc
(
wos
,
"categoryName"
);
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wos
);
result
.
setData
(
wos
);
}
}
return
result
;
}
public
static
class
Wo
extends
CategoryInfo
{
private
static
final
long
serialVersionUID
=
-
1137384484063244073L
;
static
final
WrapCopier
<
CategoryInfo
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
CategoryInfo
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
CategoryInfo
.
class
,
true
,
true
),
null
);
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java
浏览文件 @
a2353354
...
...
@@ -537,4 +537,22 @@ public class CategoryInfoAction extends StandardJaxrsAction{
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前用户可管理的列表."
,
action
=
ActionListManage
.
class
)
@GET
@Path
(
"list/manage/app/{appId}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listManage
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"应用标识"
)
@PathParam
(
"appId"
)
String
appId
)
{
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
ActionResult
<
List
<
ActionListManage
.
Wo
>>
result
=
new
ActionResult
<>();
try
{
result
=
new
ActionListManage
().
execute
(
effectivePerson
,
appId
);
}
catch
(
Exception
e
)
{
result
.
error
(
e
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录