wang-hao-jie
2022-08-25 57dcc73636bb7d8dce89c808eb8cc988a7512264
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.ruoyi.common.core.excel.fieldtype;
 
import java.text.DecimalFormat;
import java.text.NumberFormat;
 
 
/**
 * 金额类型转换(保留两位)
 * @example fieldType = MoneyType.class
 */
public class MoneyType {
 
    /**
     * 获取对象值(导入)
     */
    public static Object getValue(String val) {
        return val == null ? "" : val.replaceAll(",", "");
    }
 
    /**
     * 获取对象值(导出)
     */
    public static String setValue(Object val) {
        NumberFormat nf = new DecimalFormat(",##0.00"); 
        return val == null ? "" : nf.format(val);
    }
    
    /**
     * 获取对象值格式(导出)
     */
    public static String getDataFormat() {
        return "0.00";
    }
    
    /**
     * 清理缓存
     */
    public static void clearCache(){
        
    }
    
}