package com.ruoyi.cc.utils;

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

public class Test {

    /** 每小时秒数 */
    private static final BigDecimal SECONDS_PER_HOUR = BigDecimal.valueOf(3600);
    /** ASR 单价：元/秒 */
    private static final BigDecimal priceAsrAli = new BigDecimal("0.00015");

    private static BigDecimal calTotalCost(Integer asrSeconds, Integer ttsTimes, Integer ttsFlowTokens, Integer inputTokens, Integer outputTokens) {
        BigDecimal priceAsrAli = new BigDecimal("0.00015");
        BigDecimal totalCost = new BigDecimal("0.0");
        // asr费用 = asrSeconds/3600 * priceAsrAli
        if (asrSeconds != null && asrSeconds > 0) {
            BigDecimal hours = BigDecimal.valueOf(asrSeconds)
                    .divide(SECONDS_PER_HOUR, 10, RoundingMode.HALF_UP);
            totalCost = totalCost.add(hours.multiply(priceAsrAli));
        }
        return totalCost;
    }

    public static void main(String[] args) {
        System.out.println(calTotalCost(350, 12, 888, 12345, 23456));
    }

}
