From ffe26f9348aa29deab400c0163e083ee0071380c Mon Sep 17 00:00:00 2001 From: tianbj <1309855586@qq.com> Date: Fri, 27 Dec 2019 15:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A7=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mingsoft/cms/action/ArticleAction.java | 631 ------------------ .../net/mingsoft/cms/action/ColumnAction.java | 317 --------- .../cms/action/web/ArticleAction.java | 233 ------- .../cms/action/web/ContentAction.java | 266 -------- .../net/mingsoft/cms/biz/IArticleBiz.java | 191 ------ .../mingsoft/cms/biz/impl/ArticleBizImpl.java | 222 ------ .../net/mingsoft/cms/dao/IArticleDao.java | 169 ----- .../java/net/mingsoft/cms/dao/IArticleDao.xml | 624 ----------------- .../mingsoft/cms/entity/ArticleEntity.java | 293 -------- 9 files changed, 2946 deletions(-) delete mode 100644 src/main/java/net/mingsoft/cms/action/ArticleAction.java delete mode 100644 src/main/java/net/mingsoft/cms/action/ColumnAction.java delete mode 100644 src/main/java/net/mingsoft/cms/action/web/ArticleAction.java delete mode 100644 src/main/java/net/mingsoft/cms/action/web/ContentAction.java delete mode 100644 src/main/java/net/mingsoft/cms/biz/IArticleBiz.java delete mode 100644 src/main/java/net/mingsoft/cms/biz/impl/ArticleBizImpl.java delete mode 100644 src/main/java/net/mingsoft/cms/dao/IArticleDao.java delete mode 100644 src/main/java/net/mingsoft/cms/dao/IArticleDao.xml delete mode 100644 src/main/java/net/mingsoft/cms/entity/ArticleEntity.java diff --git a/src/main/java/net/mingsoft/cms/action/ArticleAction.java b/src/main/java/net/mingsoft/cms/action/ArticleAction.java deleted file mode 100644 index b2f9eddb..00000000 --- a/src/main/java/net/mingsoft/cms/action/ArticleAction.java +++ /dev/null @@ -1,631 +0,0 @@ -/** -The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) - - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.mingsoft.cms.action; - -import java.io.File; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.alibaba.fastjson.JSONArray; - -import net.mingsoft.base.entity.BaseEntity; -import net.mingsoft.base.filter.DateValueFilter; -import net.mingsoft.base.filter.DoubleValueFilter; -import net.mingsoft.basic.action.BaseAction; -import net.mingsoft.basic.bean.EUListBean; -import net.mingsoft.basic.biz.IColumnBiz; -import net.mingsoft.basic.entity.ColumnEntity; -import net.mingsoft.basic.util.ArrysUtil; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.basic.util.FileUtil; -import net.mingsoft.basic.util.StringUtil; -import net.mingsoft.cms.biz.IArticleBiz; -import net.mingsoft.cms.constant.ModelCode; -import net.mingsoft.cms.constant.e.ColumnTypeEnum; -import net.mingsoft.cms.entity.ArticleEntity; -import net.mingsoft.mdiy.biz.IContentModelBiz; -import net.mingsoft.mdiy.biz.IContentModelFieldBiz; -import net.mingsoft.mdiy.entity.ContentModelEntity; -import net.mingsoft.mdiy.entity.ContentModelFieldEntity; -import net.mingsoft.mdiy.util.DictUtil; -import net.mingsoft.mdiy.util.ParserUtil; - -/** - * @ClassName: ArticleAction - * @Description:TODO 文章管理 - * @author: 铭飞开发团队 - * @date: 2018年1月31日 下午2:51:39 - * - * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. - */ -@Controller -@RequestMapping("/${ms.manager.path}/cms/article") -public class ArticleAction extends BaseAction { - - /** - * 上传路径 - */ - @Value("${ms.upload.path}") - private String uploadFloderPath; - - /** - * 业务层的注入 - */ - @Autowired - private IColumnBiz columnBiz; - - /** - * 文章管理业务处理层 - */ - @Autowired - private IArticleBiz articleBiz; - - /** - * 字段管理业务层 - */ - @Autowired - private IContentModelFieldBiz fieldBiz; - - /** - * 内容管理业务层 - */ - @Autowired - private IContentModelBiz contentBiz; - - /** - * 判断是否为checkbox类型 - */ - private static final int checkBox = 11; - - - /** - * 加载页面显示所有文章信息 - * - * @param request - * @return 返回文章页面显示地址 - */ - @SuppressWarnings("static-access") - @RequestMapping("/index") - public String index(HttpServletRequest request, ModelMap mode, HttpServletResponse response) { - // 获取站点id - int appId = BasicUtil.getAppId(); - List list = columnBiz.queryAll(appId, this.getModelCodeId(request, ModelCode.CMS_COLUMN)); - request.setAttribute("listColumn", JSONArray.toJSONString(list)); - // 返回路径 - return "/cms/article/index"; // 这里表示显示/manager/cms/article/article_list.ftl - } - - /** - * 返回一个文章列表框架和一些基础数据 - * @param article - * @param request - * @param mode - * @param response - * @param categoryId - * @return 返回一个文章列表界面 - */ - @RequestMapping("/{categoryId}/main") - public String main(@ModelAttribute ArticleEntity article, HttpServletRequest request, ModelMap mode, - HttpServletResponse response, @PathVariable int categoryId) { - String articleType = request.getParameter("articleType"); - String isParent = BasicUtil.getString("isParent", "false"); - mode.addAttribute("isParent", isParent); - //使用糊涂工具排序使全部属性排在第一个 - mode.addAttribute("articleTypeList", DictUtil.list("文章属性")); - mode.addAttribute("articleType", articleType); - mode.addAttribute("categoryId", categoryId); - //返回文章页面显示地址 - return "/cms/article/article_main"; - } - - /** - * 加载页面显示所有文章信息 - * - * @param request - * @return 返回文章页面显示数据 - */ - @RequestMapping("/{categoryId}/list") - public void list(@ModelAttribute ArticleEntity article, HttpServletRequest request, ModelMap mode, - HttpServletResponse response, @PathVariable int categoryId) { - int[] basicCategoryIds = null; - String articleType = article.getArticleType(); - if(StringUtils.isEmpty(articleType)){ - articleType = BasicUtil.getString("articleTypeStr"); - } - if(!StringUtils.isEmpty(articleType) && articleType.equals("a")){ - articleType = null; - } - if(categoryId > 0){ - basicCategoryIds = columnBiz.queryChildrenCategoryIds(categoryId, BasicUtil.getAppId(), - BasicUtil.getModelCodeId(ModelCode.CMS_COLUMN)); - } - int appId = BasicUtil.getAppId(); - BasicUtil.startPage(); - article.setBasicDisplay(-1); - //查询文章列表 - List articleList = articleBiz.query(appId, basicCategoryIds, articleType, null, null, true, null, null, article); - EUListBean _list = new EUListBean(articleList, (int) BasicUtil.endPage(articleList).getTotal()); - //将数据以json数据的形式返回 - this.outJson(response, net.mingsoft.base.util.JSONArray.toJSONString(_list, new DoubleValueFilter(),new DateValueFilter("yyyy-MM-dd"))); - - } - - /** - * 添加文章页面 - * - * @return 保存文章的页面地址 - */ - @SuppressWarnings("static-access") - @RequestMapping("/add") - public String add(ModelMap mode, HttpServletRequest request) { - int categoryId = BasicUtil.getInt("categoryId", 0); - String categoryTitle = request.getParameter("categoryTitle"); - // 文章属性 - mode.addAttribute("articleType", DictUtil.list("文章属性")); - // 站点ID - int appId = BasicUtil.getAppId(); - List list = columnBiz.queryAll(appId, this.getModelCodeId(request, ModelCode.CMS_COLUMN)); - mode.addAttribute("appId", appId); - mode.addAttribute("listColumn", JSONArray.toJSONString(list)); - boolean isEditCategory = false; // 新增,不是单篇 - int columnType=1;//新增,不是单篇 - if(categoryId != 0){ - // 获取栏目id - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(categoryId); - columnType = column.getColumnType(); - // 判断栏目是否为"",如果是"",就重新赋值 - if (StringUtils.isBlank(categoryTitle)) { - categoryTitle = column.getCategoryTitle(); - } - // 判断栏目是否是单篇 - if (column != null && column.getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { - isEditCategory = true; // 是单页 - columnType = column.getColumnType();; - } - } - mode.addAttribute("categoryTitle", categoryTitle); - mode.addAttribute("isEditCategory", isEditCategory); // 新增状态 - mode.addAttribute("columnType", columnType); - mode.addAttribute("categoryId", categoryId); - mode.addAttribute("articleImagesUrl", uploadFloderPath+net.mingsoft.base.constant.Const.SEPARATOR - +BasicUtil.getAppId()+net.mingsoft.base.constant.Const.SEPARATOR); - // 添加一个空的article实体 - ArticleEntity article = new ArticleEntity(); - mode.addAttribute("article", article); - mode.addAttribute("action", "save"); - // 返回路径 - return "/cms/article/article_form"; // 这里表示显示/manager/cms/article/article_save.ftl - } - - /** - * 获取表单信息进行保存 - * - * @param article - * 文章对象 - */ - @RequestMapping("/save") - @RequiresPermissions("article:save") - public void save(@ModelAttribute ArticleEntity article, HttpServletRequest request, HttpServletResponse response) { - // 获取站点id - int appId = BasicUtil.getAppId(); - // 验证文章,文章自由排序,栏目id - if (!validateForm(article, response)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false); - - } - - article.setBasicUpdateTime(new Timestamp(System.currentTimeMillis())); - // 文章类型 - String langtyp[] = request.getParameterValues("articleType"); - if (langtyp != null) { - StringBuffer sb = new StringBuffer(); - for (int j = 0; j < langtyp.length; j++) { - sb.append(langtyp[j] + ","); - } - } - String checkboxType = BasicUtil.getString("checkboxType"); - //如果选择一个属性不做排序操作 - if(!StringUtils.isEmpty(checkboxType) && checkboxType.length()>2){ - // 文章类型排序 - article.setArticleType(ArrysUtil.sort(checkboxType, ",")+","); - }else{ - article.setArticleType(checkboxType); - } - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(article.getBasicCategoryId()); - article.setColumn(column); - - // 添加文章所属的站点id - article.setArticleWebId(appId); - // 绑定模块编号 - article.setBasicModelId(BasicUtil.getInt("modelId")); - // 保存文章实体 - - articleBiz.saveBasic(article); - if (column.getColumnType() == ColumnTypeEnum.COLUMN_TYPE_LIST.toInt()) {// 列表 - article.setArticleUrl(column.getColumnPath() + File.separator + article.getBasicId() + ParserUtil.HTML_SUFFIX); - } else if (column.getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {// 单篇 - article.setArticleUrl(column.getColumnPath() + File.separator + ParserUtil.INDEX+ParserUtil.HTML_SUFFIX); - } - articleBiz.updateBasic(article); - - // 判断栏目是否存在新增字段 - if (column.getColumnContentModelId() != 0) { - // 保存所有的字段信息 - List listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); - // 获取内容模型实体 - ContentModelEntity contentModel = (ContentModelEntity) contentBiz - .getEntity(column.getColumnContentModelId()); - if (contentModel != null) { - // 保存新增字段的信息 - Map param = this.checkField(listField, request, article.getBasicId()); - fieldBiz.insertBySQL(contentModel.getCmTableName(), param); - } - - } - - // - - if (article.getColumn().getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { - this.outJson(response, ModelCode.CMS_ARTICLE, true, "" + article.getColumn().getCategoryId(), article.getBasicId()); - } else { - this.outJson(response, ModelCode.CMS_ARTICLE, true, article.getColumn().getCategoryId()+"", ""); - } - } - - /** - * 验证表单 - * - * @param article - * @param response - * @return 返回Boolean类型 true:通过,false:有错 - */ - public boolean validateForm(ArticleEntity article, HttpServletResponse response) { - // 对表单数据进行再次验证 - // 验证文章标题是否为空 - if (StringUtils.isBlank(article.getBasicTitle())) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.empty", this.getResString("basicTitle"))); - return false; - } - // 验证文章所属是否为0 - if (article.getBasicCategoryId() == 0) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.empty", this.getResString("basicCategoryId"))); - return false; - } - // 验证文章标题长度,若超过定义长度则截取 - if (!StringUtil.checkLength(article.getBasicTitle(), 1, 300)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.length", this.getResString("basicTitle"), "1", "300")); - return false; - } - // 验证文章来源长度,若超过定义长度则截取 - if (!StringUtils.isBlank(article.getArticleSource()) - && !StringUtil.checkLength(article.getArticleSource(), 1, 300)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.length", this.getResString("articleSource"), "1", "300")); - return false; - } - // 验证文章作者长度,若超过定义长度则截取 - if (!StringUtils.isBlank(article.getArticleAuthor()) - && !StringUtil.checkLength(article.getArticleAuthor(), 1, 12)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.length", this.getResString("articleAuthor"), "1", "12")); - return false; - } - // 验证文章描述长度,若超过定义长度则截取 - if (!StringUtils.isBlank(article.getBasicDescription()) - && !StringUtil.checkLength(article.getBasicDescription(), 1, 400)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.length", this.getResString("basicDescription"), "1", "400")); - return false; - } - // 验证文章关键字长度,若超过定义长度则截取 - if (!StringUtils.isBlank(article.getArticleKeyword()) - && !StringUtil.checkLength(article.getArticleKeyword(), 1, 155)) { - this.outJson(response, ModelCode.CMS_ARTICLE, false, - getResString("err.length", this.getResString("articleKeyword"), "1", "155")); - return false; - } - return true; - } - - /** - * 更新文章 - * - * @param basicId - * 文章id - * @param article - * 文章实体 - * @param request - * @param response - */ - @RequestMapping("/{basicId}/update") - @RequiresPermissions("article:update") - public void update(@PathVariable int basicId, @ModelAttribute ArticleEntity article, HttpServletRequest request, - HttpServletResponse response) { - // 获取站点id - int appId = BasicUtil.getAppId(); - article.setBasicUpdateTime(new Timestamp(System.currentTimeMillis())); - // 文章类型 - String checkboxType = BasicUtil.getString("checkboxType"); - //如果选择一个属性不做排序操作 - if(!StringUtils.isEmpty(checkboxType) && checkboxType.length()>2){ - // 文章类型排序 - article.setArticleType(ArrysUtil.sort(checkboxType, ",")+","); - }else{ - article.setArticleType(checkboxType); - } - // 获取更改前的文章实体 - ArticleEntity oldArticle = (ArticleEntity) articleBiz.getEntity(basicId); - // 获取栏目实体 - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(article.getBasicCategoryId()); - if (oldArticle != null) { - // 获取更改前的文章所属栏目实体 - ColumnEntity oldColumn = (ColumnEntity) columnBiz.getEntity(oldArticle.getBasicCategoryId()); - - // 通过表单类型id判断是否更改了表单类型,如果更改则先删除记录 - if (oldColumn.getColumnContentModelId() != column.getColumnContentModelId()) { - // 获取旧的内容模型id - ContentModelEntity contentModel = (ContentModelEntity) contentBiz - .getEntity(oldColumn.getColumnContentModelId()); - // 删除旧的内容模型中保存的值 - Map wheres = new HashMap(); - wheres.put("basicId", article.getBasicId()); - if (contentModel != null) { - fieldBiz.deleteBySQL(contentModel.getCmTableName(), wheres); - } - // 判断栏目是否存在新增字段 - if (column.getColumnContentModelId() != 0) { - // 保存所有的字段信息 - List listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); - ContentModelEntity newContentModel = (ContentModelEntity) contentBiz - .getEntity(column.getColumnContentModelId()); - if (newContentModel != null) { - Map param = this.checkField(listField, request, article.getBasicId()); - fieldBiz.insertBySQL(newContentModel.getCmTableName(), param); - } - } - } - } - //判断是否修改了所属栏目 - if(oldArticle.getBasicCategoryId()!=article.getBasicCategoryId()){ - //拼接栏目路径和文章编号及文件后缀 - article.setArticleUrl(column.getColumnPath() + File.separator + article.getBasicId() + ParserUtil.HTML_SUFFIX); - } - // 添加文章所属的站点id - article.setArticleWebId(appId); - // 设置文章所属的栏目实体 - article.setColumn(column); - - article.setBasicUpdateTime(new Date()); - - String articleType = request.getParameter("articleTypeJson"); - articleBiz.updateBasic(article); - - // 判断该文章是否存在新增字段 - if (column.getColumnContentModelId() != 0) { - // 保存所有的字段信息 - List listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); - // // update中的where条件 - Map where = new HashMap(); - // 压入默认的basicId字段 - where.put("basicId", article.getBasicId()); - // 遍历字段的信息 - Map param = this.checkField(listField, request, article.getBasicId()); - ContentModelEntity contentModel = (ContentModelEntity) contentBiz - .getEntity(column.getColumnContentModelId()); - if (contentModel != null) { - // 遍历所有的字段实体,得到字段名列表信息 - List listFieldName = new ArrayList(); - listFieldName.add("basicId"); - // 查询新增字段的信息 - List fieldLists = fieldBiz.queryBySQL(contentModel.getCmTableName(), listFieldName, where); - - // 判断新增字段表中是否存在该文章,不存在则保存,否则更新 - if (fieldLists == null || fieldLists.size() == 0) { - fieldBiz.insertBySQL(contentModel.getCmTableName(), param); - } else { - fieldBiz.updateBySQL(contentModel.getCmTableName(), param, where); - } - - } - } - - switch (column.getColumnType()) { - case ColumnEntity.COLUMN_TYPE_COVER: - this.outJson(response, ModelCode.CMS_ARTICLE, true, column.getCategoryId() + "", ""); - break; - case ColumnEntity.COLUMN_TYPE_LIST: - this.outJson(response, ModelCode.CMS_ARTICLE, true, column.getCategoryId() + "", - this.redirectBack(request, false)); - } - - } - - /** - * 显示更新内容 - * - * @param request - * @return 修改文章的页面地址 - */ - @RequestMapping("/{id}/edit") - public String edit(@PathVariable int id, ModelMap model, HttpServletRequest request) { - - // 如果_categoryId大于0表示是编辑封面栏目,应该先查询分类下面的唯一一篇文章 - String categoryTitle = request.getParameter("categoryTitle"); - // 板块id - int categoryId = BasicUtil.getInt("categoryId", 0); - ArticleEntity articleEntity = null; - int appId = BasicUtil.getAppId(); - model.addAttribute("appId", appId); - model.addAttribute("articleImagesUrl", "/upload/"+BasicUtil.getAppId()+"/"); - model.addAttribute("action", "update"); - - if (categoryId > 0) { // 分类获取文章 - articleEntity = articleBiz.getByCategoryId(categoryId); - ColumnEntity column = articleEntity.getColumn(); - int columnType = column.getColumnType(); - model.addAttribute("article", articleEntity); - // 文章属性 - model.addAttribute("articleType", DictUtil.list("文章属性")); - model.addAttribute("categoryTitle", categoryTitle); - model.addAttribute("categoryId", categoryId);// 编辑封面 - model.addAttribute("isEditCategory", true);// 编辑封面 - model.addAttribute("columnType", columnType); - return "/cms/article/article_form"; - } else if (id > 0) { // 文章id获取 - // 允许编辑文章时更改分类 - List list = columnBiz.queryAll(appId, this.getModelCodeId(request, ModelCode.CMS_COLUMN)); - @SuppressWarnings("static-access") - String listJsonString = JSONArray.toJSONString(list); - request.setAttribute("listColumn", listJsonString); - // 文章属性 - model.addAttribute("articleType", DictUtil.list("文章属性")); - - articleEntity = (ArticleEntity) articleBiz.getEntity(id); - model.addAttribute("article", articleEntity); - // 判断是否是封面类型的栏目,如果是封面类型的栏目有些信息需要屏蔽,例如分类 - ColumnEntity column = articleEntity.getColumn(); - int columnType = column.getColumnType(); - if (column.getColumnType() == ColumnEntity.ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { - model.addAttribute("categoryTitle", categoryTitle); - model.addAttribute("categoryId", column.getCategoryId());// 编辑封面 - model.addAttribute("isEditCategory", true);// 编辑封面 - } else { - model.addAttribute("categoryTitle", articleEntity.getColumn().getCategoryTitle()); - model.addAttribute("isEditCategory", false);// 编辑文章 - } - model.addAttribute("columnType", columnType); - model.addAttribute("categoryId", column.getCategoryId());// 编辑封面 - model.addAttribute("websiteId", BasicUtil.getAppId()); - return "/cms/article/article_form"; - } else {// 非法 - // return "/cms/article/article_form"); - return this.redirectBack(request, true); - } - } - - /** - * 删除文章 - * - * @param request - * @param response - * @return - */ - @RequestMapping("/delete") - @RequiresPermissions("article:del") - public void delete(@RequestBody List articles, HttpServletRequest request, HttpServletResponse response) { - int appId = BasicUtil.getAppId(); - int[] ids = new int[articles.size()]; - //循环获取id数据 - for(int i=0;i listField, HttpServletRequest request, int articleId) { - Map mapParams = new HashMap(); - // 压入默认的basicId字段 - mapParams.put("basicId", articleId); - // 遍历字段名 - for (int i = 0; i < listField.size(); i++) { - ContentModelFieldEntity field = (ContentModelFieldEntity) listField.get(i); - String fieldName = field.getFieldFieldName(); - // 判断字段类型是否为checkbox类型 - if (field.getFieldType() == checkBox) { - String langtyp[] = request.getParameterValues(field.getFieldFieldName()); - if (langtyp != null) { - StringBuffer sb = new StringBuffer(); - for (int j = 0; j < langtyp.length; j++) { - sb.append(langtyp[j] + ","); - } - mapParams.put(field.getFieldFieldName(), sb.toString()); - } else { - mapParams.put(field.getFieldFieldName(), langtyp); - } - } else { - if (StringUtils.isBlank(request.getParameter(field.getFieldFieldName()))) { - mapParams.put(field.getFieldFieldName(), null); - } else { - mapParams.put(field.getFieldFieldName(), request.getParameter(field.getFieldFieldName())); - } - } - } - return mapParams; - } - - /** - * 查询单页栏目是否绑定了文章 - * - * @param article - * 文章对象 - */ - @RequestMapping("/{id}/queryColumnArticle") - public void queryColumnArticle(@PathVariable int id, HttpServletResponse response) { - List articls = articleBiz.queryListByColumnId(id); - if (articls == null || articls.size() == 0) { - this.outJson(response, ModelCode.CMS_ARTICLE, true, null); - } else { - this.outJson(response, ModelCode.CMS_ARTICLE, false, null); - } - } - - -} \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/action/ColumnAction.java b/src/main/java/net/mingsoft/cms/action/ColumnAction.java deleted file mode 100644 index 85c26ac2..00000000 --- a/src/main/java/net/mingsoft/cms/action/ColumnAction.java +++ /dev/null @@ -1,317 +0,0 @@ -package net.mingsoft.cms.action; - - -import java.io.File; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import net.mingsoft.basic.util.ArrysUtil; -import net.mingsoft.mdiy.util.DictUtil; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.alibaba.fastjson.JSONArray; - -import net.mingsoft.basic.action.BaseAction; -import net.mingsoft.basic.bean.EUListBean; -import net.mingsoft.basic.biz.ICategoryBiz; -import net.mingsoft.basic.biz.IColumnBiz; -import net.mingsoft.basic.biz.IModelBiz; -import net.mingsoft.basic.constant.Const; -import net.mingsoft.basic.constant.ModelCode; -import net.mingsoft.basic.constant.e.SessionConstEnum; -import net.mingsoft.basic.entity.ColumnEntity; -import net.mingsoft.basic.entity.ManagerEntity; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.basic.util.FileUtil; -import net.mingsoft.basic.util.StringUtil; -import net.mingsoft.mdiy.util.ParserUtil; - - - -/** - * 铭飞MS平台,通用栏目分类,为了区分文章栏目与其他栏目的权限,该类是从basic模块复制过来 - * @author 铭飞开发团队 - * @version - * 版本号:100-000-000
- * 创建日期:2017年8月9日
- * 历史修订:
- */ -@Controller("articleColumnAction") -@RequestMapping("/${ms.manager.path}/cms/column") -public class ColumnAction extends BaseAction{ - - - /** - * 栏目业务层 - */ - @Autowired - private IColumnBiz columnBiz; - @Autowired - private ICategoryBiz categoryBiz; - - /** - * 模块业务层注入 - */ - @Autowired - private IModelBiz modelBiz; - /** - * 返回主界面index - */ - @RequestMapping("/index") - @RequiresPermissions("cms:column:view") - public String index(HttpServletResponse response,HttpServletRequest request,ModelMap model){ - model.addAttribute("model", "cms"); - return "/basic/column/index"; - } - /** - * 栏目添加跳转页面 - * - * @return - */ - @RequestMapping("/add") - public String add(HttpServletRequest request,ModelMap model) { - // 站点ID - int appId =BasicUtil.getAppId(); - List list = columnBiz.queryAll(appId, BasicUtil.getModelCodeId(net.mingsoft.cms.constant.ModelCode.CMS_COLUMN.toString())); - ColumnEntity columnSuper = new ColumnEntity(); - // 栏目属性 - model.addAttribute("columnFlag", DictUtil.list("栏目属性")); - model.addAttribute("appId",appId); - model.addAttribute("columnSuper", columnSuper); - model.addAttribute("column",new ColumnEntity()); - model.addAttribute("listColumn", JSONArray.toJSONString(list)); - model.addAttribute("model", "cms"); - model.addAttribute("websiteId", appId); - - return "/basic/column/form"; - } - - /** - * 后台验证填写的栏目信息是否合法 - * @param column 栏目信息 - * @param response - * @return false:不合法 true:合法 - */ - private boolean checkForm(ColumnEntity column, HttpServletResponse response){ - //栏目标题空值验证 - if(StringUtils.isBlank(column.getCategoryTitle())){ - this.outJson( response, ModelCode.COLUMN, false, getResString("err.empty", this.getResString("categoryTitle"))); - return false; - } - //栏目标题长度验证 - if(!StringUtil.checkLength(column.getCategoryTitle(), 1, 31)){ - this.outJson( response, ModelCode.COLUMN, false, getResString("err.length", this.getResString("categoryTitle"), "1", "30")); - return false; - } - //栏目属性空值验证 - if(StringUtils.isBlank(column.getColumnType()+"")){ - this.outJson( response, ModelCode.COLUMN, false, getResString("err.empty", this.getResString("columnType"))); - return false; - } - - return true; - } - - /** - * 组织栏目链接地址 - * @param request - * @param column 栏目实体 - */ - private void columnPath(HttpServletRequest request,ColumnEntity column){ - StringBuffer columnPath = new StringBuffer(); - String file = BasicUtil.getRealPath("")+ParserUtil.HTML+File.separator+ column.getAppId(); - String delFile = ""; - //修改栏目路径时,删除已存在的文件夹 - column = (ColumnEntity) columnBiz.getEntity(column.getCategoryId()); - delFile = file + column.getColumnPath(); - if(!StringUtils.isBlank(delFile)){ - File delFileName = new File(delFile); - delFileName.delete(); - } - //若为顶级栏目,则路径为:/+栏目ID - if(column.getCategoryCategoryId() == 0){ - column.setColumnPath(File.separator+column.getCategoryId()); - file = file + File.separator + column.getCategoryId(); - } else { - List list = columnBiz.queryParentColumnByColumnId(column.getCategoryId()); - if(list != null){ - StringBuffer temp = new StringBuffer(); - for(int i = list.size()-1; i>=0; i--){ - ColumnEntity entity = list.get(i); - columnPath.append(File.separator).append(entity.getCategoryId()); - temp.append(File.separator).append(entity.getCategoryId()); - } - column.setColumnPath(columnPath.append(File.separator).append(column.getCategoryId()).toString()); - file = file + temp.toString() + File.separator + column.getCategoryId(); - } - } - columnBiz.updateEntity(column); - //生成文件夹 - File fileName = new File(file); - fileName.mkdir(); - } - - /** - * @param column 栏目表实体 - * column参数包含字段信息参考:
- * columnCategoryid:多个columnCategoryid直接用逗号隔开,例如columnCategoryid=1,2,3,4 - * 批量删除栏目表 - *
返回

- *
{code:"错误编码",
- * result:"true|false",
- * resultMsg:"错误信息"
- * }
- */ - @RequestMapping("/delete") - @ResponseBody - public void delete(HttpServletResponse response, HttpServletRequest request) { - int[] ids = BasicUtil.getInts("ids", ","); - ColumnEntity column =new ColumnEntity(); - for(int i=0;i list = new ArrayList(); - // 判断管理员权限,查询其管理的栏目集合 - list = columnBiz.queryAll(appId, BasicUtil.getModelCodeId(net.mingsoft.cms.constant.ModelCode.CMS_COLUMN.toString())); - //查询当前栏目实体 - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(columnId); - // 栏目属性 - model.addAttribute("columnFlag", DictUtil.list("栏目属性")); - model.addAttribute("appId",appId); - model.addAttribute("column", column); - model.addAttribute("columnc", column.getCategoryId()); - ColumnEntity columnSuper = new ColumnEntity(); - // 获取父栏目对象 - if (column.getCategoryCategoryId() != Const.COLUMN_TOP_CATEGORY_ID) { - columnSuper = (ColumnEntity) columnBiz.getEntity(column.getCategoryCategoryId()); - } - model.addAttribute("columnSuper", columnSuper); - model.addAttribute("listColumn", JSONArray.toJSONString(list)); - model.addAttribute("model", "cms"); - model.addAttribute("websiteId", appId); - return "/basic/column/form"; - } - - /** - * 栏目首页面列表显示 - */ - @SuppressWarnings("deprecation") - @RequestMapping("/list") - public void list(@ModelAttribute ColumnEntity column,HttpServletResponse response, HttpServletRequest request,ModelMap model) { - - // 站点ID有session获取 - int websiteId = BasicUtil.getAppId(); - // 需要打开的栏目节点树的栏目ID - List list = columnBiz.queryAll(websiteId, BasicUtil.getModelCodeId(net.mingsoft.cms.constant.ModelCode.CMS_COLUMN.toString())); - EUListBean _list = new EUListBean(list, list.size()); - this.outJson(response, net.mingsoft.base.util.JSONArray.toJSONString(_list)); - } - - /** - * 栏目添加 - * - * @param column - * 栏目对象 - * @return 返回页面跳转 - */ - @RequestMapping("/save") - public void save(@ModelAttribute ColumnEntity column,HttpServletRequest request,HttpServletResponse response) { - if(!checkForm(column,response)){ - return; - } - column.setCategoryAppId( BasicUtil.getAppId()); - column.setAppId(BasicUtil.getAppId()); - column.setCategoryManagerId(getManagerBySession(request).getManagerId()); - column.setCategoryDateTime(new Timestamp(System.currentTimeMillis())); - column.setCategoryModelId(BasicUtil.getModelCodeId(net.mingsoft.cms.constant.ModelCode.CMS_COLUMN.toString())); - String checkboxType = BasicUtil.getString("checkboxType"); - //如果选择一个属性不做排序操作 - if(!StringUtils.isEmpty(checkboxType) && checkboxType.length()>2){ - column.setColumnFlag(ArrysUtil.sort(checkboxType, ",")+","); - }else{ - column.setColumnFlag(checkboxType); - } - if(column.getColumnType()==ColumnEntity.ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()){ - column.setColumnListUrl(null); - } - columnBiz.saveCategory(column); - this.columnPath(request,column); - this.outJson(response, ModelCode.COLUMN, true,null,JSONArray.toJSONString(column.getCategoryId())); - } - - /** - * 更新栏目 - * @param column 栏目实体 - * @param request - * @param response - */ - @RequestMapping("/update") - @ResponseBody - public void update(@ModelAttribute ColumnEntity column,HttpServletRequest request,HttpServletResponse response) { - //获取站点ID - int websiteId = BasicUtil.getAppId(); - //检测栏目信息是否合法 - if(!checkForm(column,response)){ - return; - } - //若栏目管理属性为单页,则栏目的列表模板地址设为Null - if(column.getColumnType()==ColumnEntity.ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()){ - column.setColumnListUrl(null); - } - column.setCategoryManagerId(getManagerBySession(request).getManagerId()); - column.setAppId(websiteId); - String checkboxType = BasicUtil.getString("checkboxType"); - //如果选择一个属性不做排序操作 - if(!StringUtils.isEmpty(checkboxType) && checkboxType.length()>2){ - column.setColumnFlag(ArrysUtil.sort(checkboxType, ",")+","); - }else{ - column.setColumnFlag(checkboxType); - } - columnBiz.updateCategory(column); - this.columnPath(request,column); - //查询当前栏目是否有子栏目, - List childList = columnBiz.queryChild(column.getCategoryId(), websiteId,BasicUtil.getModelCodeId(net.mingsoft.cms.constant.ModelCode.CMS_COLUMN.toString()),null); - if(childList != null && childList.size()>0){ - //改变子栏目的顶级栏目ID为当前栏目的父级栏目ID - for(int i=0;i返回
- * {"basicCategoryId":分类编号,basicTitle - * :"标题",basicDescription:"描述",basicThumbnails:"缩略图", - * basicDateTime:"发布时间",basicUpdateTime:"更新时间","basicHit":点击数, - * "basicId":编号 articleContent:"文章内容","basicSort":排序,[自定义模型字段]} - */ - @GetMapping("/{basicId}/detail") - @ResponseBody - public void detail(@PathVariable int basicId, HttpServletRequest request, HttpServletResponse response) { - ArticleEntity article = articleBiz.getById(basicId); - if (article == null) { - this.outJson(response, ""); - return; - } - // 获取文章栏目id获取栏目实体 - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(article.getBasicCategoryId()); - ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz - .getEntity(column.getColumnContentModelId()); - - // 判断内容模型的值 - if (contentModel != null) { - Map where = new HashMap(); - // 压入basicId字段的值 - where.put("basicId", basicId); - // 遍历所有的字段实体,得到字段名列表信息 - List listFieldName = new ArrayList(); - listFieldName.add("basicId"); - // 查询新增字段的信息 - List fieldLists = fieldBiz.queryBySQL(contentModel.getCmTableName(), listFieldName, where); - if (fieldLists.size() > 0) { - Map map = (Map) fieldLists.get(0); - article.setExtendsFields(map); - } - } - - this.outJson(response, JSONObject.toJSONStringWithDateFormat(article, "yyyy-MM-dd hh:mm:ss")); - } - - - /** - * 文章列表信息 - * - * @param pageSize - * 一页显示数量 - * @param pageNum - * 当前页码 - * @param basicCategoryId - * 分类编号 - *
返回

- * {"list":"[{ - * "basicTitle":"标题", - * "basicDescription":"描述", - * "basicThumbnails":"缩略图", - * "basicDateTime":"发布时间", - * "basicUpdateTime":"更新时间", - * "basicHit":点击数, - * "basicId":编号, - * "articleContent":文章内容, - * "articleAuthor":文章作者 - * "articleType":文章属性, - * "articleSource":文章的来源, - * "articleUrl":文章跳转链接地址, - * "articleKeyword":文章关键字, - * "articleCategoryId":文章所属的分类Id, - * "articleTypeLinkURL":文章分类url地址,主要是用户生成html使用, - * "order":"排序方式", - * "orderBy":"排序字段 - * }], - * "page":{"endRow": 2, 当前页面最后一个元素在数据库中的行号 - * "firstPage": 1, 第一页页码 - * "hasNextPage": true存在下一页false不存在, - * "hasPreviousPage": true存在上一页false不存在, - * "isFirstPage": true是第一页false不是第一页, - * "isLastPage": true是最后一页false不是最后一页, - * "lastPage": 最后一页的页码, - * "navigatePages": 导航数量,实现 1...5.6.7....10效果, - * "navigatepageNums": []导航页码集合, - * "nextPage": 下一页, - * "pageNum": 当前页码, - * "pageSize": 一页显示数量, - * "pages": 总页数, - * "prePage": 上一页, - * "size": 总记录, - * "startRow":当前页面第一个元素在数据库中的行号, - * "total":总记录数量 - * } - */ - @RequestMapping(value = "/list",method= RequestMethod.GET) - @ApiOperation(value="文章列表信息") - @ResponseBody - public void list(@ModelAttribute @ApiIgnore ArticleEntity article, HttpServletRequest request, HttpServletResponse response) { - int appId = BasicUtil.getAppId(); - int[] ids = null; - if (article.getBasicCategoryId()>0) { - ids = new int[]{article.getBasicCategoryId()}; - } - //默认为desc排序 - boolean isOrder = true; - if(!StringUtils.isBlank(article.getOrder())){ - String basicOrder = article.getOrder(); - if(basicOrder.equalsIgnoreCase("asc")){ - isOrder = false; - } - } - BasicUtil.startPage(); - List list = articleBiz.query(appId, ids, null, null, article.getOrderBy(), isOrder, null, null, article); - - for(ArticleEntity _article : list){ - // 获取文章栏目id获取栏目实体 - ColumnEntity column = (ColumnEntity) columnBiz.getEntity(_article.getBasicCategoryId()); - ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz - .getEntity(column.getColumnContentModelId()); - - // 判断内容模型的值 - if (contentModel != null) { - Map where = new HashMap(); - // 压入basicId字段的值 - where.put("basicId", _article.getBasicId()); - // 遍历所有的字段实体,得到字段名列表信息 - List listFieldName = new ArrayList(); - listFieldName.add("basicId"); - // 查询新增字段的信息 - List fieldLists = fieldBiz.queryBySQL(contentModel.getCmTableName(), listFieldName, where); - if (fieldLists.size() > 0) { - Map map = (Map) fieldLists.get(0); - _article.setExtendsFields(map); - } - } - } - this.outJson(response, JSONArray.toJSONString(new ListBean(list, BasicUtil.endPage(list)),new DateValueFilter("yyyy-MM-dd HH:mm:ss"))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/action/web/ContentAction.java b/src/main/java/net/mingsoft/cms/action/web/ContentAction.java deleted file mode 100644 index 0ef27d96..00000000 --- a/src/main/java/net/mingsoft/cms/action/web/ContentAction.java +++ /dev/null @@ -1,266 +0,0 @@ -package net.mingsoft.cms.action.web; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import net.mingsoft.base.entity.BaseEntity; -import net.mingsoft.base.entity.ResultData; -import net.mingsoft.basic.bean.EUListBean; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.basic.util.StringUtil; -import net.mingsoft.cms.biz.IContentBiz; -import net.mingsoft.cms.entity.ContentEntity; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -/** - * 文章管理控制层 - * @author 铭飞开发团队 - * 创建日期:2019-11-28 15:12:32
- * 历史修订:
- */ -@Api(value = "文章接口") -@Controller("WebcmsContentAction") -@RequestMapping("/cms/content") -public class ContentAction extends net.mingsoft.cms.action.BaseAction{ - - - /** - * 注入文章业务层 - */ - @Autowired - private IContentBiz contentBiz; - - /** - * 返回主界面index - */ - @GetMapping("/index") - public String index(HttpServletResponse response,HttpServletRequest request){ - return "/cms/content/index"; - } - - /** - * 查询文章列表 - * @param content 文章实体 - */ - @ApiOperation(value = "查询文章列表接口") - @ApiImplicitParams({ - @ApiImplicitParam(name = "contentTitle", value = "文章标题", required =false,paramType="query"), - @ApiImplicitParam(name = "contentCategoryId", value = "所属栏目", required =false,paramType="query"), - @ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"), - @ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"), - @ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =false,paramType="query"), - @ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"), - @ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"), - @ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"), - @ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"), - @ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"), - @ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"), - @ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"), - @ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"), - @ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"), - @ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"), - @ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"), - }) - @RequestMapping("/list") - @ResponseBody - public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { - BasicUtil.startPage(); - List contentList = contentBiz.query(content); - return ResultData.build().success(new EUListBean(contentList,(int)BasicUtil.endPage(contentList).getTotal())); - } - - /** - * 返回编辑界面content_form - */ - @GetMapping("/form") - public String form(@ModelAttribute ContentEntity content,HttpServletResponse response,HttpServletRequest request,ModelMap model){ - if(content.getId()!=null){ - BaseEntity contentEntity = contentBiz.getEntity(Integer.parseInt(content.getId())); - model.addAttribute("contentEntity",contentEntity); - } - return "/cms/content/form"; - } - - /** - * 获取文章 - * @param content 文章实体 - */ - @ApiOperation(value = "获取文章列表接口") - @ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") - @GetMapping("/get") - @ResponseBody - public ResultData get(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model){ - if(content.getId()==null) { - return ResultData.build().error(); - } - ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId())); - return ResultData.build().success(_content); - } - - @ApiOperation(value = "保存文章列表接口") - @ApiImplicitParams({ - @ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"), - @ApiImplicitParam(name = "contentCategoryId", value = "所属栏目", required =false,paramType="query"), - @ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"), - @ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"), - @ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =true,paramType="query"), - @ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"), - @ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"), - @ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"), - @ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"), - @ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"), - @ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"), - @ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"), - @ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"), - @ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"), - @ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"), - @ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"), - @ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"), - }) - - /** - * 保存文章 - * @param content 文章实体 - */ - @PostMapping("/save") - @ResponseBody - public ResultData save(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request) { - //验证文章标题的值是否合法 - if(StringUtil.isBlank(content.getContentTitle())){ - return ResultData.build().error(getResString("err.empty", this.getResString("content.title"))); - } - if(!StringUtil.checkLength(content.getContentTitle()+"", 0, 200)){ - return ResultData.build().error(getResString("err.length", this.getResString("content.title"), "0", "200")); - } - if(!StringUtil.checkLength(content.getContentAuthor()+"", 0, 200)){ - return ResultData.build().error(getResString("err.length", this.getResString("content.author"), "0", "200")); - } - if(!StringUtil.checkLength(content.getContentSource()+"", 0, 200)){ - return ResultData.build().error(getResString("err.length", this.getResString("content.source"), "0", "200")); - } - //验证发布时间的值是否合法 - if(StringUtil.isBlank(content.getContentDatetime())){ - return ResultData.build().error(getResString("err.empty", this.getResString("content.datetime"))); - } - if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ - return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); - } - contentBiz.saveEntity(content); - return ResultData.build().success(content); - } - - /** - * @param contents 文章实体 - */ - @ApiOperation(value = "批量删除文章列表接口") - @PostMapping("/delete") - @ResponseBody - public ResultData delete(@RequestBody List contents,HttpServletResponse response, HttpServletRequest request) { - int[] ids = new int[contents.size()]; - for(int i = 0;i query(int webId, int[] basicCategoryIds, String flag, String noFlag, String orderBy, - boolean order, String beginTime,String endTime, ArticleEntity article); - - /** - * 查询文章编号集合 - * @param categoryId 栏目编号 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return - */ - public List queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime); - /** - * 查询文章编号集合 - * @param categoryId 栏目编号 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @param orderBy 排序字段 - * @param order 排序方式 - * @return - */ - public List queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime,String orderBy,String order); - /** - * 根据页面栏目的id获取与其绑定的文章实体 - * - * @param basicCategoryId - * @return 文章实体 - */ - @Deprecated - public List queryListByColumnId(int basicCategoryId); - - - - - /** - * 高级查询接口,主要提供给有自定义模型的栏目, - * - * @param conntentModel - * 自定义模型 - * @param whereMap - * 條件 - * @param page - * 分頁 - * @param appId - * 應用編號 - * @param ids - * 子类id - * @return 记录集合 - */ - @Deprecated - public List queryListForSearch(ContentModelEntity conntentModel, Map whereMap, - int appId, List ids, Map orders); - -} \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/biz/impl/ArticleBizImpl.java b/src/main/java/net/mingsoft/cms/biz/impl/ArticleBizImpl.java deleted file mode 100644 index 7f89bd37..00000000 --- a/src/main/java/net/mingsoft/cms/biz/impl/ArticleBizImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) - - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.mingsoft.cms.biz.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.github.pagehelper.PageHelper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import net.mingsoft.base.dao.IBaseDao; -import net.mingsoft.basic.biz.ICategoryBiz; -import net.mingsoft.basic.biz.IColumnBiz; -import net.mingsoft.basic.biz.IModelBiz; -import net.mingsoft.basic.biz.impl.BasicBizImpl; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.cms.bean.ColumnArticleIdBean; -import net.mingsoft.cms.biz.IArticleBiz; -import net.mingsoft.cms.dao.IArticleDao; -import net.mingsoft.cms.entity.ArticleEntity; -import net.mingsoft.mdiy.biz.IContentModelBiz; -import net.mingsoft.mdiy.entity.ContentModelEntity; - -/** - * - * @ClassName: ArticleBizImpl - * @Description:TODO(文章管理业务层实现类 || 继承BasicBizImpl || 实现IArticleBiz) - * @author: 铭飞开发团队 - * @date: 2018年1月31日 下午2:53:53 - * - * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. - */ -@Service("ArticleBizImpl") -public class ArticleBizImpl extends BasicBizImpl implements IArticleBiz { - - - /** - * 文章持久化处理 - */ - private IArticleDao articleDao; - - - - /** - * 栏目业务处理 - */ - @Autowired - private ICategoryBiz categoryBiz; - - /** - * 自定类型义业务处理 - */ - @Autowired - private IColumnBiz columnBiz; - - /** - * 自定义模型 - */ - @Autowired - private IContentModelBiz contentModelBiz; - - /** - * 模块管理业务层 - */ - @Autowired - private IModelBiz modelBiz; - - @Override - @Deprecated - public int count(int webId, int[] basicCategoryId, String flag, String noFlag,ArticleEntity article) { - return articleDao.count(webId, basicCategoryId, flag, noFlag,article); - } - - - /** - * 获取Article的持久化层 - * - * @return 返回持Article的久化对象 - */ - public IArticleDao getArticleDao() { - return articleDao; - } - - @Override - @Deprecated - public ArticleEntity getByCategoryId(int categoryId) { - // TODO Auto-generated method stub - List list = articleDao.getByCategoryId(categoryId); - if (list != null && list.size() > 0) { - return (ArticleEntity) list.get(0); - } - return null; - } - - @Override - public ArticleEntity getById(int basicId) { - // TODO Auto-generated method stub - ArticleEntity article = (ArticleEntity) articleDao.getEntity(basicId); - String contentModelTableName = null; - int ccmi = article.getColumn().getColumnContentModelId(); // 内容模型编号 - if (ccmi > 0) { - ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(ccmi); - contentModelTableName = contentModel.getCmTableName(); - } - List temp = articleDao.getById(basicId, contentModelTableName); - if (temp != null && temp.size() > 0) { - return (ArticleEntity) temp.get(0); - } - return null; - } - - - - /** - * 获取IBaseDao的持久化层 - * - * @return 返回持articleDao的久化对象 - */ - @Override - protected IBaseDao getDao() { - // TODO Auto-generated method stub - return articleDao; - } - - @Override - @Deprecated - public ArticleEntity getNext(int appId, int basicId,Integer categoryId) { - // TODO Auto-generated method stub - return articleDao.getNextOrPrevious(appId, basicId, true,categoryId); - } - - @Override - @Deprecated - public ArticleEntity getPrevious(int appId, int basicId,Integer categoryId) { - // TODO Auto-generated method stub - return articleDao.getNextOrPrevious(appId, basicId, false,categoryId); - } - @Override - public int getSearchCount(ContentModelEntity contentModel,Map wherMap, int websiteId,String ids) { - if (contentModel!=null) { - return articleDao.getSearchCount(contentModel.getCmTableName(),wherMap, websiteId,ids); - } - return articleDao.getSearchCount(null,wherMap, websiteId,ids); - } - - @Override - public List query(int webId, int[] basicCategoryIds, String flag, String noFlag, String orderBy, - boolean order,String beginTime,String endTime, ArticleEntity article) { - // TODO Auto-generated method stub - if(article == null) { - article = new ArticleEntity(); - } - return articleDao.query(webId, basicCategoryIds, flag, noFlag, orderBy, order, beginTime, endTime, article); - } - - /** - * 根据页面栏目的id获取与其绑定的文章实体 - * - * @param basicCategoryId - * @return 文章实体 - */ - @Override - @Deprecated - public List queryListByColumnId(int basicCategoryId) { - // TODO Auto-generated method stub - return articleDao.queryListByColumnId(basicCategoryId); - } - - - @Deprecated - public List queryListForSearch(ContentModelEntity conntentModel, Map whereMap, int websiteId,List ids,Map orders) { - List articleList = new ArrayList(); - String tableName = null; - if (conntentModel!=null) { - tableName = conntentModel.getCmTableName(); - } - // 查找所有符合条件的文章实体 - articleList = articleDao.queryListForSearch(tableName, whereMap, websiteId,ids,orders); - return articleList; - } - - /** - * 设置Article的持久化层 - * - * @param articleDao - */ - @Autowired - public void setArticleDao(IArticleDao articleDao) { - this.articleDao = articleDao; - } - - - @Override - public List queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime) { - return this.articleDao.queryIdsByCategoryIdForParser(categoryId,BasicUtil.getAppId(), beginTime, endTime,null,null); - } - @Override - public List queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime,String orderBy,String order) { - return this.articleDao.queryIdsByCategoryIdForParser(categoryId,BasicUtil.getAppId(), beginTime, endTime,orderBy,order); - } -} \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/IArticleDao.java b/src/main/java/net/mingsoft/cms/dao/IArticleDao.java deleted file mode 100644 index 7eb8d349..00000000 --- a/src/main/java/net/mingsoft/cms/dao/IArticleDao.java +++ /dev/null @@ -1,169 +0,0 @@ -/** - The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) - - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.mingsoft.cms.dao; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -import net.mingsoft.cms.bean.ColumnArticleIdBean; -import net.mingsoft.cms.entity.ArticleEntity; - -import net.mingsoft.base.dao.IBaseDao; - - -/** - * - * @ClassName: IArticleDao - * @Description:TODO(文章管理持久化层 || 继承IBaseDao持久化层) - * @author: 铭飞开发团队 - * @date: 2018年1月31日 下午2:55:33 - * - * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. - */ -public interface IArticleDao extends IBaseDao { - - /** - * @para webId 网站编号 - * @param basicCategoryIds - * 栏目编号集合 - * @param flag - * 文章属性 - * @param noFlag - * 文章不存在的属性 - * @param article - * 文章实体,便于扩展查询 - * @return 文章总数 - */ - @Deprecated - int count(@Param("webId") int webId, @Param("basicCategoryIds") int[] basicCategoryIds, @Param("flag") String flag, - @Param("noFlag") String noFlag, @Param("article") ArticleEntity article); - - /** - * 通过分类id获取文章内容 - * - * @param categoryId - * 分类编号 - * @return 文章集合 - */ - @Deprecated - List getByCategoryId(@Param("categoryId") int categoryId); - - /** - * 通过视图表来查询文章总数 - * - * @param basicId - * 文章编号 - * @param contentModelTableName - * 对应模块表名称 - */ - List getById(@Param("basicId") int basicId, @Param("contentModelTableName") String contentModelTableName); - - /** - * 查找basicId上一篇文章 - * - * @param appId - * 应用编号 - * @param basicId - * 文章编号 - * @param flag - * true:上一条 false:下一条 - * @return - */ - ArticleEntity getNextOrPrevious(@Param("appId") int appId, @Param("basicId") int basicId, - @Param("flag") boolean flag, @Param("categoryId") Integer categoryId); - - /** - * 根据查询文章实体总数 - * - * @param tableName - * :自定义生成的表名 - * @param map - * key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段 list[1]:是否为整形 - * list[2]:是否是等值查询 list[3]:字段的值 - * @return 文章实体总数 - */ - int getSearchCount(@Param("tableName") String tableName, @Param("map") Map map, - @Param("websiteId") int websiteId, @Param("ids") String ids); - - /** - * 文章查询 - * - * @para webId 网站编号 - * @param basicCategoryIds - * 栏目编号集合 - * @param flag - * 文章属性 - * @param noFlag - * 文章不存在的属性 - * @param orderBy - * 排序字段 - * @param order - * true 升序 false 降序 排序方式 - * @param article - * 文章实体,便于扩展查询 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return 文章集合 - */ - List query(@Param("webId") int webId, @Param("basicCategoryIds") int[] basicCategoryIds, - @Param("flag") String flag, @Param("noFlag") String noFlag, @Param("orderBy") String orderBy, - @Param("order") boolean order, @Param("beginTime") String beginTime,@Param("endTime") String endTime, - @Param("article") ArticleEntity article); - - /** - * 根据页面栏目的id获取与其绑定的文章实体 - * - * @param basicCategoryId - * @return 文章实体 - */ - @Deprecated - List queryListByColumnId(@Param("basicCategoryId") int basicCategoryId); - - /** - * 根据查询文章实体 - * - * @param tableName - * :自定义生成的表名 - * @param map - * 获取查询条件的Map key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段 - * list[1]:是否为整形 list[2]:是否是等值查询 list[3]:字段的值 - * @return 文章实体 - */ - @Deprecated - List queryListForSearch(@Param("tableName") String tableName, @Param("map") Map map, - @Param("websiteId") int websiteId, @Param("ids") List ids, - @Param("sortMap") Map sortMap); - - /** - * 查询文章编号集合 - * @param categoryId 栏目编号 - * @param appId 站点编号 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return - */ - public List queryIdsByCategoryIdForParser(@Param("categoryId")int categoryId,@Param("appId")int appId , @Param("beginTime") String beginTime,@Param("endTime") String endTime,@Param("orderBy")String orderBy,@Param("order")String order); - - -} \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/IArticleDao.xml b/src/main/java/net/mingsoft/cms/dao/IArticleDao.xml deleted file mode 100644 index 9e17ef2e..00000000 --- a/src/main/java/net/mingsoft/cms/dao/IArticleDao.xml +++ /dev/null @@ -1,624 +0,0 @@ - - - - - - - a.ARTICLE_BASICID,a.ARTICLE_CONTENT,a.ARTICLE_AUTHOR,a.ARTICLE_TYPE,a.ARTICLE_SOURCE,a.ARTICLE_URL,a.ARTICLE_KEYWORD,a.ARTICLE_FREEORDER,a.ARTICLE_WEBID, - b.BASIC_ID,b.BASIC_TITLE,b.BASIC_DESCRIPTION,b.BASIC_THUMBNAILS,b.BASIC_HIT,b.BASIC_DISPLAY,b.BASIC_DATETIME,b.BASIC_UPDATETIME,b.BASIC_PEOPLEID,b.BASIC_CATEGORYID,b.BASIC_SORT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BASIC_ID,ARTICLE_AUTHOR,ARTICLE_TYPE,ARTICLE_SOURCE,ARTICLE_URL,ARTICLE_KEYWORD,ARTICLE_FREEORDER, - BASIC_DISPLAY,BASIC_TITLE,BASIC_DESCRIPTION,BASIC_THUMBNAILS,BASIC_HIT,BASIC_DATETIME,BASIC_UPDATETIME,BASIC_PEOPLEID,BASIC_CATEGORYID,BASIC_SORT - - - - - - BASIC_DISPLAY,BASIC_ID,BASIC_CATEGORYID,BASIC_TITLE,BASIC_DESCRIPTION,BASIC_THUMBNAILS,BASIC_HIT,BASIC_DATETIME,BASIC_UPDATETIME,BASIC_PEOPLEID,BASIC_SORT, - ARTICLE_BASICID,ARTICLE_AUTHOR,ARTICLE_CONTENT,ARTICLE_TYPE,ARTICLE_SOURCE,ARTICLE_URL,ARTICLE_KEYWORD,ARTICLE_FREEORDER,ARTICLE_WEBID, - COLUMN_KEYWORD,COLUMN_DESCRIP,COLUMN_TYPE,COLUMN_URL,COLUMN_LISTURL,COLUMN_PATH,COLUMN_CM_ID,COLUMN_CATEGORY_ID, - CATEGORY_TITLE,CATEGORY_APPID,CATEGORY_ID - - - - - - insert into cms_article - - - ARTICLE_BASICID, - ARTICLE_CONTENT, - ARTICLE_AUTHOR, - ARTICLE_TYPE, - ARTICLE_SOURCE, - ARTICLE_URL, - ARTICLE_KEYWORD, - ARTICLE_FREEORDER, - ARTICLE_WEBID, - - - - #{basicId}, - #{articleContent}, - #{articleAuthor}, - #{articleType}, - #{articleSource}, - #{articleUrl}, - #{articleKeyword}, - #{articleFreeOrder}, - #{articleWebId}, - - - - - - - DELETE b from basic b WHERE b.basic_id=#{basicId}; - DELETE c from cms_article c WHERE c.article_basicid=#{basicId} - - - - - - update cms_article - - ARTICLE_CONTENT=#{articleContent}, - ARTICLE_AUTHOR=#{articleAuthor}, - ARTICLE_TYPE=#{articleType}, - ARTICLE_SOURCE=#{articleSource}, - ARTICLE_URL=#{articleUrl}, - ARTICLE_KEYWORD=#{articleKeyword}, - ARTICLE_FREEORDER=#{articleFreeOrder}, - ARTICLE_WEBID=#{articleWebId}, - - where ARTICLE_BASICID = #{basicId} - - - - - - - - - - - CONCAT('%',#{article.basicTitle},'%') - - - '%'||#{ article.basicTitle}||'%' - - - '%'+#{ article.basicTitle}+'%' - - - - CONCAT('%',#{flag},'%') - - - '%'||#{ flag}||'%' - - - '%'+#{ flag}+'%' - - - - CONCAT('%',#{noFlag},'%') - - - '%'||#{ noFlag}||'%' - - - '%'+#{ noFlag}+'%' - - - - - - - - - find_in_set('${categoryId}',CATEGORY_PARENT_ID) - - - instr(','||'${categoryId}'||',', ','||CATEGORY_PARENT_ID||',')>0 - - - CHARINDEX(','+'${categoryId}'+',' , ','+CATEGORY_PARENT_ID +',')>0 - - - - - - - - - - - - - - - - - like CONCAT("%", - - #{val} - - ,"%") - - - like '%'|| - - #{val} - - ||'%' - - - like '%'+ - - #{val} - - +'%' - - - - - - - - - - - - - - - - - - - - - - - - - from - (((basic JOIN cms_article ON (BASIC_ID = ARTICLE_BASICID)) - JOIN basic_column ON (BASIC_CATEGORYID = COLUMN_CATEGORY_ID)) - JOIN category ON (COLUMN_CATEGORY_ID = CATEGORY_ID)) - - where category_appid=#{appId} - - and basic_id < ${basicId} - - - - and basic_id > ${basicId} - - - - and BASIC_CATEGORYID = #{categoryId} - - - - - - - - - - to_date(#{dateTime},'yyyy-MM-dd HH24:mi:ss') - - - #{dateTime} - - - #{dateTime} - - - - - - - delete from cms_article - - ARTICLE_BASICID in - #{item} - - - - \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/entity/ArticleEntity.java b/src/main/java/net/mingsoft/cms/entity/ArticleEntity.java deleted file mode 100644 index fc112d03..00000000 --- a/src/main/java/net/mingsoft/cms/entity/ArticleEntity.java +++ /dev/null @@ -1,293 +0,0 @@ -/** -The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) - - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.mingsoft.cms.entity; - -import java.io.File; -import java.util.Arrays; - -import net.mingsoft.basic.entity.AppEntity; -import net.mingsoft.basic.entity.BasicEntity; -import net.mingsoft.basic.entity.ColumnEntity; -import org.apache.commons.lang3.StringUtils; - -import cn.hutool.core.util.ArrayUtil; -import net.mingsoft.base.constant.Const; -import net.mingsoft.mdiy.util.ParserUtil; - -/** - * - * @ClassName: ArticleEntity - * @Description:TODO(文章模块实体类 || 继承BasicEntity实体) - * @author: 铭飞开发团队 - * @date: 2018年1月31日 下午2:55:48 - * - * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. - */ -public class ArticleEntity extends BasicEntity{ - - /** - * 文章Id - */ - private int articleID; - - /** - * 文章内容 - */ - private String articleContent; - - /** - * 文章作者 - */ - private String articleAuthor; - - /** - * 文章属性 - */ - private String articleType ; - - /** - * 文章的来源 - */ - private String articleSource; - - /** - * 文章跳转链接地址 - */ - private String articleUrl; - - /** - * 文章关键字 - */ - private String articleKeyword; - - /** - * 文章自定义显示顺序 - */ - @Deprecated - private int articleFreeOrder; - - - /** - * 站点d - */ - private int articleWebId; - - /** - * 文章url地址 主要是用户生成html使用 - */ - private String articleLinkURL; - - /** - * 文章分类url地址,主要是用户生成html使用 - */ - private String articleTypeLinkURL; - - /** - * 一对一管理栏目 - */ - private ColumnEntity column; - - - /** - * 获取文章实体所属的栏目实体 - * @return - */ - public ColumnEntity getColumn() { - return column; - } - - /** - * 设置文章所属的栏目实体 - * @param column - */ - public void setColumn(ColumnEntity column) { - this.column = column; - } - - public String getArticleTypeLinkURL() { - return articleTypeLinkURL; - } - - public void setArticleTypeLinkURL(String articleTypeLinkURL) { - this.articleTypeLinkURL = articleTypeLinkURL; - } - - public String getArticleLinkURL() { - return articleLinkURL; - } - - public void setArticleLinkURL(String articleLinkURL) { - this.articleLinkURL = articleLinkURL; - } - - /** - * 获取文章作者 - * @return 返回文章作者 - */ - public String getArticleAuthor() { - return articleAuthor; - } - - /** - * 获取文章内容 - * @return 返回文章内容 - */ - public String getArticleContent() { - return articleContent; - } - - /** - * 获取自定义显示顺序 - * @return - */ - public int getArticleFreeOrder() { - return articleFreeOrder; - } - - /** - * 获取文章Id - * @return 返回文章Id - */ - public int getArticleID() { - return articleID; - } - - /** - * 获取文章关键字 - * @return 返回文章关键字 - */ - public String getArticleKeyword() { - return articleKeyword; - } - - /** - * 获取文章的来源 - * @return 返回文章的来源 - */ - public String getArticleSource() { - return articleSource; - } - - /** - * 获取文章属性 - * @return 返回文章属性 - */ - public String getArticleType() { - return articleType; - } - - /** - * 获取文章跳转链接 - * @return 返回文章跳转链接 - */ - public String getArticleUrl() { - return articleUrl; - } - - /** - * 获取文章站点id - * @return - */ - public int getArticleWebId() { - return articleWebId; - } - - /** - * 设置文章作者 - * @param articleAuthor 传入文章作者 - */ - public void setArticleAuthor(String articleAuthor) { - this.articleAuthor = articleAuthor; - } - - /** - * 设置文章内容 - * @param articleContent 传入文章内容 - */ - public void setArticleContent(String articleContent) { - this.articleContent = articleContent; - } - - /** - * 设置文章自定义显示循序排序 - * @param articleFreeOrder - */ - public void setArticleFreeOrder(int articleFreeOrder) { - this.articleFreeOrder = articleFreeOrder; - } - - /** - * 设置文章Id - * @param articleID 传入文章Id - */ - public void setArticleID(int articleID) { - this.articleID = articleID; - } - - /** - * 设置文章关键字 - * @param articleKeyword 传入文章关键字列表 - */ - public void setArticleKeyword(String articleKeyword) { - this.articleKeyword = articleKeyword; - } - - /** - * 设置文章的来源 - * @param articleSource 传入文章的来源 - */ - public void setArticleSource(String articleSource) { - this.articleSource = articleSource; - } - - /** - * 设置文章属性 - * @param articleType 传入文章属性 - */ - public void setArticleType(String articleType) { - this.articleType = articleType; - } - - /** - * 设置文章跳转链接 - * @param articleUrl 传入文章跳转链接地址 - */ - public void setArticleUrl(String articleUrl) { - this.articleUrl = articleUrl; - } - - - /** - * 设置文章站点id - * @param articleWebId - */ - public void setArticleWebId(int articleWebId) { - this.articleWebId = articleWebId; - } - - public String getArticleUrl(AppEntity app) { - if (!StringUtils.isBlank(app.getAppMobileStyle())) { - return app.getAppHostUrl()+ParserUtil.HTML+Const.SEPARATOR+ParserUtil.MOBILE+Const.SEPARATOR+this.getArticleUrl(); - } - return app.getAppHostUrl()+Const.SEPARATOR+ParserUtil.HTML+Const.SEPARATOR+this.getArticleUrl(); - } -} \ No newline at end of file