Java Project: Customer Relationship Management System (java+SpringBoot+layui+html+maven+mysql)

Get the source code: Download it from "Resources" on the homepage of the blog!

 

Project Introduction

CRM customer relationship management system. This system is divided into three roles: super administrator, manager, salesperson;
the functions of super administrator mainly include:
company information: department structure, sales directory;
personnel information: salesperson, account authority;
customer information: customer list;
Sales tracking: order list, report statistics;

Chart analysis: sales and customer analysis, sales failure analysis;

environmental needs

1. Operating environment: preferably java jdk 1.8, we are running on this platform. Other versions are also theoretically possible.
2. IDE environment: IDEA, Eclipse, Myeclipse can be used. IDEA is recommended;
3. Tomcat environment: Tomcat 7.x, 8.x, 9.x versions are available
4. Hardware environment: Windows 7/8/10 with more than 1G memory; or Mac OS;
5. Maven project: Yes; Check whether the source code directory contains pom.xml; if so, it is a maven project, otherwise it is a non-maven project
6. Database: MySql 5.7 version;

technology stack

1. Backend: SpringBoot;
2. Frontend: layui+html

Instructions for use

1. Use Navicat or other tools to create a database with the corresponding name in mysql, and import the sql file of
the project; 2. Change the database configuration in the application.yml configuration file in the project to your own configuration
3. Use IDEA/Eclipse/ MyEclipse imports the project, when Eclipse/MyEclipse imports, if it is a maven project, please select maven; if it is a maven project, after the import is successful, please execute the maven clean; maven install command, configure tomcat, and then run;
4. Run the project, enter localhost:8080 Login
5. Administrator account: superAdmin password 123456
Manager account: user password: 123456

6. Salesperson account: laji_ma Password: 123456

 

 

 

 

 

 

 

User management control layer:


@Controller
@RequestMapping("/customer")
public class CustomerController extends AuthorizedController {

    @Autowired
    private CustomerService customerService;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String customer() {
        return "crm/customer";
    }

    @RequestMapping(value = "/find", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<Customer> find(@RequestBody QueryCustomerVo vo) {
        return customerService.find(vo);
    }

    @RequestMapping(value = "/findAllCustomerCategory", method = RequestMethod.POST)
    @ResponseBody
    public List<CustomerCategory> findAllCustomerCategory() {
        return customerService.findAllCustomerCategory();
    }

    @RequestMapping(value = "/findAllIndustry", method = RequestMethod.POST)
    @ResponseBody
    public List<Industry> findAllIndustry() {
        return customerService.findAllIndustry();
    }

    @RequestMapping(value = "/findAllSource", method = RequestMethod.POST)
    @ResponseBody
    public List<Source> findAllSource() {
        return customerService.findAllSource();
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result add(@RequestBody Customer customer) {
        customer.setCreateBy(getUser().getUserId());
        return customerService.insert(customer);
    }

    @RequestMapping(value = "/checkCustomerName", method = RequestMethod.POST)
    @ResponseBody
    public Result checkCustomerName(@RequestBody Customer customer) {
        return customerService.checkCustomerName(customer);
    }

    @RequestMapping(value = "/findById", method = RequestMethod.POST)
    @ResponseBody
    public Customer findById(@RequestBody Customer customer) {
        return customerService.findById(customer.getCustomerId());
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Result update(@RequestBody Customer customer) {
        return customerService.update(customer);
    }

    @RequestMapping(value = "/dashboard/{customerId}", method = RequestMethod.GET)
    public ModelAndView dashboard(@PathVariable int customerId) {
        ModelAndView vm = new ModelAndView("crm/customerDashboard");
        vm.addObject("customerId", customerId);
        return vm;
    }

    @RequestMapping(value = "/updateStar", method = RequestMethod.POST)
    @ResponseBody
    public Result updateStar(@RequestBody Customer customer) {
        return customerService.updateStar(customer);
    }

    @RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
    @ResponseBody
    public Result updateLocation(@RequestBody Customer customer) {
        return customerService.updateLocation(customer);
    }
}

System user management control layer:

@Controller
@RequestMapping("/user")
public class UserController extends AuthorizedController {

    @Autowired
    private UserService userService;

    @Autowired
    private HttpSession session;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String index() {
        return "sys/user";
    }

    @RequestMapping(value = "/find", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<User> find(@RequestBody QueryUserVo vo) {
        return userService.find(vo);
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result add(@RequestBody User user) {
        return userService.insert(user);
    }

    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    @ResponseBody
    public Result delete(@RequestBody List<Integer> ids) {
        return userService.deleteByIds(ids);
    }

    @RequestMapping(value = "/findById", method = RequestMethod.POST)
    @ResponseBody
    public User findById(@RequestBody User user) {
        return userService.findById(user.getUserId());
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Result update(@RequestBody User user) {
        Result result = userService.update(user);
        if (result.isSuccess() && user.getUserId() == getUser().getUserId()) {
            session.setAttribute("User", userService.findById(getUser().getUserId()));
        }
        return result;
    }

    @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
    @ResponseBody
    public Result updateStatus(@RequestBody User user) {
        return userService.updateStatus(user);
    }

    @RequestMapping(value = "/checkUserName", method = RequestMethod.POST)
    @ResponseBody
    public Result checkUserName(@RequestBody User user) {
        return userService.checkUserName(user);
    }

    @RequestMapping(value = "/resetPassword", method = RequestMethod.POST)
    @ResponseBody
    public Result resetPassword(@RequestBody User user) {
        return userService.resetPassword(user);
    }

    @RequestMapping(value = "/profile", method = RequestMethod.GET)
    public String profile() {
        return "sys/profile";
    }

    @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
    @ResponseBody
    public Result updatePassword(@RequestBody UpdatePasswordVo vo) {
        return userService.updatePassword(vo);
    }
}

System role management control layer:

@Controller
@RequestMapping("/role")
public class RoleController extends AuthorizedController {

    @Autowired
    private RoleService roleService;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String index() {
        return "sys/role";
    }

    @RequestMapping(value = "/findAll", method = RequestMethod.POST)
    @ResponseBody
    public List<Role> findAll() {
        return roleService.findAll();
    }

    @RequestMapping(value = "/checkRoleName", method = RequestMethod.POST)
    @ResponseBody
    public Result existRoleName(@RequestBody Role role) {
        return roleService.checkRoleName(role);
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result add(@RequestBody Role role) {
        return roleService.insert(role);
    }

    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    @ResponseBody
    public Result delete(@RequestBody List<Integer> ids) {
        return roleService.deleteByIds(ids);
    }

    @RequestMapping(value = "/findById", method = RequestMethod.POST)
    @ResponseBody
    public Role findById(@RequestBody Role role) {
        return roleService.findById(role.getRoleId());
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Result update(@RequestBody Role role) {
        return roleService.update(role);
    }

    @RequestMapping(value = "/user/{roleId}", method = RequestMethod.GET)
    public ModelAndView roleUser(@PathVariable int roleId) {
        ModelAndView vm = new ModelAndView("sys/roleUser");
        vm.addObject("roleId", roleId);
        return vm;
    }

    @RequestMapping(value = "/user/findUserInRole", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<User> findUserInRole(@RequestBody QueryRoleUserVo vo) {
        return roleService.findUserInRole(vo);
    }

    @RequestMapping(value = "/user/remove", method = RequestMethod.POST)
    @ResponseBody
    public Result deleteRoleUser(@RequestBody RoleUser roleUser) {
        return roleService.deleteRoleUser(roleUser);
    }

    @RequestMapping(value = "/user/findUserNotInRole", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<User> findUserNotInRole(@RequestBody QueryRoleUserVo vo) {
        return roleService.findUserNotInRole(vo);
    }

    @RequestMapping(value = "/user/add", method = RequestMethod.POST)
    @ResponseBody
    public Result addRoleUser(@RequestBody RoleUser roleUser) {
        return roleService.insertRoleUser(roleUser);
    }

    @RequestMapping(value = "/menu/{roleId}", method = RequestMethod.GET)
    public ModelAndView roleMenu(@PathVariable Integer roleId) {
        ModelAndView mv = new ModelAndView("sys/roleMenu");
        mv.addObject("roleId", roleId);
        return mv;
    }

    @RequestMapping(value = "/menu/saveMenu", method = RequestMethod.POST)
    @ResponseBody
    public Result saveMenu(@RequestBody Map map) {
        return roleService.saveRoleMenu((Integer) map.get("roleId"), (List<Integer>) map.get("menuIdList"));
    }

    @RequestMapping(value = "/fun/{roleId}", method = RequestMethod.GET)
    public ModelAndView roleFun(@PathVariable int roleId) {
        ModelAndView vm = new ModelAndView("sys/roleFun");
        vm.addObject("roleId", roleId);
        return vm;
    }
}

System menu management control layer:

@Controller()
@RequestMapping("/menu")
public class MenuController extends AuthorizedController {

    @Autowired
    private MenuService menuService;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String index() {
        return "sys/menu";
    }

    @RequestMapping(value = "/findAllMenu", method = RequestMethod.POST)
    @ResponseBody
    public List<Menu> findAllMenu() {
        return menuService.findAllMenu();
    }

    @RequestMapping(value = "/findAllMenuTree", method = RequestMethod.POST)
    @ResponseBody
    public List<TreeNode<Menu>> findAllMenuTree() {
        return menuService.findAllMenuTree();
    }

    @RequestMapping(value = "/findUserMenuTree", method = RequestMethod.POST)
    @ResponseBody
    public List<TreeNode<Menu>> findUserMenuTree() {
        return menuService.findUserMenuTree(getUser().getUserId());
    }

    @RequestMapping(value = "/findRoleMenu", method = RequestMethod.POST)
    @ResponseBody
    public List<Menu> findRoleMenu(@RequestBody Role role) {
        return menuService.findRoleMenu(role.getRoleId());
    }

    @RequestMapping(value = "/checkMenuName", method = RequestMethod.POST)
    @ResponseBody
    public Result checkMenuName(@RequestBody Menu menu) {
        return menuService.checkMenuName(menu);
    }

    @RequestMapping(value = "/checkMenuCode", method = RequestMethod.POST)
    @ResponseBody
    public Result checkMenuCode(@RequestBody Menu menu) {
        return menuService.checkMenuCode(menu);
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result add(@RequestBody Menu menu) {
        return menuService.insert(menu);
    }

    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    @ResponseBody
    public Result remove(@RequestBody Menu menu) {
        return menuService.delete(menu.getMenuId());
    }

    @RequestMapping(value = "/findById", method = RequestMethod.POST)
    @ResponseBody
    public Menu findById(@RequestBody Menu menu) {
        return menuService.findById(menu.getMenuId());
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Result update(@RequestBody Menu menu) {
        return menuService.update(menu);
    }

    @RequestMapping(value = "/up", method = RequestMethod.POST)
    @ResponseBody
    public Result up(@RequestBody Menu menu) {
        return menuService.up(menu.getMenuId());
    }

    @RequestMapping(value = "/down", method = RequestMethod.POST)
    @ResponseBody
    public Result down(@RequestBody Menu menu) {
        return menuService.down(menu.getMenuId());
    }
}

Get the source code: Download it from "Resources" on the homepage of the blog!

Guess you like

Origin blog.csdn.net/yuyecsdn/article/details/124197229