Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
39a8c112
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,发现更多精彩内容 >>
提交
39a8c112
编写于
12月 07, 2021
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
内容管理表单保存限制权限
上级
54dbbd57
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
71 deletion
+61
-71
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java
...ol/src/main/java/com/x/cms/assemble/control/Business.java
+8
-5
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
...ava/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
+53
-66
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java
浏览文件 @
39a8c112
...
...
@@ -15,6 +15,10 @@ import org.apache.commons.lang3.StringUtils;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 通用业务类
* @author sword
*/
public
class
Business
{
private
EntityManagerContainer
emc
;
...
...
@@ -318,7 +322,7 @@ public class Business {
return
true
;
}
// 其他情况暂时全部不允许操作
return
tru
e
;
return
fals
e
;
}
/**
...
...
@@ -333,7 +337,7 @@ public class Business {
return
true
;
}
// 其他情况暂时全部不允许操作
return
tru
e
;
return
fals
e
;
}
/**
...
...
@@ -348,11 +352,10 @@ public class Business {
return
true
;
}
// 其他情况暂时全部不允许操作
return
tru
e
;
return
fals
e
;
}
public
boolean
editable
(
EffectivePerson
effectivePerson
,
AppInfo
appInfo
)
throws
Exception
{
boolean
result
=
false
;
if
((
StringUtils
.
equals
(
appInfo
.
getCreatorPerson
(),
effectivePerson
.
getDistinguishedName
()))
||
effectivePerson
.
isManager
()
||
organization
().
person
().
hasRole
(
effectivePerson
,
OrganizationDefinition
.
CMSManager
))
{
...
...
@@ -386,6 +389,6 @@ public class Business {
return
true
;
}
}
return
result
;
return
false
;
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
浏览文件 @
39a8c112
...
...
@@ -5,18 +5,17 @@ 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.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.AuditLog
;
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.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
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.cms.assemble.control.Business
;
import
com.x.cms.assemble.control.ExceptionWrapInConvert
;
import
com.x.cms.core.entity.element.Form
;
import
com.x.cms.core.entity.element.View
;
import
com.x.cms.core.entity.element.ViewCategory
;
...
...
@@ -28,83 +27,71 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
/**
* 保存表单
* @author sword
*/
public
class
ActionSave
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionSave
.
class
);
@AuditLog
(
operation
=
"保存表单"
)
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
,
JsonElement
jsonElement
)
throws
Exception
{
logger
.
debug
(
request
.
getMethod
());
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
null
;
Boolean
check
=
true
;
try
{
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
}
catch
(
Exception
e
)
{
check
=
false
;
Exception
exception
=
new
ExceptionWrapInConvert
(
e
,
jsonElement
);
result
.
error
(
exception
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
id
!=
null
&&
!
id
.
isEmpty
())
{
wi
.
setId
(
id
);
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
check
)
{
if
(
id
!=
null
&&
!
id
.
isEmpty
())
{
wi
.
setId
(
id
);
if
(!
business
.
formEditAvailable
(
effectivePerson
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
// 看看用户是否有权限进行应用信息新增操作
if
(!
business
.
formEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"person{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有内容管理表单模板信息操作的权限!"
);
Form
form
=
emc
.
find
(
wi
.
getId
(),
Form
.
class
);
if
(
null
==
form
)
{
form
=
Wi
.
copier
.
copy
(
wi
);
if
(
wi
.
getId
()
!=
null
&&
!
wi
.
getId
().
isEmpty
())
{
form
.
setId
(
wi
.
getId
());
}
Form
form
=
emc
.
find
(
wi
.
getId
(),
Form
.
class
);
if
(
null
==
form
)
{
form
=
Wi
.
copier
.
copy
(
wi
);
if
(
wi
.
getId
()
!=
null
&&
!
wi
.
getId
().
isEmpty
())
{
form
.
setId
(
wi
.
getId
());
}
emc
.
beginTransaction
(
Form
.
class
);
form
.
getProperties
().
setRelatedFormList
(
wi
.
getRelatedFormList
());
form
.
getProperties
().
setMobileRelatedFormList
(
wi
.
getMobileRelatedFormList
());
form
.
getProperties
().
setRelatedScriptMap
(
wi
.
getRelatedScriptMap
());
form
.
getProperties
().
setMobileRelatedScriptMap
(
wi
.
getMobileRelatedScriptMap
());
emc
.
persist
(
form
,
CheckPersistType
.
all
);
emc
.
commit
();
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"新增"
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
form
.
getId
());
result
.
setData
(
wo
);
}
else
{
Wi
.
copier
.
copy
(
wi
,
form
);
emc
.
beginTransaction
(
Form
.
class
);
form
.
getProperties
().
setRelatedFormList
(
wi
.
getRelatedFormList
());
form
.
getProperties
().
setMobileRelatedFormList
(
wi
.
getMobileRelatedFormList
());
form
.
getProperties
().
setRelatedScriptMap
(
wi
.
getRelatedScriptMap
());
form
.
getProperties
().
setMobileRelatedScriptMap
(
wi
.
getMobileRelatedScriptMap
());
emc
.
check
(
form
,
CheckPersistType
.
all
);
emc
.
commit
();
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"更新"
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
form
.
getId
());
result
.
setData
(
wo
);
}
CacheManager
.
notify
(
Form
.
class
);
CacheManager
.
notify
(
View
.
class
);
CacheManager
.
notify
(
ViewFieldConfig
.
class
);
CacheManager
.
notify
(
ViewCategory
.
class
);
}
catch
(
Throwable
th
)
{
th
.
printStackTrace
();
result
.
error
(
th
);
emc
.
beginTransaction
(
Form
.
class
);
form
.
getProperties
().
setRelatedFormList
(
wi
.
getRelatedFormList
());
form
.
getProperties
().
setMobileRelatedFormList
(
wi
.
getMobileRelatedFormList
());
form
.
getProperties
().
setRelatedScriptMap
(
wi
.
getRelatedScriptMap
());
form
.
getProperties
().
setMobileRelatedScriptMap
(
wi
.
getMobileRelatedScriptMap
());
emc
.
persist
(
form
,
CheckPersistType
.
all
);
emc
.
commit
();
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"新增"
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
form
.
getId
());
result
.
setData
(
wo
);
}
else
{
Wi
.
copier
.
copy
(
wi
,
form
);
emc
.
beginTransaction
(
Form
.
class
);
form
.
getProperties
().
setRelatedFormList
(
wi
.
getRelatedFormList
());
form
.
getProperties
().
setMobileRelatedFormList
(
wi
.
getMobileRelatedFormList
());
form
.
getProperties
().
setRelatedScriptMap
(
wi
.
getRelatedScriptMap
());
form
.
getProperties
().
setMobileRelatedScriptMap
(
wi
.
getMobileRelatedScriptMap
());
emc
.
check
(
form
,
CheckPersistType
.
all
);
emc
.
commit
();
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"更新"
);
Wo
wo
=
new
Wo
();
wo
.
setId
(
form
.
getId
());
result
.
setData
(
wo
);
}
CacheManager
.
notify
(
Form
.
class
);
CacheManager
.
notify
(
View
.
class
);
CacheManager
.
notify
(
ViewFieldConfig
.
class
);
CacheManager
.
notify
(
ViewCategory
.
class
);
}
return
result
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录