|
@@ -30,11 +30,13 @@ import net.mingsoft.base.constant.Const;
|
|
|
import net.mingsoft.basic.util.BasicUtil;
|
|
import net.mingsoft.basic.util.BasicUtil;
|
|
|
import net.mingsoft.basic.util.StringUtil;
|
|
import net.mingsoft.basic.util.StringUtil;
|
|
|
import net.mingsoft.cms.bean.CategoryBean;
|
|
import net.mingsoft.cms.bean.CategoryBean;
|
|
|
|
|
+import net.mingsoft.cms.bean.ContentBean;
|
|
|
import net.mingsoft.cms.biz.ICategoryBiz;
|
|
import net.mingsoft.cms.biz.ICategoryBiz;
|
|
|
import net.mingsoft.cms.biz.IContentBiz;
|
|
import net.mingsoft.cms.biz.IContentBiz;
|
|
|
import net.mingsoft.cms.entity.CategoryEntity;
|
|
import net.mingsoft.cms.entity.CategoryEntity;
|
|
|
import net.mingsoft.cms.entity.ContentEntity;
|
|
import net.mingsoft.cms.entity.ContentEntity;
|
|
|
import net.mingsoft.cms.util.CmsParserUtil;
|
|
import net.mingsoft.cms.util.CmsParserUtil;
|
|
|
|
|
+import net.mingsoft.mdiy.bean.AttributeBean;
|
|
|
import net.mingsoft.mdiy.bean.PageBean;
|
|
import net.mingsoft.mdiy.bean.PageBean;
|
|
|
import net.mingsoft.mdiy.biz.IModelBiz;
|
|
import net.mingsoft.mdiy.biz.IModelBiz;
|
|
|
import net.mingsoft.mdiy.biz.IPageBiz;
|
|
import net.mingsoft.mdiy.biz.IPageBiz;
|
|
@@ -141,9 +143,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
//获取栏目编号
|
|
//获取栏目编号
|
|
|
int typeId = BasicUtil.getInt(ParserUtil.TYPE_ID,0);
|
|
int typeId = BasicUtil.getInt(ParserUtil.TYPE_ID,0);
|
|
|
int size = BasicUtil.getInt(ParserUtil.SIZE,10);
|
|
int size = BasicUtil.getInt(ParserUtil.SIZE,10);
|
|
|
-
|
|
|
|
|
|
|
+ ContentBean contentBean = new ContentBean();
|
|
|
|
|
+ contentBean.setContentCategoryId(String.valueOf(typeId));
|
|
|
//获取文章总数
|
|
//获取文章总数
|
|
|
- List<CategoryBean> columnArticles = contentBiz.queryIdsByCategoryIdForParser(String.valueOf(typeId), null, null);
|
|
|
|
|
|
|
+ List<CategoryBean> columnArticles = contentBiz.queryIdsByCategoryIdForParser(contentBean);
|
|
|
//判断栏目下是否有文章
|
|
//判断栏目下是否有文章
|
|
|
if(columnArticles.size()==0){
|
|
if(columnArticles.size()==0){
|
|
|
this.outJson(resp, false);
|
|
this.outJson(resp, false);
|
|
@@ -204,8 +207,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
|
|
|
|
|
orderby= orderby.replaceAll("('|\"|\\\\)","\\$1");
|
|
orderby= orderby.replaceAll("('|\"|\\\\)","\\$1");
|
|
|
PageBean page = new PageBean();
|
|
PageBean page = new PageBean();
|
|
|
|
|
+ //用于详情上下页获取当前文章列表对应的分类,根据文章查询只能获取自身分类
|
|
|
|
|
+ String typeId = BasicUtil.getString(ParserUtil.TYPE_ID,article.getContentCategoryId());
|
|
|
//根据文章编号查询栏目详情模版
|
|
//根据文章编号查询栏目详情模版
|
|
|
- CategoryEntity column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(article.getContentCategoryId()));
|
|
|
|
|
|
|
+ CategoryEntity column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId));
|
|
|
//解析后的内容
|
|
//解析后的内容
|
|
|
String content = "";
|
|
String content = "";
|
|
|
Map map = BasicUtil.assemblyRequestMap();
|
|
Map map = BasicUtil.assemblyRequestMap();
|
|
@@ -215,12 +220,18 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
});
|
|
});
|
|
|
//动态解析
|
|
//动态解析
|
|
|
map.put(ParserUtil.IS_DO,true);
|
|
map.put(ParserUtil.IS_DO,true);
|
|
|
|
|
+ //设置栏目编号
|
|
|
|
|
+ map.put(ParserUtil.TYPE_ID, typeId);
|
|
|
//设置动态请求的模块路径
|
|
//设置动态请求的模块路径
|
|
|
map.put(ParserUtil.MODEL_NAME, "mcms");
|
|
map.put(ParserUtil.MODEL_NAME, "mcms");
|
|
|
map.put(ParserUtil.URL, BasicUtil.getUrl());
|
|
map.put(ParserUtil.URL, BasicUtil.getUrl());
|
|
|
map.put(ParserUtil.PAGE, page);
|
|
map.put(ParserUtil.PAGE, page);
|
|
|
map.put(ParserUtil.ID, article.getId());
|
|
map.put(ParserUtil.ID, article.getId());
|
|
|
- List<CategoryBean> articleIdList = contentBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null,orderby,order);
|
|
|
|
|
|
|
+ ContentBean contentBean = new ContentBean();
|
|
|
|
|
+ contentBean.setContentCategoryId(String.valueOf(typeId));
|
|
|
|
|
+ contentBean.setOrderBy(orderby);
|
|
|
|
|
+ contentBean.setOrder(order);
|
|
|
|
|
+ List<CategoryBean> articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
|
|
|
Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
|
|
Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
|
|
|
ModelEntity contentModel = null;
|
|
ModelEntity contentModel = null;
|
|
|
for (int artId = 0; artId < articleIdList.size();) {
|
|
for (int artId = 0; artId < articleIdList.size();) {
|
|
@@ -230,13 +241,16 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
// 文章的栏目路径
|
|
// 文章的栏目路径
|
|
|
- String articleColumnPath = articleIdList.get(artId).getCategoryPath();
|
|
|
|
|
|
|
+ String categoryParentId = articleIdList.get(artId).getId() ;
|
|
|
|
|
+ if(StringUtils.isNotBlank(articleIdList.get(artId).getCategoryParentId())){
|
|
|
|
|
+ categoryParentId += ','+articleIdList.get(artId).getCategoryParentId();
|
|
|
|
|
+ }
|
|
|
// 文章的栏目模型编号
|
|
// 文章的栏目模型编号
|
|
|
String columnContentModelId = articleIdList.get(artId).getMdiyModelId();
|
|
String columnContentModelId = articleIdList.get(artId).getMdiyModelId();
|
|
|
Map<String, Object> parserParams = new HashMap<String, Object>();
|
|
Map<String, Object> parserParams = new HashMap<String, Object>();
|
|
|
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
|
|
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
|
|
|
// 判断当前栏目是否有自定义模型
|
|
// 判断当前栏目是否有自定义模型
|
|
|
- if ( StringUtils.isNotBlank(columnContentModelId)) {
|
|
|
|
|
|
|
+ if ( StringUtils.isNotBlank(columnContentModelId) && Integer.parseInt(columnContentModelId)>0) {
|
|
|
// 通过当前栏目的模型编号获取,自定义模型表名
|
|
// 通过当前栏目的模型编号获取,自定义模型表名
|
|
|
if (contentModelMap.containsKey(columnContentModelId)) {
|
|
if (contentModelMap.containsKey(columnContentModelId)) {
|
|
|
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
|
|
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
|
|
@@ -251,18 +265,12 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
// 第一篇文章没有上一篇
|
|
// 第一篇文章没有上一篇
|
|
|
if (artId > 0) {
|
|
if (artId > 0) {
|
|
|
CategoryBean preCaBean = articleIdList.get(artId - 1);
|
|
CategoryBean preCaBean = articleIdList.get(artId - 1);
|
|
|
- //判断当前文档是否与上一页文章在同一栏目下,并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
|
|
|
|
|
- if(articleColumnPath.contains(preCaBean.getCategoryId()+"")){
|
|
|
|
|
page.setPreId(preCaBean.getArticleId());
|
|
page.setPreId(preCaBean.getArticleId());
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
// 最后一篇文章没有下一篇
|
|
// 最后一篇文章没有下一篇
|
|
|
if (artId + 1 < articleIdList.size()) {
|
|
if (artId + 1 < articleIdList.size()) {
|
|
|
CategoryBean nextCaBean = articleIdList.get(artId + 1);
|
|
CategoryBean nextCaBean = articleIdList.get(artId + 1);
|
|
|
- //判断当前文档是否与下一页文章在同一栏目下并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
|
|
|
|
|
- if(articleColumnPath.contains(nextCaBean.getCategoryId()+"")){
|
|
|
|
|
page.setNextId(nextCaBean.getArticleId());
|
|
page.setNextId(nextCaBean.getArticleId());
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -387,7 +395,8 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|
|
//设置动态请求的模块路径
|
|
//设置动态请求的模块路径
|
|
|
map.put(ParserUtil.MODEL_NAME, "mcms");
|
|
map.put(ParserUtil.MODEL_NAME, "mcms");
|
|
|
searchMap.put(ParserUtil.PAGE_NO, 0);
|
|
searchMap.put(ParserUtil.PAGE_NO, 0);
|
|
|
- ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,map, page);
|
|
|
|
|
|
|
+ AttributeBean attributeBean = new AttributeBean();
|
|
|
|
|
+ ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,map, page,attributeBean);
|
|
|
int total = PageUtil.totalPage(count, page.getSize());
|
|
int total = PageUtil.totalPage(count, page.getSize());
|
|
|
int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1);
|
|
int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1);
|
|
|
if(pageNo >= total && total!=0) {
|
|
if(pageNo >= total && total!=0) {
|