wuxw
2019-04-13 416c1925b9fc1c3975cfa3fac5764f66f3cb84fa
java110-core/src/main/java/com/java110/core/base/smo/BaseServiceSMO.java
@@ -17,6 +17,8 @@
import com.java110.core.factory.DataFlowFactory;
import com.java110.feign.base.IPrimaryKeyService;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.*;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
@@ -32,6 +34,7 @@
 */
public class BaseServiceSMO extends AppBase {
    private final static Logger logger = LoggerFactory.getLogger(BaseServiceSMO.class);
    /**
     * 主键生成
@@ -71,9 +74,10 @@
        header.add(CommonConstant.HTTP_APP_ID.toLowerCase(), CommonConstant.HC_WEB_APP_ID);
        header.add(CommonConstant.HTTP_USER_ID.toLowerCase(), CommonConstant.ORDER_DEFAULT_USER_ID);
        header.add(CommonConstant.HTTP_TRANSACTION_ID.toLowerCase(), pd.getTransactionId());
        header.add(CommonConstant.HTTP_REQ_TIME.toLowerCase(), pd.getReqData());
        header.add(CommonConstant.HTTP_REQ_TIME.toLowerCase(), pd.getRequestTime());
        header.add(CommonConstant.HTTP_SIGN.toLowerCase(), "");
        HttpEntity<String> httpEntity = new HttpEntity<String>(param, header);
        logger.debug("请求中心服务信息,{}",httpEntity);
        try{
            responseEntity = restTemplate.exchange(url, httpMethod, httpEntity, String.class);
        }catch (HttpStatusCodeException e){ //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下
@@ -81,6 +85,7 @@
        }catch (Exception e){
            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("请求中心服务信息,{}",responseEntity);
            return responseEntity;
        }