From acc77d801f70fce9646859cd6f30b9600cdab55e Mon Sep 17 00:00:00 2001 From: dengyu Date: Mon, 31 Jul 2023 19:36:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=80=9A=E8=BF=87appsett?= =?UTF-8?q?ing=E7=9A=84companysetting-singlelogin=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AE=E6=98=AF=E5=90=A6=E5=8F=AA=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E5=8D=95=E7=99=BB=E9=99=86=E3=80=82false=E4=B8=BA?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E9=87=8D=E5=A4=8D=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vue.Net/VOL.Core/UserManager/UserContext.cs | 16 +++++++++++ .../System/Partial/Sys_UserService.cs | 28 +++++++++++++++---- Vue.Net/VOL.WebApi/appsettings.json | 2 +- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Vue.Net/VOL.Core/UserManager/UserContext.cs b/Vue.Net/VOL.Core/UserManager/UserContext.cs index 9d197812..248b17c2 100644 --- a/Vue.Net/VOL.Core/UserManager/UserContext.cs +++ b/Vue.Net/VOL.Core/UserManager/UserContext.cs @@ -14,6 +14,7 @@ using VOL.Core.Extensions.AutofacManager; using VOL.Entity; using VOL.Entity.DomainModels; using ConvertHelper; +using Microsoft.EntityFrameworkCore.Metadata.Internal; namespace VOL.Core.ManageUser { @@ -408,5 +409,20 @@ namespace VOL.Core.ManageUser { CacheService.Remove(userId.GetUserIdKey()); } + + public bool HaveLogin(Guid userId) + { + var uid = userId.GetUserIdKey(); + var _r = CacheService.Get(uid); + if (_r != null) + { + return true; + } + else{ + return false; + } + } + + } } diff --git a/Vue.Net/VOL.System/Services/System/Partial/Sys_UserService.cs b/Vue.Net/VOL.System/Services/System/Partial/Sys_UserService.cs index d49c3e99..3f65751c 100644 --- a/Vue.Net/VOL.System/Services/System/Partial/Sys_UserService.cs +++ b/Vue.Net/VOL.System/Services/System/Partial/Sys_UserService.cs @@ -12,6 +12,8 @@ using VOL.Core.Services; using VOL.Core.Utilities; using VOL.Entity.DomainModels; using ConvertHelper; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using VOL.Core.CacheManager; namespace VOL.System.Services { @@ -50,6 +52,27 @@ namespace VOL.System.Services if (user == null || loginInfo.PassWord.Trim() != user.UserPwd) return responseContent.Error(ResponseType.LoginError); + //if(UserContext.GetUser) + + if (UserContext.Current.HaveLogin(user.User_Id)) + { + if (!AppSetting.CompanySetting.SingleLogin) + { + //UserContext.Current + responseContent.Data = UserContext.Current.GetUserInfo(user.User_Id); + return responseContent.OK(ResponseType.LoginSuccess ); + } + else + { + UserContext.Current.LogOut(user.User_Id); + loginInfo.PassWord = string.Empty; + } + } + else { + UserContext.Current.LogOut(user.User_Id); + loginInfo.PassWord = string.Empty; + } + string token = JwtHelper.IssueJwt(new UserInfo() { User_Id = user.User_Id, @@ -70,12 +93,7 @@ namespace VOL.System.Services }; repository.Update(user, x => x.Token, true); - if (AppSetting.CompanySetting.SingleLogin) { - UserContext.Current.LogOut(user.User_Id); - } - - loginInfo.PassWord = string.Empty; return responseContent.OK(ResponseType.LoginSuccess); } diff --git a/Vue.Net/VOL.WebApi/appsettings.json b/Vue.Net/VOL.WebApi/appsettings.json index 04637e5a..0ecd4a6f 100644 --- a/Vue.Net/VOL.WebApi/appsettings.json +++ b/Vue.Net/VOL.WebApi/appsettings.json @@ -103,7 +103,7 @@ //"COMPANYNAME": "HUAGANG", //华港通运 "COMPANYNAME": "JGWL", //青岛金港物流 //"COMPANYNAME": "QSSD",//全盛时代 - "SingleLogin": "false", //出库执行时允许超量出库 + "SingleLogin": "false", //是否只允许单个登陆(是否新的登陆踢掉旧的登陆) "CanOutMore": "true", //出库执行时允许超量出库 "NegativeStockFee": "true", //负数库存在完全出清前是否参与计算 "FEEInDay": "true", //仓储费按日精确到分; From 6cb7590896d08fc194f09b49a37f7e68d70f0edb Mon Sep 17 00:00:00 2001 From: dengyu Date: Tue, 1 Aug 2023 14:12:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=97=B6userid?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E5=9C=A8=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=9B=BA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/ViewGridConfig/methods.js | 16 ++++++------- Vol.Vue/src/lang/en.js | 2 ++ .../Partial/Sys_USERCOLUMNSETService.cs | 23 ++++++++++--------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Vol.Vue/src/components/basic/ViewGridConfig/methods.js b/Vol.Vue/src/components/basic/ViewGridConfig/methods.js index 91e9949d..dfce63f9 100644 --- a/Vol.Vue/src/components/basic/ViewGridConfig/methods.js +++ b/Vol.Vue/src/components/basic/ViewGridConfig/methods.js @@ -1927,14 +1927,14 @@ let methods = { // let GetUSERCOLUMNUrl = "api/Sys_USERCOLUMNSET/GetPageData"; - let userInfo = this.$store.getters.getUserInfo(); - let userid = userInfo.userId; - - let wheres = [{ - Name: "USERID", - Value: userid, - displayType: '=' - }]; + // let userInfo = this.$store.getters.getUserInfo(); + // let userid = userInfo.userId; + let wheres = []; + // let wheres = [{ + // Name: "USERID", + // Value: userid, + // displayType: '=' + // }]; // if (!this.isNullorEmpty(Menu_Id)) { // wheres.push({ Name: "Menu_Id", Value: Menu_Id, displayType: '=' }); // } else { diff --git a/Vol.Vue/src/lang/en.js b/Vol.Vue/src/lang/en.js index 449e5f58..82d8c3eb 100644 --- a/Vol.Vue/src/lang/en.js +++ b/Vol.Vue/src/lang/en.js @@ -51,6 +51,8 @@ module.exports = { RULEAMOUNT: '申报金额', STOREHOUSE: '仓库', + STOREHOUSE_2: '备选仓库1', + STOREHOUSE_3: '备选仓库2', AREACODE: '库位', STOREHOUSENAME: '仓库', AREANAME: '库位', diff --git a/Vue.Net/VOL.System/Services/UserColumnSet/Partial/Sys_USERCOLUMNSETService.cs b/Vue.Net/VOL.System/Services/UserColumnSet/Partial/Sys_USERCOLUMNSETService.cs index 89d8b316..b6091a0f 100644 --- a/Vue.Net/VOL.System/Services/UserColumnSet/Partial/Sys_USERCOLUMNSETService.cs +++ b/Vue.Net/VOL.System/Services/UserColumnSet/Partial/Sys_USERCOLUMNSETService.cs @@ -93,17 +93,18 @@ namespace VOL.System.Services //如果查询条件没有指定userid 则userid为当前用户 //一般用户只能使用该方法;将来给管理员提供选择人员的位置 - if (!string.IsNullOrEmpty(options.Wheres)) - { - try - { - if (!searchParametersList.Exists(x => x.Name == "USERID")) - { - queryable = queryable.Where(x => x.USERID == UserContext.Current.UserInfo.User_Id); - } - } - catch { } - } + //if (!string.IsNullOrEmpty(options.Wheres)) + //{ + // try + // { + // if (!searchParametersList.Exists(x => x.Name == "USERID")) + // { + // queryable = queryable.Where(x => x.USERID == UserContext.Current.UserInfo.User_Id); + // } + // } + // catch { } + //} + queryable = queryable.Where(x => x.USERID == UserContext.Current.UserInfo.User_Id); return queryable; };