roo00 hace 6 años
padre
commit
50de0f26ca
Se han modificado 36 ficheros con 610 adiciones y 348 borrados
  1. 7 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/LogLevel.java
  2. 13 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/scripting/ScriptingEngine.java
  3. 16 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java
  4. 4 4
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/factory/BBSSubjectInfoFactory.java
  5. 28 3
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGet.java
  6. 24 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGetAll.java
  7. 2 3
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGetAllWithPermission.java
  8. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionSave.java
  9. 8 2
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionDelete.java
  10. 33 17
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionListWithSubjectForPage.java
  11. 11 9
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionSave.java
  12. 2 2
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/BaseAction.java
  13. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionDelete.java
  14. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionDeleteForce.java
  15. 27 3
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionGet.java
  16. 2 2
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionSave.java
  17. 5 2
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectDelete.java
  18. 157 132
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectGet.java
  19. 3 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectLock.java
  20. 4 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSave.java
  21. 1 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSetCream.java
  22. 1 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSetOriginal.java
  23. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSubmitVoteResult.java
  24. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnAcceptReply.java
  25. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnComplete.java
  26. 2 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnLock.java
  27. 51 8
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectView.java
  28. 21 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSSubjectInfoService.java
  29. 17 0
      o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSSubjectInfoServiceAdv.java
  30. 0 1
      o2server/x_bbs_core_entity/src/main/java/com/x/bbs/entity/BBSForumInfo.java
  31. 1 1
      o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java
  32. 1 1
      o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/schedule/AlarmTrigger.java
  33. 4 4
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/DocumentFactory.java
  34. 1 1
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionListNextWithFilter.java
  35. 151 152
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionView.java
  36. 1 1
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionListNextPageViewData.java

+ 7 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/LogLevel.java

@@ -43,6 +43,9 @@ public class LogLevel extends ConfigObject {
 	@FieldDescribe("是否启用调试")
 	private String x_general_assemble_control = "";
 
+	@FieldDescribe("是否启用调试")
+	private String x_file_assemble_control = "";
+
 	public static LogLevel defaultInstance() {
 		return new LogLevel();
 	}
@@ -95,6 +98,10 @@ public class LogLevel extends ConfigObject {
 		return this.get(this.x_general_assemble_control);
 	}
 
+	public String x_file_assemble_control() {
+		return this.get(this.x_general_assemble_control);
+	}
+
 	private String get(String str) {
 		if (StringUtils.equalsIgnoreCase(str, Logger.ERROR)) {
 			return Logger.ERROR;

+ 13 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/scripting/ScriptingEngine.java

@@ -38,6 +38,9 @@ public class ScriptingEngine {
 	public static final String BINDINGNAME_JAXWSRESPONSE = "jaxwsResponse";
 	public static final String BINDINGNAME_ROUTEDATA = "routeData";
 
+	public static final String BINDINGNAME_ROUTES = "routes";
+	public static final String BINDINGNAME_ROUTE = "route";
+
 	public ScriptingEngine(ScriptEngine scriptEngine) {
 		this.scriptEngine = scriptEngine;
 	}
@@ -114,6 +117,16 @@ public class ScriptingEngine {
 		return this;
 	}
 
+	public ScriptingEngine bindingRoutes(Object o) {
+		this.scriptEngine.put(BINDINGNAME_ROUTES, o);
+		return this;
+	}
+
+	public ScriptingEngine bindingRoute(Object o) {
+		this.scriptEngine.put(BINDINGNAME_ROUTE, o);
+		return this;
+	}
+
 	public Object eval(String scriptText) throws Exception {
 		StringBuffer sb = new StringBuffer();
 		try {

+ 16 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java

@@ -0,0 +1,16 @@
+package com.x.base.core.project.tools;
+
+import org.apache.commons.beanutils.PropertyUtils;
+
+public class PropertyTools {
+	@SuppressWarnings("unchecked")
+	public static <T> T getOrElse(Object bean, String name, Class<T> cls, T defaultObject) throws Exception {
+		if (null == bean) {
+			return defaultObject;
+		}
+		if (PropertyUtils.isReadable(bean, name)) {
+			return (T) PropertyUtils.getProperty(bean, name);
+		}
+		return defaultObject;
+	}
+}

+ 4 - 4
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/factory/BBSSubjectInfoFactory.java

@@ -277,7 +277,7 @@ public class BBSSubjectInfoFactory extends AbstractFactory {
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.sectionId ), sectionId));
 		}
 		if( needPicture != null && needPicture ){
-			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ) );
+			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ),  cb.notEqual( root.get( BBSSubjectInfo_.picId ), ""));
 		}
 		if( creatorName != null && !creatorName.isEmpty() ){
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.creatorName ), creatorName ) );
@@ -316,7 +316,7 @@ public class BBSSubjectInfoFactory extends AbstractFactory {
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.sectionId ), sectionId));
 		}
 		if( needPicture != null && needPicture ){
-			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ) );
+			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ),  cb.notEqual( root.get( BBSSubjectInfo_.picId ), ""));
 		}
 		if( creatorName != null && !creatorName.isEmpty() ){
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.creatorName ), creatorName ) );
@@ -418,7 +418,7 @@ public class BBSSubjectInfoFactory extends AbstractFactory {
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.sectionId ), sectionId));
 		}
 		if( needPicture != null && needPicture ){
-			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ) );
+			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ),  cb.notEqual( root.get( BBSSubjectInfo_.picId ), ""));
 		}
 		cq.select( cb.count( root ) );		
 		return em.createQuery(cq.where(p)).getSingleResult();
@@ -454,7 +454,7 @@ public class BBSSubjectInfoFactory extends AbstractFactory {
 			p = cb.and( p, cb.equal( root.get( BBSSubjectInfo_.sectionId ), sectionId));
 		}
 		if( needPicture != null && needPicture ){
-			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ) );
+			p = cb.and( p, cb.isNotNull( root.get( BBSSubjectInfo_.picId ) ),  cb.notEqual( root.get( BBSSubjectInfo_.picId ), ""));
 		}
 		cq.orderBy( cb.desc( root.get( BBSSubjectInfo_.createTime ) ) );
 		return em.createQuery(cq.where(p)).setMaxResults( maxRecordCount ).getResultList();

+ 28 - 3
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGet.java

@@ -21,15 +21,17 @@ import com.x.bbs.assemble.control.jaxrs.foruminfo.exception.ExceptionForumInfoPr
 import com.x.bbs.entity.BBSForumInfo;
 import com.x.bbs.entity.BBSSectionInfo;
 
+import net.sf.ehcache.Element;
+
 public class ActionGet extends BaseAction {
 	
 	private static  Logger logger = LoggerFactory.getLogger( ActionGet.class );
 	
+	@SuppressWarnings("unchecked")
 	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
-		Wo wrap = null;
-		BBSForumInfo forumInfo = null;
 		Boolean check = true;
+		
 		if( check ){
 			if( id == null || id.isEmpty() ){
 				check = false;
@@ -38,6 +40,28 @@ public class ActionGet extends BaseAction {
 			}
 		}
 		
+		if( check ){
+			String cacheKey = "forum#" + id;
+			Element element = cache.get( cacheKey );
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<Wo> result_cache = (ActionResult<Wo>) element.getObjectValue();
+				result.setData( result_cache.getData() );
+				result.setCount( 1L);
+			} else {
+				//继续进行数据查询
+				result = getForumQueryResult( id, request, effectivePerson );
+				cache.put(new Element(cacheKey, result ));
+			}
+		}
+		return result;
+	}
+	
+	private ActionResult<Wo> getForumQueryResult(String id, HttpServletRequest request, EffectivePerson effectivePerson) {
+		ActionResult<Wo> result = new ActionResult<>();
+		Wo wrap = null;
+		BBSForumInfo forumInfo = null;
+		Boolean check = true;
+		
 		if( check ){
 			try {
 				forumInfo = forumInfoServiceAdv.get( id );
@@ -57,6 +81,7 @@ public class ActionGet extends BaseAction {
 					//TODO 为了不改变前端的逻辑,此处将List转为String进行输出,逗号分隔
 					wrap.setForumManagerName( wrap.transferStringListToString( wrap.getForumManagerList()) );
 					result.setData( wrap );
+					result.setCount(1L);
 				} catch (Exception e) {
 					check = false;
 					Exception exception = new ExceptionForumInfoProcess( e, "系统将论坛信息对象转换为输出数据时发生异常。" );
@@ -70,7 +95,7 @@ public class ActionGet extends BaseAction {
 		}
 		return result;
 	}
-	
+
 	public static class Wo extends BBSForumInfo{
 		
 		@FieldDescribe("字符串形式输出的管理员信息,逗号(,)分隔.")

+ 24 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGetAll.java

@@ -20,11 +20,34 @@ import com.x.bbs.assemble.control.jaxrs.foruminfo.exception.ExceptionForumInfoPr
 import com.x.bbs.entity.BBSForumInfo;
 import com.x.bbs.entity.BBSSectionInfo;
 
+import net.sf.ehcache.Element;
+
 public class ActionGetAll extends BaseAction {
 	
 	private static  Logger logger = LoggerFactory.getLogger( ActionGetAll.class );
 	
+	@SuppressWarnings("unchecked")
 	protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
+		ActionResult<List<Wo>> result = new ActionResult<>();
+		Boolean check = true;
+		
+		if( check ){
+			String cacheKey = "forum#all";
+			Element element = cache.get( cacheKey );
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<List<Wo>> result_cache = (ActionResult<List<Wo>>) element.getObjectValue();
+				result.setData( result_cache.getData() );
+				result.setCount( 1L);
+			} else {
+				//继续进行数据查询
+				result = getForumAllQueryResult( request, effectivePerson );
+				cache.put(new Element(cacheKey, result ));
+			}
+		}
+		return result;
+	}
+
+	private ActionResult<List<Wo>> getForumAllQueryResult(HttpServletRequest request, EffectivePerson effectivePerson) {
 		ActionResult<List<Wo>> result = new ActionResult<>();
 		List<Wo> wraps = new ArrayList<>();
 		List<BBSForumInfo> forumInfoList = null;
@@ -62,6 +85,7 @@ public class ActionGetAll extends BaseAction {
 			}
 		}
 		result.setData( wraps );
+		result.setCount( Long.parseLong( wraps.size() + "") );
 		return result;
 	}
 

+ 2 - 3
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionGetAllWithPermission.java

@@ -33,7 +33,6 @@ public class ActionGetAllWithPermission extends BaseAction {
 		Boolean check = true;
 		Boolean isBBSManager = false;
 		
-		
 		if ( check ) {
 			isBBSManager = ThisApplication.isBBSManager(effectivePerson);
 		}
@@ -48,7 +47,7 @@ public class ActionGetAllWithPermission extends BaseAction {
 				result.setCount( result_cache.getCount() );
 			} else {
 				//继续进行数据查询;
-				result = getForumQueryResult( request, effectivePerson, isBBSManager );
+				result = getForumWithPermissionQueryResult( request, effectivePerson, isBBSManager );
 				cache.put(new Element(cacheKey, result ));
 			}
 		}		
@@ -56,7 +55,7 @@ public class ActionGetAllWithPermission extends BaseAction {
 	}
 
 	@SuppressWarnings("unchecked")
-	private ActionResult<List<Wo>> getForumQueryResult(HttpServletRequest request, EffectivePerson effectivePerson, Boolean isBBSManager) {
+	private ActionResult<List<Wo>> getForumWithPermissionQueryResult(HttpServletRequest request, EffectivePerson effectivePerson, Boolean isBBSManager) {
 		ActionResult<List<Wo>> result = new ActionResult<>();
 		List<Wo> wraps = new ArrayList<>();
 		Boolean check = true;

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/foruminfo/ActionSave.java

@@ -159,9 +159,11 @@ public class ActionSave extends BaseAction {
 				}
 				forumInfo = forumInfoServiceAdv.save( forumInfo );
 				wo.setId(forumInfo.getId());
+				
 				ApplicationCache.notify( BBSForumInfo.class );
 				ApplicationCache.notify( BBSSectionInfo.class );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionForumInfoProcess(e, "系统在保存BBS论坛分区信息时发生异常.");

+ 8 - 2
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionDelete.java

@@ -2,6 +2,7 @@ package com.x.bbs.assemble.control.jaxrs.replyinfo;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
@@ -11,6 +12,8 @@ import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionReplyIdEmpt
 import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionReplyInfoProcess;
 import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionReplyNotExists;
 import com.x.bbs.entity.BBSReplyInfo;
+import com.x.bbs.entity.BBSSectionInfo;
+import com.x.bbs.entity.BBSSubjectInfo;
 
 public class ActionDelete extends BaseAction {
 
@@ -54,8 +57,11 @@ public class ActionDelete extends BaseAction {
 			wo.setId( id );
 			result.setData( wo );
 			
-			operationRecordService.replyOperation(effectivePerson.getDistinguishedName(), replyInfo, "DELETE", hostIp,
-					hostName);
+			ApplicationCache.notify( BBSSubjectInfo.class );
+			ApplicationCache.notify( BBSReplyInfo.class );
+			ApplicationCache.notify( BBSSectionInfo.class );
+			
+			operationRecordService.replyOperation(effectivePerson.getDistinguishedName(), replyInfo, "DELETE", hostIp, hostName);
 		} catch (Exception e) {
 			check = false;
 			Exception exception = new ExceptionReplyInfoProcess(e, "根据指定ID删除回复信息时发生异常.ID:" + id);

+ 33 - 17
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionListWithSubjectForPage.java

@@ -19,16 +19,15 @@ import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionPageEmpty;
 import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionReplyInfoProcess;
 import com.x.bbs.entity.BBSReplyInfo;
 
+import net.sf.ehcache.Element;
+
 public class ActionListWithSubjectForPage extends BaseAction {
 	
 	private static  Logger logger = LoggerFactory.getLogger( ActionListWithSubjectForPage.class );
 	
+	@SuppressWarnings("unchecked")
 	protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, Integer page, Integer count, JsonElement jsonElement ) throws Exception {
 		ActionResult<List<Wo>> result = new ActionResult<>();
-		List<Wo> wraps = new ArrayList<>();
-		List<BBSReplyInfo> replyInfoList = null;
-		List<BBSReplyInfo> replyInfoList_out = new ArrayList<BBSReplyInfo>();
-		Long total = 0L;
 		Wi wrapIn = null;
 		Boolean check = true;
 		
@@ -41,6 +40,30 @@ public class ActionListWithSubjectForPage extends BaseAction {
 			logger.error( e, effectivePerson, request, null);
 		}
 		
+		if( check ) {
+			String cacheKey = wrapIn.getSubjectId() + "#" + page + "#" + count;
+			Element element = cache.get( cacheKey );
+			
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<List<Wo>> result_cache = (ActionResult<List<Wo>>) element.getObjectValue();
+				result.setData( result_cache.getData() );
+				result.setCount( result_cache.getCount() );
+			} else {
+				result = getReplyQueryResult(wrapIn, request, effectivePerson, page, count);
+				cache.put(new Element(cacheKey, result ));
+			}
+		}
+		return result;
+	}
+
+	public ActionResult<List<Wo>> getReplyQueryResult( Wi wrapIn, HttpServletRequest request, EffectivePerson effectivePerson, Integer page, Integer count ) {
+		ActionResult<List<Wo>> result = new ActionResult<>();
+		List<Wo> wraps = new ArrayList<>();
+		List<BBSReplyInfo> replyInfoList = null;
+		List<BBSReplyInfo> replyInfoList_out = new ArrayList<BBSReplyInfo>();
+		Long total = 0L;
+		Boolean check = true;
+		
 		if( check ){
 			if( page == null ){
 				check = false;
@@ -118,29 +141,22 @@ public class ActionListWithSubjectForPage extends BaseAction {
 		result.setCount( total );
 		return result;
 	}
-
+	
 	public static class Wi{
-
-		private String subjectId = null;
-		
+		private String subjectId = null;		
 		public static List<String> Excludes = new ArrayList<String>( JpaObject.FieldsUnmodify );
-
 		public String getSubjectId() {
 			return subjectId;
 		}
-
 		public void setSubjectId(String subjectId) {
 			this.subjectId = subjectId;
 		}
 	}
 	
-	public static class Wo extends BBSReplyInfo{
-		
-		private static final long serialVersionUID = -5076990764713538973L;
-		
-		public static List<String> Excludes = new ArrayList<String>();
-		
-		public static WrapCopier< BBSReplyInfo, Wo > copier = WrapCopierFactory.wo( BBSReplyInfo.class, Wo.class, null, JpaObject.FieldsInvisible);
+	public static class Wo extends BBSReplyInfo{		
+		private static final long serialVersionUID = -5076990764713538973L;		
+		public static List<String> Excludes = new ArrayList<String>();		
+		public static WrapCopier< BBSReplyInfo, Wo > copier = WrapCopierFactory.wo( BBSReplyInfo.class, Wo.class, null, JpaObject.FieldsInvisible);		
 		
 		@FieldDescribe( "创建人姓名" )
 		private String creatorNameShort = "";

+ 11 - 9
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionSave.java

@@ -9,6 +9,7 @@ import com.google.gson.JsonElement;
 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.ApplicationCache;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
@@ -164,15 +165,13 @@ public class ActionSave extends BaseAction {
 								"SECTION_REPLY_PUBLISH_" + subjectInfo.getMainSectionId());
 						if (!hasPermission) {
 							check = false;
-							Exception exception = new ExceptionSectionInsufficientPermissions(
-									sectionInfo.getSectionName(), "SECTION_REPLY_PUBLISH");
+							Exception exception = new ExceptionSectionInsufficientPermissions( sectionInfo.getSectionName(), "SECTION_REPLY_PUBLISH");
 							result.error(exception);
 						}
 					} catch (Exception e) {
 						check = false;
 						Exception exception = new ExceptionSectionPermissionsCheck(e,
-								effectivePerson.getDistinguishedName(), sectionInfo.getSectionName(),
-								"SECTION_REPLY_PUBLISH");
+								effectivePerson.getDistinguishedName(), sectionInfo.getSectionName(), "SECTION_REPLY_PUBLISH");
 						result.error(exception);
 						logger.error(e, effectivePerson, request, null);
 					}
@@ -210,8 +209,7 @@ public class ActionSave extends BaseAction {
 					}
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionForumPermissionsCheck(e, effectivePerson.getDistinguishedName(),
-							subjectInfo.getForumName(), "FORUM_REPLY_PUBLISH");
+					Exception exception = new ExceptionForumPermissionsCheck(e, effectivePerson.getDistinguishedName(), subjectInfo.getForumName(), "FORUM_REPLY_PUBLISH");
 					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
@@ -260,9 +258,13 @@ public class ActionSave extends BaseAction {
 				Wo wo = new Wo();
 				wo.setId(replyInfo.getId());
 				result.setData(wo);
-
-				operationRecordService.replyOperation(effectivePerson.getDistinguishedName(), replyInfo, "CREATE",
-						hostIp, hostName);
+				
+				ApplicationCache.notify( BBSReplyInfo.class );
+				ApplicationCache.notify( BBSForumInfo.class );
+				ApplicationCache.notify( BBSSectionInfo.class );
+				ApplicationCache.notify( BBSSubjectInfo.class );
+				
+				operationRecordService.replyOperation(effectivePerson.getDistinguishedName(), replyInfo, "CREATE", hostIp, hostName);
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionReplyInfoProcess(e, "系统在保存回复信息时发生异常。");

+ 2 - 2
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/BaseAction.java

@@ -11,13 +11,13 @@ import com.x.bbs.assemble.control.service.BBSSectionInfoServiceAdv;
 import com.x.bbs.assemble.control.service.BBSSubjectInfoService;
 import com.x.bbs.assemble.control.service.UserManagerService;
 import com.x.bbs.assemble.control.service.UserPermissionService;
+import com.x.bbs.entity.BBSSubjectInfo;
 
 import net.sf.ehcache.Ehcache;
 
 public class BaseAction extends StandardJaxrsAction{
-	
+	protected Ehcache cache = ApplicationCache.instance().getCache( BBSSubjectInfo.class);
 	protected UserPermissionService UserPermissionService = new UserPermissionService();
-	protected Ehcache cache = ApplicationCache.instance().getCache( BaseAction.class);
 	protected BBSReplyInfoService replyInfoService = new BBSReplyInfoService();
 	protected BBSSubjectInfoService subjectInfoService = new BBSSubjectInfoService();
 	protected BBSSectionInfoServiceAdv sectionInfoServiceAdv = new BBSSectionInfoServiceAdv();

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionDelete.java

@@ -123,9 +123,11 @@ public class ActionDelete extends BaseAction {
 				// 已经没有子版块和任何贴子信息了,所以只需要删除相应的权限信息即可
 				sectionInfoServiceAdv.delete( id );
 				wo.setId( id );
+				
 				ApplicationCache.notify( BBSForumInfo.class );
 				ApplicationCache.notify( BBSSectionInfo.class );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 				operationRecordService.sectionOperation(effectivePerson.getDistinguishedName(), sectionInfo, "DELETE", hostIp, hostName);
 			} catch (Exception e) {
 				check = false;

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionDeleteForce.java

@@ -83,9 +83,11 @@ public class ActionDeleteForce extends BaseAction {
 			try {
 				sectionInfoServiceAdv.deleteForce(id);
 				wo.setId( id );
+				
 				ApplicationCache.notify( BBSForumInfo.class );
 				ApplicationCache.notify( BBSSectionInfo.class );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 				operationRecordService.sectionOperation(effectivePerson.getDistinguishedName(), sectionInfo, "DELETE", hostIp, hostName);
 			} catch (Exception e) {
 				check = false;

+ 27 - 3
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionGet.java

@@ -17,14 +17,15 @@ import com.x.bbs.assemble.control.jaxrs.sectioninfo.exception.ExceptionSectionIn
 import com.x.bbs.assemble.control.jaxrs.sectioninfo.exception.ExceptionSectionNotExists;
 import com.x.bbs.entity.BBSSectionInfo;
 
+import net.sf.ehcache.Element;
+
 public class ActionGet extends BaseAction {
 	
 	private static  Logger logger = LoggerFactory.getLogger( ActionGet.class );
 	
+	@SuppressWarnings("unchecked")
 	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
-		Wo wrap = null;
-		BBSSectionInfo sectionInfo = null;
 		Boolean check = true;
 		
 		if( check ){
@@ -34,6 +35,29 @@ public class ActionGet extends BaseAction {
 				result.error( exception );
 			}
 		}
+		
+		if( check ){
+			String cacheKey = "section#" + id;
+			Element element = cache.get( cacheKey );
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<Wo> result_cache = (ActionResult<Wo>) element.getObjectValue();
+				result.setData( result_cache.getData() );
+				result.setCount( 1L);
+			} else {
+				//继续进行数据查询
+				result = getSectionQueryResult( id, request, effectivePerson );
+				cache.put(new Element(cacheKey, result ));
+			}
+		}
+		return result;
+	}
+
+	private ActionResult<Wo> getSectionQueryResult(String id, HttpServletRequest request, EffectivePerson effectivePerson) {
+		ActionResult<Wo> result = new ActionResult<>();
+		Wo wrap = null;
+		BBSSectionInfo sectionInfo = null;
+		Boolean check = true;
+		
 		if( check ){
 			try {
 				sectionInfo = sectionInfoServiceAdv.get( id );
@@ -62,7 +86,7 @@ public class ActionGet extends BaseAction {
 		}
 		return result;
 	}
-
+	
 	public static class Wo extends BBSSectionInfo{
 		
 		private static final long serialVersionUID = -5076990764713538973L;

+ 2 - 2
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/sectioninfo/ActionSave.java

@@ -227,13 +227,13 @@ public class ActionSave extends BaseAction {
 				if( sectionInfo.getUpdateTime() == null ) {
 					sectionInfo.setUpdateTime( sectionInfo.getCreateTime() );
 				}
-				sectionInfo = sectionInfoServiceAdv.save( sectionInfo );
-				
+				sectionInfo = sectionInfoServiceAdv.save( sectionInfo );				
 				wo.setId( sectionInfo.getId() );
 				
 				ApplicationCache.notify( BBSForumInfo.class );
 				ApplicationCache.notify( BBSSectionInfo.class );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 				if ( sectionInfo.getCreateTime().compareTo( sectionInfo.getUpdateTime() ) == 0 ) {
 					operationRecordService.sectionOperation(effectivePerson.getDistinguishedName(), sectionInfo, "CREATE", hostIp, hostName);
 				} else {

+ 5 - 2
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectDelete.java

@@ -12,6 +12,8 @@ import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectId
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectInfoProcess;
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectNotExists;
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectQueryById;
+import com.x.bbs.entity.BBSForumInfo;
+import com.x.bbs.entity.BBSSectionInfo;
 import com.x.bbs.entity.BBSSubjectInfo;
 
 public class ActionSubjectDelete extends BaseAction {
@@ -55,10 +57,11 @@ public class ActionSubjectDelete extends BaseAction {
 			wo.setId( id );
 			
 			ApplicationCache.notify( BBSSubjectInfo.class );
+			ApplicationCache.notify( BBSSectionInfo.class );
+			ApplicationCache.notify( BBSForumInfo.class );
 			
 			// 记录操作日志
-			operationRecordService.subjectOperation(effectivePerson.getDistinguishedName(), subjectInfo, "DELETE",
-					hostIp, hostName);
+			operationRecordService.subjectOperation(effectivePerson.getDistinguishedName(), subjectInfo, "DELETE", hostIp, hostName);
 		} catch (Exception e) {
 			check = false;
 			Exception exception = new ExceptionSubjectInfoProcess(e, "根据指定ID删除主题信息时发生异常.ID:" + id);

+ 157 - 132
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectGet.java

@@ -24,11 +24,45 @@ import com.x.bbs.entity.BBSSubjectInfo;
 import com.x.bbs.entity.BBSVoteOption;
 import com.x.bbs.entity.BBSVoteOptionGroup;
 
+import net.sf.ehcache.Element;
+
 public class ActionSubjectGet extends BaseAction {
-	
-	private static  Logger logger = LoggerFactory.getLogger( ActionSubjectGet.class );
-	
-	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionSubjectGet.class);
+
+	@SuppressWarnings("unchecked")
+	protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id)
+			throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		Boolean check = true;
+
+		if (check) {
+			if (id == null || id.isEmpty()) {
+				check = false;
+				Exception exception = new ExceptionSubjectIdEmpty();
+				result.error(exception);
+			}
+		}
+
+		if (check) {
+			String cacheKey = "subject#get#" + id;
+			Element element = cache.get(cacheKey);
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<Wo> result_cache = (ActionResult<Wo>) element.getObjectValue();
+				result.setData(result_cache.getData());
+				result.setCount(1L);
+			} else {
+				// 继续进行数据查询
+				result = getSubjectGetQueryResult(id, request, effectivePerson);
+				cache.put(new Element(cacheKey, result));
+			}
+		}
+
+		return result;
+	}
+
+	private ActionResult<Wo> getSubjectGetQueryResult(String id, HttpServletRequest request,
+			EffectivePerson effectivePerson) {
 		ActionResult<Wo> result = new ActionResult<>();
 		List<WoSubjectAttachment> wrapSubjectAttachmentList = null;
 		List<BBSSubjectAttachment> subjectAttachmentList = null;
@@ -41,184 +75,175 @@ public class ActionSubjectGet extends BaseAction {
 		String subjectContent = null;
 		Boolean check = true;
 		
-		if( check ){
-			if( id == null || id.isEmpty() ){
-				check = false;
-				Exception exception = new ExceptionSubjectIdEmpty();
-				result.error( exception );
-			}
-		}
-		
-		//查询版块信息是否存在
+		// 查询版块信息是否存在
 		if (check) {
 			try {
-				subjectInfo = subjectInfoServiceAdv.get( id );
+				subjectInfo = subjectInfoServiceAdv.get(id);
 			} catch (Exception e) {
 				check = false;
-				Exception exception = new ExceptionSubjectQueryById( e, id );
-				result.error( exception );
-				logger.error( e, effectivePerson, request, null);
+				Exception exception = new ExceptionSubjectQueryById(e, id);
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
 			}
 		}
 
 		if (check) {
-			if ( subjectInfo == null ) {
+			if (subjectInfo == null) {
 				check = false;
-				Exception exception = new ExceptionSubjectNotExists( id );
-				result.error( exception );
-				//logger.error( e, effectivePerson, request, null);
-			}else{//查到了主题信息
+				Exception exception = new ExceptionSubjectNotExists(id);
+				result.error(exception);
+				// logger.error( e, effectivePerson, request, null);
+			} else {// 查到了主题信息
 				try {
-					wrap = Wo.copier.copy( subjectInfo );
-					//根据附件ID列表查询附件信息
-					if( subjectInfo.getAttachmentList() != null && subjectInfo.getAttachmentList().size() > 0 ){
-						subjectAttachmentList = subjectInfoServiceAdv.listAttachmentByIds( subjectInfo.getAttachmentList() );
-						if( subjectAttachmentList != null && subjectAttachmentList.size() > 0 ){
-							wrapSubjectAttachmentList = WoSubjectAttachment.copier.copy( subjectAttachmentList );
-							wrap.setSubjectAttachmentList( wrapSubjectAttachmentList );
+					wrap = Wo.copier.copy(subjectInfo);
+					// 根据附件ID列表查询附件信息
+					if (subjectInfo.getAttachmentList() != null && subjectInfo.getAttachmentList().size() > 0) {
+						subjectAttachmentList = subjectInfoServiceAdv
+								.listAttachmentByIds(subjectInfo.getAttachmentList());
+						if (subjectAttachmentList != null && subjectAttachmentList.size() > 0) {
+							wrapSubjectAttachmentList = WoSubjectAttachment.copier.copy(subjectAttachmentList);
+							wrap.setSubjectAttachmentList(wrapSubjectAttachmentList);
 						}
 					}
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionSubjectWrapOut( e );
-					result.error( exception );
-					logger.error( e, effectivePerson, request, null);
+					Exception exception = new ExceptionSubjectWrapOut(e);
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
 				}
-			}			
+			}
 		}
 		if (check) {
-			if( wrap != null ){
-				//填充主题的内容信息
+			if (wrap != null) {
+				// 填充主题的内容信息
 				try {
-					subjectContent = subjectInfoServiceAdv.getSubjectContent( id );
-					if( subjectContent != null ){
-						wrap.setContent( subjectContent );
+					subjectContent = subjectInfoServiceAdv.getSubjectContent(id);
+					if (subjectContent != null) {
+						wrap.setContent(subjectContent);
 					}
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionSubjectContentQueryById( e, id );
-					result.error( exception );
-					logger.error( e, effectivePerson, request, null);
+					Exception exception = new ExceptionSubjectContentQueryById(e, id);
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
 				}
 			}
 		}
-		
+
 		if (check) {
-			if( wrap != null ){//获取该主题的投票选项组
+			if (wrap != null) {// 获取该主题的投票选项组
 				try {
-					voteOptionGroupList = subjectVoteService.listVoteOptionGroup( id );
-					if( voteOptionGroupList != null && !voteOptionGroupList.isEmpty() ){
-						wrapOutSubjectVoteOptionGroupList = WoBBSVoteOptionGroup.copier.copy( voteOptionGroupList );
-						for( WoBBSVoteOptionGroup group : wrapOutSubjectVoteOptionGroupList ){
-							voteOptionList = subjectVoteService.listVoteOptionByGroupId( group.getId() );
-							if( voteOptionList != null  && !voteOptionList.isEmpty() ){
+					voteOptionGroupList = subjectVoteService.listVoteOptionGroup(id);
+					if (voteOptionGroupList != null && !voteOptionGroupList.isEmpty()) {
+						wrapOutSubjectVoteOptionGroupList = WoBBSVoteOptionGroup.copier.copy(voteOptionGroupList);
+						for (WoBBSVoteOptionGroup group : wrapOutSubjectVoteOptionGroupList) {
+							voteOptionList = subjectVoteService.listVoteOptionByGroupId(group.getId());
+							if (voteOptionList != null && !voteOptionList.isEmpty()) {
 								try {
-									wrapOutSubjectVoteOptionList = WoBBSVoteOption.copier.copy( voteOptionList );
-									group.setVoteOptions( wrapOutSubjectVoteOptionList );
+									wrapOutSubjectVoteOptionList = WoBBSVoteOption.copier.copy(voteOptionList);
+									group.setVoteOptions(wrapOutSubjectVoteOptionList);
 								} catch (Exception e) {
 									check = false;
-									Exception exception = new ExceptionSubjectWrapOut( e );
-									result.error( exception );
-									logger.error( e, effectivePerson, request, null);
+									Exception exception = new ExceptionSubjectWrapOut(e);
+									result.error(exception);
+									logger.error(e, effectivePerson, request, null);
 								}
 							}
 						}
-						wrap.setVoteOptionGroupList( wrapOutSubjectVoteOptionGroupList );
+						wrap.setVoteOptionGroupList(wrapOutSubjectVoteOptionGroupList);
 					}
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionVoteOptionListById( e, id );
-					result.error( exception );
-					logger.error( e, effectivePerson, request, null);
+					Exception exception = new ExceptionVoteOptionListById(e, id);
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
 				}
 			}
 		}
-		
+
 		if (check) {
-			//将带@形式的人员标识修改为人员的姓名并且赋值到xxShort属性里
-			if( wrap != null ){
-				cutPersonNames( wrap );
+			// 将带@形式的人员标识修改为人员的姓名并且赋值到xxShort属性里
+			if (wrap != null) {
+				cutPersonNames(wrap);
 			}
 		}
-		result.setData( wrap );
+		result.setData(wrap);
 		return result;
 	}
 
 	/**
-	 *  将带@形式的人员标识修改为人员的姓名并且赋值到xxShort属性里
-	 *  
-	 *  latestReplyUserShort = "";
-		bBSIndexSetterNameShort = "";
-		screamSetterNameShort = "";
-		originalSetterNameShort = "";
-		creatorNameShort = "";
-		auditorNameShort = "";
-		
+	 * 将带@形式的人员标识修改为人员的姓名并且赋值到xxShort属性里
+	 * 
+	 * latestReplyUserShort = ""; bBSIndexSetterNameShort = "";
+	 * screamSetterNameShort = ""; originalSetterNameShort = ""; creatorNameShort =
+	 * ""; auditorNameShort = "";
+	 * 
 	 * @param subject
 	 */
-	private void cutPersonNames( Wo subject ) {
-		if( subject != null ) {
-			if( subject.getLatestReplyUser() != null && !subject.getLatestReplyUser().isEmpty() ) {
-				subject.setLatestReplyUserShort( subject.getLatestReplyUser().split( "@" )[0]);
+	private void cutPersonNames(Wo subject) {
+		if (subject != null) {
+			if (subject.getLatestReplyUser() != null && !subject.getLatestReplyUser().isEmpty()) {
+				subject.setLatestReplyUserShort(subject.getLatestReplyUser().split("@")[0]);
 			}
-			if( subject.getbBSIndexSetterName() != null && !subject.getbBSIndexSetterName().isEmpty() ) {
-				subject.setbBSIndexSetterNameShort( subject.getbBSIndexSetterName().split( "@" )[0]);
+			if (subject.getbBSIndexSetterName() != null && !subject.getbBSIndexSetterName().isEmpty()) {
+				subject.setbBSIndexSetterNameShort(subject.getbBSIndexSetterName().split("@")[0]);
 			}
-			if( subject.getScreamSetterName() != null && !subject.getScreamSetterName().isEmpty() ) {
-				subject.setScreamSetterNameShort( subject.getScreamSetterName().split( "@" )[0]);
+			if (subject.getScreamSetterName() != null && !subject.getScreamSetterName().isEmpty()) {
+				subject.setScreamSetterNameShort(subject.getScreamSetterName().split("@")[0]);
 			}
-			if( subject.getOriginalSetterName() != null && !subject.getOriginalSetterName().isEmpty() ) {
-				subject.setOriginalSetterNameShort( subject.getOriginalSetterName().split( "@" )[0]);
+			if (subject.getOriginalSetterName() != null && !subject.getOriginalSetterName().isEmpty()) {
+				subject.setOriginalSetterNameShort(subject.getOriginalSetterName().split("@")[0]);
 			}
-			if( subject.getCreatorName() != null && !subject.getCreatorName().isEmpty() ) {
-				subject.setCreatorNameShort( subject.getCreatorName().split( "@" )[0]);
+			if (subject.getCreatorName() != null && !subject.getCreatorName().isEmpty()) {
+				subject.setCreatorNameShort(subject.getCreatorName().split("@")[0]);
 			}
-			if( subject.getAuditorName() != null && !subject.getAuditorName().isEmpty() ) {
-				subject.setAuditorNameShort( subject.getAuditorName().split( "@" )[0]);
+			if (subject.getAuditorName() != null && !subject.getAuditorName().isEmpty()) {
+				subject.setAuditorNameShort(subject.getAuditorName().split("@")[0]);
 			}
 		}
 	}
-	
-	public static class Wo extends BBSSubjectInfo{
-		
+
+	public static class Wo extends BBSSubjectInfo {
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
+
 		public static List<String> Excludes = new ArrayList<String>();
-		
-		public static WrapCopier< BBSSubjectInfo, Wo > copier = WrapCopierFactory.wo( BBSSubjectInfo.class, Wo.class, null, JpaObject.FieldsInvisible);
-		
+
+		public static WrapCopier<BBSSubjectInfo, Wo> copier = WrapCopierFactory.wo(BBSSubjectInfo.class, Wo.class, null,
+				JpaObject.FieldsInvisible);
+
 		private List<WoSubjectAttachment> subjectAttachmentList;
-		
-		@FieldDescribe( "投票主题的所有投票选项列表." )
+
+		@FieldDescribe("投票主题的所有投票选项列表.")
 		private List<WoBBSVoteOptionGroup> voteOptionGroupList;
-		
+
 		private String content = null;
-		
+
 		private Long voteCount = 0L;
-		
+
 		private String pictureBase64 = null;
-		
-		@FieldDescribe( "最新回复用户" )
+
+		@FieldDescribe("最新回复用户")
 		private String latestReplyUserShort = "";
-		
-		@FieldDescribe( "首页推荐人姓名" )
+
+		@FieldDescribe("首页推荐人姓名")
 		private String bBSIndexSetterNameShort = "";
-		
-		@FieldDescribe( "精华设置人姓名" )
+
+		@FieldDescribe("精华设置人姓名")
 		private String screamSetterNameShort = "";
-		
-		@FieldDescribe( "原创设置人姓名" )
+
+		@FieldDescribe("原创设置人姓名")
 		private String originalSetterNameShort = "";
-		
-		@FieldDescribe( "创建人姓名" )
+
+		@FieldDescribe("创建人姓名")
 		private String creatorNameShort = "";
-		
-		@FieldDescribe( "审核人姓名" )
+
+		@FieldDescribe("审核人姓名")
 		private String auditorNameShort = "";
-		
-		@FieldDescribe( "当前用户是否已经投票过." )
+
+		@FieldDescribe("当前用户是否已经投票过.")
 		private Boolean voted = false;
-		
+
 		public String getLatestReplyUserShort() {
 			return latestReplyUserShort;
 		}
@@ -315,22 +340,22 @@ public class ActionSubjectGet extends BaseAction {
 			this.voteCount = voteCount;
 		}
 	}
-	
-	public static class WoSubjectAttachment extends BBSSubjectAttachment{
-		
+
+	public static class WoSubjectAttachment extends BBSSubjectAttachment {
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
-		
-		public static WrapCopier< BBSSubjectAttachment, WoSubjectAttachment > copier = WrapCopierFactory.wo( BBSSubjectAttachment.class, WoSubjectAttachment.class, null, JpaObject.FieldsInvisible);
+
+		public static WrapCopier<BBSSubjectAttachment, WoSubjectAttachment> copier = WrapCopierFactory
+				.wo(BBSSubjectAttachment.class, WoSubjectAttachment.class, null, JpaObject.FieldsInvisible);
 	}
-	
-	public static class WoBBSVoteOptionGroup extends BBSVoteOptionGroup{
-		
+
+	public static class WoBBSVoteOptionGroup extends BBSVoteOptionGroup {
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
-		
-		public static WrapCopier< BBSVoteOptionGroup, WoBBSVoteOptionGroup > copier = WrapCopierFactory.wo( BBSVoteOptionGroup.class, WoBBSVoteOptionGroup.class, null, JpaObject.FieldsInvisible);
-		
+
+		public static WrapCopier<BBSVoteOptionGroup, WoBBSVoteOptionGroup> copier = WrapCopierFactory
+				.wo(BBSVoteOptionGroup.class, WoBBSVoteOptionGroup.class, null, JpaObject.FieldsInvisible);
+
 		private List<WoBBSVoteOption> voteOptions = null;
 
 		public List<WoBBSVoteOption> getVoteOptions() {
@@ -342,13 +367,13 @@ public class ActionSubjectGet extends BaseAction {
 		}
 	}
 
-	public static class WoBBSVoteOption extends BBSVoteOption{
-		
+	public static class WoBBSVoteOption extends BBSVoteOption {
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
-		
-		public static WrapCopier< BBSVoteOption, WoBBSVoteOption > copier = WrapCopierFactory.wo( BBSVoteOption.class, WoBBSVoteOption.class, null,JpaObject.FieldsInvisible);
-		
+
+		public static WrapCopier<BBSVoteOption, WoBBSVoteOption> copier = WrapCopierFactory.wo(BBSVoteOption.class,
+				WoBBSVoteOption.class, null, JpaObject.FieldsInvisible);
+
 		private Boolean voted = false;
 
 		public Boolean getVoted() {

+ 3 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectLock.java

@@ -2,6 +2,7 @@ package com.x.bbs.assemble.control.jaxrs.subjectinfo;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
@@ -54,6 +55,8 @@ public class ActionSubjectLock extends BaseAction {
 				wo.setId( id );
 				result.setData( wo );
 				
+				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation(e, "用户在锁定主题信息时发生异常!");

+ 4 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSave.java

@@ -21,6 +21,7 @@ import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectSa
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionSubjectWrapIn;
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionVoteOptionEmpty;
 import com.x.bbs.assemble.control.jaxrs.subjectinfo.exception.ExceptionWrapInConvert;
+import com.x.bbs.entity.BBSForumInfo;
 import com.x.bbs.entity.BBSSectionInfo;
 import com.x.bbs.entity.BBSSubjectInfo;
 
@@ -143,6 +144,9 @@ public class ActionSubjectSave extends BaseAction {
 				wo.setId(subjectInfo.getId());
 				
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				ApplicationCache.notify( BBSSectionInfo.class );
+				ApplicationCache.notify( BBSForumInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectSave(e);

+ 1 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSetCream.java

@@ -61,6 +61,7 @@ public class ActionSubjectSetCream extends BaseAction {
 				wo.setId( id );
 				result.setData( wo );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation(e, "用户在设置精华主题信息时发生异常!");

+ 1 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSetOriginal.java

@@ -60,6 +60,7 @@ public class ActionSubjectSetOriginal extends BaseAction {
 				wo.setId( id );
 				result.setData( wo );
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation(e, "用户在设置原创主题信息时发生异常!");

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectSubmitVoteResult.java

@@ -86,7 +86,9 @@ public class ActionSubjectSubmitVoteResult extends BaseAction {
 			if ("投票".equals(subjectInfo.getTypeCategory())) {
 				try {
 					subjectVoteService.submitVoteResult(effectivePerson, subjectInfo, wrapIn.getOptionGroups());
+					
 					ApplicationCache.notify( BBSSubjectInfo.class );
+					
 				} catch (Exception e) {
 					check = false;
 					Exception exception = new ExceptionSubjectOperation(e, "系统在保存投票选项信息时发生异常");

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnAcceptReply.java

@@ -53,7 +53,9 @@ public class ActionSubjectUnAcceptReply extends BaseAction {
 				Wo wo = new Wo();
 				wo.setId( id );
 				result.setData( wo );
+				
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation( e, "用户在取消确认主题回帖信息时发生异常!" );

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnComplete.java

@@ -53,7 +53,9 @@ public class ActionSubjectUnComplete extends BaseAction {
 				Wo wo = new Wo();
 				wo.setId( id );
 				result.setData( wo );
+				
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation( e, "用户在取消主题完成时发生异常!" );

+ 2 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectUnLock.java

@@ -53,7 +53,9 @@ public class ActionSubjectUnLock extends BaseAction {
 				Wo wo = new Wo();
 				wo.setId( id );
 				result.setData( wo );
+				
 				ApplicationCache.notify( BBSSubjectInfo.class );
+				
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectOperation( e, "用户在取消锁定主题信息时发生异常!" );

+ 51 - 8
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/subjectinfo/ActionSubjectView.java

@@ -26,11 +26,53 @@ import com.x.bbs.entity.BBSSubjectInfo;
 import com.x.bbs.entity.BBSVoteOption;
 import com.x.bbs.entity.BBSVoteOptionGroup;
 
+import net.sf.ehcache.Element;
+
 public class ActionSubjectView extends BaseAction {
 	
 	private static Logger logger = LoggerFactory.getLogger( ActionSubjectView.class );
 	
+	@SuppressWarnings("unchecked")
 	protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		Boolean check = true;
+		if( check ){
+			if( id == null || id.isEmpty() ){
+				check = false;
+				Exception exception = new ExceptionSubjectIdEmpty();
+				result.error( exception );
+			}
+		}
+		
+		if( check ){
+			String cacheKey = "subject#view#" + id;
+			Element element = cache.get( cacheKey );
+			if ((null != element) && (null != element.getObjectValue())) {
+				ActionResult<Wo> result_cache = (ActionResult<Wo>) element.getObjectValue();
+				result.setData( result_cache.getData() );
+				result.setCount( 1L);
+			} else {
+				//继续进行数据查询
+				result = getSubjectViewQueryResult( id, request, effectivePerson );
+				cache.put(new Element(cacheKey, result ));
+			}
+		}
+		
+		if( check ){
+			try {
+				// 查看次数+1
+				subjectInfoServiceAdv.addViewCount( id );
+			}catch(Exception e) {
+				check = false;
+				Exception exception = new ExceptionSubjectView( e, id );
+				result.error( exception );
+				logger.error( e, effectivePerson, request, null);
+			}
+		}
+		return result;
+	}
+
+	private ActionResult<Wo> getSubjectViewQueryResult(String id, HttpServletRequest request, EffectivePerson effectivePerson) {
 		ActionResult<Wo> result = new ActionResult<>();
 		List<WoSubjectAttachment> wrapSubjectAttachmentList = null;
 		List<BBSSubjectAttachment> subjectAttachmentList = null;
@@ -45,16 +87,10 @@ public class ActionSubjectView extends BaseAction {
 		List<WoBBSVoteOption> wrapOutSubjectVoteOptionList = null;
 		String subjectContent = null;
 		Boolean check = true;
-		if( check ){
-			if( id == null || id.isEmpty() ){
-				check = false;
-				Exception exception = new ExceptionSubjectIdEmpty();
-				result.error( exception );
-			}
-		}
+		
 		if (check) {//查询版块信息是否存在
 			try {
-				subjectInfo = subjectInfoServiceAdv.view( id );
+				subjectInfo = subjectInfoServiceAdv.get( id );
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionSubjectView( e, id );
@@ -71,6 +107,7 @@ public class ActionSubjectView extends BaseAction {
 			}else{//查到了主题信息
 				try {
 					currentSubject = WoBBSSubjectInfo.copier.copy( subjectInfo );
+					
 					//根据附件ID列表查询附件信息
 					if( currentSubject.getAttachmentList() != null && currentSubject.getAttachmentList().size() > 0 ){
 						subjectAttachmentList = subjectInfoServiceAdv.listAttachmentByIds( currentSubject.getAttachmentList() );
@@ -88,6 +125,7 @@ public class ActionSubjectView extends BaseAction {
 				}
 			}			
 		}
+		
 		if (check) {
 			if( wrapOutNearSubjectInfo.getCurrentSubject() != null ){
 				currentSubject = wrapOutNearSubjectInfo.getCurrentSubject();
@@ -105,6 +143,7 @@ public class ActionSubjectView extends BaseAction {
 				}
 			}
 		}
+		
 		//开始查询上一个主题的信息
 		if (check) {
 			try {
@@ -124,6 +163,7 @@ public class ActionSubjectView extends BaseAction {
 				wrapOutNearSubjectInfo.setLastSubject( lastSubject );
 			}
 		}
+		
 		//开始查询下一个主题的信息
 		if (check) {
 			try {
@@ -143,6 +183,7 @@ public class ActionSubjectView extends BaseAction {
 				wrapOutNearSubjectInfo.setNextSubject( nextSubject );
 			}
 		}
+		
 		if (check) {
 			if( currentSubject != null ){//获取该主题的投票选项
 				try {
@@ -155,6 +196,7 @@ public class ActionSubjectView extends BaseAction {
 				}
 			}
 		}
+		
 		if (check) {
 			if( currentSubject != null ){//获取该主题的投票选项组
 				try {
@@ -208,6 +250,7 @@ public class ActionSubjectView extends BaseAction {
 				}
 			}
 		}
+		
 		//将带@形式的人员标识修改为人员的姓名并且赋值到xxShort属性里
 		cutPersonNames( wrapOutNearSubjectInfo.getCurrentSubject() );
 		

+ 21 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSSubjectInfoService.java

@@ -95,6 +95,27 @@ public class BBSSubjectInfoService {
 		return subjectInfo;
 	}
 	
+	/**
+	 * 根据传入的ID从数据库查询BBSSubjectInfo对象
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	public void addViewCount( EntityManagerContainer emc, String id ) throws Exception {
+		if( id  == null || id.isEmpty() ){
+			throw new Exception( "id is null, return null!" );
+		}
+		BBSSubjectInfo subjectInfo = null;
+		subjectInfo = emc.find( id, BBSSubjectInfo.class );
+		if( subjectInfo != null ){
+			emc.beginTransaction( BBSSubjectInfo.class );
+			subjectInfo.setViewTotal( subjectInfo.getViewTotal() + 1 );
+			subjectInfo.setHot( subjectInfo.getHot() + 1 );
+			emc.check( subjectInfo, CheckPersistType.all );
+			emc.commit();
+		}
+	}
+	
 	
 	/**
 	 * 向数据库保存BBSSubjectInfo对象

+ 17 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSSubjectInfoServiceAdv.java

@@ -71,6 +71,23 @@ public class BBSSubjectInfoServiceAdv {
 		}
 	}
 	
+	/**
+	 * 根据传入的ID从数据库查询BBSSubjectInfo对象
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	public void addViewCount( String id ) throws Exception {
+		if( id  == null || id.isEmpty() ){
+			throw new Exception( "id is null, return null!" );
+		}
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
+			subjectInfoService.addViewCount( emc, id );
+		}catch( Exception e ){
+			throw e;
+		}
+	}
+	
 	/**
 	 * 向数据库保存BBSSubjectInfo对象
 	 * @param wrapIn

+ 0 - 1
o2server/x_bbs_core_entity/src/main/java/com/x/bbs/entity/BBSForumInfo.java

@@ -21,7 +21,6 @@ import org.apache.openjpa.persistence.jdbc.ElementColumn;
 import org.apache.openjpa.persistence.jdbc.ElementIndex;
 import org.apache.openjpa.persistence.jdbc.Index;
 
-import com.x.base.core.entity.AbstractPersistenceProperties;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.entity.SliceJpaObject;
 import com.x.base.core.entity.annotation.CheckPersist;

+ 1 - 1
o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java

@@ -23,7 +23,7 @@ public class ThisApplication {
 	public static void init() throws Exception {
 		try {
 			MessageConnector.start(context());
-			context.schedule(AlarmTrigger.class, "0 * * * * ?");
+			context.schedule(AlarmTrigger.class, "0/30 * * * * ?");
 		} catch (Exception e) {
 			e.printStackTrace();
 		}

+ 1 - 1
o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/schedule/AlarmTrigger.java

@@ -62,7 +62,7 @@ public class AlarmTrigger implements Job {
 					calendar_Event = calendar_EventServiceAdv.get(id);
 					if (calendar_Event != null) {
 						MessageFactory.send_alarm(emc, calendar_Event);
-						logger.info("send message:{}.", calendar_Event);
+						logger.info("send message:{}.", calendar_Event.getTitle());
 					}
 				}
 			} catch (Exception e) {

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

@@ -630,13 +630,13 @@ public class DocumentFactory<T> extends AbstractFactory {
 		p = CriteriaBuilderTools.predicate_and(cb, p, permissionWhere );	
 		
 		if( maxResultCount == null || maxResultCount == 0 ){
-			maxResultCount = 10000;
+			maxResultCount = 500;
 		}
 		
 		if( publishDateList != null && !publishDateList.isEmpty() ){
-			cq.orderBy( cb.asc( root.get( Document_.publishTime )) );
+			cq.orderBy( cb.desc( root.get( Document_.publishTime )) );
 		}else {
-			cq.orderBy( cb.asc( root.get( Document_.createTime )) );
+			cq.orderBy( cb.desc( root.get( Document_.createTime )) );
 		}
 
 		//LogUtil.INFO( ">>>>SQL:", em.createQuery( cq.where( p ) ).setMaxResults( maxResultCount ).toString() );
@@ -685,7 +685,7 @@ public class DocumentFactory<T> extends AbstractFactory {
 
 	public List<String> listInReviewIds(Integer maxCount) throws Exception {
 		if( maxCount == null ){
-			maxCount = 1000;
+			maxCount = 500;
 		}
 		EntityManager em = this.entityManagerContainer().get( Document.class );
 		CriteriaBuilder cb = em.getCriteriaBuilder();

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

@@ -77,7 +77,7 @@ public class ActionListNextWithFilter extends BaseAction {
 			try {
 				queryCategoryIds = listAllViewAbleCategoryIds( 
 						wi.getAppIdList(),  wi.getAppAliasList(), wi.getCategoryIdList(), wi.getCategoryAliasList(), wi.getDocumentType(), 
-						personName, isAnonymous, manager, 1000
+						personName, isAnonymous, manager, 500
 				);
 				if ( queryCategoryIds == null) {
 					queryCategoryIds = new ArrayList<>();

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

@@ -30,19 +30,11 @@ public class ActionView extends BaseAction {
 
 	private static  Logger logger = LoggerFactory.getLogger(ActionView.class);
 
+	@SuppressWarnings("unchecked")
 	protected ActionResult<Wo> execute(HttpServletRequest request, String id, EffectivePerson effectivePerson) throws Exception {
 		ActionResult<Wo> result = new ActionResult<>();
 		Wo wo = new Wo();
-		WoDocument woOutDocument = null;
-		AppInfo appInfo = null;
-		CategoryInfo categoryInfo = null;
-		Document document = null;
-		List<FileInfo> attachmentList = null;
-		Boolean isAppAdmin = false;
-		Boolean isCategoryAdmin = false;
 		Boolean isManager = false;
-		Boolean isEditor = false;
-		Boolean isCreator = false;
 		Boolean check = true;
 		Boolean isAnonymous = effectivePerson.isAnonymous();
 		String personName = effectivePerson.getDistinguishedName();
@@ -70,176 +62,194 @@ public class ActionView extends BaseAction {
 		Element element = cache.get(cacheKey);
 
 		if ((null != element) && (null != element.getObjectValue())) {
-			wo = (Wo) element.getObjectValue();
-			document = woOutDocument = wo.getDocument();
-			result.setData(wo);
+			result = (ActionResult<Wo>) element.getObjectValue();
 		} else {
-			if (check) {
+			//继续进行数据查询
+			result = getDocumentQueryResult( id, request, effectivePerson, isManager );
+			cache.put(new Element(cacheKey, result ));
+		}
+		
+		if (check ) {
+			//只要不是管理员访问,则记录该文档的访问记录
+			if ( !"xadmin".equalsIgnoreCase( personName) ) {
 				try {
-					document = documentInfoServiceAdv.view( id, effectivePerson );
-					if ( document == null ) {
-						check = false;
-						Exception exception = new ExceptionDocumentNotExists(id);
-						result.error(exception);
-					} else {
-						try {
-							woOutDocument = WoDocument.copier.copy( document );
-						} catch (Exception e) {
-							check = false;
-							Exception exception = new ExceptionDocumentInfoProcess(e, "将查询出来的文档信息对象转换为可输出的数据信息时发生异常。");
-							result.error(exception);
-							logger.error(e, effectivePerson, request, null);
-						}
-					}
+					documentViewRecordServiceAdv.addViewRecord( id, personName );
 				} catch (Exception e) {
-					check = false;
-					Exception exception = new ExceptionDocumentInfoProcess(e, "文档信息访问操作时发生异常。Id:" + id + ", Name:" + personName);
-					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
-			if (check) {
-				if( isAnonymous ) {
-					//检查这个文档所在的栏目和分类是否都是全员可见
-					if( ( ListTools.isNotEmpty( document.getReadPersonList() ) && !document.getReadPersonList().contains( "所有人" ) )
-							|| ListTools.isNotEmpty( document.getReadUnitList() )
-							|| ListTools.isNotEmpty( document.getReadGroupList() )
-							) {
+		}
+		return result;			
+	}
+
+	private ActionResult<Wo> getDocumentQueryResult( String id, HttpServletRequest request, EffectivePerson effectivePerson, Boolean isManager ) {
+		ActionResult<Wo> result = new ActionResult<>();
+		Wo wo = new Wo();
+		WoDocument woOutDocument = null;
+		AppInfo appInfo = null;
+		CategoryInfo categoryInfo = null;
+		Document document = null;
+		List<FileInfo> attachmentList = null;
+		Boolean isAppAdmin = false;
+		Boolean isCategoryAdmin = false;
+		Boolean isEditor = false;
+		Boolean isCreator = false;
+		Boolean check = true;
+		Boolean isAnonymous = effectivePerson.isAnonymous();
+		String personName = effectivePerson.getDistinguishedName();
+		
+		if (check) {
+			try {
+				document = documentInfoServiceAdv.view( id, effectivePerson );
+				if ( document == null ) {
+					check = false;
+					Exception exception = new ExceptionDocumentNotExists(id);
+					result.error(exception);
+				} else {
+					try {
+						woOutDocument = WoDocument.copier.copy( document );
+					} catch (Exception e) {
 						check = false;
-						Exception exception = new ExceptionDocumentInfoProcess(
-								"该文档不允许匿名访问。ID:" + id );
+						Exception exception = new ExceptionDocumentInfoProcess(e, "将查询出来的文档信息对象转换为可输出的数据信息时发生异常。");
 						result.error(exception);
+						logger.error(e, effectivePerson, request, null);
 					}
 				}
+			} catch (Exception e) {
+				check = false;
+				Exception exception = new ExceptionDocumentInfoProcess(e, "文档信息访问操作时发生异常。Id:" + id + ", Name:" + personName);
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
 			}
-			
-			if (check) {
-				try {
-					appInfo = appInfoServiceAdv.get( document.getAppId() );
-					if( appInfo == null ) {
-						check = false;
-						Exception exception = new ExceptionAppInfoNotExists( document.getAppId()  );
-						result.error(exception);
-					}					
-					if( isAnonymous ) {
-						//检查这个文档所在的栏目和分类是否都是全员可见
-						if( !appInfo.getAllPeopleView() ) {
-							//栏目不可见
-							check = false;
-							Exception exception = new ExceptionDocumentInfoProcess(
-									"栏目["+appInfo.getAppName()+"]不允许匿名访问。ID:" + document.getAppId());
-							result.error(exception);
-						}
-					}
-				} catch (Exception e) {
+		}
+		
+		if (check) {
+			if( isAnonymous ) {
+				//检查这个文档所在的栏目和分类是否都是全员可见
+				if( ( ListTools.isNotEmpty( document.getReadPersonList() ) && !document.getReadPersonList().contains( "所有人" ) )
+						|| ListTools.isNotEmpty( document.getReadUnitList() )
+						|| ListTools.isNotEmpty( document.getReadGroupList() )
+						) {
 					check = false;
-					Exception exception = new ExceptionDocumentInfoProcess(e,
-							"根据ID查询栏目信息对象时发生异常。ID:" + document.getAppId());
+					Exception exception = new ExceptionDocumentInfoProcess( "该文档不允许匿名访问。ID:" + id );
 					result.error(exception);
-					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			if (check) {
-				try {
-					categoryInfo = categoryInfoServiceAdv.get(document.getCategoryId());
-					if( categoryInfo == null ) {
-						check = false;
-						Exception exception = new ExceptionCategoryInfoNotExists( document.getCategoryId() );
-						result.error(exception);
-					}					
-					if( isAnonymous ) {
-						//检查这个文档所在的栏目和分类是否都是全员可见
-						if( !categoryInfo.getAllPeopleView() ) {
-							//分类不可见
-							check = false;
-							Exception exception = new ExceptionDocumentInfoProcess(
-									"分类["+categoryInfo.getCategoryName()+"]不允许匿名访问。ID:" + document.getCategoryId());
-							result.error(exception);
-						}
-					}
-				} catch (Exception e) {
+		}
+		
+		if (check) {
+			try {
+				appInfo = appInfoServiceAdv.get( document.getAppId() );
+				if( appInfo == null ) {
 					check = false;
-					Exception exception = new ExceptionDocumentInfoProcess(e,
-							"根据ID查询分类信息对象时发生异常。ID:" + document.getCategoryId());
+					Exception exception = new ExceptionAppInfoNotExists( document.getAppId()  );
 					result.error(exception);
-					logger.error(e, effectivePerson, request, null);
-				}
-			}
-			if (check) {
-				if ( woOutDocument != null && categoryInfo != null ) {
-					try {
-						woOutDocument.setForm(categoryInfo.getFormId());
-						woOutDocument.setFormName(categoryInfo.getFormName());
-						woOutDocument.setReadFormId(categoryInfo.getReadFormId());
-						woOutDocument.setReadFormName(categoryInfo.getReadFormName());
-						woOutDocument.setCategoryName(categoryInfo.getCategoryName());
-						woOutDocument.setCategoryAlias(categoryInfo.getCategoryAlias());
-						
-						if( woOutDocument.getCreatorPerson() != null && !woOutDocument.getCreatorPerson().isEmpty() ) {
-							woOutDocument.setCreatorPersonShort( woOutDocument.getCreatorPerson().split( "@" )[0]);
-						}
-						if( woOutDocument.getCreatorUnitName() != null && !woOutDocument.getCreatorUnitName().isEmpty() ) {
-							woOutDocument.setCreatorUnitNameShort( woOutDocument.getCreatorUnitName().split( "@" )[0]);
-						}
-						if( woOutDocument.getCreatorTopUnitName() != null && !woOutDocument.getCreatorTopUnitName().isEmpty() ) {
-							woOutDocument.setCreatorTopUnitNameShort( woOutDocument.getCreatorTopUnitName().split( "@" )[0]);
-						}
-						
-						wo.setDocument(woOutDocument);
-					} catch (Exception e) {
+				}					
+				if( isAnonymous ) {
+					//检查这个文档所在的栏目和分类是否都是全员可见
+					if( !appInfo.getAllPeopleView() ) {
+						//栏目不可见
 						check = false;
-						Exception exception = new ExceptionDocumentInfoProcess(e,
-								"根据ID查询分类信息对象时发生异常。ID:" + document.getCategoryId());
+						Exception exception = new ExceptionDocumentInfoProcess( "栏目["+appInfo.getAppName()+"]不允许匿名访问。ID:" + document.getAppId());
 						result.error(exception);
-						logger.error(e, effectivePerson, request, null);
 					}
 				}
+			} catch (Exception e) {
+				check = false;
+				Exception exception = new ExceptionDocumentInfoProcess(e, "根据ID查询栏目信息对象时发生异常。ID:" + document.getAppId());
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
 			}
-
-			if (check) {
-				if (woOutDocument != null) {
-					try {						
-						wo.setData( documentInfoServiceAdv.getDocumentData( document ) );
-					} catch (Exception e) {
+		}
+		if (check) {
+			try {
+				categoryInfo = categoryInfoServiceAdv.get(document.getCategoryId());
+				if( categoryInfo == null ) {
+					check = false;
+					Exception exception = new ExceptionCategoryInfoNotExists( document.getCategoryId() );
+					result.error(exception);
+				}					
+				if( isAnonymous ) {
+					//检查这个文档所在的栏目和分类是否都是全员可见
+					if( !categoryInfo.getAllPeopleView() ) {
+						//分类不可见
 						check = false;
-						Exception exception = new ExceptionDocumentInfoProcess(e,
-								"系统获取文档数据内容信息时发生异常。Id:" + document.getCategoryId());
+						Exception exception = new ExceptionDocumentInfoProcess( "分类["+categoryInfo.getCategoryName()+"]不允许匿名访问。ID:" + document.getCategoryId());
 						result.error(exception);
-						logger.error(e, effectivePerson, request, null);
 					}
 				}
+			} catch (Exception e) {
+				check = false;
+				Exception exception = new ExceptionDocumentInfoProcess(e, "根据ID查询分类信息对象时发生异常。ID:" + document.getCategoryId());
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
 			}
-
-			if (check) {
+		}
+		if (check) {
+			if ( woOutDocument != null && categoryInfo != null ) {
 				try {
-					attachmentList = fileInfoServiceAdv.getAttachmentList(document.getId());
-					if (attachmentList != null && !attachmentList.isEmpty()) {
-						wo.setAttachmentList( WoFileInfo.copier.copy(attachmentList));
+					woOutDocument.setForm(categoryInfo.getFormId());
+					woOutDocument.setFormName(categoryInfo.getFormName());
+					woOutDocument.setReadFormId(categoryInfo.getReadFormId());
+					woOutDocument.setReadFormName(categoryInfo.getReadFormName());
+					woOutDocument.setCategoryName(categoryInfo.getCategoryName());
+					woOutDocument.setCategoryAlias(categoryInfo.getCategoryAlias());
+					
+					if( woOutDocument.getCreatorPerson() != null && !woOutDocument.getCreatorPerson().isEmpty() ) {
+						woOutDocument.setCreatorPersonShort( woOutDocument.getCreatorPerson().split( "@" )[0]);
 					}
+					if( woOutDocument.getCreatorUnitName() != null && !woOutDocument.getCreatorUnitName().isEmpty() ) {
+						woOutDocument.setCreatorUnitNameShort( woOutDocument.getCreatorUnitName().split( "@" )[0]);
+					}
+					if( woOutDocument.getCreatorTopUnitName() != null && !woOutDocument.getCreatorTopUnitName().isEmpty() ) {
+						woOutDocument.setCreatorTopUnitNameShort( woOutDocument.getCreatorTopUnitName().split( "@" )[0]);
+					}
+					wo.setDocument(woOutDocument);
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionDocumentInfoProcess(e,
-							"系统获取文档附件内容列表时发生异常。Id:" + document.getCategoryId());
+					Exception exception = new ExceptionDocumentInfoProcess(e, "根据ID查询分类信息对象时发生异常。ID:" + document.getCategoryId());
 					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
-			if (check) {
-				if( wo.getDocument() != null &&
-						wo.getDocument().getCreatorPerson() != null &&
-						wo.getDocument().getCreatorPerson().equals( personName )) {
-						isCreator = true;
-						wo.setIsCreator( isCreator );
+		}
+
+		if (check) {
+			if (woOutDocument != null) {
+				try {						
+					wo.setData( documentInfoServiceAdv.getDocumentData( document ) );
+				} catch (Exception e) {
+					check = false;
+					Exception exception = new ExceptionDocumentInfoProcess(e, "系统获取文档数据内容信息时发生异常。Id:" + document.getCategoryId());
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
-			if (check) {
-				cache.put( new Element(cacheKey, wo) );
+		}
+
+		if (check) {
+			try {
+				attachmentList = fileInfoServiceAdv.getAttachmentList(document.getId());
+				if (attachmentList != null && !attachmentList.isEmpty()) {
+					wo.setAttachmentList( WoFileInfo.copier.copy(attachmentList));
+				}
+			} catch (Exception e) {
+				check = false;
+				Exception exception = new ExceptionDocumentInfoProcess(e, "系统获取文档附件内容列表时发生异常。Id:" + document.getCategoryId());
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
 			}
 		}
 		
+		if (check) {
+			if( wo.getDocument() != null &&
+					wo.getDocument().getCreatorPerson() != null &&
+					wo.getDocument().getCreatorPerson().equals( personName )) {
+					isCreator = true;
+					wo.setIsCreator( isCreator );
+			}
+		}
+	
 		if (check) {
 			try {
 				if ( categoryInfoServiceAdv.isCategoryInfoManager(woOutDocument.getCategoryId(), personName)) {
@@ -252,6 +262,7 @@ public class ActionView extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
+		
 		if (check) {
 			try {
 				if (appInfoServiceAdv.isAppInfoManager(woOutDocument.getAppId(), personName)) {
@@ -271,7 +282,6 @@ public class ActionView extends BaseAction {
 			} else {
 				// 判断当前登录者是不是该文档的可编辑者
 				try {
-					
 					List<String> unitNames = null;
 					List<String> groupNames = null;
 					if( !isAnonymous ) {
@@ -301,23 +311,12 @@ public class ActionView extends BaseAction {
 				}
 			}
 		}
-		
+	
 		wo.setIsManager( isManager );
 		wo.setIsAppAdmin( isAppAdmin );
 		wo.setIsCategoryAdmin( isCategoryAdmin );
 		wo.setIsEditor( isEditor );
 		
-		if (check) {
-			// 记录该文档的访问记录
-			if ( !"xadmin".equalsIgnoreCase( personName) ) {
-				try {
-					documentViewRecordServiceAdv.addViewRecord(id, personName);
-				} catch (Exception e) {
-					logger.error(e, effectivePerson, request, null);
-				}
-			}
-		}
-		
 		result.setData(wo);
 		return result;
 	}

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

@@ -200,7 +200,7 @@ public class ActionListNextPageViewData extends BaseAction {
 						unitNames,
 						groupNames,
 						isManager,
-						viewableCatagories, wi.getDocumentType(), 5000);
+						viewableCatagories, wi.getDocumentType(), 500);
 				if( viewAbleDocIds == null ){
 					viewAbleDocIds = new ArrayList<>();
 				}