|
@@ -4,7 +4,11 @@ package com.pj.project4sp.admin4login;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
+import com.pj.project4sp.admin.SpLoginInfo;
|
|
|
+import com.pj.utils.cache.RedisUtil;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
@@ -90,16 +94,20 @@ public class SpAccAdminService {
|
|
|
return AjaxJson.getError("此账号已被禁用,如有疑问,请联系管理员");
|
|
|
}
|
|
|
|
|
|
- // =========== 至此, 已登录成功 ============
|
|
|
+ // =========== 至此, 已登录成功 ============
|
|
|
successLogin(admin);
|
|
|
StpUtil.login(admin.getId());
|
|
|
// 组织返回参数
|
|
|
+ SpLoginInfo spLoginInfo = new SpLoginInfo();
|
|
|
+ BeanUtils.copyProperties(admin,spLoginInfo);
|
|
|
SoMap map = new SoMap();
|
|
|
map.put("admin", admin);
|
|
|
List<String> per_list = spRolePermissionService.getPcodeByRid2(admin.getRoleId());
|
|
|
map.put("per_list", per_list);
|
|
|
map.put("tokenInfo", StpUtil.getTokenInfo());
|
|
|
StpUserUtil.cachePerList(per_list);
|
|
|
+ // 记录登录信息至redis
|
|
|
+ RedisUtil.set("loginInfo:", JSONUtil.toJsonStr(spLoginInfo));
|
|
|
return AjaxJson.getSuccessData(map);
|
|
|
}
|
|
|
|