|
|
@@ -316,10 +316,14 @@ public class HuaTaiRequestApiComponents {
|
|
|
params.put("jkey", jkey);
|
|
|
try{
|
|
|
url=url+"?key={key}&jkey={jkey}";
|
|
|
- String result = restTemplate.getForObject(url, String.class, params);
|
|
|
+ String result = (String)restTemplate.getForObject(url, String.class, params);
|
|
|
if(StringUtils.isNotBlank(result)){
|
|
|
+ String unicodeSpace = "\u0000";
|
|
|
+ if(result.contains(unicodeSpace)){
|
|
|
+ result= result.replaceAll(unicodeSpace, "");
|
|
|
+ }
|
|
|
//放入到redis中 2小时
|
|
|
- redisTemplate.opsForValue().set("HT_GET_VOKEN_STR", result, 2*60*60);
|
|
|
+ redisTemplate.opsForValue().set("HT_GET_VOKEN_STR", result, 2*60*59);
|
|
|
}
|
|
|
}catch(Exception e){
|
|
|
throw new SystemException("获取voken异常");
|
|
|
@@ -334,18 +338,23 @@ public class HuaTaiRequestApiComponents {
|
|
|
public String getVotoken(){
|
|
|
String voken = redisTemplate.opsForValue().get("HT_GET_VOKEN_STR");
|
|
|
String unicodeSpace = "\u0000";
|
|
|
- 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(StringUtils.isBlank(voken)){
|
|
|
//重新放入,重新获取
|
|
|
setVoken();
|
|
|
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;
|
|
|
}
|