|
|
@ -27,6 +27,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.ruoyi.quartz.helper.OkHttpHelper.post;
|
|
|
|
import static com.ruoyi.quartz.helper.OkHttpHelper.post;
|
|
|
@ -325,16 +326,20 @@ public abstract class SyncAccountsJobAbstract {
|
|
|
|
* 生成调用接口的token信息
|
|
|
|
* 生成调用接口的token信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void generateToken(CJTJobContext context) {
|
|
|
|
private void generateToken(CJTJobContext context) {
|
|
|
|
CJTRequest cjtRequest = new CJTRequest(REQUEST_GENERATE_TOKEN_PATH
|
|
|
|
String openToken = (String) redisCache.getCacheObject(RedisConstants.CJT_TOKEN_CACHE_KEY);
|
|
|
|
, context.getAppKey()
|
|
|
|
if (StringUtils.isEmpty(RedisConstants.CJT_TOKEN_CACHE_KEY)){
|
|
|
|
, context.getAppSecret()
|
|
|
|
CJTRequest cjtRequest = new CJTRequest(REQUEST_GENERATE_TOKEN_PATH
|
|
|
|
, context.getTicket()
|
|
|
|
, context.getAppKey()
|
|
|
|
, CERTIFICATE);
|
|
|
|
, context.getAppSecret()
|
|
|
|
cjtRequest.buildGenerateBody();
|
|
|
|
, context.getTicket()
|
|
|
|
JSONObject body = JSONObject.parseObject(post(cjtRequest));
|
|
|
|
, CERTIFICATE);
|
|
|
|
JSONObject value = body.getJSONObject("value");
|
|
|
|
cjtRequest.buildGenerateBody();
|
|
|
|
String token = value.getString("accessToken");
|
|
|
|
JSONObject body = JSONObject.parseObject(post(cjtRequest));
|
|
|
|
context.setOpenToken(token);
|
|
|
|
JSONObject value = body.getJSONObject("value");
|
|
|
|
|
|
|
|
String token = value.getString("accessToken");
|
|
|
|
|
|
|
|
context.setOpenToken(token);
|
|
|
|
|
|
|
|
redisCache.setCacheObject(RedisConstants.CJT_TOKEN_CACHE_KEY,token,10, TimeUnit.MINUTES);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|