当前位置:   article > 正文

Java项目:基于ssm开发的Java快递代拿系统_ssm快递代拿系统

ssm快递代拿系统

作者主页: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/ 注意:端口不要修改,否则会有异常

五、运行截图

六、相关代码

职员管理控制器

  1. /**
  2. * 职员管理
  3. * @author jitwxs
  4. * @date 2018/5/2 16:49
  5. */
  6. @RestController
  7. @RequestMapping("/admin/staff")
  8. public class StaffController {
  9. @Autowired
  10. private SysUserService userService;
  11. @Autowired
  12. private GlobalFunction globalFunction;
  13. private void changeUserStatus(String[] ids, Integer status) {
  14. for(String id : ids) {
  15. SysUser user = userService.selectById(id);
  16. user.setStatus(status);
  17. userService.updateById(user);
  18. }
  19. }
  20. /**
  21. * 获取用户的状态列表
  22. * @author jitwxs
  23. * @since 2018/5/2 9:58
  24. */
  25. @GetMapping("/status")
  26. public Msg listStaffStatus() {
  27. List<Map<String,Object>> result = new ArrayList<>();
  28. for(SysUserStatusEnum enums :SysUserStatusEnum.values()) {
  29. Map<String,Object> map = new HashMap<>();
  30. map.put("id",enums.getIndex());
  31. map.put("name",enums.getName());
  32. result.add(map);
  33. }
  34. return Msg.ok(null,result);
  35. }
  36. /**
  37. * 获取所有的职员名,用于分配订单
  38. * @author jitwxs
  39. * @since 2018/5/14 13:38
  40. */
  41. @GetMapping("/listName")
  42. public Msg listStaff() {
  43. // 获取所有在职的职员
  44. List<SysUser> staffs = userService.selectList(new EntityWrapper<SysUser>()
  45. .eq("status", SysUserStatusEnum.ACTIVE.getIndex())
  46. .eq("role_id", RoleEnum.STAFF.getIndex()));
  47. return Msg.ok(null,staffs);
  48. }
  49. /**
  50. * 获取所有职员
  51. * @author jitwxs
  52. * @since 2018/5/2 16:50
  53. */
  54. @GetMapping("/list")
  55. public Map listStaff(Integer rows, Integer page, SysUserSelectWrapper usw) {
  56. // Get请求中文编码
  57. try {
  58. usw.setName(globalFunction.iso8859ToUtf8(usw.getName()));
  59. usw.setAddress(globalFunction.iso8859ToUtf8(usw.getAddress()));
  60. } catch (UnsupportedEncodingException e) {
  61. e.printStackTrace();
  62. }
  63. // 得到筛选条件
  64. EntityWrapper<SysUser> userWrapper = globalFunction.getSysUserWrapper(usw);
  65. // 不显示admin角色
  66. userWrapper.ne("role_id", RoleEnum.ADMIN.getIndex());
  67. Page<SysUser> selectPage = userService.selectPage(new Page<>(page, rows), userWrapper);
  68. List<SysUserDto> list = globalFunction.sysUser2dto(selectPage.getRecords());
  69. Map<String,Object> map = new HashMap<>();
  70. map.put("total", selectPage.getTotal());
  71. map.put("rows", list);
  72. return map;
  73. }
  74. /**
  75. * 更新用户信息
  76. */
  77. @PostMapping("")
  78. public Msg update(SysUser user) {
  79. userService.updateById(user);
  80. return Msg.ok();
  81. }
  82. /**
  83. * 新增用户信息
  84. */
  85. @PostMapping("/insert")
  86. public Msg insert(SysUser user) {
  87. UUID uuid = UUID.randomUUID();
  88. user.setId(uuid.toString());
  89. user.setRoleId(1);
  90. user.setStatus(0);
  91. user.setPassword(PasswordUtils.entryptPassword("123"));
  92. //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
  93. user.setCreateDate(new Date());// new Date()为获取当前系统时间
  94. user.setUpdateDate(new Date());
  95. userService.insert(user);
  96. return Msg.ok();
  97. }
  98. /**
  99. * 获取用户信息
  100. * @author jitwxs
  101. * @since 2018/5/14 16:15
  102. */
  103. @GetMapping("/{id}")
  104. public Msg getById(@PathVariable String id) {
  105. SysUser user = userService.selectById(id);
  106. return Msg.ok(null,user);
  107. }
  108. /**
  109. * 修改员工为在职
  110. * @author jitwxs
  111. * @since 2018/5/13 20:42
  112. */
  113. @PostMapping("/active")
  114. public Msg changeActive(String[] ids) {
  115. changeUserStatus(ids, SysUserStatusEnum.ACTIVE.getIndex());
  116. return Msg.ok();
  117. }
  118. /**
  119. * 修改员工为冻结
  120. * @author jitwxs
  121. * @since 2018/5/13 20:42
  122. */
  123. @PostMapping("/freeze")
  124. public Msg changeFreeze(String[] ids) {
  125. changeUserStatus(ids, SysUserStatusEnum.FREEZE.getIndex());
  126. return Msg.ok();
  127. }
  128. /**
  129. * 修改员工为离职
  130. * @author jitwxs
  131. * @since 2018/5/13 20:42
  132. */
  133. @PostMapping("/leave")
  134. public Msg changeLeave(String[] ids) {
  135. changeUserStatus(ids, SysUserStatusEnum.LEAVE.getIndex());
  136. return Msg.ok();
  137. }
  138. }

订单管理控制器

  1. /**
  2. * 管理员订单Controller
  3. * @author jitwxs
  4. * @date 2018/5/2 0:21
  5. */
  6. @RestController
  7. @RequestMapping("/admin/express")
  8. public class ExpressController {
  9. @Autowired
  10. private ExpressService expressService;
  11. @Autowired
  12. private GlobalFunction globalFunction;
  13. @Autowired
  14. private ExpressPaymentService expressPaymentService;
  15. /**
  16. * 获取订单的状态列表
  17. * @author jitwxs
  18. * @since 2018/5/2 9:58
  19. */
  20. @GetMapping("/status")
  21. public Msg listExpressStatus() {
  22. List<Map<String,Object>> result = new ArrayList<>();
  23. for(ExpressStatusEnum enums :ExpressStatusEnum.values()) {
  24. Map<String,Object> map = new HashMap<>();
  25. map.put("id",enums.getIndex());
  26. map.put("name",enums.getName());
  27. result.add(map);
  28. }
  29. return Msg.ok(null,result);
  30. }
  31. /**
  32. * 订单列表
  33. * @param esw 筛选条件
  34. * @author jitwxs
  35. * @since 2018/5/2 0:33
  36. */
  37. @GetMapping("/list")
  38. public Map listExpress(Integer rows, Integer page, ExpressSelectWrapper esw, @RequestParam(defaultValue = "createDate") String order) {
  39. // Get请求中文编码
  40. try {
  41. esw.setName(globalFunction.iso8859ToUtf8(esw.getName()));
  42. esw.setStaffName(globalFunction.iso8859ToUtf8(esw.getStaffName()));
  43. esw.setAddress(globalFunction.iso8859ToUtf8(esw.getAddress()));
  44. } catch (UnsupportedEncodingException e) {
  45. e.printStackTrace();
  46. }
  47. // 得到筛选条件
  48. EntityWrapper<Express> expressWrapper = globalFunction.getExpressWrapper(esw);
  49. Page<Express> selectPage = expressService.selectPage(new Page<>(page, rows, order, false), expressWrapper);
  50. List<ExpressDto> list = globalFunction.express2dto(selectPage.getRecords());
  51. Map<String,Object> map = new HashMap<>(16);
  52. map.put("total", selectPage.getTotal());
  53. map.put("rows", list);
  54. return map;
  55. }
  56. /**
  57. * 获取单个订单详情
  58. * @author jitwxs
  59. * @since 2018/5/2 14:04
  60. */
  61. @GetMapping("/{id}")
  62. public Msg getById(@PathVariable String id) {
  63. Express express = expressService.selectById(id);
  64. ExpressDto expressDto = globalFunction.express2dto(express);
  65. return Msg.ok(null,expressDto);
  66. }
  67. /**
  68. * 分配订单
  69. * @param ids 订单数组
  70. * @param staffId 派送员id
  71. * @author jitwxs
  72. * @since 2018/5/2 16:37
  73. */
  74. @PostMapping("/assign")
  75. public Msg assignExpress(String[] ids,String staffId) {
  76. for(String id : ids) {
  77. Express express = expressService.selectById(id);
  78. // 只有订单状态为WAIT_DIST时才要分配订单
  79. if(ExpressStatusEnum.WAIT_DIST.getName().equals(ExpressStatusEnum.getName(express.getStatus()))) {
  80. express.setStaff(staffId);
  81. express.setStatus(ExpressStatusEnum.TRANSPORT.getIndex());
  82. expressService.updateById(express);
  83. }
  84. }
  85. return Msg.ok();
  86. }
  87. /**
  88. * 确认订单
  89. * @author jitwxs
  90. * @since 2018/5/13 17:51
  91. */
  92. @PostMapping("/confirm")
  93. public Msg confirmExpress(ExpressPayment payment) {
  94. String id = payment.getExpressId();
  95. Express express = expressService.selectById(id);
  96. express.setStatus(ExpressStatusEnum.COMPLTE.getIndex());
  97. expressService.updateById(express);
  98. expressPaymentService.updateById(payment);
  99. return Msg.ok();
  100. }
  101. /**
  102. * 异常订单
  103. * @author jitwxs
  104. * @since 2018/5/13 17:51
  105. */
  106. @PostMapping("/error")
  107. public Msg errorExpress(String[] ids, String text) {
  108. for(String id : ids) {
  109. Express express = expressService.selectById(id);
  110. // 只有订单状态为TRANSPORT时才要确认
  111. if(ExpressStatusEnum.TRANSPORT.getName().equals(ExpressStatusEnum.getName(express.getStatus()))) {
  112. express.setStatus(ExpressStatusEnum.ERROR.getIndex());
  113. express.setStaffRemark(text);
  114. expressService.updateById(express);
  115. }
  116. }
  117. return Msg.ok();
  118. }
  119. /**
  120. * 删除订单
  121. * @author jitwxs
  122. * @since 2018/5/2 14:05
  123. */
  124. @PostMapping("/delete")
  125. public Msg deleteById(String[] ids) {
  126. for(String id : ids) {
  127. Express express = expressService.selectById(id);
  128. if(express != null) {
  129. // 设置删除标记为true
  130. express.setHasDelete(true);
  131. expressService.updateById(express);
  132. }
  133. }
  134. return Msg.ok();
  135. }
  136. /**
  137. * 恢复订单
  138. * @author jitwxs
  139. * @since 2018/5/2 14:05
  140. */
  141. @PostMapping("/recycle")
  142. public Msg recycleById(String[] ids) {
  143. for(String id : ids) {
  144. Express express = expressService.selectById(id);
  145. if(express != null) {
  146. // 设置删除标记为false
  147. express.setHasDelete(false);
  148. expressService.updateById(express);
  149. }
  150. }
  151. return Msg.ok();
  152. }
  153. /**
  154. * 彻底删除订单
  155. * @author jitwxs
  156. * @since 2018/5/2 14:05
  157. */
  158. @PostMapping("/clean")
  159. public Msg cleanById(String[] ids) {
  160. for(String id : ids) {
  161. expressService.deleteById(id);
  162. }
  163. return Msg.ok();
  164. }
  165. }

七、如果也想学习本系统,下面领取。关注并回复:044ssm

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/524974
推荐阅读
相关标签
  

闽ICP备14008679号