作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
管理员角色包含以下功能:
管理员登录,人员管理,快递管理,查看我的私信,查看已发送私信等功能。
用户角色包含以下功能:
用户登录,查看好友申请,查看我的好友,查看我的私信,查看已发送私信,查看我的快递,查看好友快递等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
技术栈
HTML+CSS+JavaScript+jsp+mysql
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/login.jsp 登录
运行截图
相关代码
订单管理控制器
@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();
}
}
用户反馈控制器
@RestController
@RequestMapping("/admin/feedback")
public class FeedbackController {
@Autowired
private FeedbackService feedbackService;
@Autowired
private SysUserService userService;
@Autowired
private GlobalFunction globalFunction;
/**
* 获取所有反馈类型
* @author jitwxs
* @since 2018/5/14 14:46
*/
@GetMapping("/type/list")
public Msg listFeedbackType() {
List<Map<String,Object>> result = new ArrayList<>();
for(FeedbackTypeEnum enums :FeedbackTypeEnum.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 14:35
*/
@GetMapping("/list")
public Map listFeedback(Integer rows, Integer page, FeedbackSelectWrapper fsw, @RequestParam(defaultValue = "createDate") String order) {
// Get请求中文编码
try {
fsw.setName(globalFunction.iso8859ToUtf8(fsw.getName()));
fsw.setStaffName(globalFunction.iso8859ToUtf8(fsw.getStaffName()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// 得到筛选条件
EntityWrapper<Feedback> feedbackWrapper = globalFunction.getFeedbackWrapper(fsw);
Page<Feedback> selectPage = feedbackService.selectPage(new Page<>(page, rows,order,false), feedbackWrapper);
List<FeedbackDto> list = globalFunction.feedback2dto(selectPage.getRecords());
Map<String,Object> map = new HashMap<>();
map.put("total", selectPage.getTotal());
map.put("rows", list);
return map;
}
/**
* 删除反馈
* @author jitwxs
* @since 2018/5/2 14:05
*/
@PostMapping("/delete")
public Msg deleteById(String[] ids) {
for(String id : ids) {
feedbackService.deleteById(id);
}
return Msg.ok();
}
/**
* 处理反馈
* @author jitwxs
* @since 2018/5/14 15:06
*/
@PostMapping("")
public Msg handleFeedback(String id, String content) {
if(StringUtils.isBlank(id) || StringUtils.isBlank(content)) {
return Msg.error("参数错误");
}
Feedback feedback = feedbackService.selectById(id);
// 设置处理人为当前用户
feedback.setStaffId(globalFunction.getUserId());
feedback.setResult(content);
// 0代表未处理,1代表已处理;默认为0
feedback.setStatus(1);
feedbackService.updateById(feedback);
return Msg.ok();
}
}
职员管理控制器
@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();
}
}
如果也想学习本系统,下面领取。关注并回复:080jsp