package com.xueyi.system.staff.domain.dto;

import com.xueyi.common.core.annotation.Excel;
import com.xueyi.common.web.utils.DateUtils;
import com.xueyi.system.api.organize.domain.po.SysDeptPo;
import com.xueyi.system.organize.mapper.SysDeptMapper;
import com.xueyi.system.staff.domain.po.DmEmpAttendancePo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serial;

/**
 * 员工考勤 数据传输对象
 *
 * @author xueyi
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class DmEmpAttendanceDto extends DmEmpAttendancePo {

    @Serial
    private static final long serialVersionUID = 1L;



    @Excel(name = "当日最早打卡记录", sort = 6)
    private String sTime;

    @Excel(name = "当日最晚打卡记录", sort = 7)
    private String eTime;

    @Excel(name = "部门名", sort = 5)
    private String deptName;

    public DmEmpAttendanceDto fixExcel(){
        if (this.checkInTime != null){
            this.sTime = DateUtils.formatDate(this.checkInTime, "HH:mm");
        }

        if (this.checkOutTime != null) {
            this.eTime = DateUtils.formatDate(this.checkOutTime, "HH:mm");
        }


        return this;
    }
}