package com.freemud.sdk.api.assortment.order.util;

import org.apache.commons.lang.StringUtils;

public class WeightUtils {

    public static Double changeToG(Double weight, String unit) {
        weight = weight == null ? 0D : weight;
        if(unit == null) {
            return weight;
        }
        switch (unit) {
            case "g":
            case "克":
                return weight;
            case "千克":
                return weight * 1000;
            case "两":
                return weight * 50;
            case "斤":
                return weight * 500;
            case "磅":
                return weight * 453.59237d;
            default:
                return weight;
        }
    }
}
