package com.dxhy.core.job.utils;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.dxhy.core.job.entity.*;
import com.dxhy.core.job.pojo.InvoiceDetailInfo;
import com.dxhy.core.job.pojo.InvoiceInfo;
import com.dxhy.core.job.pojo.VehicleSaleInvoiceInfos;

/**
 * 功能描述
 *
 * @author 陈刚扬
 * @date 2020/10/28
 */
@SuppressWarnings({"AlibabaUndefineMagicConstant", "AlibabaMethodTooLong", "DuplicatedCode"})
public class TransitionUtils {

    /**
     * 实体转换
     *
     * @param info
     *            发票信息
     * @return 返回
     * @throws ParseException
     *             异常
     */
    public static TDxRecordInvoiceJobEntity getInvoiceInfo(InvoiceInfo info) throws ParseException {
        TDxRecordInvoiceJobEntity invoice = new TDxRecordInvoiceJobEntity();
        // 发票代码
        invoice.setInvoiceCode(info.getInvoiceCode());
        // 发票号码
        invoice.setInvoiceNo(info.getInvoiceNo());
        //发票UUID
        invoice.setUuid(info.getInvoiceCode()+info.getInvoiceNo());
        // 全电发票号码
        if(StringUtils.isNotBlank(info.getElectronicInvoiceNo())){
            invoice.setEleInvoiceNo(info.getElectronicInvoiceNo());
        }
        // 当前税款所属期
        invoice.setDqskssq(info.getCurrentTaxPeriod());
        // 当前税款所属期勾选截止日
        invoice.setGxjzr(info.getLegalizeEndDate());
        // 当前税款所属期可勾选发票开票日期起
        invoice.setGxfwq(info.getLegalizeInvoiceDateBegin());
        // 当前税款所属期可勾选发票开票日期止
        invoice.setGxfwz(info.getLegalizeInvoiceDateEnd());
        // 发票类型
        invoice.setInvoiceType(info.getInvoiceType());
        // 购方名称
        invoice.setGfName(info.getBuyerName());
        // 购方税号
        invoice.setGfTaxNo(info.getBuyerTaxNo());
        // 购方地址、电话
        invoice.setGfAddressAndPhone(info.getBuyerAddressPhone());
        // 购方开户行及账号
        invoice.setGfBankAndNo(info.getBuyerAcount());
        // 销方名称
        invoice.setXfName(info.getSalerName());
        // 销方税号
        invoice.setXfTaxNo(info.getSalerTaxNo());
        // 销方地址、电话
        invoice.setXfAddressAndPhone(info.getSalerAddressPhone());
        // 销方开户行及账号
        invoice.setXfBankAndNo(info.getSalerAcount());
        // 开票日期
        invoice.setInvoiceDate(new SimpleDateFormat("yyyyMMdd").parse(info.getInvoiceDate()));
        // 发票金额
        invoice.setInvoiceAmount(new BigDecimal(info.getInvoiceAmount()));
        // 发票税额
        invoice.setTaxAmount(new BigDecimal(info.getTaxAmount()));
        // 价税合计
        invoice.setTotalAmount(new BigDecimal(info.getTotalAmount()));
        // 备注
        invoice.setRemark(info.getRemark());
        // 发票状态
        invoice.setInvoiceStatus(info.getInvoiceStatus());

        // 是否代办退税
        if (info.getSfdbts() == null || "".equals(info.getSfdbts())) {
            invoice.setSfdbts(null);
        } else {
            invoice.setSfdbts(info.getSfdbts());
        }
        // 认证类型
        if (info.getRzlx() == null || "".equals(info.getRzlx())) {
            invoice.setRzlx(null);
        } else {
            invoice.setRzlx(info.getRzlx());
        }
        // 认证方式
        if (info.getLegalizeType() == null || "".equals(info.getLegalizeType())) {
            invoice.setRzhType("");
        } else {
            invoice.setRzhType(info.getLegalizeType());
        }
        // 校验码
        if (info.getCheckCode() == null || "".equals(info.getCheckCode())) {
            invoice.setCheckCode("");
        } else {
            invoice.setCheckCode(info.getCheckCode());
        }
        // 通行费标志
        if (info.getTxfbz() == null || "".equals(info.getTxfbz())) {
            invoice.setTxfbz("");
        } else {
            invoice.setTxfbz(info.getTxfbz());
        }
        // 零税率标志
        if (info.getLslbz() == null || "".equals(info.getLslbz())) {
            invoice.setLslbz("");
        } else {
            invoice.setLslbz(info.getLslbz());
        }

        invoice.setSfygx(info.getLegalizeState());
        if ("1".equals(info.getLegalizeState()) && !"4".equals(info.getRzlx())) {
            // 认证状态
            invoice.setRzhYesorno(info.getLegalizeState());
            // 认证日期
            if (info.getLegalizeDate() == null || "".equals(info.getLegalizeDate())) {
                invoice.setRzhDate(null);
            } else {
                invoice.setRzhDate(new SimpleDateFormat("yyyyMMdd").parse(info.getLegalizeDate()));
            }
            // 认证归属期
            if (info.getLegalizeBlongDate() == null || "".equals(info.getLegalizeBlongDate())) {
                invoice.setRzhBelongDate(null);
            } else {
                invoice.setRzhBelongDate(info.getLegalizeBlongDate());
            }
            invoice.setAuthStatus("4");
            invoice.setBdkStatus("1");
        } else {

            invoice.setAuthStatus("0");
        }
        if ("1".equals(info.getLegalizeState()) && "4".equals(info.getRzlx())) {
            // 认证状态
            invoice.setRzhYesorno("2");
            // 认证日期
            if (info.getLegalizeDate() == null || "".equals(info.getLegalizeDate())) {
                invoice.setRzhDate(null);
            } else {
                invoice.setRzhDate(new SimpleDateFormat("yyyyMMdd").parse(info.getLegalizeDate()));
            }
            // 认证归属期
            if (info.getLegalizeBlongDate() == null || "".equals(info.getLegalizeBlongDate())) {
                invoice.setRzhBelongDate(null);
            } else {
                invoice.setRzhBelongDate(info.getLegalizeBlongDate());
            }
            invoice.setAuthStatus("4");
            invoice.setBdkStatus("2");
        }
        // 管理状态
        if (info.getGlzt() == null || "".equals(info.getGlzt())) {
            invoice.setGlzt("");
        } else {
            invoice.setGlzt(info.getGlzt());
        }
        // 信息来源
        if (info.getXxly() == null || "".equals(info.getXxly())) {
            invoice.setXxly("");
        } else {
            invoice.setXxly(info.getXxly());
        }
        //抵扣税额
        if (info.getDkse() == null || "".equals(info.getDkse())) {
            invoice.setDkTaxAmount(invoice.getTaxAmount());
        } else {
            invoice.setDkTaxAmount(new BigDecimal(info.getYxse()));
        }
        // 异常类型
        if (info.getYclx() == null || "".equals(info.getYclx())) {
            invoice.setYclx("");
        } else {
            invoice.setYclx(info.getYclx());
        }
        // 逾期可勾选标志
        if (info.getYqkgxbz() == null || "".equals(info.getYqkgxbz())) {
            invoice.setYqkgxbz("");
        } else {
            invoice.setYqkgxbz(info.getYqkgxbz());
        }
        if(StringUtils.isNotBlank(info.getBdkMessage())){
            invoice.setBdkMessage(info.getBdkMessage());
        }
        if(StringUtils.isNotBlank(info.getInvoiceSources())){
            invoice.setInvoiceSource(info.getInvoiceSources());
        }
        invoice.setSourceSystem("0");
        invoice.setValid("1");
        invoice.setTdly("0");
        return invoice;
    }

    /**
     * 实体转换
     *
     * @param detailInfo
     *            明细信息
     * @return 返回
     */
    public static TDxRecordInvoiceDetailJobEntity getInvoiceDetailInfo(InvoiceDetailInfo detailInfo) {
        TDxRecordInvoiceDetailJobEntity detail = new TDxRecordInvoiceDetailJobEntity();
        detail.setDetailNo(detailInfo.getDetailNo());
        detail.setGoodsName(detailInfo.getGoodsName());
        if (isBlank(detailInfo.getSpecificationModel())) {
            detail.setModel(null);
        } else {
            detail.setModel(detailInfo.getSpecificationModel());
        }
        if (isBlank(detailInfo.getGoodsNum())) {
            detail.setGoodsNum(null);
        } else {
            detail.setGoodsNum(detailInfo.getGoodsNum());
        }
        if ("".equals(detailInfo.getNum())) {
            detail.setNum(null);
        } else {
            detail.setNum(detailInfo.getNum());
        }

        if ("".equals(detailInfo.getUnit())) {
            detail.setUnit(null);
        } else {
            detail.setUnit(detailInfo.getUnit());
        }

        if ("".equals(detailInfo.getUnitPrice())) {
            detail.setUnitPrice(null);
        } else {
            detail.setUnitPrice(detailInfo.getUnitPrice());
        }
        if ("".equals(detailInfo.getDetailAmount())) {
            detail.setDetailAmount(null);
        } else {
            detail.setDetailAmount(detailInfo.getDetailAmount());
        }
        if ("".equals(detailInfo.getTaxRate())) {
            detail.setTaxRate(null);
        } else {
            detail.setTaxRate(detailInfo.getTaxRate());
        }
        if ("".equals(detailInfo.getTaxAmount())) {
            detail.setTaxAmount(null);
        } else {
            detail.setTaxAmount(detailInfo.getTaxAmount());
        }
        if ("".equals(detailInfo.getCph())) {
            detail.setCph("");
        } else {
            detail.setCph(detailInfo.getCph());
        }
        if (isBlank(detailInfo.getLx())) {
            detail.setLx("");
        } else {
            detail.setLx(detailInfo.getLx());
        }
        if (isBlank(detailInfo.getTxrqq())) {
            detail.setTxrqq("");
        } else {
            detail.setTxrqq(detailInfo.getTxrqq());
        }
        if (isBlank(detailInfo.getTxrqz())) {
            detail.setTxrqz("");
        } else {
            detail.setTxrqz(detailInfo.getTxrqz());
        }
        return detail;
    }

    private static Boolean isBlank(String str) {
        return str == null || str.trim().length() == 0;

    }

    /**
     * 实体类转换
     *
     * @author X Yang
     * @date 2017年6月8日 下午6:41:27
     */
    public static State getStateInfo(StateInfo info) throws ParseException {
        State state = new State();
        state.setInvoiceCode(info.getInvoiceCode());
        state.setInvoiceNo(info.getInvoiceNo());
        state.setInvoiceStatus(info.getInvoiceStatus());
        if ("".equals(info.getLegalizeDate())) {
            state.setLegalizeDate(null);
        } else {
            state.setLegalizeDate(new SimpleDateFormat("yyyyMMdd").parse(info.getLegalizeDate()));
        }

        state.setLegalizeState(info.getLegalizeState());
        if ("1".equals(info.getLegalizeState())) {
            state.setAuthStatus("4");
        } else {
            state.setAuthStatus("0");
        }
        if ("".equals(info.getLegalizeBelongDate())) {
            state.setLegalizeBelongDate(null);
        } else {
            state.setLegalizeBelongDate(info.getLegalizeBelongDate());
        }
        if ("".equals(info.getLegalizeType())) {
            state.setLegalizeType(null);
        } else {
            state.setLegalizeType(info.getLegalizeType());
        }
        if (info.getRzlx() == null) {
            state.setLegalizeLx(null);
        } else {
            state.setLegalizeLx(Integer.parseInt(info.getRzlx()));
        }
        if (StringUtils.isNotBlank(info.getZztime())) {
            state.setZttime(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(info.getZztime()));
        }
        if (StringUtils.isNotBlank(info.getYqkgxbz())) {
            state.setYqkgxbz(info.getYqkgxbz());
        }
//        if (StringUtils.isNotBlank(info.getYxse())) {
//            state.setYxse(info.getYxse());
//        }
        if(StringUtils.isNotBlank(info.getDkse())){
            state.setYxse(info.getDkse());
        }
        if (StringUtils.isNotBlank(info.getGlzt())) {
            state.setGlzt(info.getGlzt());
        }
        if (StringUtils.isNotBlank(info.getXxly())) {
            state.setXxly(info.getXxly());
        }
        return state;
    }

    public static Map<String, Object> getVehicleInfo(VehicleSaleInvoiceInfos info) throws ParseException {

        TDxVehicleSaleInvoice vehicleSaleInvoice = new TDxVehicleSaleInvoice();
        TDxRecordInvoiceJobEntity veinfo = new TDxRecordInvoiceJobEntity();
        veinfo.setInvoiceCode(info.getInvoiceCode());
        veinfo.setInvoiceNo(info.getInvoiceNo());
        veinfo.setDqskssq(info.getCurrentTaxPeriod());
        veinfo.setGxjzr(info.getLegalizeEndDate());
        veinfo.setGxfwq(info.getLegalizeInvoiceDateBegin());
        veinfo.setGxfwz(info.getLegalizeInvoiceDateEnd());
        veinfo.setInvoiceType(info.getInvoiceType());
        veinfo.setGfName(info.getBuyerName());
        veinfo.setInvoiceDate(new SimpleDateFormat("yyyyMMdd").parse(info.getInvoiceDate()));
        if (isBlank(info.getBuyerIdNum())) {
            vehicleSaleInvoice.setBuyerIdNum("");
        } else {
            vehicleSaleInvoice.setBuyerIdNum(info.getBuyerIdNum());
        }
        veinfo.setGfTaxNo(info.getBuyerTaxNo());
        if (isBlank(info.getVehicleType())) {
            vehicleSaleInvoice.setVehicleType("");
        } else {
            vehicleSaleInvoice.setVehicleType(info.getVehicleType());
        }
        if (isBlank(info.getFactoryModel())) {
            vehicleSaleInvoice.setFactoryModel("");
        } else {
            vehicleSaleInvoice.setFactoryModel(info.getFactoryModel());
        }
        if (isBlank(info.getProductPlace())) {
            vehicleSaleInvoice.setProductPlace("");
        } else {
            vehicleSaleInvoice.setProductPlace(info.getProductPlace());
        }
        if (isBlank(info.getCertificate())) {
            vehicleSaleInvoice.setCertificate("");
        } else {
            vehicleSaleInvoice.setCertificate(info.getCertificate());
        }
        if (isBlank(info.getCertificateImprot())) {
            vehicleSaleInvoice.setCertificateImport("");
        } else {
            vehicleSaleInvoice.setCertificateImport(info.getCertificateImprot());
        }
        if (isBlank(info.getInspectionNum())) {
            vehicleSaleInvoice.setInspectionNum("");
        } else {
            vehicleSaleInvoice.setInspectionNum(info.getInspectionNum());
        }
        if (isBlank(info.getEngineNo())) {
            vehicleSaleInvoice.setEngineNo("");
        } else {
            vehicleSaleInvoice.setEngineNo(info.getEngineNo());
        }
        if (isBlank(info.getVehicleNo())) {
            vehicleSaleInvoice.setVehicleNo("");
        } else {
            vehicleSaleInvoice.setVehicleNo(info.getVehicleNo());
        }
        veinfo.setTotalAmount(new BigDecimal(info.getTotalAmount()));
        veinfo.setXfName(info.getSalerName());
        veinfo.setXfTaxNo(info.getTaxNum());
        if (isBlank(info.getPhone())) {
            vehicleSaleInvoice.setPhone("");
        } else {
            vehicleSaleInvoice.setPhone(info.getPhone());
        }
        if (isBlank(info.getBuyerBank())) {
            vehicleSaleInvoice.setBuyerBank("");
        } else {
            vehicleSaleInvoice.setBuyerBank(info.getBuyerBank());
        }
        if (isBlank(info.getBuyerAcount())) {
            veinfo.setXfBankAndNo("");
        } else {
            veinfo.setXfBankAndNo(info.getBuyerAcount());
        }
        if (isBlank(info.getBuyerAddressPhone())) {
            veinfo.setXfAddressAndPhone("");
        } else {
            veinfo.setXfAddressAndPhone(info.getBuyerAddressPhone());
        }
        vehicleSaleInvoice.setTaxRate(info.getTaxRate());
        veinfo.setTaxAmount(new BigDecimal(info.getTaxAmount()));
        if (isBlank(info.getTaxBureauCode())) {
            vehicleSaleInvoice.setTaxBureauCode("");
        } else {
            vehicleSaleInvoice.setTaxBureauCode(info.getTaxBureauCode());
        }
        if (isBlank(info.getTaxBureauName())) {
            vehicleSaleInvoice.setTaxBureauName("");
        } else {
            vehicleSaleInvoice.setTaxBureauName(info.getTaxBureauName());
        }
        veinfo.setInvoiceAmount(new BigDecimal(info.getInvoiceAmount()));
        if (isBlank(info.getTaxRecords())) {
            vehicleSaleInvoice.setTaxRecords("");
        } else {
            vehicleSaleInvoice.setTaxRecords(info.getTaxRecords());
        }
        if (isBlank(info.getTonnage())) {
            vehicleSaleInvoice.setTonnage("");
        } else {
            vehicleSaleInvoice.setTonnage(info.getTonnage());
        }
        if (isBlank(info.getLimitPeople())) {
            vehicleSaleInvoice.setLimitPeople("");
        } else {
            vehicleSaleInvoice.setLimitPeople(info.getLimitPeople());
        }
        veinfo.setInvoiceStatus(info.getInvoiceStatus());
        veinfo.setRzhYesorno("0");
        if ("1".equals(info.getLegalizeState()) && !"4".equals(info.getRzlx())) {
            veinfo.setAuthStatus("4");
            veinfo.setSfygx(info.getCheckStatus());
            veinfo.setRzhYesorno(info.getLegalizeState());
            if ("".equals(info.getTaxPeriod())) {
                veinfo.setRzhBelongDate(null);
            } else {
                veinfo.setRzhBelongDate(info.getTaxPeriod());
            }
            if ("".equals(info.getLegalizeDate())) {
                veinfo.setRzhDate(null);
            } else {
                veinfo.setRzhDate(new SimpleDateFormat("yyyyMMdd").parse(info.getLegalizeDate()));
            }
            veinfo.setBdkStatus("1");
        } else {

            veinfo.setAuthStatus("0");
        }
        if ("1".equals(info.getLegalizeState()) && "4".equals(info.getRzlx())) {
            veinfo.setAuthStatus("4");
            veinfo.setSfygx(info.getCheckStatus());
            veinfo.setRzhYesorno("2");
            if ("".equals(info.getTaxPeriod())) {
                veinfo.setRzhBelongDate(null);
            } else {
                veinfo.setRzhBelongDate(info.getTaxPeriod());
            }
            if ("".equals(info.getLegalizeDate())) {
                veinfo.setRzhDate(null);
            } else {
                veinfo.setRzhDate(new SimpleDateFormat("yyyyMMdd").parse(info.getLegalizeDate()));
            }
            veinfo.setBdkStatus("2");
        }

        if ("".equals(info.getLegalizeType())) {
            veinfo.setRzhType(null);
        } else {
            veinfo.setRzhType(info.getLegalizeType());
        }
        if (info.getSfdbts() == null) {
            veinfo.setSfdbts("");
        } else {
            veinfo.setSfdbts(info.getSfdbts());
        }
        if (info.getRzlx() == null) {
            veinfo.setRzlx("");
        } else {
            veinfo.setRzlx(info.getRzlx());
        }
        if ("".equals(info.getYxse()) || info.getYxse() == null) {
            veinfo.setDkTaxAmount(new BigDecimal(info.getTaxAmount()));
        } else {
            veinfo.setDkTaxAmount(new BigDecimal(info.getYxse()));
        }
        if ("".equals(info.getXxly())) {
            veinfo.setXxly(null);
        } else {
            veinfo.setXxly(info.getXxly());
        }
        if ("".equals(info.getGlzt())) {
            veinfo.setGlzt(null);
        } else {
            veinfo.setGlzt(info.getGlzt());
        }
        if ("".equals(info.getYqkgxbz())) {
            veinfo.setYqkgxbz(null);
        } else {
            veinfo.setYqkgxbz(info.getYqkgxbz());
        }
        veinfo.setSourceSystem("0");
        Map<String, Object> map = new HashMap<>(2);
        map.put("vehicleSaleInvoice", vehicleSaleInvoice);
        map.put("veinfo", veinfo);
        return map;
    }

    public static InvoiceCheckVehicleDetailModel getVehicleDetaiModel(TDxVehicleSaleInvoice tDxVehicleSaleInvoice) {
        // Auto-generated method stub
        InvoiceCheckVehicleDetailModel model = new InvoiceCheckVehicleDetailModel();
        model.setBuyerBank(tDxVehicleSaleInvoice.getBuyerBank());
        model.setBuyerIdNum(tDxVehicleSaleInvoice.getBuyerIdNum());
        model.setCertificate(tDxVehicleSaleInvoice.getCertificate());
        model.setCertificateImport(tDxVehicleSaleInvoice.getCertificateImport());
        model.setCheckStatus(tDxVehicleSaleInvoice.getCheckStatus());
        model.setEngineNo(tDxVehicleSaleInvoice.getEngineNo());
        model.setFactoryModel(tDxVehicleSaleInvoice.getFactoryModel());
        model.setInspectionNum(tDxVehicleSaleInvoice.getInspectionNum());
        model.setLimitPeople(tDxVehicleSaleInvoice.getLimitPeople());
        model.setPhone(tDxVehicleSaleInvoice.getPhone());
        model.setProductPlace(tDxVehicleSaleInvoice.getProductPlace());
        model.setTaxBureauCode(tDxVehicleSaleInvoice.getTaxBureauCode());
        model.setTaxBureauName(tDxVehicleSaleInvoice.getTaxBureauName());
        model.setTaxRate(tDxVehicleSaleInvoice.getTaxRate());
        model.setTaxRecords(tDxVehicleSaleInvoice.getTaxRecords());
        model.setTonnage(tDxVehicleSaleInvoice.getTonnage());
        model.setUuid(tDxVehicleSaleInvoice.getUuid());
        model.setVehicleNo(tDxVehicleSaleInvoice.getVehicleNo());
        model.setVehicleType(tDxVehicleSaleInvoice.getVehicleType());
        model.setCreateDate(new Date());
        model.setPlateNo(tDxVehicleSaleInvoice.getPlateNo());
        model.setRegistrationNo(tDxVehicleSaleInvoice.getRegistrationNo());
        model.setVehicleAdminOffice(tDxVehicleSaleInvoice.getVehicleAdminOffice());
        model.setAuctionUnit(tDxVehicleSaleInvoice.getAuctionUnit());
        model.setAuctionAddress(tDxVehicleSaleInvoice.getAuctionAddress());
        model.setAuctionTaxNo(tDxVehicleSaleInvoice.getAuctionTaxNo());
        model.setAuctionBank(tDxVehicleSaleInvoice.getAuctionBank());
        model.setAuctionPhone(tDxVehicleSaleInvoice.getAuctionPhone());
        model.setCarMarket(tDxVehicleSaleInvoice.getCarMarket());
        model.setCarMarketTaxNo(tDxVehicleSaleInvoice.getCarMarketTaxNo());
        model.setCarMarketAddress(tDxVehicleSaleInvoice.getCarMarketAddress());
        model.setCarMarketBank(tDxVehicleSaleInvoice.getCarMarketBank());
        model.setCarMarketPhone(tDxVehicleSaleInvoice.getCarMarketPhone());
        return model;
    }

    public static InvoiceCheckVehicleDetailSalesModel
        getVehicleDetaiSalesModel(TDxVehicleSaleInvoice tDxVehicleSaleInvoice) {
        // Auto-generated method stub
        InvoiceCheckVehicleDetailSalesModel model = new InvoiceCheckVehicleDetailSalesModel();
        model.setBuyerBank(tDxVehicleSaleInvoice.getBuyerBank());
        model.setBuyerIdNum(tDxVehicleSaleInvoice.getBuyerIdNum());
        model.setCertificate(tDxVehicleSaleInvoice.getCertificate());
        model.setCertificateImport(tDxVehicleSaleInvoice.getCertificateImport());
        model.setCheckStatus(tDxVehicleSaleInvoice.getCheckStatus());
        model.setEngineNo(tDxVehicleSaleInvoice.getEngineNo());
        model.setFactoryModel(tDxVehicleSaleInvoice.getFactoryModel());
        model.setInspectionNum(tDxVehicleSaleInvoice.getInspectionNum());
        model.setLimitPeople(tDxVehicleSaleInvoice.getLimitPeople());
        model.setPhone(tDxVehicleSaleInvoice.getPhone());
        model.setProductPlace(tDxVehicleSaleInvoice.getProductPlace());
        model.setTaxBureauCode(tDxVehicleSaleInvoice.getTaxBureauCode());
        model.setTaxBureauName(tDxVehicleSaleInvoice.getTaxBureauName());
        model.setTaxRate(tDxVehicleSaleInvoice.getTaxRate());
        model.setTaxRecords(tDxVehicleSaleInvoice.getTaxRecords());
        model.setTonnage(tDxVehicleSaleInvoice.getTonnage());
        model.setUuid(tDxVehicleSaleInvoice.getUuid());
        model.setVehicleNo(tDxVehicleSaleInvoice.getVehicleNo());
        model.setVehicleType(tDxVehicleSaleInvoice.getVehicleType());
        model.setCreateDate(new Date());
        model.setPlateNo(tDxVehicleSaleInvoice.getPlateNo());
        model.setRegistrationNo(tDxVehicleSaleInvoice.getRegistrationNo());
        model.setVehicleAdminOffice(tDxVehicleSaleInvoice.getVehicleAdminOffice());
        model.setAuctionUnit(tDxVehicleSaleInvoice.getAuctionUnit());
        model.setAuctionAddress(tDxVehicleSaleInvoice.getAuctionAddress());
        model.setAuctionTaxNo(tDxVehicleSaleInvoice.getAuctionTaxNo());
        model.setAuctionBank(tDxVehicleSaleInvoice.getAuctionBank());
        model.setAuctionPhone(tDxVehicleSaleInvoice.getAuctionPhone());
        model.setCarMarket(tDxVehicleSaleInvoice.getCarMarket());
        model.setCarMarketTaxNo(tDxVehicleSaleInvoice.getCarMarketTaxNo());
        model.setCarMarketAddress(tDxVehicleSaleInvoice.getCarMarketAddress());
        model.setCarMarketBank(tDxVehicleSaleInvoice.getCarMarketBank());
        model.setCarMarketPhone(tDxVehicleSaleInvoice.getCarMarketPhone());
        model.setGfPhone(tDxVehicleSaleInvoice.getGfPhone());
        return model;
    }

}
