From f78bbc93bd974c81a405ee8cd25f1522c72f74fb Mon Sep 17 00:00:00 2001 From: mingsoft Date: Sat, 7 May 2022 10:49:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=84=E8=8C=83=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E3=80=81=E8=A7=84=E8=8C=83=E6=8E=A5=E5=8F=A3=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dissues=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/action/web/EditorAction.java | 83 -- .../mingsoft/cms/action/CategoryAction.java | 134 +- .../mingsoft/cms/action/ContentAction.java | 86 +- .../cms/action/web/CategoryAction.java | 27 +- .../cms/action/web/ContentAction.java | 34 +- .../mingsoft/cms/action/web/MCmsAction.java | 8 +- .../net/mingsoft/cms/dao/ICategoryDao.xml | 2 +- .../java/net/mingsoft/cms/dao/IContentDao.xml | 29 +- .../java/net/mingsoft/config/WebConfig.java | 54 +- .../WEB-INF/manager/cms/content/form.ftl | 2 +- src/main/webapp/WEB-INF/manager/index.ftl | 896 ++----------- src/main/webapp/template/1/default/about.htm | 2 +- src/main/webapp/template/1/default/index.htm | 60 +- .../webapp/template/1/default/message.htm | 443 ------ src/main/webapp/template/1/default/nav.htm | 44 - .../webapp/template/1/default/news-detail.htm | 1189 +++++++++-------- .../webapp/template/1/default/news-list.htm | 2 +- .../template/1/default/product-detail.htm | 2 +- .../template/1/default/product-list.htm | 2 +- src/main/webapp/template/1/default/search.htm | 2 +- 20 files changed, 940 insertions(+), 2161 deletions(-) delete mode 100755 src/main/java/net/mingsoft/basic/action/web/EditorAction.java delete mode 100755 src/main/webapp/template/1/default/message.htm delete mode 100755 src/main/webapp/template/1/default/nav.htm diff --git a/src/main/java/net/mingsoft/basic/action/web/EditorAction.java b/src/main/java/net/mingsoft/basic/action/web/EditorAction.java deleted file mode 100755 index a1097785..00000000 --- a/src/main/java/net/mingsoft/basic/action/web/EditorAction.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012-2022 铭软科技(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.basic.action.web; - -import cn.hutool.core.io.FileUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.mingsoft.ueditor.MsUeditorActionEnter; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.config.MSProperties; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -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.Map; - -/** - * 临时修复:百度编辑器上传,会在下一版本合并 - * - * @author 铭软开发团队 - * @date 2019年7月16日 - * 历史修订 2022-1-21 新增normalize(), - * editor()方法过滤非法上传路径 - */ -@ApiIgnore -@Controller("ueAction") -@RequestMapping("/static/plugins/ueditor/{version}/jsp") -public class EditorAction { - - @ResponseBody - @RequestMapping(value = "editor", method = {RequestMethod.GET, RequestMethod.POST}) - public String editor(HttpServletRequest request, HttpServletResponse response, String jsonConfig) { - String uploadFloderPath = MSProperties.upload.path; - String rootPath = BasicUtil.getRealPath(uploadFloderPath); - jsonConfig = jsonConfig.replace("{ms.upload}", "/" + uploadFloderPath); - //过滤非法上传路径 - Map map = (Map) JSONObject.parse(jsonConfig); - String imagePathFormat = (String) map.get("imagePathFormat"); - imagePathFormat = FileUtil.normalize(imagePathFormat); - - String filePathFormat = (String) map.get("filePathFormat"); - filePathFormat = FileUtil.normalize(filePathFormat); - - String videoPathFormat = (String) map.get("videoPathFormat"); - videoPathFormat = FileUtil.normalize(videoPathFormat); - - map.put("imagePathFormat", imagePathFormat); - map.put("filePathFormat", filePathFormat); - map.put("videoPathFormat", videoPathFormat); - - jsonConfig = JSONObject.toJSONString(map); - MsUeditorActionEnter actionEnter = new MsUeditorActionEnter(request, rootPath, jsonConfig, BasicUtil.getRealPath("")); - String json = actionEnter.exec(); - Map jsonMap = JSON.parseObject(json,Map.class); - jsonMap.put("url","/".concat(uploadFloderPath).concat(jsonMap.get("url")+"")); - return JSONObject.toJSONString(jsonMap); - } - -} diff --git a/src/main/java/net/mingsoft/cms/action/CategoryAction.java b/src/main/java/net/mingsoft/cms/action/CategoryAction.java index 90e0b9f9..1c69404c 100755 --- a/src/main/java/net/mingsoft/cms/action/CategoryAction.java +++ b/src/main/java/net/mingsoft/cms/action/CategoryAction.java @@ -42,12 +42,9 @@ 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.validation.BindingResult; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -70,44 +67,26 @@ public class CategoryAction extends BaseAction { /** * 返回主界面index + * @return */ @GetMapping("/index") - public String index(HttpServletResponse response,HttpServletRequest request){ + public String index(){ return "/cms/category/index"; } /** - * 查询分类列表 - * @param category 分类实体 + * 查询分类列表接口 + * @param category 栏目实体 + * @return */ @ApiOperation(value = "查询分类列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"), - @ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"), - @ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"), - @ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"), @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", 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(value="/list",method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody - public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) { + public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category) { BasicUtil.startPage(); List categoryList = categoryBiz.query(category); return ResultData.build().success(new EUListBean(categoryList,(int) BasicUtil.endPage(categoryList).getTotal())); @@ -115,9 +94,11 @@ public class CategoryAction extends BaseAction { /** * 返回编辑界面category_form + * @param category 栏目 + * @return */ @GetMapping("/form") - public String form(@ModelAttribute CategoryEntity category, HttpServletResponse response, HttpServletRequest request, ModelMap model){ + public String form(@ModelAttribute CategoryEntity category, ModelMap model){ model.addAttribute("appId", BasicUtil.getApp().getAppId()); return "/cms/category/form"; } @@ -130,7 +111,7 @@ public class CategoryAction extends BaseAction { @ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") @GetMapping("/get") @ResponseBody - public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model){ + public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category){ if(category.getId()==null) { return ResultData.build().error(); } @@ -138,41 +119,36 @@ public class CategoryAction extends BaseAction { return ResultData.build().success(_category); } - @ApiOperation(value = "保存分类列表接口") - @ApiImplicitParams({ - @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"), - @ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"), - @ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"), - @ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"), - @ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"), - @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", 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 category 分类实体 */ + @ApiOperation(value = "保存分类列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"), + @ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"), + @ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"), + @ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"), + @ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"), + @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"), + }) @PostMapping("/save") @ResponseBody @LogAnn(title = "保存分类", businessType = BusinessTypeEnum.INSERT) @RequiresPermissions("cms:category:save") - public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request) { + public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) { //验证栏目管理名称的值是否合法 if(StringUtil.isBlank(category.getCategoryTitle())){ return ResultData.build().error(getResString("err.empty", this.getResString("category.title"))); @@ -202,19 +178,26 @@ public class CategoryAction extends BaseAction { } /** - * @param categorys 分类实体 + * 批量删除分类列表接口 + * @param categorys + * @return */ @ApiOperation(value = "批量删除分类列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "categorys", value = "删除的栏目集合", allowMultiple = true, dataType = "CategoryEntity", required = true) + + }) @PostMapping("/delete") @ResponseBody @LogAnn(title = "删除分类", businessType = BusinessTypeEnum.DELETE) @RequiresPermissions("cms:category:del") - public ResultData delete(@RequestBody List categorys, HttpServletResponse response, HttpServletRequest request) { + public ResultData delete(@RequestBody List categorys) { for(int i = 0;ilambdaQuery() .ne(StrUtil.isNotBlank(category.getId()), CategoryEntity::getId, category.getId()) .eq(CategoryEntity::getCategoryPinyin, category.getCategoryPinyin())); @@ -321,7 +306,16 @@ public class CategoryAction extends BaseAction { return ResultData.build().success(); } + /** + * 批量更新模版 + * @param category 栏目实体 + * @return + */ @ApiOperation(value = "批量更新模版") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"), + @ApiImplicitParam(name = "dictId", value = "字典", required =true,paramType="query") + }) @GetMapping("/updateTemplate") @ResponseBody @RequiresPermissions("cms:category:update") @@ -343,7 +337,15 @@ public class CategoryAction extends BaseAction { return ResultData.build().success(); } + /** + * 复制栏目 + * @param category 栏目实体 + * @return + */ @ApiOperation(value = "复制栏目") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") + }) @GetMapping("/copyCategory") @ResponseBody @RequiresPermissions("cms:category:save") diff --git a/src/main/java/net/mingsoft/cms/action/ContentAction.java b/src/main/java/net/mingsoft/cms/action/ContentAction.java index f821c96f..b456ca6f 100755 --- a/src/main/java/net/mingsoft/cms/action/ContentAction.java +++ b/src/main/java/net/mingsoft/cms/action/ContentAction.java @@ -85,14 +85,15 @@ public class ContentAction extends BaseAction { * 返回主界面index */ @GetMapping("/index") - public String index(HttpServletResponse response,HttpServletRequest request){ + public String index(){ return "/cms/content/index"; } + /** * 返回主界面main */ @GetMapping("/main") - public String main(HttpServletResponse response,HttpServletRequest request){ + public String main(){ return "/cms/content/main"; } @@ -109,23 +110,10 @@ public class ContentAction extends BaseAction { @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"), }) @PostMapping("/list") @ResponseBody - public ResultData list(@ModelAttribute @ApiIgnore ContentBean content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) { + public ResultData list(@ModelAttribute @ApiIgnore ContentBean content) { BasicUtil.startPage(); List contentList = contentBiz.query(content); return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal())); @@ -135,7 +123,7 @@ public class ContentAction extends BaseAction { * 返回编辑界面content_form */ @GetMapping("/form") - public String form(@ModelAttribute ContentEntity content, HttpServletResponse response, HttpServletRequest request, ModelMap model){ + public String form(@ModelAttribute ContentEntity content, ModelMap model){ model.addAttribute("appId", BasicUtil.getApp().getAppId()); return "/cms/content/form"; } @@ -144,17 +132,18 @@ public class ContentAction extends BaseAction { * 获取文章 * @param content 文章实体 */ - @ApiOperation(value = "获取文章列表接口") + @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){ + public ResultData get(@ModelAttribute @ApiIgnore ContentEntity content){ if(content.getId()==null) { return ResultData.build().error(); } ContentEntity _content = contentBiz.getById(content.getId()); return ResultData.build().success(_content); } + /** * 获取文章 * @param content 文章实体 @@ -174,39 +163,33 @@ public class ContentAction extends BaseAction { return ResultData.build().success(list.size() > 0 ? list.get(0) : null); } - @ApiOperation(value = "保存文章列表接口") - @ApiImplicitParams({ - @ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"), - @ApiImplicitParam(name = "categoryId", 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 文章实体 */ + @ApiOperation(value = "保存文章列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"), + @ApiImplicitParam(name = "categoryId", 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"), + }) @PostMapping("/save") @ResponseBody @LogAnn(title = "保存文章", businessType = BusinessTypeEnum.INSERT) @RequiresPermissions("cms:content:save") - public ResultData save(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request) { + public ResultData save(@ModelAttribute @ApiIgnore ContentEntity content) { //验证文章标题的值是否合法 if(StringUtil.isBlank(content.getContentTitle())){ return ResultData.build().error(getResString("err.empty", this.getResString("content.title"))); @@ -235,11 +218,15 @@ public class ContentAction extends BaseAction { * @param contents 文章实体 */ @ApiOperation(value = "批量删除文章列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "contents", value = "文章集合", allowMultiple = true, dataType = "ContentEntity", required = true) + + }) @PostMapping("/delete") @ResponseBody @LogAnn(title = "删除文章", businessType = BusinessTypeEnum.DELETE) @RequiresPermissions("cms:content:del") - public ResultData delete(@RequestBody List contents, HttpServletResponse response, HttpServletRequest request) { + public ResultData delete(@RequestBody List contents) { List ids = new ArrayList<>(); for(int i = 0;i columnArticles = contentBiz.queryIdsByCategoryIdForParser(contentBean); //判断栏目下是否有文章 @@ -203,7 +203,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { @ResponseBody public String view(String orderby, String order, HttpServletRequest req, HttpServletResponse resp) { //参数文章编号 - ContentEntity article = (ContentEntity) contentBiz.getEntity(BasicUtil.getInt(ParserUtil.ID)); + ContentEntity article = contentBiz.getById(BasicUtil.getString(ParserUtil.ID)); if (ObjectUtil.isNull(article)) { throw new BusinessException(this.getResString("err.empty", this.getResString("id"))); } @@ -219,7 +219,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { //用于详情上下页获取当前文章列表对应的分类,根据文章查询只能获取自身分类 String typeId = BasicUtil.getString(ParserUtil.TYPE_ID, article.getCategoryId()); //根据文章编号查询栏目详情模版 - CategoryEntity column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId)); + CategoryEntity column = categoryBiz.getById(typeId); //解析后的内容 String content = ""; Map map = BasicUtil.assemblyRequestMap(); diff --git a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml index 574b3e55..c6fd4642 100755 --- a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml @@ -106,7 +106,7 @@ and ( - find_in_set('${id}',CATEGORY_PARENT_IDS)>0 + find_in_set(#{id},CATEGORY_PARENT_IDS)>0 or id=#{id} ) and del=0 diff --git a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml index 14223f99..b5f8fb91 100755 --- a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml @@ -63,7 +63,6 @@ - @@ -182,25 +181,25 @@ - + - update cms_content set del=1 where id=#{id} + delete from cms_content where id=#{id} - + - update cms_content set del=1 + delete from cms_content - category_id in #{item} - update cms_content set del=1 + delete from cms_content - id in #{item} @@ -218,12 +217,12 @@ ct.del=0 and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%') and (ct.category_id=#{categoryId} or ct.category_id in - (select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)>0)) + (select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0)) and - FIND_IN_SET('${item}',ct.content_type)>0 + FIND_IN_SET(#{item},ct.content_type)>0 and content_display=#{contentDisplay} @@ -257,7 +256,7 @@ and (ct.category_id=#{categoryId} or ct.category_id in - (select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)>0)) + (select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0)) and ct.category_id=#{categoryId} @@ -308,7 +307,7 @@ left join cms_category c ON a.category_id = c.id - left join ${tableName} d on d.link_id=a.id + left join ${tableName} d on d.link_id=a.id a.del=0 @@ -326,7 +325,7 @@ and - FIND_IN_SET('${item}',a.content_type)>0 + FIND_IN_SET(#{item},a.content_type)>0 @@ -347,10 +346,10 @@ and a.content_datetime < to_date(#{map.content_datetime_end}, 'yyyy-mm-dd hh24:mi:ss') - + - and d.${field.key} like CONCAT(CONCAT('%',#{item.value}),'%') + and d.${item.key} like CONCAT(CONCAT('%',#{item.value}),'%') diff --git a/src/main/java/net/mingsoft/config/WebConfig.java b/src/main/java/net/mingsoft/config/WebConfig.java index d7143371..724b2fd0 100644 --- a/src/main/java/net/mingsoft/config/WebConfig.java +++ b/src/main/java/net/mingsoft/config/WebConfig.java @@ -21,12 +21,20 @@ package net.mingsoft.config; +import cn.hutool.core.util.StrUtil; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import net.mingsoft.basic.filter.XSSEscapeFilter; import net.mingsoft.basic.interceptor.ActionInterceptor; +import net.mingsoft.mdiy.biz.IConfigBiz; +import net.mingsoft.mdiy.entity.ConfigEntity; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.context.annotation.Bean; @@ -41,6 +49,7 @@ import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.io.File; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,6 +61,8 @@ import java.util.concurrent.TimeUnit; @Configuration public class WebConfig implements WebMvcConfigurer { + @Autowired(required = false) + private IConfigBiz configBiz; @Bean public ActionInterceptor actionInterceptor() { @@ -84,19 +95,20 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { String uploadMapping = MSProperties.upload.mapping; - String uploadFloderPath = MSProperties.upload.path; + String uploadFolderPath = MSProperties.upload.path; String template = MSProperties.upload.template; String htmlDir = MSProperties.htmlDir; - registry.addResourceHandler(uploadMapping).addResourceLocations(File.separator + uploadFloderPath + File.separator, "file:" + uploadFloderPath + File.separator); - registry.addResourceHandler("/template/**").addResourceLocations(File.separator + template + File.separator, "file:" + template + File.separator); + // 上传路径映射 这里的映射不能使用File.separator Windows会存在映射问题 + registry.addResourceHandler(uploadMapping).addResourceLocations("/" + uploadFolderPath + "/", "file:" + uploadFolderPath + "/"); + registry.addResourceHandler("/" + template + "/**").addResourceLocations("/" + template + "/", "file:" + template + "/"); registry.addResourceHandler("/"+htmlDir+"/**").addResourceLocations("/"+htmlDir+"/", "file:"+htmlDir+"/"); //三种映射方式 webapp下、当前目录下、jar内 registry.addResourceHandler("/app/**").addResourceLocations("/app/", "file:app/", "classpath:/app/"); registry.addResourceHandler("/static/**").addResourceLocations("/static/", "file:static/", "classpath:/static/", "classpath:/META-INF/resources/"); registry.addResourceHandler("/api/**").addResourceLocations("/api/", "file:api/", "classpath:/api/"); - if (new File(uploadFloderPath).isAbsolute()) { + if (new File(uploadFolderPath).isAbsolute()) { //如果指定了绝对路径,上传的文件都映射到uploadMapping下 - registry.addResourceHandler(uploadMapping).addResourceLocations("file:" + uploadFloderPath + File.separator + registry.addResourceHandler(uploadMapping).addResourceLocations("file:" + uploadFolderPath + "/" //映射其他路径文件 //,file:F://images ); @@ -117,19 +129,27 @@ public class WebConfig implements WebMvcConfigurer { //XSS过滤器 @Bean - public FilterRegistrationBean xssFilterRegistration() { + public FilterRegistrationBean xssFilterRegistration(@Value("${ms.xss.xssEnable:false}") boolean xssEnable, + @Value("${ms.xss.filterUrl}") String filterUrl, + @Value("${ms.xss.excludeUrl}") String excludeUrl) { XSSEscapeFilter xssFilter = new XSSEscapeFilter(); + Map initParameters = new HashMap(); FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setName("XSSFilter"); - registration.addUrlPatterns("/*"); - registration.setOrder(Ordered.HIGHEST_PRECEDENCE); - xssFilter.includes.add(".*/search.do"); - Map initParameters = new HashMap(); - boolean enable = true; + registration.addUrlPatterns(new String[]{"/*"}); + registration.setOrder(-2147483648); + xssFilter.includes.add("/**"); + xssFilter.excludes.add(MSProperties.manager.path + "/**"); + if (filterUrl != null && StrUtil.isNotBlank(filterUrl.toString())) { + xssFilter.includes.addAll(Arrays.asList(filterUrl.toString().split(","))); + } + if (excludeUrl != null && StrUtil.isNotBlank(excludeUrl.toString())) { + xssFilter.excludes.addAll(Arrays.asList(excludeUrl.toString().split(","))); + } initParameters.put("isIncludeRichText", "false"); registration.setInitParameters(initParameters); registration.setFilter(xssFilter); - registration.setEnabled(enable); + registration.setEnabled(xssEnable); return registration; } @@ -184,5 +204,15 @@ public class WebConfig implements WebMvcConfigurer { return pool; } + public Map getMap(String configName) { + if (!StringUtils.isEmpty(configName) && !StringUtils.isEmpty(configName)) { + ConfigEntity configEntity = new ConfigEntity(); + configEntity.setConfigName(configName); + configEntity = (ConfigEntity)this.configBiz.getOne(new QueryWrapper(configEntity)); + return configEntity != null && !StringUtils.isEmpty(configEntity.getConfigData()) ? (Map) JSON.parseObject(configEntity.getConfigData(), HashMap.class) : null; + } else { + return null; + } + } } diff --git a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl index 61f5b5bb..9a02297e 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl @@ -1,7 +1,7 @@ - 文章1 + 文章 <#include "../../include/head-file.ftl"> diff --git a/src/main/webapp/WEB-INF/manager/index.ftl b/src/main/webapp/WEB-INF/manager/index.ftl index 171b2b6b..37de90d9 100644 --- a/src/main/webapp/WEB-INF/manager/index.ftl +++ b/src/main/webapp/WEB-INF/manager/index.ftl @@ -1,819 +1,97 @@ - - ${app.appName} - <#include '/include/head-file.ftl'/> - - - - - - + + + + + + + -<#include 'reset-password.ftl'/> -
- - - - - - - - - - - - - - - - - - <#--右侧内容--> - - - - <#--展示合并菜单--> -
- -
- - - - - -
-
  • - -
    {{item.modelTitle}}
    -
    - -
    - -
  • -
    -
    -
    - -
    - - - - - - - - -
    - -
    - - - - - - - - - - - -
    -
    +
    + + + + + + + + + + + + + + click to open the Dialog + + + This is a message + + +
    - - - + diff --git a/src/main/webapp/template/1/default/about.htm b/src/main/webapp/template/1/default/about.htm index d223f5d2..cf91df56 100755 --- a/src/main/webapp/template/1/default/about.htm +++ b/src/main/webapp/template/1/default/about.htm @@ -6,7 +6,7 @@
    - <#include "nav.htm" /> + <#include "header.htm" />
    diff --git a/src/main/webapp/template/1/default/index.htm b/src/main/webapp/template/1/default/index.htm index 40eb40bb..eb02e5ad 100755 --- a/src/main/webapp/template/1/default/index.htm +++ b/src/main/webapp/template/1/default/index.htm @@ -2,11 +2,12 @@ {ms:global.name/} + <#include "head-file.htm" />
    - <#include "nav.htm" /> + <#include "header.htm" />
    diff --git a/src/main/webapp/template/1/default/message.htm b/src/main/webapp/template/1/default/message.htm deleted file mode 100755 index 05ba433a..00000000 --- a/src/main/webapp/template/1/default/message.htm +++ /dev/null @@ -1,443 +0,0 @@ - - - - {ms:global.name/} - <#include "head-file.htm" /> - - -
    - <#include "nav.htm" /> -
    -
    -
    - 分类名称 - 分类名称 - 分类名称 -
    -
    -
    - 当前位置: - 首页 {ms:channel type="path"} - - ${field.typetitle} {/ms:channel} -
    -
    - - - - - - -
    - 提交 -
    -
    -
    -
    -
    - <#include "footer.htm" /> -
    - - - - \ No newline at end of file diff --git a/src/main/webapp/template/1/default/nav.htm b/src/main/webapp/template/1/default/nav.htm deleted file mode 100755 index f93b650b..00000000 --- a/src/main/webapp/template/1/default/nav.htm +++ /dev/null @@ -1,44 +0,0 @@ -<#assign ids=field.parentids> -<#assign typeid=field.typeid> -
    -
    - - - - -
    -
    diff --git a/src/main/webapp/template/1/default/news-detail.htm b/src/main/webapp/template/1/default/news-detail.htm index c39f8747..64d8ea57 100755 --- a/src/main/webapp/template/1/default/news-detail.htm +++ b/src/main/webapp/template/1/default/news-detail.htm @@ -1,632 +1,663 @@ - - - {ms:global.name/} - <#include "head-file.htm" /> - - -
    - <#include "nav.htm" /> -
    - -
    -
    - {ms:channel type='parent'} - ${field.typetitle} - {/ms:channel} - <#assign typetitle=field.typetitle> - <#if field.typeleaf> - {ms:channel type='level'} - ${field.typetitle} - {/ms:channel} - <#else> - {ms:channel type='son'} - ${field.typetitle} - {/ms:channel} - + + + {ms:global.name/} + <#include "head-file.htm" /> + + +
    + <#include "header.htm" /> +
    + +
    +
    + {ms:channel type='parent'} + ${field.typetitle} + {/ms:channel} + <#assign typetitle=field.typetitle> + <#if field.typeleaf> + {ms:channel type='level'} + ${field.typetitle} + {/ms:channel} + <#else> + {ms:channel type='son'} + ${field.typetitle} + {/ms:channel} + +
    +
    +
    + 当前位置: + 首页 {ms:channel type="path"} + + ${field.typetitle} + {/ms:channel} +
    + ${field.title} +
    + 发布时间: + ${field.date?date?string("yyyy-MM-dd")} + 预览次数: + ${field.hit} +
    +
    + ${field.content} +
    +
    + 上一篇: + <#if pre.title?has_content> + ${pre.title} + <#else> + 已经没有了 + +
    +
    + 下一篇: + <#if next.title?has_content> + ${next.title} + <#else> + 已经没有了 + +
    + + 点赞 + +
    -
    -
    - 当前位置: - 首页 {ms:channel type="path"} - - ${field.typetitle} {/ms:channel} -
    - ${field.title} -
    - 发布时间: - ${field.date?date?string("yyyy-MM-dd")} - 预览次数: - ${field.hit} -
    -
    - ${field.content} -
    -
    - 上一篇: - <#if pre.title?has_content> - ${pre.title} - <#else> - 已经没有了 - -
    -
    - 下一篇: - <#if next.title?has_content> - ${next.title} - <#else> - 已经没有了 - -
    -
    -
    - -
    - <#include "footer.htm" /> -
    - - - + } + \ No newline at end of file diff --git a/src/main/webapp/template/1/default/news-list.htm b/src/main/webapp/template/1/default/news-list.htm index 42cc33e0..883011fe 100755 --- a/src/main/webapp/template/1/default/news-list.htm +++ b/src/main/webapp/template/1/default/news-list.htm @@ -6,7 +6,7 @@
    - <#include "nav.htm" /> + <#include "header.htm" />
    diff --git a/src/main/webapp/template/1/default/product-detail.htm b/src/main/webapp/template/1/default/product-detail.htm index a2868732..eb81fe87 100755 --- a/src/main/webapp/template/1/default/product-detail.htm +++ b/src/main/webapp/template/1/default/product-detail.htm @@ -6,7 +6,7 @@
    - <#include "nav.htm" /> + <#include "header.htm" />
    diff --git a/src/main/webapp/template/1/default/product-list.htm b/src/main/webapp/template/1/default/product-list.htm index abac4964..5ab2bd03 100755 --- a/src/main/webapp/template/1/default/product-list.htm +++ b/src/main/webapp/template/1/default/product-list.htm @@ -6,7 +6,7 @@
    - <#include "nav.htm" /> + <#include "header.htm" />
    diff --git a/src/main/webapp/template/1/default/search.htm b/src/main/webapp/template/1/default/search.htm index 661c3c50..3389b75f 100755 --- a/src/main/webapp/template/1/default/search.htm +++ b/src/main/webapp/template/1/default/search.htm @@ -6,7 +6,7 @@
    - <#include "nav.htm" /> + <#include "header.htm" />