diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs index 3f1cecaa2..90261d1bc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs @@ -9,6 +9,7 @@ using Learun.Application.WeChat; using System.Configuration; using System.IO; using System.Linq; +using System.Text; namespace Learun.Application.Organization { @@ -1327,6 +1328,27 @@ namespace Learun.Application.Organization } } + public UserEntity GetEntityByOldAccount(string account) + { + try + { + UserEntity userEntity; + userEntity = userService.GetEntityByOldAccount(account); + return userEntity; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + ///// ///// 获取用户头像 ///// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs index 49626515a..1333391f5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs @@ -210,5 +210,8 @@ namespace Learun.Application.Organization /// /// bool RevisePasswordiden(string newPassword, string oldPassword); + + + UserEntity GetEntityByOldAccount(string account); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs index 84319a5aa..06ea4a415 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs @@ -39,7 +39,32 @@ namespace Learun.Application.Organization strSql.Append("SELECT "); strSql.Append(fieldSql); strSql.Append(" FROM LR_Base_User t "); - strSql.Append(" WHERE (t.F_Account = @account or t.N_Account=@account) AND t.F_DeleteMark = 0 "); + strSql.Append(" WHERE (t.N_Account=@account) AND t.F_DeleteMark = 0 "); + return this.BaseRepository().FindEntity(strSql.ToString(), new { account = account }); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + public UserEntity GetEntityByOldAccount(string account) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(fieldSql); + strSql.Append(" FROM LR_Base_User t "); + strSql.Append(" WHERE t.F_Account = @account AND t.F_DeleteMark = 0 "); return this.BaseRepository().FindEntity(strSql.ToString(), new { account = account }); } catch (Exception ex) @@ -208,7 +233,7 @@ namespace Learun.Application.Organization keyword = "%" + keyword + "%"; strSql.Append(" AND( t.F_Account like @keyword or t.F_RealName like @keyword or t.N_Account like @keyword or t.F_Mobile like @keyword ) "); } - + return this.BaseRepository().FindList(strSql.ToString(), new { companyId, departmentId, keyword }, pagination); } catch (Exception ex) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs index fa3d32db7..0a8c2464a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs @@ -519,7 +519,7 @@ namespace Learun.Application.Web.Controllers //} #region 内部账户验证 - UserEntity userEntity = userBll.CheckLogin(username, password); + UserEntity userEntity = userBll.CheckLogin($"N{username}", password); #region 写入日志 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Feixing/UserApiController.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Feixing/UserApiController.cs index ef3b36e23..85a46fb80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Feixing/UserApiController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Feixing/UserApiController.cs @@ -621,7 +621,7 @@ namespace Learun.Application.WebApi.Modules.Feixing string account = Request.Query["account"]; string password = Request.Query["password"]; //验证账户 - var userEntity = userIbll.CheckLogin(account, Md5Helper.Encrypt(password, 32)); + var userEntity = userIbll.CheckLogin($"N{account}", Md5Helper.Encrypt(password, 32)); var empinfoEntity = empInfoIbll.GetEmpInfoEntityByEmpNo(userEntity.F_Account); msg = userEntity.LoginMsg; if (userEntity.LoginOk && empinfoEntity != null) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TaiGang/TUserApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TaiGang/TUserApi.cs index 4b523dda8..79bf7af82 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TaiGang/TUserApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TaiGang/TUserApi.cs @@ -100,7 +100,7 @@ namespace Learun.Application.WebApi var loginModel = this.GetReqData(); #region 内部账户验证 - UserEntity userEntity = userIBLL.CheckLogin(loginModel.username, Md5Helper.Encrypt(loginModel.password, 32)); + UserEntity userEntity = userIBLL.CheckLogin($"N{loginModel.username}", Md5Helper.Encrypt(loginModel.password, 32)); if (!userEntity.LoginOk)//登录失败 { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs index 98c86fe48..546ebae07 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs @@ -56,15 +56,15 @@ namespace Learun.Application.WebApi LoginModel loginModel = this.GetReqData(); #region 内部账户验证 - UserEntity userEntity = userIBLL.CheckLogin(loginModel.username, loginModel.password); + UserEntity userEntity = userIBLL.CheckLogin($"N{loginModel.username}", loginModel.password); #region 写入日志 LogEntity logEntity = new LogEntity(); logEntity.F_CategoryId = 1; logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login); - logEntity.F_OperateAccount = loginModel.username + "(" + userEntity.F_RealName + ")"; - logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : loginModel.username; + logEntity.F_OperateAccount = $"N{loginModel.username}" + "(" + userEntity.F_RealName + ")"; + logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : $"N{loginModel.username}"; logEntity.F_Module = Config.GetValue("SoftName"); logEntity.F_Description = "移动端"; #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs index e84ebfb49..b8db33013 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs @@ -185,7 +185,7 @@ namespace Learun.Application.WebApi.Modules LoginModel loginModel = this.GetReqData(); #region 内部账户验证 - UserEntity userEntity = userIbll.CheckLogin(loginModel.username, loginModel.password); + UserEntity userEntity = userIbll.CheckLogin($"N{loginModel.username}", loginModel.password); #region 写入日志 LogEntity logEntity = new LogEntity(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs index 1ddb442ec..5bf8fb384 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EmpInfo/EmpInfoService.cs @@ -279,6 +279,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { + if(keyValue.StartsWith("N")) + { + keyValue=keyValue.Substring(1); + } return this.BaseRepository("CollegeMIS").FindEntity(m => m.EmpNo == keyValue); } catch (Exception ex) @@ -435,7 +439,8 @@ sum(case when DATEDIFF(YYYY, t.Birthday, GETDATE()) > 20 and DATEDIFF(YYYY, t.Bi var studentList = new List(); foreach (var tEntity in teacherList) { - if (alluserlist.Count(m => m.F_Account == tEntity.EmpNo) > 0) + var empNo = $"N{tEntity.EmpNo}"; + if (alluserlist.Count(m => m.N_Account == empNo) > 0) { continue; } @@ -448,10 +453,10 @@ sum(case when DATEDIFF(YYYY, t.Birthday, GETDATE()) > 20 and DATEDIFF(YYYY, t.Bi } UserEntity userbase = new UserEntity(); - userbase.F_Account = tEntity.EmpNo; - userbase.N_Account = tEntity.EmpNo; + userbase.F_Account = empNo; + userbase.N_Account = empNo; userbase.F_RealName = tEntity.EmpName; - userbase.F_EnCode = tEntity.EmpNo; + userbase.F_EnCode = empNo; userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); userbase.F_HeadIcon = string.IsNullOrEmpty(url) ? Config.GetValue("defaultheadimg") : url; userbase.F_Gender = tEntity.GenderNo.HasValue ? Convert.ToInt32(tEntity.GenderNo.Value) : 1; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs index 1dab84677..f9f4d2532 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs @@ -328,6 +328,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { + if (enCode.StartsWith("N")) + { + enCode = enCode.Substring(1); + } var data = this.BaseRepository("CollegeMIS").FindEntity(a => a.StuNo == enCode); //if (data != null && (data.Photo != null && data.Photo != "")) //{ @@ -983,6 +987,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration UserEntity userbase = new UserEntity(); userbase.F_Account = tEntity.StuNo; + userbase.N_Account = $"N{tEntity.StuNo}"; userbase.F_RealName = tEntity.StuName; userbase.F_EnCode = tEntity.StuNo; userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util.Operat/OperatorHelper.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util.Operat/OperatorHelper.cs index db1a8dda9..a5c62a47b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util.Operat/OperatorHelper.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util.Operat/OperatorHelper.cs @@ -301,7 +301,8 @@ namespace Learun.Util.Operat userInfo.token = operatorInfo.token; userInfo.account = operatorInfo.account; - UserEntity userEntity = userIBLL.GetEntityByAccount(operatorInfo.account); + //UserEntity userEntity = userIBLL.GetEntityByAccount(operatorInfo.account); + UserEntity userEntity = userIBLL.GetEntityByOldAccount(operatorInfo.account); if (userEntity != null) { userInfo.userId = userEntity.F_UserId;