|  | @ -4,6 +4,8 @@ package com.yihu.jw.restmodel.common;
 | 
												
													
														
															|  | import com.fasterxml.jackson.databind.ObjectMapper;
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | //import com.yihu.jw.exception.ApiException;
 |  | //import com.yihu.jw.exception.ApiException;
 | 
												
													
														
															|  | //import com.yihu.jw.exception.code.ExceptionCode;
 |  | //import com.yihu.jw.exception.code.ExceptionCode;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.exception.ApiException;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.exception.code.ExceptionCode;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | import org.slf4j.Logger;
 |  | import org.slf4j.Logger;
 | 
												
													
														
															|  | import org.slf4j.LoggerFactory;
 |  | import org.slf4j.LoggerFactory;
 | 
												
											
												
													
														
															|  | @ -60,6 +62,17 @@ public class EnvelopRestController {
 | 
												
													
														
															|  |         return envelop;
 |  |         return envelop;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     //Json转实体类
 | 
												
													
														
															|  | 
 |  |     public <T> T toEntity(String json, Class<T> entityCls) {
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             ObjectMapper objectMapper = new ObjectMapper();
 | 
												
													
														
															|  | 
 |  |             objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
 | 
												
													
														
															|  | 
 |  |             T entity = objectMapper.readValue(json, entityCls);
 | 
												
													
														
															|  | 
 |  |             return entity;
 | 
												
													
														
															|  | 
 |  |         } catch (IOException ex) {
 | 
												
													
														
															|  | 
 |  |             throw new ApiException("Unable to parse json, " + ex.getMessage(), ExceptionCode.common_error_params_code);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 将实体集合转换为模型集合。
 |  |      * 将实体集合转换为模型集合。
 |