CarInOutEntity.java 5.65 KB
package com.bsth.entity.ac;

import com.bsth.data.basic.bus.BusDataBuffer;
import com.bsth.data.basic.person.PersonDataBuffer;
import com.bsth.data.signal.dto.RfidInOutDto;
import com.bsth.entity.Bus;
import com.bsth.entity.Person;
import com.bsth.util.HexCardTransform;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 车辆进出场
 * Created by panzhao on 2017/9/5.
 */
@Entity
@Table(name = "bsth_ac_cljcc_real")
public class CarInOutEntity {

    @Id
    @GeneratedValue
    private Long id;
    /**
     * 公司编码
     */
    private String company;

    /** 分公司编码 */
    private String fgsCompany;

    /** 线路编码 */
    private String lineCode;

    /** 线路名称 */
    private String lineName;

    /** 驾驶员 (工号/姓名) */
    private String jsy;

    /** 人卡号 */
    private String pCard;

    /** 车辆自编号 */
    private String nbbm;

    /** 车牌号 */
    private String plateNo;

    /** 车卡号 */
    private String carCard;

    /** 4:出场  2: 进场 */
    private int type;

    /**
     * 计划时间戳
     */
    private Long pt;

    /**
     * 计划驾驶员工号
     */
    private String pJsy;

    /** 实际出入时间戳 */
    private Long t;

    /**
     * 车辆任务状态
     * 0: 无任务
     * 1: 有任务
     */
    private int taskStatus;

    /** 区域 进出口 */
    private String areaId;

    /**
     * 车辆类型
     * 0:公交车
     * 1:小车
     */
    private int carType;

    /**
     * 是否是临时车
     */
    private boolean tempCar;

    /**
     * 信号状态
     * 0: rfid
     * 1: 牌照识别
     */
    private int signalType;

    private boolean pcMatch;


    public static CarInOutEntity getInstance(RfidInOutDto rfidInOut) {
        CarInOutEntity cio = new CarInOutEntity();
        cio.setType(0);
        cio.setCarType(0);
        cio.setpCard(rfidInOut.getDriverCard());
        cio.setCarCard(rfidInOut.getCarCard());
        cio.setT(rfidInOut.getReportTime());
        cio.setType(rfidInOut.getType());
        cio.setSignalType(0);
        cio.setAreaId(rfidInOut.getAreaId());

        Bus b = BusDataBuffer.findByCard(rfidInOut.getCarCard());
        if(null != b){
            cio.setPlateNo(b.getCarPlate());
            cio.setNbbm(b.getNbbm());
            cio.setCompany(b.getCompanyCode());
            cio.setFgsCompany(b.getBrancheCompanyCode());
            cio.setLineCode(b.getLineCode());
            cio.setLineName(b.getLineName());
        }

        String cardId = HexCardTransform.hexConvert(cio.getpCard());
        Person p = PersonDataBuffer.findByCard(cardId);
        if(null != p){
            cio.setJsy(p.getUserId() + "/" + p.getPersonnelName());
            cio.setCompany(p.getCompanyCode());
            cio.setFgsCompany(p.getBrancheCompanyCode());
        }
        return cio;
    }

    public Long getId() {
        return id;
    }

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

    public String getCompany() {
        return company;
    }

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

    public String getFgsCompany() {
        return fgsCompany;
    }

    public void setFgsCompany(String fgsCompany) {
        this.fgsCompany = fgsCompany;
    }

    public String getLineCode() {
        return lineCode;
    }

    public void setLineCode(String lineCode) {
        this.lineCode = lineCode;
    }

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public String getJsy() {
        return jsy;
    }

    public void setJsy(String jsy) {
        this.jsy = jsy;
    }

    public String getpCard() {
        return pCard;
    }

    public void setpCard(String pCard) {
        this.pCard = pCard;
    }

    public String getNbbm() {
        return nbbm;
    }

    public void setNbbm(String nbbm) {
        this.nbbm = nbbm;
    }

    public String getPlateNo() {
        return plateNo;
    }

    public void setPlateNo(String plateNo) {
        this.plateNo = plateNo;
    }

    public String getCarCard() {
        return carCard;
    }

    public void setCarCard(String carCard) {
        this.carCard = carCard;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Long getPt() {
        return pt;
    }

    public void setPt(Long pt) {
        this.pt = pt;
    }

    public String getpJsy() {
        return pJsy;
    }

    public void setpJsy(String pJsy) {
        this.pJsy = pJsy;
    }

    public Long getT() {
        return t;
    }

    public void setT(Long t) {
        this.t = t;
    }

    public int getTaskStatus() {
        return taskStatus;
    }

    public void setTaskStatus(int taskStatus) {
        this.taskStatus = taskStatus;
    }

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public int getCarType() {
        return carType;
    }

    public void setCarType(int carType) {
        this.carType = carType;
    }

    public boolean isTempCar() {
        return tempCar;
    }

    public void setTempCar(boolean tempCar) {
        this.tempCar = tempCar;
    }

    public int getSignalType() {
        return signalType;
    }

    public void setSignalType(int signalType) {
        this.signalType = signalType;
    }

    public boolean isPcMatch() {
        return pcMatch;
    }

    public void setPcMatch(boolean pcMatch) {
        this.pcMatch = pcMatch;
    }
}