Java项目:JSP家政服务管理系统

127 篇文章 14 订阅
111 篇文章 0 订阅

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

雇主用户角色包含以下功能:
首页,注册账号,雇主登录,查询家政阿姨,查看供求信息,查看家政公司,阿姨预约,查看我的预约,发布需求信息等功能。

管理员角色包含以下功能:
登录,添加新闻,家政合同管理,家政阿姨管理,审核供应信息,企业用户管理,雇主管理等功能。

家政阿姨角色包含以下功能:
登陆页面,发布供应信息,管理我的预约等功能。

家政公司角色包含以下功能:
登录,发布家政名片等功能。

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

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.数据库:MySql 5.7版本;

技术栈

HTML+CSS+JavaScript+jsp+mysql

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入localhost:8080/login.jsp 登录

运行截图

前台页面

 

 

 

 

 

管理端页面

 

 

 

 

 

 

 

相关代码 

管理员控制器

@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>();
    }

}

预约控制器

@Controller()
@RequestMapping("/app")
public class AppointmentController extends BaseController{

    @Autowired
    private AppointmentService appService;

    /**
     * 跳转我的预约页面
     * @return 我的预约页面
     */
    @GetMapping("/toCmApp")
    public String toCmApp() {
        return "cm_app";
    }

    /**
     * 跳转预约列表页面
     * @return 预约列表页面
     */
    @GetMapping("/toHkApp")
    public String toHkApp() {
        return "hk_app";
    }

    @PostMapping("/mkApp")
    @ResponseBody
    public ResponseResult<Void> makeAppoint(
            HttpSession session,
            @RequestParam("app_type") String appType,
            @RequestParam("app_address_city") String appAddressCity,
            @RequestParam("app_address_area") String appAddressArea,
            @RequestParam("app_address_detail") String appAddressDetail,
            @RequestParam("app_phone") String appPhone,
            @RequestParam("app_time") String appTime
    ) {
        ResponseResult<Void> response = new ResponseResult<Void>();
        String username = new String();
        String key = "username";
        if (session.getAttribute(key) == null) {
            response.setState(406);
            response.setMessage("用户未登录");
        } else {
            username = session.getAttribute(key).toString();
        }
        String appAddress = appAddressCity + "-" + appAddressArea + "-" + appAddressDetail;
        Appointment appointment = new Appointment();
        appointment.setAppAddress(appAddress);
        appointment.setAppType(appType);
        appointment.setAppPhone(appPhone);
        appointment.setAppBeginTime(FormatDate.StrToDate(appTime));

        System.out.println("预约地点:" + appAddress + "预约类型:" + appType + "预约电话:" + appPhone);

        appService.insertAppointment(appointment, username);

        return new ResponseResult<Void>();
    }

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

        return result;
    }

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

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

        return result;
    }

    @PostMapping("/apply")
    @ResponseBody
    public ResponseResult<Void> apply (
            HttpSession session,
            Integer id
    ) {
        appService.insertApplyList(session, id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/getSingleApp")
    @ResponseBody
    public ResponseResult<Appointment> getSingleApp (
            @RequestParam("id") Integer id
    ) {
        ResponseResult<Appointment> result = new ResponseResult<>();
        Appointment app = appService.selectAppointByID(id);
        result.setData(app);
        return result;
    }

    @PostMapping("/updateAppStatus")
    @ResponseBody
    public ResponseResult<Void> updateAppStatus (
            @RequestParam("id") Integer id
    ) {
        appService.updateAppointStatus(0, id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/deleteApp")
    @ResponseBody
    public ResponseResult<Void> deleteAppointByID (
            @RequestParam("id") Integer id
    ) {
        appService.deleteAppointByID(id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/confirmHK")
    @ResponseBody
    public ResponseResult<Void> confirmHK (
            HttpSession session,
            @RequestParam("id") Integer id,
            @RequestParam("hkID") Integer hkID
    ) {
        String username = session.getAttribute("username").toString();
        appService.insertConfirmHKID(username, id, hkID);
        return new ResponseResult<>();
    }
}

订单控制器

@Controller()
@RequestMapping("/app")
public class AppointmentController extends BaseController{

    @Autowired
    private AppointmentService appService;

    /**
     * 跳转我的预约页面
     * @return 我的预约页面
     */
    @GetMapping("/toCmApp")
    public String toCmApp() {
        return "cm_app";
    }

    /**
     * 跳转预约列表页面
     * @return 预约列表页面
     */
    @GetMapping("/toHkApp")
    public String toHkApp() {
        return "hk_app";
    }

    @PostMapping("/mkApp")
    @ResponseBody
    public ResponseResult<Void> makeAppoint(
            HttpSession session,
            @RequestParam("app_type") String appType,
            @RequestParam("app_address_city") String appAddressCity,
            @RequestParam("app_address_area") String appAddressArea,
            @RequestParam("app_address_detail") String appAddressDetail,
            @RequestParam("app_phone") String appPhone,
            @RequestParam("app_time") String appTime
    ) {
        ResponseResult<Void> response = new ResponseResult<Void>();
        String username = new String();
        String key = "username";
        if (session.getAttribute(key) == null) {
            response.setState(406);
            response.setMessage("用户未登录");
        } else {
            username = session.getAttribute(key).toString();
        }
        String appAddress = appAddressCity + "-" + appAddressArea + "-" + appAddressDetail;
        Appointment appointment = new Appointment();
        appointment.setAppAddress(appAddress);
        appointment.setAppType(appType);
        appointment.setAppPhone(appPhone);
        appointment.setAppBeginTime(FormatDate.StrToDate(appTime));

        System.out.println("预约地点:" + appAddress + "预约类型:" + appType + "预约电话:" + appPhone);

        appService.insertAppointment(appointment, username);

        return new ResponseResult<Void>();
    }

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

        return result;
    }

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

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

        return result;
    }

    @PostMapping("/apply")
    @ResponseBody
    public ResponseResult<Void> apply (
            HttpSession session,
            Integer id
    ) {
        appService.insertApplyList(session, id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/getSingleApp")
    @ResponseBody
    public ResponseResult<Appointment> getSingleApp (
            @RequestParam("id") Integer id
    ) {
        ResponseResult<Appointment> result = new ResponseResult<>();
        Appointment app = appService.selectAppointByID(id);
        result.setData(app);
        return result;
    }

    @PostMapping("/updateAppStatus")
    @ResponseBody
    public ResponseResult<Void> updateAppStatus (
            @RequestParam("id") Integer id
    ) {
        appService.updateAppointStatus(0, id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/deleteApp")
    @ResponseBody
    public ResponseResult<Void> deleteAppointByID (
            @RequestParam("id") Integer id
    ) {
        appService.deleteAppointByID(id);
        return new ResponseResult<Void>();
    }

    @PostMapping("/confirmHK")
    @ResponseBody
    public ResponseResult<Void> confirmHK (
            HttpSession session,
            @RequestParam("id") Integer id,
            @RequestParam("hkID") Integer hkID
    ) {
        String username = session.getAttribute("username").toString();
        appService.insertConfirmHKID(username, id, hkID);
        return new ResponseResult<>();
    }
}

如果也想学习本系统,下面领取。关注并回复:057jsp

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
1 概述 1 1.1 实用背景意义 1 1.2 家政现状分析 1 1.3 论文主体结构 2 2 系统开发环境与相关技术概述 3 2.1 系统开发环境 3 2.1.1 硬件要求 3 2.1.2 软件要求 3 2.1.3 系统运行环境需求 3 2.2 相关技术概述 3 2.2.1 Java技术 3 2.2.2 Eclipse简介 4 2.2.3 B/S架构设计 4 2.2.4 MySQL数据库简介 5 3 系统设计分析 6 3.1 系统可行性分析 6 3.1.1 经济可行性 6 3.1.2 技术可行性 6 3.1.3 实现可行性 6 3.2 系统需求分析 6 3.2.1 功能需求分析 6 3.2.2 系统性能分析 7 3.3 系统流程设计 7 3.3.1 用户登入模块 7 3.3.2 信息修改模块 8 3.3.3 信息删除流程 ....9 4 系统设计与实现 10 4.1 系统主要功能 10 4.2 数据主库设计 12 4.2.1 数据库概要设计 12 4.2.2 数据库 E-R图 13 4.2.3 数据主库表结构 14 4.3 前台页面展示 17 4.3.1 注册页面显示 17 4.3.2 登录显示模块 18 4.3.3 主要功能模块 20 4.4 后台管理页面 25 4.4.1账户管理功能模块.................................................................................................25 4.4.2身份信息认证模块.................................................................................................25 5 系统测试与探讨 26 5.1 系统测试内容 26 5.2 系统测试方法 26 5.3 测试结果探讨 26 5.3.1 用户注册登录模块测试 26 5.3.2 用户信息管理模块测试 26 5.3.3 订单管理模块测试 27 5.3.4 后台管理员模块测试 27 6 结论与展望 30 谢辞 31 参考文献 32 附录............................................................................................................................................33

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜未央5788

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

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

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

打赏作者

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

抵扣说明:

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

余额充值