基于SpringBoot+Vue码头船只货柜管理系统

作者简介:Java领域优质创作者、优快云博客专家 、优快云内容合伙人、掘金特邀作者、阿里云博客专家、51CTO特邀作者、多年架构师设计经验、多年校企合作经验,被多个学校常年聘为校外企业导师,指导学生毕业设计并参与学生毕业答辩指导,有较为丰富的相关经验。期待与各位高校教师、企业讲师以及同行交流合作

主要内容:Java项目、Python项目、前端项目、PHP、ASP.NET、人工智能与大数据、单片机开发、物联网设计与开发设计、简历模板、学习资料、面试题库、技术互助、就业指导等

业务范围:免费功能设计、开题报告、任务书、中期检查PPT、系统功能实现、代码编写、论文编写和辅导、论文降重、长期答辩答疑辅导、腾讯会议一对一专业讲解辅导答辩、模拟答辩演练、和理解代码逻辑思路等

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-XX-364

一,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

开发技术:SpringBoot+Vue

二,项目简介

21世纪是一个全新的具有挑战性的世纪,全世界的码头都将面对全新的问题,面临新的挑战。全球化大潮的涌动,催促着一种新的国际体制的加速形成。国际贸易港口码头之间的合作与竞争将更加频繁和激烈。以信息技术为代表的新技术革命迅猛发展,高集成度、智能化、光纤化、数字化、综合化、网络化,为船运和码头业提供了更为广阔的发展空间;国际经济结构的调整,经济全球化的加速,必将促进港口间国际贸易的发展与运量的增长。

随着计算机管理技术的高速发展,各个领域都应用计算机对相关信息进行管理。本系统是一个复杂而且涉及内容众多的系统,码头船只货柜管理系统是码头管理系统中一个比较重要的部分。为了码头管理工作节省不必要的人力、物力和资源,迫切需要较好的码头船只货柜管理系统软件来提高工作效率和信息的准确率,以降低经济成本。利用计算机、网络、计算机应用软件等现代科技和手段,加强和改进码头管理工作,可以降低管理工作的成本,减轻工作强度,提高工作效率。科技的发展就是要为生产服务,有了码头船只货柜管理系统一定会为码头工作带来便捷。

码头船只货柜管理系统以Java开发语言开发,MySQL为后台数据库,采用SSM框架开发。SSM框架集由Spring、SpringMVC、MyBatis三个开源框架整合而成,常作为数据源较简单的web项目的框架。其中spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器框架。SpringMVC分离了控制器、模型对象、分派器以及处理程序对象的角色,这种分离让它们更容易进行定制。MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架。开发工具是IDEA。

码头船只货柜管理系统拥有的功能有:用户登录、修改个人信息、查看码头信息;增加、删除、修改系统管理人员;增加、删除、修改船只信息;删除、增加、修改船只路线信息;增加、修改、删除货柜信息。因此,该系统应具有如下的功能:

a.用户登录:该模块分为两种用户的登录,一是一般(查看)用户,他的权限只有修改个人信息和查看功能;二是具有最大权限的系统管理员,他可以修改自己的信息,并且不仅有查看、增删改的基本权限,还有对用户的管理权限。

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

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

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

e.船只管理:该模块实现船只的增加,删除和修改

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

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

三,系统展示

四,核心代码展示


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 路线信息
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/luxian")
public class LuxianController {
    private static final Logger logger = LoggerFactory.getLogger(LuxianController.class);

    @Autowired
    private LuxianService luxianService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private ChuanzhiService chuanzhiService;

    @Autowired
    private YonghuService yonghuService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        params.put("luxianDeleteStart",1);params.put("luxianDeleteEnd",1);
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = luxianService.queryPage(params);

        //字典表数据转换
        List<LuxianView> list =(List<LuxianView>)page.getList();
        for(LuxianView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        LuxianEntity luxian = luxianService.selectById(id);
        if(luxian !=null){
            //entity转view
            LuxianView view = new LuxianView();
            BeanUtils.copyProperties( luxian , view );//把实体数据重构到view中

                //级联表
                ChuanzhiEntity chuanzhi = chuanzhiService.selectById(luxian.getChuanzhiId());
                if(chuanzhi != null){
                    BeanUtils.copyProperties( chuanzhi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setChuanzhiId(chuanzhi.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody LuxianEntity luxian, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,luxian:{}",this.getClass().getName(),luxian.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");

        Wrapper<LuxianEntity> queryWrapper = new EntityWrapper<LuxianEntity>()
            .eq("chuanzhi_id", luxian.getChuanzhiId())
            .eq("luxian_uuid_number", luxian.getLuxianUuidNumber())
            .eq("luxian_delete", luxian.getLuxianDelete())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LuxianEntity luxianEntity = luxianService.selectOne(queryWrapper);
        if(luxianEntity==null){
            luxian.setLuxianDelete(1);
            luxian.setCreateTime(new Date());
            luxianService.insert(luxian);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody LuxianEntity luxian, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,luxian:{}",this.getClass().getName(),luxian.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(StringUtil.isEmpty(role))
//            return R.error(511,"权限为空");
        //根据字段查询是否有相同数据
        Wrapper<LuxianEntity> queryWrapper = new EntityWrapper<LuxianEntity>()
            .notIn("id",luxian.getId())
            .andNew()
            .eq("chuanzhi_id", luxian.getChuanzhiId())
            .eq("luxian_uuid_number", luxian.getLuxianUuidNumber())
            .eq("luxian_delete", luxian.getLuxianDelete())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LuxianEntity luxianEntity = luxianService.selectOne(queryWrapper);
        if(luxianEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      luxian.set
            //  }
            luxianService.updateById(luxian);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        ArrayList<LuxianEntity> list = new ArrayList<>();
        for(Integer id:ids){
            LuxianEntity luxianEntity = new LuxianEntity();
            luxianEntity.setId(id);
            luxianEntity.setLuxianDelete(2);
            list.add(luxianEntity);
        }
        if(list != null && list.size() >0){
            luxianService.updateBatchById(list);
        }
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<LuxianEntity> luxianList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            LuxianEntity luxianEntity = new LuxianEntity();
//                            luxianEntity.setChuanzhiId(Integer.valueOf(data.get(0)));   //船只 要改的
//                            luxianEntity.setLuxianUuidNumber(data.get(0));                    //路线编号 要改的
//                            luxianEntity.setLuxianContent("");//照片
//                            luxianEntity.setLuxianDelete(1);//逻辑删除字段
//                            luxianEntity.setCreateTime(date);//时间
                            luxianList.add(luxianEntity);


                            //把要查询是否重复的字段放入map中
                                //路线编号
                                if(seachFields.containsKey("luxianUuidNumber")){
                                    List<String> luxianUuidNumber = seachFields.get("luxianUuidNumber");
                                    luxianUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> luxianUuidNumber = new ArrayList<>();
                                    luxianUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("luxianUuidNumber",luxianUuidNumber);
                                }
                        }

                        //查询是否重复
                         //路线编号
                        List<LuxianEntity> luxianEntities_luxianUuidNumber = luxianService.selectList(new EntityWrapper<LuxianEntity>().in("luxian_uuid_number", seachFields.get("luxianUuidNumber")).eq("luxian_delete", 1));
                        if(luxianEntities_luxianUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(LuxianEntity s:luxianEntities_luxianUuidNumber){
                                repeatFields.add(s.getLuxianUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [路线编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        luxianService.insertBatch(luxianList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = luxianService.queryPage(params);

        //字典表数据转换
        List<LuxianView> list =(List<LuxianView>)page.getList();
        for(LuxianView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        LuxianEntity luxian = luxianService.selectById(id);
            if(luxian !=null){


                //entity转view
                LuxianView view = new LuxianView();
                BeanUtils.copyProperties( luxian , view );//把实体数据重构到view中

                //级联表
                    ChuanzhiEntity chuanzhi = chuanzhiService.selectById(luxian.getChuanzhiId());
                if(chuanzhi != null){
                    BeanUtils.copyProperties( chuanzhi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setChuanzhiId(chuanzhi.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody LuxianEntity luxian, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,luxian:{}",this.getClass().getName(),luxian.toString());
        Wrapper<LuxianEntity> queryWrapper = new EntityWrapper<LuxianEntity>()
            .eq("chuanzhi_id", luxian.getChuanzhiId())
            .eq("luxian_uuid_number", luxian.getLuxianUuidNumber())
            .eq("luxian_delete", luxian.getLuxianDelete())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LuxianEntity luxianEntity = luxianService.selectOne(queryWrapper);
        if(luxianEntity==null){
            luxian.setLuxianDelete(1);
            luxian.setCreateTime(new Date());
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      luxian.set
        //  }
        luxianService.insert(luxian);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

五,相关作品展示

基于Java开发、Python开发、PHP开发、C#开发等相关语言开发的实战项目

基于Nodejs、Vue等前端技术开发的前端实战项目

基于微信小程序和安卓APP应用开发的相关作品

基于51单片机等嵌入式物联网开发应用

基于各类算法实现的AI智能应用

基于大数据实现的各类数据管理和推荐系统

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_469603589

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值