提交 25e1f210 编写于 作者: liyi_hz2008's avatar liyi_hz2008

[内容管理]修复了发布文档时会通知所有人员的问题

上级 ac7e5abd
......@@ -177,7 +177,7 @@ public class ActionPersistPublishAndNotify extends BaseAction {
//将读者以及作者信息持久化到数据库中
if( !wi.getSkipPermission() ) {
try {
documentPersistService.refreshDocumentPermission( id, wi.getReaderList(), wi.getAuthorList() );
document = documentPersistService.refreshDocumentPermission( id, wi.getReaderList(), wi.getAuthorList() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
......
......@@ -365,7 +365,7 @@ public class ActionPersistPublishByWorkFlow extends BaseAction {
if ( check && !wi.getSkipPermission() ) {
//将读者以及作者信息持久化到数据库中
try {
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
document = documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
......
......@@ -381,7 +381,7 @@ public class ActionPersistPublishContent extends BaseAction {
if ( check && !wi.getSkipPermission() ) {
//将读者以及作者信息持久化到数据库中
try {
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
document = documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
......
......@@ -365,7 +365,7 @@ public class ActionPersistSaveDocument extends BaseAction {
if (check) {
try {//将读者以及作者信息持久化到数据库中
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
document = documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
......
......@@ -298,15 +298,17 @@ public class DocumentPersistService {
* @param authorList
* @throws Exception
*/
public void refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
public Document refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
if( StringUtils.isEmpty( docId ) ){
throw new Exception("docId is empty!");
}
permissionService.refreshDocumentPermission( docId, readerList, authorList);
Document document = permissionService.refreshDocumentPermission( docId, readerList, authorList);
new CmsBatchOperationPersistService().addOperation(
CmsBatchOperationProcessService.OPT_OBJ_DOCUMENT,
CmsBatchOperationProcessService.OPT_TYPE_PERMISSION, docId, docId, "刷新文档权限:ID=" + docId );
return document;
}
/**
......
......@@ -33,11 +33,11 @@ public class PermissionOperateService {
* @param authorList
* @throws Exception
*/
public void refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
public Document refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
List<PermissionInfo> permissionList = composeDocmentAllPermissions(readerList, authorList);
try {
//将读者以及作者信息持久化到数据库中
refreshDocumentPermission( docId, permissionList );
return refreshDocumentPermission( docId, permissionList );
} catch (Exception e) {
throw e;
}
......@@ -141,13 +141,14 @@ public class PermissionOperateService {
* @param permissionList
* @throws Exception
*/
public void refreshDocumentPermission( String docId, List<PermissionInfo> permissionList ) throws Exception {
public Document refreshDocumentPermission( String docId, List<PermissionInfo> permissionList ) throws Exception {
if( StringUtils.isEmpty(docId) ){
throw new Exception( "docId is empty!" );
}
Document document = null;
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
emc.beginTransaction( Document.class );
Document document = emc.find( docId, Document.class );
document = emc.find( docId, Document.class );
if( document != null ) {
//清空文档权限信息
......@@ -196,12 +197,12 @@ public class PermissionOperateService {
if( ListTools.isEmpty( document.getAuthorPersonList() ) && ListTools.isEmpty( document.getAuthorUnitList() )
&& ListTools.isEmpty( document.getAuthorGroupList() )) {
//编辑全部都为空,则是创建人可编辑
document.addToAuthorPersonList( document.getCreatorPerson() );
document.addToReadPersonList( document.getCreatorPerson() );
document.addToAuthorPersonList( document.getCreatorPerson() );
}
if( ListTools.isEmpty( document.getManagerList() ) ) {
//管理全部都为空,则是创建人可以管理
document.addToManagerList( document.getCreatorPerson() );
document.addToReadPersonList( document.getCreatorPerson() );
document.addToManagerList( document.getCreatorPerson() );
}
......@@ -211,6 +212,8 @@ public class PermissionOperateService {
} catch ( Exception e ) {
throw e;
}
return document;
}
// private boolean existsPermission(List<PermissionInfo> permissionList, String objectType, String permissionCode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册