|
|
|
@ -19,6 +19,7 @@ import com.jianshui.system.service.ICompanyservicePropService; |
|
|
|
|
import com.jianshui.system.service.ISysConfigService; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.RandomUtils; |
|
|
|
|
import org.springframework.core.env.Environment; |
|
|
|
|
import sun.misc.BASE64Encoder; |
|
|
|
|
|
|
|
|
|
import org.apache.commons.httpclient.HttpClient; |
|
|
|
@ -54,6 +55,14 @@ import org.apache.commons.codec.binary.Base64; |
|
|
|
|
public class ElephantUtils { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String ELE_CHECK_URL; |
|
|
|
|
private static String ELE_CHECK_ENTCODE; |
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
Environment environment = SpringUtils.getBean(Environment.class); |
|
|
|
|
ELE_CHECK_URL = environment.getProperty("ele_check_url"); |
|
|
|
|
ELE_CHECK_ENTCODE = environment.getProperty("elephant_entcode_check"); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 大象请求 云端版 |
|
|
|
|
* |
|
|
|
@ -67,11 +76,11 @@ public class ElephantUtils { |
|
|
|
|
|
|
|
|
|
boolean isDevMode = CommonUtils.isDevMode(); |
|
|
|
|
|
|
|
|
|
String host = ElephantConstants.PROD_HOST; |
|
|
|
|
/*String host = ElephantConstants.PROD_HOST; |
|
|
|
|
if (isDevMode || devMode) { |
|
|
|
|
host = ElephantConstants.DEV_HOST; |
|
|
|
|
} |
|
|
|
|
String url = host + uri; |
|
|
|
|
}*/ |
|
|
|
|
String url = ELE_CHECK_URL + uri; |
|
|
|
|
|
|
|
|
|
String token = getToken(devMode); |
|
|
|
|
if (StringUtils.isEmpty(token)) { |
|
|
|
@ -81,8 +90,9 @@ public class ElephantUtils { |
|
|
|
|
|
|
|
|
|
// 先处理下请求体
|
|
|
|
|
JSONObject requestBody = new JSONObject(); |
|
|
|
|
String entCode = configService.selectConfigByKey("elephant_entcode"); |
|
|
|
|
requestBody.put("entCode", entCode); |
|
|
|
|
/*String entCode = configService.selectConfigByKey("elephant_entcode"); |
|
|
|
|
requestBody.put("entCode", entCode);*/ |
|
|
|
|
requestBody.put("entCode", ELE_CHECK_ENTCODE); |
|
|
|
|
requestBody.put("zipCode", 0); // 不压缩
|
|
|
|
|
requestBody.put("encryptCode", 0); // 不加密
|
|
|
|
|
|
|
|
|
@ -157,10 +167,12 @@ public class ElephantUtils { |
|
|
|
|
} |
|
|
|
|
boolean isDevMode = CommonUtils.isDevMode(); |
|
|
|
|
|
|
|
|
|
String url = ElephantConstants.PROD_TOKEN_HOST; |
|
|
|
|
/*String url = ElephantConstants.PROD_TOKEN_HOST; |
|
|
|
|
if (isDevMode || devMode) { |
|
|
|
|
url = ElephantConstants.DEV_TOKEN_HOST; |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
String url = ELE_CHECK_URL + "authen/token"; |
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("appKey", appkey); |
|
|
|
@ -199,11 +211,11 @@ public class ElephantUtils { |
|
|
|
|
String sercretKey = secretIdProp.getValue(); |
|
|
|
|
boolean isDevMode = CommonUtils.isDevMode(); |
|
|
|
|
|
|
|
|
|
String host = ElephantConstants.PROD_HOST; |
|
|
|
|
/*String host = ElephantConstants.PROD_HOST; |
|
|
|
|
if (isDevMode) { |
|
|
|
|
host = ElephantConstants.DEV_HOST; |
|
|
|
|
} |
|
|
|
|
String url = host + uri; |
|
|
|
|
}*/ |
|
|
|
|
String url = ELE_CHECK_URL + uri; |
|
|
|
|
|
|
|
|
|
String token = getToken(devMode); |
|
|
|
|
if (token == "") { |
|
|
|
@ -233,7 +245,7 @@ public class ElephantUtils { |
|
|
|
|
query = StrUtil.removePrefix(query, "&"); |
|
|
|
|
query = query.replace("_", "."); |
|
|
|
|
query = "POST" + |
|
|
|
|
host.replace("http://", "").replace("https://", "") + |
|
|
|
|
ELE_CHECK_URL.replace("http://", "").replace("https://", "") + |
|
|
|
|
uri + |
|
|
|
|
methodName + |
|
|
|
|
query; |
|
|
|
|