Java项目:家政服务管理系统(java+SSM+ElementUI+Vue+layui+Mysql)

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

项目介绍

基于SSM的家政服务中介网

角色:管理员、用户、家政公司

管理员登录后,通过管理员功能来管理后台系统。主要功能有:首页、个人中心、用户管理、家政公司管理、用户资金账户管理、用户资金扣减管理、用户资金入账管理、家政公司充值管理、家政公司账户管理、家政公司资金扣减管理、家政公司资金入账管理、用户充值管理、服务分类管理、家政服务管理、服务订单管理、互动交流管理、订单状态申请管理、留言板管理、系统管理等功能。

用户包括:首页、个人中心、用户资金账户管理、用户资金扣减管理、用户资金入账管理、用户充值管理、家政服务管理、服务订单管理、订单状态申请管理、我的收藏管理等功能。

家政公司包括:首页、个人中心、家政公司充值管理、家政公司账户管理、家政公司资金扣减管理、家政公司资金入账管理、服务订单管理、互动交流管理、订单状态申请管理等功能。


环境需要

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/8.0等版本均可;


技术栈

后端:SSM(Spring+SpringMVC+Mybatis)

前端:ElementUI+Vue+layui


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中config.properties配置文件中的数据库配置改为自己的配置,然后运行;
前台运行地址:http://localhost:8080/ssmilafa/front/
后台运行地址:http://localhost:8080/ssmilafa/admin/dist/index.html#/login
管理员:abo/abo
用户:123/123
家政公司:345/345

 

 

 

订单管理控制层:

/**
 * Description:订单控制类
 */
@Controller
@RequestMapping("/order")
public class OrderController extends BaseController {

    @Autowired
    private OrderService orderService;
    @Autowired
    private CommentService commentService;

    /**
     * 跳转至我的订单页面
     * @return 我的订单页面
     */
    @GetMapping("/toOrder")
    public String toOrder() {
        return "order";
    }

    /**
     * 跳转至商家订单页面
     * @return 商家订单页面
     */
    @GetMapping("/toHkOrder")
    public String toHkOrder() {
        return "hk_order";
    }

    @PostMapping("/getAllOrder")
    @ResponseBody
    public ResponseResult<PageInfo<Order>> getAllOrder (
            HttpSession session,
            @RequestParam(required = false,defaultValue = "1",value = "pageNum")Integer currentPage
    ) {
        ResponseResult<PageInfo<Order>> result = new ResponseResult<>();
        if (session == null) {
            throw new UserNoLoginException("用户未登录");
        } else {
            PageInfo<Order> list = orderService.getAllOrder(session, currentPage);
            result.setData(list);
        }
        return result;
    }

    @PostMapping("/getOrderByID")
    @ResponseBody
    public ResponseResult<Order> getOrderByID (
            @RequestParam("orderID") int id
    ) {
        ResponseResult<Order> result = new ResponseResult<>();
        Order order = orderService.getOrderByID(id);
        result.setData(order);
        return result;
    }

    @PostMapping("/deleteOrderByID")
    @ResponseBody
    public ResponseResult<Void> deleteOrderByID (
            @RequestParam("orderID") int id
    ) {
        orderService.deleteOrderByID(id);
        return new ResponseResult<>();
    }

    @PostMapping("/getOrderListByHKID")
    @ResponseBody
    public ResponseResult<List<Order>> getOrderListByHKID (
            HttpSession session
    ) {
        ResponseResult<List<Order>> result = new ResponseResult<>();
        List<Order> list = orderService.getOrderListByHKID(session);
        result.setData(list);
        return result;
    }

    @PostMapping("/acceptOrder")
    @ResponseBody
    public ResponseResult<Void> acceptOrder (
            @RequestParam("id") int id
    ) {
        orderService.updateOrderStatusByID(id, 1);
        return new ResponseResult<>();
    }

    @PostMapping("/finishOrder")
    @ResponseBody
    public ResponseResult<Void> finishOrder (
            @RequestParam("id") int id
    ) {
        orderService.updateOrderStatusByID(id, 0);
        return new ResponseResult<>();
    }

    @PostMapping("/cancelOrder")
    @ResponseBody
    public ResponseResult<Void> cancelOrder (
            @RequestParam("id") int id
    ) {
        orderService.cancelOrder(id);
        return new ResponseResult<>();
    }

    @PostMapping("/assessOrder")
    @ResponseBody
    public ResponseResult<Void> assessOrder (
            @RequestParam("orderID") int orderID,
            @RequestParam("commentStar") int commentStar,
            @RequestParam("commentContent") String commentContent
    ) {
        Comment comment = new Comment();
        comment.setOrderID(orderID);
        comment.setCommentStar(commentStar);
        comment.setCommentContent(commentContent);
        Date now = new Date();
        comment.setCommentTime(now);
        commentService.insertComment(comment);
        return new ResponseResult<>();
    }

}

用户管理控制层:

/**
 * Description:用户操作Controller
 */
@Controller
@RequestMapping("/user")
public class UserController extends BaseController{

    @Autowired
    private UserService userService;

    /**
     * 跳转注册页面
     * @return 注册页面
     */
    @GetMapping("/toRegister")
    public String toRegister() {
        return "register";
    }

    /**
     * 显示登录页面
     * @return 登录页面
     */
    @GetMapping("/toLogin")
    public String toLogin() {
        return "login";
    }

    /**
     * 用户注册功能
     * @param username 用户名
     * @param password 密码
     * @param role 角色
     * @param session session对象
     * @return
     */
    @PostMapping("/register")
    @ResponseBody
    public ResponseResult<Void> userRegister(
            @RequestParam("username") String username,
            @RequestParam("password") String password,
            @RequestParam("role") int role,
            HttpSession session
    ) {
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        user.setRole(role);
        user.setStatus(1);
        userService.insert(user);
        session.setAttribute("username", username);
        return new ResponseResult<Void>();
    }

    /**
     * 用户登录
     * @return
     */
    @PostMapping("/login")
    @ResponseBody
    public ResponseResult<Integer> userLogin(
            @RequestParam("username") String username,
            @RequestParam("password") String password,
            @RequestParam("vertifyCode") String vertifyCode,
            HttpSession session
    ) {
        System.out.println("前台输入验证码:" + vertifyCode);

        ResponseResult<Integer> response = new ResponseResult<>();

        // 从session中获取之前保存的验证码跟前台传来的验证码进行匹配
        Object kaptcha = session.getAttribute(RANDOMCODEKEY);

        if(!vertifyCode.equals(kaptcha)){
            response.setState(502);
        }

        Boolean result = userService.login(username, password);

        if (result) {
            System.out.println("用户存在,登录成功");
            response.setData(userService.getLoginRole(username));
        }

        session.setAttribute("username", username);
        return response;
    }

    /**
     * 退出登录
     * @param session
     * @return
     */
    @GetMapping("/logout")
    public String userLogout (HttpSession session) {
        session.removeAttribute("username");
        session.invalidate();
        return "login";
    }

    /**
     * 登录成功
     * @param session
     * @return
     * @throws UserNoLoginException
     */
    @PostMapping("/loginSuccess")
    @ResponseBody
    public ResponseResult<Void> loginSuccess (
            HttpSession session
    ) throws UserNoLoginException {
        String username = (String) session.getAttribute("username");
        ResponseResult<Void> result = new ResponseResult<>();
        if (StringUtils.isEmpty(username)) {
            throw new UserNoLoginException("用户未登录");
        } else {
            if (session.getAttribute("username").toString() != null) {
                result.setState(200);
            }
        }
        return result;
    }
}

管理员管理控制层: 

/**
 * Description:管理员页面Controller
 */
@Controller
@RequestMapping("/admin")
public class AdminController extends BaseController{

    @Autowired
    private AdminService adminService;

    /**
     * 跳转管理员页面
     * @return
     */
    @GetMapping("/toAdminIndex")
    public String toAdminIndex() {
        return "admin-index";
    }

    @PostMapping("/getCurrentUsername")
    @ResponseBody
    public ResponseResult<String> getCurrentUsername (
            HttpSession session
    ) {
        ResponseResult<String> result = new ResponseResult<>();
        String username = (String)session.getAttribute("username");
        if (StringUtils.isEmpty(username)) {
            throw new UserNoLoginException();
        } else {
            result.setData(username);
        }
        return result;
    }

    @PostMapping("/selectAllLogin")
    @ResponseBody
    public ResponseResult<List<User>> selectAllLogin () {
        ResponseResult<List<User>> response = new ResponseResult<>();
        List<User> list = adminService.selectAllLogin();
        response.setData(list);
        return response;
    }

    @PostMapping("/selectAllCustomer")
    @ResponseBody
    public ResponseResult<List<Customer>> selectAllCustomer () {
        ResponseResult<List<Customer>> response = new ResponseResult<>();
        List<Customer> list = adminService.selectAllCustomer();
        response.setData(list);
        return response;
    }

    @PostMapping("/insertCustomer")
    @ResponseBody
    public ResponseResult<Void> insertCustomer (
            @RequestParam("nickname") String nickname,
            @RequestParam("name") String name,
            @RequestParam("gender") String gender,
            @RequestParam("phone") String phone,
            @RequestParam("email") String email,
            @RequestParam("password") String password,
            @RequestParam("address") String address
    ) {
        ResponseResult<Void> response = new ResponseResult<>();
        Customer customer = new Customer();
        customer.setCmNickname(nickname);
        customer.setCmName(name);
        customer.setCmSex(gender);
        customer.setCmPhone(phone);
        customer.setCmEmail(email);
        customer.setCmPassword(password);
        customer.setCmAddress(address);
        adminService.insertCustomer(customer);
        return response;
    }

    @PostMapping("/insertAdmin")
    @ResponseBody
    public ResponseResult<Void> insertAdmin (
            @RequestParam("name") String name,
            @RequestParam("gender") String gender,
            @RequestParam("phone") String phone,
            @RequestParam("password") String password
    ) {
        ResponseResult<Void> response = new ResponseResult<>();
        Admin admin = new Admin();
        admin.setAdName(name);
        admin.setAdPassword(password);
        admin.setAdPhone(phone);
        admin.setAdSex(gender);
        adminService.insertAdmin(admin);
        return response;
    }

    @PostMapping("/updateLoginStatus")
    @ResponseBody
    public ResponseResult<Void> updateLoginStatus (
            @RequestParam("") String username
    ) {
        ResponseResult<Void> response = new ResponseResult<>();
        adminService.updateLoginStatus(username);
        return  response;
    }

    @PostMapping("/getOrderData")
    @ResponseBody
    public ResponseResult<List<EchartsData>> getOrderData(){
        ResponseResult<List<EchartsData>> response = new ResponseResult<>();
        List<EchartsData> echartsData = adminService.getOrderData();
        response.setData(echartsData);
        return response;
    }

    @PostMapping("/getAppoimentData")
    @ResponseBody
    public ResponseResult<List<EchartsData>> getAppoimentData(){
        ResponseResult<List<EchartsData>> response = new ResponseResult<>();
        List<EchartsData> echartsData = adminService.getAppoimentData();
        response.setData(echartsData);
        return response;
    }

    @PostMapping("/updateUserInfo")
    @ResponseBody
    public ResponseResult<Void> updateUserInfo (
            @RequestParam("id") String id,
            @RequestParam("password") String password,
            @RequestParam("role") String role,
            @RequestParam("status") String status
    ) {
        adminService.updateUserInfo(Integer.parseInt(id), password, Integer.parseInt(role), Integer.parseInt(status));
        return new ResponseResult<>();
    }

    @PostMapping("/getAllCustomerCertify")
    @ResponseBody
    public ResponseResult<List<Customer>> getAllCustomerCertify () {
        ResponseResult<List<Customer>> result = new ResponseResult<>();
        List<Customer> list = adminService.getAllCustomerCertify();
        result.setData(list);
        return result;
    }

    @PostMapping("/getAllHousekeeperCertify")
    @ResponseBody
    public ResponseResult<List<HouseKeeper>> getAllHousekeeperCertify () {
        ResponseResult<List<HouseKeeper>> result = new ResponseResult<>();
        List<HouseKeeper> list = adminService.getAllHousekeeperCertify();
        result.setData(list);
        return result;
    }

    @PostMapping("/getAllCompanyCertify")
    @ResponseBody
    public ResponseResult<List<Company>> getAllCompanyCertify () {
        ResponseResult<List<Company>> result = new ResponseResult<>();
        List<Company> list = adminService.getAllCompanyCertify();
        result.setData(list);
        return result;
    }

    @PostMapping("/getCustomerByID")
    @ResponseBody
    public ResponseResult<Customer> getCustomerByID (
            @RequestParam("id") String id
    ) {
        ResponseResult<Customer> result = new ResponseResult<>();
        Customer customer = adminService.getCustomerByID(Integer.parseInt(id));
        result.setData(customer);
        return result;
    }

    @PostMapping("/getHousekeeperByID")
    @ResponseBody
    public ResponseResult<HouseKeeper> getHousekeeperByID (
            @RequestParam("id") String id
    ) {
        ResponseResult<HouseKeeper> result = new ResponseResult<>();
        HouseKeeper houseKeeper = adminService.getHousekeeperByID(Integer.parseInt(id));
        result.setData(houseKeeper);
        return result;
    }

    @PostMapping("/getCompanyByID")
    @ResponseBody
    public ResponseResult<Company> getCompanyByID (
            @RequestParam("id") String id
    ) {
        ResponseResult<Company> result = new ResponseResult<>();
        Company company = adminService.getCompanyByID(Integer.parseInt(id));
        result.setData(company);
        return result;
    }

    @PostMapping("/cancelCustomerByID")
    @ResponseBody
    public ResponseResult<Void> cancelCustomerByID (
            @RequestParam("id") String id
    ) {
        adminService.updateCustomerStatusByID(Integer.parseInt(id), 2);
        return new ResponseResult<>();
    }

    @PostMapping("/certifyCustomerByID")
    @ResponseBody
    public ResponseResult<Void> certifyCustomerByID (
            @RequestParam("id") String id
    ) {
        adminService.updateCustomerStatusByID(Integer.parseInt(id), 1);
        return new ResponseResult<>();
    }

    @PostMapping("/cancelHousekeeperByID")
    @ResponseBody
    public ResponseResult<Void> cancelHousekeeperByID (
            @RequestParam("id") String id
    ) {
        adminService.updateHousekeeperStatusByID(Integer.parseInt(id), 2);
        return new ResponseResult<>();
    }

    @PostMapping("/certifyHousekeeperByID")
    @ResponseBody
    public ResponseResult<Void> certifyHousekeeperByID (
            @RequestParam("id") String id
    ) {
        adminService.updateHousekeeperStatusByID(Integer.parseInt(id), 1);
        return new ResponseResult<>();
    }

    @PostMapping("/cancelCompanyByID")
    @ResponseBody
    public ResponseResult<Void> cancelCompanyByID (
            @RequestParam("id") String id
    ) {
        adminService.updateCompanyStatusByID(Integer.parseInt(id), 2);
        return new ResponseResult<>();
    }

    @PostMapping("/certifyCompanyByID")
    @ResponseBody
    public ResponseResult<Void> certifyCompanyByID (
            @RequestParam("id") String id
    ) {
        adminService.updateCompanyStatusByID(Integer.parseInt(id), 1);
        return new ResponseResult<>();
    }

    @PostMapping("/getUserByPhone")
    @ResponseBody
    public ResponseResult<List<User>> getUserByPhone (
            @RequestParam("phone") String phone
    ) {
        ResponseResult<List<User>> result = new ResponseResult<>();
        List<User> list = adminService.getUserByPhone(phone);
        result.setData(list);
        return result;
    }

    @PostMapping("/updatePassword")
    @ResponseBody
    public ResponseResult<Void> updatePassword (
            HttpSession session,
            @RequestParam("oldPassword") String oldPassword,
            @RequestParam("newPassword") String newPassword
    ) {
        adminService.updatePassword(session, oldPassword, newPassword);
        return new ResponseResult<Void>();
    }

}

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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值