package org.ta.pddserver.utils;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class PddNationalPriceTool {

    //首重重量
    private static int initialWeight = 1000;
    //上限重量
    private static int maxWeight = 200000;

    // 首重价格
    private static int initalPrice = 450;


    //超重计费标准
    private static int excessWeight = 1000;

    //超重价格
    private static int excessPrice = 100;

    //标椎三边长度
    private static int standard = 100;

    //标准三边之和
    private static int maxStandard = 160;


    /*
     * 根据类型、重量（g） 计算运费
     * */
    public static PddJYPriceTool.FeeResult FreightCostCalculation(int length, int width, int height, int weight) {
        PddJYPriceTool.FeeResult result = new PddJYPriceTool.FeeResult();
        int price = initalPrice;
        if (weight > initialWeight) {
            int pw = weight - initialWeight;
            int pc = pw / excessWeight;
            if (pw % excessWeight != 0) {
                pc += 1;
            }
            price = price + pc * excessPrice;
            log.info("续重数量：{}", pc);
        }
        result.setRentFee(0);
        result.setFreightFee(price);
        result.setWeight(weight);
        return result;
    }
}
