Commit 24f9b665 by 水库浪子

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

1 parent 0082627e
...@@ -14,4 +14,6 @@ public interface IWeAccessTokenService { ...@@ -14,4 +14,6 @@ public interface IWeAccessTokenService {
public String findProviderAccessToken(); public String findProviderAccessToken();
public void removeToken();
} }
\ No newline at end of file \ No newline at end of file
...@@ -68,6 +68,8 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService { ...@@ -68,6 +68,8 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
} }
private String findAccessToken(String accessTokenKey){ private String findAccessToken(String accessTokenKey){
String weAccessToken =redisCache.getCacheObject(accessTokenKey); String weAccessToken =redisCache.getCacheObject(accessTokenKey);
...@@ -105,4 +107,15 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService { ...@@ -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; ...@@ -6,6 +6,7 @@ import java.util.Optional;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -25,6 +26,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -25,6 +26,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Autowired @Autowired
private WeCorpAccountMapper weCorpAccountMapper; private WeCorpAccountMapper weCorpAccountMapper;
@Autowired
private IWeAccessTokenService iWeAccessTokenService;
/** /**
* 查询企业id相关配置 * 查询企业id相关配置
* *
...@@ -72,7 +77,15 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -72,7 +77,15 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount) 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 { ...@@ -94,7 +107,18 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
*/ */
@Override @Override
public int startVailWeCorpAccount(String corpId) { 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 @Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!