Browse Source

redis token

master
yinzuomei 3 years ago
parent
commit
7e1cc720ad
  1. 23
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  2. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java

23
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -746,14 +746,33 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
resDTO.setEpmetUserId("f838614e67cf8ae0edaefe562b6660e5");
//生成token串
Map<String, Object> map = new HashMap<>();
map.put("app", "resi");
map.put("client", "miniding");
map.put("app", AppClientConstant.APP_RESI);
map.put("client", AppClientConstant.MINI_DING);
map.put("userId", resDTO.getEpmetUserId());
String token = jwtTokenUtils.createToken(map);
resDTO.setAuthorization(token);
//4.存放Redis
this.saveTokenDtoDing(AppClientConstant.APP_RESI,AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), token, resDTO.getCustomerId());
} catch (ApiException e) {
throw new EpmetException(e.getErrMsg());
}
return resDTO;
}
private String saveTokenDtoDing(String app,String client, String userId, String token, String customerId) {
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(customerId);
tokenDto.setApp(AppClientConstant.APP_RESI);
tokenDto.setClient(AppClientConstant.MINI_DING);
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setUpdateTime(System.currentTimeMillis());
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
cpUserDetailRedis.set(tokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
return token;
}
}

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java

@ -32,6 +32,11 @@ public interface AppClientConstant {
*/
String CLIENT_WXMP = "wxmp";
/**
* 钉钉小程序
*/
String MINI_DING = "mini_ding";
/**
* 客户来源App
* */

Loading…
Cancel
Save