java快递查询,java快递管理系统
目录
介绍效果图核心代码后台角色管理控制器后台管理员管理控制器投诉控制层前台申请地点申请控制层
介绍
超级管理员:系统管理、用户管理、网点管理、运输点管理、快递员管理、网点申请管理(审核)、报价管理(时效报价)等。
普通用户:注册登录、个人信息管理(个人资料、密码修改等)、地址管理、实名认证、在线寄件(单件寄件、批量导入寄件)、订单查询(物流信息查询)、在线申请网点、投诉建议等。
网点管理员:揽收负责区域的快递,进行快递快递运输,确认到达快递,快递到达后指派网点下快递员进行派送。
运输点管理员:负责运输至该运输点的快递再次运输。
运行环境:windows/Linux均可、jdk1.8、mysql5.7、idea/eclipse均可。
效果图
核心代码
后台角色管理控制器
/** * 后台角色管理控制器* @作者YY * */@请求映射(/admin/role )@控制器公共类角色控制器{私有记录器log=记录器工厂。获取记录器(角色控制器。类);@ autowired私人菜单服务菜单服务;@ Autowiredprivate OperaterLogService OperaterLogService;@ Autowiredprivate RoleService RoleService;/** * 分页搜索角色列表* @ param Model * @ param Role * @ param page bean * @ return */@ request mapping(value=/list )公共字符串列表(模型模型,角色角色,页面Bean角色页面bean){模型。添加属性( title ,角色列表);model.addAttribute(name ,role。getname());model.addAttribute(pageBean ,roleService.findByName(role,page bean));返回"管理员/角色/列表";}/** * 角色添加页面* @ param model * @ return */@ request mapping(value=/add ,method=RequestMethod .GET)公共字符串add(Model Model){ list menu find all=menu service。find all();model.addAttribute(roleTypes ,userroletypeenum。values());model.addAttribute(topMenus ,菜单实用程序。gettop菜单(查找全部));模型。添加属性(“第二菜单”,菜单实用程序)。getsecondmenus(find all));model.addAttribute(thirdMenus ,menu util。getthird menus(查找全部));返回"管理/角色/添加";}/** * 角色添加表单提交处理* @ param role * @ return */@ request mapping(value=/add ,method=RequestMethod .POST)@ ResponseBodypublic result boolean add(Role Role){ Role top 1 byroletype=roleservice。查找前1名byroletypandroletypenot(角色。getroletype());if (top1ByRoleType!=null){返回结果。错误(代码消息.ADMIN _角色_退出);}//用统一验证实体方法验证是否合法CodeMsg validate=validateentityutil。验证(角色);if(validate.getCode()!
= CodeMsg.SUCCESS.getCode()){return Result.error(validate);}if(roleService.save(role) == null){return Result.error(CodeMsg.ADMIN_ROLE_ADD_ERROR);}log.info("添加角色【"+role+"】");operaterLogService.add("添加角色【"+role.getName()+"】");return Result.success(true);}/** * 角色编辑页面 * @param id * @param model * @return */@RequestMapping(value="/edit",method=RequestMethod.GET)public String edit(@RequestParam(name="id",required=true)Long id,Model model){List<Menu> findAll = menuService.findAll();model.addAttribute("topMenus",MenuUtil.getTopMenus(findAll));model.addAttribute("secondMenus",MenuUtil.getSecondMenus(findAll));model.addAttribute("thirdMenus",MenuUtil.getThirdMenus(findAll));Role role = roleService.find(id);model.addAttribute("role", role);model.addAttribute("authorities",JSONArray.toJSON(role.getAuthorities()).toString());model.addAttribute("roleTypes", UserRoleTypeEnum.values());return "admin/role/edit";}/** * 角色修改表单提交处理 * @param request * @param role * @return */@RequestMapping(value="/edit",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> edit(Role role){//用统一验证实体方法验证是否合法CodeMsg validate = ValidateEntityUtil.validate(role);if(validate.getCode() != CodeMsg.SUCCESS.getCode()){return Result.error(validate);}Role existRole = roleService.find(role.getId());if(existRole == null){return Result.error(CodeMsg.ADMIN_ROLE_NO_EXIST);}existRole.setName(role.getName());existRole.setRemark(role.getRemark());existRole.setStatus(role.getStatus());existRole.setAuthorities(role.getAuthorities());if(roleService.save(existRole) == null){return Result.error(CodeMsg.ADMIN_ROLE_EDIT_ERROR);}log.info("编辑角色【"+role+"】");operaterLogService.add("编辑角色【"+role.getName()+"】");return Result.success(true);}/** * 删除角色 * @param request * @param id * @return */@RequestMapping(value="delete",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){try {roleService.delete(id);} catch (Exception e) {// TODO: handle exceptionreturn Result.error(CodeMsg.ADMIN_ROLE_DELETE_ERROR);}log.info("编辑角色ID【"+id+"】");operaterLogService.add("删除角色ID【"+id+"】");return Result.success(true);}}
后台管理员管理控制器
/** * 后台管理员管理控制器 * @author yy * */@RequestMapping("/admin/user")@Controllerpublic class UserController { @Autowiredprivate UserService userService;@Autowiredprivate RoleService roleService;@Autowiredprivate OperaterLogService operaterLogService;/** * 管理员列表页面 * @param model * @param user * @param pageBean * @return */@RequestMapping(value="/list")public String list(Model model,User user,PageBean<User> 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)@ResponseBodypublic Result<Boolean> 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)@ResponseBodypublic Result<Boolean> 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)@ResponseBodypublic Result<Boolean> 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")@Controllerpublic class ComplaintController { @Autowired private ComplaintService complaintService; /** * 分页搜索投诉列表 * @param model * @param complaint * @param pageBean * @return */ @RequestMapping(value="/list") public String list(Model model, Complaint complaint, PageBean<Complaint> 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<Boolean> 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")@Controllerpublic 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<BranchApplyFor> 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<Boolean> 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<Boolean> 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); } }
以上就是Java实战之在线寄查快递系统的实现的详细内容,更多关于Java寄查快递系统的资料请关注盛行IT其它相关文章!
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。