New file |
| | |
| | | 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,"数据格式错误"); |
| | | } |
| | | } |
| | | |
| | | } |