package com.zcloud.basic.info.domain.model;

import cn.hutool.json.JSONObject;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.domain.model.BaseE;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * web-domain
 *
 * @Author SondonYong
 * @Date 2025-12-05 14:00:37
 */
@Data
public class RzUserRecordE extends BaseE {
    //主键
    private Long id;
    //业务主键id
    private String rzUserRecordId;
    //用户id
    private Long userId;
    //姓名
    private String employeeName;
    //性别
    private String employeeGender;
    //年龄
    private String employeeAge;
    //入职时间
    private String entryTime;
    //人员状态
    private String employeeStatus;
    //工作级别
    private String jobLevel;
    private String jobName;
    //部门名称
    private String deptName;
    //部门编码
    private String deptCode;
    private String positionName;
    //手机号
    private String phoneNumber;
    //身份证号
    private String idCardNumber;
    //图片编码
    private String employeeImagesCode;
    //图片base64编码
    private String employeeImages;
    //企业编码
    private String corporationCode;
    //企业名称
    private String corporationName;


    public void initFromRZ(JSONObject json){
        if(StringUtils.isEmpty(json.getStr("phone_number"))){
            throw new BizException("数据错误，手机号不能为空。");
        }
        if(StringUtils.isEmpty(json.getStr("id_card_number"))){
            throw new BizException("数据错误，身份证号不能为空。");
        }

        this.setEmployeeName(json.getStr("employee_name"));
        this.setEmployeeGender(json.getStr("employee_gender"));
        this.setEmployeeAge(json.getStr("employee_age"));
        this.setEntryTime(json.getStr("entry_time"));
        this.setEmployeeStatus(json.getStr("employee_status"));
        this.setJobName(json.getStr("job_name"));
        this.setJobLevel(json.getStr("job_level"));
        this.setDeptName(json.getStr("dept_name"));
        this.setDeptCode(json.getStr("dept_code"));
        this.setPositionName(json.getStr("position_name"));
        this.setPhoneNumber(json.getStr("phone_number"));
        this.setIdCardNumber(json.getStr("id_card_number"));
        this.setEmployeeImagesCode(json.getStr("employee_images_code"));
        this.setCorporationCode(json.getStr("corporation_code"));
        this.setCorporationName(json.getStr("corporation_name"));
    }

}

