Browse Source

Merge pull request #11 from liyihz2008/master

CMS代码注释调整以及部分代码优化
o2oa 7 years ago
parent
commit
604b2ebe81

+ 5 - 2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/DocumentFactory.java

@@ -75,14 +75,17 @@ public class DocumentFactory<T> extends AbstractFactory {
 	}
 	}
 	
 	
 	//@MethodDescribe("根据ID列示指定分类所有Document信息列表")
 	//@MethodDescribe("根据ID列示指定分类所有Document信息列表")
-	public List<String> listByCategoryId( String categoryId ) throws Exception {
+	public List<String> listByCategoryId( String categoryId, Integer maxCount ) throws Exception {
+		if( maxCount == null || maxCount == 0 ) {
+			maxCount = 10000;
+		}
 		EntityManager em = this.entityManagerContainer().get( Document.class );
 		EntityManager em = this.entityManagerContainer().get( Document.class );
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<String> cq = cb.createQuery( String.class );
 		CriteriaQuery<String> cq = cb.createQuery( String.class );
 		Root<Document> root = cq.from( Document.class );
 		Root<Document> root = cq.from( Document.class );
 		Predicate p = cb.equal(root.get( Document_.categoryId ), categoryId );
 		Predicate p = cb.equal(root.get( Document_.categoryId ), categoryId );
 		cq.select(root.get( Document_.id)).where(p);
 		cq.select(root.get( Document_.id)).where(p);
-		return em.createQuery( cq ).setMaxResults(10000).getResultList();
+		return em.createQuery( cq ).setMaxResults(maxCount).getResultList();
 	}
 	}
 	
 	
 	//@MethodDescribe("根据ID列示指定分类所有Document信息数量")
 	//@MethodDescribe("根据ID列示指定分类所有Document信息数量")

+ 24 - 11
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionArchive.java

@@ -13,48 +13,61 @@ import com.x.base.core.project.logger.LoggerFactory;
 import com.x.cms.assemble.control.Business;
 import com.x.cms.assemble.control.Business;
 import com.x.cms.core.entity.Document;
 import com.x.cms.core.entity.Document;
 
 
+/**
+ * 文档归档操作执行类
+ * @author O2LEE
+ *
+ */
 public class ActionArchive extends BaseAction {
 public class ActionArchive extends BaseAction {
 
 
-	private static  Logger logger = LoggerFactory.getLogger( ActionArchive.class );
+	private static Logger logger = LoggerFactory.getLogger( ActionArchive.class );
 	
 	
+	/**
+	 * 文档归档操作
+	 * @param request
+	 * @param id  文档ID
+	 * @param effectivePerson 系统登录用户
+	 * @return
+	 * @throws Exception
+	 */
 	protected ActionResult<Wo> execute( HttpServletRequest request, String id, EffectivePerson effectivePerson ) throws Exception {
 	protected ActionResult<Wo> execute( HttpServletRequest request, String id, EffectivePerson effectivePerson ) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
 		ActionResult<Wo> result = new ActionResult<>();
-		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			Business business = new Business(emc);
-			Document document = business.getDocumentFactory().get(id);
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
+			Business business = new Business( emc );
+			Document document = business.getDocumentFactory().get( id );
 			if ( null == document ) {
 			if ( null == document ) {
 				Exception exception = new ExceptionDocumentNotExists( id );
 				Exception exception = new ExceptionDocumentNotExists( id );
 				result.error( exception );
 				result.error( exception );
 				throw exception;
 				throw exception;
 			}
 			}
 			try {
 			try {
-				modifyDocStatus(id, "archived", effectivePerson.getDistinguishedName() );
+				modifyDocStatus( id, "archived", effectivePerson.getDistinguishedName() );
 				document.setDocStatus( "archived" );
 				document.setDocStatus( "archived" );
 				
 				
 				ApplicationCache.notify( Document.class );
 				ApplicationCache.notify( Document.class );
-			} catch (Exception e) {
+			} catch ( Exception e ) {
 				Exception exception = new ExceptionDocumentInfoProcess( e, "系统将文档状态修改为归档状态时发生异常。Id:" + id );
 				Exception exception = new ExceptionDocumentInfoProcess( e, "系统将文档状态修改为归档状态时发生异常。Id:" + id );
 				result.error( exception );
 				result.error( exception );
-				logger.error( e, effectivePerson, request, null);
+				logger.error( e, effectivePerson, request, null );
 				throw exception;
 				throw exception;
 			}
 			}
 			
 			
+			//信息操作日志记录
 			logService.log( emc, effectivePerson.getDistinguishedName(), document.getCategoryAlias() + ":" + document.getTitle(), document.getAppId(), document.getCategoryId(), document.getId(), "", "DOCUMENT", "删除" );
 			logService.log( emc, effectivePerson.getDistinguishedName(), document.getCategoryAlias() + ":" + document.getTitle(), document.getAppId(), document.getCategoryId(), document.getId(), "", "DOCUMENT", "删除" );
 			
 			
 			Wo wo = new Wo();
 			Wo wo = new Wo();
 			wo.setId( document.getId() );
 			wo.setId( document.getId() );
 			result.setData( wo );
 			result.setData( wo );
-		} catch (Exception e) {
-			Exception exception = new ExceptionDocumentInfoProcess( e, "系统将文档状态修改为归档状态时发生异常。Id:" + id );
+		} catch ( Exception e ) {
+			Exception exception = new ExceptionDocumentInfoProcess( e, "文档归档操作发生异常。Id:" + id );
 			result.error( exception );
 			result.error( exception );
-			logger.error( e, effectivePerson, request, null);
+			logger.error( e, effectivePerson, request, null );
 			throw exception;
 			throw exception;
 		}
 		}
 		return result;
 		return result;
 	}
 	}
 	
 	
 	public static class Wo extends WoId {
 	public static class Wo extends WoId {
-
 	}
 	}
 
 
 }
 }

+ 18 - 0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionBatchModifyDataWithIds.java

@@ -14,10 +14,23 @@ import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.cms.core.entity.Document;
 import com.x.cms.core.entity.Document;
 
 
+/**
+ * 根据ID列表批量修改文档数据操作类
+ * @author O2LEE
+ *
+ */
 public class ActionBatchModifyDataWithIds extends BaseAction {
 public class ActionBatchModifyDataWithIds extends BaseAction {
 
 
 	private static  Logger logger = LoggerFactory.getLogger(ActionBatchModifyDataWithIds.class);
 	private static  Logger logger = LoggerFactory.getLogger(ActionBatchModifyDataWithIds.class);
 
 
+	/**
+	 * 根据ID列表批量修改文档数据操作
+	 * @param request
+	 * @param jsonElement  传入的Json
+	 * @param effectivePerson
+	 * @return
+	 * @throws Exception
+	 */
 	protected ActionResult<Wo> execute(HttpServletRequest request, JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception {
 	protected ActionResult<Wo> execute(HttpServletRequest request, JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
 		ActionResult<Wo> result = new ActionResult<>();
 		Boolean check = true;
 		Boolean check = true;
@@ -73,6 +86,11 @@ public class ActionBatchModifyDataWithIds extends BaseAction {
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 数据修改信息结构
+	 * @author O2LEE
+	 *
+	 */
 	public static class WiDataChange{
 	public static class WiDataChange{
 		
 		
 		@FieldDescribe( "数据路径或者属性名." )
 		@FieldDescribe( "数据路径或者属性名." )

+ 1 - 1
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionView.java

@@ -76,7 +76,7 @@ public class ActionView extends BaseAction {
 		} else {
 		} else {
 			if (check) {
 			if (check) {
 				try {
 				try {
-					document = documentInfoServiceAdv.view( id, effectivePerson );
+					document = documentInfoServiceAdv.get(id);
 					if ( document == null ) {
 					if ( document == null ) {
 						check = false;
 						check = false;
 						Exception exception = new ExceptionDocumentNotExists(id);
 						Exception exception = new ExceptionDocumentNotExists(id);

+ 1 - 1
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionTransferAllDocumentInfoPermission.java

@@ -63,7 +63,7 @@ public class ActionTransferAllDocumentInfoPermission extends BaseAction {
 					
 					
 					//查询该分类下所有的文档ID列表
 					//查询该分类下所有的文档ID列表
 					try {
 					try {
-						documentIds = documentServiceAdv.listIdsByCategoryId(categoryId);
+						documentIds = documentServiceAdv.listIdsByCategoryId(categoryId, 9999999);
 						if( ListTools.isEmpty( documentIds ) ){
 						if( ListTools.isEmpty( documentIds ) ){
 							continue;
 							continue;
 						}
 						}

+ 5 - 0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/element/PermissionInfo.java

@@ -2,6 +2,11 @@ package com.x.cms.assemble.control.jaxrs.permission.element;
 
 
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.annotation.FieldDescribe;
 
 
+/**
+ * 信息权限信息结构
+ * @author O2LEE
+ *
+ */
 public class PermissionInfo {
 public class PermissionInfo {
 
 
 	@FieldDescribe( "权限类别:读者|阅读|作者|管理" )
 	@FieldDescribe( "权限类别:读者|阅读|作者|管理" )

+ 4 - 10
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/AppInfoService.java

@@ -23,14 +23,6 @@ import com.x.query.core.entity.Item;
 
 
 public class AppInfoService {
 public class AppInfoService {
 
 
-//	public List<AppInfo> list( EntityManagerContainer emc, List<String> ids ) throws Exception {
-//		if( ids == null || ids.isEmpty() ){
-//			return null;
-//		}
-//		return emc.list( AppInfo.class,  ids );
-//		Business business = new Business( emc );
-//		return business.getAppInfoFactory().list( ids );
-//	}
 	public List<String> listAllIds(EntityManagerContainer emc, String documentType ) throws Exception {
 	public List<String> listAllIds(EntityManagerContainer emc, String documentType ) throws Exception {
 		Business business = new Business( emc );
 		Business business = new Business( emc );
 		return business.getAppInfoFactory().listAllIds(documentType);
 		return business.getAppInfoFactory().listAllIds(documentType);
@@ -170,6 +162,7 @@ public class AppInfoService {
 		return business.getCategoryInfoFactory().countByAppId( id, documentType );
 		return business.getCategoryInfoFactory().countByAppId( id, documentType );
 	}
 	}
 	
 	
+	@SuppressWarnings("unchecked")
 	public AppInfo save( EntityManagerContainer emc, AppInfo wrapIn ) throws Exception {
 	public AppInfo save( EntityManagerContainer emc, AppInfo wrapIn ) throws Exception {
 		AppInfo appInfo = null;
 		AppInfo appInfo = null;
 		if( wrapIn.getId() == null ){
 		if( wrapIn.getId() == null ){
@@ -191,6 +184,7 @@ public class AppInfoService {
 			appInfo.setAppAlias( appInfo.getAppName() );
 			appInfo.setAppAlias( appInfo.getAppName() );
 			emc.persist( appInfo, CheckPersistType.all);
 			emc.persist( appInfo, CheckPersistType.all);
 		}else{
 		}else{
+			//如果用户修改了栏目的名称
 			if( !wrapIn.getAppName().equals(appInfo.getAppName() )){
 			if( !wrapIn.getAppName().equals(appInfo.getAppName() )){
 				emc.beginTransaction( CategoryInfo.class );
 				emc.beginTransaction( CategoryInfo.class );
 				emc.beginTransaction( Document.class );
 				emc.beginTransaction( Document.class );
@@ -202,10 +196,10 @@ public class AppInfoService {
 						categoryInfo = emc.find( categoryId, CategoryInfo.class );
 						categoryInfo = emc.find( categoryId, CategoryInfo.class );
 						categoryInfo.setAppName( wrapIn.getAppName() );
 						categoryInfo.setAppName( wrapIn.getAppName() );
 						categoryInfo.setCategoryAlias( wrapIn.getAppName() + "-" + categoryInfo.getCategoryName() );
 						categoryInfo.setCategoryAlias( wrapIn.getAppName() + "-" + categoryInfo.getCategoryName() );
-						emc.check( categoryInfo, CheckPersistType.all );
+						emc.check( categoryInfo, CheckPersistType.all );						
 						
 						
 						//对该目录下所有的文档的栏目名称和分类别名进行调整
 						//对该目录下所有的文档的栏目名称和分类别名进行调整
-						document_ids = business.getDocumentFactory().listByCategoryId( categoryId );
+						document_ids = business.getDocumentFactory().listByCategoryId( categoryId, 9999999 );
 						if( document_ids != null && !document_ids.isEmpty() ){
 						if( document_ids != null && !document_ids.isEmpty() ){
 							for( String docId : document_ids ){
 							for( String docId : document_ids ){
 								document = emc.find( docId, Document.class );
 								document = emc.find( docId, Document.class );

+ 4 - 10
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CategoryInfoService.java

@@ -23,14 +23,6 @@ import com.x.cms.core.entity.tools.LogUtil;
 import com.x.query.core.entity.Item;
 import com.x.query.core.entity.Item;
 
 
 public class CategoryInfoService {
 public class CategoryInfoService {
-
-//	public List<CategoryInfo> list(EntityManagerContainer emc, List<String> ids) throws Exception {
-//		if( ids == null || ids.isEmpty() ){
-//			return null;
-//		}
-//		Business business = new Business( emc );
-//		return business.getCategoryInfoFactory().list( ids );
-//	}
 	
 	
 	public CategoryInfo get( EntityManagerContainer emc, String id ) throws Exception {
 	public CategoryInfo get( EntityManagerContainer emc, String id ) throws Exception {
 		if( id == null || id.isEmpty() ){
 		if( id == null || id.isEmpty() ){
@@ -130,6 +122,7 @@ public class CategoryInfoService {
 		return categoryInfo;
 		return categoryInfo;
 	}
 	}
 	
 	
+	@SuppressWarnings("unchecked")
 	public CategoryInfo save( EntityManagerContainer emc, CategoryInfo temp_categoryInfo, String extContent ) throws Exception {
 	public CategoryInfo save( EntityManagerContainer emc, CategoryInfo temp_categoryInfo, String extContent ) throws Exception {
 		CategoryInfo categoryInfo = null;
 		CategoryInfo categoryInfo = null;
 		CategoryExt categoryExt = null;
 		CategoryExt categoryExt = null;
@@ -191,7 +184,7 @@ public class CategoryInfoService {
 			if( !oldCategoryName.equals( categoryInfo.getCategoryName() )){
 			if( !oldCategoryName.equals( categoryInfo.getCategoryName() )){
 				emc.beginTransaction( Document.class );
 				emc.beginTransaction( Document.class );
 				//对该目录下所有的文档的栏目名称和分类别名进行调整
 				//对该目录下所有的文档的栏目名称和分类别名进行调整
-				document_ids = business.getDocumentFactory().listByCategoryId( categoryInfo.getId() );
+				document_ids = business.getDocumentFactory().listByCategoryId( categoryInfo.getId(), 9999999 );
 				if( document_ids != null && !document_ids.isEmpty() ){
 				if( document_ids != null && !document_ids.isEmpty() ){
 					for( String docId : document_ids ){
 					for( String docId : document_ids ){
 						document = emc.find( docId, Document.class );
 						document = emc.find( docId, Document.class );
@@ -259,6 +252,7 @@ public class CategoryInfoService {
 		return categoryExt;
 		return categoryExt;
 	}
 	}
 
 
+	@SuppressWarnings("unchecked")
 	public void delete( EntityManagerContainer emc, String id ) throws Exception {
 	public void delete( EntityManagerContainer emc, String id ) throws Exception {
 		List<String> ids = null;
 		List<String> ids = null;
 		CategoryInfo categoryInfo = null;
 		CategoryInfo categoryInfo = null;
@@ -299,7 +293,7 @@ public class CategoryInfoService {
 		}
 		}
 		
 		
 		//还有文档以及文档权限需要删除
 		//还有文档以及文档权限需要删除
-		ids = business.getDocumentFactory().listByCategoryId( id );
+		ids = business.getDocumentFactory().listByCategoryId( id, 9999999 );
 		if( ids != null && !ids.isEmpty()  ){
 		if( ids != null && !ids.isEmpty()  ){
 			for( String del_id : ids ){
 			for( String del_id : ids ){
 				document = emc.find( del_id, Document.class );
 				document = emc.find( del_id, Document.class );

+ 2 - 10
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoService.java

@@ -17,21 +17,13 @@ import com.x.query.core.entity.Item;
 
 
 public class DocumentInfoService {
 public class DocumentInfoService {
 
 
-//	public List<Document> list( EntityManagerContainer emc, List<String> ids ) throws Exception {
-//		if( ids == null || ids.isEmpty() ){
-//			return null;
-//		}
-//		Business business = new Business( emc );
-//		return business.getDocumentFactory().list( ids );
-//	}
-	
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
-	public List<String> listByCategoryId( EntityManagerContainer emc, String categoryId ) throws Exception {
+	public List<String> listByCategoryId( EntityManagerContainer emc, String categoryId, Integer maxCount ) throws Exception {
 		if( categoryId == null || categoryId.isEmpty() ){
 		if( categoryId == null || categoryId.isEmpty() ){
 			return null;
 			return null;
 		}
 		}
 		Business business = new Business( emc );
 		Business business = new Business( emc );
-		return business.getDocumentFactory().listByCategoryId( categoryId );
+		return business.getDocumentFactory().listByCategoryId( categoryId, maxCount );
 	}
 	}
 
 
 	public Document get(EntityManagerContainer emc, String id) throws Exception {
 	public Document get(EntityManagerContainer emc, String id) throws Exception {

+ 163 - 56
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoServiceAdv.java

@@ -11,8 +11,8 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.entity.dataitem.DataItemConverter;
 import com.x.base.core.entity.dataitem.DataItemConverter;
 import com.x.base.core.entity.dataitem.ItemCategory;
 import com.x.base.core.entity.dataitem.ItemCategory;
+import com.x.base.core.project.exception.ExceptionWhen;
 import com.x.base.core.project.gson.XGsonBuilder;
 import com.x.base.core.project.gson.XGsonBuilder;
-import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.base.core.project.tools.ListTools;
 import com.x.cms.assemble.control.Business;
 import com.x.cms.assemble.control.Business;
 import com.x.cms.assemble.control.DocumentDataHelper;
 import com.x.cms.assemble.control.DocumentDataHelper;
@@ -25,8 +25,7 @@ import com.x.cms.core.entity.content.Data;
 import com.x.query.core.entity.Item;
 import com.x.query.core.entity.Item;
 
 
 /**
 /**
- * 对文档信息进行管理的服务类(高级)
- * 高级服务器可以利用Service完成事务控制
+ * 对文档信息进行管理的服务类
  * 
  * 
  * @author O2LEE
  * @author O2LEE
  */
  */
@@ -34,55 +33,67 @@ public class DocumentInfoServiceAdv {
 	private DocumentInfoService documentInfoService = new DocumentInfoService();
 	private DocumentInfoService documentInfoService = new DocumentInfoService();
 	private PermissionOperateService permissionService = new PermissionOperateService();
 	private PermissionOperateService permissionService = new PermissionOperateService();
 	
 	
-	public List<Document> listByCategoryId( String categoryId ) throws Exception {
+	/**
+	 * 根据指定的信息分类ID,获取分类下所有的信息文档对象
+	 * @param categoryId  信息分类ID
+	 * @param maxCount  查询最大条目数量
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Document> listByCategoryId( String categoryId, Integer maxCount ) throws Exception {
 		if( categoryId == null || categoryId.isEmpty() ){
 		if( categoryId == null || categoryId.isEmpty() ){
 			throw new Exception("categoryId is null!");
 			throw new Exception("categoryId is null!");
 		}
 		}
 		List<String> ids = null;
 		List<String> ids = null;
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
-			ids = documentInfoService.listByCategoryId( emc, categoryId );
+			ids = documentInfoService.listByCategoryId( emc, categoryId, maxCount );
 			return emc.list( Document.class,  ids );
 			return emc.list( Document.class,  ids );
-//			return documentInfoService.list( emc, ids );
 		} catch ( Exception e ) {
 		} catch ( Exception e ) {
 			throw e;
 			throw e;
 		}
 		}
 	}
 	}
 	
 	
-	public List<String> listIdsByCategoryId( String categoryId ) throws Exception {
+	/**
+	 * 根据指定的信息分类ID,获取分类下所有的文档ID列表
+	 * @param categoryId  信息分类ID
+	 * @param maxCount  查询最大条目数量
+	 * @return
+	 * @throws Exception
+	 */
+	public List<String> listIdsByCategoryId( String categoryId, Integer maxCount ) throws Exception {
 		if( categoryId == null || categoryId.isEmpty() ){
 		if( categoryId == null || categoryId.isEmpty() ){
 			throw new Exception("categoryId is null!");
 			throw new Exception("categoryId is null!");
 		}
 		}
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
-			return documentInfoService.listByCategoryId( emc, categoryId );
+			return documentInfoService.listByCategoryId( emc, categoryId, maxCount );
 		} catch ( Exception e ) {
 		} catch ( Exception e ) {
 			throw e;
 			throw e;
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据ID获取指定信息文档对象
+	 * @param id  信息文档ID
+	 * @return
+	 * @throws Exception
+	 */
 	public Document get( String id ) throws Exception {
 	public Document get( String id ) throws Exception {
 		if( id == null || id.isEmpty() ){
 		if( id == null || id.isEmpty() ){
 			throw new Exception("id is null!");
 			throw new Exception("id is null!");
 		}
 		}
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
-			return documentInfoService.get( emc, id );
-		} catch ( Exception e ) {
-			throw e;
-		}
-	}
-
-	public Document view( String id, EffectivePerson currentPerson ) throws Exception {
-		if( id == null || id.isEmpty() ){
-			throw new Exception("id is null!");
-		}
-		Document document = null;
-		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
-			document = emc.find( id, Document.class );
-			return document;
+			return emc.find( id, Document.class, ExceptionWhen.none );
 		} catch ( Exception e ) {
 		} catch ( Exception e ) {
 			throw e;
 			throw e;
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据文档信息对象查询该文档信息的数据对象
+	 * @param document  文档信息
+	 * @return
+	 * @throws Exception
+	 */
 	public Data getDocumentData( Document document ) throws Exception {
 	public Data getDocumentData( Document document ) throws Exception {
 		if( document == null ){
 		if( document == null ){
 			throw new Exception("document is null!");
 			throw new Exception("document is null!");
@@ -115,6 +126,12 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 根据信息分类ID,获取分类下所有文档的数量
+	 * @param categoryId  信息分类ID
+	 * @return
+	 * @throws Exception
+	 */
 	public Long countByCategoryId(String categoryId ) throws Exception {
 	public Long countByCategoryId(String categoryId ) throws Exception {
 		if( categoryId == null || categoryId.isEmpty() ){
 		if( categoryId == null || categoryId.isEmpty() ){
 			throw new Exception("categoryId is null!");
 			throw new Exception("categoryId is null!");
@@ -126,18 +143,30 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据ID列表列示指定ID的文档信息
+	 * @param ids  信息文档ID列表
+	 * @return
+	 * @throws Exception
+	 */
 	public List<Document> list(List<String> ids) throws Exception {
 	public List<Document> list(List<String> ids) throws Exception {
 		if( ListTools.isEmpty( ids ) ){
 		if( ListTools.isEmpty( ids ) ){
 			throw new Exception("ids is empty!");
 			throw new Exception("ids is empty!");
 		}
 		}
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 			return emc.list( Document.class,  ids );
 			return emc.list( Document.class,  ids );
-//			return documentInfoService.list(emc, ids);
 		} catch ( Exception e ) {
 		} catch ( Exception e ) {
 			throw e;
 			throw e;
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 保存文档信息
+	 * @param document  文档信息对象
+	 * @param jsonElement  文档数据对象
+	 * @return
+	 * @throws Exception
+	 */
 	public Document save( Document document, JsonElement jsonElement ) throws Exception {
 	public Document save( Document document, JsonElement jsonElement ) throws Exception {
 		if( document == null ){
 		if( document == null ){
 			throw new Exception("document is null!");
 			throw new Exception("document is null!");
@@ -145,8 +174,8 @@ public class DocumentInfoServiceAdv {
 		
 		
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 			document =  documentInfoService.save( emc, document );
 			document =  documentInfoService.save( emc, document );
-			//如果有数据信息,则保存数据信息
 			
 			
+			//如果有数据信息, 则保存数据信息			
 			DocumentDataHelper documentDataHelper = new DocumentDataHelper( emc, document );
 			DocumentDataHelper documentDataHelper = new DocumentDataHelper( emc, document );
 			if( jsonElement != null ) {
 			if( jsonElement != null ) {
 				documentDataHelper.update(jsonElement);
 				documentDataHelper.update(jsonElement);
@@ -164,6 +193,12 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 向文档数据表同步文档的最新数据信息
+	 * @param document  文档信息对象(包含数据)
+	 * @return 
+	 * @throws Exception
+	 */
 	public Document refreshDocInfoData( Document document ) throws Exception {
 	public Document refreshDocInfoData( Document document ) throws Exception {
 		if( document == null ){
 		if( document == null ){
 			throw new Exception("document is null!");
 			throw new Exception("document is null!");
@@ -182,10 +217,27 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据指定的条件获取符合条件的文档信息数量
+	 * @param viewAbleCategoryIds   用于过滤的可见信息分类ID列表
+	 * @param title   用于过滤的文档标题
+	  * @param publisherList  用于过滤的发布者列表
+	 * @param createDateList  用于过滤的信息创建日期列表
+	 * @param publishDateList  用于过滤的信息发布日期列表
+	 * @param statusList  用于过滤的信息文档状态列表
+	 * @param documentType  用于过滤的信息类别
+	 * @param creatorUnitNameList  用于过滤的创建者所属组织名称列表
+	 * @param importBatchNames  用于过滤的导入数据批次名称列表
+	 * @param personNames  用于过滤权限的人员姓名列表
+	 * @param unitNames  用于过滤权限的人员所属组织名称列表
+	 * @param groupNames  用于过滤权限的群组名称列表
+	 * @param manager  查询者身份是否为管理员权限
+	 * @return
+	 * @throws Exception
+	 */
 	public Long countWithCondition( List<String> viewAbleCategoryIds, String title, List<String> publisherList, 
 	public Long countWithCondition( List<String> viewAbleCategoryIds, String title, List<String> publisherList, 
 			List<String> createDateList,  List<String> publishDateList,  List<String> statusList, String documentType, 
 			List<String> createDateList,  List<String> publishDateList,  List<String> statusList, String documentType, 
-			List<String>  creatorUnitNameList,
-			List<String> importBatchNames, List<String> personNames, 
+			List<String>  creatorUnitNameList, List<String> importBatchNames, List<String> personNames, 
 			List<String> unitNames, List<String> groupNames, Boolean manager) throws Exception {
 			List<String> unitNames, List<String> groupNames, Boolean manager) throws Exception {
 		if( ListTools.isEmpty( viewAbleCategoryIds ) && !manager ){
 		if( ListTools.isEmpty( viewAbleCategoryIds ) && !manager ){
 			return 0L;
 			return 0L;
@@ -198,6 +250,28 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 根据指定的条件获取符合条件的下一页文档信息列表
+	 * @param id  上一页最后一条信息ID,如果为第一页,则传入"(0)"
+	 * @param count  一页查询的条目数量
+	 * @param viewAbleCategoryIds   用于过滤的可见信息分类ID列表
+	 * @param title   用于过滤的文档标题
+	 * @param publisherList  用于过滤的发布者列表
+	 * @param createDateList  用于过滤的信息创建日期列表
+	 * @param publishDateList  用于过滤的信息发布日期列表
+	 * @param statusList  用于过滤的信息文档状态列表
+	 * @param documentType  用于过滤的信息类别
+	 * @param creatorUnitNameList  用于过滤的创建者所属组织名称列表
+	 * @param importBatchNames  用于过滤的导入数据批次名称列表
+	 * @param personNames  用于过滤权限的人员姓名列表
+	 * @param unitNames  用于过滤权限的人员所属组织名称列表
+	 * @param groupNames  用于过滤权限的群组名称列表
+	 * @param orderField  用于查询结果排序的属性名称
+	 * @param order  查询结果的排序方式
+	 * @param manager  查询者身份是否为管理员权限
+	 * @return
+	 * @throws Exception
+	 */
 	public List<Document> listNextWithCondition(String id, Integer count, List<String> viewAbleCategoryIds, String title, List<String> publisherList, 
 	public List<Document> listNextWithCondition(String id, Integer count, List<String> viewAbleCategoryIds, String title, List<String> publisherList, 
 			List<String> createDateList,  List<String> publishDateList,  List<String> statusList, String documentType, 
 			List<String> createDateList,  List<String> publishDateList,  List<String> statusList, String documentType, 
 			List<String>  creatorUnitNameList, List<String> importBatchNames, List<String> personNames, 
 			List<String>  creatorUnitNameList, List<String> importBatchNames, List<String> personNames, 
@@ -219,6 +293,14 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据指定的信息分类ID列表以及文档类别,列示指定人员(根据creatorPerson匹配)草稿状态的文档信息列表
+	 * @param name  指定人员名称
+	 * @param categoryIdList  指定信息分类ID列表
+	 * @param documentType  指定信息类别
+	 * @return
+	 * @throws Exception
+	 */
 	public List<Document> listMyDraft( String name, List<String> categoryIdList, String documentType ) throws Exception {
 	public List<Document> listMyDraft( String name, List<String> categoryIdList, String documentType ) throws Exception {
 		if( name == null || name.isEmpty()){
 		if( name == null || name.isEmpty()){
 			throw new Exception("name is null!");
 			throw new Exception("name is null!");
@@ -233,6 +315,13 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 从文档中获取指定数据根路径为path0的数据
+	 * @param document  文档信息对象
+	 * @param path0  path0名称
+	 * @return
+	 * @throws Exception
+	 */
 	public Item getDataWithDocIdWithPath(Document document, String path0 ) throws Exception {
 	public Item getDataWithDocIdWithPath(Document document, String path0 ) throws Exception {
 		if( path0 == null || path0.isEmpty()){
 		if( path0 == null || path0.isEmpty()){
 			throw new Exception("path0 is null!");
 			throw new Exception("path0 is null!");
@@ -248,17 +337,17 @@ public class DocumentInfoServiceAdv {
 	}
 	}
 
 
 	/**
 	/**
-	 * 普通用戶的查詢,帶權限查詢
-	 * @param title
-	 * @param appIdList
-	 * @param categoryIdList
-	 * @param publisherList
-	 * @param createDateList
-	 * @param publishDateList
-	 * @param statusList
-	 * @param personName
-	 * @param viewableCategoryIds
-	 * @param maxResultCount
+	 * 普通用戶的查詢(帶權限查詢)
+	 * @param title   用于过滤的文档标题
+	 * @param appIdList  用于过滤的信息栏目ID列表
+	 * @param categoryIdList  用于过滤的信息分类ID列表
+	 * @param publisherList   用于过滤的发布者列表
+	 * @param createDateList  用于过滤的信息创建日期列表
+	 * @param publishDateList  用于过滤的信息发布日期列表
+	 * @param statusList  用于过滤的信息文档状态列表
+	 * @param personName  用于过滤权限的人员名称
+	 * @param viewableCategoryIds   用于过滤的可见信息分类ID列表
+	 * @param maxResultCount  查询最大文档数量
 	 * @return
 	 * @return
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
@@ -285,17 +374,17 @@ public class DocumentInfoServiceAdv {
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 管理員的查詢,跨越權限
-	 * @param title
-	 * @param appIdList
-	 * @param appAliasList
-	 * @param categoryIdList
-	 * @param categoryAliasList
-	 * @param publisherList
-	 * @param createDateList
-	 * @param publishDateList
-	 * @param statusList
-	 * @param maxResultCount
+	 * 管理員的查詢(跨越權限)
+	 * @param title   用于过滤的文档标题
+	 * @param appIdList  用于过滤的信息栏目ID列表
+	 * @param appAliasList  用于过滤的信息栏目别外列表
+	 * @param categoryIdList  用于过滤的信息分类ID列表
+	 * @param categoryAliasList  用于过滤的信息分类别名列表
+	 * @param publisherList  用于过滤的发布者列表
+	 * @param createDateList  用于过滤的信息创建日期列表
+	 * @param publishDateList  用于过滤的信息发布日期列表
+	 * @param statusList  用于过滤的信息文档状态列表
+	 * @param maxResultCount  查询最大文档数量
 	 * @return
 	 * @return
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
@@ -310,6 +399,11 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 根据信息文档对象,向信息数据Item对象里补充distributeFactor、bundle和itemCategory信息
+	 * @param o  信息数据对象
+	 * @param document  信息对象
+	 */
 	void fill(Item o, Document document) {
 	void fill(Item o, Document document) {
 		/** 将DateItem与Document放在同一个分区 */
 		/** 将DateItem与Document放在同一个分区 */
 		o.setDistributeFactor(document.getDistributeFactor());
 		o.setDistributeFactor(document.getDistributeFactor());
@@ -317,6 +411,12 @@ public class DocumentInfoServiceAdv {
 		o.setItemCategory(ItemCategory.cms);
 		o.setItemCategory(ItemCategory.cms);
 	}
 	}
 	
 	
+	/**
+	 * 获取信息被阅读次数
+	 * @param id  信息文档ID
+	 * @return
+	 * @throws Exception
+	 */
 	public Long getViewCount( String id ) throws Exception {
 	public Long getViewCount( String id ) throws Exception {
 		if( id == null || id.isEmpty() ){
 		if( id == null || id.isEmpty() ){
 			throw new Exception("id is null!");
 			throw new Exception("id is null!");
@@ -332,7 +432,7 @@ public class DocumentInfoServiceAdv {
 
 
 	/**
 	/**
 	 * 根据组织好的document对象更新数据库中文档的权限信息
 	 * 根据组织好的document对象更新数据库中文档的权限信息
-	 * @param document
+	 * @param document  信息文档对象
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public void updateAllPermission(Document document) throws Exception {
 	public void updateAllPermission(Document document) throws Exception {
@@ -363,9 +463,9 @@ public class DocumentInfoServiceAdv {
 
 
 	/**
 	/**
 	 * 根据读者作者列表更新文档所有的权限信息
 	 * 根据读者作者列表更新文档所有的权限信息
-	 * @param docId
-	 * @param readerList
-	 * @param authorList
+	 * @param docId  信息文档ID
+	 * @param readerList  信息读者权限列表
+	 * @param authorList  信息作者权限列表(允许修改信息的人员)
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public void refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
 	public void refreshDocumentPermission( String docId, List<PermissionInfo> readerList, List<PermissionInfo> authorList ) throws Exception {
@@ -377,8 +477,8 @@ public class DocumentInfoServiceAdv {
 
 
 	/**
 	/**
 	 * 根据组织好的权限信息列表更新指定文档的权限信息
 	 * 根据组织好的权限信息列表更新指定文档的权限信息
-	 * @param docId
-	 * @param permissionList
+	 * @param docId  信息文档ID
+	 * @param permissionList  信息权限列表
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public void refreshDocumentPermission(String docId, List<PermissionInfo> permissionList) throws Exception {
 	public void refreshDocumentPermission(String docId, List<PermissionInfo> permissionList) throws Exception {
@@ -390,8 +490,8 @@ public class DocumentInfoServiceAdv {
 
 
 	/**
 	/**
 	 * 变更一个文档的分类信息
 	 * 变更一个文档的分类信息
-	 * @param document
-	 * @param categoryInfo
+	 * @param document  信息文档对象
+	 * @param categoryInfo  新的信息分类对象
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public Boolean changeCategory( Document document, CategoryInfo categoryInfo) throws Exception {
 	public Boolean changeCategory( Document document, CategoryInfo categoryInfo) throws Exception {
@@ -432,6 +532,13 @@ public class DocumentInfoServiceAdv {
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	 * 根据文档ID列表,批量修改数据
+	 * @param docIds  文档ID
+	 * @param dataChanges  数据修改信息
+	 * @return
+	 * @throws Exception
+	 */
 	public Wo changeData(List<String> docIds, List<WiDataChange> dataChanges) throws Exception {
 	public Wo changeData(List<String> docIds, List<WiDataChange> dataChanges) throws Exception {
 		if( ListTools.isEmpty( docIds )){
 		if( ListTools.isEmpty( docIds )){
 			throw new Exception("docIds is empty!");
 			throw new Exception("docIds is empty!");

+ 2 - 2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/PermissionOperateService.java

@@ -224,7 +224,7 @@ public class PermissionOperateService {
 						emc.commit();
 						emc.commit();
 						continue;
 						continue;
 					}
 					}
-					documentIds = business.getDocumentFactory().listByCategoryId( categoryInfo.getId() );
+					documentIds = business.getDocumentFactory().listByCategoryId( categoryInfo.getId(), 9999999 );
 					if( ListTools.isNotEmpty( documentIds )) {
 					if( ListTools.isNotEmpty( documentIds )) {
 						documentList = emc.list( Document.class,  documentIds );
 						documentList = emc.list( Document.class,  documentIds );
 //						documentList = business.getDocumentFactory().list( documentIds );
 //						documentList = business.getDocumentFactory().list( documentIds );
@@ -286,7 +286,7 @@ public class PermissionOperateService {
 				return;
 				return;
 			}
 			}
 			appInfo = emc.find( categoryInfo.getAppId(), AppInfo.class );
 			appInfo = emc.find( categoryInfo.getAppId(), AppInfo.class );
-			documentIds = business.getDocumentFactory().listByCategoryId( categoryInfo.getId() );
+			documentIds = business.getDocumentFactory().listByCategoryId( categoryInfo.getId(), 9999999 );
 			if( ListTools.isNotEmpty( documentIds )) {
 			if( ListTools.isNotEmpty( documentIds )) {
 				documentList = emc.list( Document.class,  documentIds );
 				documentList = emc.list( Document.class,  documentIds );
 //				documentList = business.getDocumentFactory().list( documentIds );
 //				documentList = business.getDocumentFactory().list( documentIds );