Quellcode durchsuchen

Merge branch 'feature/BBS.addSomeReplyService' into 'develop'

Feature/bbs.add some reply service

See merge request o2oa/o2oa!38
周睿 vor 5 Jahren
Ursprung
Commit
a6bc2797ab

+ 3 - 1
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/AbstractFactory.java

@@ -1,6 +1,9 @@
 package com.x.bbs.assemble.control;
 
 import com.x.base.core.container.EntityManagerContainer;
+import com.x.bbs.entity.BBSReplyInfo;
+
+import java.util.List;
 
 public abstract class AbstractFactory {
 
@@ -20,5 +23,4 @@ public abstract class AbstractFactory {
 	public EntityManagerContainer entityManagerContainer() throws Exception {
 		return this.business.entityManagerContainer();
 	}
-
 }

+ 31 - 3
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/factory/BBSReplyInfoFactory.java

@@ -52,12 +52,15 @@ public class BBSReplyInfoFactory extends AbstractFactory {
 	}
 
 	//@MethodDescribe( "根据主贴ID统计主贴的回复数量" )
-	public Long countBySubjectId( String subjectId ) throws Exception {
+	public Long countBySubjectId(String subjectId, Boolean noLevel) throws Exception {
 		EntityManager em = this.entityManagerContainer().get( BBSReplyInfo.class );
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Long> cq = cb.createQuery(Long.class);
 		Root<BBSReplyInfo> root = cq.from( BBSReplyInfo.class);
 		Predicate p = cb.equal( root.get( BBSReplyInfo_.subjectId ), subjectId );
+		if( !noLevel ){
+			p = cb.and( p,cb.equal(root.get( BBSReplyInfo_.parentId ), ""));
+		}
 		cq.select( cb.count( root ) );
 		return em.createQuery(cq.where(p)).getSingleResult();
 	}
@@ -86,7 +89,7 @@ public class BBSReplyInfoFactory extends AbstractFactory {
 	}
 	
 	//@MethodDescribe( "根据主题ID获取该主题所有的回复信息对象列表" )
-	public List<BBSReplyInfo> listWithSubjectForPage( String subjectId, Integer maxCount ) throws Exception {
+	public List<BBSReplyInfo> listWithSubjectForPage(String subjectId, Boolean noLevel, Integer maxCount) throws Exception {
 		if( subjectId == null ){
 			throw new Exception( "subjectId can not null." );
 		}
@@ -95,7 +98,10 @@ public class BBSReplyInfoFactory extends AbstractFactory {
 		CriteriaQuery<BBSReplyInfo> cq = cb.createQuery( BBSReplyInfo.class );
 		Root<BBSReplyInfo> root = cq.from( BBSReplyInfo.class );
 		Predicate p = cb.equal( root.get( BBSReplyInfo_.subjectId ), subjectId );
-		cq.orderBy( cb.asc( root.get( BBSReplyInfo_.orderNumber ) ) );
+		if( !noLevel ){
+			p = cb.and( p, cb.equal(root.get( BBSReplyInfo_.parentId ), ""));
+		}
+		cq.orderBy( cb.desc( root.get( BBSReplyInfo_.createTime ) ) );
 		if( maxCount == null ){
 			return em.createQuery(cq.where(p)).getResultList();
 		}else{
@@ -387,4 +393,26 @@ public class BBSReplyInfoFactory extends AbstractFactory {
 		cq.select( root.get( BBSReplyInfo_.id ) );
 		return em.createQuery(cq.where(p)).getResultList();
 	}
+
+	/**
+	 * 根据回复ID,查询二级回复列表,状态:无审核|审核通过
+	 *
+	 * @param replyId
+	 * @return
+	 */
+    public List<BBSReplyInfo> listReplyWithReplyId(String replyId) throws Exception {
+		if( StringUtils.isEmpty( replyId ) ){
+			throw new Exception( "replyId is empty!" );
+		}
+		EntityManager em = this.entityManagerContainer().get( BBSReplyInfo.class );
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<BBSReplyInfo> cq = cb.createQuery( BBSReplyInfo.class );
+		Root<BBSReplyInfo> root = cq.from( BBSReplyInfo.class );
+		Predicate p = cb.equal( root.get( BBSReplyInfo_.parentId ), replyId );
+		p = cb.and( p, cb.or(
+				cb.equal( root.get( BBSReplyInfo_.replyAuditStatus ), "无审核" ),
+				cb.equal( root.get( BBSReplyInfo_.replyAuditStatus ), "审核通过" )
+		));
+		return em.createQuery(cq.where(p)).getResultList();
+    }
 }

+ 141 - 0
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/jaxrs/replyinfo/ActionListWithReply.java

@@ -0,0 +1,141 @@
+package com.x.bbs.assemble.control.jaxrs.replyinfo;
+
+import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
+import com.x.base.core.project.tools.SortTools;
+import com.x.bbs.assemble.control.jaxrs.replyinfo.exception.ExceptionReplyInfoProcess;
+import com.x.bbs.entity.BBSReplyInfo;
+import net.sf.ehcache.Element;
+import org.apache.commons.lang3.StringUtils;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @apiNote 根据回复内容ID 查询 针对该回帖的回复内容的列表
+ * @Author O2LEE
+ */
+public class ActionListWithReply extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionListWithReply.class);
+
+	/**
+	 * 根据回复的ID获取针对该回复的回复列表
+	 * @param request
+	 * @param effectivePerson
+	 * @param replyId
+	 * @return
+	 * @throws Exception
+	 */
+	protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String replyId ) throws Exception {
+		ActionResult<List<Wo>> result = new ActionResult<>();
+		Boolean check = true;
+
+		if (check) {
+			String cacheKey = replyId + "#replys#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(result_cache.getCount());
+			} else {
+				result = getReplyQueryResult( request, effectivePerson, replyId );
+				cache.put(new Element(cacheKey, result));
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * 根据回复的ID获取针对该回复的回复列表
+	 * @param request
+	 * @param effectivePerson
+	 * @param replyId
+	 * @return
+	 */
+	public ActionResult<List<Wo>> getReplyQueryResult( HttpServletRequest request,
+			EffectivePerson effectivePerson, String replyId ) 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;
+		Boolean check = true;
+
+		if (check) {
+			try {
+				replyInfoList = replyInfoService.listRelysWithRelyId(replyId);
+			} catch (Exception e) {
+				check = false;
+				Exception exception = new ExceptionReplyInfoProcess(e,"根据回复ID查询针对该回复所有的二级回复数量时发生异常。replyId:" + replyId );
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
+			}
+		}
+		if (check) {
+			if (ListTools.isNotEmpty(replyInfoList)) {
+				try {
+					wraps = Wo.copier.copy(replyInfoList);
+				} catch (Exception e) {
+					check = false;
+					Exception exception = new ExceptionReplyInfoProcess(e, "将查询结果转换成可以输出的数据信息时发生异常。");
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
+				}
+			}
+		}
+		if (check) {
+			if (ListTools.isNotEmpty(wraps)) {
+				for (Wo wo : wraps) {
+					if (StringUtils.isNotEmpty(wo.getCreatorName())) {
+						wo.setCreatorNameShort(wo.getCreatorName().split("@")[0]);
+					}
+					if (StringUtils.isNotEmpty(wo.getAuditorName())) {
+						wo.setAuditorNameShort(wo.getAuditorName().split("@")[0]);
+					}
+				}
+				SortTools.desc(wraps, "createTime" );
+				result.setCount( Long.parseLong(wraps.size()+"") );
+			}
+		}
+		result.setData(wraps);
+		return result;
+	}
+
+	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 = "";
+
+		@FieldDescribe("审核人姓名")
+		private String auditorNameShort = "";
+
+		public String getCreatorNameShort() {
+			return creatorNameShort;
+		}
+
+		public String getAuditorNameShort() {
+			return auditorNameShort;
+		}
+
+		public void setCreatorNameShort(String creatorNameShort) {
+			this.creatorNameShort = creatorNameShort;
+		}
+
+		public void setAuditorNameShort(String auditorNameShort) {
+			this.auditorNameShort = auditorNameShort;
+		}
+	}
+}

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

@@ -5,6 +5,7 @@ import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.x.base.core.project.tools.SortTools;
 import org.apache.commons.lang3.StringUtils;
 
 import com.google.gson.JsonElement;
@@ -24,11 +25,15 @@ import com.x.bbs.entity.BBSReplyInfo;
 
 import net.sf.ehcache.Element;
 
+
+/**
+ * @apiNote 根据主帖的ID 返回针对主帖的回复列表(其中要包含一个标志 及说明针对该回复的回复内容条数 )
+ * @author O2LEE
+ */
 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<>();
@@ -39,14 +44,13 @@ public class ActionListWithSubjectForPage extends BaseAction {
 			wrapIn = this.convertToWrapIn(jsonElement, Wi.class);
 		} catch (Exception e) {
 			check = false;
-			Exception exception = new ExceptionReplyInfoProcess(e,
-					"系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
+			Exception exception = new ExceptionReplyInfoProcess(e,"系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
 			result.error(exception);
 			logger.error(e, effectivePerson, request, null);
 		}
 
 		if (check) {
-			String cacheKey = wrapIn.getSubjectId() + "#" + page + "#" + count;
+			String cacheKey = wrapIn.getSubjectId() + "#" + page + "#" + count + "#" + wrapIn.getNoLevel();
 			Element element = cache.get(cacheKey);
 
 			if ((null != element) && (null != element.getObjectValue())) {
@@ -54,7 +58,7 @@ public class ActionListWithSubjectForPage extends BaseAction {
 				result.setData(result_cache.getData());
 				result.setCount(result_cache.getCount());
 			} else {
-				result = getReplyQueryResult(wrapIn, request, effectivePerson, page, count);
+				result = getReplyQueryResult( wrapIn, request, effectivePerson, page, count );
 				cache.put(new Element(cacheKey, result));
 			}
 		}
@@ -62,9 +66,10 @@ public class ActionListWithSubjectForPage extends BaseAction {
 	}
 
 	public ActionResult<List<Wo>> getReplyQueryResult(Wi wrapIn, HttpServletRequest request,
-			EffectivePerson effectivePerson, Integer page, Integer count) {
+			EffectivePerson effectivePerson, Integer page, Integer count) throws Exception {
 		ActionResult<List<Wo>> result = new ActionResult<>();
 		List<Wo> wraps = new ArrayList<>();
+		List<Wo> wrapSubReplies = new ArrayList<>();
 		List<BBSReplyInfo> replyInfoList = null;
 		List<BBSReplyInfo> replyInfoList_out = new ArrayList<BBSReplyInfo>();
 		Long total = 0L;
@@ -86,11 +91,10 @@ public class ActionListWithSubjectForPage extends BaseAction {
 		}
 		if (check) {
 			try {
-				total = replyInfoService.countWithSubjectForPage(wrapIn.getSubjectId());
+				total = replyInfoService.countWithSubjectForPage(wrapIn.getSubjectId(), wrapIn.getNoLevel() );
 			} catch (Exception e) {
 				check = false;
-				Exception exception = new ExceptionReplyInfoProcess(e,
-						"根据主题ID查询主题内所有的回复数量时发生异常。Subject:" + wrapIn.getSubjectId());
+				Exception exception = new ExceptionReplyInfoProcess(e,"根据主题ID查询主题内所有的回复数量时发生异常。Subject:" + wrapIn.getSubjectId());
 				result.error(exception);
 				logger.error(e, effectivePerson, request, null);
 			}
@@ -98,11 +102,10 @@ public class ActionListWithSubjectForPage extends BaseAction {
 		if (check) {
 			if (total > 0) {
 				try {
-					replyInfoList = replyInfoService.listWithSubjectForPage(wrapIn.getSubjectId(), page * count);
+					replyInfoList = replyInfoService.listWithSubjectForPage( wrapIn.getSubjectId(), wrapIn.getNoLevel(), page * count );
 				} catch (Exception e) {
 					check = false;
-					Exception exception = new ExceptionReplyInfoProcess(e,
-							"根据主题ID查询主题内所有的回复列表时发生异常。Subject:" + wrapIn.getSubjectId());
+					Exception exception = new ExceptionReplyInfoProcess(e,"根据主题ID查询主题内所有的回复列表时发生异常。Subject:" + wrapIn.getSubjectId());
 					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
@@ -119,10 +122,10 @@ public class ActionListWithSubjectForPage extends BaseAction {
 			int endIndex = page * count;
 			for (int i = 0; replyInfoList != null && i < replyInfoList.size(); i++) {
 				if (i < replyInfoList.size() && i >= startIndex && i < endIndex) {
-					replyInfoList_out.add(replyInfoList.get(i));
+					replyInfoList_out.add( replyInfoList.get(i) );
 				}
 			}
-			if (ListTools.isNotEmpty(replyInfoList_out)) {
+			if (ListTools.isNotEmpty( replyInfoList_out )) {
 				try {
 					wraps = Wo.copier.copy(replyInfoList_out);
 				} catch (Exception e) {
@@ -135,6 +138,8 @@ public class ActionListWithSubjectForPage extends BaseAction {
 		}
 		if (check) {
 			if (ListTools.isNotEmpty(wraps)) {
+
+				List<BBSReplyInfo> subReplies = null;
 				for (Wo wo : wraps) {
 					if (StringUtils.isNotEmpty(wo.getCreatorName())) {
 						wo.setCreatorNameShort(wo.getCreatorName().split("@")[0]);
@@ -142,11 +147,27 @@ public class ActionListWithSubjectForPage extends BaseAction {
 					if (StringUtils.isNotEmpty(wo.getAuditorName())) {
 						wo.setAuditorNameShort(wo.getAuditorName().split("@")[0]);
 					}
+
+					//查询一下该回复是否存在下级回复,以及下级回复的数量,除了第一条,其他的都去掉内容,避免大量的网络传输
+					subReplies = replyInfoService.listRelysWithRelyId( wo.getId() );
+					if( ListTools.isNotEmpty( subReplies )){
+						wrapSubReplies = Wo.copier.copy( subReplies );
+						SortTools.desc( wrapSubReplies, "createTime" );
+						for( int i=0; i<wrapSubReplies.size(); i++  ){
+							if( i > 0 ){
+								wrapSubReplies.get(i).setContent(null);
+							}
+						}
+						wo.setSubReplyTotal( wrapSubReplies.size() );
+						wo.setSubReplies( wrapSubReplies );
+					}
 				}
+				result.setCount(total);
+				SortTools.desc( wraps, "createTime" );
 			}
 		}
 		result.setData(wraps);
-		result.setCount(total);
+
 		return result;
 	}
 
@@ -154,7 +175,18 @@ public class ActionListWithSubjectForPage extends BaseAction {
 
 		@FieldDescribe("主题Id")
 		private String subjectId = null;
-		
+
+		@FieldDescribe("是否平级显示所有的的回复, 如果为true则只显示第一层")
+		private Boolean noLevel = false;
+
+		public Boolean getNoLevel() {
+			return noLevel;
+		}
+
+		public void setNoLevel(Boolean noLevel) {
+			this.noLevel = noLevel;
+		}
+
 		public static List<String> Excludes = new ArrayList<String>(JpaObject.FieldsUnmodify);
 
 		public String getSubjectId() {
@@ -169,8 +201,7 @@ public class ActionListWithSubjectForPage extends BaseAction {
 	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 WrapCopier<BBSReplyInfo, Wo> copier = WrapCopierFactory.wo(BBSReplyInfo.class, Wo.class, null, JpaObject.FieldsInvisible);
 
 		@FieldDescribe("创建人姓名")
 		private String creatorNameShort = "";
@@ -178,6 +209,28 @@ public class ActionListWithSubjectForPage extends BaseAction {
 		@FieldDescribe("审核人姓名")
 		private String auditorNameShort = "";
 
+		@FieldDescribe("下级回复的数量,默认为0")
+		private Integer subReplyTotal = 0;
+
+		@FieldDescribe("下级回复的数量,默认为0")
+		private List<Wo> subReplies;
+
+		public List<Wo> getSubReplies() {
+			return subReplies;
+		}
+
+		public void setSubReplies(List<Wo> subReplies) {
+			this.subReplies = subReplies;
+		}
+
+		public Integer getSubReplyTotal() {
+			return subReplyTotal;
+		}
+
+		public void setSubReplyTotal(Integer subReplyTotal) {
+			this.subReplyTotal = subReplyTotal;
+		}
+
 		public String getCreatorNameShort() {
 			return creatorNameShort;
 		}

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

@@ -13,8 +13,7 @@ import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.container.Suspended;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
+import com.alibaba.druid.util.StringUtils;
 import com.google.gson.JsonElement;
 import com.x.base.core.project.annotation.JaxrsDescribe;
 import com.x.base.core.project.annotation.JaxrsMethodDescribe;
@@ -105,4 +104,35 @@ public class ReplyInfoAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
+
+	@JaxrsMethodDescribe(value = "根据回复内容ID 查询 针对该回帖的回复内容的列表.", action = ActionListWithReply.class)
+	@GET
+	@Path("list/sub/{id}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void listSubRepliesWithReply(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+					@JaxrsParameterDescribe("回复信息ID") @PathParam("id") String id) {
+		ActionResult<List<ActionListWithReply.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		Boolean check = true;
+
+		if (check) {
+			if (StringUtils.isEmpty( id )) {
+				check = false;
+				Exception exception = new ExceptionReplyIdEmpty();
+				result.error(exception);
+			}
+		}
+		if (check) {
+			try {
+				result = new ActionListWithReply().execute(request, effectivePerson, id);
+			} catch (Exception e) {
+				result = new ActionResult<>();
+				Exception exception = new ExceptionReplyInfoProcess(e, "根据回复内容ID 查询 针对该回帖的回复内容的列表!");
+				result.error(exception);
+				logger.error(e, effectivePerson, request, null);
+			}
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 }

+ 1 - 1
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSForumSubjectStatisticService.java

@@ -99,7 +99,7 @@ public class BBSForumSubjectStatisticService {
 				emc.beginTransaction( BBSSubjectInfo.class );
 				subject = emc.find( s.getId(), BBSSubjectInfo.class );
 				if( subject != null ){
-					count = business.replyInfoFactory().countBySubjectId( s.getId() );
+					count = business.replyInfoFactory().countBySubjectId( s.getId(), true );
 					subject.setReplyTotal( count.longValue() );
 					emc.check( subject, CheckPersistType.all );
 				}

+ 25 - 6
o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/service/BBSReplyInfoService.java

@@ -3,6 +3,7 @@ package com.x.bbs.assemble.control.service;
 import java.util.Date;
 import java.util.List;
 
+import com.alibaba.druid.util.StringUtils;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
@@ -44,7 +45,7 @@ public class BBSReplyInfoService {
 	
 	/**
 	 * 向数据库保存BBSReplyInfo对象
-	 * @param wrapIn
+	 * @param _bBSReplyInfo
 	 */
 	public BBSReplyInfo save( BBSReplyInfo _bBSReplyInfo ) throws Exception {
 		BBSReplyInfo _bBSReplyInfo_tmp = null;
@@ -179,27 +180,27 @@ public class BBSReplyInfoService {
 		}
 	}
 
-	public List<BBSReplyInfo> listWithSubjectForPage( String subjectId, int maxCount ) throws Exception {
+	public List<BBSReplyInfo> listWithSubjectForPage(String subjectId, Boolean noLevel, int maxCount) throws Exception {
 		if( subjectId == null ){
 			throw new Exception( "subjectId can not null." );
 		}
 		Business business = null;
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 			business = new Business(emc);
-			return business.replyInfoFactory().listWithSubjectForPage( subjectId, maxCount );
+			return business.replyInfoFactory().listWithSubjectForPage( subjectId, noLevel, maxCount );
 		}catch( Exception e ){
 			throw e;
 		}
 	}
 	
-	public Long countWithSubjectForPage( String subjectId ) throws Exception {
+	public Long countWithSubjectForPage(String subjectId, Boolean noLevel) throws Exception {
 		if( subjectId == null ){
 			throw new Exception( "subjectId can not null." );
 		}
 		Business business = null;
 		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
 			business = new Business(emc);
-			return business.replyInfoFactory().countBySubjectId( subjectId );
+			return business.replyInfoFactory().countBySubjectId( subjectId, noLevel );
 		}catch( Exception e ){
 			throw e;
 		}
@@ -232,7 +233,7 @@ public class BBSReplyInfoService {
 	}
 
 	public Long countReplyForTodayByUserName( String userName ) throws Exception {
-		if( userName == null ){
+		if( StringUtils.isEmpty(userName) ){
 			throw new Exception( "userName can not null." );
 		}
 		Business business = null;
@@ -243,4 +244,22 @@ public class BBSReplyInfoService {
 			throw e;
 		}
 	}
+
+	/**
+	 * 根据回复ID,查询二级回复列表
+	 * @param replyId
+	 * @return
+	 */
+    public List<BBSReplyInfo> listRelysWithRelyId(String replyId) throws Exception {
+		if(StringUtils.isEmpty( replyId ) ){
+			throw new Exception( "replyId can not null." );
+		}
+		Business business = null;
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
+			business = new Business(emc);
+			return business.replyInfoFactory().listReplyWithReplyId(replyId);
+		}catch( Exception e ){
+			throw e;
+		}
+    }
 }

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

@@ -255,7 +255,7 @@ public class BBSSubjectInfoService {
 		//先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
 		subjectInfo = emc.find( subjectId, BBSSubjectInfo.class );
 		subjectContent = emc.find( subjectId, BBSSubjectContent.class );
-		replyInfoList = business.replyInfoFactory().listWithSubjectForPage( subjectId, null );
+		replyInfoList = business.replyInfoFactory().listWithSubjectForPage( subjectId, true, null );
 		voteOptionList = business.voteOptionFactory().listVoteOptionBySubject( subjectId );
 		voteOptionGroupList = business.voteOptionFactory().listVoteOptionGroupBySubject( subjectId );
 		voteRecordList = business.voteRecordFactory().listVoteRecordBySubject( subjectId );