package cn.hnthyy.thmz.vo;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;

@Data
public class ReceiptVo implements Comparable<ReceiptVo>{
    private String name;
    private String receiptBill;
    private String flag;
    private BigDecimal totalCharge;


    @Override
    public int compareTo(ReceiptVo receiptVo) {
        //重写Comparable接口的compareTo方法，
        Integer ownBill = 0;
        Integer otherBill = 0;
        if (StringUtils.isNotBlank(this.receiptBill)) {
            ownBill = Integer.valueOf(this.receiptBill);
        }
        if (receiptVo != null && StringUtils.isNotBlank(receiptVo.getReceiptBill())) {
            otherBill = Integer.valueOf(receiptVo.getReceiptBill());
        }
        return ownBill - otherBill;// 根据发票号升序排列，降序修改相减顺序即可
    }
}
