WEBGIS管理模块实现

简介: WEBGIS管理模块实现


系统的其他管理功能模块也是系统相关的辅助功能模块,主要包括用户管理功能和数据的批量导人两部分。

后台的开发语言十分繁多,在网络发展的初级阶段使用CGI 技术来实现动态效果时可能使用的是C 语言,发展到现在有PHP 、Java 、Asp. Net 、Ruby 、Go 等,甚至连原来工作在浏览器端的JavaScript 都被搬到了服务器端,并命名为Node. js 。
需要提醒的是,语言的种类太多,这个数量在未来仍然可能变化,如果要成为一个优秀的开发者,不应该被语言所局限,而更加应该关注实现问题的思路和本质。

1 .用户管理

城市地下电力管线管理系统允许电网管理人员进入系统对城市电力管网进行管理。当

用户输入正确的用户名和密码后便会进入系统主页面,加载系统的各个功能模块。系统提

供了添加用户、查看用户、修改密码等常用的用户管理功能,并且只有管理员用户具有添加、

删除普通用户的权限。

1 )注册页面

在安全注册与登录操作过程中严格验证表单内容,以提高网站的安全性,防止非法用户

进入网站。本系统中注册页面为addUser. jsp ,如

实现注册表单页面的关键代码如下:

< 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 )登录页面

城市地下电力管线管理系统允许电网管理人员进入系统对城市电力管网进行管理,图7. 4-21 为用

户登录界面,也是系统的默认首页。登录系统需要验证用户输入的用户名和密码是否正确,用户名和密码正确则进入系统,

码不全正确则给予相应的提示,整个登录过程的验证流程如图

前台与后台的登录验证方法基本一致,只是前台登录保存的是登录的用户信息,后台登录保存的是登录系统的管理员基本信息。前台与后台的登录页面代码方式相同,以前台登录页面为例,其关键代码如下:

< 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>

在登录验证

的过程中通过页面中获取的用户名和密码作为查询条件在用户信息表中查找条件匹配的用户信息,如果往返的结果集不为空,说明验证通过;反之失败。前台登录验证方法关键代码如下:

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. 数据的批量导入

数据的批盘导人功能以Excel 文件形式批量导人电力管网的设备的属性信息,它有效地避免人工输入设备数据造成的可靠性和效率低下的问题。由于系统属性和空间数据库的一致性,批量导入模块在属性数据库导人时会增加对应的空间数据库记录。数据的批量导人模块时序图如图所示,通过业务逻辑服务的uploadExcelAction 将前端文件上传到服务器端。importExcelService 使用jxl 类库解析Excel 文件中的记录,并将其通过DAO 接口保存到属性和空间数据库中。

< 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

导人功能用到了一些实体类,下面是实现的关键代码:

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();


目录
相关文章
|
6天前
|
监控 Java 定位技术
WebGIS 信息系统-主界面基本模块功能设计
WebGIS 信息系统-主界面基本模块功能设计
44 2
|
6天前
|
Java 关系型数据库 数据库连接
webgis系统实现
webgis系统实现
30 7
|
7月前
|
存储 数据采集 数据挖掘
webGIS的功能
webGIS的功能
82 0
|
8月前
|
安全 API 区块链
交易所系统源码开发结构和主要功能模块搭建部署
交易所系统源码开发结构和主要功能模块搭建部署
|
10月前
|
人工智能 机器人 vr&ar
项目实战25—用户、第三方系统和项目之间的耦合性
项目实战25—用户、第三方系统和项目之间的耦合性
81 0
|
12月前
|
JavaScript 前端开发 数据库
Unity3d(webGL)构建数字孪生小案例(包含完整的数据交互体系)附赠完整代码
Unity3d(webGL)构建数字孪生小案例(包含完整的数据交互体系)附赠完整代码,请关注公众号:拼搏的小浣熊,获取简化版的代码!
|
存储 JSON 分布式计算
商圈库_功能_环境代码编写 | 学习笔记
快速学习商圈库_功能_环境代码编写。
93 0
商圈库_功能_环境代码编写 | 学习笔记