From d35f5c65013b9172dba34d9d9fe791ea35980a01 Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Tue, 7 Jan 2020 14:12:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=87=E7=BA=A75.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +- .../mingsoft/cms/action/GeneraterAction.java | 36 +++--- .../mingsoft/cms/action/web/FieldAction.java | 103 ------------------ .../mingsoft/cms/action/web/MCmsAction.java | 29 ++--- .../WEB-INF/manager/cms/generate/index.ftl | 2 + src/main/webapp/templets/1/default/advice.htm | 4 +- src/main/webapp/templets/1/default/index.htm | 8 +- .../webapp/upload/1/appLogo/1578375538540.jpg | Bin 0 -> 32845 bytes 8 files changed, 42 insertions(+), 146 deletions(-) delete mode 100644 src/main/java/net/mingsoft/cms/action/web/FieldAction.java create mode 100644 src/main/webapp/upload/1/appLogo/1578375538540.jpg diff --git a/pom.xml b/pom.xml index 5ff72242..899ab1e8 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,6 @@ - @@ -46,6 +45,11 @@ ms-mpeople 1.0.13 + + net.mingsoft + ms-mdiy + 1.0.12-SNAPSHOT + net.mingsoft ms-upgrader diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index 7f98b209..b02df132 100644 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -21,21 +21,19 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) package net.mingsoft.cms.action; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -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 cn.hutool.core.io.FileUtil; +import net.mingsoft.basic.action.BaseAction; +import net.mingsoft.basic.biz.IModelBiz; +import net.mingsoft.basic.entity.AppEntity; +import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.cms.bean.ContentBean; import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.biz.IContentBiz; import net.mingsoft.cms.entity.CategoryEntity; -import org.apache.commons.lang3.StringUtils; +import net.mingsoft.cms.util.CmsParserUtil; +import net.mingsoft.mdiy.util.ParserUtil; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -46,15 +44,12 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import net.mingsoft.basic.action.BaseAction; -import net.mingsoft.basic.biz.IModelBiz; -import net.mingsoft.basic.entity.AppEntity; -import net.mingsoft.cms.util.CmsParserUtil; -import net.mingsoft.mdiy.biz.IContentModelFieldBiz; - -import cn.hutool.core.io.FileUtil; -import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.mdiy.util.ParserUtil; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; /** * @@ -92,10 +87,7 @@ public class GeneraterAction extends BaseAction { private String managerPath; /** - * 新增字段业务层 - */ - @Autowired - protected IContentModelFieldBiz fieldBiz; + /** diff --git a/src/main/java/net/mingsoft/cms/action/web/FieldAction.java b/src/main/java/net/mingsoft/cms/action/web/FieldAction.java deleted file mode 100644 index c1a0f786..00000000 --- a/src/main/java/net/mingsoft/cms/action/web/FieldAction.java +++ /dev/null @@ -1,103 +0,0 @@ -/** -The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) - - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.mingsoft.cms.action.web; - -import com.alibaba.fastjson.JSONObject; -import net.mingsoft.base.action.BaseAction; -import net.mingsoft.basic.biz.IColumnBiz; -import net.mingsoft.basic.entity.ColumnEntity; -import net.mingsoft.mdiy.biz.IContentModelBiz; -import net.mingsoft.mdiy.biz.IContentModelFieldBiz; -import net.mingsoft.mdiy.entity.ContentModelEntity; -import net.mingsoft.mdiy.entity.ContentModelFieldEntity; -import 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 javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - - -/** - * 供前端页面获取自定义模型中字段实体信息 - * @author 铭飞开发团队 - * 创建日期:2019-11-28 15:12:32
- * 历史修订:
- */ -@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) { - //获取字段名称 - 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 diff --git a/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java b/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java index 01d46768..198aea7a 100644 --- a/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java +++ b/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java @@ -26,8 +26,9 @@ import cn.hutool.core.util.PageUtil; import freemarker.core.ParseException; import freemarker.template.MalformedTemplateNameException; import freemarker.template.TemplateNotFoundException; +import net.mingsoft.base.constant.Const; import net.mingsoft.basic.util.BasicUtil; -import net.mingsoft.basic.util.SpringUtil; +import net.mingsoft.basic.util.StringUtil; import net.mingsoft.cms.bean.ContentBean; import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.biz.IContentBiz; @@ -35,24 +36,25 @@ import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.cms.entity.ContentEntity; import net.mingsoft.cms.util.CmsParserUtil; import net.mingsoft.mdiy.bean.PageBean; -import net.mingsoft.mdiy.biz.IContentModelBiz; import net.mingsoft.mdiy.biz.IModelBiz; import net.mingsoft.mdiy.biz.IPageBiz; -import net.mingsoft.mdiy.entity.ContentModelEntity; +import net.mingsoft.mdiy.entity.ModelEntity; import net.mingsoft.mdiy.entity.PageEntity; +import net.mingsoft.mdiy.parser.TagParser; import net.mingsoft.mdiy.util.ParserUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.*; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 动态生成页面,需要后台配置自定义页数据 @@ -243,7 +245,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { map.put(ParserUtil.ID, article.getId()); List articleIdList = contentBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null,orderby,order); Map contentModelMap = new HashMap(); - ContentModelEntity contentModel = null; + ModelEntity contentModel = null; for (int artId = 0; artId < articleIdList.size();) { //如果不是当前文章则跳过 if(articleIdList.get(artId).getArticleId() != Integer.parseInt(article.getId())){ @@ -260,14 +262,13 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { if ( StringUtils.isNotBlank(columnContentModelId)) { // 通过当前栏目的模型编号获取,自定义模型表名 if (contentModelMap.containsKey(columnContentModelId)) { - parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); + parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); } else { // 通过栏目模型编号获取自定义模型实体 - contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) - .getEntity(Integer.parseInt(columnContentModelId)); + contentModel=(ModelEntity)modelBiz.getEntity(Integer.parseInt(columnContentModelId)); // 将自定义模型编号设置为key值 - contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); - parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); + contentModelMap.put(columnContentModelId, contentModel.getModelTableName()); + parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); } } // 第一篇文章没有上一篇 diff --git a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl index 8a2b1ec3..45257583 100644 --- a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl @@ -152,6 +152,8 @@ ms.http.post(ms.manager+'/cms/generate//generateIndex.do', {url:that.template,position:that.position}).then(function (data) { if(data.result){ that.$notify({ title: '更新成功!', type: 'success' }); + }else { + that.$notify({ title: '更新失败!',message: "错误", type: 'error' }); } }).catch(function (err) { that.$notify({ title: '更新失败!',message: err, type: 'error' }); diff --git a/src/main/webapp/templets/1/default/advice.htm b/src/main/webapp/templets/1/default/advice.htm index 152a01f9..6b4db001 100644 --- a/src/main/webapp/templets/1/default/advice.htm +++ b/src/main/webapp/templets/1/default/advice.htm @@ -14,7 +14,7 @@
- +
@@ -29,7 +29,7 @@ if(!flag) { $.ajax({ type: "POST", - url: "{ms:global.host/}/mdiy/diyForm/f2c131968438246e885e0feed7256dbc.do", + url: "{ms:global.host/}/mdiy/post/7df6529f9eaa26da7ae4e01c7f73aa06.do", data: $("#postForm").serialize(), success: function(msg) { flag = true; diff --git a/src/main/webapp/templets/1/default/index.htm b/src/main/webapp/templets/1/default/index.htm index a9773e01..21d38acd 100644 --- a/src/main/webapp/templets/1/default/index.htm +++ b/src/main/webapp/templets/1/default/index.htm @@ -65,11 +65,11 @@