|
@@ -31,6 +31,7 @@ import java.security.SecureRandom;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -316,14 +317,10 @@ public class HuaTaiRequestApiComponents {
|
|
|
params.put("jkey", jkey);
|
|
params.put("jkey", jkey);
|
|
|
try{
|
|
try{
|
|
|
url=url+"?key={key}&jkey={jkey}";
|
|
url=url+"?key={key}&jkey={jkey}";
|
|
|
- String result = (String)restTemplate.getForObject(url, String.class, params);
|
|
|
|
|
|
|
+ String result = restTemplate.getForObject(url, String.class, params);
|
|
|
if(StringUtils.isNotBlank(result)){
|
|
if(StringUtils.isNotBlank(result)){
|
|
|
- String unicodeSpace = "\u0000";
|
|
|
|
|
- if(result.contains(unicodeSpace)){
|
|
|
|
|
- result= result.replaceAll(unicodeSpace, "");
|
|
|
|
|
- }
|
|
|
|
|
//放入到redis中 2小时
|
|
//放入到redis中 2小时
|
|
|
- redisTemplate.opsForValue().set("HT_GET_VOKEN_STR", result, 2*60*59);
|
|
|
|
|
|
|
+ redisTemplate.opsForValue().set("HT_GET_VOKEN_STR", result, 2*60*59, TimeUnit.SECONDS);
|
|
|
}
|
|
}
|
|
|
}catch(Exception e){
|
|
}catch(Exception e){
|
|
|
throw new SystemException("获取voken异常");
|
|
throw new SystemException("获取voken异常");
|
|
@@ -337,24 +334,10 @@ public class HuaTaiRequestApiComponents {
|
|
|
*/
|
|
*/
|
|
|
public String getVotoken(){
|
|
public String getVotoken(){
|
|
|
String voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
String voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
|
- String unicodeSpace = "\u0000";
|
|
|
|
|
if(StringUtils.isBlank(voken)){
|
|
if(StringUtils.isBlank(voken)){
|
|
|
//重新放入,重新获取
|
|
//重新放入,重新获取
|
|
|
setVoken();
|
|
setVoken();
|
|
|
voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
|
- }else{
|
|
|
|
|
- if(voken!=null && !"".equals(voken) && voken.contains(unicodeSpace)){
|
|
|
|
|
- voken= voken.replaceAll(unicodeSpace, "");
|
|
|
|
|
- if(StringUtils.isBlank(voken)){
|
|
|
|
|
- //重新放入,重新获取
|
|
|
|
|
- setVoken();
|
|
|
|
|
- voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(voken!=null && !"".equals(voken) && voken.contains(unicodeSpace)){
|
|
|
|
|
- voken= voken.replaceAll(unicodeSpace, "");
|
|
|
|
|
}
|
|
}
|
|
|
return voken;
|
|
return voken;
|
|
|
}
|
|
}
|