package com.iotek.controller;
import com.iotek.entity.Checkon;
import com.iotek.entity.Employee;
import com.iotek.service.CheckonService;
import com.iotek.service.EmployeeService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by Mbenben on 2017/4/21.
*/
@Controller("checkAction")
public class CheckAction {
@Resource(name = "empolyeeService")
private EmployeeService employeeService;
@Resource(name = "checkonService")
private CheckonService checkonService;
//上班签到
@RequestMapping("/addCheckon.action")
public String addCheckon(HttpSession session, ModelMap map) throws ParseException {
Employee employee = (Employee) session.getAttribute("employee");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
String source = "9:00";//上班规定时间
double h = 0;
Date date = null;
Date date1 = null;
try {
date = sdf.parse(source);
date1 = sdf.parse(sdf.format(new Date()));
h = (date1.getTime() - date.getTime()) / 1000 / 3600.0;
} catch (ParseException e) {
e.printStackTrace();
}
List<Checkon> checkonList = checkonService.getCheckonByEid(employee.getEid());
if (checkonList.size() != 0) {
Checkon checkon = checkonList.get(checkonList.size() - 1);
Date date2 = sdf1.parse(sdf1.format(checkon.getStarttime()));
Date date3 = sdf1.parse(sdf1.format(new Date()));
if (!date2.equals(date3)) {
Checkon checkon1 = new Checkon();
checkon1.setStarttime(new Date());
checkon.setGowork_state("正常");
if (0 < h && h <= 3) {
checkon1.setGowork_state("迟到");
} else if (h > 3) {
checkon1.setGowork_state("旷工");
}
checkon1.setEmployee(employee);
checkonService.addChechon(checkon1);
Checkon checkon2 = checkonService.getCheckonByTid(checkon1.getKid());
session.setAttribute("checkon2", checkon2);
map.addAttribute("success", "签到成功");
} else {
map.addAttribute("defeated", "你已经打过卡了");
}
return "showCheckon.jsp";
}
Checkon checkon = new Checkon();
checkon.setStarttime(new Date());
checkon.setGowork_state("正常");
if (0 < h && h <= 3) {
checkon.setGowork_state("迟到");
}
if (h > 3) {
checkon.setGowork_state("旷工");
}
checkon.setEmployee(employee);
checkonService.addChechon(checkon);
Checkon checkon2 = checkonService.getCheckonByTid(checkon.getKid());
session.setAttribute("checkon2", checkon2);
map.addAttribute("success", "签到成功");
return "showCheckon.jsp";
}
/*下班签到*/
@RequestMapping("/updateCheckon.action")
public String updateCheckon(HttpSession session, ModelMap map) throws ParseException {
Employee employee = (Employee) session.getAttribute("employee");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
String source = "17:00";//下班规定时间
double h = 0;
Date date = null;
Date date1 = null;
try {
date = sdf.parse(source);
date1 = sdf.parse(sdf.format(new Date()));
h = (date.getTime() - date1.getTime()) / 1000 / 3600.0;
} catch (ParseException e) {
e.printStackTrace();
}
List<Checkon> checkonList = checkonService.getCheckonByEid(employee.getEid());
if (checkonList.size() != 0) {
Checkon checkon = checkonList.get(checkonList.size() - 1);
if (checkon.getStarttime() != null && checkon.getEndtime() == null) {
checkon.setEndtime(new Date());
checkon.setUpwork_state("正常");
if (0 < h && h <= 3) {
checkon.setUpwork_state("早退");
} else if (h > 3) {
checkon.setUpwork_state("旷工");
}
checkonService.updateCheckon(checkon);
Checkon checkon2 = checkonService.getCheckonByTid(checkon.getKid());
session.setAttribute("checkon2", checkon2);
} else {
map.addAttribute("checkon", "请先打上班卡");
}
}
map.addAttribute("success", "你已经打过下班卡了");
return "showCheckon.jsp";
}
@RequestMapping("/getAllCheckon.action")
public String getAllCheckon(HttpSession session) {
List<Checkon> list = checkonService.getAll();
session.setAttribute("list",list);
return "showAllCheck.jsp";
}
@RequestMapping("/showEmpC.action")
public String showEmpC(HttpSession session,Employee employee){
Employee employee1=(Employee) session.getAttribute("employee");
List<Checkon> checkonList= checkonService.getCheckonByEid(employee1.getEid());
session.setAttribute("checkonList",checkonList);
return "showEmpC.jsp";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
人力资源管理系统源码项目,可直接运行
共541个文件
gif:130个
class:112个
jsp:98个
3星 · 超过75%的资源 需积分: 14 32 下载量 94 浏览量
2018-02-28
11:01:32
上传
评论 11
收藏 38.82MB ZIP 举报
温馨提示
人力资源管理系统源码,内附说明文档,通俗易懂,逻辑清晰易于理解。Spring+SpringMvc+MyBatis。
资源推荐
资源详情
资源评论
收起资源包目录
人力资源管理系统源码项目,可直接运行 (541个子文件)
metadata.values.at 76B
EmpolyeeAction.class 7KB
EmpolyeeAction.class 7KB
SalaryAction.class 6KB
SalaryAction.class 6KB
UserAction.class 6KB
UserAction.class 6KB
RecruitAction.class 6KB
RecruitAction.class 6KB
CheckAction.class 5KB
CheckAction.class 5KB
RwandphAction.class 4KB
RwandphAction.class 4KB
PostAction.class 4KB
PostAction.class 4KB
TrainAction.class 4KB
TrainAction.class 4KB
Resume.class 4KB
Resume.class 4KB
DeptAction.class 4KB
DeptAction.class 4KB
ResumeAction.class 3KB
ResumeAction.class 3KB
Employee.class 3KB
Employee.class 3KB
EmployeeServiceImpl.class 3KB
EmployeeServiceImpl.class 3KB
Recruit.class 2KB
Recruit.class 2KB
CheckServiceImpl.class 2KB
CheckServiceImpl.class 2KB
User.class 2KB
User.class 2KB
TrainServiceImpl.class 2KB
TrainServiceImpl.class 2KB
DissentAction.class 2KB
DissentAction.class 2KB
Train.class 2KB
Train.class 2KB
RwandphServiceImpl.class 2KB
RwandphServiceImpl.class 2KB
DeptSeviceImpl.class 2KB
DeptSeviceImpl.class 2KB
Salary.class 2KB
Salary.class 2KB
ResumeServiceImpl.class 2KB
ResumeServiceImpl.class 2KB
SalaryServiceImpl.class 2KB
SalaryServiceImpl.class 2KB
PostServiceImpl.class 2KB
PostServiceImpl.class 2KB
Checkon.class 2KB
Checkon.class 2KB
Dept.class 2KB
Dept.class 2KB
UserServiceImpl.class 2KB
UserServiceImpl.class 2KB
Rwandph.class 1KB
Rwandph.class 1KB
RecruitServiceImpl.class 1KB
RecruitServiceImpl.class 1KB
DateConvert.class 1KB
DateConvert.class 1KB
Dissent.class 1KB
Dissent.class 1KB
Post.class 1KB
Post.class 1KB
DissentServiceImpl.class 979B
DissentServiceImpl.class 979B
EmployeeDao.class 841B
EmployeeDao.class 841B
CheckonDao.class 773B
CheckonDao.class 773B
EmployeeService.class 740B
EmployeeService.class 740B
SalaryDao.class 727B
SalaryDao.class 727B
RwandphDao.class 673B
CheckonService.class 673B
RwandphDao.class 673B
CheckonService.class 673B
TrainDao.class 635B
TrainDao.class 635B
SalaryService.class 628B
SalaryService.class 628B
DeptDao.class 587B
DeptDao.class 587B
RwandphService.class 573B
RwandphService.class 573B
ResumeDao.class 565B
ResumeDao.class 565B
TrainService.class 537B
TrainService.class 537B
PostDao.class 534B
PostDao.class 534B
RecruitDao.class 494B
RecruitDao.class 494B
UserDao.class 491B
UserDao.class 491B
DeptSevice.class 488B
共 541 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- Android01112020-07-03开发软件说一下啊,让我用VS开半天
- 依古比古踩小点点2020-03-21说明文档在哪呢,我还是不会运行阿,看到回复下谢谢563491473
- Huicai的博客2021-03-29数据库文件没有,垃圾
- Rosinante.2018-03-29一般一般一般
- m0_689108302022-03-31您好,这个是用什么编译器运行的呢
qq_32616469
- 粉丝: 3
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功