提交 988ddc0d authored 作者: 李秋林's avatar 李秋林

促销后台员工登录token修改为gateway解析同一个逻辑

上级 9c932923
package com.wangxiaolu.promotion.service.user.impl; package com.wangxiaolu.promotion.service.user.impl;
import cn.hutool.core.lang.UUID;
import com.wangxiaolu.promotion.common.constant.TokenConstants;
import com.wangxiaolu.promotion.common.redis.RedisKeys; import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache; import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.common.util.JwtTokenUtils;
import com.wangxiaolu.promotion.common.util.JwtUtils; import com.wangxiaolu.promotion.common.util.JwtUtils;
import com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao; import com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper; import com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper;
...@@ -14,7 +17,9 @@ import org.springframework.beans.BeanUtils; ...@@ -14,7 +17,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author : liqiulin * @author : liqiulin
...@@ -33,9 +38,16 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic ...@@ -33,9 +38,16 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic
@Override @Override
public LoginVo employeeLoginVerify(UserLoginParam userLoginParam) { public LoginVo employeeLoginVerify(UserLoginParam userLoginParam) {
ManageEmployeeInfoDto employeeDto = manageEmployeeInfoDao.loginByEmployeeNo(userLoginParam.getLoginName(),userLoginParam.getPassword()); ManageEmployeeInfoDto employeeDto = manageEmployeeInfoDao.loginByEmployeeNo(userLoginParam.getLoginName(),userLoginParam.getPassword());
String loginToken = jwtUtils.getEmployeeToken(userLoginParam.getLoginName(), userLoginParam.getPassword()); String token = UUID.fastUUID().toString();
redisCache.addToJsonToMinute(RedisKeys.UserKeys.TEMPORARY_TOKEN.getKey()+loginToken,employeeDto,360); // Jwt存储信息
LoginVo loginVo = new LoginVo<>(employeeDto,loginToken); Map<String, Object> claimsMap = new HashMap<String, Object>();
claimsMap.put(TokenConstants.USER_KEY, token);
claimsMap.put(TokenConstants.DETAILS_USER_ID, employeeDto.getId());
claimsMap.put(TokenConstants.DETAILS_USERNAME, employeeDto.getName());
String temporaryToken = JwtTokenUtils.createToken(claimsMap);
redisCache.addToJsonToMinute(RedisKeys.UserKeys.TEMPORARY_TOKEN.getKey() + token, employeeDto, 1080);
LoginVo loginVo = new LoginVo<>(employeeDto,temporaryToken);
return loginVo; return loginVo;
} }
......
...@@ -12,8 +12,6 @@ import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto; ...@@ -12,8 +12,6 @@ import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.LoginVo; import com.wangxiaolu.promotion.pojo.user.vo.LoginVo;
import com.wangxiaolu.promotion.result.basedata.RCode; import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserQueryService; import com.wangxiaolu.promotion.service.wechat.WeChatUserQueryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论