fix:登入问题
This commit is contained in:
@@ -289,12 +289,6 @@
|
|||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>tlog-all-spring-boot-starter</artifactId>
|
<artifactId>tlog-all-spring-boot-starter</artifactId>
|
||||||
<version>1.5.0</version>
|
<version>1.5.0</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>tlog-hutool-http</artifactId>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package org.nl.common.utils;
|
|||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.wms.system_manage.service.user.dto.CurrentUser;
|
import org.nl.wms.system_manage.service.user.dto.CurrentUser;
|
||||||
|
|
||||||
@@ -24,19 +24,15 @@ public class SecurityUtils {
|
|||||||
*/
|
*/
|
||||||
public static CurrentUser getCurrentUser() {
|
public static CurrentUser getCurrentUser() {
|
||||||
try {
|
try {
|
||||||
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo");
|
return JSONObject.parseObject(String.valueOf(StpUtil.getExtra("loginInfo")),CurrentUser.class);
|
||||||
if (ObjectUtil.isNotEmpty(json)) {
|
|
||||||
return json.toBean(CurrentUser.class);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
CurrentUser currentUser = new CurrentUser();
|
CurrentUser currentUser = new CurrentUser();
|
||||||
currentUser.setId("1");
|
currentUser.setId("2");
|
||||||
currentUser.setPresonName("外部系统用户");
|
currentUser.setPresonName("外部系统用户");
|
||||||
currentUser.setUsername("admin");
|
currentUser.setUsername("admin");
|
||||||
return currentUser;
|
return currentUser;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +85,7 @@ public class SecurityUtils {
|
|||||||
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo");
|
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo");
|
||||||
JSONArray permissions = json.getJSONArray("permissions");
|
JSONArray permissions = json.getJSONArray("permissions");
|
||||||
if (permissions.size() > 0) {
|
if (permissions.size() > 0) {
|
||||||
return permissions.toList(String.class);
|
return permissions.toJavaList(String.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class HandLoginServiceImpl implements HandLoginService {
|
|||||||
// SaLoginModel 配置登录相关参数
|
// SaLoginModel 配置登录相关参数
|
||||||
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
||||||
.setDevice("PE") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
.setDevice("PE") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
.setExtra("loginInfo", JSONObject.toJSONString(user)) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 返回 token 与 用户信息
|
// 返回 token 与 用户信息
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtils redisUtils;
|
private RedisUtils redisUtils;
|
||||||
|
|
||||||
@Value("${sa-token.cookie.domain}")
|
|
||||||
private String domain;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> updateAvatar(MultipartFile multipartFile) {
|
public Map<String, String> updateAvatar(MultipartFile multipartFile) {
|
||||||
SysUser user = this.getOne(new QueryWrapper<SysUser>().eq("username", SecurityUtils.getCurrentUsername()));
|
SysUser user = this.getOne(new QueryWrapper<SysUser>().eq("username", SecurityUtils.getCurrentUsername()));
|
||||||
@@ -210,12 +207,11 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
|||||||
// SaLoginModel 配置登录相关参数
|
// SaLoginModel 配置登录相关参数
|
||||||
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
||||||
.setDevice("PC") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
.setDevice("PC") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
.setExtra("loginInfo", JSONObject.toJSONString(user)) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||||
);
|
);
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("token", StpUtil.getTokenValue());
|
result.put("token", StpUtil.getTokenValue());
|
||||||
result.put("roles", permissionList);
|
result.put("roles", permissionList);
|
||||||
result.put("domain", domain);
|
|
||||||
result.put("user", user);
|
result.put("user", user);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,9 +149,6 @@ sa-token:
|
|||||||
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
||||||
# token 前缀
|
# token 前缀
|
||||||
token-prefix:
|
token-prefix:
|
||||||
cookie:
|
|
||||||
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
|
|
||||||
domain:
|
|
||||||
is-read-cookie: false
|
is-read-cookie: false
|
||||||
is-print: false
|
is-print: false
|
||||||
schedulerFile: /Users/mima0000/Desktop/scheduler.xml
|
schedulerFile: /Users/mima0000/Desktop/scheduler.xml
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = {
|
|||||||
/**
|
/**
|
||||||
* @description token key
|
* @description token key
|
||||||
*/
|
*/
|
||||||
TokenKey: 'EL-ADMIN-TOEKN',
|
TokenKey: 'Authorization',
|
||||||
/**
|
/**
|
||||||
* @description 请求超时时间,毫秒(默认2分钟)
|
* @description 请求超时时间,毫秒(默认2分钟)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ const defaultForm = {
|
|||||||
code: '',
|
code: '',
|
||||||
bill_type: '',
|
bill_type: '',
|
||||||
status: '',
|
status: '',
|
||||||
product_area: '',
|
|
||||||
source_form_type: '',
|
source_form_type: '',
|
||||||
source_form_id: '',
|
source_form_id: '',
|
||||||
source_form_date: '',
|
source_form_date: '',
|
||||||
@@ -337,6 +336,14 @@ export default {
|
|||||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (!this.form.bill_type) {
|
||||||
|
this.crud.notify('单据类型不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!this.form.form_data.product_area) {
|
||||||
|
this.crud.notify('车间不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
this.form.item = this.tableData
|
this.form.item = this.tableData
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user