|
|
@@ -4,14 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import shop.alien.entity.result.R;
|
|
|
import shop.alien.entity.store.LifeSys;
|
|
|
+import shop.alien.entity.store.LifeSysMenu;
|
|
|
import shop.alien.entity.store.UserLoginInfo;
|
|
|
import shop.alien.entity.store.vo.SystemLoginVo;
|
|
|
import shop.alien.gateway.config.BaseRedisService;
|
|
|
+import shop.alien.gateway.feign.StoreServiceFeign;
|
|
|
import shop.alien.gateway.mapper.LifeSysGatewayMapper;
|
|
|
import shop.alien.gateway.service.SystemService;
|
|
|
import shop.alien.util.common.JwtUtil;
|
|
|
@@ -38,6 +41,9 @@ public class SystemServiceImpl implements SystemService {
|
|
|
|
|
|
private final LifeSysGatewayMapper lifeSysMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private final StoreServiceFeign storeServiceFeign;
|
|
|
+
|
|
|
private final BaseRedisService baseRedisService;
|
|
|
|
|
|
@Value("${jwt.expiration-time}")
|
|
|
@@ -78,6 +84,9 @@ public class SystemServiceImpl implements SystemService {
|
|
|
tokenMap.put("userName", lifeSys.getUserName());
|
|
|
tokenMap.put("userId", String.valueOf(lifeSys.getId()));
|
|
|
tokenMap.put("userType", "web");
|
|
|
+ R<List<LifeSysMenu>> menuByUserId = storeServiceFeign.getMenuByUserId(lifeSys.getId().longValue(), 1L);
|
|
|
+ List<LifeSysMenu> data = menuByUserId.getData();
|
|
|
+ tokenMap.put("menuList", JSONObject.toJSONString(data));
|
|
|
//存入token
|
|
|
result.setToken(JwtUtil.createJWT("web_" + lifeSys.getId(), lifeSys.getUserName(), JSONObject.toJSONString(tokenMap), effectiveTimeIntLong));
|
|
|
baseRedisService.setString("web_" + lifeSys.getUserName(), result.getToken());
|
|
|
@@ -85,6 +94,8 @@ public class SystemServiceImpl implements SystemService {
|
|
|
result.setResult(true);
|
|
|
//角色Id
|
|
|
result.setRoleId(lifeSys.getRoleId());
|
|
|
+ //菜单列表
|
|
|
+ result.setMenuList(data);
|
|
|
//登录结果
|
|
|
result.setMessage("登录成功!!");
|
|
|
} else {
|