jsp码头船只出行及配套货柜码放管理系统的设计与实现

jsp码头船只出行及配套货柜码放管理系统主要用于实现高校在线考试,

基本功能包括:用户登录、修改个人信息、查看码头信息;系统管理人员管理;船只信息管理;船只路线信息管理;货柜信息管理等。本系统结构如下:
(1)用户登录模块:
  该模块分为三中用户的登录:
  1、一般(查看)用户,权限只有修改个人信息和查看功能
  2、(操作)用户登录,可以修改自己的信息,还可以对系统内容进行增加、删除和修改
  3、系统管理员,可以修改自己的信息,并且不仅有查看、增删改的基本权限,还有对用户的管理和注册权限

(2)用户管理模块:
  该模块实现对用户的增加,删除和修改

(3)个人信息维护模块:
  该模块实现用户对自己的名字和密码等个人信息的修改

(4)新闻公告管理模块:
  该模块实现新闻公告的增加,删除和修改

(5)船只管理模块:
  该模块实现船只的增加,删除和修改

(6)路线管理模块:
  该模块实现路线的增加,删除和修改,以及船只与路线关系的管理

(7)货柜管理模块:
  该模块实现货柜的增加,删除和修改,以及船只与货柜关系的管理

系统实现:

 首页主要分为Banner信息栏,导航栏,和版权信息栏。如图4.2.1.1所示。点击导航栏的任意某一内容,屏幕会列出想要查看的信息。如图4.2.1.2所示,点击出行船只,就会以分页显示的方式列出最新码头船只出行的情况。

 

                         图4.1.1.1 首页界面

 

                    图4.2.1.2 点击出行船只后显示界面

实现船只出行信息罗列的核心代码如下:

public String getAll() {

       HttpServletRequest request = ServletActionContext.getRequest();

       request.setAttribute("newsmodel",chuxingEbi.getAll(0, 6));

       request.setAttribute("newsnum",chuxingEbi.getAllCount());

       return "newsall";

    }

    public String getAllqt() {

       HttpServletRequest request = ServletActionContext.getRequest();

       request.setAttribute("newsmodel",chuxingEbi.getAll());

       request.setAttribute("newsnum",chuxingEbi.getAllCount());

       return "qtall";

}

4.2.2  用户登录的实现

登录界面分为管理员登录与一般用户(操作、看)登录。登录页面设计相对比较简单,界面清晰,背景配以黑灰渐变色,首页运行效果,如图4.2.2.1。

用户的登录分为三种情况,第一种是管理员登录,如图4.2.2.2是管理员登录后的界面。管理员可以进行用户管理,个人信息维护,新闻公告管理,船只管理,货柜管理,当然还可以查看新闻信息。

第二种是一般(操作)用户,如图4.2.2.3显示的是一般用户登录后的界面,与管理员操作大体相同,只是功能相对较少些。一般用户登录代码与管理员代码大致相似,只是功能少一些。

第三种是一般(看)用户,该图4.2.2.4是一般用户(看)登录后的界面,只有查看权限,包括新闻,船只,货柜及其路线的查看。该用户的登录实现代码亦同上。

 

图4.2.2.1  首页登录界面

 

图4.2.2.2  管理员登录界面

 

 

图4.2.2.3  一般用户(操作)登录界面

 

 

图4.2.2.4  一般用户(看)登录界面

 

用户登录后主要是对各模块进行权限内的合法操作,其实现登录的核心代码如下:

       public String login()

{

       HttpServletRequest request = ServletActionContext.getRequest();

       HttpSession session = request.getSession();

       String username = request.getParameter("username");

       String password = request.getParameter("password");

       //System.out.println(username+";"+password);

       UserQueryModel qm = new UserQueryModel();

       qm.setUsername(username);

       qm.setPassword(password);

       int num = userEbi.getByConditionCount(qm);

       //System.out.println("数量:+"+num);

       if(num>0){

           int sta = userEbi.getByCondition(qm, 0, 100).get(0).getState();

           switch (sta) {

           case 0:

              session.setAttribute("useradmin", username);

              return "admin";

           case 1:

              session.setAttribute("useradmin", username);

              return "admin1";

           case 2:

              session.setAttribute("useradmin", username);

              return "admin2";

           default:

              request.setAttribute("error", "用户名或密码不对");

              return "loginf";

           }  

       }else{

           request.setAttribute("error", "用户名或密码不对");

           return "loginf";

       }

    }

 

4.2.3  用户管理的实现

    只有管理员才有用户管理的权限,该功能模块可以实现管理员对用户密码以及权限的初始设置和修改。用户的权限有看和操作两种。管理员还可以通过点击删除按钮来实现对用户的删除。如图4.2.3.1所示。

 

图4.2.3.1  用户管理界面

 

图4.2.3.1显示的是管理员的用户管理界面,其核心代码如下:

//根据Id得到用户信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       UserQueryModel qm = new UserQueryModel();

       qm.setId(id);

       request.setAttribute("userupdate", userEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       userEbi.delete(id);

       return "delete";

    }

//修改

public String update() {

       userEbi.update(userModel);

       return "update";

    }

    public String create() {

       HttpServletRequest request = ServletActionContext.getRequest();

       userEbi.create(userModel);

       return SUCCESS;

    }

4.2.4  个人信息维护的实现

    个人信息的维护功能模块的实现,方便了用户对自己的个人信息的修改,比如名字和密码。用户登录该系统之后,通过个人信息维护模块,重新输入自己的名字和密码来修改个人信息。其界面如图4.2.4.1所示。

 

                  

图4.2.4.1  个人信息维护界面

实现个人信息维护的核心代码如下:

     public String getxiugai(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       UserQueryModel qm = new UserQueryModel();

       qm.setId(id);

       request.setAttribute("userupdate", userEbi.getByCondition(qm, 0, 20));

       return "byid";

   }

4.2.5  船只管理的实现

该功能模块实现了可操作人员对船只的增加、删除和修改功能。用户通过添加船只编号、名称、体积和详细信息来增加船只,实现船只的增加功能。如图4.2.5.1。通过船只管理模块,点击想要修改或者删除的船只信息后方的修改或者删除按钮,实现对船只的修改和删除功能。如图4.2.5.2所示。

 

图4.2.5.1  船只增加界面

 

 

图4.2.5.2  船只管理界面

 

上图4.2.5.1和4.2.5.2显示的是船只的增加和管理界面,其核心代码:

 

    public String create() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       chuanzhiModel.setTtime(ttime);

       chuanzhiEbi.create(chuanzhiModel);

       return SUCCESS;

    }

    //根据Id得到船只信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       ChuanzhiQueryModel qm = new ChuanzhiQueryModel();

       qm.setId(id);

       request.setAttribute("newsupdate", chuanzhiEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       chuanzhiEbi.delete(id);

       return "delete";

    }

4.2.6  货柜管理的实现

    码头船只的配套货柜码放管理功能模块,实现了对货柜的增加、删除和修改。用户通过对货柜编号、名称、体积和详细信息的输入,来完成货柜的增加功能。如图4.2.6.1。在货柜管理中,通过货柜的删除按钮和修改按钮实现目标货柜的删除和修改。如图4.2.6.2所示。

 

图4.2.6.1  货柜增加界面

 

 

图4.2.6.2  货柜管理界面

 

图4.2.6.1和图4.2.6.2显示的是货柜增加和管理功能,其核心代码如下:

public String create() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       huoguiModel.setTtime(ttime);

       huoguiEbi.create(huoguiModel);

       return SUCCESS;

    }

    //根据Id得到货柜信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       HuoguiQueryModel qm = new HuoguiQueryModel();

       qm.setId(id);

       request.setAttribute("newsupdate", huoguiEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       huoguiEbi.delete(id);

       return "delete";

    }

    public String update() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       huoguiModel.setTtime(ttime);

       huoguiEbi.update(huoguiModel);

       return "update";

    }

}

4.2.7  路线管理的实现

    路线管理功能模块实现了可操作人员对线路的增加、删除和修改。使得路线的管理方便快捷。用户可以通过对路线编号、名称、具体路线以及详细信息的添加来实现增加路线功能。如图4.2.7.1。用户通过点击出行路线管理界面上的修改和删除按钮来修改和删除目标路线,如图4.2.7.2所示。

 

图4.2.7.1  出行路线增加界面

 

图4.2.7.2  出行路线管理界面

 

 

核心代码为:

public String create() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       luxianModel.setTtime(ttime);

       luxianEbi.create(luxianModel);

       return SUCCESS;

    }

    //根据Id得到信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       LuxianQueryModel qm = new LuxianQueryModel();

       qm.setId(id);

       request.setAttribute("newsupdate", luxianEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       luxianEbi.delete(id);

       return "delete";

    }

       public String update() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       luxianModel.setTtime(ttime);

       luxianEbi.update(luxianModel);

       return "update";

    }

}

4.2.8  船只分配路线的实现

    该模块实现了用户对船只出行路线的设置。用户通过船只的选择和路线的选择、以及说明信息的填写,实现为船只分配路线的功能,如图4.2.8.1所示。还可以通过对删除和修改按钮的点击,来删除或者修改分配好的船只路线组合,如图4.2.8.2所示。

 

 

图4.2.8.1  船只分配出行路线界面

 

图4.2.8.2  船只出行路线管理界面

 

其核心代码如下:

    public String create() {

       //System.out.println("????????????????????");

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       chuxingModel.setTtime(ttime);

       //System.out.println(chuxingModel.toString());

       chuxingEbi.create(chuxingModel);

       return SUCCESS;

    }

    //根据Id得到信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

        int id = Integer.parseInt(request.getParameter("id"));

       ChuxingQueryModel qm = new ChuxingQueryModel();

       qm.setId(id);

       request.setAttribute("newsupdate", chuxingEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

        HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       chuxingEbi.delete(id);

       return SUCCESS;

    }

 

    public String update() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       chuxingModel.setTtime(ttime);

       chuxingEbi.update(chuxingModel);

       return "update";

    }

    //去获取船只,线路的信息

    public String getCL(){

       HttpServletRequest request = ServletActionContext.getRequest();

       List<ChuanzhiModel> czlist = chuanzhiEbi.getAll();

       List<LuxianModel> lxlist = luxianEbi.getAll();

       System.out.println(czlist+"//"+lxlist);

       request.setAttribute("czmodel",czlist);

       request.setAttribute("lxmodel",lxlist);

       return "addcl";

    }

}

4.2.9  船只分配货柜的实现

     船只分配货柜这一功能模块主要是为每一艘轮船进行货柜的分配,还有对已分配货柜的船只进行信息的修改和删除。用户可以通过船只的选择、货柜的选择和说明信息(该轮船可以放置多少个货柜等等信息)的填写来实现分配货柜功能,如图4.2.9.1所示。用户还可以通过点击删除和修改按钮来实现对已分配货柜船只组合的删除和修改,如图4.2.9.2所示。

 

图4.2.9.1  船只分配货柜界面

 

图4.2.9.2船只对应配套货柜管理界面

 

该功能模块实现了用户对船只进行货柜码放的管理。其核心代码如下:

    public String create() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       peitaohgModel.setTtime(ttime);

       peitaohgEbi.create(peitaohgModel);

       return SUCCESS;

    }

    //根据Id得到用户信息去修改

    public String getUserById(){

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       PeitaohgQueryModel qm = new PeitaohgQueryModel();

       qm.setId(id);

       request.setAttribute("newsupdate", peitaohgEbi.getByCondition(qm, 0, 20));

       return "byid";

    }

    //删除

    public String deletedById() {

       HttpServletRequest request = ServletActionContext.getRequest();

       int id = Integer.parseInt(request.getParameter("id"));

       peitaohgEbi.delete(id);

       return SUCCESS;

    }

   

    public String update() {

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

       String ttime = df.format(new Date());// new Date()为获取当前系统时间

       peitaohgModel.setTtime(ttime);

       peitaohgEbi.update(peitaohgModel);

       return "update";

    }

    public String getczhg(){

       HttpServletRequest request = ServletActionContext.getRequest();

      

       List<HuoguiModel> hglist = huoguiEbi.getAll();

       List<ChuanzhiModel> czlist = chuanzhiEbi.getAll();

       request.setAttribute("hgmodel",hglist);

       request.setAttribute("czmodel",czlist);

       return "addczhg";

    }

}

公众号扫入回复--“Jsp码头船只货柜码”即可--->获取源码

 

原文地址:https://www.cnblogs.com/chenqiwei/p/RunWsh_jsp001.html