提交 783121ad 编写于 作者: 水库浪子

添加企业账号更新,启动清空企业微信token功能;

上级 53e8b2c0
......@@ -14,4 +14,6 @@ public interface IWeAccessTokenService {
public String findProviderAccessToken();
public void removeToken();
}
\ No newline at end of file
......@@ -68,6 +68,8 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
}
private String findAccessToken(String accessTokenKey){
String weAccessToken =redisCache.getCacheObject(accessTokenKey);
......@@ -105,4 +107,15 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
}
/**
* 清空redis中的相关token
*/
@Override
public void removeToken() {
redisCache.deleteObject(WeConstans.WE_COMMON_ACCESS_TOKEN);
redisCache.deleteObject(WeConstans.WE_CONTACT_ACCESS_TOKEN);
redisCache.deleteObject(WeConstans.WE_PROVIDER_ACCESS_TOKEN);
}
}
......@@ -6,6 +6,7 @@ import java.util.Optional;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -25,6 +26,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Autowired
private WeCorpAccountMapper weCorpAccountMapper;
@Autowired
private IWeAccessTokenService iWeAccessTokenService;
/**
* 查询企业id相关配置
*
......@@ -72,7 +77,15 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount)
{
return weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount);
int returnCode = weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
iWeAccessTokenService.removeToken();
}
return returnCode;
}
......@@ -94,7 +107,18 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
*/
@Override
public int startVailWeCorpAccount(String corpId) {
return weCorpAccountMapper.startVailWeCorpAccount(corpId);
int returnCode = weCorpAccountMapper.startVailWeCorpAccount(corpId);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
iWeAccessTokenService.removeToken();
}
return returnCode;
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册