66688988
This commit is contained in:
@@ -7,8 +7,8 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.common.common.exception.BusinessException;
|
||||
import net.lab1024.sa.common.module.support.redis.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
@@ -28,7 +28,7 @@ public class Base {
|
||||
private static String clientUrl;
|
||||
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
/**
|
||||
* 发送 POST JSON 请求
|
||||
@@ -40,7 +40,7 @@ public class Base {
|
||||
public String postJson(String url, String jsonData, Map<String, String> headers) {
|
||||
// 获取token
|
||||
String tokenKey = "fangxinqian:" + clientId;
|
||||
String token = redisService.get(tokenKey);
|
||||
String token = redisTemplate.opsForValue().get(tokenKey);
|
||||
if (token == null) {
|
||||
token = getAccessToken();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class Base {
|
||||
}
|
||||
|
||||
String tokenKey = "fangxinqian:" + clientId;
|
||||
redisService.set(tokenKey,accessToken,(expiresIn - 120));
|
||||
redisTemplate.opsForValue().set(tokenKey,accessToken,(expiresIn - 120));
|
||||
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,7 @@
|
||||
package net.lab1024.sa.admin.extend.fangxinqian;
|
||||
package net.lab1024.sa.admin.extend.fangxinqian.company;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.admin.extend.fangxinqian.Base;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -9,5 +10,4 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class Company extends Base {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user