package com.ruoyi.cai.util;

import cn.hutool.core.util.NumberUtil;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class NumCaUtil {

    /**
     * 向下取整计算金额
     * @param value
     * @param rate
     * @return
     */
    public static Long coin(Long value, BigDecimal rate){
        BigDecimal decimal = NumberUtil.mul(value, rate);
        return decimal.setScale(0, RoundingMode.DOWN).longValue();
    }
}
