Implementation of WEBGIS management module

Other management function modules of the system are also system-related auxiliary function modules, mainly including user management functions and data batch import.
There are many development languages ​​in the background. In the initial stage of network development, CGI technology may be used to achieve dynamic effects. C language may be used. Now there are PHP, Java, Asp. Net, Ruby, Go, etc., and even the original work in The JavaScript on the browser side has been moved to the server side and named Node.js.
What needs to be reminded is that there are too many types of languages, and this number may still change in the future. If you want to become an excellent developer, you should not be limited by the language, but should pay more attention to the ideas and essence of the implementation problem.

1. User management

The urban underground power pipeline management system allows power grid managers to enter the system to manage the urban power pipeline network. When
the user enters the correct user name and password, he will enter the main page of the system and load the various functional modules of the system. The system
provides common user management functions such as adding users, viewing users, and changing passwords, and only administrator users have
the authority to add and delete ordinary users.

1) Registration page

Strictly verify the content of the form during the secure registration and login operation to improve the security of the website and prevent illegal users
from entering the website. The registration page in this system is addUser.jsp. For example,
insert image description here
the key code to realize the registration form page is as follows:

< s: include value =”commonMenu.jsp”><Is: include>
<div class =” clear”></div>
<div class =” system_box”>
< s: form action =”addUser” theme =” simple" meth 。d ="post "四ctype =”multipart/form - data”>
< table class =” system - table ”>
<tr>< th colspan =” 2 ”〉账户基本信息(必填)</th></tr>
<tr>
< td width =” 80px ”〉登录名警</ td>
< td width z ” 340px”>
< s : textf ield theme =” simple ” n四e =” user . userName ” cssClass =” stri290 ”
reqiured =true” value =””/>
</td>
</tr>
<tr>
< td width g ” 80px”〉用户密码祷</td>
< td width =340px”>
< s : password theme =” simple" name =” user . userPassword ” cssClass =” psdi290 ”
value =””/>
</td>
</tr>
<tr>
< td width =” BOpx ">用户组别铃</ td>
< td width =340px”>
< selectclass =”selectl” name =”user.userLevel ”>
<option value =”。”〉超级管理员</ option>
<option value =” 1 ”〉管理员</ option>
<option value z ” 2 ” select回〉普通用户</ option>
</select ></td >
</tr>
< tr>< th colspan =” 2 ”〉用户个人信息(选填)</th></tr>
<tr>
< td width =” BOpx ”〉真实姓名</td>
< td width =340px”>
< s: textfield theme =” simple ” name =” user. userRealName" cssClass =”
stri290” value =··”/>
</td>
</tr>
<tr>
< td width =” 80px”〉手机号</td>
< td width =340px">
< s : textf ield theme =” simple" name =” user . userMobile" cssClass =” stri290 ”
value =””/>
</td>
</tr>
<tr>

2) Login page

The urban underground power pipeline management system allows power grid management personnel to enter the system to manage the urban power pipeline network. Figure 7.4-21 is the user
login interface, which is also the default home page of the system. The login system needs to verify whether the user name and password entered by the user are correct. If the user name and password are correct, they will enter the system. If the
code is incomplete, a corresponding prompt will be given. The verification process of the entire login process is
insert image description here
insert image description here
as shown in the figure. The login saves the logged-in user information, and the background login saves the basic information of the administrator who logs in to the system. The login page codes of the foreground and the background are the same. Taking the login page of the foreground as an example, the key codes are as follows:

< s: form action z ” login” method =” post” enctype =”multipart/form - data”>
< inputname =”mode ” type =” hidden” value z ” check”>
< s : textf ield label z ”用户名” name =” name ” cssClass =”str”/>
< s : password l由el =”密码” name z ” password ”/>
< s : submit value =”登录”/〉
</s: form>

Verify at login

In the process, the user name and password obtained in the page are used as the query conditions to find the user information matching the conditions in the user information table. If the round-trip result set is not empty, it means that the verification is passed; otherwise, it fails. The key code of the front-end login verification method is as follows:

public class loginAction extends ActionSupport {
    
    
private String mode;
private String name;
private String password ;
private loginService loginService;
public String execute() throws Exception {
    
    
if(mode.equals(” login”)){
    
    
return mode;
//注销登录
if(mode.equals (” loginout”)){
    
    
Mapsession = ActionContext. getContext(). getSession();
session.remove(”user Info);
return ” loginout'’ J
//登录检查
if(mode.equals (”check”)){
    
    
if(name.equals (””)){
    
    
addFieldError (” name”,”请填写用户名”);
return INPUT;
if(password equals (川’)){
addFieldError (” password ”,”请填写密码”);
return INPUT;
intflagLogin = - 1;
flagLogin = loginService. checkAccount(name ,归ssword ) ;
switch( flagLogin) {
    
    
caseO:addFieldError (飞回E”,”用户名不存在”);
case - 1 : addFieldError (” password ”,”密码错误”);
if(hasErrors()){
    
    
return INPUT;
} else {
    
    
Mapsession = ActionContext. getContext() . getSessio叫);
session. put (”user Info, loginService . getUserinfo());
return SUCCESS;
return SUCCESS;

2. Batch import of data

The batch import function of data imports the attribute information of the equipment of the power pipe network in batches in the form of Excel files, which effectively avoids the problems of reliability and low efficiency caused by manual input of equipment data. Due to the consistency of the system attributes and the spatial database, the batch import module will increase the corresponding spatial database records when the attribute database is imported. The timing diagram of the data batch import module is shown in the figure, and the front-end files are uploaded to the server through the uploadExcelAction of the business logic service. importExcelService uses the jxl class library to parse the records in the Excel file and save them to the attribute and spatial database through the DAO interface.

insert image description here

< s: include value =” cornrnonMenu.jsp”><Is: include>
<div class =” clear”></div>
<div class =” systern_ box”>
< s : form action =” uploadsExcel ” cssClass =” system - table ” rneth od z ” post" enc type =”
rnultipart/forrn - data”>
<tr>
< s: f ilelabel =”导人文件” name= "upFile” cssClass = 飞290 ”></ s :file>
< s:token />
<tr>
< td class =” td Label ">文件类型</td>
<td>
< select name =” type” class =” i290selectl”>
<option value =气urv町、测绘层</option>
<option value =” well ”〉电缆井</ option>
<option value -丁oint ”〉电缆接头</ option>
<option value = ” wire ”〉电缆段</ option>
<option value =” r四a ind er ”〉电缆盘余</ option>
<option value =” ele ”〉电气设备</option>
</select>
</td>
</tr>
< s: subrnitvalue

The import function uses some entity classes, the following is the key code of implementation:

private FileupFile;
private SurveyDatalmport import Dao;
private ContainerDatalmport import DaoEle;
private Wirecablelmport import DaoWirecable;
pri vate InsertObjectByFileimport DaoObj;
private intcountFinish;
private intcountAll;
private List< String> err Info;
public import ExcelService() {
    
    
public intimport Excel(String type){
    
    
if( type.equals (” survey”)){
    
    
return import Survey( ) ;
/ 椅
} elseif(type. equals (” well”)){
    
    
import Well ( ) ;
return 1;
} elseif(type. equals (” joint”)){
    
    
import Joint();
return 1;
} elseif(type.equals (”wire”)){
    
    
import Wirecable();
return 1;
} elseif(type. equals (” remainder”)){
    
    
import Remainder();
return 1;
} elseif(type.equals (” ele”)){
    
    
import Ele();
return l;
return 1;
骨导人测绘层
铃/
p由lie int import Survey( ) {
    
    
try{
    
    7章城市地下电力管线GIS 系统|’ 327
intres = import Dao. surveyDatalmport ( upFile);
if(res != - 1) {
    
    
countFinish = import Dao. getCountFinish();
countAll = import Dao. getCountAll();
errlnfo = import Dao. getErrlnfo( ) ;
return res,
}catch(Exceptione){
    
    
return - 1;
public void import Ele() {
    
    
try{
    
    
/养
import DaoEle. containerDataimport ( upFile);
countFinish = import DaoEle. getNumimport ed();
countAll = import DaoEle. getNumSum();
errinfo = import DaoEle. getErrinfo();
}catch(Exceptione) {
    
    
提导人电缆段
祷/
p由lie void import Wirecable() {
    
    
try{
    
    
import DaoWirecable. wirecableimport ( upFile);
countFinish = import DaoWirecable . getCountFinish();
count且11 = import DaoWirecable. getCountAll();
errinfo = import DaoWirecable. getErrinfo();
}catch(Exceptione){
    
    
//return - 1;
/ 铸
祷导人工井
祷/
p由lie void import Well ( ) {
    
    
try{
    
    
/婪
import DaoObj. insertObjectByFile ( upFile, newFile ( ServletActionContext.
getServletContext(). getRealPath (”叮+”\\阳B - INF\ \ classes\ \ org \ \ resource\ \
excelXML\\PdEwPtWell.xml”));
countFinish = import DaoObj. getCountFinish();
countAll = import DaoO坷, getCountAll ( ) ;
errinfo = import DaoObj getErrinfo();
}catch(Exceptione) {
    
    
e.pri时StackTrace( ) ;

public void import Joint() {
    
    
try{
    
    

import DaoObj. insertObjectByFile ( upFile, newFile ( ServletActionContext.
getServletContext( ) getRealPath (””)+”\\阳B INF\ \ classes\ \ org \ \ resource\ \
excelXML\\
PdElCnintermediateJoint.xml”)),
countFinish = import DaoO坷, getCountFinish();
countAll = import DaoObj. getCountAll ( ) ;
err Info= import DaoObj. getErrinfo();
}catch(Exceptione){
    
    
e . printStackTrace();

public void import Remainder() {
    
    
try{
    
    
import DaoObj. insertOb] ectByFile ( upFile, newFile ( ServletActionContext.
getServletContext( ) getRealPath (川)+”\\ WEB - INF\\ classes\\ org \\resource\\
excelXML\\
PdElCnCabledrumRemainder.xml ”)),
countFinish = import DaoObj. getCountFinish();
countAll = import DaoObj . getCountAll ( ) ;
err Info= import DaoObj . getErrinfo();
}catch(Exceptione){
    
    
e. printStackTrace();

Guess you like

Origin blog.csdn.net/leva345/article/details/131381334