package cn.iocoder.yudao.module.order.vo.orderItem;

import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
* 订单项 Response VO
* @author 系统管理员
*/
@Data
@ApiModel("管理后台 - 特价申请-订单项 back vo")
public class OrderItemSpecialBackVO {

    @ExcelProperty("主键ID")
    @ApiModelProperty(value = "主键ID", required = true)
    private Long orderItemId;

    @ExcelProperty("订单ID")
    @ApiModelProperty(value = "订单ID", required = true)
    private Long orderId;

    @ExcelProperty("订单编号")
    @ApiModelProperty(value = "订单编号", required = true)
    private String orderNo;

    @ApiModelProperty(value = "订单类型：1 普货 2 重货 3 泡货")
    private Integer orderItemType;

    @ExcelProperty("运输方式id")
    @ApiModelProperty(value = "运输方式id", required = true)
    private Integer transportId;

    @ExcelProperty("线路ID")
    @ApiModelProperty(value = "线路ID", required = true)
    private Long lineId;

    @ExcelProperty("渠道ID")
    @ApiModelProperty(value = "渠道ID")
    private Long channelId;

    @ExcelProperty("订单项状态详情见字典")
    @ApiModelProperty(value = "订单项状态详情见字典")
    private Integer itemStatus;

    @ExcelProperty("商品ID")
    @ApiModelProperty(value = "商品ID", required = true)
    private Long prodId;

    @ExcelProperty("产品类型")
    @ApiModelProperty(value = "产品类型")
    private Integer prodType;

    @ExcelProperty("产品中文标题")
    @ApiModelProperty(value = "产品中文标题")
    private String prodTitleZh;

    @ExcelProperty("产品英文标题")
    @ApiModelProperty(value = "产品英文标题")
    private String prodTitleEn;

    @ApiModelProperty(value = "商品第三方链接")
    private String link;

    @ExcelProperty("品牌ID")
    @ApiModelProperty(value = "品牌ID", required = true)
    private Long brand;

    @ExcelProperty("0 无牌 1 有牌 2 中性")
    @ApiModelProperty(value = "0 无牌 1 有牌 2 中性", required = true)
    private Integer brandType;

    @ExcelProperty("费用模式")
    @ApiModelProperty(value = "费用模式：无牌价0，有牌价1，中性品牌价2", required = true)
    private String feeType;

    @ApiModelProperty(value = "是否预付：0 到付 1 预付")
    private Integer isPayAdvance;

    @ApiModelProperty(value = "计费方式：0 运费/清关费 1 全包价")
    private Integer charging;

    @ApiModelProperty(value = "数量")
    private Integer quantity;

    @ExcelProperty("件数")
    @ApiModelProperty(value = "件数", required = true)
    private Integer num;

    @ExcelProperty("单位")
    @ApiModelProperty(value = "单位", required = true)
    private String unit;

    @ExcelProperty("箱规")
    @ApiModelProperty(value = "箱规")
    private String boxGauge;

    @ExcelProperty("体积")
    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    @ExcelProperty("重量")
    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ExcelProperty("货值")
    @ApiModelProperty(value = "货值")
    private BigDecimal worth;

    @ExcelProperty("货值金额单位ID")
    @ApiModelProperty(value = "货值金额单位ID")
    private Integer worthCurrency;

    @ExcelProperty("商品特性(可选多个特性ID)")
    @ApiModelProperty(value = "商品特性(可选多个特性ID)")
    private String prodAttrIds;

    @ExcelProperty(value = "入仓数量")
    @ApiModelProperty(value = "入仓数量", required = true)
    private Integer sumQuantity;

    @ExcelProperty("入仓件数")
    @ApiModelProperty(value = "入仓件数", required = true)
    private Integer sumNum;

    @ExcelProperty("入仓体积")
    @ApiModelProperty(value = "入仓体积", required = true)
    private BigDecimal sumVolume;

    @ExcelProperty("入仓重量")
    @ApiModelProperty(value = "入仓重量", required = true)
    private BigDecimal sumWeight;

    @ExcelProperty("重货比")
    @ApiModelProperty(value = "重货比", required = true)
    private BigDecimal weightRatio;

    @ExcelProperty("运费")
    @ApiModelProperty(value = "运费(销售)")
    private BigDecimal seaFreight;

    @ExcelProperty("成本运费")
    @ApiModelProperty(value = "运费(成本)")
    private BigDecimal costSeaFreight;

    @ExcelProperty("原来运费")
    @ApiModelProperty(value = "原来运费(原价)")
    private BigDecimal originalSeaFreight;

    @ExcelProperty("运费货币单位ID")
    @ApiModelProperty(value = "运费货币单位ID")
    private Integer seaFreightCurrency;

    @ExcelProperty("运费体积单位")
    @ApiModelProperty(value = "运费体积单位")
    private Long seaFreightVolume;

    @ExcelProperty("清关费")
    @ApiModelProperty(value = "清关费(销售)")
    private BigDecimal clearanceFreight;

    @ExcelProperty("成本清关费")
    @ApiModelProperty(value = "清关费(成本)")
    private BigDecimal costClearanceFreight;

    @ExcelProperty("原清关费")
    @ApiModelProperty(value = "原清关费(原价)")
    private BigDecimal originalClearanceFreight;

    @ExcelProperty("清关费货币单位ID")
    @ApiModelProperty(value = "清关费货币单位ID")
    private Integer clearanceFreightCurrency;

    @ExcelProperty("清关费体积单位")
    @ApiModelProperty(value = "清关费体积单位")
    private Long clearanceFreightVolume;

    @ExcelProperty("创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @ApiModelProperty(value = "创建时间", required = true)
    private Date createTime;

    @ApiModelProperty(value = "重货体积")
    private String wVolume;

    @ApiModelProperty(value = "泡货重量")
    private String vWeight;

    @ApiModelProperty(value = "重货标准基数")
    private BigDecimal weightUnit;

    @ApiModelProperty(value = "泡货标准基数")
    private BigDecimal volumeUnit;


    /**
     * 入仓信息json
     */
    @ApiModelProperty(value = "入仓信息VO")
    @TableField(exist = false)
    private WarehouseInInfoVO warehouseInInfoVO;
    /**
     * 是否仓库入仓新品
     */
    @ApiModelProperty(value = "是否仓库入仓新品 0 下单货物  1 非下单货物-即新品 ")
    private Boolean isWarehouseInAdd;

    /**
     * 入仓信息json
     */
    @ApiModelProperty(value = "入仓信息json")
    private String warehouseInInfo;
    /**
     * 材质
     */
    @ApiModelProperty(value = "材质")
    private String material;

    @ApiModelProperty(value = "原订单项id")
    private Long orgItemId;

    @ApiModelProperty(value = "'空运加价运费单价'")
    private BigDecimal markupSeaFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "'空运加价清关费单价'")
    private BigDecimal markupClearanceFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "空运清关费来源：1 商品 2 渠道")
    private Integer airClearanceSource;

    @ApiModelProperty(value = "'空运清关费来源数据详情'")
    private String airClearanceInfo;

    @ApiModelProperty(value = "优惠申请状态 0 正常  1 处理中 2 通过  3 不通过 4 取消")
    private Integer discountStatus = 0;
    @ApiModelProperty(value = "优惠申请状态 结果")
    private String discountResult;
    @ApiModelProperty(value = "管理优惠状态 0 正常  1 处理中 2 通过  3 不通过 4 取消")
    private Integer adminStatus = 0;
    @ApiModelProperty(value = "管理申请状态 结果")
    private String adminResult;
    @ApiModelProperty(value = "佣金设置状态 0 正常  1 处理中 2 通过  3 不通过 4 取消")
    private Integer commissionStatus = 0;
    @ApiModelProperty(value = "佣金设置状态 结果")
    private String commissionResult;
    @ApiModelProperty(value = "泡货优惠状态 0 正常  1 处理中 2 通过  3 不通过 4 取消")
    private Integer volumeStatus = 0;
    @ApiModelProperty(value = "泡货优惠状态 结果")
    private String volumeResult;
    @ApiModelProperty(value = "重货优惠状态 0 正常  1 处理中 2 通过  3 不通过 4 取消")
    private Integer weightStatus = 0;
    @ApiModelProperty(value = "重货优惠状态 结果")
    private String weightResult;

    @ApiModelProperty(value = "活动优惠运费金额(原始单价上进行优惠)")
    private BigDecimal discountFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "活动优惠运费总金额")
    private BigDecimal discountFreightTotalPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "活动优惠清关费金额(原始单价上进行优惠)")
    private BigDecimal discountClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "活动优惠清关费总金额")
    private BigDecimal discountClearanceFeeTotalPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "是否已定价")
    private Boolean isPriced = Boolean.FALSE;

    @ApiModelProperty(value = "是否需要单询，0-否，1-是")
    private Integer needOrderInquiry;

    @ApiModelProperty(value = "是否处理过单询异常")
    private Boolean isHandlerOrderInquiryException;

    @ApiModelProperty(value = "是否处理了渠道特性异常")
    private Boolean handlerChannelAttrException;


    public void setWarehouseInInfo(String warehouseInInfo) {
        this.warehouseInInfo = warehouseInInfo;
        this.warehouseInInfoVO = JSONObject.parseObject(warehouseInInfo, WarehouseInInfoVO.class);

    }

    public void setWarehouseInInfoVO(WarehouseInInfoVO warehouseInInfoVO) {
        this.warehouseInInfoVO = warehouseInInfoVO;
        if (Objects.nonNull(warehouseInInfoVO)) {
            this.warehouseInInfo = JSONObject.toJSONString(warehouseInInfoVO);
        }
    }



}
