chenjiahe
2022-01-19 641b392b1197b27eeeedc5f38d834376fe6e0193
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
package com.platform.util;
 
import com.alibaba.fastjson.JSONObject;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import org.apache.poi.ss.formula.functions.T;
 
import java.io.Serializable;
 
/**
 * 类型转化工具
 */
public class FormatConversion {
 
    /**
     * @param data 转化的数据
     * @param tClass 转化成的对象
     * @return
     */
    public static Object jsonToEntity(String data,Class tClass) {
        try{
            return JSONObject.parseObject(data, tClass);
        }catch (Exception e){
            throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA,"数据格式错误");
        }
    }
 
}