Let's start by demonstrating the features you want to implement:
Click:
We looked at three sub-modules:
Click module Management:
In the module management, we can set up a total of several modules, each module inside what specific operations and so on.
Role management:
Assign permissions to roles.
OK, let's look at the specific implementation:
We first introduce a third-party system into the project:
Import Project.
Then modify the Sysconfig, and the/web-inf/proxool.xml file in the Sysmanager system
Then
Then restart Tomcat.
Then modify the code:
We add an action layer below: In fact, our third-party system is implemented by the acion of our own project and into the third-party system:
Let's take a look at Sysconfigacion.java:
Packageyycg.base.action;Importjavax.servlet.http.HttpServletRequest;Importjavax.servlet.http.HttpSession;ImportOrg.springframework.stereotype.Controller;Importorg.springframework.web.bind.annotation.RequestMapping;ImportYycg.base.pojo.vo.ActiveUser;ImportYycg.base.process.context.Config;ImportYycg.util.ResourcesUtil;ImportYycg.util.Vcom_3DES, @Controller @RequestMapping ("/sysconfig") Public classsysconfigaction {//generating an encrypted string PrivateString buildstring (String userid,string pwd)throwsexception{//get a key from a configuration fileString key= Resourcesutil.getvalue (config.sysconfig, "Deskey"); //string to be encryptedString oldstring = userid + "#" + pwd + "#" +System.currenttimemillis (); System.out.println ("Original string =" +oldstring); //3DES encryption, 1 means encryption, key: KeysVcom_3des Tempdesen =NewVcom_3des (1, oldstring, key); //after the encrypted stringString strtemp =Tempdesen.vcom3deschiper (); returnstrtemp; } //sysmanagerurl_modulelist=http://localhost: 8080/sysmanager/module/show.do?loginkeystring= /*** Module Operation Management*/@RequestMapping ("/modulelist") PublicString modulelist (HttpServletRequest request)throwsexception{HttpSession Session=request.getsession (); Activeuser Activeuser=(Activeuser) Session.getattribute (Config.activeuser_key); String userid=Activeuser.getuserid (); //generating an encrypted stringString strtemp=buildstring (userid, "test"); //Organization Interface Address//obtaining an interface address from a configuration file//get the interface address for module managementString Module_url = Resourcesutil.getvalue (Config.sysconfig, "Sysmanagerurl_modulelist"); //append the encrypted string to the interface addressString URL = module_url+strtemp; returnView.redirect (URL);//go to a third-party system } //Role Management sysmanagerurl_rolelist=http://localhost: 8080/sysmanager/role/show.do?loginkeystring= /*** Role Management*/@RequestMapping ("/rolelist") PublicString rolelist (HttpServletRequest request)throwsexception{HttpSession Session=request.getsession (); Activeuser Activeuser=(Activeuser) Session.getattribute (Config.activeuser_key); String userid=Activeuser.getuserid (); //generating an encrypted stringString strtemp=buildstring (userid, "test"); //Organization Interface Address//obtaining an interface address from a configuration file//get the interface address for module managementString Rolelist_url = Resourcesutil.getvalue (Config.sysconfig, "Sysmanagerurl_rolelist"); //append the encrypted string to the interface addressString URL = rolelist_url+strtemp; returnView.redirect (URL);//go to a third-party system } //system parameter Configuration sysconfigurl_basicinfo=http://localhost: 8080/sysconfig/admin/findbasicinfolist.action?loginkeystring= /*** System parameter Configuration*/@RequestMapping ("/basicinfo") PublicString Basicinfo (HttpServletRequest request)throwsexception{HttpSession Session=request.getsession (); Activeuser Activeuser=(Activeuser) Session.getattribute (Config.activeuser_key); String userid=Activeuser.getuserid (); //generating an encrypted stringString strtemp=buildstring (userid, "test"); //Organization Interface Address//obtaining an interface address from a configuration file//get the interface address for module managementString Basicinfo_url = Resourcesutil.getvalue (Config.sysconfig, "Sysconfigurl_basicinfo"); //append the encrypted string to the interface addressString URL = basicinfo_url+strtemp; returnView.redirect (URL);//go to a third-party system }}
We are looking at: View.java:
Packageyycg.base.action;ImportYycg.base.process.context.Config;/*** Controller View handling Common method class * *@authorMRT **/ Public classView {/*** Common successful JSP page file name*/ Public Static FinalString SUCCESS = "SUCCESS"; /*** Generic failed JSP page file name*/ Public Static FinalString error = "Error"; /*** Back to the Base module JSP path method, other modules can add * *@paramPage * JSP file name *@return */ Public Staticstring Tobase (String page) {returnConfig.page_path_base +page; } /*** Return to the Business module JSP path method, other modules can add * *@paramPage * JSP file name *@return */ Public Staticstring tobusiness (String page) {returnConfig.page_path_business +page; } /*** Action returns Successful page method * *@return */ Public StaticString tosuccess () {returnConfig.page_path_base +SUCCESS; } /*** Action return operation failed page method * *@return */ Public StaticString Toerror () {returnConfig.page_path_base +ERROR; } /*** Action is redirected to a custom URL in redirect mode * *@paramURL *@return */ Public Staticstring Redirect (string url) {return"Redirect:" +URL; } /*** Action is directed to a custom page in forward mode * *@paramURL *@return */ Public Staticstring Forward (string url) {return"Forward:" +URL; } }
Finally, let's look at how the page is written.
We know that our left-hand menu is written in Meanu.json, and this time it is the same:
Menu.json as follows:
{"icon": "Icon-sys", "MenuID": "1", "Menuname": "Third party System", "url": "", "menus": [ {"icon": "Icon-log", "MenuID": "1_1", "Menuname": "Module Management", "url": "/yycgproject/sysconfig/modulelist.action" }, {"icon": "Icon-log", "MenuID": "1_1 "," menuname ":" Role Management "," url ":"/yycgproject/sysconfig/rolelist.action " }, {" icon ":" Icon-log "," MenuID ":" 1_1 "," Menuname ":" System Parameter Management "," url ":"/yycgproject/sysconfig/basicinfo.action " } ] },
In this way we have achieved the above function. Because both of these third-party spaces are copied from the source system, all are edited, and we don't need to edit them.
The following article is about the ability to display different menus depending on the user. The menu displayed is different for the user.
049 Medical Program-Module Five: Permission settings-access to third-party systems