package com.cftech.orderdetail.utils;

import com.alibaba.fastjson.serializer.ValueFilter;

import java.math.BigDecimal;

public class DoubleJSONFilter implements ValueFilter {

    @Override
    public Object process(Object value, String s, Object o1) {
        if( o1 instanceof Double  ){
            BigDecimal bg = new BigDecimal((Double) o1);
            BigDecimal f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP);
            return f1;
        }
        return o1;
    }
}
