package cn.iocoder.yudao.module.order.dto;

import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import cn.iocoder.yudao.module.product.vo.coupon.CouponInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
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.List;

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

/**
 * 运费和清关费
 * 是否重泡货：海运是否重货、空运是否泡货
 * 1.应收数据：显示品名初始未优惠前的数据，如全局重、泡货标准对应的数据
 * 2.实收数据：实际成交收费数据
 * 3.应收单价：原价
 * 4.优惠单价价额：成交单价-原价
 * 5.成交单价：销售价
 * 6.应收运&清关费：原价*收费数据
 * 7.优惠运费&清关费：（销售价-原价）*收费数据
 * 8.收款单优惠金额：品名对应应收明细在收款单中优惠金额累加
 * 9.总优惠金额：品名对应应收明细优惠金额+优惠单价*收费数据
 * 10.实收运费&清关费：成交单价*收费数据
 * 11.合计金额：所有品名的实收数据累加
 */
@Data
@ApiModel("订单项费用汇总")
public class OrderItemCostDto {

    @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;

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

    @ApiModelProperty(value = "订单项属性：1 普货 2 重货 3 泡货")
    private Integer itemType;

    @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;

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

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

    @ExcelProperty("品牌名称")
    @ApiModelProperty(value = "品牌名称")
    private String brandName;

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

    @ExcelProperty("费用模式")
    @ApiModelProperty(value = "费用模式：无牌价0，有牌价1，中性品牌价2", required = true)
    private Integer 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 = "填单体积")
    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;

    @ApiModelProperty(value = "是否特价")
    private Boolean specialPriceType;

    @ApiModelProperty(value = "单位(箱/托)")
    private String unit;

    @ApiModelProperty(value = "入仓数量")
    private Integer warehouseInQuantity = 0;

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

    @ExcelProperty("入仓体积")
    @ApiModelProperty(value = "入仓体积")
    private BigDecimal warehouseInVolume = BigDecimal.ZERO;

    @ExcelProperty("入仓重量")
    @ApiModelProperty(value = "入仓重量")
    private BigDecimal warehouseInWeight = BigDecimal.ZERO;

    @ApiModelProperty(value = "最小计量重量")
    private BigDecimal minMeteringWeight = BigDecimal.ZERO;

    @ApiModelProperty(value = "最小计量体积")
    private BigDecimal minMeteringVolume  = BigDecimal.ZERO;

    @ApiModelProperty(value = "最小计量个数")
    private BigDecimal minMeteringQuantity  = BigDecimal.ZERO;


    @ApiModelProperty(value = "应收收费数量")
    private BigDecimal orgChargeQuantity = BigDecimal.ZERO;

    @ExcelProperty("应收收费件数")
    @ApiModelProperty(value = "应收收费件数")
    private Integer orgChargeNum = 0;

    @ExcelProperty("应收收费体积")
    @ApiModelProperty(value = "应收收费体积")
    private BigDecimal orgChargeVolume = BigDecimal.ZERO;

    @ExcelProperty("应收收费重量")
    @ApiModelProperty(value = "应收收费重量")
    private BigDecimal orgChargeWeight = BigDecimal.ZERO;

    @ApiModelProperty(value = "实际收费数量")
    private BigDecimal realityChargeQuantity = BigDecimal.ZERO;

    @ExcelProperty("实际收费件数")
    @ApiModelProperty(value = "实际收费件数")
    private Integer realityChargeNum = 0;

    @ExcelProperty("实际收费体积")
    @ApiModelProperty(value = "实际收费体积")
    private BigDecimal realityChargeVolume = BigDecimal.ZERO;

    @ExcelProperty("实际收费重量")
    @ApiModelProperty(value = "实际收费重量", required = true)
    private BigDecimal realityChargeWeight = BigDecimal.ZERO;

    /*** 运费 ***/
    @ExcelProperty("成交运费单价(成交/销售)")
    @ApiModelProperty(value = "成交运费单价")
    private BigDecimal oneSeaFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "应收单价(原始价格(无牌无液无电)+特殊加价+佣金)")
    private BigDecimal receivableOneSeaFreight;

    @ExcelProperty("应收运费")
    @ApiModelProperty(value = "应收运费(成本) = 应收单价 * 原始重泡货标准的收费数据")
    private BigDecimal receivableSeaFreight;

    @ExcelProperty("实收运费(小计)")
    @ApiModelProperty(value = "实收运费(小计) = (成交单价 * 当前实际收费数据)")
    private BigDecimal realitySeaFreight;

    @ExcelProperty("原来运费")
    @ApiModelProperty(value = "原来运费(原始无牌无液无电价格)")
    private BigDecimal originalSeaFreight;

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

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

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

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

    @ApiModelProperty(value = "收款单优惠运费金额")
    private BigDecimal receiptDiscountFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "总优惠运费金额(运费计价优惠与收款单优惠之和)")
    private BigDecimal totalDiscountFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "液体运费单价")
    private BigDecimal liquidFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "带电运费单价")
    private BigDecimal electrifiedFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "品牌运费单价")
    private BigDecimal brandFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "包装清关费单价")
    private BigDecimal packagingClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "包装运费单价")
    private BigDecimal packagingFreightPrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "佣金类型：0 无 1 明佣 2 暗佣 3 明+暗")
    private Integer commissionType;

    @ApiModelProperty("明佣金额")
    private BigDecimal plainCommission = BigDecimal.ZERO;

    @ApiModelProperty("暗佣金额")
    private BigDecimal hiddenCommission = BigDecimal.ZERO;

    @ApiModelProperty(value = "运费核销比例传值要乘以100")
    private BigDecimal writeOffFreightFeeProportion;

    @ExcelProperty("是否核销运费")
    @ApiModelProperty(value = "是否核销运费")
    private Boolean isWriteOffFreight;
    /*** 运费 ***/

    /*** 清关费 ***/
    @ApiModelProperty(value = "原清关费(原始无牌无液无电价格)")
    private BigDecimal originalClearanceFreight;

    @ApiModelProperty(value = "应收清关费单价(原始价格(无牌无液无电)+特殊加价)")
    private BigDecimal receivableOneClearanceFreight;

    @ApiModelProperty(value = "成交清关费单价(成交)")
    private BigDecimal oneClearanceFreight = BigDecimal.ZERO;

    @ExcelProperty("应收清关费")
    @ApiModelProperty(value = "应收清关费(成本) = 应收单价 * 原始重泡货标准的收费数据")
    private BigDecimal receivableClearanceFreight;

    @ApiModelProperty(value = "实收清关费 = (成交单价 * 当前实际收费数据)")
    private BigDecimal realityClearanceFreight;

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

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

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

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

    @ApiModelProperty(value = "收款单优惠清关费金额")
    private BigDecimal receiptDiscountClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "总优惠清关费金额(清关费计价优惠与收款单优惠之和)")
    private BigDecimal totalDiscountClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "液体清关费单价")
    private BigDecimal liquidClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "带电清关费单价")
    private BigDecimal electrifiedClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "品牌清关费单价")
    private BigDecimal brandClearanceFeePrice = BigDecimal.ZERO;

    @ApiModelProperty(value = "清关费核销比例传值要乘以100")
    private BigDecimal writeOffClearanceFeeProportion;

    @ExcelProperty("是否核销清关费")
    @ApiModelProperty(value = "是否核销清关费")
    private Boolean isWriteOffClearance;
    /*** 清关费 ***/

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

    @ExcelProperty("快递单号")
    @ApiModelProperty("快递单号")
    private String expressNo;

    /**
     * 入仓信息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 = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;


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


    @ApiModelProperty(value = "是否特价佣金设置")
    private Boolean specialCommission = Boolean.FALSE;

    @ApiModelProperty(value = "使用的优惠信息")
    private String couponInfo;

    @ApiModelProperty(value = "使用的优惠详情列表")
    private List<CouponInfoVO> couponInfoVOList;

    @ApiModelProperty(value = "优惠后运费单价")
    private BigDecimal afterDiscountSeaFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "优惠后清关费单价")
    private BigDecimal afterDiscountClearanceFreight = BigDecimal.ZERO;

}
