package cn.momia.service.deal.web.ctrl.dto;

import cn.momia.api.product.sku.Sku;
import cn.momia.service.deal.order.Order;
import cn.momia.api.product.Product;
import cn.momia.service.base.web.ctrl.dto.Dto;

import java.math.BigDecimal;
import java.util.List;

public class OrderDetailDto extends OrderDto implements Dto {
    private Product product;

    public String getCover() {
        return product.getCover();
    }

    public String getTitle() {
        return product.getTitle();
    }

    public String getScheduler() {
        return product.getScheduler();
    }

    // TODO
//    public String getRegion() {
//        return MetaUtil.getRegionName(product.getRegionId());
//    }

    public String getAddress() {
        return product.getAddress();
    }

    public BigDecimal getPrice() {
        return product.getPrice();
    }

    public String getTime() {
        return product.getSkuTime(getSkuId());
    }

    public boolean isClosed() {
        List<Sku> skus = product.getSkus();
        if (skus == null || skus.isEmpty()) return true;
        for (Sku sku : skus) {
            if (sku.getSkuId() == getSkuId()) return sku.isClosed();
        }

        return true;
    }

    public OrderDetailDto(Order order, Product product) {
        super(order);
        this.product = product;
    }
}

package cn.momia.service.deal.web.ctrl.dto;

import cn.momia.api.product.sku.Sku;
import cn.momia.service.deal.order.Order;
import cn.momia.api.product.Product;
import cn.momia.service.base.web.ctrl.dto.Dto;

import java.math.BigDecimal;
import java.util.List;

public class OrderDetailDto extends OrderDto implements Dto {
    private Product product;

    public String getCover() {
        return product.getCover();
    }

    public String getTitle() {
        return product.getTitle();
    }

    public String getScheduler() {
        return product.getScheduler();
    }

    public int getRegionId() {
        return product.getRegionId();
    }

    public String getAddress() {
        return product.getAddress();
    }

    public BigDecimal getPrice() {
        return product.getPrice();
    }

    public String getTime() {
        return product.getSkuTime(getSkuId());
    }

    public boolean isClosed() {
        List<Sku> skus = product.getSkus();
        if (skus == null || skus.isEmpty()) return true;
        for (Sku sku : skus) {
            if (sku.getSkuId() == getSkuId()) return sku.isClosed();
        }

        return true;
    }

    public OrderDetailDto(Order order, Product product) {
        super(order);
        this.product = product;
    }
}

return regionid