package com.yanzhu.jh.project.domain;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 劳务实名制管理对象 sur_project_attendance_data
 * 
 * @author ruoyi
 * @date 2023-09-24
 */
public class SurProjectAttendanceData extends BaseEntity
{
    public SurProjectAttendanceData(){
        this.year= DateTime.now().year();
    }
    private static final long serialVersionUID = 1L;

    private int year;

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getWorkerName() {
        return workerName;
    }

    public void setWorkerName(String workerName) {
        this.workerName = workerName;
    }

    public String getWorkerPhoto() {
        return workerPhoto;
    }

    public void setWorkerPhoto(String workerPhoto) {
        this.workerPhoto = workerPhoto;
    }

    public Long getWorkerGender() {
        return workerGender;
    }

    public void setWorkerGender(Long workerGender) {
        this.workerGender = workerGender;
    }

    public Long getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Long birthDate) {
        this.birthDate = birthDate;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getWorkTypeName() {
        return workTypeName;
    }

    public void setWorkTypeName(String workTypeName) {
        this.workTypeName = workTypeName;
    }

    public String getEthnic() {
        return ethnic;
    }

    public void setEthnic(String ethnic) {
        this.ethnic = ethnic;
    }

    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getSpecWorkType() {
        return specWorkType;
    }

    public void setSpecWorkType(Integer specWorkType) {
        this.specWorkType = specWorkType;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getAttendanceOutTime() {
        return attendanceOutTime;
    }

    public void setAttendanceOutTime(String attendanceOutTime) {
        this.attendanceOutTime = attendanceOutTime;
    }

    @Excel(name = "项目ID")
    private Long projectId;
    @Excel(name = "项目名称")
    private String projectName;
    @Excel(name = "部门ID")
    private Long deptId;
    @Excel(name = "部门名称")
    private String deptName;
    @Excel(name = "姓名")
    private String workerName;
    @Excel(name = "照片")
    private String workerPhoto;
    @Excel(name = "性别0:男 1:女")
    private Long workerGender;
    @Excel(name = "出生日期时间戳")
    private Long birthDate;
    @Excel(name = "所属班组")
    private String groupName;
    @Excel(name = "工种")
    private String workTypeName;
    @Excel(name = "民族")
    private String ethnic;
    @Excel(name = "籍贯")
    private String nativePlace;

    @Excel(name = "联系电话")
    private String phone;
    @Excel(name = "是否特殊工种")
    private Integer specWorkType;
    @Excel(name = "分包商类型")
    private String companyTypeId;
    @Excel(name = "分包商名称")
    private String companyName;
    @Excel(name = "考勤时间(离开)yyyy-MM-dd HH:mm:ss")
    private String attendanceOutTime;
    /**  */
    private Long id;

    /** 配置项ID,可以获取项目ID和总包ID */
    @Excel(name = "配置项ID,可以获取项目ID和总包ID")
    private Long cfgid;

    /** 注册应用ID */
    @Excel(name = "注册应用ID")
    private String appId;

    /** 厂商编号参考字典attendance_vendors */
    @Excel(name = "厂商编号参考字典attendance_vendors")
    private String vendorsCode;

    /** 服务端ID */
    @Excel(name = "服务端ID")
    private String serverid;

    /** 工人Id */
    @Excel(name = "工人Id")
    private String workerId;


    /** 考勤时间yyyy-MM-dd HH:mm:ss */
    @Excel(name = "考勤时间yyyy-MM-dd HH:mm:ss")
    private String attendanceTime;

    /** 身份证号 */
    @Excel(name = "身份证号")
    private String identification;

    /** 队伍id */
    @Excel(name = "队伍id")
    private Long teamId;

    /** 工种编码 */
    @Excel(name = "工种编码")
    private String workTypeCode;

    /** 分包商id */
    @Excel(name = "分包商id")
    private String companyId;

    /** 平台对应分包商ID */
    @Excel(name = "平台对应分包商ID")
    private Long vendorId;


    /** 设备编号 */
    @Excel(name = "设备编号")
    private String deviceCode;


    /** 照片 */
    @Excel(name = "照片")
    private String scanPhoto;


    /**  */
    @Excel(name = "数据是否有效")
    private Long isDel;


    private Long subDeptId;

    public static SurProjectAttendanceData createFromHuazhu(JSONObject j) {
        SurProjectAttendanceData d=new SurProjectAttendanceData();
        d.vendorsCode="huazhu";
        d.serverid=j.getString("id");
        d.workerId=j.getString("labourWorkerId");
        long recordTime=j.getLongValue("recordTime",0);
        if(recordTime>0){
            d.attendanceTime= DateUtil.format(DateUtil.date(recordTime),"yyyy-MM-dd HH:mm:ss");
        }
        d.identification=j.getString("idCardNo");
        d.teamId=j.getLongValue("teamId",0);
        d.workTypeCode=j.getString("workerTypeId");
        d.companyId=j.getString("unitId");
        d.deviceCode=j.getString("deviceNo");
        return  d;
    }

    public static SurProjectAttendanceData createFromJgw(JSONObject j) {
        SurProjectAttendanceData d=new SurProjectAttendanceData();
        d.vendorsCode="jgw";
        d.serverid=j.getString("id");
        d.workerId=j.getString("workerId");
        d.attendanceTime = j.getString("checkinTime");
        d.identification="";
        d.teamId=0l;
        d.workTypeCode="";
        d.companyId=j.getString("subcontractorId");
        d.deviceCode=j.getString("deviceSerialNo");
        d.isDel=0l;
        return  d;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }


    public Long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

    public Long getSubDeptId() {
        return subDeptId;
    }

    public void setSubDeptId(Long subDeptId) {
        this.subDeptId = subDeptId;
    }

    public String getCompanyTypeId() {
        return companyTypeId;
    }

    public void setCompanyTypeId(String companyTypeId) {
        this.companyTypeId = companyTypeId;
    }

    public static SurProjectAttendanceData create(JSONObject json) {
        SurProjectAttendanceData d=new SurProjectAttendanceData();
        d.attendanceTime=json.getString("time");
        d.serverid=json.getString("id");
        d.workerId=json.getString("workerId");
        d.identification=json.getString("identification");
        d.teamId=json.getLong("teamId");
        d.workTypeCode=json.getString("workerTypeId");
        d.companyId=json.getString("companyId");
        d.vendorId=json.getLong("vendorId");
        d.deviceCode=json.getString("deviceCode");
        d.scanPhoto=json.getString("scanPhoto");
        d.isDel=0l;
        return  d;
    }

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setCfgid(Long cfgid) 
    {
        this.cfgid = cfgid;
    }

    public Long getCfgid() 
    {
        return cfgid;
    }
    public void setVendorsCode(String vendorsCode) 
    {
        this.vendorsCode = vendorsCode;
    }

    public String getVendorsCode() 
    {
        return vendorsCode;
    }
    public void setServerid(String serverid)
    {
        this.serverid = serverid;
    }

    public String getServerid()
    {
        return serverid;
    }
    public void setWorkerId(String workerId)
    {
        this.workerId = workerId;
    }

    public String getWorkerId()
    {
        return workerId;
    }

    public void setAttendanceTime(String attendanceTime) 
    {
        this.attendanceTime = attendanceTime;
    }

    public String getAttendanceTime() 
    {
        return attendanceTime;
    }
    public void setIdentification(String identification) 
    {
        this.identification = identification;
    }

    public String getIdentification() 
    {
        return identification;
    }
    public void setTeamId(Long teamId) 
    {
        this.teamId = teamId;
    }

    public Long getTeamId() 
    {
        return teamId;
    }
    public void setWorkTypeCode(String workTypeCode) 
    {
        this.workTypeCode = workTypeCode;
    }

    public String getWorkTypeCode() 
    {
        return workTypeCode;
    }
    public void setCompanyId(String companyId)
    {
        this.companyId = companyId;
    }

    public String getCompanyId()
    {
        return companyId;
    }
    public void setVendorId(Long vendorId) 
    {
        this.vendorId = vendorId;
    }

    public Long getVendorId() 
    {
        return vendorId;
    }

    public void setDeviceCode(String deviceCode) 
    {
        this.deviceCode = deviceCode;
    }

    public String getDeviceCode() 
    {
        return deviceCode;
    }


    public void setScanPhoto(String scanPhoto) 
    {
        this.scanPhoto = scanPhoto;
    }

    public String getScanPhoto() 
    {
        return scanPhoto;
    }

    public void setIsDel(Long isDel) 
    {
        this.isDel = isDel;
    }

    public Long getIsDel() 
    {
        return isDel;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("cfgid", getCfgid())
            .append("vendorsCode", getVendorsCode())
            .append("serverid", getServerid())
            .append("workerId", getWorkerId())
            .append("attendanceTime", getAttendanceTime())
            .append("identification", getIdentification())
            .append("teamId", getTeamId())
            .append("workTypeCode", getWorkTypeCode())
            .append("companyId", getCompanyId())
            .append("vendorId", getVendorId())
            .append("deviceCode", getDeviceCode())
            .append("scanPhoto", getScanPhoto())
            .append("remark", getRemark())
            .append("isDel", getIsDel())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
