|
@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.OauthAgentToken;
|
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
import cn.com.ctop.common.module.mapper.OauthAgentTokenMapper;
|
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
+import cn.com.ctop.common.module.service.IOauthAgentTokenService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -42,13 +44,22 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
|
|
|
private CtopOauthTokenMapper ctopOauthTokenMapper;
|
|
|
@Resource
|
|
|
private OauthAgentTokenMapper agentTokenMapper;
|
|
|
+ @Autowired
|
|
|
+ private IOauthAgentTokenService agentTokenService;
|
|
|
|
|
|
@Override
|
|
|
public CtopOauthToken getOauthTokenByAccountId(String accountId) {
|
|
|
QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
|
|
|
queryWrapper.last("limit 1");
|
|
|
- return this.getOne(queryWrapper);
|
|
|
+ CtopOauthToken one = this.getOne(queryWrapper);
|
|
|
+ if (one.getMediaId().equals("2") || one.getMediaId().equals("4")) {
|
|
|
+ OauthAgentToken tokenByAppId = agentTokenService.getTokenByAppId(one.getAppId());
|
|
|
+ if (!Check.isNull(tokenByAppId)) {
|
|
|
+ one.setAccessToken(tokenByAppId.getAccessToken());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return one;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -57,7 +68,14 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
|
|
|
QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
|
|
|
queryWrapper.last("limit 1");
|
|
|
- return this.getOne(queryWrapper);
|
|
|
+ CtopOauthToken one = this.getOne(queryWrapper);
|
|
|
+ if (one.getMediaId().equals("2") || one.getMediaId().equals("4")) {
|
|
|
+ OauthAgentToken tokenByAppId = agentTokenService.getTokenByAppId(one.getAppId());
|
|
|
+ if (!Check.isNull(tokenByAppId)) {
|
|
|
+ one.setAccessToken(tokenByAppId.getAccessToken());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return one;
|
|
|
}
|
|
|
|
|
|
/**
|