trick9191 6 yıl önce
ebeveyn
işleme
90160d998a

+ 6 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/EnvelopRestController.java

@ -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;
@ -62,14 +64,14 @@ public class EnvelopRestController {
    //Json转实体类
    //Json转实体类
    public <T> T toEntity(String json, Class<T> entityCls) {
    public <T> T toEntity(String json, Class<T> entityCls) {
//        try {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
            objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
            T entity = objectMapper.readValue(json, entityCls);
            T entity = objectMapper.readValue(json, entityCls);
            return entity;
            return entity;
//        } catch (IOException ex) {
//            throw new ApiException("Unable to parse json, " + ex.getMessage(), ExceptionCode.common_error_params_code);
//        }
        } catch (IOException ex) {
            throw new ApiException("Unable to parse json, " + ex.getMessage(), ExceptionCode.common_error_params_code);
        }
    }
    }
    /**
    /**