java110
2021-06-29 c8195a8a1c34b9fa8db9aa4dc340d4344044ce97
java110-core/src/main/java/com/java110/core/factory/CallApiServiceFactory.java
old mode 100644 new mode 100755
@@ -16,7 +16,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
@@ -205,11 +209,18 @@
        long startTime = DateUtil.getCurrentDate().getTime();
        logger.debug(url + "调用api开始:" + (startTime));
        HttpHeaders header = new HttpHeaders();
        if (pd.getHeaders() != null) {
            for (String key : pd.getHeaders().keySet()
            ) {
                header.add(key, pd.getHeaders().get(key).toString());
            }
        }
        header.add(CommonConstant.HTTP_APP_ID.toLowerCase(), StringUtil.isEmpty(pd.getAppId()) ? AppDto.WEB_APP_ID : pd.getAppId());
        header.add(CommonConstant.HTTP_USER_ID.toLowerCase(), StringUtil.isEmpty(pd.getUserId()) ? CommonConstant.ORDER_DEFAULT_USER_ID : pd.getUserId());
        header.add(CommonConstant.HTTP_TRANSACTION_ID.toLowerCase(), pd.getTransactionId());
        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 {
@@ -221,10 +232,8 @@
        } finally {
            logger.debug("请求地址为,{} 请求中心服务信息,{},中心服务返回信息,{}", url, httpEntity, responseEntity);
            logger.debug(url + "调用api耗时:" + (DateUtil.getCurrentDate().getTime() - startTime));
            return responseEntity;
        }
        return responseEntity;
    }