...
|
...
|
@@ -11,6 +11,7 @@ import com.yoho.global.model.constant.ApiCode; |
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.util.HashMap;
|
...
|
...
|
@@ -29,6 +30,9 @@ public class YHRestCaller { |
|
|
|
|
|
private String yhbUrl = "http://api.yoho.cn";
|
|
|
|
|
|
@Value("${erp.gateway.address}")
|
|
|
private String erpGatewayAddress;
|
|
|
|
|
|
private String yhbClientType = "web";
|
|
|
|
|
|
private String yhbClientKey = "0ed29744ed318fd28d2c07985d3ba633";
|
...
|
...
|
@@ -82,13 +86,19 @@ public class YHRestCaller { |
|
|
}
|
|
|
// TODO: 2017/11/29 增加临时写死低版本号
|
|
|
requestParams.put("app_version","6.2.3");
|
|
|
String sign = getSign(requestParams);
|
|
|
requestParams.put("client_secret", sign);
|
|
|
|
|
|
ApiResponse apiResp;
|
|
|
//not YHMethodContants.APP_PASSPORT_VERIFY
|
|
|
if (!StringUtils.equals(YHMethodContants.APP_PASSPORT_VERIFY,method)){
|
|
|
//调用erp-gateway
|
|
|
requestParams.put("_sncp", "NGJjYjhkNmwwZGM0OTk0YmQyMTMwZjlmoTZmzjY4cjN");
|
|
|
apiResp = get(erpGatewayAddress, requestParams, ApiResponse.class);
|
|
|
}else {
|
|
|
//调用gateway
|
|
|
apiResp = get(yhbUrl, requestParams, ApiResponse.class);
|
|
|
}
|
|
|
String sign = getSign(requestParams);
|
|
|
requestParams.put("client_secret", sign);
|
|
|
ApiResponse apiResp = get(yhbUrl, requestParams, ApiResponse.class);
|
|
|
if(apiResp == null || apiResp.getCode() != 200) {
|
|
|
logger.warn("yhbGetMethod failed, respCode: {}, respMessage: {}, url: {}, requestParams: {}", apiResp.getCode(), apiResp.getMessage(), yhbUrl, requestParams);
|
|
|
throw new ServiceException(ServiceError.SYSTEM);
|
...
|
...
|
|