Commit d46aff17 authored by tianbj's avatar tianbj

4.7.2

parent fef0c487
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>wb-mcms</artifactId> <artifactId>mcms</artifactId>
<version>4.7.1</version> <version>4.7.2</version>
<name>ms-mcms</name> <name>ms-mcms</name>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
...@@ -37,12 +37,23 @@ ...@@ -37,12 +37,23 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>ms-mcms</artifactId> <artifactId>ms-basic</artifactId>
<version>4.7.1</version> <version>1.0.16</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mpeople</artifactId>
<version>1.0.11</version>
</dependency>
<!-- 此部分是铭飞平台MStroe的客户端(MStore不在铭飞开源产品范围),如果不需要使用MStore可以删除掉 -->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-upgrader</artifactId>
<version>1.0.13</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>wb-mcms</finalName> <finalName>ms-mcms</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
...@@ -67,15 +78,6 @@ ...@@ -67,15 +78,6 @@
<fork>true</fork> <fork>true</fork>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- 打包时候需需要启用,注意避免快照依赖的冗余jar包 -->
<!-- outputFileNameMapping>@{artifactId}@- @{baseVersion}@. @{extension}@</outputFileNameMapping -->
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
......
This diff is collapsed.
package net.mingsoft.cms.action;
import java.util.MissingResourceException;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:47
*/
public class BaseAction extends net.mingsoft.mdiy.action.BaseAction{
@Override
protected String getResString(String key) {
// TODO Auto-generated method stub
String str = "";
try {
str = super.getResString(key);
} catch (MissingResourceException e) {
str = net.mingsoft.cms.constant.Const.RESOURCES.getString(key);
}
return str;
}
}
This diff is collapsed.
/**
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.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.biz.IColumnBiz;
import net.mingsoft.basic.biz.IModelBiz;
import net.mingsoft.basic.entity.AppEntity;
import net.mingsoft.basic.entity.CategoryEntity;
import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.biz.IArticleBiz;
import net.mingsoft.cms.constant.ModelCode;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.biz.IContentModelBiz;
import net.mingsoft.mdiy.biz.IContentModelFieldBiz;
import cn.hutool.core.io.FileUtil;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.mdiy.util.ParserUtil;
/**
*
* @ClassName: GeneraterAction
* @Description:TODO 生成器
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:52:07
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
@Controller("cmsGenerater")
@RequestMapping("/${ms.manager.path}/cms/generate")
@Scope("request")
public class GeneraterAction extends BaseAction {
/**
* 文章管理业务层
*/
@Autowired
private IArticleBiz articleBiz;
/**
* 栏目管理业务层
*/
@Autowired
private IColumnBiz columnBiz;
/**
* 模块管理业务层
*/
@Autowired
private IModelBiz modelBiz;
@Value("${ms.manager.path}")
private String managerPath;
/**
* 新增字段业务层
*/
@Autowired
protected IContentModelFieldBiz fieldBiz;
/**
* 自定义模型业务层
*/
@Autowired
protected IContentModelBiz contentBiz;
/**
* 更新主页
*
* @return
*/
@RequestMapping("/index")
public String index(HttpServletRequest request, ModelMap model) {
// 该站点ID有session提供
int websiteId = BasicUtil.getAppId();
Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号
// 获取所有的内容管理栏目
List<ColumnEntity> list = columnBiz.queryAll(websiteId, modelId);
model.addAttribute("list", JSONArray.toJSONString(list));
model.addAttribute("now", new Date());
return "/cms/generate/index";
}
/**
* 生成主页
*
* @param request
* @param response
*/
@RequestMapping("/generateIndex")
@RequiresPermissions("cms:generate:index")
@ResponseBody
public void generateIndex(HttpServletRequest request, HttpServletResponse response) {
// 模版文件名称
String tmpFileName = request.getParameter("url");
// 生成后的文件名称
String generateFileName = request.getParameter("position");
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath())) {
this.outJson(response, false, getResString("templet.file"));
} else {
try {
CmsParserUtil.generate(tmpFileName, generateFileName);
this.outJson(response, true);
} catch (IOException e) {
e.printStackTrace();
this.outJson(response, false);
}
}
}
/**
* 生成列表的静态页面
*
* @param request
* @param response
* @param columnId
*/
@RequestMapping("/{columnId}/genernateColumn")
@RequiresPermissions("cms:generate:column")
@ResponseBody
public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable int columnId) {
// 获取站点id
AppEntity app = BasicUtil.getApp();
List<ColumnEntity> columns = new ArrayList<ColumnEntity>();
// 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目
int modelId = BasicUtil.getModelCodeId(ModelCode.CMS_COLUMN); // 查询当前模块编号
if (columnId > 0) {
List<CategoryEntity> categorys = columnBiz.queryChildrenCategory(columnId, app.getAppId(), modelId);
for (CategoryEntity c : categorys) {
columns.add((ColumnEntity) columnBiz.getEntity(c.getCategoryId()));
}
} else {
// 获取所有的内容管理栏目
columns = columnBiz.queryAll(app.getAppId(), modelId);
}
List<ColumnArticleIdBean> articleIdList = null;
try {
// 1、设置模板文件夹路径
// 获取栏目列表模版
for (ColumnEntity column : columns) {
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getColumnUrl()))) {
continue;
}
articleIdList = articleBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null);
// 判断列表类型
switch (column.getColumnType()) {
case ColumnEntity.COLUMN_TYPE_LIST: // 列表
CmsParserUtil.generateList(column, articleIdList.size());
break;
case ColumnEntity.COLUMN_TYPE_COVER:// 单页
if(articleIdList.size()==0){
ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean();
CopyOptions copyOptions=CopyOptions.create();
copyOptions.setIgnoreError(true);
BeanUtil.copyProperties(column,columnArticleIdBean,copyOptions);
articleIdList.add(columnArticleIdBean);
}
CmsParserUtil.generateBasic(articleIdList);
break;
default:
throw new IllegalStateException("Unexpected value: " + column.getColumnType());
}
}
} catch (IOException e) {
e.printStackTrace();
this.outJson(response, false);
}
this.outJson(response, true);
}
/**
* 根据栏目id更新所有的文章
*
* @param request
* @param response
* @param columnId
*/
@RequestMapping("/{columnId}/generateArticle")
@RequiresPermissions("cms:generate:article")
@ResponseBody
public void generateArticle(HttpServletRequest request, HttpServletResponse response, @PathVariable int columnId) {
String dateTime = request.getParameter("dateTime");
// 网站风格物理路径
List<ColumnArticleIdBean> articleIdList = null;
try {
// 查出所有文章(根据选择栏目)包括子栏目
articleIdList = articleBiz.queryIdsByCategoryIdForParser(columnId, dateTime, null);
// 有符合条件的新闻就更新
if (articleIdList.size() > 0) {
CmsParserUtil.generateBasic(articleIdList);
}
this.outJson(response, true);
} catch (IOException e) {
e.printStackTrace();
this.outJson(response, false);
}
}
/**
* 用户预览主页
*
* @param request
* @return
*/
@RequestMapping("/{position}/viewIndex")
public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) {
AppEntity app = BasicUtil.getApp();
// 组织主页预览地址
String indexPosition = app.getAppHostUrl() + File.separator + ParserUtil.HTML + File.separator + app.getAppId()
+ File.separator + position + ParserUtil.HTML_SUFFIX;
return "redirect:" + indexPosition;
}
}
\ No newline at end of file
/**
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.web;
import java.util.ArrayList;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.filter.DateValueFilter;
import net.mingsoft.basic.action.BaseAction;
import net.mingsoft.basic.bean.ListBean;
import net.mingsoft.basic.biz.IColumnBiz;
import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.biz.IArticleBiz;
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 springfox.documentation.annotations.ApiIgnore;
/**
*
* @ClassName: ArticleAction
* @Description:TODO 前段文章控制,如果标签不能满足可以使用这个控制来满足用户的查询文章需求,主要是通过ajax返回json数据格式
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:52:44
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
@Controller("jsonApiArticle")
@RequestMapping("/mcms/article")
public class ArticleAction extends BaseAction {
/**
* 文章管理业务处理层
*/
@Autowired
private IArticleBiz articleBiz;
/**
* 栏目管理业务处理层
*/
@Autowired
private IColumnBiz columnBiz;
/**
* 内容模型管理业务处理层
*/
@Autowired
private IContentModelBiz contentModelBiz;
/**
* 自定义字段管理业务处理层
*/
@Autowired
private IContentModelFieldBiz fieldBiz;
/**
* 文章信息
*
* @param basicId
* 文章编号
* <dt><span class="strong">返回</span></dt><br/>
* {"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<String> listFieldName = new ArrayList<String>();
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
* 分类编号
* <dt><span class="strong">返回</span></dt><br/>
* {"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<ArticleEntity> 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<String> listFieldName = new ArrayList<String>();
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
/**
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.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.JSONObject;
import net.mingsoft.basic.biz.IColumnBiz;
import net.mingsoft.mdiy.biz.IContentModelBiz;
import net.mingsoft.mdiy.biz.IContentModelFieldBiz;
import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.mdiy.entity.ContentModelEntity;
import net.mingsoft.mdiy.entity.ContentModelFieldEntity;
import net.mingsoft.base.action.BaseAction;
import net.mingsoft.basic.util.BasicUtil;
/**
*
*
*
* <p>
* <b>铭飞科技</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* @author 史爱华
*
* <p>
* Comments: 供前端页面获取自定义模型中字段实体信息
* </p>
*
* <p>
* Create Date:2015-07-11
* </p>
*
* <p>
* Modification history:
* </p>
*/
@Controller("webField")
@RequestMapping("/field")
public class FieldAction extends BaseAction{
/**
* 栏目业务层
*/
@Autowired
private IColumnBiz columnBiz;
/**
* 内容模型业务层
*/
@Autowired
private IContentModelBiz contentModelBiz;
/**
* 字段管理业务层
*/
@Autowired
private IContentModelFieldBiz fieldBiz;
/**
*
* 根据当前栏目id和字段名称获取自定义模型中的字段实体信息
* @param request
* @param response
*/
@RequestMapping("/{columId}/getEntity")
@ResponseBody
public void getEntity(@PathVariable int columId,HttpServletRequest request, HttpServletResponse response) {
System.out.println("111");
BasicUtil.setSession("xxx", "888");
System.err.println("session:"+BasicUtil.getSession("xxx"));
//获取字段名称
String fieldFieldName = request.getParameter("fieldFieldName");
//根据栏目id获取栏目实体
ColumnEntity column = (ColumnEntity) this.columnBiz.getEntity(columId);
if(column==null){
this.outJson(response, this.getResString("err"));
return;
}else{
//判断该栏目下是存在内容模型
if(column.getColumnContentModelId()>0){
//获取当前栏目对应的内容模型
ContentModelEntity contentModel = (ContentModelEntity) this.contentModelBiz.getEntity(column.getColumnContentModelId());
if(contentModel==null){
this.outJson(response, this.getResString("err"));
return;
}
//获取字段实体
ContentModelFieldEntity field = fieldBiz.getEntityByCmId(column.getColumnContentModelId(), fieldFieldName);
//返回字段实体
this.outJson(response, JSONObject.toJSONString(field));
}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/**
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.bean;
import net.mingsoft.basic.entity.ColumnEntity;
/**
* 文章解析生成
* @author 铭飞开源团队
* @date 2018年12月13日
*/
public class ColumnArticleIdBean extends ColumnEntity{
/**
* 文章编号
*/
private int articleId;
public int getArticleId() {
return articleId;
}
public void setArticleId(int articleId) {
this.articleId = articleId;
}
}
\ No newline at end of file
/**
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;
import java.util.List;
import java.util.Map;
import net.mingsoft.basic.biz.IBasicBiz;
import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.entity.ArticleEntity;
import net.mingsoft.mdiy.entity.ContentModelEntity;
/**
*
* @ClassName: IArticleBiz
* @Description:TODO(文章管理业务处理层 || 继承IBasicBiz业务处理层)
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:53:32
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
public interface IArticleBiz extends IBasicBiz {
/**
* @para webId 网站编号
* @param basicCategoryId
* 栏目编号
* @param flag
* 文章属性
* @param noFlag
* 文章不存在的属性
* @param article
* 文件实体
* @return
*/
@Deprecated
int count(int webId, int[] basicCategoryId, String flag, String noFlag, ArticleEntity article);
/**
* 通过分类id获取文章内容
*
* @param categoryId
* 分类编号
* @return
*/
@Deprecated
public ArticleEntity getByCategoryId(int categoryId);
/**
* 通过视图表来查询文章总数
*
* @param basicId
* 文章编号
*/
public ArticleEntity getById(int basicId);
/**
* 查找basicId下一篇文章
*
* @param appId
* 应用编号
* @param basicId
* 文章编号
* @return
*/
@Deprecated
public ArticleEntity getNext(int appId, int basicId, Integer categoryId);
/**
* 查找basicId上一篇文章
*
* @param appId
* 应用编号
* @param basicId
* 文章编号
* @return
*/
@Deprecated
public ArticleEntity getPrevious(int appId, int basicId, Integer categoryId);
/**
* 高级查询接口,主要提供给有自定义模型的栏目,返回總數
*
* @param contentModel
* 自定义模型
* @param whereMap
* 條件
* @param appId
* appId 應用編號
* @param ids
* 子类id
* @return 记录数量
* @see IArticleBiz.count
*/
public int getSearchCount(ContentModelEntity contentModel, Map whereMap, int appId, String ids);
/**
* 文章查询
*
* @para webId 网站编号
* @param basicCategoryIds
* 栏目编号集合
* @param flag
* 文章属性
* @param noFlag
* 文章不存在的属性
* @param orderBy
* 排序字段
* @param order
* true 升序 false 降序 排序方式
* @param beginTime 开始时间
* @param endTime 结束时间
* @param article
* 文章实体,便于扩展查询
* @return 文章集合
*/
List<ArticleEntity> 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<ColumnArticleIdBean> queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime);
/**
* 查询文章编号集合
* @param categoryId 栏目编号
* @param beginTime 开始时间
* @param endTime 结束时间
* @param orderBy 排序字段
* @param order 排序方式
* @return
*/
public List<ColumnArticleIdBean> queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime,String orderBy,String order);
/**
* 根据页面栏目的id获取与其绑定的文章实体
*
* @param basicCategoryId
* @return 文章实体
*/
@Deprecated
public List<ArticleEntity> queryListByColumnId(int basicCategoryId);
/**
* 高级查询接口,主要提供给有自定义模型的栏目,
*
* @param conntentModel
* 自定义模型
* @param whereMap
* 條件
* @param page
* 分頁
* @param appId
* 應用編號
* @param ids
* 子类id
* @return 记录集合
*/
@Deprecated
public List<ArticleEntity> queryListForSearch(ContentModelEntity conntentModel, Map whereMap,
int appId, List ids, Map orders);
}
\ No newline at end of file
/**
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<ArticleEntity> 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<ArticleEntity> queryListByColumnId(int basicCategoryId) {
// TODO Auto-generated method stub
return articleDao.queryListByColumnId(basicCategoryId);
}
@Deprecated
public List<ArticleEntity> queryListForSearch(ContentModelEntity conntentModel, Map whereMap, int websiteId,List ids,Map orders) {
List<ArticleEntity> articleList = new ArrayList<ArticleEntity>();
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<ColumnArticleIdBean> queryIdsByCategoryIdForParser(int categoryId, String beginTime,String endTime) {
return this.articleDao.queryIdsByCategoryIdForParser(categoryId,BasicUtil.getAppId(), beginTime, endTime,null,null);
}
@Override
public List<ColumnArticleIdBean> 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
package net.mingsoft.cms.constant;
import java.util.ResourceBundle;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:51
*/
public class Const {
/**
* 资源文件
*/
public final static ResourceBundle RESOURCES = ResourceBundle.getBundle("net.mingsoft.cms.resources.resources");
}
/**
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.constant;
import net.mingsoft.base.constant.e.BaseEnum;
public enum ModelCode implements BaseEnum{
/**
* 内容:栏目模块编号
*/
CMS_COLUMN("02990000"),
/**
* 内容:文章模块编号
*/
CMS_ARTICLE("02980100"),
/**
* 内容:文章列表
*/
CMS_ARTICLE_BASIC("02980000"),
/**
* 内容:自定义搜索
*/
CMS_SEARCH("02050000"),
/**
* 内容:自定义模型
*/
CMS_CONTENT_MODEL("02060000"),
/**
* 内容:一键更新
*/
CMS_GENERATE_ALL("02070100"),
/**
* 内容:更新主页
*/
CMS_GENERATE_INDEX("02070200"),
/**
* 内容:更新文档
*/
CMS_GENERATE_ARTICLE("02070300"),
/**
* 内容: 更新栏目
*/
CMS_GENERATE_COLUMN("02070400"),
/**
* 内容:模版
*/
CMS_TEMPLETSKIN("02080000"),
/**
* 内容:织梦数据导入
*/
COM_DEDE_DATA_IMPORT("02090100"),
/**
* 内容:栏目属性管理模块
*/
CMS_COLUMN_TYPE("02090200");
/**
* 设置modelCode的常量
* @param code 常量
*/
ModelCode(String code) {
this.code = code;
}
private String code;
/**
* 返回该modelCode常量的字符串表示
* @return 字符串
*/
@Override
public String toString() {
// TODO Auto-generated method stub
return code;
}
/**
* 返回该modelCode常量的整型表示
* @return 整型
*/
public int toInt() {
// TODO Auto-generated method stub
return Integer.parseInt(code);
}
}
\ No newline at end of file
/**
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.constant.e;
import net.mingsoft.base.constant.e.BaseEnum;
/**
*
* @ClassName: ColumnTypeEnum
* @Description:TODO(文章栏目分类类型)
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:55:18
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
public enum ColumnTypeEnum implements BaseEnum {
/**
* 列表
*/
COLUMN_TYPE_LIST(1),
/**
* 单页
*/
COLUMN_TYPE_COVER(2),
/**
* 跳转地址
*/
COLUMN_TYPE_URL(3);
ColumnTypeEnum(Object code) {
this.code = code;
}
private Object code;
@Override
public int toInt() {
// TODO Auto-generated method stub
return Integer.valueOf(code+"");
}
}
\ No newline at end of file
/**
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<String, List> 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<ArticleEntity> 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<ArticleEntity> queryListByColumnId(@Param("basicCategoryId") int basicCategoryId);
/**
* 根据查询文章实体
*
* @param tableName
* :自定义生成的表名
* @param map
* 获取查询条件的Map key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段
* list[1]:是否为整形 list[2]:是否是等值查询 list[3]:字段的值
* @return 文章实体
*/
@Deprecated
List<ArticleEntity> queryListForSearch(@Param("tableName") String tableName, @Param("map") Map<String, List> map,
@Param("websiteId") int websiteId, @Param("ids") List ids,
@Param("sortMap") Map sortMap);
/**
* 查询文章编号集合
* @param categoryId 栏目编号
* @param appId 站点编号
* @param beginTime 开始时间
* @param endTime 结束时间
* @return
*/
public List<ColumnArticleIdBean> 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
This diff is collapsed.
/**
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
#mcms\u7248\u672C
version=d3a98fefcb242db78da5fc31608ff247
templet.file=\u6A21\u677F\u6587\u4EF6\u4E0D\u5B58\u5728
id=\u6587\u7AE0\u7F16\u53F7
typeid=\u680F\u76EE\u7F16\u53F7
order=\u6392\u5E8F
This diff is collapsed.
package net.mingsoft.config; package net.mingsoft.config;
import java.io.File; import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.aop.Advisor; import org.springframework.aop.Advisor;
import net.mingsoft.basic.filter.XSSEscapeFilter; import net.mingsoft.basic.filter.XSSEscapeFilter;
import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.JdkRegexpMethodPointcut; import org.springframework.aop.support.JdkRegexpMethodPointcut;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean;
...@@ -31,6 +34,16 @@ import net.mingsoft.basic.util.BasicUtil; ...@@ -31,6 +34,16 @@ import net.mingsoft.basic.util.BasicUtil;
@Configuration @Configuration
public class WebConfig implements WebMvcConfigurer { public class WebConfig implements WebMvcConfigurer {
/**
* 上传路径
*/
@Value("${ms.upload.path}")
private String uploadFloderPath;
/**
* 上传路径映射
*/
@Value("${ms.upload.mapping}")
private String uploadMapping;
@Bean @Bean
public ActionInterceptor actionInterceptor() { public ActionInterceptor actionInterceptor() {
return new ActionInterceptor(); return new ActionInterceptor();
...@@ -54,19 +67,20 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -54,19 +67,20 @@ public class WebConfig implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
//jar包方式映射处理 registry.addResourceHandler("/upload/**").addResourceLocations("/upload/","file:upload/");
String classPath = BasicUtil.getClassPath(""); registry.addResourceHandler("/templets/**").addResourceLocations("/templets/","file:templets/");
if (classPath.startsWith("file")) { registry.addResourceHandler("/html/**").addResourceLocations("/html/","file:html/");
registry.addResourceHandler("/upload/**").addResourceLocations("file:" + BasicUtil.getRealPath("upload") + File.separator); //三种映射方式 webapp下、当前目录下、jar内
registry.addResourceHandler("/html/**").addResourceLocations("file:" + BasicUtil.getRealPath("html") + File.separator); registry.addResourceHandler("/app/**").addResourceLocations("/app/","file:app/", "classpath:/app/");
registry.addResourceHandler("/templets/**").addResourceLocations("file:" + BasicUtil.getRealPath("templets") + File.separator); registry.addResourceHandler("/static/**","/**").addResourceLocations("/static/","file:static/","classpath:/static/","classpath:/META-INF/resources/");
} else { registry.addResourceHandler("/api/**").addResourceLocations("/api/","file:api/", "classpath:/api/");
//必须做判断,不然jar运行的html路径会被覆盖掉 if(new File(uploadFloderPath).isAbsolute()){
registry.addResourceHandler("/html/**").addResourceLocations("/html/"); //如果指定了绝对路径,上传的文件都映射到uploadMapping下
registry.addResourceHandler(uploadMapping).addResourceLocations("file:"+uploadFloderPath+ File.separator
//映射其他路径文件
//,file:F://images
);
} }
registry.addResourceHandler("/app/**").addResourceLocations("/app/", "classpath:/app/");
registry.addResourceHandler("/static/**").addResourceLocations("/static/", "classpath:/static/");
registry.addResourceHandler("/api/**").addResourceLocations("/api/", "classpath:/api/");
} }
/** /**
* druidServlet注册 * druidServlet注册
...@@ -132,16 +146,17 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -132,16 +146,17 @@ public class WebConfig implements WebMvcConfigurer {
return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor()); return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor());
} }
/** @Bean
* xssFilter注册 public FilterRegistrationBean xssFilterRegistration() {
*/ XSSEscapeFilter xssFilter = new XSSEscapeFilter();
// @Bean FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter);
// public FilterRegistrationBean xssFilterRegistration() { xssFilter.excludes.add(".*file/upload.do");
// XSSEscapeFilter xssFilter = new XSSEscapeFilter(); xssFilter.excludes.add(".*/jsp/editor.do");
// FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter); xssFilter.excludes.add(".*/?(jpg|js|css|gif|png|ico)$");
// registration.addUrlPatterns("/*"); xssFilter.excludes.add("/");
// return registration; registration.addUrlPatterns("/*");
// } return registration;
}
/** /**
* RequestContextListener注册 * RequestContextListener注册
......
...@@ -12,14 +12,23 @@ ms: ...@@ -12,14 +12,23 @@ ms:
view-path: /WEB-INF/manager view-path: /WEB-INF/manager
upload: upload:
path: /upload path: upload
mapping: /upload/**
denied: .exe,.jsp denied: .exe,.jsp
allowed: jpg multipart:
max-size: 1 #最大上传文件大小 单位:KB
memory-size: 4096 max-file-size: 10240
#文件暂存临时目录
upload-temp-dir: temp
#临时文件大小
max-in-memory-size: 10240
#总上传最大大小 单位:KB -1禁用
max-request-size: -1
spring: spring:
http.multipart.enabled: false
profiles: profiles:
active: dev active: dev
mvc: mvc:
...@@ -53,6 +62,7 @@ spring: ...@@ -53,6 +62,7 @@ spring:
time_format: HH:mm:ss time_format: HH:mm:ss
datetime_format: yyyy-MM-dd HH:mm:ss datetime_format: yyyy-MM-dd HH:mm:ss
auto_import: /include/macro.ftl as ms auto_import: /include/macro.ftl as ms
number_format: 0.##
mybatis: mybatis:
mapper-locations: classpath*:**/dao/*.xml mapper-locations: classpath*:**/dao/*.xml
......
This diff is collapsed.
<@ms.html5>
<@ms.nav title="文章列表"></@ms.nav>
<@ms.searchForm name="searchForm" action="">
<#if articleTypeList?has_content>
<@ms.select label="文章属性" default="全部" value="a" name="articleType" id="forumSelect" list=articleTypeList listValue="dictLabel" listKey="dictValue" value="${articleType?default('')}"/>
<#else>
<@ms.select label="文章属性" name="articleType" id="forumSelect" value="" list=["默认属性"] />
</#if>
<@ms.text label="文章标题" name="basicTitle" value="" title="请输入文章标题" placeholder="请输入文章标题" />
<@ms.searchFormButton>
<@ms.queryButton id="submitSearch" />
</@ms.searchFormButton>
</@ms.searchForm>
<div id="toolbar">
<@ms.panelNavBtnGroup>
<@shiro.hasPermission name="article:save"><@ms.panelNavBtnAdd title=""/></@shiro.hasPermission>
<@shiro.hasPermission name="article:del"><@ms.panelNavBtnDel title=""/></@shiro.hasPermission>
</@ms.panelNavBtnGroup>
</div>
<@ms.panel>
<table id="articleListTable"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-detail-formatter="detailFormatter"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
</@ms.html5>
<!--删除限时文章-->
<@ms.modal modalName="delete" title="删除文章">
<@ms.modalBody>
确定要删除所选的文章吗?
</@ms.modalBody>
<@ms.modalButton>
<@ms.button class="btn btn-danger rightDelete" value="确定"/>
</@ms.modalButton>
</@ms.modal>
<script>
$(function(){
var search = $("form[name='searchForm']").serializeJSON();
var articleType = search.articleType;
$("#articleListTable").bootstrapTable({
url:"${managerPath}/cms/article/${categoryId}/list.do?articleTypeStr="+articleType,
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
toolbar: "#toolbar",
columns: [{ checkbox: true}, {
field: 'column.categoryTitle',
title: '栏目名',
width: 90,
align: 'left'
},{
field: 'basicTitle',
title: '文章标题',
formatter: function (value, row, index){
<@shiro.hasPermission name="article:update">
var url='${managerPath}/cms/article/'+row.articleID+"/edit.do";
return "<a href="+url+" target='_self' >"+value+"</a>";
</@shiro.hasPermission>
<@shiro.lacksPermission name="article:update">
return value;
</@shiro.lacksPermission>
}
}, {
field: 'articleAuthor',
title: '作者',
width: 100
}, {
field: 'basicSort',
title: '排序',
align: 'center',
width: 50
}, {
field: 'basicHit',
title: '点击',
align: 'center',
width: 50
}, {
field: 'basicDateTime',
title: '发布时间',
align: 'center',
width: 150
}]
});
//查询文章标题
$("#submitSearch").click(function(){
var search = $("form[name='searchForm']").serializeJSON();
var params = $('#articleListTable').bootstrapTable('getOptions');
params.queryParams = function(params) {
$.extend(params,search);
return params;
}
$("#articleListTable").bootstrapTable('refresh', {query:$("form[name='searchForm']").serializeJSON()});
});
//添加文章
$("#addButton").click(function(){
if(${isParent}==true){
<@ms.notify msg="不能选择父级栏目" />
return false;
}
location.href = "${managerPath}/cms/article/add.do?categoryId=${categoryId?default(0)}&modelId=${Session.model_id_session?default(0)}&categoryTitle=${categoryTitle?default('')}";
});
//点击重置按钮
$(".reset").click(function(){
$("input[name=basicTitle]").val("");
})
//多选删除
$("#delButton").click(function(){
//获取勾选的所在行的所有数据
var rows = $("#articleListTable").bootstrapTable("getSelections");
if(rows!=""){
//弹出modal窗体
$(".delete").modal();
}else{
<@ms.notify msg="请选择文章!" type="warning"/>
}
});
//删除多个文章
$(".rightDelete").click(function(){
var rows = $("#articleListTable").bootstrapTable("getSelections");
if(rows!=""){
$.ajax({
url:"${managerPath}/cms/article/delete.do",
type:'post',
dataType:'json',
data:JSON.stringify(rows),
contentType:'application/json',
success:function(msg) {
if (msg.result) {
<@ms.notify msg="删除成功!" type="success"/>
location.reload();
} else {
<@ms.notify msg="删除失败" type="fail"/>
}
}
});
}else{
<@ms.notify msg="请选择文章!" type="warning"/>
}
});
});
</script>
<!DOCTYPE html>
<html lang="zh">
<head>
<#include "/include/macro.ftl"/>
<#include "/include/meta.ftl"/>
</head>
<body class="over-hide">
<@ms.content>
<@ms.contentMenu>
<!-- 树形模块菜单开始 -->
<#if listColumn?has_content>
<@ms.tree treeId="inputTree" json="${listColumn?default('')}" addNodesName="全部" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" showIcon="true" expandAll="true" getZtreeId="getZtreeId(event,treeId,treeNode);" />
<#else>
<@ms.nodata content="暂无栏目"/>
</#if>
<!-- 树形模块菜单结束 -->
</@ms.contentMenu>
<@ms.contentBody width="85%" style="overflow-y: hidden;">
<@ms.contentPanel style="margin:0;padding:0;overflow-y: hidden;">
<iframe src="${managerPath}/cms/article/0/main.do" style="width:100%;maring:0;padding:0;border:none;height:100%;background-image: url(${skin_manager_loadding}); background-repeat: no-repeat; background-position: center;" id="listFrame" target="listFrame" ></iframe>
</@ms.contentPanel>
</@ms.contentBody>
</@ms.content>
<script>
//树形结点
function getZtreeId(event,treeId,treeNode){
if (treeNode.columnType==1) {
//父级栏目为true,子级栏目为false
var isParent = false;
if(treeNode.isParent == true){
isParent = true;
}
$("#listFrame").attr("src","${managerPath}/cms/article/"+treeNode.categoryId+"/main.do?isParent="+isParent+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle));
} else if(treeNode.columnType==2){
//判断该单篇栏目是否存在文章
$.ajax({
type: "POST",
url: "${managerPath}/cms/article/"+treeNode.categoryId+"/queryColumnArticle.do",
dataType:"json",
success: function(msg){
if (msg.result) {
$("#listFrame").attr("src","${managerPath}/cms/article/add.do?categoryId="+treeNode.categoryId+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle));
} else {
//如果该单篇栏目下存在文章则跳转到文章编辑页
$("#listFrame").attr("src","${managerPath}/cms/article/"+treeNode.categoryId+"/edit.do?categoryId="+treeNode.categoryId+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle));
}
},
});
} else if(treeNode.columnType=="" || treeNode.columnType == undefined){
$("#listFrame").attr("src","${managerPath}/cms/article/0/main.do");
}
}
</script>
</body>
</html>
\ No newline at end of file
<@shiro.hasPermission name="cms:column:save"><@ms.addButton id="addColumnBtn"/></@shiro.hasPermission>
<@shiro.hasPermission name="cms:column:del"><@ms.delButton id="delColumnBtn"/></@shiro.hasPermission>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment