Browse Source

修改秘钥重置功能,重置db的同时会删除redis中对应的key

dev_shibei_match
wxz 5 years ago
parent
commit
8766b5642b
  1. 8
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java
  2. 2
      epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml

8
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java

@ -20,6 +20,8 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ExternalAppDao;
import com.epmet.dao.ExternalAppSecretDao;
@ -65,6 +67,9 @@ public class ExternalAppServiceImpl implements ExternalAppService {
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private RedisUtils redisUtils;
@Transactional
@Override
public ExternalAppResultDTO add(String appName, String customerId, String customerType) {
@ -184,8 +189,11 @@ public class ExternalAppServiceImpl implements ExternalAppService {
public String resetSecret(String appId) {
String secret = genSecret();
if (externalAppSecretDao.updateSecret(appId, secret) > 0) {
// 删除外部应用的秘钥缓存,再次使用的时候将主动加载入缓存
redisUtils.delete(RedisKeys.getExternalAppSecretKey(appId));
return secret;
}
return null;
}

2
epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml

@ -19,7 +19,7 @@
<update id="updateSecret">
update external_app_secret
set SECRET=#{secret}
where ID = #{appId}
where APP_ID = #{appId}
</update>
<select id="getSecretsByAppId" resultType="com.epmet.entity.ExternalAppSecretEntity">

Loading…
Cancel
Save