diff --git a/WebRoot/i18n/globalMessages_zh_CN.properties b/WebRoot/i18n/globalMessages_zh_CN.properties index b6fbbf6..6fe6091 100644 --- a/WebRoot/i18n/globalMessages_zh_CN.properties +++ b/WebRoot/i18n/globalMessages_zh_CN.properties @@ -19,7 +19,7 @@ main.message.stateInfo2=全部成功 main.message.stateInfo3=全部失败 main.message.stateInfo4=部分成功 main.message.info=下列任务已完成 -main.text.logout=退出视图 +main.text.logout=退出 main.text.systemSelect=视图切换 main.text.welcome=您好 main.text.systemName=当前视图 diff --git a/src/conf/myconfig.properties b/src/conf/myconfig.properties index 189b604..ec1f466 100644 --- a/src/conf/myconfig.properties +++ b/src/conf/myconfig.properties @@ -11,8 +11,8 @@ email.password = wwr@intranet email.host = 10.0.6.100 #file save path uploadServerPath=D:/Java/apache-tomcat-7.0.61-windows-x86/webapps/nmsweb/download/ -common.ssl.ks = D:/Java/apache-tomcat-7.0.61-windows-x86/webapps/nmsweb/WEB-INF/classes/ssl/client_ks -common.ssl.ts = D:/Java/apache-tomcat-7.0.61-windows-x86/webapps/nmsweb/WEB-INF/classes/ssl/client_ts +common.ssl.ks = C:\\Users\\Administrator\\git\\nmsweb\\src\\conf\\ssl\\client_ks +common.ssl.ts = C:\\Users\\Administrator\\git\\nmsweb\\src\\conf\\ssl\\client_ts #-- common.single.socket.port = 60702 common.ssl.socket.port = 60703 @@ -84,14 +84,19 @@ nextval_function_name=nextval currval_function_name=currval nation.role.jsbh=224 +#若系统为rc系统,配置此配置,菜单显示为rc的菜单 值为分中心角色id +#region.role.jsbh=21 dept.mk.id=280 #1:open 0:close -nms.report.open=1 +nms.report.open=0 #unit:s nms.report.interval=20 nms.status.setId=7 nms.status.url=http\://192.168.11.64\:8080/galaxy-service/service/nms/v1/saveServerStatus nms.port.url=http\://192.168.11.64\:8080/galaxy-service/service/nms/v1/rafficNetflowPortInfo -nms.rule.url=http\://192.168.11.64\:8080/galaxy-service/service/nms/v1/saveNmsDiRule \ No newline at end of file +nms.rule.url=http\://192.168.11.64\:8080/galaxy-service/service/nms/v1/saveNmsDiRule + +default.nodeGroupId=100000 +prefabricate.view=100000,100003,100004,100005,100006,100007,100033,100035,100037 \ No newline at end of file diff --git a/src/nis/nms/core/Constants.java b/src/nis/nms/core/Constants.java index 2374c6d..419c93e 100644 --- a/src/nis/nms/core/Constants.java +++ b/src/nis/nms/core/Constants.java @@ -236,7 +236,15 @@ public class Constants { public static final String DEPT_MK_ID; public static final String PREFABRICATE_VIEW; + + public static final String REGION_ROLE; static { + if(rb.containsKey("region.role.jsbh")){ + REGION_ROLE=rb.getString("region.role.jsbh"); + }else{ + REGION_ROLE="-1"; + } + if(rb.containsKey("prefabricate.view")){ PREFABRICATE_VIEW=rb.getString("prefabricate.view"); }else{ diff --git a/src/nis/nms/web/Test.java b/src/nis/nms/web/Test.java index 73fbcfa..9be2c13 100644 --- a/src/nis/nms/web/Test.java +++ b/src/nis/nms/web/Test.java @@ -2,71 +2,53 @@ package nis.nms.web; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; -import java.io.InputStream; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; import org.apache.log4j.Logger; - public class Test { - static Logger logger=Logger.getLogger(Test.class); + static Logger logger = Logger.getLogger(Test.class); + public static void main(String[] args) { - File zh=new File("D:\\Workspaces\\wwrWork\\nmsweb\\WebRoot\\i18n\\globalMessages_zh_CN.properties"); - File ru=new File("D:\\Workspaces\\wwrWork\\nmsweb\\WebRoot\\i18n\\globalMessages_ru_RU.properties"); - if(!zh.exists()||!ru.exists()){ - logger.error("文件未找到"); - return ; - } + + File out = new File("D:\\wwr\\ru.txt"); + File ru = new File("D:\\wwr\\ru翻译-181017.txt"); + try { - BufferedReader zhReader=new BufferedReader(new FileReader(zh)); - BufferedReader ruReader=new BufferedReader(new FileReader(ru)); - - String zhLine=null; - String ruLine=null; - - int rowNum=0; - - while((zhLine=zhReader.readLine())!=null&&(ruLine=ruReader.readLine())!=null){ - if(zhLine.startsWith("#")||ruLine.startsWith("#")){ - rowNum++; - continue; - } - rowNum++; - - if(rowNum==4348){ - System.out.println("bug点"); - } - String[] zhSplit=zhLine.split("="); - String[] ruSplit=ruLine.split("="); - - if((zhSplit==null||zhSplit.length<2)||(ruSplit==null||ruSplit.length<2)){ - if(zhLine.equals(ruLine)){ - continue; - }else{ - logger.error("此行不匹配:"+rowNum); - return ; + BufferedReader ruReader = new BufferedReader(new FileReader(ru)); + BufferedReader outReader = new BufferedReader(new FileReader(out)); + Properties ruProp = new Properties(); + ruProp.load(ruReader); + Properties outProp = new Properties(); + outProp.load(outReader); + + Set> entrySet = ruProp.entrySet(); + for (Entry entry : entrySet) { + String key = (String) entry.getKey(); + String zhValue = outProp.getProperty(key); + String ruValue = ruProp.getProperty(key); + if (zhValue != null) { + System.out.println("#########" + zhValue + "#############"); + Set> outEntrySet = outProp.entrySet(); + for (Entry entry2 : outEntrySet) { + String temp = (String) entry2.getValue(); + + if (zhValue.equals(temp)) { + System.out.println((String) entry2.getKey() + "--> " + ruValue); + } + } - - } - - String zhKey=zhSplit[0]; - String ruKey=ruSplit[0]; - - if(zhKey.equals(ruKey)){ - continue; - }else{ - logger.error("行不匹配:"+rowNum); - return ; } } - - } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } } diff --git a/src/nis/nms/web/actions/LoginAction.java b/src/nis/nms/web/actions/LoginAction.java index caebaa0..00a193e 100644 --- a/src/nis/nms/web/actions/LoginAction.java +++ b/src/nis/nms/web/actions/LoginAction.java @@ -30,169 +30,159 @@ import nis.nms.util.Constant; import nis.nms.util.MD5; import nis.nms.util.OnlineListener; - - @SuppressWarnings("unchecked") -@Results( { - @Result(name="ok", value = "/main.jsp"), - //updateUserPassword.jsp - ///modifyPwd.jsp - @Result(name="modifyPwd", value="/page/system/fourceModifyUserPwd.jsp"), - @Result(name="systemSelect", value = "systemSelect.jsp"), - @Result(name="back", value = "/login.jsp"), - @Result(name="logout", value = "/login.jsp?i18n_lang=${i18n_lang}"), - @Result(name="test", value = "2.jsp"), - @Result(name = "error", value = "/error.jsp") -}) +@Results({ @Result(name = "ok", value = "/main.jsp"), + // updateUserPassword.jsp + /// modifyPwd.jsp + @Result(name = "modifyPwd", value = "/page/system/fourceModifyUserPwd.jsp"), + @Result(name = "systemSelect", value = "systemSelect.jsp"), @Result(name = "back", value = "/login.jsp"), + @Result(name = "logout", value = "/login.jsp?i18n_lang=${i18n_lang}"), @Result(name = "test", value = "2.jsp"), + @Result(name = "error", value = "/error.jsp") }) public class LoginAction extends BaseAction { - + private static final long serialVersionUID = 1L; private CommonService commonService; private XtYhJbxx logInInfo; private List userInfoList = new ArrayList(); - public String executeAction() throws Exception { return login(); } - + public String login() { try { - if(logInInfo!=null){ + if (logInInfo != null) { MD5 md5 = new MD5(); - //用户使用用户代码和用户密码登陆 - String sql = " from XtYhJbxx where yhbh = '" + logInInfo.getYhmc().trim() + "' and yhmm = '" + md5.getMD5Code(logInInfo.getYhmm().trim()) +"' "; + // 用户使用用户代码和用户密码登陆 + String sql = " from XtYhJbxx where yhbh = '" + logInInfo.getYhmc().trim() + "' and yhmm = '" + + md5.getMD5Code(logInInfo.getYhmm().trim()) + "' "; userInfoList = this.commonService.find(sql); - if(userInfoList != null && userInfoList.size() > 0){ - XtYhJbxx userInfo = (XtYhJbxx)userInfoList.get(0); - if(userInfo.getZxbz().equals("1")){ - outHtmlString(""); + if (userInfoList != null && userInfoList.size() > 0) { + XtYhJbxx userInfo = (XtYhJbxx) userInfoList.get(0); + if (userInfo.getZxbz().equals("1")) { + outHtmlString( + ""); return null; } - - //判断部门 - /*2018-09-19新增根据deptflag判断是否启用用户部门管理 0:启用 1:不启用*/ - Long deptflag =(Long) this.getRequest().getSession().getAttribute(Constant.DEPT_FLAG); + + // 判断部门 + /* 2018-09-19新增根据deptflag判断是否启用用户部门管理 0:启用 1:不启用 */ + Long deptflag = (Long) this.getRequest().getSession().getAttribute(Constant.DEPT_FLAG); try { - if(deptflag==null){ - sql="select t.type_state from type_table t where t.type_identity = ?"; + if (deptflag == null) { + sql = "select t.type_state from type_table t where t.type_identity = ?"; List list = this.commonService.executeSQL(sql, "deptflag"); - if(list!=null&&list.size()>0){ + if (list != null && list.size() > 0) { deptflag = ((BigDecimal) list.get(0)).longValue(); - }else{ - deptflag=1L; + } else { + deptflag = 1L; } - System.out.println("是否启用部门管理功能:"+(deptflag==0?"启用":"关闭")); + System.out.println("是否启用部门管理功能:" + (deptflag == 0 ? "启用" : "关闭")); this.getRequest().getSession().setAttribute(Constant.DEPT_FLAG, deptflag); } - + } catch (Exception e) { - System.out.println("get dept flag faild"+e); + System.out.println("get dept flag faild" + e); } - - - if(!"admin".equalsIgnoreCase(userInfo.getYhbh())&&deptflag==0){ + + if (!"admin".equalsIgnoreCase(userInfo.getYhbh()) && deptflag == 0) { XtYhJbxx checkDeptUser = this.getYhJbxx(userInfo); List ll = checkDeptUser.getUserDeptList(); boolean isDeptstate = false; - if(ll!=null && ll.size()>0){ - for(int g=0;g 0) { + for (int g = 0; g < ll.size(); g++) { + TableDepartment td = (TableDepartment) ll.get(g); + if (td.getDeptstate().equals("0")) { isDeptstate = true; break; } } } - - if(!isDeptstate){//false说明此用户所在部门全部无效,故禁止登录 - outHtmlString(""); + + if (!isDeptstate) {// false说明此用户所在部门全部无效,故禁止登录 + outHtmlString( + ""); return null; } } - - - HttpSession session = getRequest().getSession(true); // true + + HttpSession session = getRequest().getSession(true); // true this.getRequest().getSession().removeAttribute(Constant.SESSION_SYSTEM_LOGIN); this.getRequest().getSession().removeAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME); - + try { - /*2018-08-30将 是否启用邮件标识 加入session*/ - Long emailFlag = (Long)this.getRequest().getSession().getAttribute(Constant.EMAIL_FLAG); - - if(emailFlag==null){ - sql="select t.type_state from type_table t where t.type_identity = ?"; + /* 2018-08-30将 是否启用邮件标识 加入session */ + Long emailFlag = (Long) this.getRequest().getSession().getAttribute(Constant.EMAIL_FLAG); + + if (emailFlag == null) { + sql = "select t.type_state from type_table t where t.type_identity = ?"; List list = this.commonService.executeSQL(sql, "emailflag"); - if(list!=null&&list.size()>0){ + if (list != null && list.size() > 0) { emailFlag = ((BigDecimal) list.get(0)).longValue(); - }else{ - emailFlag=1L; + } else { + emailFlag = 1L; } - System.out.println("是否启用邮件功能:"+(emailFlag==0?"启用":"关闭")); + System.out.println("是否启用邮件功能:" + (emailFlag == 0 ? "启用" : "关闭")); this.getRequest().getSession().setAttribute(Constant.EMAIL_FLAG, emailFlag); } - + } catch (Exception e) { - System.out.println("get email flag faild"+e); + System.out.println("get email flag faild" + e); } - - /*2018-09-12新增配置属性NATION_ROLE,标识管理角色*/ + + /* 2018-09-12新增配置属性NATION_ROLE,标识管理角色 */ this.getRequest().getSession().setAttribute("nationRole", Constants.NATION_ROLE); // 判断重复登陆 - if (XtYhJbxx.LONGIN_USER != null) - {// 存在在线用户 + if (XtYhJbxx.LONGIN_USER != null) {// 存在在线用户 boolean isLogin = false; if (XtYhJbxx.LONGIN_USER.contains(userInfo.getYhid())) isLogin = true; - if (isLogin)//在线用户中包括正在登陆的用户 + if (isLogin)// 在线用户中包括正在登陆的用户 { -// if(this.getIsSingleLogin()==0){//启用单点登录 -// outHtmlString(""); -// this.saveLoginRpt("重复登录,失败","登入",userInfo.getYhmc());//记录登陆日志 -// return null; -// } - HttpSession sessionold = (HttpSession) XtYhJbxx.LOGIN_SESSION - .get(userInfo.getYhid());// 如果用户已经登录,则取出之前登录的session信息 - try - { - if (sessionold != null) - { - if(!session.getId().equals(sessionold.getId())){//如果新的sessionid不等于旧的sessionid(新打开浏览器) - if(this.getIsSingleLogin()==0){//启用单点登录 + // if(this.getIsSingleLogin()==0){//启用单点登录 + // outHtmlString(""); + // this.saveLoginRpt("重复登录,失败","登入",userInfo.getYhmc());//记录登陆日志 + // return null; + // } + HttpSession sessionold = (HttpSession) XtYhJbxx.LOGIN_SESSION.get(userInfo.getYhid());// 如果用户已经登录,则取出之前登录的session信息 + try { + if (sessionold != null) { + if (!session.getId().equals(sessionold.getId())) {// 如果新的sessionid不等于旧的sessionid(新打开浏览器) + if (this.getIsSingleLogin() == 0) {// 启用单点登录 sessionold.invalidate();// 将旧的session信息销毁 } - }else {//处理登录登出异常操作 - XtYhJbxx user = (XtYhJbxx) session.getAttribute(Constant.SESSION_CZY_NAME);//获取之前登录用户的session - if(!userInfo.getYhid().equals(user.getYhid())){//对比之前登录的用户与当前登录用户是否相同 + } else {// 处理登录登出异常操作 + XtYhJbxx user = (XtYhJbxx) session.getAttribute(Constant.SESSION_CZY_NAME);// 获取之前登录用户的session + if (!userInfo.getYhid().equals(user.getYhid())) {// 对比之前登录的用户与当前登录用户是否相同 XtYhJbxx.LOGIN_SESSION.remove(user.getYhid());// 从session列表信息中移除 XtYhJbxx.LONGIN_USER.remove(user.getYhid());// 将之前的用户信息从登录用户信息列表中移除 - }else{ - //新增是否首次使用密码判断如果是首次使用密码则必须先修改密码才可进入操作系统 + } else { + // 新增是否首次使用密码判断如果是首次使用密码则必须先修改密码才可进入操作系统 int ischeck = checkPwdState(userInfo.getYhbh()); - if(ischeck == 0){ + if (ischeck == 0) { logInInfo.setYhid(userInfo.getYhid()); logInInfo.setYhbh(userInfo.getYhbh()); logInInfo.setYhmc(userInfo.getYhmc()); return "modifyPwd"; - }else if(ischeck == 1){ - if(session.getAttribute(Constant.SESSION_SYSTEM_LOGIN)!=null){ - //进入系统界面 + } else if (ischeck == 1) { + if (session.getAttribute(Constant.SESSION_SYSTEM_LOGIN) != null) { + // 进入系统界面 return "ok"; - }else{ - //获取可访问的业务系统 + } else { + // 获取可访问的业务系统 toSystemSelect(userInfo.getYhbh()); } } } - + } } - //if(this.getIsSingleLogin()==0){//启用单点登录 - XtYhJbxx.LOGIN_SESSION.remove(userInfo.getYhid());// 从session列表信息中移除 - XtYhJbxx.LONGIN_USER.remove(userInfo.getYhid());// 将之前的用户信息从登录用户信息列表中移除 - //} - } catch (Exception e) - { + // if(this.getIsSingleLogin()==0){//启用单点登录 + XtYhJbxx.LOGIN_SESSION.remove(userInfo.getYhid());// 从session列表信息中移除 + XtYhJbxx.LONGIN_USER.remove(userInfo.getYhid());// 将之前的用户信息从登录用户信息列表中移除 + // } + } catch (Exception e) { e.printStackTrace(); System.out.println("sessionold已经过期"); XtYhJbxx.LOGIN_SESSION.remove(userInfo.getYhid());// 从session列表信息中移除 @@ -200,120 +190,140 @@ public class LoginAction extends BaseAction { } } XtYhJbxx.LONGIN_USER.add(userInfo.getYhid());// 将新用户写入在线用户信息中 - } else - {// 没有在线用户 + } else {// 没有在线用户 XtYhJbxx.LONGIN_USER = new ArrayList(); - XtYhJbxx.LONGIN_USER.add(userInfo.getYhid());//将新用户写入在线用户信息中 + XtYhJbxx.LONGIN_USER.add(userInfo.getYhid());// 将新用户写入在线用户信息中 } - + session.setAttribute("loginYhid", userInfo.getYhid()); session.setAttribute("userBgColor", userInfo.getBgColor()); session.setAttribute("YHBH", userInfo.getYhbh()); - if(!StringUtil.isBlank(userInfo.getLanguage())){//将用户的语言存入session中 - String lang=userInfo.getLanguage(); + if (!StringUtil.isBlank(userInfo.getLanguage())) {// 将用户的语言存入session中 + String lang = userInfo.getLanguage(); String[] split = lang.split("_"); Locale locale = new Locale(split[0], split[1]); session.setAttribute("i18n_lang", locale); } session.setAttribute(Constant.SESSION_CZY_NAME, this.getYhJbxx(userInfo)); - XtYhJbxx.LOGIN_SESSION.put(userInfo.getYhid(),session);//将session保存起来 - //把session加入监听器 + XtYhJbxx.LOGIN_SESSION.put(userInfo.getYhid(), session);// 将session保存起来 + // 把session加入监听器 OnlineListener.createsession(new HttpSessionEvent(session)); session.setAttribute("treeList", this.getYhJsMk(userInfo.getYhbh())); - //System.out.println("sessionid = " + this.getRequest().getSession().getId()); - //记录登陆日志 - this.saveLoginRpt("i18n_LoginAction.login.success_n81i","i18n_LoginAction.login.in_n81i",userInfo.getYhmc()); + // System.out.println("sessionid = " + + // this.getRequest().getSession().getId()); + // 记录登陆日志 + this.saveLoginRpt("i18n_LoginAction.login.success_n81i", "i18n_LoginAction.login.in_n81i", + userInfo.getYhmc()); // 查询菜单树 QueryMenuTreeAction query = new QueryMenuTreeAction(commonService); List> userfunctionList = null; - if (logInInfo.getYhmc() != null && "admin".equals(logInInfo.getYhmc().trim())){ + if (logInInfo.getYhmc() != null && "admin".equals(logInInfo.getYhmc().trim())) { userfunctionList = query.queryMenuTree(logInInfo.getYhmc().trim(), null); } else { if (userInfo != null) { - userfunctionList = query.queryMenuTree(null,this.getUser().getYhbh()); - }else{ + userfunctionList = query.queryMenuTree(null, this.getUser().getYhbh()); + } else { return "error"; } } - if(userfunctionList==null || userfunctionList.size()==0){ - this.saveLoginRpt("i18n_LoginAction.login.noPermission_n81i","i18n_LoginAction.login.in_n81i",logInInfo.getYhmc());//记录登陆日志 - outHtmlString(""); - //outHtmlString(""); + if (userfunctionList == null || userfunctionList.size() == 0) { + this.saveLoginRpt("i18n_LoginAction.login.noPermission_n81i", "i18n_LoginAction.login.in_n81i", + logInInfo.getYhmc());// 记录登陆日志 + outHtmlString( + ""); + // outHtmlString(""); return null; } // 用户所要功能权限 add by ghh session.setAttribute("userfunctionList", userfunctionList); - LinkedList> userfunctionList2 = new LinkedList>(); + LinkedList> userfunctionList2 = new LinkedList>(); userfunctionList2.addAll(userfunctionList); -// List> userfunctionList2 = (List>) ((LinkedList>)userfunctionList).clone(); + // List> userfunctionList2 = + // (List>) + // ((LinkedList>)userfunctionList).clone(); String treeStr = query.makeMenuTree(userfunctionList2); - //System.out.println(userInfoTemp.getNickname()+":treeXML\t" + treeStr); - if(session.getAttribute("treeStr")!=null){ + // System.out.println(userInfoTemp.getNickname()+":treeXML\t" + // + treeStr); + if (session.getAttribute("treeStr") != null) { session.removeAttribute("treeStr"); } session.setAttribute("treeStr", treeStr); session.setAttribute("treeHtml", query.getMenuHtml(treeStr)); - //新增是否首次使用密码判断如果是首次使用密码则必须先修改密码才可进入操作系统 + // 新增是否首次使用密码判断如果是首次使用密码则必须先修改密码才可进入操作系统 int ischeck = checkPwdState(userInfo.getYhbh()); - if(ischeck == 0){ + if (ischeck == 0) { logInInfo.setYhid(userInfo.getYhid()); logInInfo.setYhbh(userInfo.getYhbh()); logInInfo.setYhmc(userInfo.getYhmc()); return "modifyPwd"; - }else if(ischeck == 1){ - //新增业务系统登陆判断systemLogin - if(session.getAttribute(Constant.SESSION_SYSTEM_LOGIN)==null){//跳转到业务系统选择页面 - + } else if (ischeck == 1) { + // 新增业务系统登陆判断systemLogin + if (session.getAttribute(Constant.SESSION_SYSTEM_LOGIN) == null) {// 跳转到业务系统选择页面 + return toSystemSelect(userInfo.getYhbh()); - }else {//进入系统界面 + } else {// 进入系统界面 return "ok"; } - }else{ + } else { session.invalidate(); } } - }else{ + } else { return "back"; } - + } catch (Exception e) { -// e.printStackTrace(); -// outHtmlString(""); - this.saveLoginRpt("i18n_LoginAction.login.unpredictableErr_n81i","i18n_LoginAction.login.in_n81i",logInInfo.getYhmc());//记录登陆日志 - outHtmlString(""); - //outHtmlString(""); + // e.printStackTrace(); + // outHtmlString(""); + this.saveLoginRpt("i18n_LoginAction.login.unpredictableErr_n81i", "i18n_LoginAction.login.in_n81i", + logInInfo.getYhmc());// 记录登陆日志 + outHtmlString( + ""); + // outHtmlString(""); return null; } - this.saveLoginRpt("用户名或密码错误","i18n_LoginAction.login.in_n81i",logInInfo.getYhmc());//记录登陆日志 - outHtmlString(""); - //outHtmlString(""); + this.saveLoginRpt("用户名或密码错误", "i18n_LoginAction.login.in_n81i", logInInfo.getYhmc());// 记录登陆日志 + outHtmlString( + ""); + // outHtmlString(""); return null; } - private String toSystemSelect(String yhbh){ + + private String toSystemSelect(String yhbh) { try { - List stList = new ArrayList(); - if(yhbh != null && !"".equals(yhbh)){ - if("admin".equals(yhbh.trim())){ + List stList = new ArrayList(); + if (yhbh != null && !"".equals(yhbh)) { + if ("admin".equals(yhbh.trim())) { this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN, -1l); this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, "ALL"); return "ok"; - }else{ - - stList = this.commonService - .executeSQL("select DISTINCT(st.system_Id),st.system_Name,st.is_master " + - "from system_table st " + - "left join Gorup_System_Table gst on gst.system_Id = st.system_Id " + - "left join Xt_Yh_Js_Index xyji on xyji.jsbh = gst.user_Group_Id " + - "left join XT_JS_JBXX xjj on xjj.jsbh = xyji.jsbh " + - "where xyji.yhbh='" + yhbh.trim() + - "' and st.system_state = 0 and xyji.type=1 and xjj.zxbz=0 " +//业务系统启用+角色类型为用户组+用户组有效 - "order by st.system_Id"); - //国家中心人员具有 查看所有业务系统 数据的权限 - List list = this.commonService.executeSQL("SELECT jsbh FROM xt_yh_js_index where yhbh = ?", yhbh.trim()); - if(list != null && list.size() > 0){ - for(String obj : list){ - if(StringUtils.isNotBlank(obj)){ - if((Constants.NATION_ROLE.trim()).equals(obj.trim())){ + } else { + + stList = this.commonService.executeSQL( + "select DISTINCT(st.system_Id),st.system_Name,st.is_master " + "from system_table st " + + "left join Gorup_System_Table gst on gst.system_Id = st.system_Id " + + "left join Xt_Yh_Js_Index xyji on xyji.jsbh = gst.user_Group_Id " + + "left join XT_JS_JBXX xjj on xjj.jsbh = xyji.jsbh " + "where xyji.yhbh='" + + yhbh.trim() + "' and st.system_state = 0 and xyji.type=1 and xjj.zxbz=0 " + // 业务系统启用+角色类型为用户组+用户组有效 + "order by st.system_Id"); + // 国家中心人员具有 查看所有业务系统 数据的权限 + List list = this.commonService.executeSQL("SELECT jsbh FROM xt_yh_js_index where yhbh = ?", + yhbh.trim()); + if (list != null && list.size() > 0) { + for (String obj : list) { + if (StringUtils.isNotBlank(obj)) { + if ((Constants.NATION_ROLE.trim()).equals(obj.trim())) { Object[] all = new Object[3]; all[0] = -1; all[1] = "ALL"; @@ -324,48 +334,56 @@ public class LoginAction extends BaseAction { } } } - - if(stList!=null && stList.size()==1){ - this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN, Long.parseLong(stList.get(0)[0].toString())); - this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, stList.get(0)[1].toString()); + if (stList != null && stList.size() == 1) { -// System.out.println(stList.get(0)[1]+"-=-=-=-=-=-=--=-=-=-=-=-==============--- Only One "+this.getRequest().getSession().getAttribute(Constant.SESSION_SYSTEM_LOGIN)); + this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN, + Long.parseLong(stList.get(0)[0].toString())); + this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, + stList.get(0)[1].toString()); + + // System.out.println(stList.get(0)[1]+"-=-=-=-=-=-=--=-=-=-=-=-==============--- + // Only One + // "+this.getRequest().getSession().getAttribute(Constant.SESSION_SYSTEM_LOGIN)); return "ok"; } } - } - this.getRequest().setAttribute("stList", stList); + } + this.getRequest().setAttribute("stList", stList); } catch (Exception e) { e.printStackTrace(); } return "systemSelect"; } + /** * 判断用户是否首次使用密码如果是首次返回到密码修改页面 + * * @param yhbh * @return 0要修改密码;1无需修改密码继续;2用户不存在 */ - private int checkPwdState(String yhbh){ - //默认要修改密码 + private int checkPwdState(String yhbh) { + // 默认要修改密码 int ischeck = 0; try { - List stList = new ArrayList(); - if(yhbh != null && !"".equals(yhbh)){ - stList = this.commonService - .executeSQL("select xyj.PWDSTATE from xt_yh_jbxx xyj where xyj.yhbh = '"+yhbh+"' AND xyj.ZXBZ = 0 "); - if(stList == null){ - outHtmlString(""); + List stList = new ArrayList(); + if (yhbh != null && !"".equals(yhbh)) { + stList = this.commonService.executeSQL( + "select xyj.PWDSTATE from xt_yh_jbxx xyj where xyj.yhbh = '" + yhbh + "' AND xyj.ZXBZ = 0 "); + if (stList == null) { + outHtmlString( + ""); ischeck = 2; - }else if(stList.size()==1){// && stList.size()==1 - //如果密码正常状态则直接放行 - ischeck =Integer.parseInt(String.valueOf(stList.get(0))); - }else{ - outHtmlString(""); + } else if (stList.size() == 1) {// && stList.size()==1 + // 如果密码正常状态则直接放行 + ischeck = Integer.parseInt(String.valueOf(stList.get(0))); + } else { + outHtmlString( + ""); ischeck = 2; } - } - this.getRequest().setAttribute("stList", stList); + } + this.getRequest().setAttribute("stList", stList); } catch (Exception e) { e.printStackTrace(); } @@ -378,15 +396,13 @@ public class LoginAction extends BaseAction { String yhbh = this.getRequest().getParameter("yhbh"); try { MD5 md5 = new MD5(); - XtYhJbxx userNew = (XtYhJbxx) this.commonService.get( - XtYhJbxx.class, Long.parseLong(yhid.trim())); + XtYhJbxx userNew = (XtYhJbxx) this.commonService.get(XtYhJbxx.class, Long.parseLong(yhid.trim())); userNew.setYhmm(md5.getMD5Code(logInInfo.getYhmm().trim())); - //让管理员重置密码之后,修改密码状态未必须修改状态0 + // 让管理员重置密码之后,修改密码状态未必须修改状态0 userNew.setPwdState("1"); this.commonService.update(userNew); // //将删除操作写到操作日志中 - this.addDBOperationRpt(commonService, "XT_YH_JBXX", "UPDATE", - userNew.getYhid()); + this.addDBOperationRpt(commonService, "XT_YH_JBXX", "UPDATE", userNew.getYhid()); this.getRequest().setAttribute("MSG", 1); } catch (Exception e) { this.getRequest().setAttribute("MSG", 2); @@ -394,64 +410,82 @@ public class LoginAction extends BaseAction { } return toSystemSelect(yhbh); } - public String systemSelect(){ - if("yes".equals(this.getRequest().getParameter("SytemChange"))){ - if(this.getRequest().getSession().getAttribute("YHBH")!=null){ + + public String systemSelect() { + if ("yes".equals(this.getRequest().getParameter("SytemChange"))) { + if (this.getRequest().getSession().getAttribute("YHBH") != null) { return toSystemSelect(this.getRequest().getSession().getAttribute("YHBH").toString()); - }else { - outHtmlString(""); + } else { + outHtmlString( + ""); return null; } - }else{ - if(this.getRequest().getParameter("systemId")!=null && !"".equals(this.getRequest().getParameter("systemId"))){ + } else { + if (this.getRequest().getParameter("systemId") != null + && !"".equals(this.getRequest().getParameter("systemId"))) { Long systemId = Long.parseLong(this.getRequest().getParameter("systemId")); this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN, systemId); - if(systemId == -1){//管理员权限,查看所有数据 - this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, "ALL"); - this.getRequest().getSession().setAttribute(Constant.ADMIN_FLAG, true); - }else{ - this.getRequest().getSession().setAttribute(Constant.ADMIN_FLAG, false); + if (systemId == -1) {// 管理员权限,查看所有数据 + this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, "ALL"); + this.getRequest().getSession().setAttribute(Constant.ADMIN_FLAG, true); + } else { + this.getRequest().getSession().setAttribute(Constant.ADMIN_FLAG, false); List stList = new ArrayList(); - try{ - stList = this.commonService.executeSQL("select st.system_Name from system_table st where st.system_Id = "+Long.parseLong(this.getRequest().getParameter("systemId"))); - if(stList!=null && stList.size()==1){ - this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, stList.get(0).toString()); + try { + stList = this.commonService + .executeSQL("select st.system_Name from system_table st where st.system_Id = " + + Long.parseLong(this.getRequest().getParameter("systemId"))); + if (stList != null && stList.size() == 1) { + this.getRequest().getSession().setAttribute(Constant.SESSION_SYSTEM_LOGIN_NAME, + stList.get(0).toString()); } } catch (Exception e) { e.printStackTrace(); } } - //刷新菜单树---------------------------2013-1-8 新增 + // 刷新菜单树---------------------------2013-1-8 新增 QueryMenuTreeAction query = new QueryMenuTreeAction(commonService); List> userfunctionList = null; - userfunctionList = query.queryMenuTree(null,this.getUser().getYhbh()); - - if(userfunctionList==null || userfunctionList.size()==0){ - this.saveLoginRpt("i18n_LoginAction.login.noPermission_n81i","i18n_LoginAction.login.in_n81i",logInInfo.getYhmc());//记录登陆日志 - outHtmlString(""); - //outHtmlString(""); + userfunctionList = query.queryMenuTree(null, this.getUser().getYhbh()); + + if (userfunctionList == null || userfunctionList.size() == 0) { + this.saveLoginRpt("i18n_LoginAction.login.noPermission_n81i", "i18n_LoginAction.login.in_n81i", + logInInfo.getYhmc());// 记录登陆日志 + outHtmlString( + ""); + // outHtmlString(""); return null; } // 用户所要功能权限 add by ghh this.getRequest().getSession().setAttribute("userfunctionList", userfunctionList); - LinkedList> userfunctionList2 = new LinkedList>(); + LinkedList> userfunctionList2 = new LinkedList>(); userfunctionList2.addAll(userfunctionList); -// List> userfunctionList2 = (List>) ((LinkedList>)userfunctionList).clone(); + // List> userfunctionList2 = + // (List>) + // ((LinkedList>)userfunctionList).clone(); String treeStr = query.makeMenuTree(userfunctionList2); - //System.out.println(userInfoTemp.getNickname()+":treeXML\t" + treeStr); - if(this.getRequest().getSession().getAttribute("treeStr")!=null){ + // System.out.println(userInfoTemp.getNickname()+":treeXML\t" + + // treeStr); + if (this.getRequest().getSession().getAttribute("treeStr") != null) { this.getRequest().getSession().removeAttribute("treeStr"); } this.getRequest().getSession().setAttribute("treeStr", treeStr); - //---------------------------2013-1-8 新增--------end------------- + // ---------------------------2013-1-8 + // 新增--------end------------- return "ok"; - }else{ - outHtmlString(""); + } else { + outHtmlString( + ""); return null; } } } - public String logout(){ + + public String logout() { System.out.println("用户退出@@@@@@@@@@@@@@@@@@@@@@"); HttpSession session = this.getRequest().getSession(false); if (session.isNew()) @@ -462,88 +496,104 @@ public class LoginAction extends BaseAction { XtYhJbxx.LONGIN_USER.remove(user.getYhbh()); XtYhJbxx.LOGIN_SESSION.remove(user.getYhbh()); Locale lang = (Locale) session.getAttribute("i18n_lang"); -// OnlineListener online = new OnlineListener(); -// online.sessionDestroyed(new HttpSessionEvent(session)); + // OnlineListener online = new OnlineListener(); + // online.sessionDestroyed(new HttpSessionEvent(session)); // 使用户session失效 - session.invalidate(); - this.saveLoginRpt("i18n_LoginAction.login.success_n81i","i18n_LoginAction.checkPwdState.out_n81i",user.getYhmc());//记录登陆日志 - }else{ + session.invalidate(); + this.saveLoginRpt("i18n_LoginAction.login.success_n81i", "i18n_LoginAction.checkPwdState.out_n81i", + user.getYhmc());// 记录登陆日志 + } else { System.out.println("从session中没有取得人员信息!"); - this.saveLoginRpt("i18n_LoginAction.checkPwdState.sessionOutTime_n81i","i18n_LoginAction.checkPwdState.out_n81i",user.getYhmc());//记录登陆日志 + this.saveLoginRpt("i18n_LoginAction.checkPwdState.sessionOutTime_n81i", + "i18n_LoginAction.checkPwdState.out_n81i", user.getYhmc());// 记录登陆日志 } } - + return "logout"; } - public List getYhJsMk(String yhbh){ + + public List getYhJsMk(String yhbh) { List treeList = new ArrayList(); try { -// String sql="select substr(mkbh,0,length(mkbh)-5) as pid,mkbh,mkmc,mkms,mkurl,mktb from XtMkJbxx where mkbh in " + -// "(select mkbh from XtJsMkIndex where jsbh in" + -// "(select a.jsbh from XtJsJbxx a where a.jsbh in(" + -// "select jsbh from XtYhJsIndex where yhbh = '"+yhbh+"') and a.zxbz='0')) and zxbz='0'"; - String sql="select pid,id,mkmc,mkms,mkurl,mktb,iconimage,mktype from XtMkJbxx where id in " + - "(select mkbh from XtJsMkIndex where jsbh in" + - "(select a.jsbh from XtJsJbxx a where a.jsbh in(" + - "select jsbh from XtYhJsIndex where yhbh = '"+yhbh+"') and a.zxbz='0')) and zxbz='0' order by showlevel,showorder"; + String sql = ""; + String regionRoleId = Constants.REGION_ROLE; + if (!"admin".equals(yhbh)&&StringUtils.isNotBlank(regionRoleId) && !regionRoleId.equals("-1")) { + sql = "SELECT pid,id,mkmc,mkms,mkurl,mktb,iconimage,mktype FROM XtMkJbxx WHERE id IN(SELECT mkbh FROM XtJsMkIndex WHERE jsbh = " + + regionRoleId + ")"; + } else { + // String sql="select substr(mkbh,0,length(mkbh)-5) as + // pid,mkbh,mkmc,mkms,mkurl,mktb from XtMkJbxx where mkbh in " + + // "(select mkbh from XtJsMkIndex where jsbh in" + + // "(select a.jsbh from XtJsJbxx a where a.jsbh in(" + + // "select jsbh from XtYhJsIndex where yhbh = '"+yhbh+"') and + // a.zxbz='0')) and zxbz='0'"; + sql = "select pid,id,mkmc,mkms,mkurl,mktb,iconimage,mktype from XtMkJbxx where id in " + + "(select mkbh from XtJsMkIndex where jsbh in" + + "(select a.jsbh from XtJsJbxx a where a.jsbh in(" + + "select jsbh from XtYhJsIndex where yhbh = '" + yhbh + + "') and a.zxbz='0')) and zxbz='0' order by showlevel,showorder"; + } + List menuList = this.commonService.find(sql); - for(int i=0;i getUserInfoList() { return userInfoList; } + public void setUserInfoList(List userInfoList) { this.userInfoList = userInfoList; } diff --git a/src/nis/nms/web/actions/QueryMenuTreeAction.java b/src/nis/nms/web/actions/QueryMenuTreeAction.java index 43c7eeb..f76ed75 100644 --- a/src/nis/nms/web/actions/QueryMenuTreeAction.java +++ b/src/nis/nms/web/actions/QueryMenuTreeAction.java @@ -11,6 +11,7 @@ import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; +import nis.nms.core.Constants; import nis.nms.domains.XtYhJbxx; import nis.nms.service.CommonService; import nis.nms.util.Common; @@ -39,6 +40,8 @@ public class QueryMenuTreeAction { public List> queryMenuTree(String yhmc,String yhbh) { // 查询用户下的所以功能节点 List> userfunctionList = null; + String regionRoleId=Constants.REGION_ROLE; + try { StringBuffer hql = new StringBuffer(); if (yhmc != null @@ -47,7 +50,9 @@ public class QueryMenuTreeAction { .append("select n.Id,n.ZXBZ,n.PID,n.HANDLER,n.MKURL," + "n.MKMC,n.MKTYPE from xt_mk_jbxx n where ZXBZ=0"); - } else { + }else if(StringUtils.isNotBlank(regionRoleId)&&!regionRoleId.equals("-1")){ + hql.append("SELECT n.id ,n.ZXBZ,n.PID,n. HANDLER,n.MKURL,n.MKMC,n.MKTYPE FROM xt_mk_jbxx n WHERE ZXBZ = 0 AND n.id IN( SELECT r.MKBH FROM xt_js_mk_index r WHERE r.JSBH ="+regionRoleId+")"); + }else { if (yhbh != null) { if(Constant.F_BUTTON_AUTHER){ hql diff --git a/src/nis/nms/web/actions/detection/DetectionSetAction.java b/src/nis/nms/web/actions/detection/DetectionSetAction.java index 2574d3e..85f6897 100644 --- a/src/nis/nms/web/actions/detection/DetectionSetAction.java +++ b/src/nis/nms/web/actions/detection/DetectionSetAction.java @@ -30,6 +30,7 @@ import nis.nms.service.CommonService; import nis.nms.util.BaseAction; import nis.nms.util.ExportUtils; import nis.nms.util.Page; +import nis.nms.util.StringUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.FalseFileFilter; @@ -1803,19 +1804,36 @@ public class DetectionSetAction extends BaseAction { // } setInfo2.setId(setInfo.getId()); // setInfo2.setNodegroup(setInfo.getNodegroup()); - setInfo2.setNodeGroupsId(setInfo.getNodeGroupsId());// 设置节点组id(多个用逗号连接) + if(StringUtils.isBlank(setInfo.getNodeGroupsId())){ + setInfo2.setNodeGroupsId(null); + }else{ + setInfo2.setNodeGroupsId(setInfo.getNodeGroupsId());// 设置节点组id(多个用逗号连接) + } setInfo2.setCheckTypeInfo(typeInfo); setInfo2.setProcessIden(setInfo.getProcessIden()); // setInfo2.setNodeIp(setInfo.getNodeIp()); - setInfo2.setNodeIpsId(setInfo.getNodeIpsId());// 设置节点id(多个逗号连接) + if(StringUtils.isBlank(setInfo.getNodeIpsId())){ + setInfo2.setNodeIpsId(setInfo.getNodeIpsId()); + }else{ + setInfo2.setNodeIpsId(setInfo.getNodeIpsId());// 设置节点id(多个逗号连接) + } setInfo2.setCheckWay(setInfo.getCheckWay()); setInfo2.setDetectionSetState(setInfo.getDetectionSetState()); setInfo2.setCheckTypeInfo(typeInfo); setInfo.setCheckTypeInfo(typeInfo); setInfo.setNodeIp(detectionSetInfo.getNodeIpsName()); - setInfo.setNodeIpsId(detectionSetInfo.getNodeIpsId());// 设置节点id - setInfo.setNodeGroupsId(detectionSetInfo.getNodeGroupsId());// 设置节点组id,之前没有设置此信息 + if(StringUtils.isBlank(detectionSetInfo.getNodeIpsId())){ + setInfo.setNodeIpsId(null);// 设置节点id + }else{ + setInfo.setNodeIpsId(detectionSetInfo.getNodeIpsId()); + } + + if(StringUtils.isBlank(detectionSetInfo.getNodeGroupsId())){ + setInfo.setNodeGroupsId(null);// 设置节点组id,之前没有设置此信息 + }else{ + setInfo.setNodeGroupsId(detectionSetInfo.getNodeGroupsId());// 设置节点组id,之前没有设置此信息 + } setInfo.setDetectionSetState(detectionSetInfo .getDetectionSetState()); setInfo.setCheckWay(detectionSetInfo.getCheckWay());