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

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

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

/**
 * 订单异常 Response VO
 *
 * @author 系统管理员
 */
@Data
@ApiModel("管理后台 - 订单异常列表 Response VO")
public class OrderExceptionBackVO {

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

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

    @ExcelProperty("订单商品id")
    @ApiModelProperty(value = "订单商品id", required = true)
    private Long orderItemId;

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

    @ExcelProperty("异常类型")
    @ApiModelProperty(value = "异常类型", required = true)
    private String orderExceptionType;

    @ExcelProperty("异常描述")
    @ApiModelProperty(value = "异常描述", required = true)
    private String orderExceptionRemark;

    @ExcelProperty("异常金额")
    @ApiModelProperty(value = "异常金额", required = true)
    private java.math.BigDecimal orderExceptionAmount;

    @ExcelProperty("异常金额币种ID")
    @ApiModelProperty(value = "异常金额币种ID", required = true)
    private Long orderExceptionAmountCurrencyId;

    @ExcelProperty("附件,多个,拼接")
    @ApiModelProperty(value = "附件,多个,拼接")
    private String orderExceptionAttr;

    @ExcelProperty("异常状态")
    @ApiModelProperty(value = "异常状态")
    private String orderExceptionStatus;

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

    @ExcelProperty("处理人ID")
    @ApiModelProperty(value = "处理人ID")
    private Long userId;

    @ExcelProperty("处理人")
    @ApiModelProperty(value = "处理人")
    private String userName;

    @ExcelProperty("处理时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @ApiModelProperty(value = "处理时间", required = true)
    private Date handlerTime;

    @ApiModelProperty(value = "处理备注", required = true)
    private String handlerRemark;

    @ExcelProperty("异常描述-带中英文")
    @ApiModelProperty(value = "异常描述-带中英文", required = true)
    private OrderExceptionDescVO orderExceptionDescVO;

    @ExcelProperty(value = "异常详情")
    @ApiModelProperty(value = "异常详情")
    private String orderExceptionDetails;

    @ExcelProperty("异常备注")
    @ApiModelProperty(value = "异常备注")
    private String orderExceptionNotes;

    @ApiModelProperty(value = "异常流程ID")
    private String bpmId;

    @ApiModelProperty(value = "异常流程状态，1处理中2通过3不通过4已取消")
    private String bpmStatus;


    /**
     * 附加的json串，用于传递产生异常时的信息，目的是溯源。因异常多种多样，参数也各不相同，故不转化为固定对象，建议转换为JsonObject，使用get("属性名")获取值
     */
    @ApiModelProperty(value = "附带的json，每个业务所用的json属性不同，故没有统一对象映射")
    private String additionalJson;

    @ApiModelProperty(value = "旧的价格对象")
    private String oldPriceJson;

    @ApiModelProperty(value = "异常申请备注信息")
    private String applyNotes;

    public void setOrderExceptionDescVO() {
        this.orderExceptionDescVO = JSONObject.parseObject(this.orderExceptionRemark, OrderExceptionDescVO.class);
    }

    public OrderExceptionDescVO getOrderExceptionDescVO() {
        return JSONObject.parseObject(this.orderExceptionRemark, OrderExceptionDescVO.class);
    }
}
