当前位置:   article > 正文

Java项目:客户关系管理系统(java+SpringBoot+layui+html+maven+mysql)_java 管理系统角色划分

java 管理系统角色划分

源码获取:博客首页 "资源" 里下载!

 

项目介绍

CRM客户关系管理系统。本系统共分为三种角色:超级管理员、经理、销售人员;
超级管理员的功能主要有:
公司资料:部门结构、销售目录;
人员资料:销售人员、账号权限;
客户资料:客户列表;
销售跟踪:订单列表、报表统计;

图表分析:销售与客户分析、销售失败分析;

环境需要

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;

技术栈

1. 后端:SpringBoot;
2. 前端:layui+html

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中application.yml配置文件中的数据库配置改为自己的配置
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
4. 运行项目,输入localhost:8080 登录
5. 管理员账户:superAdmin  密码123456
经理账户:user 密码:123456

6.销售人员账户:laji_ma  密码:123456

 

 

 

 

 

 

 

用户管理控制层:

  1. @Controller
  2. @RequestMapping("/customer")
  3. public class CustomerController extends AuthorizedController {
  4. @Autowired
  5. private CustomerService customerService;
  6. @RequestMapping(value = "", method = RequestMethod.GET)
  7. public String customer() {
  8. return "crm/customer";
  9. }
  10. @RequestMapping(value = "/find", method = RequestMethod.POST)
  11. @ResponseBody
  12. public PageInfo<Customer> find(@RequestBody QueryCustomerVo vo) {
  13. return customerService.find(vo);
  14. }
  15. @RequestMapping(value = "/findAllCustomerCategory", method = RequestMethod.POST)
  16. @ResponseBody
  17. public List<CustomerCategory> findAllCustomerCategory() {
  18. return customerService.findAllCustomerCategory();
  19. }
  20. @RequestMapping(value = "/findAllIndustry", method = RequestMethod.POST)
  21. @ResponseBody
  22. public List<Industry> findAllIndustry() {
  23. return customerService.findAllIndustry();
  24. }
  25. @RequestMapping(value = "/findAllSource", method = RequestMethod.POST)
  26. @ResponseBody
  27. public List<Source> findAllSource() {
  28. return customerService.findAllSource();
  29. }
  30. @RequestMapping(value = "/add", method = RequestMethod.POST)
  31. @ResponseBody
  32. public Result add(@RequestBody Customer customer) {
  33. customer.setCreateBy(getUser().getUserId());
  34. return customerService.insert(customer);
  35. }
  36. @RequestMapping(value = "/checkCustomerName", method = RequestMethod.POST)
  37. @ResponseBody
  38. public Result checkCustomerName(@RequestBody Customer customer) {
  39. return customerService.checkCustomerName(customer);
  40. }
  41. @RequestMapping(value = "/findById", method = RequestMethod.POST)
  42. @ResponseBody
  43. public Customer findById(@RequestBody Customer customer) {
  44. return customerService.findById(customer.getCustomerId());
  45. }
  46. @RequestMapping(value = "/update", method = RequestMethod.POST)
  47. @ResponseBody
  48. public Result update(@RequestBody Customer customer) {
  49. return customerService.update(customer);
  50. }
  51. @RequestMapping(value = "/dashboard/{customerId}", method = RequestMethod.GET)
  52. public ModelAndView dashboard(@PathVariable int customerId) {
  53. ModelAndView vm = new ModelAndView("crm/customerDashboard");
  54. vm.addObject("customerId", customerId);
  55. return vm;
  56. }
  57. @RequestMapping(value = "/updateStar", method = RequestMethod.POST)
  58. @ResponseBody
  59. public Result updateStar(@RequestBody Customer customer) {
  60. return customerService.updateStar(customer);
  61. }
  62. @RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
  63. @ResponseBody
  64. public Result updateLocation(@RequestBody Customer customer) {
  65. return customerService.updateLocation(customer);
  66. }
  67. }

系统用户管理控制层:

  1. @Controller
  2. @RequestMapping("/user")
  3. public class UserController extends AuthorizedController {
  4. @Autowired
  5. private UserService userService;
  6. @Autowired
  7. private HttpSession session;
  8. @RequestMapping(value = "", method = RequestMethod.GET)
  9. public String index() {
  10. return "sys/user";
  11. }
  12. @RequestMapping(value = "/find", method = RequestMethod.POST)
  13. @ResponseBody
  14. public PageInfo<User> find(@RequestBody QueryUserVo vo) {
  15. return userService.find(vo);
  16. }
  17. @RequestMapping(value = "/add", method = RequestMethod.POST)
  18. @ResponseBody
  19. public Result add(@RequestBody User user) {
  20. return userService.insert(user);
  21. }
  22. @RequestMapping(value = "/remove", method = RequestMethod.POST)
  23. @ResponseBody
  24. public Result delete(@RequestBody List<Integer> ids) {
  25. return userService.deleteByIds(ids);
  26. }
  27. @RequestMapping(value = "/findById", method = RequestMethod.POST)
  28. @ResponseBody
  29. public User findById(@RequestBody User user) {
  30. return userService.findById(user.getUserId());
  31. }
  32. @RequestMapping(value = "/update", method = RequestMethod.POST)
  33. @ResponseBody
  34. public Result update(@RequestBody User user) {
  35. Result result = userService.update(user);
  36. if (result.isSuccess() && user.getUserId() == getUser().getUserId()) {
  37. session.setAttribute("User", userService.findById(getUser().getUserId()));
  38. }
  39. return result;
  40. }
  41. @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
  42. @ResponseBody
  43. public Result updateStatus(@RequestBody User user) {
  44. return userService.updateStatus(user);
  45. }
  46. @RequestMapping(value = "/checkUserName", method = RequestMethod.POST)
  47. @ResponseBody
  48. public Result checkUserName(@RequestBody User user) {
  49. return userService.checkUserName(user);
  50. }
  51. @RequestMapping(value = "/resetPassword", method = RequestMethod.POST)
  52. @ResponseBody
  53. public Result resetPassword(@RequestBody User user) {
  54. return userService.resetPassword(user);
  55. }
  56. @RequestMapping(value = "/profile", method = RequestMethod.GET)
  57. public String profile() {
  58. return "sys/profile";
  59. }
  60. @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
  61. @ResponseBody
  62. public Result updatePassword(@RequestBody UpdatePasswordVo vo) {
  63. return userService.updatePassword(vo);
  64. }
  65. }

系统角色管理控制层:

  1. @Controller
  2. @RequestMapping("/role")
  3. public class RoleController extends AuthorizedController {
  4. @Autowired
  5. private RoleService roleService;
  6. @RequestMapping(value = "", method = RequestMethod.GET)
  7. public String index() {
  8. return "sys/role";
  9. }
  10. @RequestMapping(value = "/findAll", method = RequestMethod.POST)
  11. @ResponseBody
  12. public List<Role> findAll() {
  13. return roleService.findAll();
  14. }
  15. @RequestMapping(value = "/checkRoleName", method = RequestMethod.POST)
  16. @ResponseBody
  17. public Result existRoleName(@RequestBody Role role) {
  18. return roleService.checkRoleName(role);
  19. }
  20. @RequestMapping(value = "/add", method = RequestMethod.POST)
  21. @ResponseBody
  22. public Result add(@RequestBody Role role) {
  23. return roleService.insert(role);
  24. }
  25. @RequestMapping(value = "/remove", method = RequestMethod.POST)
  26. @ResponseBody
  27. public Result delete(@RequestBody List<Integer> ids) {
  28. return roleService.deleteByIds(ids);
  29. }
  30. @RequestMapping(value = "/findById", method = RequestMethod.POST)
  31. @ResponseBody
  32. public Role findById(@RequestBody Role role) {
  33. return roleService.findById(role.getRoleId());
  34. }
  35. @RequestMapping(value = "/update", method = RequestMethod.POST)
  36. @ResponseBody
  37. public Result update(@RequestBody Role role) {
  38. return roleService.update(role);
  39. }
  40. @RequestMapping(value = "/user/{roleId}", method = RequestMethod.GET)
  41. public ModelAndView roleUser(@PathVariable int roleId) {
  42. ModelAndView vm = new ModelAndView("sys/roleUser");
  43. vm.addObject("roleId", roleId);
  44. return vm;
  45. }
  46. @RequestMapping(value = "/user/findUserInRole", method = RequestMethod.POST)
  47. @ResponseBody
  48. public PageInfo<User> findUserInRole(@RequestBody QueryRoleUserVo vo) {
  49. return roleService.findUserInRole(vo);
  50. }
  51. @RequestMapping(value = "/user/remove", method = RequestMethod.POST)
  52. @ResponseBody
  53. public Result deleteRoleUser(@RequestBody RoleUser roleUser) {
  54. return roleService.deleteRoleUser(roleUser);
  55. }
  56. @RequestMapping(value = "/user/findUserNotInRole", method = RequestMethod.POST)
  57. @ResponseBody
  58. public PageInfo<User> findUserNotInRole(@RequestBody QueryRoleUserVo vo) {
  59. return roleService.findUserNotInRole(vo);
  60. }
  61. @RequestMapping(value = "/user/add", method = RequestMethod.POST)
  62. @ResponseBody
  63. public Result addRoleUser(@RequestBody RoleUser roleUser) {
  64. return roleService.insertRoleUser(roleUser);
  65. }
  66. @RequestMapping(value = "/menu/{roleId}", method = RequestMethod.GET)
  67. public ModelAndView roleMenu(@PathVariable Integer roleId) {
  68. ModelAndView mv = new ModelAndView("sys/roleMenu");
  69. mv.addObject("roleId", roleId);
  70. return mv;
  71. }
  72. @RequestMapping(value = "/menu/saveMenu", method = RequestMethod.POST)
  73. @ResponseBody
  74. public Result saveMenu(@RequestBody Map map) {
  75. return roleService.saveRoleMenu((Integer) map.get("roleId"), (List<Integer>) map.get("menuIdList"));
  76. }
  77. @RequestMapping(value = "/fun/{roleId}", method = RequestMethod.GET)
  78. public ModelAndView roleFun(@PathVariable int roleId) {
  79. ModelAndView vm = new ModelAndView("sys/roleFun");
  80. vm.addObject("roleId", roleId);
  81. return vm;
  82. }
  83. }

系统菜单管理控制层:

  1. @Controller()
  2. @RequestMapping("/menu")
  3. public class MenuController extends AuthorizedController {
  4. @Autowired
  5. private MenuService menuService;
  6. @RequestMapping(value = "", method = RequestMethod.GET)
  7. public String index() {
  8. return "sys/menu";
  9. }
  10. @RequestMapping(value = "/findAllMenu", method = RequestMethod.POST)
  11. @ResponseBody
  12. public List<Menu> findAllMenu() {
  13. return menuService.findAllMenu();
  14. }
  15. @RequestMapping(value = "/findAllMenuTree", method = RequestMethod.POST)
  16. @ResponseBody
  17. public List<TreeNode<Menu>> findAllMenuTree() {
  18. return menuService.findAllMenuTree();
  19. }
  20. @RequestMapping(value = "/findUserMenuTree", method = RequestMethod.POST)
  21. @ResponseBody
  22. public List<TreeNode<Menu>> findUserMenuTree() {
  23. return menuService.findUserMenuTree(getUser().getUserId());
  24. }
  25. @RequestMapping(value = "/findRoleMenu", method = RequestMethod.POST)
  26. @ResponseBody
  27. public List<Menu> findRoleMenu(@RequestBody Role role) {
  28. return menuService.findRoleMenu(role.getRoleId());
  29. }
  30. @RequestMapping(value = "/checkMenuName", method = RequestMethod.POST)
  31. @ResponseBody
  32. public Result checkMenuName(@RequestBody Menu menu) {
  33. return menuService.checkMenuName(menu);
  34. }
  35. @RequestMapping(value = "/checkMenuCode", method = RequestMethod.POST)
  36. @ResponseBody
  37. public Result checkMenuCode(@RequestBody Menu menu) {
  38. return menuService.checkMenuCode(menu);
  39. }
  40. @RequestMapping(value = "/add", method = RequestMethod.POST)
  41. @ResponseBody
  42. public Result add(@RequestBody Menu menu) {
  43. return menuService.insert(menu);
  44. }
  45. @RequestMapping(value = "/remove", method = RequestMethod.POST)
  46. @ResponseBody
  47. public Result remove(@RequestBody Menu menu) {
  48. return menuService.delete(menu.getMenuId());
  49. }
  50. @RequestMapping(value = "/findById", method = RequestMethod.POST)
  51. @ResponseBody
  52. public Menu findById(@RequestBody Menu menu) {
  53. return menuService.findById(menu.getMenuId());
  54. }
  55. @RequestMapping(value = "/update", method = RequestMethod.POST)
  56. @ResponseBody
  57. public Result update(@RequestBody Menu menu) {
  58. return menuService.update(menu);
  59. }
  60. @RequestMapping(value = "/up", method = RequestMethod.POST)
  61. @ResponseBody
  62. public Result up(@RequestBody Menu menu) {
  63. return menuService.up(menu.getMenuId());
  64. }
  65. @RequestMapping(value = "/down", method = RequestMethod.POST)
  66. @ResponseBody
  67. public Result down(@RequestBody Menu menu) {
  68. return menuService.down(menu.getMenuId());
  69. }
  70. }

源码获取:博客首页 "资源" 里下载!

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

闽ICP备14008679号