package com.casic.PgInterface.patroler.dto;

import com.casic.PgInterface.patroler.domain.PgInPgPerson;
import com.casic.PgInterface.patroler.domain.PgInPgStatus;

import java.text.SimpleDateFormat;

/**
 * Created by yxw on 2018/4/2.
 */
public class PgInPgInfoDto{

    private String userName;//入廊人员
    private String phoneNumber;//联系方式
    private String userCode;//人员编号
    private String personType;//人员类别
    private String isInPg;//是否在廊内
    private String lastInTime;//最后入廊时间
    private String inTime;//入廊时间
    private String outTime;//出廊时间
    private String inPgNum;//入廊次数

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getPersonType() {
        return personType;
    }

    public void setPersonType(String personType) {
        this.personType = personType;
    }

    public String getIsInPg() {
        return isInPg;
    }

    public void setIsInPg(String isInPg) {
        this.isInPg = isInPg;
    }

    public String getLastInTime() {
        return lastInTime;
    }

    public void setLastInTime(String lastInTime) {
        this.lastInTime = lastInTime;
    }

    public String getInPgNum() {
        return inPgNum;
    }

    public void setInPgNum(String inPgNum) {
        this.inPgNum = inPgNum;
    }

    public String getInTime() {
        return inTime;
    }

    public void setInTime(String inTime) {
        this.inTime = inTime;
    }

    public String getOutTime() {
        return outTime;
    }

    public void setOutTime(String outTime) {
        this.outTime = outTime;
    }

    public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        this.setUserName(pgInPgPerson.getUserName());
        this.setUserCode(pgInPgPerson.getUserCode());
        this.setPhoneNumber(pgInPgPerson.getPhoneNumber());
        this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg()));
        this.setPersonType(pgInPgPerson.getPersonType());
        if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null)
            this.setLastInTime(sdf.format(pgInPgStatus.getInTime()));
        else
            this.setLastInTime("");
        this.setInPgNum(String.valueOf(inPgNum));
    }

    public PgInPgInfoDto(PgInPgStatus pgInPgStatus) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        this.setUserName(pgInPgStatus.getPgInPgPersonId().getUserName());
        this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber());
        this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType());
        this.setInTime(sdf.format(pgInPgStatus.getInTime()));
        if (pgInPgStatus.getOutTime() != null)
            this.setOutTime(sdf.format(pgInPgStatus.getOutTime()));
        else
            this.setOutTime("");
    }

    public PgInPgInfoDto()
    {

    }
}
