Commit 4e704a7f authored by 黄奎's avatar 黄奎

页面修改

parent b03f9d31
......@@ -44,5 +44,10 @@ namespace Edu.Model.ViewModel.User
return Common.ConvertHelper.StringToList(this.RoleAuth);
}
}
/// <summary>
/// 管理者账号
/// </summary>
public string ManagerAccount { get; set; }
}
}
using Edu.Common.Enum;
using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Common.Enum.User;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.User;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using VT.FW.DB;
......@@ -16,6 +20,11 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_ManagerRepository managerRepository = new RB_ManagerRepository();
/// <summary>
/// 账号处理类
/// </summary>
private readonly AccountModule accountModule = new AccountModule();
/// <summary>
/// 获取管理者列表
/// </summary>
......@@ -74,7 +83,7 @@ namespace Edu.Module.User
/// </summary>
/// <param name="MId"></param>
/// <returns></returns>
public RB_Manager_ViewModel GetManagerModule(object MId)
public RB_Manager_ViewModel GetManagerModule(int MId)
{
return managerRepository.GetEntity<RB_Manager_ViewModel>(MId);
}
......@@ -85,13 +94,73 @@ namespace Edu.Module.User
/// <param name="MId"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveManagerModule(int MId,int Status)
public bool RemoveManagerModule(int MId, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
bool flag = false;
var model = GetManagerModule(MId);
if (model != null && model.MId > 0)
{
{nameof(RB_Manager_ViewModel.Status), Status}
};
bool flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), MId));
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Manager_ViewModel.Status), Status}
};
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), MId));
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
AccountId = model.MId,
Account = model.MTel,
AccountType = AccountTypeEnum.Admin
});
if (accountList != null && accountList.Count > 0)
{
flag = accountModule.SetAccountStatusModule(new RB_Account_ViewModel()
{
AccountType = AccountTypeEnum.Admin,
AccountId = model.MId,
UpdateTime = DateTime.Now,
Status = (DateStateEnum)Status
});
}
}
return flag;
}
/// <summary>
/// 创建管理者账号
/// </summary>
/// <param name="MId"></param>
/// <param name="user"></param>
/// <returns></returns>
[TransactionCallHandler]
public bool CreateManagerAccountModule(int MId, UserInfo user)
{
bool flag = false;
var model = GetManagerModule(MId);
if (model != null && model.MId > 0)
{
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
Account = model.MTel,
AccountType = AccountTypeEnum.Admin
});
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
Account = model.MTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd),
AccountType = AccountTypeEnum.Admin,
AccountId = model.MId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
Status=model.Status,
});
}
}
return flag;
}
}
......
......@@ -139,7 +139,7 @@ namespace Edu.Module.User
/// <param name="StuId"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveStudentModule(int StuId,int Status)
public bool RemoveStudentModule(int StuId, int Status)
{
bool flag = false;
var model = GetStudentModule(StuId);
......@@ -219,6 +219,7 @@ namespace Edu.Module.User
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
Status = model.Status
});
}
}
......
......@@ -68,8 +68,9 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.SName
SELECT A.*,B.SName,IFNULL(account.Account,'') ManagerAccount
FROM rb_manager AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId
LEFT JOIN rb_account AS account ON (A.MId=account.AccountId and account.AccountType=1)
WHERE 1=1
");
if (query != null)
......
......@@ -65,8 +65,7 @@ namespace Edu.WebApi.Controllers.User
RB_Account_ViewModel viewModel = JsonConvert.DeserializeObject<RB_Account_ViewModel>(RequestParm.Msg.ToString());
if (viewModel != null && viewModel.AccountType > 0 && viewModel.AccountId > 0)
{
int uid = 0;
if (int.TryParse(RequestParm.Uid,out uid))
if (int.TryParse(RequestParm.Uid, out int uid))
{
viewModel.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id;
var result = accountModule.SetResetPassword(viewModel);
......@@ -683,6 +682,18 @@ namespace Edu.WebApi.Controllers.User
var flag = managerModule.RemoveManagerModule(MId, Status);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 创建管理者账号
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CreateManagerAccount()
{
var MId = base.ParmJObj.GetInt("MId", 0);
var flag = managerModule.CreateManagerAccountModule(MId,base.UserInfo);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment