基于javaweb+mysql的springbootoa人事管理系统(java+springboot+layui+html+mysql+maven)

基于javaweb+mysql的springbootoa人事管理系统(java+springboot+layui+html+mysql+maven)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SpringBootoa人事管理系统(java+springboot+layui+html+mysql+maven)

项目介绍:

员工管理、部门管理、职位管理、薪资管理、考勤管理、请假管理、奖惩管理、日志管理、文件下载、文件上传、图表展示

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;

4.数据库:MySql 5.7版本;

技术栈

JSP +SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等

        Date endtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
        Long time = endtime.getTime() - starttime.getTime();
        Double worktime = time / 1000.0 / 60.0 / 60.0;
        attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
        attendance.setStarttime(starttime);
        attendance.setEndtime(endtime);
        attendanceService.addAttendance(attendance);
        return Result.success("考勤补录成功");
    }

    @RequestMapping("/empadd")
    @ResponseBody
    public Result<Object> EmpAddaAttendance(HttpSession session) throws ParseException {
        SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Employee employee = (Employee) session.getAttribute("loginUser");
        boolean flag = attendanceService.queryByEmpAndDate(employee.getName(), new java.sql.Date(new java.util.Date().getTime())) == null;
        if (!flag) {
            return Result.fail("你今日已打过卡了");
        } else {
            Attendance attendance = new Attendance();
            attendance.setStatus(2);
            attendance.setEmployee_name(employee.getName());
            attendance.setStartDate(new java.sql.Date(new java.util.Date().getTime()));
            attendance.setStarttime(time.parse(time.format(new Date())));
            attendanceService.addAttendance(attendance);
            return Result.success(employee.getName() + "打卡成功");
        }
    }

    @GetMapping("/{id}")
    public String queryAttendanceById(@PathVariable("id") Integer id, Model model) {
        model.addAttribute("empList", employeeService.queryAll());
        model.addAttribute("attendance", attendanceService.queryById(id));
        return "attendance/attendanceedit";
    }

    @RequestMapping("/update")
    @ResponseBody
    public Result<Object> updateAttendance(String id, String startDate, String starttime, String endtime, String employee_name, String status) throws ParseException {
        Attendance attendance = attendanceService.queryById(Integer.valueOf(id));
        Date startDate1 = new SimpleDateFormat("yyyy-MM-dd").parse(startDate);
        Date starttime1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(starttime);
    }

    @GetMapping("/list")
    @ResponseBody//返回Json
    public Result<Object> getAttendanceList(AttendanceQuery param) {
        System.out.println(param);
        List<Attendance> list = attendanceService.getAttendanceList(param);
        System.out.println(list);
        Long count = attendanceService.countAttendanceList(param);
        return Result.success("success", list, count);
    }

    //添加部门页面跳转
    @RequestMapping("/AttendanceAdd")
    public String toAttendanceAdd(Model model) {
        model.addAttribute("empList", employeeService.queryAll());
        return "attendance/attendanceadd";
    }

    @PostMapping("/add")
    @ResponseBody
    public Result<Object> addaAttendance(Attendance attendance, String start, String end) throws ParseException {
        Date starttime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(start);
        Date endtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
        Long time = endtime.getTime() - starttime.getTime();
        Double worktime = time / 1000.0 / 60.0 / 60.0;
        attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
        attendance.setStarttime(starttime);
        attendance.setEndtime(endtime);
        attendanceService.addAttendance(attendance);
        return Result.success("考勤补录成功");
    }

    @RequestMapping("/empadd")
    @ResponseBody
    public Result<Object> EmpAddaAttendance(HttpSession session) throws ParseException {
        SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Employee employee = (Employee) session.getAttribute("loginUser");
        boolean flag = attendanceService.queryByEmpAndDate(employee.getName(), new java.sql.Date(new java.util.Date().getTime())) == null;
        if (!flag) {
            return Result.fail("你今日已打过卡了");
        } else {
            Attendance attendance = new Attendance();
            attendance.setStatus(2);
            attendance.setEmployee_name(employee.getName());
            attendance.setStartDate(new java.sql.Date(new java.util.Date().getTime()));
            attendance.setStarttime(time.parse(time.format(new Date())));
            attendanceService.addAttendance(attendance);
            return Result.success(employee.getName() + "打卡成功");

@RequestMapping("/dept")
@Controller
public class DeptController {

    @Autowired
    DepartmentService departmentService;
    @GetMapping("")
    public String toDeptListUI(){
        return "dept/deptList";
    }

    @GetMapping("/list")
    @ResponseBody//返回Json
    public Result<Object> getDeptList(DeptQuery param){
        List<Employee> list=departmentService.getDeptList(param);
        Long count=departmentService.countDeptList(param);
        return Result.success("success",list,count);
    }

    //添加部门
    @PostMapping("/add")
    @ResponseBody
    public Result<Object> addDept(Department department)
    {
        System.out.println(department);
        departmentService.addDept(department);
        return Result.success("添加部门成功");
    }
    //添加部门页面跳转
    @RequestMapping("/deptAdd")
    public String toDeptAdd(){
        return "dept/deptadd";
    }

    //删除部门
    @PostMapping("/delete/{ids}")
    @ResponseBody
    public Result<Object> deleteDeptById(@PathVariable("ids") String ids)
    {
        departmentService.deleteDeptById(ids);
        return Result.success("删除部门成功");
    }

        Date date = time.parse(time.format(new Date()));
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        leave.setEmployee_name(loginUser.getName());
        leave.setStatus(0);
        leave.setSubtime(date);
        System.out.println(leave);
        leaveService.addLeave(leave);
//        Date starttime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(start);
//        Date endtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
        return Result.success("提交申请成功");
    }

}

@RequestMapping("/empreward")
@Controller
public class RewardController2 {

    @Autowired
    DepartmentService departmentService;
    @Autowired
    RewardService rewardService;
    @Autowired
    EmployeeService employeeService;

    @RequestMapping("")
    public String toRewardUi(Model model){
        model.addAttribute("deptList",departmentService.queryAll());
        return "reward/rewardList2";
    }

    @GetMapping("/list")
    @ResponseBody
    public Result<Object> getRewardList(RewardQuery param, HttpSession session) {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        param.setEmployee_name(loginUser.getName());
        List<Reward> list = rewardService.getRewardList(param);
    }

    @PostMapping("/add")
    @ResponseBody
    public Result<Object> addaHealth(String temperature, String pic,String pic2,HttpSession session) throws ParseException {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        Health health=new Health();
        health.setEmployee_name(loginUser.getName());
        health.setCreatedate(new Date());
        health.setTemperature(Double.valueOf(temperature));
        health.setImage("image\\" + pic);
        health.setImage2("image\\" + pic2);
        healthService.addHealth(health);
        return Result.success("日报上传成功");
    }

    //添加部门页面跳转
    @RequestMapping("/HealthAdd")
    public String toAttendanceAdd(Model model,HttpSession session) {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        model.addAttribute("user",loginUser);
        String startDate1 = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        model.addAttribute("date",startDate1);

        return "health/healthadd";
    }

}

@Controller
@RequestMapping("/empattendance")

@Controller
@RequestMapping("/empattendance")
public class AttendanceController2 {
    @Autowired
    AttendanceService attendanceService;
    @Autowired
    EmployeeService employeeService;

    @GetMapping("")
    public String toAttendanceListUI() {
        return "attendance/attendanceList2";
    }

    @GetMapping("/list")
    @ResponseBody//返回Json
    public Result<Object> getAttendanceList(AttendanceQuery param,HttpSession session) {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        param.setEmployee_name(loginUser.getName());
        List<Attendance> list = attendanceService.getAttendanceList(param);
        Long count = attendanceService.countAttendanceList(param);
        return Result.success("success", list, count);
    }

    //添加部门页面跳转
    @RequestMapping("/AttendanceAdd")
    public String toAttendanceAdd(Model model) {
        model.addAttribute("empList", employeeService.queryAll());
        return "attendance/attendanceadd";
    }

    @PostMapping("/add")
    @ResponseBody
    public Result<Object> addaAttendance(Attendance attendance, String start, String end) throws ParseException {
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public Result queryLogList(LogExample logExample) {
        LogExample.Criteria criteria = logExample.createCriteria();
        criteria.andCreatedByIsNotNull();
        List<Log> logsList = logService.queryLogList(logExample);
        return Result.success(LOG_QUERY_SUCCESS, logsList);
    }

    /**
     * @param msg
     * @return ApiResult
     * @throws UnknownHostException 插入日志 insertLog
     */
    @RequestMapping("/add")
    @ResponseBody
    public Result insertLog(Employee employee, String msg) throws UnknownHostException {
        Log log = new Log();
        InetAddress addr = InetAddress.getLocalHost();
        log.setLoginIp(addr.getHostAddress());
        log.setLoginName(employee.getUsername());
        log.setLoginMsg(msg);
        log.setCreatedBy(Long.valueOf(1));
        log.setCreatedDate(new java.sql.Date(new java.util.Date().getTime()));
        log.setOwner("zcx");
        logService.insertLog(log);
        return Result.success(LOG_INSERT_SUCCESS);
    }

    /**
     * 删除日志 deleteLogById
     * @param ids
     * @return ApiResult
     */
    @RequestMapping("/delete/{ids}")
    @ResponseBody
    public Result deleteLogById(@PathVariable("ids") String ids) {
        logService.deleteLogById(ids);
        return Result.success(LOG_DELETE_SUCCESS);
    }
        return Result.success("删除员工成功");
    }

    //获取单个员工信息
    @GetMapping("/{id}")
    public String queryEmpById(@PathVariable("id") Integer id,Model model){
        //获取部门信息和级别信息
        List<Department> deptList=departmentService.queryAll();
        List<Level> levelList=levelService.queryAll();
        model.addAttribute("levelList",levelList);
        model.addAttribute("deptList",deptList);
        //获取员工信息
        Employee employee = employeeService.queryEmpById(id);
        model.addAttribute("emp",employee);
        return "emp/empedit";
    }

    //更新员工
    @RequestMapping("/update")
    @ResponseBody
    public Result<Object> updateEmp(Employee employee,@Param("department.id") String dept_id,String level_id)
    {
        employee.setDepartment(departmentService.queryById(dept_id));
        employee.setLevel(levelService.queryById(level_id));
        employeeService.updateEmp(employee);
        return Result.success("修改成功");
    }

    @RequestMapping("/queryEmpByDept")
    @ResponseBody
    public List<Employee> queryEmpByDept(String dept_id){
        List<Employee> employeeList = employeeService.queryEmpByDeptId(Integer.valueOf(dept_id));
        System.out.println(employeeList);
        return employeeList;
    }

    @RequestMapping("/updateEmpPassword")
    @ResponseBody
    public Result<Object> updatePassword(HttpSession session, String old_password, String new_password, String again_password){
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        //验证密码
        boolean matches =old_password.equals(loginUser.getPassword());
        if(matches)
        if (worktime <= 0) {
            return Result.fail("工作时长不能为0或小于0");
        } else {
            attendance.setStarttime(startDate1);
            attendance.setEmployee_name(employee_name);
            attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
            attendance.setStarttime(starttime1);
            attendance.setEndtime(endtime1);
            attendance.setStatus(Integer.parseInt(status));
            attendanceService.updateAttendance(attendance);
            return Result.success("修改成功");
        }
    }

    @RequestMapping("/empupdate")
    @ResponseBody
    public Result<Object> EmpupdateAttendance(HttpSession session) throws ParseException {
        SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Employee employee = (Employee) session.getAttribute("loginUser");
        Attendance attendance = attendanceService.queryByEmpAndDate(employee.getName(), new java.sql.Date(new Date().getTime()));
        Date date = time.parse(time.format(new Date()));
        if (attendance == null) {
            return Result.fail("你今日还未打卡");
        } else {
            Long time1 = date.getTime() - attendance.getStarttime().getTime();
            Double worktime = time1 / 1000.0 / 60.0 / 60.0;
            if (worktime <= 0) {
                return Result.fail("工作时长不能为0或小于0");
            } else {
                if (attendance.getStatus() == 2) {
                    attendance.setStatus(1);
                    attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
                    attendance.setEndtime(date);
                    attendanceService.updateAttendance(attendance);
                    return Result.success("下班成功");
                } else {
                    return Result.fail("您今日已打卡下班,如打卡有误,请联系管理员修改");
                }
            }
        }
    }

    @PostMapping("/delete/{ids}")
    @ResponseBody
    public Result<Object> deleteAttendance(@PathVariable("ids") String ids) {
        attendanceService.deleteAttendanceById(ids);
            String filename = emp + prefix + "xc" + UUID.randomUUID() + suffix;
            File filepath = new File(UploadPath, filename);
            // 判断路径是否存在,没有创建
            if (!filepath.getParentFile().exists()) {
                filepath.getParentFile().mkdirs();
            }
            // 将上传文件保存到一个目标文档中
            File file1 = new File(UploadPath + File.separator + filename);
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file1));
            out.write(file.getBytes());
            out.flush();
            out.close();

//            file.transferTo(file1);
            Map<String, Object> res = new HashMap<>();
            // 返回的是一个url对象,图片名称
            res.put("url", filename);
            return res;
        } else {
            return null;
        }
    }

    @RequestMapping("/update")
    @ResponseBody
    public Result<Object> updateHealth(String id, String employee_name, String temperature, String pic,String pic2) throws ParseException {
        System.out.println(pic2);
        Health health = healthService.queryById(Integer.valueOf(id));
        if (health.getEmployee_name().equals(employee_name)) {
            health.setTemperature(Double.valueOf(temperature));
            health.setImage("image\\" + pic);
            health.setImage2("image\\" + pic2);
            healthService.updateHealth(health);
            return Result.success("修改成功");
        } else {
            return Result.fail("修改失败");
        }
    }
}

            Long time1 = date.getTime() - attendance.getStarttime().getTime();
            Double worktime = time1 / 1000.0 / 60.0 / 60.0;
            if (worktime <= 0) {
                return Result.fail("工作时长不能为0或小于0");
            } else {
                if (attendance.getStatus() == 2) {
                    attendance.setStatus(1);
                    attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
                    attendance.setEndtime(date);
                    attendanceService.updateAttendance(attendance);
                    return Result.success("下班成功");
                } else {
                    return Result.fail("您今日已打卡下班,如打卡有误,请联系管理员修改");
                }
            }
        }
    }

    @PostMapping("/delete/{ids}")
    @ResponseBody
    public Result<Object> deleteAttendance(@PathVariable("ids") String ids) {
        attendanceService.deleteAttendanceById(ids);
        return Result.success("删除考勤成功");
    }

}


/**
 * @Title: HealthController
 * @Package com.xlk.controller
 * @Description: HealthController
 */
@Controller
@RequestMapping("/health2")
public class HealthController2 {
    @Autowired
    HealthService healthService;
    @Autowired
    EmployeeService employeeService;

    @GetMapping("")
    public String toHealthListUI() {
        return "health/healthList2";
    }

    @GetMapping("/list")
    @ResponseBody
    public Result<Object> getHealthList(HealthQuery param,HttpSession session) {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
        param.setEmployee_name(loginUser.getName());
        List<Health> list = healthService.getHealthList(param);
        Long count = healthService.countHealthList(param);
        return Result.success("success", list, count);
    }

    @GetMapping("/get/{id}")
        } else {
            Long time1 = date.getTime() - attendance.getStarttime().getTime();
            Double worktime = time1 / 1000.0 / 60.0 / 60.0;
            if (worktime <= 0) {
                return Result.fail("工作时长不能为0或小于0");
            } else {
                if (attendance.getStatus() == 2) {
                    attendance.setStatus(1);
                    attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
                    attendance.setEndtime(date);
                    attendanceService.updateAttendance(attendance);
                    return Result.success("下班成功");
                } else {
                    return Result.fail("您今日已打卡下班,如打卡有误,请联系管理员修改");
                }
            }
        }
    }

    @PostMapping("/delete/{ids}")
    @ResponseBody
    public Result<Object> deleteAttendance(@PathVariable("ids") String ids) {
        attendanceService.deleteAttendanceById(ids);
        return Result.success("删除考勤成功");
    }

}

                if(user.getStatus()==1)
                {
                    session.setAttribute("loginUser",user);
                    return Result.success();
                }
                else
                {
                    return Result.fail("用户已被禁止登陆");
                }

            }
        }
        return Result.fail("用户名或密码错误");
    }

    @RequestMapping("/loginout")
    @ResponseBody
    public Result<Object> loginout(HttpSession session){
        session.removeAttribute("loginUser");
        return Result.success("退出成功");
    }
    @RequestMapping("/updatePassword")
    public Result<Object> updatePassword(HttpSession session,String old_password,String new_password,String again_password){
        User loginUser = (User) session.getAttribute("loginUser");
        //验证密码
        BCryptPasswordEncoder passwordEncoder=new BCryptPasswordEncoder();//新建springSecurity验证
        boolean matches = passwordEncoder.matches(old_password, loginUser.getPassword());//验证密码
        System.out.println(matches);
        if(matches)
        {
            if(new_password.equals(again_password))
            {
                loginUser.setPassword(passwordEncoder.encode(new_password));
                userService.updatePassword(loginUser);
                return Result.success("修改密码成功");
            }
            else
            {
                return Result.fail("二次重复密码不一致");
            }
        }
        return Result.success("老密码错误");
    }
}

            //取得原文件名字
            String fileName = file.getOriginalFilename();
            //取得文件扩展名
            String suffix = fileName.substring(fileName.lastIndexOf("."));
            //提取系统时间作为新文件名
            String prefix = date.replaceAll("-", "");
            System.out.println(prefix);
            //保存路径
            // 上传文件名
            String filename = emp + prefix + "xc" + UUID.randomUUID() + suffix;
            File filepath = new File(UploadPath, filename);
            // 判断路径是否存在,没有创建
            if (!filepath.getParentFile().exists()) {
                filepath.getParentFile().mkdirs();
            }
            // 将上传文件保存到一个目标文档中
            File file1 = new File(UploadPath + File.separator + filename);
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file1));
            out.write(file.getBytes());
            out.flush();
            out.close();

//            file.transferTo(file1);
            Map<String, Object> res = new HashMap<>();
            // 返回的是一个url对象,图片名称
            res.put("url", filename);
            return res;
        } else {
            return null;
        }
    }

    @RequestMapping("/update")
    @ResponseBody
    public Result<Object> updateHealth(String id, String employee_name, String temperature, String pic,String pic2) throws ParseException {
        Health health = healthService.queryById(Integer.valueOf(id));
        if (health.getEmployee_name().equals(employee_name)) {
            health.setTemperature(Double.valueOf(temperature));
            health.setImage("image\\" + pic);
            health.setImage2("image\\" + pic2);
            healthService.updateHealth(health);
            return Result.success("修改成功");
        } else {
            return Result.fail("修改失败");
        }
    }

    @PostMapping("/add")
    @ResponseBody
    public Result<Object> addaHealth(String temperature, String pic,String pic2,HttpSession session) throws ParseException {
        Employee loginUser = (Employee) session.getAttribute("loginUser");
            if (!filepath.getParentFile().exists()) {
                filepath.getParentFile().mkdirs();
            }
            // 将上传文件保存到一个目标文档中
            File file1 = new File(UploadPath + File.separator + filename);
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file1));
            out.write(file.getBytes());
            out.flush();
            out.close();

//            file.transferTo(file1);
            Map<String, Object> res = new HashMap<>();
            // 返回的是一个url对象,图片名称
            res.put("url", filename);
            return res;
        } else {
            return null;
        }
    }

    @ResponseBody
    @RequestMapping(value = "/uploadFile2", method = RequestMethod.POST)
    public Map<String, Object> uploadFile2(HttpServletRequest servletRequest, @RequestParam("file") MultipartFile file, HttpSession session, String emp, String date)
            throws IOException {
        // 如果文件内容不为空,则写入上传路径
        if (!file.isEmpty()) {
            // 上传文件路径
            String UploadPath = FileUtil.projectRootDir + "\\src\\main\\resources\\static\\health";
            //取得原文件名字
            String fileName = file.getOriginalFilename();
            //取得文件扩展名
            String suffix = fileName.substring(fileName.lastIndexOf("."));
            //提取系统时间作为新文件名
            String prefix = date.replaceAll("-", "");
            System.out.println(prefix);
            //保存路径
            // 上传文件名
            String filename = emp + prefix + "xc" + UUID.randomUUID() + suffix;
            File filepath = new File(UploadPath, filename);
            attendanceService.addAttendance(attendance);
            return Result.success(employee.getName() + "打卡成功");
        }
    }

    @GetMapping("/{id}")
    public String queryAttendanceById(@PathVariable("id") Integer id, Model model) {
        model.addAttribute("empList", employeeService.queryAll());
        model.addAttribute("attendance", attendanceService.queryById(id));
        return "attendance/attendanceedit";
    }

    @RequestMapping("/update")
    @ResponseBody
    public Result<Object> updateAttendance(String id, String startDate, String starttime, String endtime, String employee_name, String status) throws ParseException {
        Attendance attendance = attendanceService.queryById(Integer.valueOf(id));
        Date startDate1 = new SimpleDateFormat("yyyy-MM-dd").parse(startDate);
        Date starttime1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(starttime);
        Date endtime1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(endtime);
        Long time = endtime1.getTime() - starttime1.getTime();
        Double worktime = time / 1000.0 / 60.0 / 60.0;
        if (worktime <= 0) {
            return Result.fail("工作时长不能为0或小于0");
        } else {
            attendance.setStarttime(startDate1);
            attendance.setEmployee_name(employee_name);
            attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2));
            attendance.setStarttime(starttime1);
            attendance.setEndtime(endtime1);
            attendance.setStatus(Integer.parseInt(status));
            attendanceService.updateAttendance(attendance);
            return Result.success("修改成功");
        }
    }

    @RequestMapping("/empupdate")
    @ResponseBody
    public Result<Object> EmpupdateAttendance(HttpSession session) throws ParseException {
        SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Employee employee = (Employee) session.getAttribute("loginUser");
        Attendance attendance = attendanceService.queryByEmpAndDate(employee.getName(), new java.sql.Date(new Date().getTime()));
        Date date = time.parse(time.format(new Date()));
        if (attendance == null) {
            return Result.fail("你今日还未打卡");
        } else {
            Long time1 = date.getTime() - attendance.getStarttime().getTime();
            Double worktime = time1 / 1000.0 / 60.0 / 60.0;
            if (worktime <= 0) {
                return Result.fail("工作时长不能为0或小于0");
            } else {
                if (attendance.getStatus() == 2) {

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
人事管理OA系统 本案例开发环境: 数据库:Mysql IDE :STS3.0 JDk :1.7 Tomcat:7.0 本案例所使用技术: 1、struts2标签 2、jsp页面 3、SSH2 框架 目前完成功能: 1、用户登录判断权限 2、普通用户登录主页详情查看 3、员工考勤查询 4、员工个人薪资查询 5、员工假期申请与查询及修改 6、用户密码修改 2013-08-26 18:48 新完成的模块 1、人事部职员管理职工模块 a、添加职工 b、多种条件查询职工 c、查看职工详情 2013-08-26 18:38 新完成的模块 1、公司部门管理 a、所有部门查询(详情查询) b、部门详情修改 c、查看部门所有员工 d、添加部门 f、修改部门 2、员工考勤管理 a、当天考勤查询 b、所有考勤查询(多条件考勤查询) 问题: 如果action同用全局属性会出现属性上次查询被赋值的情况 正在在解决方案????? 2013-08-28 新完成的模块 1、员工考勤管理 a、职工签到 2、职工加班管理 b、部门加班查询(部门Id条件查询) c、个人加班查询 (员工Id和时间查询) d、添加加班信息 e、修改加班信息 3、职工薪资管理 f、按月查询薪资(部门Id查询) g、薪资发放 4、个人页面(同用普通用户页面) spring 默认注入为单例模式 如有些action不需要刻意在bean标签加入scope="prototype"属性 内部私有属性定义时最好赋初值(尤其字符串)这样对后面判断有益 如果action无法传值 刻意考虑用session传值 2013-08-29 10:19 新完成模块 1、请假管理 a、添加拦截器作为用户登录验证 此案例到此结束!源码中可能有些地方不够细致 没加大数据测试不足之处还请谅解!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

java毕业

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

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

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

打赏作者

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

抵扣说明:

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

余额充值