@@ -9,6 +9,7 @@ using Learun.Application.WeChat; | |||||
using System.Configuration; | using System.Configuration; | ||||
using System.IO; | using System.IO; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | |||||
namespace Learun.Application.Organization | 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); | |||||
} | |||||
} | |||||
} | |||||
///// <summary> | ///// <summary> | ||||
///// 获取用户头像 | ///// 获取用户头像 | ||||
///// </summary> | ///// </summary> | ||||
@@ -210,5 +210,8 @@ namespace Learun.Application.Organization | |||||
/// <param name="oldPassword"></param> | /// <param name="oldPassword"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
bool RevisePasswordiden(string newPassword, string oldPassword); | bool RevisePasswordiden(string newPassword, string oldPassword); | ||||
UserEntity GetEntityByOldAccount(string account); | |||||
} | } | ||||
} | } |
@@ -39,7 +39,32 @@ namespace Learun.Application.Organization | |||||
strSql.Append("SELECT "); | strSql.Append("SELECT "); | ||||
strSql.Append(fieldSql); | strSql.Append(fieldSql); | ||||
strSql.Append(" FROM LR_Base_User t "); | 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<UserEntity>(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<UserEntity>(strSql.ToString(), new { account = account }); | return this.BaseRepository().FindEntity<UserEntity>(strSql.ToString(), new { account = account }); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -208,7 +233,7 @@ namespace Learun.Application.Organization | |||||
keyword = "%" + keyword + "%"; | 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 ) "); | 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<UserEntity>(strSql.ToString(), new { companyId, departmentId, keyword }, pagination); | return this.BaseRepository().FindList<UserEntity>(strSql.ToString(), new { companyId, departmentId, keyword }, pagination); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -519,7 +519,7 @@ namespace Learun.Application.Web.Controllers | |||||
//} | //} | ||||
#region 内部账户验证 | #region 内部账户验证 | ||||
UserEntity userEntity = userBll.CheckLogin(username, password); | |||||
UserEntity userEntity = userBll.CheckLogin($"N{username}", password); | |||||
#region 写入日志 | #region 写入日志 | ||||
@@ -621,7 +621,7 @@ namespace Learun.Application.WebApi.Modules.Feixing | |||||
string account = Request.Query["account"]; | string account = Request.Query["account"]; | ||||
string password = Request.Query["password"]; | 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); | var empinfoEntity = empInfoIbll.GetEmpInfoEntityByEmpNo(userEntity.F_Account); | ||||
msg = userEntity.LoginMsg; | msg = userEntity.LoginMsg; | ||||
if (userEntity.LoginOk && empinfoEntity != null) | if (userEntity.LoginOk && empinfoEntity != null) | ||||
@@ -100,7 +100,7 @@ namespace Learun.Application.WebApi | |||||
var loginModel = this.GetReqData<TLoginModel>(); | var loginModel = this.GetReqData<TLoginModel>(); | ||||
#region 内部账户验证 | #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)//登录失败 | if (!userEntity.LoginOk)//登录失败 | ||||
{ | { | ||||
@@ -56,15 +56,15 @@ namespace Learun.Application.WebApi | |||||
LoginModel loginModel = this.GetReqData<LoginModel>(); | LoginModel loginModel = this.GetReqData<LoginModel>(); | ||||
#region 内部账户验证 | #region 内部账户验证 | ||||
UserEntity userEntity = userIBLL.CheckLogin(loginModel.username, loginModel.password); | |||||
UserEntity userEntity = userIBLL.CheckLogin($"N{loginModel.username}", loginModel.password); | |||||
#region 写入日志 | #region 写入日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_CategoryId = 1; | logEntity.F_CategoryId = 1; | ||||
logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); | logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); | ||||
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login); | 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_Module = Config.GetValue("SoftName"); | ||||
logEntity.F_Description = "移动端"; | logEntity.F_Description = "移动端"; | ||||
#endregion | #endregion | ||||
@@ -185,7 +185,7 @@ namespace Learun.Application.WebApi.Modules | |||||
LoginModel loginModel = this.GetReqData<LoginModel>(); | LoginModel loginModel = this.GetReqData<LoginModel>(); | ||||
#region 内部账户验证 | #region 内部账户验证 | ||||
UserEntity userEntity = userIbll.CheckLogin(loginModel.username, loginModel.password); | |||||
UserEntity userEntity = userIbll.CheckLogin($"N{loginModel.username}", loginModel.password); | |||||
#region 写入日志 | #region 写入日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
@@ -279,6 +279,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
if(keyValue.StartsWith("N")) | |||||
{ | |||||
keyValue=keyValue.Substring(1); | |||||
} | |||||
return this.BaseRepository("CollegeMIS").FindEntity<EmpInfoEntity>(m => m.EmpNo == keyValue); | return this.BaseRepository("CollegeMIS").FindEntity<EmpInfoEntity>(m => m.EmpNo == keyValue); | ||||
} | } | ||||
catch (Exception ex) | 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<UserEntity>(); | var studentList = new List<UserEntity>(); | ||||
foreach (var tEntity in teacherList) | 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; | continue; | ||||
} | } | ||||
@@ -448,10 +453,10 @@ sum(case when DATEDIFF(YYYY, t.Birthday, GETDATE()) > 20 and DATEDIFF(YYYY, t.Bi | |||||
} | } | ||||
UserEntity userbase = new UserEntity(); | 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_RealName = tEntity.EmpName; | ||||
userbase.F_EnCode = tEntity.EmpNo; | |||||
userbase.F_EnCode = empNo; | |||||
userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); | userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); | ||||
userbase.F_HeadIcon = string.IsNullOrEmpty(url) ? Config.GetValue("defaultheadimg") : url; | userbase.F_HeadIcon = string.IsNullOrEmpty(url) ? Config.GetValue("defaultheadimg") : url; | ||||
userbase.F_Gender = tEntity.GenderNo.HasValue ? Convert.ToInt32(tEntity.GenderNo.Value) : 1; | userbase.F_Gender = tEntity.GenderNo.HasValue ? Convert.ToInt32(tEntity.GenderNo.Value) : 1; | ||||
@@ -328,6 +328,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
if (enCode.StartsWith("N")) | |||||
{ | |||||
enCode = enCode.Substring(1); | |||||
} | |||||
var data = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(a => a.StuNo == enCode); | var data = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(a => a.StuNo == enCode); | ||||
//if (data != null && (data.Photo != null && data.Photo != "")) | //if (data != null && (data.Photo != null && data.Photo != "")) | ||||
//{ | //{ | ||||
@@ -983,6 +987,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
UserEntity userbase = new UserEntity(); | UserEntity userbase = new UserEntity(); | ||||
userbase.F_Account = tEntity.StuNo; | userbase.F_Account = tEntity.StuNo; | ||||
userbase.N_Account = $"N{tEntity.StuNo}"; | |||||
userbase.F_RealName = tEntity.StuName; | userbase.F_RealName = tEntity.StuName; | ||||
userbase.F_EnCode = tEntity.StuNo; | userbase.F_EnCode = tEntity.StuNo; | ||||
userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); | userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); | ||||
@@ -301,7 +301,8 @@ namespace Learun.Util.Operat | |||||
userInfo.token = operatorInfo.token; | userInfo.token = operatorInfo.token; | ||||
userInfo.account = operatorInfo.account; | 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) | if (userEntity != null) | ||||
{ | { | ||||
userInfo.userId = userEntity.F_UserId; | userInfo.userId = userEntity.F_UserId; | ||||