package com.ev.logistics.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ev.logistics.entity.*;
import com.ev.logistics.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;
/**
* @author EV
* @date 2021/5/5 0:15
*/
@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";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于SpringBoot的快递之家管理系统的设计与实现 运行环境 jdk8+mysql5.7+IntelliJ IDEA+maven 项目技术(必填) SpringBoot+MybatisPlus+Thymeleaf+jquery+layui 登录注册 我要收件 我要寄件 我寄出的 我收到的 物流管理,寄出 我的寄件 物流信息,揽件 按状态搜索物流信息 个人信息 用户管理 1. springboot项目,按照步骤正常安装就行,搭建完成后启动LogisticsApplication.java即可 2. 静态资源文件打开比较慢
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot的快递之家管理系统的设计与实现 (210个子文件)
$CACHE_FILE$ 3KB
layui.css 83KB
layer.css 15KB
me.css 15KB
laydate.css 9KB
login.css 3KB
code.css 1KB
font.css 527B
iconfont.eot 46KB
loading-0.gif 6KB
loading-2.gif 2KB
loading-1.gif 701B
adminSend.html 8KB
fragments.html 6KB
fragments.html 6KB
userInfo.html 5KB
adminUser.html 5KB
userSend.html 5KB
userPickUp.html 4KB
pickUp.html 4KB
send2.html 4KB
send3.html 3KB
send.html 3KB
adminPickUp.html 3KB
register.html 2KB
404.html 1KB
error.html 1KB
index.html 1KB
500.html 1KB
login.html 931B
logistics.iml 12KB
adminController.java 7KB
UserController.java 7KB
AliyunOssUtil.java 4KB
LoginController.java 4KB
PickUpController.java 3KB
SendController.java 2KB
PostServiceImpl.java 2KB
OrdersServiceImpl.java 1KB
PostDao.java 912B
Post.java 774B
PostService.java 696B
OrdersDao.java 649B
Orders.java 639B
AliyunOssConfigConstant.java 598B
User.java 598B
IndexController.java 577B
OrdersService.java 490B
CategoryServiceImpl.java 465B
PositionServiceImpl.java 465B
UserServiceImpl.java 437B
Position.java 410B
Category.java 378B
LogisticsApplication.java 340B
PositionDao.java 304B
CategoryDao.java 304B
UserDao.java 292B
CategoryService.java 259B
PositionService.java 259B
UserService.java 247B
LogisticsApplicationTests.java 233B
avatar1.jpg 6KB
vue.js 345KB
layui.all.js 272KB
jquery.js 95KB
mobile.js 52KB
table.js 31KB
laydate.js 27KB
layer.js 22KB
layui.js 19KB
layedit.js 12KB
colorpicker.js 11KB
tree.js 11KB
form.js 9KB
upload.js 7KB
element.js 7KB
slider.js 7KB
transfer.js 6KB
general.js 6KB
laypage.js 4KB
register.js 4KB
userInfo.js 4KB
carousel.js 4KB
util.js 4KB
rate.js 3KB
flow.js 2KB
laytpl.js 2KB
send.js 1KB
code.js 1KB
index.png 3.25MB
bg.png 2.99MB
icon.png 11KB
icon-ext.png 6KB
application.properties 2B
logistics.sql 9KB
iconfont.svg 300KB
iconfont.ttf 45KB
iconfont.woff 30KB
iconfont.woff2 25KB
workspace.xml 36KB
共 210 条
- 1
- 2
- 3
资源评论
办公模板库素材蛙
- 粉丝: 1660
- 资源: 2299
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Autosar学习视频10-19节
- stm32小车.zip
- AshampooUnInstaller v15.00.22 Portable一款强大的卸载工具,彻底、智能著称阿香婆强制卸载软件.rar
- Ashampoo WinOptimizer v27.00.05 阿香婆一款专业的垃圾清理、碎片整理启动项管理系统优化工具.rar
- misc设备驱动 正点原子阿尔法
- youleng-wms JAVA开发的WMS源码可以借签学习 数据库MYSQL
- 385大神asp.net三层设计停车场管理系统毕业课程源码设计+参考论文
- 数据集,训练数据集,深度学习
- 384大神asp.net基于三层汽车进销存销售管理系统毕业课程源码设计
- AutoSAR基础学习资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功