1、
String price = "19.90"; // 19.99
int totalFee =(int)(new BigDecimal(price).multiply(new BigDecimal("100"))).doubleValue();
int totalFee2 = (int) (Double.parseDouble(price) * 100);
System.out.println(totalFee); //1990
System.out.println(totalFee2); //1989
Double 和bigdecimal處理不一樣
2、
Long l = 112630689643634688L;
18位的Long,以Long類型返回給前端,前端解析出來的值,不一致。
解決辦法:
在response對象里面的Long類型的字段加個注解:



