• Java项目:ssm开发的Java快递代拿系统


    作者主页:源码空间站2022

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    使用技术

    采用 Spring + SpringMVC + MyBatisPlus,连接池采用 Druid,安全框架使用 Shiro,前端采用 Bootstrap + layer 实现。

    支付采用支付宝沙箱环境,支付APP下载链接,[点击这里](https://sandbox.alipaydev.com/user/downloadApp.htm)。

    支付账号:uceskd4358@sandbox.com
    登录密码、支付密码:111111

    **注意:**
     

    请务必使用以上链接下载`沙箱支付宝`,也务必使用以上账号登录。不要使用真实支付宝APP和真实支付宝账号登录。

    运行环境

    - 集成开发环境:IntelliJ IDEA

    - 项目构建工具:Maven
    - 数据库:MYSQL 5.7+
    - JDK版本:1.8
    - Tomcat版本:Tomcat8

    (1)首先请创建数据库:
    ```shell
    CREATE DATABASE IF NOT EXISTS `express-ssm` /*!40100 DEFAULT CHARACTER SET utf8 */
    ```
    (2)导入项目 sql 文件夹下的 `express-ssm.sql` 文件。
    (3)编辑项目中 `src/main/resources/cnf/mysql.properties` 文件,修改数据库连接信息:
    jdbc.driver=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/express-ssm?useUnicode=true&useSSL=false&characterEncoding=utf-8
    jdbc.username=root # MYSQL 用户名

    jdbc.password=root # MYSQL 密码

    运行

    项目运行时,在tomcat中配置项目运行路径为http://localhost:8080/  注意:后面不要带项目名,否则会运行出错;

    默认账户

    注:以下为本项目默认存在的用户名密码,请将本仓库项目在本地运行后使用以下密码登录。

    | 权限   | 用户名 | 密码 |
    | 管理员 | admin  | 123  |
    | 配送员 | 李四   | 123  |

    | 用户名 | 小红   | 123  |

    运行截图

    相关代码 

    管理员订单Controller

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

    用户反馈Controller

    1. package jit.wxs.express.controller.admin;
    2. import com.baomidou.mybatisplus.mapper.EntityWrapper;
    3. import com.baomidou.mybatisplus.plugins.Page;
    4. import jit.wxs.express.controller.GlobalFunction;
    5. import jit.wxs.express.dto.FeedbackDto;
    6. import jit.wxs.express.enums.FeedbackTypeEnum;
    7. import jit.wxs.express.interactive.FeedbackSelectWrapper;
    8. import jit.wxs.express.interactive.Msg;
    9. import jit.wxs.express.pojo.Feedback;
    10. import jit.wxs.express.service.FeedbackService;
    11. import jit.wxs.express.service.SysUserService;
    12. import org.apache.commons.lang3.StringUtils;
    13. import org.springframework.beans.factory.annotation.Autowired;
    14. import org.springframework.web.bind.annotation.*;
    15. import java.io.UnsupportedEncodingException;
    16. import java.util.ArrayList;
    17. import java.util.HashMap;
    18. import java.util.List;
    19. import java.util.Map;
    20. /**
    21. * 用户反馈Controller
    22. * @author jitwxs
    23. * @since 2018/5/14 14:35
    24. */
    25. @RestController
    26. @RequestMapping("/admin/feedback")
    27. public class FeedbackController {
    28. @Autowired
    29. private FeedbackService feedbackService;
    30. @Autowired
    31. private SysUserService userService;
    32. @Autowired
    33. private GlobalFunction globalFunction;
    34. /**
    35. * 获取所有反馈类型
    36. * @author jitwxs
    37. * @since 2018/5/14 14:46
    38. */
    39. @GetMapping("/type/list")
    40. public Msg listFeedbackType() {
    41. List> result = new ArrayList<>();
    42. for(FeedbackTypeEnum enums :FeedbackTypeEnum.values()) {
    43. Map map = new HashMap<>();
    44. map.put("id",enums.getIndex());
    45. map.put("name",enums.getName());
    46. result.add(map);
    47. }
    48. return Msg.ok(null,result);
    49. }
    50. /**
    51. * 获取所有反馈
    52. * @author jitwxs
    53. * @since 2018/5/14 14:35
    54. */
    55. @GetMapping("/list")
    56. public Map listFeedback(Integer rows, Integer page, FeedbackSelectWrapper fsw, @RequestParam(defaultValue = "createDate") String order) {
    57. // Get请求中文编码
    58. try {
    59. fsw.setName(globalFunction.iso8859ToUtf8(fsw.getName()));
    60. fsw.setStaffName(globalFunction.iso8859ToUtf8(fsw.getStaffName()));
    61. } catch (UnsupportedEncodingException e) {
    62. e.printStackTrace();
    63. }
    64. // 得到筛选条件
    65. EntityWrapper feedbackWrapper = globalFunction.getFeedbackWrapper(fsw);
    66. Page selectPage = feedbackService.selectPage(new Page<>(page, rows,order,false), feedbackWrapper);
    67. List list = globalFunction.feedback2dto(selectPage.getRecords());
    68. Map map = new HashMap<>();
    69. map.put("total", selectPage.getTotal());
    70. map.put("rows", list);
    71. return map;
    72. }
    73. /**
    74. * 删除反馈
    75. * @author jitwxs
    76. * @since 2018/5/2 14:05
    77. */
    78. @PostMapping("/delete")
    79. public Msg deleteById(String[] ids) {
    80. for(String id : ids) {
    81. feedbackService.deleteById(id);
    82. }
    83. return Msg.ok();
    84. }
    85. /**
    86. * 处理反馈
    87. * @author jitwxs
    88. * @since 2018/5/14 15:06
    89. */
    90. @PostMapping("")
    91. public Msg handleFeedback(String id, String content) {
    92. if(StringUtils.isBlank(id) || StringUtils.isBlank(content)) {
    93. return Msg.error("参数错误");
    94. }
    95. Feedback feedback = feedbackService.selectById(id);
    96. // 设置处理人为当前用户
    97. feedback.setStaffId(globalFunction.getUserId());
    98. feedback.setResult(content);
    99. // 0代表未处理,1代表已处理;默认为0
    100. feedback.setStatus(1);
    101. feedbackService.updateById(feedback);
    102. return Msg.ok();
    103. }
    104. }

    职员管理

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

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

  • 相关阅读:
    智能工厂MES系统,终端设备支持手机、PDA、工业平板、PC
    2.5 Windows驱动开发:DRIVER_OBJECT对象结构
    非常好用的C# .Net开源高性能跨平台内网穿透工具FastTunnel 香橙派orangepi
    区块链的风潮
    软件测试面试题:智力题。
    高级java每日一道面试题-2024年7月14日
    遥感图像地物覆盖分类,数据集制作-分类模型对比-分类保姆级教程
    基于SpringBoot的校园点餐系统
    # ubuntu22下配置postgresql远程访问
    老友记第一季21集背诵句
  • 原文地址:https://blog.csdn.net/m0_74967853/article/details/128156371