Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
@@ -10,8 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/ip")
|
||||
public class IpCfgController {
|
||||
|
||||
public class IpCfgController extends BaseController{
|
||||
// @Autowired
|
||||
// protected IpCfgService ipCfgService;
|
||||
|
||||
@RequestMapping(value = {"ipWhiteList"})
|
||||
public String ipWhiteList() {
|
||||
@@ -24,15 +37,75 @@ public class IpCfgController {
|
||||
return "/cfg/ipWhiteForm";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"ipBlockList"})
|
||||
public String ipBlockList() {
|
||||
public String ipBlockList(Model model,BaseIpCfg baseIpCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
if(baseIpCfg!=null){
|
||||
Integer serviceId=baseIpCfg.getServiceId();
|
||||
logger.info("sercice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
baseIpCfg.setTableName(tableName);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(new Page<BaseIpCfg>(request, response, 1), baseIpCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/ipBlockList";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"ipBlockForm"})
|
||||
public String ipBlockForm() {
|
||||
public String ipBlockForm(Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
logger.info("sercice id is "+serviceId);
|
||||
System.out.println("ipBlockForm loaded");
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=ipCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=BaseIpCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得BaseIpCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
BaseIpCfg ipcfg=(BaseIpCfg)clazz.newInstance();
|
||||
ipcfg.setTableName(tableName);
|
||||
ipcfg.initDefaultValue();
|
||||
model.addAttribute("_ipCfg", ipcfg);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/ipBlockForm";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* addIpPortCfg(新增IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(method=RequestMethod.POST,value = {"addIpCfg"})
|
||||
public String addIpCfg(@ModelAttribute("ipCfg") BaseIpCfg ipCfg) {
|
||||
if(ipCfg!=null&&!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
int result=ipCfgService.addIpCfg(ipCfg);
|
||||
}
|
||||
return "/cfg/ipBlockForm";
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryName;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/configuration/serviceDictInfo")
|
||||
public class ServiceDictInfoController extends BaseController {
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public ServiceDictInfo get(@RequestParam(required=false) Integer serviceDictId) {
|
||||
if (!StringUtil.isEmpty(serviceDictId)){
|
||||
return serviceDictInfoService.getDictById(serviceDictId);
|
||||
}else{
|
||||
return new ServiceDictInfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据serviceDictId查出配置对象
|
||||
* @param serviceDictId
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "loadDataDict")
|
||||
public ServiceDictInfo loadDataDict(@RequestParam(required=false) Integer serviceDictId,HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
|
||||
return serviceDictInfoService.getDictById(serviceDictId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-业务字典信息列表
|
||||
* @param serviceDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findDictList(new Page<ServiceDictInfo>(request, response), serviceDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/serviceDictList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"form"})
|
||||
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/serviceDictInfo";
|
||||
}
|
||||
return "/cfg/serviceDictForm";
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
serviceDictInfoService.deleteDict(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isShowHide是否显示隐藏菜单
|
||||
* @param extId
|
||||
* @param isShowHidden
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("user")
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "treeData")
|
||||
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide, HttpServletResponse response) {
|
||||
List<Map<String, Object>> mapList = Lists.newArrayList();
|
||||
List<ServiceDictInfo> list = serviceDictInfoService.findAllDict();
|
||||
for (int i=0; i<list.size(); i++){
|
||||
ServiceDictInfo serviceDictInfo = list.get(i);
|
||||
if (StringUtils.isBlank(extId) || (extId !=null && !extId.equals(serviceDictInfo.getServiceDictId().toString()))) {
|
||||
if(isShowHide != null && isShowHide.equals("0") && serviceDictInfo.getIsValid().equals(0)){
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
map.put("id", serviceDictInfo.getServiceDictId());
|
||||
map.put("pId", serviceDictInfo.getParent().getServiceDictId());
|
||||
map.put("name",serviceDictInfo.getItemValue());
|
||||
mapList.add(map);
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//标签配置
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"markForm"})
|
||||
public String markForm(ServiceDictInfo serviceDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/serviceDictMarkInfo";
|
||||
}
|
||||
return "/cfg/serviceDictMarkForm";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-业务字典信息列表
|
||||
* @param serviceDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"markList"})
|
||||
public String markList(ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findDictMarkList(new Page<ServiceDictInfo>(request, response), serviceDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/serviceDictMarkList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "markSaveOrUpdate")
|
||||
public String markSaveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/markList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"markDelete"})
|
||||
public String markDelete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
serviceDictInfoService.deleteDict(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/markList";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.SysDictInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/configuration/sysDictInfo")
|
||||
public class SysDictInfoController extends BaseController {
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public SysDictInfo get(@RequestParam(required=false) Integer sysDictId) {
|
||||
if (!StringUtil.isEmpty(sysDictId)){
|
||||
return sysDictInfoService.getDictById(sysDictId);
|
||||
}else{
|
||||
return new SysDictInfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据sysDictId查出配置对象
|
||||
* @param sysDictId
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "loadDataDict")
|
||||
public SysDictInfo loadDataDict(@RequestParam(required=false) Integer sysDictId,HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
|
||||
return sysDictInfoService.getDictById(sysDictId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-生效范围系统字典信息列表
|
||||
* @param sysDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(SysDictInfo sysDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<SysDictInfo> page = sysDictInfoService.findDictList(new Page<SysDictInfo>(request, response), sysDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/sysDictList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"form"})
|
||||
public String form(SysDictInfo sysDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/sysDictInfo";
|
||||
}
|
||||
return "/cfg/sysDictForm";
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
sysDictInfoService.saveOrUpdate(sysDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/sysDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
sysDictInfoService.deleteDict(sysDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/sysDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user