package com.xhpc.order.domain;

import com.xhpc.common.core.web.domain.BaseEntity;
import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author
 * @description 历史订单 xhpc_history_order
 * @date 2021-07-22
 */
@Entity
@Table(name = "xhpc_history_order")
public class XhpcHistoryOrder extends BaseEntity {

    /**
     * 历史订单id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long historyOrderId;

    /**
     * 电站id
     */
    private Long chargingStationId;

    /**
     * 充电订单id
     */
    private Long chargeOrderId;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 终端id
     */
    private Long terminalId;

    /**
     * 流水号
     */
    private String serialNumber;

    /**
     * 互联网订单流水号
     */
    private String internetSerialNumber;

    /**
     * Evcs订单号,供监管平台和第三方使用
     */
    private String evcsOrderNo;

    /**
     * 订单总价
     */
    private BigDecimal totalPrice;

    /**
     * 电站活动抵扣
     */
    private BigDecimal promotionDiscount;

    /**
     * 实际价格
     */
    private BigDecimal actPrice;

    /**
     * 实收电费
     */
    private BigDecimal actPowerPrice;

    /**
     * 实收服务费
     */
    private BigDecimal actServicePrice;

    private BigDecimal actTotalPrice;

    /**
     * 流量方总金额抽成
     */
    private BigDecimal internetCommission;

    /**
     * 流量方服务费抽成
     */
    private BigDecimal internetSvcCommission;
    /**
     * 流量方电量抽成
     */
    private BigDecimal internetDegreeCommission;

    /**
     * 平台总金额抽成
     */
    private BigDecimal platformCommission;

    /**
     * 平台服务费抽成
     */
    private BigDecimal platformSvcCommisssion;

    /**
     * 运维总抽成
     */
    private BigDecimal operationCommission;

    /**
     * 运维服务费抽成
     */
    private BigDecimal operationSvcCommission;

    private BigDecimal clearingPrice;

    /**
     * 开始充电soc
     */
    private String startSoc;

    /**
     * 结束时soc
     */
    private String endSoc;

    private Integer reconciliationStatus;
    /**
     * 对账状态（0待确认 1已确认，2待提交，3待审核）
     */
    private Integer clearingType;

    /**
     * 清分状态（0待清分 1清分在途，2已提现，3待提交，4待审核）
     */
    private Integer sortingStatus;

    /**
     * 1 自动结算 2 平台结算
     */
    private Integer type;

    /**
     * 状态（0正常 1停用）
     */
    private Integer status;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    private Integer delFlag;

    /**
     * 总电费
     */
    private BigDecimal powerPriceTotal;

    /**
     * 总服务费
     */
    private BigDecimal servicePriceTotal;

    /**
     * 活动总电费
     */
    private BigDecimal activityPowerPriceTotal;

    /**
     * 活动总服务费
     */
    private BigDecimal activityServicePriceTotal;

    /**
     * 活动总金额
     */
    private BigDecimal activityTotalPrice;

    /**
     * 0未统计 1已统计
     */
    private Integer state;

    /**
     * VIN 码
     */
    private String vinNormal;

    /**
     * 充电电量
     */
    private Double totalPower;

    private Date startTime;
    /**
     * 结束时间
     */
    private Date endTime;

    /**
     * 0:用户手动停止充电
     * 1:客户归属地运营商平台停止充电
     * 2：BMS 停止充电；
     * 3：充电机设备故障；
     * 4：连接器断开
     * 5-99 自定义
     */
    private String stopReasonEvcs ;

    /**
     * 运营商/场站OperatorID
     */
    private String operatorIdEvcs;

    /**
     * 流量方OperatorID
     */
    private String operatorId3rdptyEvcs;

    /**
     * 终端客户开启充电方式
     * 0：未知
     * 1：市/省级平台无卡启动
     * 2：有卡启动
     * 3：其他无卡启动
     */
    private Integer chargeModelEvcs;

    /**
     * 实际充电的客户在运营商侧的名称,<=20字符
     */
    private String userNameEvcs;

    /**
     * 接口额定功率
     * 单位：kW, 小数点后 1 位
     */
    private Double connectorPowerEvcs;

    /**
     * 电表总起值
     * 单位:度, 小数点后2位
     */
    private Double meterValueStartEvcs;

    /**
     * 电表总结束值
     * 单位:度, 小数点后2位
     */
    private Double meterValueEndEvcs;

    /**
     * 充电用户手机号
     */
    private String phone;


    /**
     * 推送第三方订单返回的确认结果
     */
    private Integer confirmResult;

    /**
     * 费率模型id
     */
    private Long rateModelId;

    /**
     * 充电方式
     */
    private String chargingMode;

    /**
     * 充电方式
     */
    private Integer source;

    /**
     * 活动id
     */
    private String activityId;

    /**
     * 是否发送停车券 1未发送 2已发送
     */
    private Integer parkingVoucher;

    /**
     * 运营商id
     */
    private Long operatorId;

    private String mark;

    private Long motorcadeId;

    public Integer getConfirmResult() {

        return confirmResult;
    }

    public void setConfirmResult(Integer confirmResult) {

        this.confirmResult = confirmResult;
    }

    public Double getMeterValueEndEvcs() {

        return meterValueEndEvcs;
    }

    public void setMeterValueEndEvcs(Double meterValueEndEvcs) {

        this.meterValueEndEvcs = meterValueEndEvcs;
    }

    public String getUserNameEvcs() {

        return userNameEvcs == null ? getPhone() : userNameEvcs;
    }

    public void setUserNameEvcs(String userNameEvcs) {

        this.userNameEvcs = userNameEvcs;
    }

    @Transient
    private List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList;

    public List<XhpcStatisticsTimeInterval> getXhpcStatisticsTimeIntervalList() {

        return xhpcStatisticsTimeIntervalList == null ? new ArrayList<>() : xhpcStatisticsTimeIntervalList;
    }

    public void setXhpcStatisticsTimeIntervalList(List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList) {

        this.xhpcStatisticsTimeIntervalList = xhpcStatisticsTimeIntervalList;
    }

    public Long getHistoryOrderId() {

        return historyOrderId;
    }

    public void setHistoryOrderId(Long historyOrderId) {

        this.historyOrderId = historyOrderId;
    }

    public Long getChargingStationId() {

        return chargingStationId == null ? 0 : chargingStationId;
    }

    public void setChargingStationId(Long chargingStationId) {

        this.chargingStationId = chargingStationId;
    }

    public Long getChargeOrderId() {

        return chargeOrderId;
    }

    public void setChargeOrderId(Long chargeOrderId) {

        this.chargeOrderId = chargeOrderId;
    }

    public Long getUserId() {

        return userId;
    }

    public void setUserId(Long userId) {

        this.userId = userId;
    }

    public Long getTerminalId() {

        return terminalId;
    }

    public void setTerminalId(Long terminalId) {

        this.terminalId = terminalId;
    }

    public String getSerialNumber() {

        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {

        this.serialNumber = serialNumber;
    }

    public String getInternetSerialNumber() {

        return internetSerialNumber;
    }

    public void setInternetSerialNumber(String internetSerialNumber) {

        this.internetSerialNumber = internetSerialNumber;
    }

    public String getEvcsOrderNo() {

        return evcsOrderNo;
    }

    public void setEvcsOrderNo(String evcsOrderNo) {

        this.evcsOrderNo = evcsOrderNo;
    }

    public BigDecimal getTotalPrice() {

        return totalPrice == null ? BigDecimal.ZERO : totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {

        this.totalPrice = totalPrice;
    }

    public BigDecimal getPromotionDiscount() {

        return promotionDiscount;
    }

    public void setPromotionDiscount(BigDecimal promotionDiscount) {

        this.promotionDiscount = promotionDiscount;
    }

    public BigDecimal getActPrice() {

        return actPrice;
    }

    public void setActPrice(BigDecimal actPrice) {

        this.actPrice = actPrice;
    }

    public BigDecimal getActPowerPrice() {

        return actPowerPrice;
    }

    public void setActPowerPrice(BigDecimal actPowerPrice) {

        this.actPowerPrice = actPowerPrice;
    }

    public BigDecimal getActServicePrice() {

        return actServicePrice;
    }

    public void setActServicePrice(BigDecimal actServicePrice) {

        this.actServicePrice = actServicePrice;
    }

    public BigDecimal getInternetCommission() {

        return internetCommission;
    }

    public void setInternetCommission(BigDecimal internetCommission) {

        this.internetCommission = internetCommission;
    }

    public BigDecimal getInternetSvcCommission() {

        return internetSvcCommission;
    }

    public void setInternetSvcCommission(BigDecimal internetSvcCommission) {

        this.internetSvcCommission = internetSvcCommission;
    }

    public BigDecimal getPlatformCommission() {

        return platformCommission;
    }

    public void setPlatformCommission(BigDecimal platformCommission) {

        this.platformCommission = platformCommission;
    }

    public BigDecimal getPlatformSvcCommisssion() {

        return platformSvcCommisssion;
    }

    public void setPlatformSvcCommisssion(BigDecimal platformSvcCommisssion) {

        this.platformSvcCommisssion = platformSvcCommisssion;
    }

    public BigDecimal getOperationCommission() {

        return operationCommission;
    }

    public void setOperationCommission(BigDecimal operationCommission) {

        this.operationCommission = operationCommission;
    }

    public BigDecimal getOperationSvcCommission() {

        return operationSvcCommission;
    }

    public void setOperationSvcCommission(BigDecimal operationSvcCommission) {

        this.operationSvcCommission = operationSvcCommission;
    }

    public String getStartSoc() {

        return startSoc;
    }

    public void setStartSoc(String startSoc) {

        this.startSoc = startSoc;
    }

    public String getEndSoc() {

        return endSoc;
    }

    public void setEndSoc(String endSoc) {

        this.endSoc = endSoc;
    }

    public Integer getReconciliationStatus() {

        return reconciliationStatus;
    }

    public void setReconciliationStatus(Integer reconciliationStatus) {

        this.reconciliationStatus = reconciliationStatus;
    }

    public Integer getSortingStatus() {

        return sortingStatus;
    }

    public void setSortingStatus(Integer sortingStatus) {

        this.sortingStatus = sortingStatus;
    }

    public Integer getType() {

        return type;
    }

    public void setType(Integer type) {

        this.type = type;
    }

    public Integer getStatus() {

        return status;
    }

    public void setStatus(Integer status) {

        this.status = status;
    }

    public Integer getDelFlag() {

        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {

        this.delFlag = delFlag;
    }

    public BigDecimal getPowerPriceTotal() {

        return powerPriceTotal;
    }

    public void setPowerPriceTotal(BigDecimal powerPriceTotal) {

        this.powerPriceTotal = powerPriceTotal;
    }

    public BigDecimal getServicePriceTotal() {

        return servicePriceTotal == null ? BigDecimal.ZERO : servicePriceTotal;
    }

    public void setServicePriceTotal(BigDecimal servicePriceTotal) {

        this.servicePriceTotal = servicePriceTotal;
    }

    public Integer getState() {

        return state;
    }

    public void setState(Integer state) {

        this.state = state;
    }

    public String getVinNormal() {

        return vinNormal;
    }

    public void setVinNormal(String vinNormal) {

        this.vinNormal = vinNormal;
    }

    public Double getTotalPower() {

        return totalPower == null ? 0 : totalPower;
    }

    public void setTotalPower(Double totalPower) {

        this.totalPower = totalPower;
    }

    public Date getStartTime() {

        return startTime == null ? getCreateTime() : startTime;
    }

    public void setStartTime(Date startTime) {

        this.startTime = startTime;
    }

    public String getStopReasonEvcs() {

        return stopReasonEvcs = stopReasonEvcs;
    }

    public void setStopReasonEvcs(String stopReasonEvcs) {

        this.stopReasonEvcs = stopReasonEvcs;
    }

    public String getOperatorIdEvcs() {

        return operatorIdEvcs;
    }

    public void setOperatorIdEvcs(String operatorIdEvcs) {

        this.operatorIdEvcs = operatorIdEvcs;
    }

    public String getOperatorId3rdptyEvcs() {

        return operatorId3rdptyEvcs;
    }

    public void setOperatorId3rdptyEvcs(String operatorId3rdptyEvcs) {

        this.operatorId3rdptyEvcs = operatorId3rdptyEvcs;
    }

    public Integer getChargeModelEvcs() {

        return chargeModelEvcs == null ? 3 : chargeModelEvcs;
    }

    public void setChargeModelEvcs(int chargeModelEvcs) {

        this.chargeModelEvcs = chargeModelEvcs;
    }

    public Double getConnectorPowerEvcs() {

        return connectorPowerEvcs == null ? 0 : connectorPowerEvcs;
    }

    public void setConnectorPowerEvcs(Double connectorPowerEvcs) {

        this.connectorPowerEvcs = connectorPowerEvcs;
    }

    public Double getMeterValueStartEvcs() {

        return meterValueStartEvcs;
    }

    public void setMeterValueStartEvcs(Double meterValueStartEvcs) {

        this.meterValueStartEvcs = meterValueStartEvcs;
    }

    public String getPhone() {

        return phone;
    }

    public void setPhone(String phone) {

        this.phone = phone;
    }

    public Date getEndTime() {

        return endTime;
    }

    public void setEndTime(Date endTime) {

        this.endTime = endTime;
    }

    public Long getRateModelId() {

        return rateModelId;
    }

    public void setRateModelId(Long rateModelId) {

        this.rateModelId = rateModelId;
    }

    public String getChargingMode() {
        return chargingMode;
    }

    public void setChargingMode(String chargingMode) {
        this.chargingMode = chargingMode;
    }

    public BigDecimal getInternetDegreeCommission() {
        return internetDegreeCommission;
    }

    public void setInternetDegreeCommission(BigDecimal internetDegreeCommission) {
        this.internetDegreeCommission = internetDegreeCommission;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public BigDecimal getActivityPowerPriceTotal() {
        return activityPowerPriceTotal;
    }

    public void setActivityPowerPriceTotal(BigDecimal activityPowerPriceTotal) {
        this.activityPowerPriceTotal = activityPowerPriceTotal;
    }

    public BigDecimal getActivityServicePriceTotal() {
        return activityServicePriceTotal;
    }

    public void setActivityServicePriceTotal(BigDecimal activityServicePriceTotal) {
        this.activityServicePriceTotal = activityServicePriceTotal;
    }

    public BigDecimal getActivityTotalPrice() {
        return activityTotalPrice;
    }

    public void setActivityTotalPrice(BigDecimal activityTotalPrice) {
        this.activityTotalPrice = activityTotalPrice;
    }

    public void setChargeModelEvcs(Integer chargeModelEvcs) {
        this.chargeModelEvcs = chargeModelEvcs;
    }

    public String getActivityId() {
        return activityId;
    }

    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }

    public Integer getParkingVoucher() {
        return parkingVoucher;
    }

    public void setParkingVoucher(Integer parkingVoucher) {
        this.parkingVoucher = parkingVoucher;
    }

    public Long getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

    public String getMark() {
        return mark;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    public Long getMotorcadeId() {
        return motorcadeId;
    }

    public void setMotorcadeId(Long motorcadeId) {
        this.motorcadeId = motorcadeId;
    }

    public Integer getClearingType() {
        return clearingType;
    }

    public void setClearingType(Integer clearingType) {
        this.clearingType = clearingType;
    }

    public BigDecimal getClearingPrice() {
        return clearingPrice;
    }

    public void setClearingPrice(BigDecimal clearingPrice) {
        this.clearingPrice = clearingPrice;
    }

    public BigDecimal getActTotalPrice() {
        return actTotalPrice;
    }

    public void setActTotalPrice(BigDecimal actTotalPrice) {
        this.actTotalPrice = actTotalPrice;
    }
}
