package com.zfire.mall.manager.bean.trade;

import com.zfire.mall.manager.enums.TradeLoginOrderTypeEnum;
import com.zfire.mall.manager.plus.entity.TradeLoginOrder;
import com.zfire.mall.manager.plus.entity.TradeLoginOrderFile;
import com.zfire.mall.manager.plus.entity.TradeLoginOrderItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

@Data
@Accessors(chain = true)
@ApiModel
public class TradeLoginOrderBean extends TradeLoginOrder {

    @ApiModelProperty(value = "明细")
    private List<TradeLoginOrderItem> items;

    @ApiModelProperty(value = "审核附件")
    private List<TradeLoginOrderFile> files;

    @ApiModelProperty(value = "新旧数据结果（前端忽略）")
    private String oldNewContent;

    public void editParamsSetter(TradeLoginOrder order) {
        if (order.getIsSpan()) {
            order.setOrderType(this.getOrderType());
        }
        order.setProjectArea(this.getProjectArea());
        order.setProjectNo(this.getProjectNo());
        order.setServiceId(this.getServiceId());
        order.setServiceNumber(this.getServiceNumber());
        order.setServiceName(this.getServiceName());
        order.setPartyAId(this.getPartyAId());
        order.setPartyA(this.getPartyA());
        order.setCustomerId(this.getCustomerId());
        order.setCustomerNumber(this.getCustomerNumber());
        order.setCustomerName(this.getCustomerName());
        order.setCustomerLinkName(this.getCustomerLinkName());
        order.setCustomerLinkMobile(this.getCustomerLinkMobile());
        order.setCustomerAddress(this.getCustomerAddress());
        order.setFollowCustomer(this.getFollowCustomer());
        order.setFollowCustomerMobile(this.getFollowCustomerMobile());
        order.setProjectName(this.getProjectName());
        if (order.getOrderType().equals(TradeLoginOrderTypeEnum.HOME.getKey())) {
            order.setHomeProjectNameRadio(this.getHomeProjectNameRadio());
            order.setHomeProjectNameArea(this.getHomeProjectNameArea());
            order.setHomeProjectNameSeat(this.getHomeProjectNameSeat());
            order.setHomeProjectNameNumber(this.getHomeProjectNameNumber());
        }
        order.setEnginLinkName(this.getEnginLinkName());
        order.setEnginLinkMobile(this.getEnginLinkMobile());
        order.setProvinceId(this.getProvinceId());
        order.setCityId(this.getCityId());
        order.setAreaId(this.getAreaId());
        order.setStreetId(this.getStreetId());
        order.setAddress(this.getAddress());
        order.setJoinAddress(this.getJoinAddress());
        order.setPositionAddress(this.getPositionAddress());
        order.setLat(this.getLat());
        order.setLnt(this.getLnt());
        order.setProjectCategory(this.getProjectCategory());
        order.setDrawUpload(this.getDrawUpload());
        order.setType(this.getType());
        order.setExtent(this.getExtent());
        order.setUseExtent(this.getUseExtent());
        order.setTradeParentId(this.getTradeParentId());
        order.setTradeParentName(this.getTradeParentName());
        order.setTradeId(this.getTradeId());
        order.setTradeName(this.getTradeName());
        order.setMachineType(this.getMachineType());
        order.setSuccessRate(this.getSuccessRate());
        order.setPreSignDate(this.getPreSignDate());
        order.setPreDeviceAmount(this.getPreDeviceAmount());
        order.setStatus(this.getStatus());
        order.setRemark(this.getRemark());
        order.setOtherInfo(this.getOtherInfo());
        order.setOrderUpdateTime(this.getOrderUpdateTime());
    }
}
