新增用户管理和vpn服务器ip功能
This commit is contained in:
37
src/main/java/com/nis/domain/basics/IpReuseIpCfg.java
Normal file
37
src/main/java/com/nis/domain/basics/IpReuseIpCfg.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
*@Title: DnsIpConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description 欺骗IP实体类
|
||||
*@author dell
|
||||
*@date 2018年2月5日 下午2:57:17
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsIpConfig.java
|
||||
* @author (dell)
|
||||
* @date 2018年2月5日 下午2:57:17
|
||||
* @version V1.0
|
||||
*/
|
||||
public class IpReuseIpCfg extends BaseIpCfg {
|
||||
|
||||
private static final long serialVersionUID = 5956694477140186483L;
|
||||
private String tableName="user_ip_cfg";
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
import org.apache.ibatis.cache.CacheKey;
|
||||
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
|
||||
@@ -65,7 +66,7 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
private List<AvContUrlCfg> avContUrlCfgList;
|
||||
private BaseStringCfg strCfg;
|
||||
private ComplexkeywordCfg complexCfg;
|
||||
|
||||
private List<IpReuseIpCfg> ipReuseIpCfgs;
|
||||
private Long dnsStrategyId;
|
||||
@ExcelField(title="policy_name",sort=21)
|
||||
private String dnsStrategyName;
|
||||
@@ -94,6 +95,12 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
public Integer getSourceCompileId() {
|
||||
return sourceCompileId;
|
||||
}
|
||||
public List<IpReuseIpCfg> getIpReuseIpCfgs() {
|
||||
return ipReuseIpCfgs;
|
||||
}
|
||||
public void setIpReuseIpCfgs(List<IpReuseIpCfg> ipReuseIpCfgs) {
|
||||
this.ipReuseIpCfgs = ipReuseIpCfgs;
|
||||
}
|
||||
public void setSourceCompileId(Integer sourceCompileId) {
|
||||
this.sourceCompileId = sourceCompileId;
|
||||
}
|
||||
|
||||
283
src/main/java/com/nis/domain/configuration/UserManage.java
Normal file
283
src/main/java/com/nis/domain/configuration/UserManage.java
Normal file
@@ -0,0 +1,283 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
|
||||
public class UserManage extends BaseEntity<UserManage>{
|
||||
|
||||
private static final long serialVersionUID = -2749633756272829982L;
|
||||
|
||||
private static final String tableName="user_manage";
|
||||
private String userName;
|
||||
private String userPwd;
|
||||
private String serverIp;
|
||||
private String authMethod;
|
||||
private Integer numLogins;
|
||||
private String lastLogin;
|
||||
private String transferBytes;
|
||||
private String transferPackets;
|
||||
private Long creatorId;
|
||||
private Date createTime;
|
||||
private Long editorId;
|
||||
private Date editTime;
|
||||
private Integer isValid;
|
||||
private String remarks;
|
||||
|
||||
private String newUserPwd;
|
||||
private String oldUserName;//原用户名
|
||||
//用户名详细信息
|
||||
private String authType;
|
||||
private Date createOn;
|
||||
private Date updatedOn;
|
||||
private String outgoingUnicastPackets;
|
||||
private String outgoingUnicastTotalSize;
|
||||
private String outgoingBroadcastPackets;
|
||||
private String outgoingBroadcastTotalSize;
|
||||
private String incomingUnicastPackets;
|
||||
private String incomingUnicastTotalSize;
|
||||
private String incomingBroadcastPackets;
|
||||
private String incomingBroadcastTotalSize;
|
||||
private Integer numberOfLogins;
|
||||
|
||||
private String creatorName;
|
||||
private String editorName;
|
||||
private Date search_create_time_start;
|
||||
private Date search_create_time_end;
|
||||
private Date search_edit_time_start;
|
||||
private Date search_edit_time_end;
|
||||
|
||||
private String seltype;
|
||||
private Integer functionId;
|
||||
private String isAudit;
|
||||
|
||||
public String getIsAudit() {
|
||||
return isAudit;
|
||||
}
|
||||
public void setIsAudit(String isAudit) {
|
||||
this.isAudit = isAudit;
|
||||
}
|
||||
public String getOldUserName() {
|
||||
return oldUserName;
|
||||
}
|
||||
public void setOldUserName(String oldUserName) {
|
||||
this.oldUserName = oldUserName;
|
||||
}
|
||||
|
||||
public String getNewUserPwd() {
|
||||
return newUserPwd;
|
||||
}
|
||||
public void setNewUserPwd(String newUserPwd) {
|
||||
this.newUserPwd = newUserPwd;
|
||||
}
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
public Integer getFunctionId() {
|
||||
return functionId;
|
||||
}
|
||||
public void setFunctionId(Integer functionId) {
|
||||
this.functionId = functionId;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Long getCreatorId() {
|
||||
return creatorId;
|
||||
}
|
||||
public void setCreatorId(Long creatorId) {
|
||||
this.creatorId = creatorId;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Long getEditorId() {
|
||||
return editorId;
|
||||
}
|
||||
public void setEditorId(Long editorId) {
|
||||
this.editorId = editorId;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
public String getEditorName() {
|
||||
return editorName;
|
||||
}
|
||||
public void setEditorName(String editorName) {
|
||||
this.editorName = editorName;
|
||||
}
|
||||
public Date getSearch_create_time_start() {
|
||||
return search_create_time_start;
|
||||
}
|
||||
public void setSearch_create_time_start(Date search_create_time_start) {
|
||||
this.search_create_time_start = search_create_time_start;
|
||||
}
|
||||
public Date getSearch_create_time_end() {
|
||||
return search_create_time_end;
|
||||
}
|
||||
public void setSearch_create_time_end(Date search_create_time_end) {
|
||||
this.search_create_time_end = search_create_time_end;
|
||||
}
|
||||
public Date getSearch_edit_time_start() {
|
||||
return search_edit_time_start;
|
||||
}
|
||||
public void setSearch_edit_time_start(Date search_edit_time_start) {
|
||||
this.search_edit_time_start = search_edit_time_start;
|
||||
}
|
||||
public Date getSearch_edit_time_end() {
|
||||
return search_edit_time_end;
|
||||
}
|
||||
public void setSearch_edit_time_end(Date search_edit_time_end) {
|
||||
this.search_edit_time_end = search_edit_time_end;
|
||||
}
|
||||
public String getSeltype() {
|
||||
return seltype;
|
||||
}
|
||||
public void setSeltype(String seltype) {
|
||||
this.seltype = seltype;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public String getUserPwd() {
|
||||
return userPwd;
|
||||
}
|
||||
public void setUserPwd(String userPwd) {
|
||||
this.userPwd = userPwd;
|
||||
}
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
public void setServerIp(String serverIp) {
|
||||
this.serverIp = serverIp;
|
||||
}
|
||||
public String getAuthMethod() {
|
||||
return authMethod;
|
||||
}
|
||||
public void setAuthMethod(String authMethod) {
|
||||
this.authMethod = authMethod;
|
||||
}
|
||||
public Integer getNumLogins() {
|
||||
return numLogins;
|
||||
}
|
||||
public void setNumLogins(Integer numLogins) {
|
||||
this.numLogins = numLogins;
|
||||
}
|
||||
public String getLastLogin() {
|
||||
return lastLogin;
|
||||
}
|
||||
public void setLastLogin(String lastLogin) {
|
||||
this.lastLogin = lastLogin;
|
||||
}
|
||||
public String getTransferBytes() {
|
||||
return transferBytes;
|
||||
}
|
||||
public void setTransferBytes(String transferBytes) {
|
||||
this.transferBytes = transferBytes;
|
||||
}
|
||||
public String getTransferPackets() {
|
||||
return transferPackets;
|
||||
}
|
||||
public void setTransferPackets(String transferPackets) {
|
||||
this.transferPackets = transferPackets;
|
||||
}
|
||||
public String getAuthType() {
|
||||
return authType;
|
||||
}
|
||||
public void setAuthType(String authType) {
|
||||
this.authType = authType;
|
||||
}
|
||||
public Date getCreateOn() {
|
||||
return createOn;
|
||||
}
|
||||
public void setCreateOn(Date createOn) {
|
||||
this.createOn = createOn;
|
||||
}
|
||||
public Date getUpdatedOn() {
|
||||
return updatedOn;
|
||||
}
|
||||
public void setUpdatedOn(Date updatedOn) {
|
||||
this.updatedOn = updatedOn;
|
||||
}
|
||||
public String getOutgoingUnicastPackets() {
|
||||
return outgoingUnicastPackets;
|
||||
}
|
||||
public void setOutgoingUnicastPackets(String outgoingUnicastPackets) {
|
||||
this.outgoingUnicastPackets = outgoingUnicastPackets;
|
||||
}
|
||||
public String getOutgoingUnicastTotalSize() {
|
||||
return outgoingUnicastTotalSize;
|
||||
}
|
||||
public void setOutgoingUnicastTotalSize(String outgoingUnicastTotalSize) {
|
||||
this.outgoingUnicastTotalSize = outgoingUnicastTotalSize;
|
||||
}
|
||||
public String getOutgoingBroadcastPackets() {
|
||||
return outgoingBroadcastPackets;
|
||||
}
|
||||
public void setOutgoingBroadcastPackets(String outgoingBroadcastPackets) {
|
||||
this.outgoingBroadcastPackets = outgoingBroadcastPackets;
|
||||
}
|
||||
public String getOutgoingBroadcastTotalSize() {
|
||||
return outgoingBroadcastTotalSize;
|
||||
}
|
||||
public void setOutgoingBroadcastTotalSize(String outgoingBroadcastTotalSize) {
|
||||
this.outgoingBroadcastTotalSize = outgoingBroadcastTotalSize;
|
||||
}
|
||||
|
||||
public String getIncomingUnicastPackets() {
|
||||
return incomingUnicastPackets;
|
||||
}
|
||||
public void setIncomingUnicastPackets(String incomingUnicastPackets) {
|
||||
this.incomingUnicastPackets = incomingUnicastPackets;
|
||||
}
|
||||
public String getIncomingUnicastTotalSize() {
|
||||
return incomingUnicastTotalSize;
|
||||
}
|
||||
public void setIncomingUnicastTotalSize(String incomingUnicastTotalSize) {
|
||||
this.incomingUnicastTotalSize = incomingUnicastTotalSize;
|
||||
}
|
||||
public String getIncomingBroadcastPackets() {
|
||||
return incomingBroadcastPackets;
|
||||
}
|
||||
public void setIncomingBroadcastPackets(String incomingBroadcastPackets) {
|
||||
this.incomingBroadcastPackets = incomingBroadcastPackets;
|
||||
}
|
||||
public String getIncomingBroadcastTotalSize() {
|
||||
return incomingBroadcastTotalSize;
|
||||
}
|
||||
public void setIncomingBroadcastTotalSize(String incomingBroadcastTotalSize) {
|
||||
this.incomingBroadcastTotalSize = incomingBroadcastTotalSize;
|
||||
}
|
||||
public Integer getNumberOfLogins() {
|
||||
return numberOfLogins;
|
||||
}
|
||||
public void setNumberOfLogins(Integer numberOfLogins) {
|
||||
this.numberOfLogins = numberOfLogins;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -103,6 +103,7 @@ import com.nis.web.service.RoleService;
|
||||
import com.nis.web.service.SystemService;
|
||||
import com.nis.web.service.UserService;
|
||||
import com.nis.web.service.basics.AsnIpCfgService;
|
||||
import com.nis.web.service.basics.IpReuseIpCfgService;
|
||||
import com.nis.web.service.basics.PolicyGroupInfoService;
|
||||
import com.nis.web.service.basics.ServiceDictInfoService;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
@@ -132,6 +133,7 @@ import com.nis.web.service.configuration.NumCfgService;
|
||||
import com.nis.web.service.configuration.ProxyFileStrategyService;
|
||||
import com.nis.web.service.configuration.PxyObjKeyringService;
|
||||
import com.nis.web.service.configuration.RequestInfoService;
|
||||
import com.nis.web.service.configuration.UserManageService;
|
||||
import com.nis.web.service.configuration.WebsiteCfgService;
|
||||
import com.nis.web.service.configuration.XmppCfgService;
|
||||
import com.nis.web.service.configuration.statistics.ConfigureStatisticsService;
|
||||
@@ -254,6 +256,11 @@ public class BaseController {
|
||||
protected CachePolicyService cachePolicyService;
|
||||
@Autowired
|
||||
protected ConfigSynchronizationService configSynchronizationService;
|
||||
|
||||
@Autowired
|
||||
protected UserManageService userManageService;
|
||||
@Autowired
|
||||
protected IpReuseIpCfgService ipReuseIpCfgService;
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/vpn")
|
||||
public class IpReuseIpCfgController extends BaseController{
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")IpReuseIpCfg entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<IpReuseIpCfg> page = ipReuseIpCfgService.findPage(new Page<IpReuseIpCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
model.addAttribute("regionList", regionList);
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
return "/basics/userIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
public String addForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
initFormCondition(model,cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/userIpCfgFormAdd";
|
||||
}
|
||||
@RequestMapping(value = {"/updateForm"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String updateForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")IpReuseIpCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
cfg = ipReuseIpCfgService.getUserIpCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model,cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/userIpCfgFormUpdate";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String saveBgpCfg(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,String ids,CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
try{
|
||||
ipReuseIpCfgService.save(entity);;
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = {"/update"})
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpReuseIpCfg cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
ipReuseIpCfgService.update(cfg);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
ipReuseIpCfgService.delete(isValid,ids);
|
||||
addMessage(redirectAttributes,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证登录名是否有效
|
||||
* @param oldLoginName
|
||||
* @param loginName
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:manage:edit")
|
||||
@RequestMapping(value = "checkIp")
|
||||
public String checkIp(String oldDestIpAddress, String destIpAddress) {
|
||||
if (destIpAddress !=null && destIpAddress.equals(oldDestIpAddress)) {
|
||||
return "true";
|
||||
} else if (destIpAddress !=null && ipReuseIpCfgService.getIpByIp(destIpAddress) == null) {
|
||||
return "true";
|
||||
}
|
||||
return "false";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.nis.web.controller.configuration.maintenance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/userManage")
|
||||
public class UserManageController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
@RequiresPermissions(value={"user:manage:view"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")UserManage entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<UserManage> page = userManageService.findPage(new Page<UserManage>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
// initPageCondition(model,entity);
|
||||
return "/cfg/maintenance/userManage/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入用户添加或修改页面
|
||||
* @param user
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"form"})
|
||||
@RequiresPermissions(value={"user:manage:config"})
|
||||
public String form(UserManage user, Model model,String ids) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
user = userManageService.getUserById(ids);
|
||||
}
|
||||
model.addAttribute("user", user);
|
||||
return "/cfg/maintenance/userManage/userForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"user:manage:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
userManageService.delete(isValid,ids);
|
||||
addMessage(redirectAttributes,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"user:manage:config"})
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,String ids,UserManage entity
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
try{
|
||||
userManageService.save(entity,model,request);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证登录名是否有效
|
||||
* @param oldLoginName
|
||||
* @param loginName
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:manage:edit")
|
||||
@RequestMapping(value = "checkLoginName")
|
||||
public String checkLoginName(String oldUserName, String userName) {
|
||||
if (userName !=null && userName.equals(oldUserName)) {
|
||||
return "true";
|
||||
} else if (userName !=null && userManageService.getUserByLoginName(userName) == null) {
|
||||
return "true";
|
||||
}
|
||||
return "false";
|
||||
}
|
||||
|
||||
/**
|
||||
* 父节点选择树形结构
|
||||
* @param extId排除节点id
|
||||
* @param isShowHide
|
||||
* @param isLeafShow:叶子节点是否显示
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "treeData")
|
||||
public List<Map<String, Object>> treeData(@RequestParam(required=false)Boolean specific,@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
|
||||
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
|
||||
List<Map<String, Object>> mapList = Lists.newArrayList();
|
||||
Map<String, Object> map2 = Maps.newHashMap();
|
||||
map2.put("id", 0);
|
||||
map2.put("pId", 0);
|
||||
map2.put("groupId",0);
|
||||
map2.put("name","root_node");
|
||||
mapList.add(map2);
|
||||
IpReuseIpCfg ip=new IpReuseIpCfg();
|
||||
ip.setFunctionId(636);
|
||||
List<IpReuseIpCfg> list=ipReuseIpCfgService.findList(ip);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
IpReuseIpCfg ipReuseIpCfg=list.get(i);
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
map.put("id", ipReuseIpCfg.getDestIpAddress());
|
||||
map.put("pId", 0);
|
||||
map.put("name",ipReuseIpCfg.getDestIpAddress());
|
||||
mapList.add(map);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "userInfo")
|
||||
public List<UserManage> getUserInfo(String serverIp,HttpServletRequest request,HttpServletResponse response){
|
||||
String[] ipArray = serverIp.split(",");
|
||||
List<UserManage> userManageList=new ArrayList<UserManage>();
|
||||
for(String ip :ipArray){
|
||||
UserManage user=new UserManage();
|
||||
IpReuseIpCfg ipReuseIpCfg=ipReuseIpCfgService.getIpByIp(ip);
|
||||
//根据ip调用接口获取数据
|
||||
//user=userManageService.getUserManage(ip, request);
|
||||
if(ipReuseIpCfg!=null){
|
||||
user.setServerIp(ipReuseIpCfg.getDestIpAddress());
|
||||
user.setRemarks(ipReuseIpCfg.getCfgDesc());
|
||||
userManageList.add(user);
|
||||
}
|
||||
}
|
||||
return userManageList;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "view")
|
||||
@RequiresPermissions(value={"user:manage:config"})
|
||||
public String view(String serverIp,String userName,HttpServletResponse response,Model model){
|
||||
UserManage user=new UserManage();
|
||||
user=userManageService.getUserByLoginName(userName);
|
||||
IpReuseIpCfg ipReuseIpCfg=ipReuseIpCfgService.getIpByIp(serverIp);
|
||||
if(ipReuseIpCfg!=null){
|
||||
user.setServerIp(ipReuseIpCfg.getDestIpAddress());
|
||||
user.setRemarks(ipReuseIpCfg.getCfgDesc());
|
||||
}
|
||||
model.addAttribute("user", user);
|
||||
return "/cfg/maintenance/userManage/userView";
|
||||
}
|
||||
}
|
||||
17
src/main/java/com/nis/web/dao/basics/IpReuseIpCfgDao.java
Normal file
17
src/main/java/com/nis/web/dao/basics/IpReuseIpCfgDao.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface IpReuseIpCfgDao extends CrudDao<IpReuseIpCfg> {
|
||||
List<IpReuseIpCfg> findPage(IpReuseIpCfg userIpCfg);
|
||||
IpReuseIpCfg getUserIpCfg(Long cfgId);
|
||||
IpReuseIpCfg getIpByIp(String destIpAddress);
|
||||
}
|
||||
360
src/main/java/com/nis/web/dao/basics/IpReuseIpCfgDao.xml
Normal file
360
src/main/java/com/nis/web/dao/basics/IpReuseIpCfgDao.xml
Normal file
@@ -0,0 +1,360 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.basics.IpReuseIpCfgDao">
|
||||
<resultMap id="reuserIpCfgMap" type="com.nis.domain.basics.IpReuseIpCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
|
||||
,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address
|
||||
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
|
||||
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
|
||||
r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable
|
||||
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.dns_strategy_id
|
||||
</sql>
|
||||
|
||||
<select id="findPage" resultMap="reuserIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
from ip_reuse_ip_cfg r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join request_info ri on r.request_id=ri.id
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="cfgRegionCode != null">
|
||||
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="ipType != null">
|
||||
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="ipPattern != null">
|
||||
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''">
|
||||
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''">
|
||||
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="portPattern != null">
|
||||
AND r.PORT_PATTERN=#{portPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort !=''">
|
||||
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destPort != null and destPort !=''">
|
||||
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="direction != null">
|
||||
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocolId != null">
|
||||
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName !=''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorName != null and editorName !=''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName !=''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime !=''">
|
||||
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify !=''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute !=''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable !=''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
|
||||
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getUserIpCfg" resultMap="reuserIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from ip_reuse_ip_cfg r
|
||||
where r.is_valid !=-1 and r.cfg_id=#{cfgId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.IpReuseIpCfg" >
|
||||
insert into ip_reuse_ip_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
ip_type,
|
||||
src_ip_address,
|
||||
ip_pattern,
|
||||
port_pattern,
|
||||
src_port,
|
||||
protocol,
|
||||
protocol_id,
|
||||
direction,
|
||||
dest_port,
|
||||
dest_ip_address,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
dns_strategy_id
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{ipType,jdbcType=INTEGER},
|
||||
#{srcIpAddress,jdbcType=VARCHAR},
|
||||
#{ipPattern,jdbcType=INTEGER},
|
||||
#{portPattern,jdbcType=INTEGER},
|
||||
#{srcPort,jdbcType=VARCHAR},
|
||||
#{protocol,jdbcType=INTEGER},
|
||||
#{protocolId,jdbcType=INTEGER},
|
||||
#{direction,jdbcType=INTEGER},
|
||||
#{destPort,jdbcType=VARCHAR},
|
||||
#{destIpAddress,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{dnsStrategyId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.IpReuseIpCfg" >
|
||||
update ip_reuse_ip_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="compileId != null" >
|
||||
COMPILE_ID = #{compileId,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ipType != null" >
|
||||
ip_type = #{ipType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''" >
|
||||
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="ipPattern != null" >
|
||||
ip_pattern = #{ipPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="portPattern != null" >
|
||||
port_pattern = #{portPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort != ''" >
|
||||
src_port = #{srcPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="protocol != null" >
|
||||
protocol = #{protocol,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="protocolId != null" >
|
||||
protocol_id = #{protocolId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="direction != null" >
|
||||
direction = #{direction,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="destPort != null and destPort != ''" >
|
||||
dest_port = #{destPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''" >
|
||||
dest_ip_address = #{destIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="dnsStrategyId != null " >
|
||||
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
<select id="getIpByIp" resultMap="reuserIpCfgMap">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from ip_reuse_ip_cfg r where r.is_valid !=-1 and r.dest_ip_address=#{destIpAddress}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface UserManageDao extends CrudDao<UserManage>{
|
||||
void saveInfo(UserManage entity);
|
||||
void updateInfo(UserManage entity);
|
||||
UserManage getUserByLoginName(@Param("userName") String userName);
|
||||
List<UserManage> findList(UserManage entity);
|
||||
UserManage getUserById(@Param("id") String id);
|
||||
}
|
||||
145
src/main/java/com/nis/web/dao/configuration/UserManageDao.xml
Normal file
145
src/main/java/com/nis/web/dao/configuration/UserManageDao.xml
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.UserManageDao">
|
||||
|
||||
<resultMap id="userManageMap" type="com.nis.domain.configuration.UserManage" >
|
||||
<id column="id" property="id" jdbcType="INTEGER"/>
|
||||
<result column="user_name" property="userName" jdbcType="VARCHAR"/>
|
||||
<result column="user_pwd" property="userPwd" jdbcType="VARCHAR"/>
|
||||
<result column="server_ip" property="serverIp" jdbcType="VARCHAR"/>
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER"/>
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="remarks" property="remarks" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Columns">
|
||||
r.ID,r.USER_NAME,r.USER_PWD,r.SERVER_IP,r.is_audit,
|
||||
r.IS_VALID,r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,remarks
|
||||
</sql>
|
||||
|
||||
<select id="findList" parameterType="com.nis.domain.configuration.UserManage" resultMap="userManageMap">
|
||||
SELECT
|
||||
<include refid="Columns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name ,e.name as editor_name
|
||||
</trim>
|
||||
FROM user_manage r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.is_valid=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.is_valid != -1
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND r.user_name like concat(concat('%',#{userName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serverIp != null and serverIp != ''">
|
||||
AND r.server_ip like concat(concat('%',#{serverIp,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
AND r.remarks like concat(concat('%',#{remarks,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<!-- <if test="creatorName != null and creatorName != ''">
|
||||
AND r.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if> -->
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.UserManage">
|
||||
insert into user_manage(
|
||||
USER_NAME,
|
||||
USER_PWD,
|
||||
SERVER_IP,
|
||||
IS_VALID,
|
||||
is_audit,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
remarks
|
||||
)values (
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
#{userPwd,jdbcType=VARCHAR},
|
||||
#{serverIp,jdbcType=VARCHAR},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{remarks,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.configuration.UserManage">
|
||||
update user_manage
|
||||
<set>
|
||||
<trim suffixOverrides=",">
|
||||
<if test="userName != null and userName != ''" >
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userPwd != null and userPwd != ''">
|
||||
user_pwd=#{userPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="serverIp != null and serverIp != ''" >
|
||||
server_ip = #{serverIp,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''" >
|
||||
remarks = #{remarks,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getUserByLoginName" resultMap="userManageMap">
|
||||
select
|
||||
<include refid="Columns"/>
|
||||
from user_manage r where is_valid !=-1 and r.user_name=#{userName}
|
||||
</select>
|
||||
<select id="getUserById" resultMap="userManageMap">
|
||||
select
|
||||
<include refid="Columns"/>
|
||||
from user_manage r where r.is_valid !=-1 and r.id=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.basics.IpReuseIpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 音视频文本
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class IpReuseIpCfgService extends BaseService{
|
||||
@Autowired
|
||||
protected IpReuseIpCfgDao ipReuseIpCfgDao;
|
||||
|
||||
|
||||
public Page<IpReuseIpCfg> findPage(Page page, IpReuseIpCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<IpReuseIpCfg> list=ipReuseIpCfgDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<IpReuseIpCfg> findList(IpReuseIpCfg entity){
|
||||
List<IpReuseIpCfg> list=ipReuseIpCfgDao.findPage(entity);
|
||||
return list;
|
||||
}
|
||||
public IpReuseIpCfg getUserIpCfg(Long cfgId) {
|
||||
return ipReuseIpCfgDao.getUserIpCfg(cfgId);
|
||||
}
|
||||
|
||||
public IpReuseIpCfg getIpByIp(String destIpAddress) {
|
||||
return ipReuseIpCfgDao.getIpByIp(destIpAddress);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void save(CfgIndexInfo entity){
|
||||
Date createTime=new Date();
|
||||
for(IpReuseIpCfg cfg:entity.getIpReuseIpCfgs()) {
|
||||
if(cfg.getCfgId()==null){
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
ipReuseIpCfgDao.insert(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update(IpReuseIpCfg entity){
|
||||
Date editTime=new Date();
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
ipReuseIpCfgDao.update(entity);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isValid,String ids){
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
IpReuseIpCfg entity = new IpReuseIpCfg();
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
ipReuseIpCfgDao.update(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.dao.configuration.UserManageDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class UserManageService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
protected UserManageDao userManageDao;
|
||||
|
||||
public Page<UserManage> findPage(Page<UserManage> page, UserManage entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<UserManage> list=userManageDao.findList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public UserManage getUserByLoginName(String userName) {
|
||||
return userManageDao.getUserByLoginName(userName);
|
||||
}
|
||||
|
||||
public UserManage getUserById(String id) {
|
||||
return userManageDao.getUserById(id);
|
||||
}
|
||||
|
||||
public void save(UserManage entity,Model model, HttpServletRequest request){
|
||||
Date createTime=new Date();
|
||||
if(entity.getId()==null){
|
||||
try {
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
userManageDao.insert(entity);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
//cgi接口添加
|
||||
/*String[] ipArray = entity.getServerIp().split(",");
|
||||
for(String ip :ipArray){
|
||||
//循环调用接口增加
|
||||
String url="?cmd=UserCreate&server_ip="+ip+"&user_name="+entity.getUserName()+"&user_pwd="+entity.getUserPwd();
|
||||
System.out.println(url);
|
||||
}*/
|
||||
}else{
|
||||
entity.setEditTime(createTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
//获取修改之前数据
|
||||
UserManage olduser=userManageDao.getUserById(String.valueOf(entity.getId()));
|
||||
userManageDao.update(entity);
|
||||
//cgi接口删除旧数据
|
||||
/*String[] ipArray = olduser.getServerIp().split(",");
|
||||
for(String ip :ipArray){
|
||||
//循环调用接口删除
|
||||
String url="?cmd=UserDelete&server_ip="+ip+"&user_name="+olduser.getUserName();
|
||||
System.out.println(url);
|
||||
}*/
|
||||
if(StringUtil.isEmpty(entity.getUserName())){
|
||||
entity.setUserName(olduser.getUserName());
|
||||
}
|
||||
if(StringUtil.isEmpty(entity.getUserPwd())){
|
||||
entity.setUserPwd(olduser.getUserPwd());
|
||||
}
|
||||
/*String[] newIpArray = entity.getServerIp().split(",");
|
||||
for(String newIp :newIpArray){
|
||||
//循环调用接口添加
|
||||
String url="?cmd=UserCreate&server_ip="+newIp+"&user_name="+entity.getUserName()+"&user_pwd="+entity.getUserPwd();
|
||||
System.out.println(url);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
//根据vpn服务器ip获取用户vpn服务器ip信息
|
||||
public UserManage getUserManage(String serverIp,HttpServletRequest request){
|
||||
UserManage user=new UserManage();
|
||||
/*Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("server_ip", serverIp);
|
||||
try{
|
||||
String url ="URL"+ Constants.NTC_IP_REUSE_USER_LIST;
|
||||
String recv = HttpClientUtil.getUserMsg(url, params, request);
|
||||
logger.info("查询结果:" + recv);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<UserManage> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<UserManage>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
}*/
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isValid,String ids){
|
||||
String[] idArray = ids.split(",");
|
||||
List<UserManage> userList=new ArrayList<UserManage>();
|
||||
for(String id :idArray){
|
||||
UserManage entity = new UserManage();
|
||||
entity=userManageDao.getUserById(id);
|
||||
if(entity!=null){
|
||||
userList.add(entity);
|
||||
}
|
||||
entity.setId(Long.valueOf(id));
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
userManageDao.update(entity);
|
||||
}
|
||||
//cgi接口删除旧数据
|
||||
for (int i = 0; i < userList.size(); i++) {
|
||||
String[] ipArray = userList.get(i).getServerIp().split(",");
|
||||
for(String ip :ipArray){
|
||||
//循环调用接口删除
|
||||
String url="?cmd=UserDelete&server_ip="+ip+"&user_name="+userList.get(i).getUserName();
|
||||
System.out.println(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user