package cn.pluss.platform.vo;


import cn.pluss.platform.entity.MerchantBankCard;
import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantImage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * @author yuchen
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MerchantBaseInfoVO extends MerchantBaseInfo {

    /**
     * 结算人与收银台合照
     */
    private String cashDeskWithPerson;

    /**
     * 结算人手持身份证
     */
    private String handIdCard;

    /**
     * 上级名称
     */
    private String parentContactName;

    /**
     * 上级手机号
     */
    private String parentContactMobile;

    /**
     * 今日交易笔数
     */
    private String dayBillCount;

    /**
     * 今日交易额
     */
    private String dayBillSum;

    /** 上月笔数 */
    private String lastMonthBillCount;

    /** 上月交易额 */
    private String lastMonthBillSum;

    /** 今年笔数 */
    private String yearBillCount;

    /** 今年交易额 */
    private String yearBillSum;

    /** 全部交易笔数 */
    private String allBillCount;

    /** 全部交易额 */
    private String allBillSum;

    private String bankCertName;

    public static MerchantBaseInfoVO convertMerchantBaseInfo(MerchantBaseInfo merchantBaseInfo, MerchantBankCard merchantBankCard, List<MerchantImage> list) {
        MerchantBaseInfoVO vo = new MerchantBaseInfoVO();
        vo.setAddress(merchantBaseInfo.getAddress());
        vo.setMerchantName(merchantBaseInfo.getMerchantName());
        vo.setMerchantType(merchantBaseInfo.getMerchantType());
        vo.setAddressNo(merchantBaseInfo.getAddressNo());
        vo.setAlias(merchantBaseInfo.getAlias());
        vo.setContactMobile(merchantBaseInfo.getContactMobile());
        vo.setContactName(merchantBaseInfo.getContactName());
        vo.setEmail(merchantBaseInfo.getEmail());
        if (null != merchantBankCard) {
            vo.setBankCertName(merchantBankCard.getBankCertName());
        }
        vo.setMcc(merchantBaseInfo.getMcc());
        vo.setProductDesc(merchantBaseInfo.getProductDesc());
        vo.setMccName(merchantBaseInfo.getMccName());
        vo.setAliAccount(merchantBaseInfo.getAliAccount());
        vo.setMerchantAddress(merchantBaseInfo.getProvince() + "," + merchantBaseInfo.getCity() + "," + merchantBaseInfo.getDistrict());
        for (MerchantImage merchantImage : list) {
            if ("06".equals(merchantImage.getPhotoType())) {
                vo.setStoreHeadPic(merchantImage.getPicUrl());
            }
            if ("08".equals(merchantImage.getPhotoType())) {
                vo.setCashPic(merchantImage.getPicUrl());
            }
            if ("09".equals(merchantImage.getPhotoType())) {
                vo.setStoreInsidePic(merchantImage.getPicUrl());
            }
        }
        return vo;
    }
}

