/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.oa.entity;

import com.jeeplus.common.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.modules.sys.entity.Office;
import com.jeeplus.modules.sys.entity.User;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 考勤表Entity
 * @author 孟祥越
 * @version 2017-05-11
 */
public class OaAttendance extends DataEntity<OaAttendance> {
	
	private static final long serialVersionUID = 1L;
	private Office company;		// 公司
	private Office office;		// 部门
	private OaAttendanceRule rule;		// 考勤规则
	private User user;		// 用户
	private Date signDate;		// 考勤日期
	private Date startTime;		// 签到时间
	private Date endTime;		// 签退时间
	private String morning;     //上班情况
	private String afternoon;   //下班情况
	private String officeId ;   //部门id
	private String remarks;     //备注信息
	private Date fromThisDay;   //日期查询
	private Date toThisDay;    //日期查询
	public OaAttendance() {
		super();
	}

	public OaAttendance(String id){
		super(id);
	}

	@ExcelField(title="公司", fieldType=String.class, value="company.name", align=2, sort=10)
	public Office getCompany() {
		return company;
	}

	public void setCompany(Office company) {
		this.company = company;
	}
	

	public OaAttendanceRule getRule() {
		return rule;
	}
	public void setRule(OaAttendanceRule rule) {
		this.rule = rule;
	}

	@ExcelField(title="考勤规则",fieldType =String.class, align=2, sort=20)
	public String getOaAttendanceRule(){
		return rule.getStartTime()+"--"+rule.getEndTime()+"("+rule.getWorkdays()+")";
	}


	@ExcelField(title="用户", fieldType=User.class, value="user.name", align=2, sort=30)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getStartTime() {
		return startTime;
	}
	@ExcelField(title="上班时间", align=2, sort=40)
	public String getStartTimeStr(){
		return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}


	public Date getEndTime() {
		return endTime;
	}

	@ExcelField(title="下班时间", align=2, sort=50)
	public String getEndTimeStr(){
		return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@ExcelField(title = "考勤日期",align = 2,sort = 35)
	public Date getSignDate() {
		return signDate;
	}

	public void setSignDate(Date signDate) {
		this.signDate = signDate;
	}

	public String getMorning() {
		return morning;
	}

	public void setMorning(String morning) {
		this.morning = morning;
	}

	public String getAfternoon() {
		return afternoon;
	}

	public void setAfternoon(String afternoon) {
		this.afternoon = afternoon;
	}

	public String getOfficeId() {
		return officeId;
	}

	public void setOfficeId(String officeId) {
		this.officeId = officeId;
	}

	@Override
	@ExcelField(title = "备注" ,align = 2,sort = 55)
	public String getRemarks() {
		return remarks;
	}

	@Override
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	@ExcelField(title="部门", fieldType=String.class, value="office.name", align=2, sort=15)
	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;

	}

	public Date getFromThisDay() {
		return fromThisDay;
	}

	public void setFromThisDay(Date fromThisDay) {
		this.fromThisDay = fromThisDay;
	}

	public Date getToThisDay() {
		return toThisDay;
	}

	public void setToThisDay(Date toThisDay) {
		this.toThisDay = toThisDay;
	}
}