package com.iformall.domain.po;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

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

/**
 * @author gongbiao
 */
@TableName(value = "wx_bill_other")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillOther extends BaseEntity {

    protected Long id;


    @Excel(name = "商户名称", width = 20, orderNum = "2")
	@TableField(exist = false)
	private String merchantName;

	@Excel(name = "其他费用名称", width = 20, orderNum = "3")
	@io.swagger.annotations.ApiModelProperty(value="账单名称",name="name")
	private String name;

	@Excel(name = "备注", orderNum = "11", width = 20)
	@io.swagger.annotations.ApiModelProperty(value="账单备注",name="comments")
	private String comments;

    @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay")
    private Long receivePay;
	@io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay")
    private Long pay;

	@Excel(name = "缴款截止日期", orderNum = "7", width = 20, format = "yyyy-MM-dd")
	@io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate")
	private Date receiveDate;

	@Excel(name = "收款日期", orderNum = "8", width = 20, format = "yyyy-MM-dd")
	@io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate")
	private Date payDate;

	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime")
	private Date createtime;

	@Excel(name = "逾期(天)", orderNum = "10", width = 20)
	@io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
	private Long expiredDay;
	@io.swagger.annotations.ApiModelProperty(value="租户",name="tenantId")
	private String tenantId;
	@io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe")
    private Long owe;
	@Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "9")
	@io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期", name = "status")
	private Integer status;
	@io.swagger.annotations.ApiModelProperty(value="删除 是1否0",name="isDel")
	private Integer isDel;
	@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
	private Long merchantId;
	@io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId")
	private Long userId;
	@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
	private Long shopId;
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime")
	private Date updatetime;

	@io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType")
	private Integer rentShopType;

	@io.swagger.annotations.ApiModelProperty(value = "支付方式：见枚举EnumBillPayWay", name = "payWay")
	private Integer payWay;

	@TableField(exist = false)
	private Integer allPeriod;

	@TableField(exist = false)
	private Long needPay;

	@TableField(exist = false)
	private Long latePayPrice;

	@TableField(exist = false)
	@SortColumn(column = "period")
	private Integer period;

	@Excel(name = "商铺号", width = 20, orderNum = "1")
	@TableField(exist = false)
	private String shopNumber;

	@TableField(exist = false)
	@Excel(name = "实际应收金额(元)", orderNum = "4", width = 20)
	private String receivePayStr;
	@TableField(exist = false)
	@Excel(name = "实收金额(元)", orderNum = "5", width = 20)
	private String payStr;
	@TableField(exist = false)
	@Excel(name = "欠缴金额(元)", orderNum = "6", width = 20)
	private String oweStr;

	@io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime")
	private Date starttime;

	@io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime")
	private Date endtime;

	public String getReceivePayStr() {
		return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString();
	}

	public String getPayStr() {
		return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString();
	}

	public String getOweStr() {
		return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString();
	}

	@TableField(exist = false)
	private List<Map<String, Object>> shops;
	@io.swagger.annotations.ApiModelProperty(value = "冻结状态，0正常1冻结", name = "freeze")
	private Integer freeze;

	@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
	private Integer serviceChargePay;

	@io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay")
	@TableField(exist = false)
	private Long realReceivePay;

	@TableField(exist = false)
	private String serviceChargePayBefore;
	@TableField(exist = false)
	private String serviceChargePayUpdate;
}
