源码获取:博客首页 "资源" 里下载!
超级管理员:系统管理、用户管理、网点管理、运输点管理、快递员管理、网点申请管理(审核)、报价管理(时效报价)等。
普通用户:注册登录、个人信息管理(个人资料、密码修改等)、地址管理、实名认证、在线寄件(单件寄件、批量导入寄件)、订单查询(物流信息查询)、在线申请网点、投诉建议等。
网点管理员:揽收负责区域的快递,进行快递快递运输,确认到达快递,快递到达后指派网点下快递员进行派送。
运输点管理员:负责运输至该运输点的快递再次运输。
运行环境:windows/Linux均可、jdk1.8、mysql5.7、idea/eclipse均可。
后台角色管理控制器:
/**
* 后台角色管理控制器
* @author yy
*
*/
@RequestMapping("/admin/role")
@Controller
public class RoleController {
private Logger log = LoggerFactory.getLogger(RoleController.class);
@Autowired
private MenuService menuService;
@Autowired
private OperaterLogService operaterLogService;
@Autowired
private RoleService roleService;
/**
* 分页搜索角色列表
* @param model
* @param role
* @param pageBean
* @return
*/
@RequestMapping(value="/list")
public String list(Model model,Role role,PageBean pageBean){
model.addAttribute("title", "角色列表");
model.addAttribute("name", role.getName());
model.addAttribute("pageBean", roleService.findByName(role, pageBean));
return "admin/role/list";
}
/**
* 角色添加页面
* @param model
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){
List
后台管理员管理控制器:
/**
* 后台管理员管理控制器
* @author yy
*
*/
@RequestMapping("/admin/user")
@Controller
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
@Autowired
private OperaterLogService operaterLogService;
/**
* 管理员列表页面
* @param model
* @param user
* @param pageBean
* @return
*/
@RequestMapping(value="/list")
public String list(Model model,User user,PageBean pageBean){
model.addAttribute("title", "管理员列表");
model.addAttribute("username", user.getUsername());
model.addAttribute("pageBean", userService.findList(pageBean,user.getUsername(), UserRoleTypeEnum.ADMIN));
return "admin/user/list";
}
/**
* 新增管理员页面
* @param model
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){
model.addAttribute("roles", roleService.findAllByRoleType(UserRoleTypeEnum.ADMIN));
return "admin/user/add";
}
/**
* 管理员添加表单提交处理
* @param user
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.POST)
@ResponseBody
public Result add(User user){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(user);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(user.getRole() == null || user.getRole().getId() == null){
return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY);
}
//判断管理员名是否存在
if(userService.isExistUsername(user.getUsername(), 0L)){
return Result.error(CodeMsg.ADMIN_USERNAME_EXIST);
}
user.setUserType(UserRoleTypeEnum.ADMIN);
//到这说明一切符合条件,进行数据库新增
if(userService.save(user) == null){
return Result.error(CodeMsg.ADMIN_USE_ADD_ERROR);
}
operaterLogService.add("添加管理员,管理员名:" + user.getUsername());
return Result.success(true);
}
/**
* 管理员编辑页面
* @param model
* @return
*/
@RequestMapping(value="/edit",method=RequestMethod.GET)
public String edit(Model model,@RequestParam(name="id",required=true)Long id){
model.addAttribute("roles", roleService.findAllByRoleType(UserRoleTypeEnum.ADMIN));
model.addAttribute("user", userService.find(id));
return "admin/user/edit";
}
/**
* 编辑管理员信息表单提交处理
* @param user
* @return
*/
@RequestMapping(value="/edit",method=RequestMethod.POST)
@ResponseBody
public Result edit(User user){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(user);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(user.getRole() == null || user.getRole().getId() == null){
return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY);
}
if(user.getId() == null || user.getId().longValue() <= 0){
return Result.error(CodeMsg.ADMIN_USE_NO_EXIST);
}
if(userService.isExistUsername(user.getUsername(), user.getId())){
return Result.error(CodeMsg.ADMIN_USERNAME_EXIST);
}
//到这说明一切符合条件,进行数据库保存
User findById = userService.find(user.getId());
//讲提交的管理员信息指定字段复制到已存在的user对象中,该方法会覆盖新字段内容
BeanUtils.copyProperties(user, findById, "id","createTime","updateTime","userType");
if(userService.save(findById) == null){
return Result.error(CodeMsg.ADMIN_USE_EDIT_ERROR);
}
operaterLogService.add("编辑管理员,管理员名:" + user.getUsername());
return Result.success(true);
}
/**
* 删除管理员
* @param id
* @return
*/
@RequestMapping(value="/delete",method=RequestMethod.POST)
@ResponseBody
public Result delete(@RequestParam(name="id",required=true)Long id){
try {
userService.delete(id);
} catch (Exception e) {
return Result.error(CodeMsg.ADMIN_USE_DELETE_ERROR);
}
operaterLogService.add("删除管理员,管理员ID:" + id);
return Result.success(true);
}
}
投诉控制层:
/**
* @info : 投诉控制层
* @author: yy
*/
@RequestMapping("/admin/complaint")
@Controller
public class ComplaintController {
@Autowired
private ComplaintService complaintService;
/**
* 分页搜索投诉列表
* @param model
* @param complaint
* @param pageBean
* @return
*/
@RequestMapping(value="/list")
public String list(Model model, Complaint complaint, PageBean pageBean){
model.addAttribute("title", "投诉列表");
model.addAttribute("waybillNumber", complaint.getWaybillNumber());
model.addAttribute("pageBean", complaintService.findList(complaint, pageBean));
return "admin/complaint/list";
}
@RequestMapping(value="/accepted",method= RequestMethod.POST)
@ResponseBody
public Result accepted(@RequestParam(name="id")Long id){
Complaint complaint = complaintService.find(id);
complaint.setStatus(Complaint.ACCEPTED);
if (complaintService.save(complaint) == null){
return Result.error(CodeMsg.COMPLAINT_ACCEPTED_ERROR);
}
return Result.success(true);
}
}
前台申请地点申请控制层:
/**
* @info : 前台网点申请网点申请控制层
* @author: yy
*/
@RequestMapping("/admin/branchApplyFor")
@Controller
public class BranchApplyForController {
@Autowired
private BranchApplyForService branchApplyForService;
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
/**
* 网点申请列表页面
* @param model
* @param branchApplyFor
* @param pageBean
* @return
*/
@RequestMapping(value="/list")
public String list(Model model, BranchApplyFor branchApplyFor, PageBean pageBean){
model.addAttribute("title", "网点申请列表");
model.addAttribute("branchName", branchApplyFor.getBranchName());
model.addAttribute("pageBean", branchApplyForService.findList(pageBean,branchApplyFor.getBranchName(), null));
return "admin/branch_apply_for/list";
}
/**
* 通过申请
* @param id
* @return
*/
@RequestMapping(value="/agree",method=RequestMethod.POST)
@ResponseBody
public Result agree(@RequestParam(name="id")Long id){
Role role = roleService.findTop1ByRoleType(UserRoleTypeEnum.BRANCHES);
if (role == null){
return Result.error(CodeMsg.BRANCHAPPLYFOR_ROLE_NO_EXIST);
}
Integer integer = branchApplyForService.agreeBranchApplyFor(id, role);
if (1 == integer){
return Result.error(CodeMsg.BRANCHAPPLYFOR_THROUGH_ERROR);
}
return Result.success(true);
}
/**
* 驳回申请
* @param id
* @return
*/
@RequestMapping(value="/rejected",method=RequestMethod.POST)
@ResponseBody
public Result rejected(@RequestParam(name="id")Long id,@RequestParam(name = "rejectReason")String rejectReason){
BranchApplyFor branchApplyFor = branchApplyForService.find(id);
branchApplyFor.setBranchApplyForStatus(BranchApplyForStatusEnum.NOTTHROUGH);
if (StringUtils.isEmpty(rejectReason)){
return Result.error(CodeMsg.BRANCHAPPLYFOR_NOTTHROUGH_NULL);
}
if (rejectReason.length() >= 188){
return Result.error(CodeMsg.BRANCHAPPLYFOR_NOTTHROUGH_LENGTH);
}
branchApplyFor.setRejectReason(rejectReason);
if (branchApplyForService.save(branchApplyFor) == null){
return Result.error(CodeMsg.BRANCHAPPLYFOR_NOTTHROUGH_ERROR);
}
return Result.success(true);
}
}
源码获取:博客首页 "资源" 里下载!