新开分支整理代码:
1.帮助文档修改功能 2.帮助文档与上一版对比功能 3.单点问题解决 4.markdown帮助文档 Conflicts: src/main/resources/messages/message_en.properties src/main/resources/messages/message_ru.properties src/main/resources/messages/message_zh_CN.properties
This commit is contained in:
@@ -1,23 +1,31 @@
|
||||
package com.nis.web.controller;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.configuration.HelpInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.HelpInfoService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/sys/")
|
||||
public class SystemController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private HelpInfoService helpService;
|
||||
@RequestMapping("index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response,ModelMap model){
|
||||
return "/sys/sysIndex";
|
||||
@@ -91,6 +99,9 @@ public class SystemController extends BaseController{
|
||||
System.out.println(menu.getParentIds());
|
||||
newList.add(menu);
|
||||
}*/
|
||||
//将帮助文档缓存到redis
|
||||
helpService.cacheAllHelpInfo();
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -100,6 +111,91 @@ public class SystemController extends BaseController{
|
||||
model.addAttribute("menuList",newList);
|
||||
return "/help";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param editedHelpInfo 修改之后的帮助文档内容
|
||||
* @param helpHrefVal 文档的路径
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("saveHelp")
|
||||
@ResponseBody
|
||||
public boolean saveHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="editedHelpInfo")String editedHelpInfo,@RequestParam(required=true,value="helpHrefVal")String helpHrefVal){
|
||||
if(StringUtils.strIsBlank(helpHrefVal)){
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
StringBuffer helpInfoText=new StringBuffer(); //修改之后的内容
|
||||
helpInfoText.append(URLDecoder.decode(editedHelpInfo,"utf-8"));
|
||||
String helpHref=URLDecoder.decode(helpHrefVal,"utf-8");
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = new HelpInfo();
|
||||
helpInfo.setFileComment(helpInfoText.toString());
|
||||
helpInfo.setFileName(split[split.length-1]);
|
||||
helpService.saveHelpInfo(helpInfo);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("save helpInfo error",e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 查看帮助文档内容
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param helpHref
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("viewHelp")
|
||||
@ResponseBody
|
||||
public HelpInfo viewHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="helpHref")String helpHref){
|
||||
|
||||
if(StringUtils.strIsBlank(helpHref)){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
helpHref=URLDecoder.decode(helpHref,"utf-8");
|
||||
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = helpService.findHelpCommentByName(split[split.length-1]);
|
||||
return helpInfo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("view helpInfo error",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 查看帮助文档备份内容
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param helpHref
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("viewBakHelp")
|
||||
@ResponseBody
|
||||
public HelpInfo viewBakHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="helpHref")String helpHref){
|
||||
|
||||
if(StringUtils.strIsBlank(helpHref)){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
helpHref=URLDecoder.decode(helpHref,"utf-8");
|
||||
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = helpService.findHelpBakCommentByName(split[split.length-1]);
|
||||
return helpInfo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("view helpBakInfo error",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user