赞
踩
作者主页:Java毕设网
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
管理员功能:订单关联、人员关联、订单回收、用户反馈、重置密码、退出系统
用户功能:接单大厅、我的订单、重置密码、退出系统
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7、8.0等版本均可;
5.是否Maven项目:是;
1.后端:SpringBoot+Mybatis+Mysql
2.前端:html+css+javascript
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8091/ 注意:端口不要修改,否则会有异常
- /**
- * 职员管理
- * @author jitwxs
- * @date 2018/5/2 16:49
- */
- @RestController
- @RequestMapping("/admin/staff")
- public class StaffController {
- @Autowired
- private SysUserService userService;
- @Autowired
- private GlobalFunction globalFunction;
-
- private void changeUserStatus(String[] ids, Integer status) {
- for(String id : ids) {
- SysUser user = userService.selectById(id);
- user.setStatus(status);
- userService.updateById(user);
- }
- }
-
- /**
- * 获取用户的状态列表
- * @author jitwxs
- * @since 2018/5/2 9:58
- */
- @GetMapping("/status")
- public Msg listStaffStatus() {
- List<Map<String,Object>> result = new ArrayList<>();
- for(SysUserStatusEnum enums :SysUserStatusEnum.values()) {
- Map<String,Object> map = new HashMap<>();
- map.put("id",enums.getIndex());
- map.put("name",enums.getName());
- result.add(map);
- }
- return Msg.ok(null,result);
- }
-
- /**
- * 获取所有的职员名,用于分配订单
- * @author jitwxs
- * @since 2018/5/14 13:38
- */
- @GetMapping("/listName")
- public Msg listStaff() {
- // 获取所有在职的职员
- List<SysUser> staffs = userService.selectList(new EntityWrapper<SysUser>()
- .eq("status", SysUserStatusEnum.ACTIVE.getIndex())
- .eq("role_id", RoleEnum.STAFF.getIndex()));
-
- return Msg.ok(null,staffs);
- }
-
- /**
- * 获取所有职员
- * @author jitwxs
- * @since 2018/5/2 16:50
- */
- @GetMapping("/list")
- public Map listStaff(Integer rows, Integer page, SysUserSelectWrapper usw) {
- // Get请求中文编码
- try {
- usw.setName(globalFunction.iso8859ToUtf8(usw.getName()));
- usw.setAddress(globalFunction.iso8859ToUtf8(usw.getAddress()));
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
-
- // 得到筛选条件
- EntityWrapper<SysUser> userWrapper = globalFunction.getSysUserWrapper(usw);
- // 不显示admin角色
- userWrapper.ne("role_id", RoleEnum.ADMIN.getIndex());
- Page<SysUser> selectPage = userService.selectPage(new Page<>(page, rows), userWrapper);
-
- List<SysUserDto> list = globalFunction.sysUser2dto(selectPage.getRecords());
-
- Map<String,Object> map = new HashMap<>();
- map.put("total", selectPage.getTotal());
- map.put("rows", list);
-
- return map;
- }
-
- /**
- * 更新用户信息
- */
- @PostMapping("")
- public Msg update(SysUser user) {
- userService.updateById(user);
- return Msg.ok();
- }
-
- /**
- * 新增用户信息
- */
- @PostMapping("/insert")
- public Msg insert(SysUser user) {
- UUID uuid = UUID.randomUUID();
- user.setId(uuid.toString());
- user.setRoleId(1);
- user.setStatus(0);
- user.setPassword(PasswordUtils.entryptPassword("123"));
- //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
- user.setCreateDate(new Date());// new Date()为获取当前系统时间
- user.setUpdateDate(new Date());
- userService.insert(user);
- return Msg.ok();
- }
-
- /**
- * 获取用户信息
- * @author jitwxs
- * @since 2018/5/14 16:15
- */
- @GetMapping("/{id}")
- public Msg getById(@PathVariable String id) {
- SysUser user = userService.selectById(id);
- return Msg.ok(null,user);
- }
-
- /**
- * 修改员工为在职
- * @author jitwxs
- * @since 2018/5/13 20:42
- */
- @PostMapping("/active")
- public Msg changeActive(String[] ids) {
- changeUserStatus(ids, SysUserStatusEnum.ACTIVE.getIndex());
- return Msg.ok();
- }
-
- /**
- * 修改员工为冻结
- * @author jitwxs
- * @since 2018/5/13 20:42
- */
- @PostMapping("/freeze")
- public Msg changeFreeze(String[] ids) {
- changeUserStatus(ids, SysUserStatusEnum.FREEZE.getIndex());
- return Msg.ok();
- }
-
- /**
- * 修改员工为离职
- * @author jitwxs
- * @since 2018/5/13 20:42
- */
- @PostMapping("/leave")
- public Msg changeLeave(String[] ids) {
- changeUserStatus(ids, SysUserStatusEnum.LEAVE.getIndex());
- return Msg.ok();
- }
-
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- /**
- * 管理员订单Controller
- * @author jitwxs
- * @date 2018/5/2 0:21
- */
- @RestController
- @RequestMapping("/admin/express")
- public class ExpressController {
- @Autowired
- private ExpressService expressService;
- @Autowired
- private GlobalFunction globalFunction;
- @Autowired
- private ExpressPaymentService expressPaymentService;
-
- /**
- * 获取订单的状态列表
- * @author jitwxs
- * @since 2018/5/2 9:58
- */
- @GetMapping("/status")
- public Msg listExpressStatus() {
- List<Map<String,Object>> result = new ArrayList<>();
- for(ExpressStatusEnum enums :ExpressStatusEnum.values()) {
- Map<String,Object> map = new HashMap<>();
- map.put("id",enums.getIndex());
- map.put("name",enums.getName());
- result.add(map);
- }
- return Msg.ok(null,result);
- }
-
- /**
- * 订单列表
- * @param esw 筛选条件
- * @author jitwxs
- * @since 2018/5/2 0:33
- */
- @GetMapping("/list")
- public Map listExpress(Integer rows, Integer page, ExpressSelectWrapper esw, @RequestParam(defaultValue = "createDate") String order) {
- // Get请求中文编码
- try {
- esw.setName(globalFunction.iso8859ToUtf8(esw.getName()));
- esw.setStaffName(globalFunction.iso8859ToUtf8(esw.getStaffName()));
- esw.setAddress(globalFunction.iso8859ToUtf8(esw.getAddress()));
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- // 得到筛选条件
- EntityWrapper<Express> expressWrapper = globalFunction.getExpressWrapper(esw);
- Page<Express> selectPage = expressService.selectPage(new Page<>(page, rows, order, false), expressWrapper);
-
- List<ExpressDto> list = globalFunction.express2dto(selectPage.getRecords());
-
- Map<String,Object> map = new HashMap<>(16);
- map.put("total", selectPage.getTotal());
- map.put("rows", list);
- return map;
- }
-
- /**
- * 获取单个订单详情
- * @author jitwxs
- * @since 2018/5/2 14:04
- */
- @GetMapping("/{id}")
- public Msg getById(@PathVariable String id) {
- Express express = expressService.selectById(id);
- ExpressDto expressDto = globalFunction.express2dto(express);
-
- return Msg.ok(null,expressDto);
- }
-
- /**
- * 分配订单
- * @param ids 订单数组
- * @param staffId 派送员id
- * @author jitwxs
- * @since 2018/5/2 16:37
- */
- @PostMapping("/assign")
- public Msg assignExpress(String[] ids,String staffId) {
- for(String id : ids) {
- Express express = expressService.selectById(id);
- // 只有订单状态为WAIT_DIST时才要分配订单
- if(ExpressStatusEnum.WAIT_DIST.getName().equals(ExpressStatusEnum.getName(express.getStatus()))) {
- express.setStaff(staffId);
- express.setStatus(ExpressStatusEnum.TRANSPORT.getIndex());
- expressService.updateById(express);
- }
- }
- return Msg.ok();
- }
-
- /**
- * 确认订单
- * @author jitwxs
- * @since 2018/5/13 17:51
- */
- @PostMapping("/confirm")
- public Msg confirmExpress(ExpressPayment payment) {
- String id = payment.getExpressId();
-
- Express express = expressService.selectById(id);
- express.setStatus(ExpressStatusEnum.COMPLTE.getIndex());
- expressService.updateById(express);
-
- expressPaymentService.updateById(payment);
-
- return Msg.ok();
- }
-
- /**
- * 异常订单
- * @author jitwxs
- * @since 2018/5/13 17:51
- */
- @PostMapping("/error")
- public Msg errorExpress(String[] ids, String text) {
- for(String id : ids) {
- Express express = expressService.selectById(id);
- // 只有订单状态为TRANSPORT时才要确认
- if(ExpressStatusEnum.TRANSPORT.getName().equals(ExpressStatusEnum.getName(express.getStatus()))) {
- express.setStatus(ExpressStatusEnum.ERROR.getIndex());
- express.setStaffRemark(text);
- expressService.updateById(express);
- }
- }
- return Msg.ok();
- }
-
- /**
- * 删除订单
- * @author jitwxs
- * @since 2018/5/2 14:05
- */
- @PostMapping("/delete")
- public Msg deleteById(String[] ids) {
- for(String id : ids) {
- Express express = expressService.selectById(id);
- if(express != null) {
- // 设置删除标记为true
- express.setHasDelete(true);
- expressService.updateById(express);
- }
- }
- return Msg.ok();
- }
-
- /**
- * 恢复订单
- * @author jitwxs
- * @since 2018/5/2 14:05
- */
- @PostMapping("/recycle")
- public Msg recycleById(String[] ids) {
- for(String id : ids) {
- Express express = expressService.selectById(id);
- if(express != null) {
- // 设置删除标记为false
- express.setHasDelete(false);
- expressService.updateById(express);
- }
- }
- return Msg.ok();
- }
-
- /**
- * 彻底删除订单
- * @author jitwxs
- * @since 2018/5/2 14:05
- */
- @PostMapping("/clean")
- public Msg cleanById(String[] ids) {
- for(String id : ids) {
- expressService.deleteById(id);
- }
- return Msg.ok();
- }
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。