package com.tzy.common.dto.invoice;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tzy.common.constant.Constants;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author by po'yi
 * @Classname SimpleOrderDTO
 * @Description TODO
 * @Date 2022/8/9 14:05
 */
@Data
public class InvoiceMerchantDTO implements Serializable {
	private Long id;
	private String name;
	private String avatar;
	private BigDecimal invoiceAmount;
	//总金额,单位分
	@JsonIgnore
	private long totalAmount;

	public BigDecimal getInvoiceAmount() {
		if (totalAmount > 0) {
			invoiceAmount = new BigDecimal(totalAmount).divide(Constants.HUNDRED, 2, RoundingMode.HALF_UP);
		}
		return invoiceAmount;
	}
}
