Commit b03361cd authored by sgjj's avatar sgjj
Browse files

恢复标签

parent 765bfd55
...@@ -102,6 +102,7 @@ public class CategoryAction extends BaseAction{ ...@@ -102,6 +102,7 @@ public class CategoryAction extends BaseAction{
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
category.setAppId(BasicUtil.getAppId());
BasicUtil.startPage(); BasicUtil.startPage();
List categoryList = categoryBiz.query(category); List categoryList = categoryBiz.query(category);
return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal())); return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal()));
...@@ -131,6 +132,7 @@ public class CategoryAction extends BaseAction{ ...@@ -131,6 +132,7 @@ public class CategoryAction extends BaseAction{
if(category.getId()==null) { if(category.getId()==null) {
return ResultData.build().error(); return ResultData.build().error();
} }
category.setAppId(BasicUtil.getAppId());
CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId())); CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId()));
return ResultData.build().success(_category); return ResultData.build().success(_category);
} }
...@@ -188,6 +190,7 @@ public class CategoryAction extends BaseAction{ ...@@ -188,6 +190,7 @@ public class CategoryAction extends BaseAction{
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
} }
category.setAppId(BasicUtil.getAppId());
categoryBiz.saveEntity(category); categoryBiz.saveEntity(category);
return ResultData.build().success(category); return ResultData.build().success(category);
} }
...@@ -262,6 +265,7 @@ public class CategoryAction extends BaseAction{ ...@@ -262,6 +265,7 @@ public class CategoryAction extends BaseAction{
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
} }
category.setAppId(BasicUtil.getAppId());
categoryBiz.updateEntity(category); categoryBiz.updateEntity(category);
return ResultData.build().success(category); return ResultData.build().success(category);
} }
......
package net.mingsoft.cms.action; package net.mingsoft.cms.action;
import java.util.List; import java.util.List;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import net.mingsoft.base.entity.ResultData; import net.mingsoft.base.entity.ResultData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
...@@ -20,19 +13,15 @@ import org.springframework.stereotype.Controller; ...@@ -20,19 +13,15 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import net.mingsoft.cms.biz.IContentBiz; import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.entity.ContentEntity; import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.base.util.JSONObject;
import net.mingsoft.base.entity.BaseEntity; import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.StringUtil; import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.base.filter.DateValueFilter;
import net.mingsoft.base.filter.DoubleValueFilter;
import net.mingsoft.basic.bean.EUListBean; import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.annotation.LogAnn; import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.constant.e.BusinessTypeEnum; import net.mingsoft.basic.constant.e.BusinessTypeEnum;
...@@ -105,6 +94,7 @@ public class ContentAction extends BaseAction{ ...@@ -105,6 +94,7 @@ public class ContentAction extends BaseAction{
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
content.setAppId(BasicUtil.getAppId());
BasicUtil.startPage(); BasicUtil.startPage();
List contentList = contentBiz.query(content); List contentList = contentBiz.query(content);
return ResultData.build().success(new EUListBean(contentList,(int)BasicUtil.endPage(contentList).getTotal())); return ResultData.build().success(new EUListBean(contentList,(int)BasicUtil.endPage(contentList).getTotal()));
...@@ -134,6 +124,7 @@ public class ContentAction extends BaseAction{ ...@@ -134,6 +124,7 @@ public class ContentAction extends BaseAction{
if(content.getId()==null) { if(content.getId()==null) {
return ResultData.build().error(); return ResultData.build().error();
} }
content.setAppId(BasicUtil.getAppId());
ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId())); ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
return ResultData.build().success(_content); return ResultData.build().success(_content);
} }
...@@ -191,6 +182,7 @@ public class ContentAction extends BaseAction{ ...@@ -191,6 +182,7 @@ public class ContentAction extends BaseAction{
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
} }
content.setAppId(BasicUtil.getAppId());
contentBiz.saveEntity(content); contentBiz.saveEntity(content);
return ResultData.build().success(content); return ResultData.build().success(content);
} }
...@@ -265,6 +257,7 @@ public class ContentAction extends BaseAction{ ...@@ -265,6 +257,7 @@ public class ContentAction extends BaseAction{
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
} }
content.setAppId(BasicUtil.getAppId());
contentBiz.updateEntity(content); contentBiz.updateEntity(content);
return ResultData.build().success(content); return ResultData.build().success(content);
} }
......
...@@ -24,7 +24,6 @@ package net.mingsoft.cms.action; ...@@ -24,7 +24,6 @@ package net.mingsoft.cms.action;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -32,6 +31,9 @@ import javax.servlet.http.HttpServletResponse; ...@@ -32,6 +31,9 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -42,13 +44,9 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -42,13 +44,9 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import net.mingsoft.basic.action.BaseAction; import net.mingsoft.basic.action.BaseAction;
import net.mingsoft.basic.biz.IColumnBiz;
import net.mingsoft.basic.biz.IModelBiz; import net.mingsoft.basic.biz.IModelBiz;
import net.mingsoft.basic.entity.AppEntity; 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.bean.ColumnArticleIdBean;
import net.mingsoft.cms.biz.IArticleBiz; import net.mingsoft.cms.biz.IArticleBiz;
import net.mingsoft.cms.constant.ModelCode; import net.mingsoft.cms.constant.ModelCode;
...@@ -84,7 +82,7 @@ public class GeneraterAction extends BaseAction { ...@@ -84,7 +82,7 @@ public class GeneraterAction extends BaseAction {
* 栏目管理业务层 * 栏目管理业务层
*/ */
@Autowired @Autowired
private IColumnBiz columnBiz; private ICategoryBiz categoryBiz;
/** /**
* 模块管理业务层 * 模块管理业务层
...@@ -155,40 +153,42 @@ public class GeneraterAction extends BaseAction { ...@@ -155,40 +153,42 @@ public class GeneraterAction extends BaseAction {
* @param response * @param response
* @param columnId * @param columnId
*/ */
@RequestMapping("/{columnId}/genernateColumn") @RequestMapping("/{CategoryId}/genernateColumn")
@RequiresPermissions("cms:generate:column") @RequiresPermissions("cms:generate:column")
@ResponseBody @ResponseBody
public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable int columnId) { public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable String CategoryId) {
// 获取站点id // 获取站点id
AppEntity app = BasicUtil.getApp(); AppEntity app = BasicUtil.getApp();
List<ColumnEntity> columns = new ArrayList<ColumnEntity>(); List<CategoryEntity> columns = new ArrayList<CategoryEntity>();
// 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目 // 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目
int modelId = BasicUtil.getModelCodeId(ModelCode.CMS_COLUMN); // 查询当前模块编号 if (StringUtils.isNotBlank(CategoryId)) {
if (columnId > 0) { CategoryEntity categoryEntity = new CategoryEntity();
List<CategoryEntity> categorys = columnBiz.queryChildrenCategory(columnId, app.getAppId(), modelId); categoryEntity.setId(CategoryId);
for (CategoryEntity c : categorys) { categoryEntity.setAppId(app.getAppId());
columns.add((ColumnEntity) columnBiz.getEntity(c.getCategoryId())); columns = categoryBiz.queryChilds(categoryEntity);
}
} else { } else {
// 获取所有的内容管理栏目 // 获取所有的内容管理栏目
columns = columnBiz.queryAll(app.getAppId(), modelId); CategoryEntity categoryEntity=new CategoryEntity();
categoryEntity.setAppId(app.getAppId());
columns = categoryBiz.query(categoryEntity);
} }
List<ColumnArticleIdBean> articleIdList = null; List<ColumnArticleIdBean> articleIdList = null;
try { try {
// 1、设置模板文件夹路径 // 1、设置模板文件夹路径
// 获取栏目列表模版 // 获取栏目列表模版
for (ColumnEntity column : columns) { for (CategoryEntity column : columns) {
// 判断模板文件是否存在 // 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getColumnUrl()))) { if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryUrl()))) {
continue; continue;
} }
articleIdList = articleBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null); articleIdList = articleBiz.queryIdsByCategoryIdForParser(Integer.parseInt(column.getCategoryId()), null, null);
// 判断列表类型 // 判断列表类型
switch (column.getColumnType()) { switch (column.getCategoryType()) {
case ColumnEntity.COLUMN_TYPE_LIST: // 列表 //TODO 暂时先用字符串代替
case "1": // 列表
CmsParserUtil.generateList(column, articleIdList.size()); CmsParserUtil.generateList(column, articleIdList.size());
break; break;
case ColumnEntity.COLUMN_TYPE_COVER:// 单页 case "2":// 单页
if(articleIdList.size()==0){ if(articleIdList.size()==0){
ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean(); ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean();
CopyOptions copyOptions=CopyOptions.create(); CopyOptions copyOptions=CopyOptions.create();
...@@ -198,8 +198,6 @@ public class GeneraterAction extends BaseAction { ...@@ -198,8 +198,6 @@ public class GeneraterAction extends BaseAction {
} }
CmsParserUtil.generateBasic(articleIdList); CmsParserUtil.generateBasic(articleIdList);
break; break;
default:
throw new IllegalStateException("Unexpected value: " + column.getColumnType());
} }
} }
} catch (IOException e) { } catch (IOException e) {
......
...@@ -196,7 +196,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -196,7 +196,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
String content = ""; String content = "";
try { try {
//根据模板路径,参数生成 //根据模板路径,参数生成
content = CmsParserUtil.generate(columnArticles.get(0).getColumnListUrl(),map, isMobileDevice(req)); content = CmsParserUtil.generate(columnArticles.get(0).getCategoryListUrl(),map, isMobileDevice(req));
} catch (TemplateNotFoundException e) { } catch (TemplateNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (MalformedTemplateNameException e) { } catch (MalformedTemplateNameException e) {
...@@ -251,20 +251,20 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -251,20 +251,20 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
continue; continue;
} }
// 文章的栏目路径 // 文章的栏目路径
String articleColumnPath = articleIdList.get(artId).getColumnPath(); String articleColumnPath = articleIdList.get(artId).getCategoryPath();
// 文章的栏目模型编号 // 文章的栏目模型编号
int columnContentModelId = articleIdList.get(artId).getColumnContentModelId(); String columnContentModelId = articleIdList.get(artId).getMdiyModelId();
Map<String, Object> parserParams = new HashMap<String, Object>(); Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) { if ( StringUtils.isNotBlank(columnContentModelId)) {
// 通过当前栏目的模型编号获取,自定义模型表名 // 通过当前栏目的模型编号获取,自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) { if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName());
} else { } else {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class)
.getEntity(columnContentModelId); .getEntity(Integer.parseInt(columnContentModelId));
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); contentModelMap.put(columnContentModelId, contentModel.getCmTableName());
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName());
......
...@@ -22,13 +22,14 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) ...@@ -22,13 +22,14 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
package net.mingsoft.cms.bean; package net.mingsoft.cms.bean;
import net.mingsoft.basic.entity.ColumnEntity; import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.cms.entity.CategoryEntity;
/** /**
* 文章解析生成 * 文章解析生成
* @author 铭飞开源团队 * @author 铭飞开源团队
* @date 2018年12月13日 * @date 2018年12月13日
*/ */
public class ColumnArticleIdBean extends ColumnEntity{ public class ColumnArticleIdBean extends CategoryEntity {
/** /**
* 文章编号 * 文章编号
*/ */
......
package net.mingsoft.cms.biz; package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz; import net.mingsoft.base.biz.IBaseBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.List;
/** /**
...@@ -11,4 +14,14 @@ import net.mingsoft.base.biz.IBaseBiz; ...@@ -11,4 +14,14 @@ import net.mingsoft.base.biz.IBaseBiz;
*/ */
public interface ICategoryBiz extends IBaseBiz { public interface ICategoryBiz extends IBaseBiz {
/**
* 查询当前分类下的所有子分类
* @param category
* @return
*/
List<CategoryEntity> queryChilds(CategoryEntity category);
int saveEntity(CategoryEntity entity);
void updateEntity(CategoryEntity entity);
} }
\ No newline at end of file
...@@ -21,12 +21,15 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技 ...@@ -21,12 +21,15 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技
package net.mingsoft.cms.biz.impl; package net.mingsoft.cms.biz.impl;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl; import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao; import net.mingsoft.base.dao.IBaseDao;
import java.util.*; import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.dao.ICategoryDao; import net.mingsoft.cms.dao.ICategoryDao;
...@@ -49,4 +52,41 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz { ...@@ -49,4 +52,41 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return categoryDao; return categoryDao;
} }
@Override
public List<CategoryEntity> queryChilds(CategoryEntity category) {
// TODO Auto-generated method stub
return categoryDao.queryChildren(category);
}
@Override
public int saveEntity(CategoryEntity categoryEntity) {
// TODO Auto-generated method stub
setParentId(categoryEntity);
return super.saveEntity(categoryEntity);
}
private void setParentId(CategoryEntity categoryEntity) {
if(StringUtils.isNotEmpty(categoryEntity.getCategoryId())&&Integer.parseInt(categoryEntity.getCategoryId())>0) {
CategoryEntity category = (CategoryEntity)categoryDao.getEntity(Integer.parseInt(categoryEntity.getCategoryId()));
if(StringUtils.isEmpty(category.getCategoryParentId())) {
categoryEntity.setCategoryParentId(categoryEntity.getCategoryId());
} else {
categoryEntity.setCategoryParentId(category.getCategoryParentId()+","+categoryEntity.getCategoryParentId());
}
}
}
@Override
public void updateEntity(CategoryEntity entity) {
List<CategoryEntity> categoryEntities = queryChilds(entity);
setParentId(entity);
super.updateEntity(entity);
categoryEntities.forEach(x->{
setParentId(x);
if(!x.getId().equals(entity.getId())){
super.updateEntity(x);
}
});
}
} }
\ No newline at end of file
...@@ -2,7 +2,9 @@ package net.mingsoft.cms.dao; ...@@ -2,7 +2,9 @@ package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao; import net.mingsoft.base.dao.IBaseDao;
import java.util.*; import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
...@@ -13,4 +15,12 @@ import org.springframework.stereotype.Component; ...@@ -13,4 +15,12 @@ import org.springframework.stereotype.Component;
*/ */
@Component("cmsCategoryDao") @Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao { public interface ICategoryDao extends IBaseDao {
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public List<net.mingsoft.cms.entity.CategoryEntity> queryChildren(CategoryEntity category);
} }
\ No newline at end of file
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
update cms_category update cms_category
<set> <set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if> <if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if> category_id=#{categoryId},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if> <if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if> <if test="categorySort != null">category_sort=#{categorySort},</if>
<if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if> <if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if>
...@@ -151,6 +151,41 @@ ...@@ -151,6 +151,41 @@
</where> </where>
limit 0,1 limit 0,1
</select> </select>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${id}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${id}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${id}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap">
select * from cms_category
<where>
<if test="appId &gt; 0">
and app_id=#{appId}
</if>
<if test="dictId &gt; 0">
and dict_id=#{dictId}
</if>
and
(
<if test="categoryParentId != null and categoryParentId!=''">
CATEGORY_PARENT_ID like '%${categoryParentId}%'
</if>
<if test="categoryParentId == null or categoryParentId ==''">
<include refid="queryWhereCategoryId"></include>
</if>
<if test="id != null">
or id=#{id}
</if>
)
and del=0
</where>
</select>
<!--删除--> <!--删除-->
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<result column="content_details" property="contentDetails" /><!--文章内容 --> <result column="content_details" property="contentDetails" /><!--文章内容 -->
<result column="content_url" property="contentUrl" /><!--文章跳转链接地址 --> <result column="content_url" property="contentUrl" /><!--文章跳转链接地址 -->
<result column="content_hit" property="contentHit" /><!--点击次数 --> <result column="content_hit" property="contentHit" /><!--点击次数 -->
<result column="appid" property="appid" /><!--文章管理的应用id --> <result column="app_id" property="appId" /><!--文章管理的应用id -->
<result column="create_by" property="createBy" /><!--创建人 --> <result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 --> <result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 --> <result column="update_by" property="updateBy" /><!--修改人 -->
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<if test="contentDetails != null and contentDetails != ''">content_details,</if> <if test="contentDetails != null and contentDetails != ''">content_details,</if>
<if test="contentUrl != null and contentUrl != ''">content_url,</if> <if test="contentUrl != null and contentUrl != ''">content_url,</if>
<if test="contentHit != null">content_hit,</if> <if test="contentHit != null">content_hit,</if>
<if test="appid != null">appid,</if> <if test="appId != null">app_id,</if>
<if test="createBy &gt; 0">create_by,</if> <if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if> <if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 0">update_by,</if> <if test="updateBy &gt; 0">update_by,</if>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if> <if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if> <if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
<if test="contentHit != null">#{contentHit},</if> <if test="contentHit != null">#{contentHit},</if>
<if test="appid != null">#{appid},</if> <if test="appId != null">#{appId},</if>
<if test="createBy &gt; 0">#{createBy},</if> <if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 0">#{updateBy},</if> <if test="updateBy &gt; 0">#{updateBy},</if>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if> <if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if> <if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if>
<if test="contentHit != null">content_hit=#{contentHit},</if> <if test="contentHit != null">content_hit=#{contentHit},</if>
<if test="appid != null">appid=#{appid},</if> <if test="appId != null">app_id=#{appId},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if> <if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if> <if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if> <if test="updateBy &gt; 0">update_by=#{updateBy},</if>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
<if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if> <if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if> <if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if>
<if test="contentHit != null">and content_hit=#{contentHit}</if> <if test="contentHit != null">and content_hit=#{contentHit}</if>
<if test="appid != null"> and appid=#{appid} </if> <if test="appId != null"> and app_id=#{appId} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if> <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if> <if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if> <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
<if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if> <if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if> <if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if>
<if test="contentHit != null"> and content_hit=#{contentHit}</if> <if test="contentHit != null"> and content_hit=#{contentHit}</if>
<if test="appid != null"> and appid=#{appid} </if> <if test="appId != null"> and app_id=#{appId} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if> <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if> <if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if> <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
......
...@@ -73,7 +73,7 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -73,7 +73,7 @@ private static final long serialVersionUID = 1574925152617L;
/** /**
* 文章管理的应用id * 文章管理的应用id
*/ */
private Integer appid; private Integer appId;
/** /**
* 点击次数 * 点击次数
*/ */
...@@ -259,14 +259,14 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -259,14 +259,14 @@ private static final long serialVersionUID = 1574925152617L;
/** /**
* 设置文章管理的应用id * 设置文章管理的应用id
*/ */
public void setAppid(Integer appid) { public void setAppId(Integer appId) {
this.appid = appid; this.appId = appId;
} }
/** /**
* 获取文章管理的应用id * 获取文章管理的应用id
*/ */
public Integer getAppid() { public Integer getAppId() {
return this.appid; return this.appId;
} }
} }
\ No newline at end of file
...@@ -22,11 +22,15 @@ import net.mingsoft.basic.util.BasicUtil; ...@@ -22,11 +22,15 @@ import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.SpringUtil; import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.bean.ColumnArticleIdBean; import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.constant.e.ColumnTypeEnum; import net.mingsoft.cms.constant.e.ColumnTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.mdiy.bean.PageBean; import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.biz.IContentModelBiz; import net.mingsoft.mdiy.biz.IContentModelBiz;
import net.mingsoft.mdiy.biz.impl.ModelBizImpl;
import net.mingsoft.mdiy.entity.ContentModelEntity; import net.mingsoft.mdiy.entity.ContentModelEntity;
import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.parser.TagParser; import net.mingsoft.mdiy.parser.TagParser;
import net.mingsoft.mdiy.util.ParserUtil; import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
public class CmsParserUtil extends ParserUtil { public class CmsParserUtil extends ParserUtil {
...@@ -42,9 +46,8 @@ public class CmsParserUtil extends ParserUtil { ...@@ -42,9 +46,8 @@ public class CmsParserUtil extends ParserUtil {
public static void generate(String templatePath, String targetPath) throws IOException { public static void generate(String templatePath, String targetPath) throws IOException {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(IS_DO, false); map.put(IS_DO, false);
ColumnEntity column = new ColumnEntity(); CategoryEntity column = new CategoryEntity();
//内容管理栏目编码 //内容管理栏目编码
column.setCategoryModelId(BasicUtil.getModelCodeId("02990000"));
map.put(COLUMN, column); map.put(COLUMN, column);
String content = CmsParserUtil.generate(templatePath, map, false); String content = CmsParserUtil.generate(templatePath, map, false);
FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8); FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8);
...@@ -67,7 +70,7 @@ public class CmsParserUtil extends ParserUtil { ...@@ -67,7 +70,7 @@ public class CmsParserUtil extends ParserUtil {
* @throws ParseException * @throws ParseException
* @throws IOException * @throws IOException
*/ */
public static void generateList(ColumnEntity column, int articleIdTotal) public static void generateList(CategoryEntity column, int articleIdTotal)
throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException { throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
// 只初始化一次cfg // 只初始化一次cfg
if (ftl == null) { if (ftl == null) {
...@@ -76,12 +79,12 @@ public class CmsParserUtil extends ParserUtil { ...@@ -76,12 +79,12 @@ public class CmsParserUtil extends ParserUtil {
} }
// 移动端模板 // 移动端模板
Template mobileTemplate = cfg.getTemplate( Template mobileTemplate = cfg.getTemplate(
BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getColumnListUrl(), Const.UTF8); BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getCategoryListUrl(), Const.UTF8);
// pc端模板 // pc端模板
Template template = cfg.getTemplate(File.separator + column.getColumnListUrl(), Const.UTF8); Template template = cfg.getTemplate(File.separator + column.getCategoryListUrl(), Const.UTF8);
// 文章的栏目模型编号 // 文章的栏目模型编号
int columnContentModelId = column.getColumnContentModelId(); String columnContentModelId = column.getMdiyModelId();
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
try { try {
// 为了分页添加column,判断栏目是否为父栏目 // 为了分页添加column,判断栏目是否为父栏目
...@@ -94,11 +97,11 @@ public class CmsParserUtil extends ParserUtil { ...@@ -94,11 +97,11 @@ public class CmsParserUtil extends ParserUtil {
String columnListPath; String columnListPath;
String mobilePath; String mobilePath;
ContentModelEntity contentModel = null; ModelEntity contentModel = null;
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) { if (StringUtils.isNotBlank(columnContentModelId)) {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class).getEntity(columnContentModelId); contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId));
} }
int pageNo = 1; int pageNo = 1;
PageBean page = new PageBean(); PageBean page = new PageBean();
...@@ -112,7 +115,7 @@ public class CmsParserUtil extends ParserUtil { ...@@ -112,7 +115,7 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(APP_ID, BasicUtil.getAppId()); parserParams.put(APP_ID, BasicUtil.getAppId());
if (contentModel!=null) { if (contentModel!=null) {
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
parserParams.put(TABLE_NAME, contentModel.getCmTableName()); parserParams.put(TABLE_NAME, contentModel.getModelTableName());
} }
//如果单站点,就废弃站点地址 //如果单站点,就废弃站点地址
if(ParserUtil.IS_SINGLE) { if(ParserUtil.IS_SINGLE) {
...@@ -123,15 +126,15 @@ public class CmsParserUtil extends ParserUtil { ...@@ -123,15 +126,15 @@ public class CmsParserUtil extends ParserUtil {
if (totalPageSize <= 0) { if (totalPageSize <= 0) {
// 数据库中第一页是从开始0*size // 数据库中第一页是从开始0*size
// 首页路径index.html // 首页路径index.html
mobilePath = ParserUtil.buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); mobilePath = ParserUtil.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
columnListPath = ParserUtil.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
// 设置分页的起始位置 // 设置分页的起始位置
page.setPageNo(pageNo); page.setPageNo(pageNo);
parserParams.put(ParserUtil.PAGE, page); parserParams.put(ParserUtil.PAGE, page);
TagParser tag = new TagParser(content,parserParams); TagParser tag = new TagParser(content,parserParams);
FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8);
// 判断是手机端生成还是pc端,防止重复生成 // 判断是手机端生成还是pc端,防止重复生成
if (ParserUtil.hasMobileFile(column.getColumnListUrl())) { if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) {
writer = new StringWriter(); writer = new StringWriter();
mobileTemplate.process(null, writer); mobileTemplate.process(null, writer);
tag = new TagParser(writer.toString(), parserParams); tag = new TagParser(writer.toString(), parserParams);
...@@ -146,15 +149,15 @@ public class CmsParserUtil extends ParserUtil { ...@@ -146,15 +149,15 @@ public class CmsParserUtil extends ParserUtil {
// 数据库中第一页是从开始0*size // 数据库中第一页是从开始0*size
// 首页路径index.html // 首页路径index.html
mobilePath = ParserUtil mobilePath = ParserUtil
.buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); .buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
columnListPath = ParserUtil columnListPath = ParserUtil
.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
} else { } else {
// 其他路径list-2.html // 其他路径list-2.html
mobilePath = ParserUtil.buildMobileHtmlPath( mobilePath = ParserUtil.buildMobileHtmlPath(
column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
columnListPath = ParserUtil columnListPath = ParserUtil
.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
} }
// 设置分页的起始位置 // 设置分页的起始位置
page.setPageNo(pageNo); page.setPageNo(pageNo);
...@@ -162,7 +165,7 @@ public class CmsParserUtil extends ParserUtil { ...@@ -162,7 +165,7 @@ public class CmsParserUtil extends ParserUtil {
TagParser tag = new TagParser(content,parserParams); TagParser tag = new TagParser(content,parserParams);
FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8);
// 判断是手机端生成还是pc端,防止重复生成 // 判断是手机端生成还是pc端,防止重复生成
if (ParserUtil.hasMobileFile(column.getColumnListUrl())) { if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) {
writer = new StringWriter(); writer = new StringWriter();
mobileTemplate.process(null, writer); mobileTemplate.process(null, writer);
tag = new TagParser(writer.toString(),parserParams); tag = new TagParser(writer.toString(),parserParams);
...@@ -204,11 +207,11 @@ public class CmsParserUtil extends ParserUtil { ...@@ -204,11 +207,11 @@ public class CmsParserUtil extends ParserUtil {
// 文章编号 // 文章编号
int articleId = articleIdList.get(artId).getArticleId(); int articleId = articleIdList.get(artId).getArticleId();
// 文章的栏目路径 // 文章的栏目路径
String articleColumnPath = articleIdList.get(artId).getColumnPath(); String articleColumnPath = articleIdList.get(artId).getCategoryPath();
// 文章的模板路径 // 文章的模板路径
String columnUrl = articleIdList.get(artId).getColumnUrl(); String columnUrl = articleIdList.get(artId).getCategoryUrl();
// 文章的栏目模型编号 // 文章的栏目模型编号
int columnContentModelId = articleIdList.get(artId).getColumnContentModelId(); String columnContentModelId = articleIdList.get(artId).getMdiyModelId();
// 文章是否已经生成了,生成了就跳过 // 文章是否已经生成了,生成了就跳过
if (generateIds.contains(articleId)) { if (generateIds.contains(articleId)) {
artId++; artId++;
...@@ -225,20 +228,20 @@ public class CmsParserUtil extends ParserUtil { ...@@ -225,20 +228,20 @@ public class CmsParserUtil extends ParserUtil {
// 组合文章路径如:html/站点id/栏目id/文章id.html // 组合文章路径如:html/站点id/栏目id/文章id.html
writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + articleId); writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + articleId);
//如果是封面就生成index.html //如果是封面就生成index.html
if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {
writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX); writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX);
} }
Map<String, Object> parserParams = new HashMap<String, Object>(); Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) { if (StringUtils.isNotBlank(columnContentModelId)) {
// 通过当前栏目的模型编号获取,自定义模型表名 // 通过当前栏目的模型编号获取,自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) { if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(TABLE_NAME, contentModel.getCmTableName()); parserParams.put(TABLE_NAME, contentModel.getCmTableName());
} else { } else {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class)
.getEntity(columnContentModelId); .getEntity(Integer.parseInt(columnContentModelId));
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); contentModelMap.put(columnContentModelId, contentModel.getCmTableName());
parserParams.put(TABLE_NAME, contentModel.getCmTableName()); parserParams.put(TABLE_NAME, contentModel.getCmTableName());
...@@ -265,13 +268,13 @@ public class CmsParserUtil extends ParserUtil { ...@@ -265,13 +268,13 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(IS_DO, false); parserParams.put(IS_DO, false);
parserParams.put(ParserUtil.PAGE, page); parserParams.put(ParserUtil.PAGE, page);
String content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, false); String content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, false);
FileUtil.writeString(content, writePath, Const.UTF8); FileUtil.writeString(content, writePath, Const.UTF8);
// 手机端 // 手机端
if (ParserUtil.hasMobileFile(columnUrl)) { if (ParserUtil.hasMobileFile(columnUrl)) {
writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId); writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId);
//如果是封面就生成index.html //如果是封面就生成index.html
if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {
writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX); writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX);
} }
// 判断文件是否存在,若不存在弹出返回信息 // 判断文件是否存在,若不存在弹出返回信息
...@@ -280,7 +283,7 @@ public class CmsParserUtil extends ParserUtil { ...@@ -280,7 +283,7 @@ public class CmsParserUtil extends ParserUtil {
continue; continue;
} }
parserParams.put(MOBILE, BasicUtil.getApp().getAppMobileStyle()); parserParams.put(MOBILE, BasicUtil.getApp().getAppMobileStyle());
content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, true); content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, true);
FileUtil.writeString(content, writePath, Const.UTF8); FileUtil.writeString(content, writePath, Const.UTF8);
} }
artId++; artId++;
......
<!DOCTYPE html> {ms:channel ref=one}
<html> [field.typetitle/]
<head> {ms:arclist refs=one}
<#include "head-file.htm"> [field.title/]<br>
<link rel="stylesheet" type="text/css" href="{ms:global.host/}/plugins/bootstrap/3.3.5/css/bootstrap.min.css"> [field.author/]<br>
<script type="text/javascript" src="{ms:global.host/}/plugins/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
var ms = {
base:"http://store.mingsoft.net"
}
</script>
<script src="http://store.mingsoft.net/api/ms.web.mstore.js"></script>
</head>
<body>
<#include "head.htm">
<!-- <div class="ms-banner">
<img src="./images/banner.jpg">
</div> -->
<div id="indexVue">
<div id="banner_tabs" class="flexslider">
<ul class="slides">
<template v-for="banner in bannerList">
<li style="background:url({ms:global.host/}/{ms:global.style/}/images/03.jpg) no-repeat center;">
<p class="banner_tit animated fadeInLeft">铭飞MS平台</p>
<p class="banner_des animated fadeInRight">MCms系统永久完整开源</p>
</li>
<li style="background:url({ms:global.host/}/{ms:global.style/}/images/03.jpg) no-repeat center;">
<p class="banner_tit animated fadeInLeft">MStore</p>
<p class="banner_des animated fadeInRight">丰富强大的功能插件、海量精美的行业模板</p>
</li>
<li style="background:url({ms:global.host/}/{ms:global.style/}/images/03.jpg) no-repeat center;">
<p class="banner_tit animated fadeInLeft">优质的服务体验</p>
<p class="banner_des animated fadeInRight">人工远程协助服务、永久享受更新升级</p>
</li>
</template>
</ul>
<ul class="flex-direction-nav">
<li>
<a class="flex-prev" href="javascript:;">Previous</a>
</li>
<li>
<a class="flex-next" href="javascript:;">Next</a>
</li>
</ul>
</div>
<div class="ms-content-index">
<div class="ms-content-template">
<div>
<ul class="nav nav-tabs ms-index-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#model" aria-controls="model" role="tab" data-toggle="tab">模板</a>
</li>
<li role="presentation">
<a href="#plug" aria-controls="plug" role="tab" data-toggle="tab">插件</a>
</li>
</ul>
<div class="ms-content-all">
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="model">
<div style="display: none;" class="ms-loading" v-show="!loading">
<img src="{ms:global.host/}/{ms:global.style/}/images/loading.gif" />
</div>
<div class="ms-model-content" style="display: none;" v-show="loading">
<template v-for="model in modelList">
<div class="ms-model-list">
<a class="ms-model-img" :href="model.upgraderVersionUrl" target="_blank">
<img @mouseout="imgMout()" @mouseover="imgMover()" :src="'http://store.mingsoft.net/'+model.upgraderVersionImg" onerror="this.src='{ms:global.host/}/{ms:global.style/}/images/no-data.png'" />
</a>
<div class="ms-model-mobile-img" v-if="model.upgraderVersionMobileImg != '' && model.upgraderVersionMobileImg != undefined" style="background: url({ms:global.host/}/{ms:global.style/}/images/mobile.png)">
<div>
<img @mouseout="imgMout()" @mouseover="imgMover()" :src="'http://store.mingsoft.net/'+model.upgraderVersionMobileImg" onerror="this.src='{ms:global.host/}/{ms:global.style/}/images/no-data.png'" />
</div>
</div>
<div class="ms-model-info">
<span v-text="model.upgraderVersionName"></span>
<img class="ms-model-info-img" :src="model.upgraderVersionPeopleIcon" onerror="this.src='http://cdn.mingsoft.net/global/images/msheader.png'" />
<img :src="'{ms:global.host/}/{ms:global.style/}/images/level-'+model.upgraderVersionStart+'.png'" />
<div class="ms-model-type">模板</div>
</div>
</div>
</template>
<div class="ms-model-list" style="display: none;" v-show="loading">
<div class="ms-model-more">
<div onclick="window.open('http://store.mingsoft.net/mstoreShow.do')">查看更多</div>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="plug">
<div class="ms-model-content" style="display: none;" v-show="loading">
<template v-for="pulg in pulgList">
<div class="ms-model-list">
<a class="ms-model-img" :href="pulg.upgraderVersionUrl" target="_blank">
<img :src="'http://store.mingsoft.net/'+pulg.upgraderVersionImg" onerror="this.src='{ms:global.host/}/{ms:global.style/}/images/no-data.png'" />
</a>
<div class="ms-model-info">
<span v-text="pulg.upgraderVersionName"></span>
<img class="ms-model-info-img" :src="pulg.upgraderVersionPeopleIcon" onerror="this.src='http://cdn.mingsoft.net/global/images/msheader.png'" />
<img :src="'{ms:global.host/}/{ms:global.style/}/images/level-'+pulg.upgraderVersionStart+'.png'" />
<div class="ms-model-type">插件</div>
</div>
</div>
</template>
<div class="ms-model-list" style="display: none;" v-show="loading">
<div class="ms-model-more">
<div onclick="window.open('http://store.mingsoft.net/mstoreShow.do')">查看更多</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ms-content-case">
<div class="ms-content-case-mian">
<div class="ms-content-case-title">
<div class="ms-content-case-title-words">网站案例</div>
<div class="ms-content-case-more">
<a href='{ms:global.url/}/149/index.html'>MORE>></a>
</div>
</div>
<div class="ms-content-case-list">
{ms:arclist typeid=149 size=6}
<div class="ms-content-main-case">
<div class="ms-content-main-case-img">
<img src="{ms:global.host/}[field.litpic/]">
</div>
<div class="ms-content-main-case-explain">
<div class="ms-content-main-case-title">[field.title/]</div>
<div class="ms-content-main-case-content">
<p class="ms-content-main-case-written">
[field.content/]
</p>
</div>
<div class="ms-content-main-case-click">
<a target="_blank" href="[field.source/]">点击查看</a>
</div>
</div>
</div>
{/ms:arclist} {/ms:arclist}
</div> {/ms:channel}
</div> \ No newline at end of file
</div>
<div class="ms-content-product">
<div class="ms-content-product-main">
<div class="ms-content-product-title">
<div class="ms-content-product-title-words">产品方向</div>
</div>
<div class="ms-content-product-list">
<ul class="ms-content-product-list-ul">
<li>
<div class="ms-content-product-list-img">
<a target="_blank" href="http://www.mingsoft.net/html/1/5523/index.html">
<img src="http://www.mingsoft.net/templets/1/ming-soft//images/hu1.png"></a>
</div>
<div class="ms-content-product-list-content">
<div class="ms-content-product-list-content-title">
<a target="_blank" href="http://www.mingsoft.net/html/1/5523/index.html">铭飞建站系统MCMS</a></div>
<div class="ms-content-product-list-content-describe">纯Java开发,MCMS支持PC与MOBILE皮肤定制,同时使用MS团队移动JS插件,支持站群。</div></div>
</li>
<li>
<div class="ms-content-product-list-img">
<a target="_blank" href="http://www.mingsoft.net/html/1/5524/index.html">
<img src="http://www.mingsoft.net/templets/1/ming-soft//images/hu2.jpg"></a>
</div>
<div class="ms-content-product-list-content">
<div class="ms-content-product-list-content-title">
<a target="_blank" href="http://www.mingsoft.net/html/1/5524/index.html">移动互联网</a></div>
<div class="ms-content-product-list-content-describe">重新定义移动开发,快速、开放、高性能,数据无缝对接,超过500个模块api 接口,方便实现各种应用。</div></div>
</li>
<li>
<div class="ms-content-product-list-img">
<a target="_blank" href="http://www.mingsoft.net/html/1/5526/index.html">
<img src="http://www.mingsoft.net/templets/1/ming-soft//images/hu3.jpg"></a>
</div>
<div class="ms-content-product-list-content">
<div class="ms-content-product-list-content-title">
<a target="_blank" href="http://www.mingsoft.net/html/1/5526/index.html">铭飞物联网</a></div>
<div class="ms-content-product-list-content-describe">MS+物联网,让生产企业真正掌握企业命脉,实现互联网+生产,给企业插上信息化翅膀,共享、共荣大数据时代</div></div>
</li>
</ul>
</div>
</div>
</div>
<div class="ms-content-news">
<div class="ms-content-news-main">
<div class="ms-content-news-main-title">
<div class="ms-content-news-main-title-words">公司动态</div>
<div class="ms-content-news-main-title-more">
<a href='{ms:global.url/}/59/index.html'>MORE>></a>
</div>
</div>
<div class="ms-content-news-main-img-text">
{ms:arclist typeid=59 size=1}
<img src="{ms:global.host/}[field.litpic/]">
{/ms:arclist}
<ul class="ms-content-news-main-ul">
{ms:arclist typeid=59 size=6}
<li>
<a href="{ms:global.url/}[field.link/]">
<div class="ms-content-news-main-li-title">
<!-- <span class="ms-content-news-main-li-span">·</span> -->
<span class="">[field.title/]</span>
</div>
<div class="ms-content-news-main-li-time">[field.date?string("yyyy-mm-dd")/]</div>
</a>
</li>
{/ms:arclist}
</ul>
</div>
</div>
</div>
</div>
</div>
<#include "footer.htm">
</body>
</html>
<script type="text/javascript">
var index = new Vue({
el: "#indexVue",
data: {
bannerList: ['01', '02', '03', '04', '05'], //幻灯片列表
modelList: [], //模板列表
pulgList: [], //插件列表
loading: false, //加载状态
},
methods: {
query: function(data, type) {
var target = this;
ms.web.mstore.list(data, function(json) {
if(type == 'model') {
target.modelList = json.list;
} else {
target.pulgList = json.list;
target.loading = true;
}
});
},
imgMover: function() {
var _this = event.target;
var ms_top = ($(_this).height()) - 275;
if(ms_top < 0) {
ms_top = 0;
}
$(_this).stop(true);
$(_this).animate({
"top": -(ms_top)
}, 2500);
},
imgMout: function() {
var _this = event.target;
$(_this).stop(true);
$(_this).animate({
"top": 0
}, 2500);
},
},
mounted: function() {
var data = "upgraderVersionType=2&upgraderVersionIndustry=0&orderBy=uv_id&pageSize=5&pageNo=1";
this.query(data, 'model');
var data = "upgraderVersionType=1&upgraderVersionIndustry=0&orderBy=uv_id&pageSize=5&pageNo=1";
this.query(data, 'pulg');
/*幻灯*/
setTimeout(function() {
var bannerSlider = new Slider($('#banner_tabs'), {
time: 5000,
delay: 400,
event: 'hover',
auto: true,
mode: 'fade',
controller: $('#bannerCtrl'),
activeControllerCls: 'active'
});
$('#banner_tabs .flex-prev').click(function() {
bannerSlider.prev()
});
$('#banner_tabs .flex-next').click(function() {
bannerSlider.next()
});
}, 300)
},
})
</script>
\ No newline at end of file
Supports Markdown
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