当前位置:   article > 正文

Java项目:快递之家管理系统的设计与实现(SpringBoot+MybatisPlus+Thymeleaf+jquery+layui)1026_物流管理系统的设计与实现java

物流管理系统的设计与实现java

项目描述

该项目 两种角色 用户、管理员:
用户主要功能有:待收列表,收件列表,寄件功能,寄件列表,个人信息修改;
管理员主要功能有:相比于用户多了 物流管理,用户管理;

运行环境

jdk8+mysql5.7+IntelliJ IDEA+maven

项目技术

SpringBoot+MybatisPlus+Thymeleaf+jquery+layui

项目截图

登录
在这里插入图片描述

注册
在这里插入图片描述

寄件
在这里插入图片描述寄件列表
在这里插入图片描述

待收件
在这里插入图片描述收件列表
在这里插入图片描述
个人信息
在这里插入图片描述

物流管理
在这里插入图片描述
用户管理在这里插入图片描述
代码结构在这里插入图片描述

部分代码



/**
 * @author GXY
 */
@Controller
public class adminController {

    @Autowired
    PostService postService;

    @Autowired
    CategoryService categoryService;

    @Autowired
    PositionService positionService;

    @Autowired
    OrdersService ordersService;

    @Autowired
    UserService userService;

    //寄件管理
    @GetMapping("/toAdminSend")
    public String toAdminSend(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, HttpSession session, Model model, RedirectAttributes attributes) {
        User userInfo = (User) session.getAttribute("user");
        if (userInfo != null) {
            PageHelper.startPage(pageNum, 6);
            List<Post> postList = postService.findAllPost();
            PageInfo<Post> pageInfo = new PageInfo<>(postList);
            model.addAttribute("postList", postList);
            model.addAttribute("pageInfo", pageInfo);
            List<Category> categoryList = categoryService.list();
            model.addAttribute("categoryList", categoryList);
            return "adminSend";
        } else {
            attributes.addFlashAttribute("message", "权限不足,请先登录");
            return "redirect:/toLogin";
        }
    }

    @GetMapping("adminSendPost/{id}")
    public String adminSendPost(@PathVariable Integer id) {
        postService.updatePostStatusTo1(id, new Date());
        return "redirect:/toAdminSend";
    }

    @PostMapping("/searchPost")
    public String searchPost(Post post, @RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, Model model) {
        PageHelper.startPage(pageNum, 6);
        List<Post> postList = postService.findPostBySearch(post);
        PageInfo<Post> pageInfo = new PageInfo<>(postList);
        List<Category> categoryList = categoryService.list();
        model.addAttribute("categoryList", categoryList);
        model.addAttribute("postList", postList);
        model.addAttribute("pageInfo", pageInfo);
        return "adminSend";
    }


    //收件管理
    @GetMapping("adminPickUpPost/{id}")
    public String adminPickUpPost(@PathVariable Integer id, Model model) {
        Post post = postService.findById(id);
        model.addAttribute("post", post);
        QueryWrapper<Position> status0 = new QueryWrapper<Position>().eq("status", 0);
        List<Position> positionList = positionService.list(status0);
        model.addAttribute("positionList", positionList);
        return "adminPickUp";
    }

//    @GetMapping("/toAdminPickUp")
//    public String toAdminPickUp(Model model, RedirectAttributes attributes, HttpSession session) {
//        User userInfo = (User) session.getAttribute("user");
//        if (userInfo != null) {
//            QueryWrapper<Position> status0 = new QueryWrapper<Position>().eq("status", 0);
//            List<Position> positionList = positionService.list(status0);
//            model.addAttribute("positionList", positionList);
//            return "adminPickUp";
//        } else {
//            attributes.addFlashAttribute("message", "权限不足,请先登录");
//            return "redirect:/toLogin";
//        }
//    }

    @PostMapping("/adminPickUpOrders")
    public String adminPickUpOrders(@RequestParam String num, @RequestParam String name, @RequestParam String sendName, @RequestParam Integer id, @RequestParam Integer positionId,RedirectAttributes attributes) {

        QueryWrapper<User> userName = new QueryWrapper<User>().eq("name", name);
        try {
            User user = userService.getOne(userName);
            if (user==null) {
                attributes.addFlashAttribute("message", "收件人有误,请注册后邮寄");

            }
            Orders orders = new Orders();
            orders.setUserId(user.getId());
            orders.setSendName(sendName);
            orders.setPositionId(positionId);
            orders.setCreateTime(new Date());
            orders.setUpdateTime(new Date());
            orders.setNum(num);
            ordersService.save(orders);
        }catch (NullPointerException e) {
            e.printStackTrace();
        }



        //柜子状态变为1
        Position position = positionService.getById(positionId);
        position.setStatus(1);
        positionService.updateById(position);
        //post状态变为2
        postService.updatePostStatusTo2(id, new Date());

        return "redirect:/toAdminSend";
    }

    //用户管理
    @GetMapping("/toAdminUser")
    public String toAdminUser(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, HttpSession session, Model model, RedirectAttributes attributes) {
        User userInfo = (User) session.getAttribute("user");
        if (userInfo != null) {
            PageHelper.startPage(pageNum, 6);
            List<User> userList = userService.list();
            PageInfo<User> pageInfo = new PageInfo<>(userList);
            model.addAttribute("userList", userList);
            model.addAttribute("pageInfo", pageInfo);
            return "adminUser";
        } else {
            attributes.addFlashAttribute("message", "权限不足,请先登录");
            return "redirect:/toLogin";
        }
    }

    @GetMapping("/adminUserTo1/{id}")
    public String adminUserTo1(@PathVariable Integer id, HttpSession session) {
        User user = userService.getById(id);
        user.setRole(1);
        userService.updateById(user);

        User userInfo = (User) session.getAttribute("user");
        if (id == userInfo.getId()) {
            session.setAttribute("user", user);
            return "index";
        }
        return "redirect:/toAdminUser";
    }

    @GetMapping("/adminUserTo0/{id}")
    public String adminUserTo0(@PathVariable Integer id) {
        User user = userService.getById(id);
        user.setRole(0);
        userService.updateById(user);
        return "redirect:/toAdminUser";
    }

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
/**
 * @author GXY
 */
@Controller
public class PickUpController {

    @Autowired
    OrdersService ordersService;

    @Autowired
    PositionService positionService;

    @Autowired
    PostService postService;

    @GetMapping("/toPickUp")
    public String toPickUp(@RequestParam(required = false, defaultValue = "1", value = "pageNum") int pageNum, Model model, HttpSession session, RedirectAttributes attributes) {
        User userInfo = (User) session.getAttribute("user");
        if (userInfo != null) {
            PageHelper.startPage(pageNum, 6);
            List<Orders> ordersList = ordersService.findByUserId(userInfo.getId());
            PageInfo<Orders> pageInfo = new PageInfo<>(ordersList);
            model.addAttribute("ordersList",ordersList);
            model.addAttribute("pageInfo",pageInfo);
            return "pickUp";
        } else {
            attributes.addFlashAttribute("message", "权限不足,请先登录");
            return "redirect:/toLogin";
        }
    }

    @GetMapping("/pickUpOrders/{id}")
    public String pickUpOrders(@PathVariable Integer id){
        ordersService.updateOrdersStatusTo1(id,new Date());
        Orders orders = ordersService.findById(id);
        //柜子状态变为0
        Position position = positionService.getById(orders.getPositionId());
        position.setStatus(0);
        positionService.updateById(position);
        //post状态变为3
        Post post = postService.findByNum(orders.getNum());
        postService.updatePostStatusTo3(post.getId(), new Date());

        return "redirect:/toPickUp";
    }

    @GetMapping("/pickUpOrders2/{id}")
    public String pickUpOrders2(@PathVariable Integer id){
        ordersService.updateOrdersStatusTo1(id,new Date());
        //柜子状态变为0
        Orders orders = ordersService.findById(id);
        Position position = positionService.getById(orders.getPositionId());
        position.setStatus(0);
        positionService.updateById(position);
        return "redirect:/toUserPickUp";
    }

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59

源码获取:
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/155641

推荐阅读
相关标签