用户列表新增密码返回,响应优化,

parent 42e22b8c
......@@ -11,13 +11,16 @@ public class UserResponse
public int CreateUser { get; set; }
public string RealName { get; set; }
public string Login { get; set; }
public string Password { get; set; }
public string Mail { get; set; }
public string Mobile { get; set; }
public int States { get; set; }
public string Hospital { get; set; }
public int Role { get; set; }
public string Department { get; set; }
public int[] RoleArr { get; set; }
public string[] RoleNameArr { get; set; }
public string[] HospitalNameArr { get; set; }
}
}
......@@ -2118,55 +2118,55 @@ public List<SecPrintResponse> Print(int secondId)
#endregion 打印
public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId, out int isShowManage)
{
var user = userRepository.GetEntity(t => t.ID == userId);
if (user == null)
throw new NotImplementedException("人员ID无效");
//public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId, out int isShowManage)
//{
// var user = userRepository.GetEntity(t => t.ID == userId);
// if (user == null)
// throw new NotImplementedException("人员ID无效");
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
isShowManage = computeService.IsShowManage(allotId);
// var allot = perallotRepository.GetEntity(t => t.ID == allotId);
// isShowManage = computeService.IsShowManage(allotId);
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
Dictionary<int, string> dict = new Dictionary<int, string>
{
{ application.DirectorRole, AccountUnitType.科主任.ToString() },
{ application.NurseRole, AccountUnitType.护士长.ToString() },
{ application.OfficeRole, AccountUnitType.行政中层.ToString() },
{ application.SpecialRole, AccountUnitType.科主任.ToString() },
};
// var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
// var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
// Dictionary<int, string> dict = new Dictionary<int, string>
// {
// { application.DirectorRole, AccountUnitType.科主任.ToString() },
// { application.NurseRole, AccountUnitType.护士长.ToString() },
// { application.OfficeRole, AccountUnitType.行政中层.ToString() },
// { application.SpecialRole, AccountUnitType.科主任.ToString() },
// };
if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>();
// if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>();
var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]);
if (computes == null || !computes.Any()) return new List<SecondPerforResponse>();
// var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]);
// if (computes == null || !computes.Any()) return new List<SecondPerforResponse>();
var data = GetAllotPerformance(allotId, computes, isShowManage);
// 补充医院其他绩效
var result = AddAprAmount(allotId, data);
// var data = GetAllotPerformance(allotId, computes, isShowManage);
// // 补充医院其他绩效
// var result = AddAprAmount(allotId, data);
// 预留比例
if (result != null)
{
var empDic = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
foreach (var item in result)
{
item.PerforSumFee = Math.Round(item.PerforSumFee ?? 0, 0, MidpointRounding.AwayFromZero);
item.PerforManagementFee = Math.Round(item.PerforManagementFee ?? 0, 0, MidpointRounding.AwayFromZero);
var real = Math.Round((item.PerforSumFee ?? 0) + (item.PerforManagementFee ?? 0), 0) * item.Adjust + (item.AdjustLaterOtherFee ?? 0);
item.OthePerfor = Math.Round(item.OthePerfor ?? 0, 0, MidpointRounding.AwayFromZero);
item.NightWorkPerfor = Math.Round(item.NightWorkPerfor ?? 0, 0, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round((real ?? 0) + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0), 0, MidpointRounding.AwayFromZero);
item.ReservedRatio = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatioFee = Math.Round((real ?? 0) * (item.ReservedRatio ?? 0), 0, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 0, MidpointRounding.AwayFromZero);
}
}
// // 预留比例
// if (result != null)
// {
// var empDic = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
// foreach (var item in result)
// {
// item.PerforSumFee = Math.Round(item.PerforSumFee ?? 0, 0, MidpointRounding.AwayFromZero);
// item.PerforManagementFee = Math.Round(item.PerforManagementFee ?? 0, 0, MidpointRounding.AwayFromZero);
// var real = Math.Round((item.PerforSumFee ?? 0) + (item.PerforManagementFee ?? 0), 0) * item.Adjust + (item.AdjustLaterOtherFee ?? 0);
// item.OthePerfor = Math.Round(item.OthePerfor ?? 0, 0, MidpointRounding.AwayFromZero);
// item.NightWorkPerfor = Math.Round(item.NightWorkPerfor ?? 0, 0, MidpointRounding.AwayFromZero);
// item.ShouldGiveFee = Math.Round((real ?? 0) + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0), 0, MidpointRounding.AwayFromZero);
// item.ReservedRatio = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
// item.ReservedRatioFee = Math.Round((real ?? 0) * (item.ReservedRatio ?? 0), 0, MidpointRounding.AwayFromZero);
// item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 0, MidpointRounding.AwayFromZero);
// }
// }
return result;
}
// return result;
//}
public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out int isShowManage)
{
......
......@@ -133,23 +133,31 @@ public sys_role GetUserFirstRole(int userId)
/// <returns></returns>
public List<UserResponse> GetUserList(int userID)
{
var userrole = _userroleRepository.GetEntity(t => t.UserID == userID);
if (userrole == null) throw new PerformanceException("用户未配置角色");
var role = _roleRepository.GetEntity(t => t.ID == userrole.RoleID);
if (role == null) throw new PerformanceException("用户角色不存在");
var userRoles = _userroleRepository.GetEntities();
var userHospitals = _userhospitalRepository.GetEntities();
var users = _userRepository.GetEntities();
var hospitals = _hospitalRepository.GetEntities();
var roles = _roleRepository.GetEntities();
var userrole = userRoles?.FirstOrDefault(t => t.UserID == userID);
if (userrole == null)
throw new PerformanceException("用户未配置角色");
var role = roles?.FirstOrDefault(t => t.ID == userrole.RoleID);
if (role == null)
throw new PerformanceException("用户角色不存在");
var result = new List<UserResponse>();
if (role.IsViewAllUsers == 2)
{
var userlist = _userRepository.GetEntities(t => t.CreateUser == userID && t.IsDelete == 1 && (t.ParentID == 0 || t.ParentID == null));
var sonUser = _userRepository.GetEntities(t => t.ParentID != 0 && t.ParentID != null);
var userlist = users?.Where(t => t.CreateUser == userID && t.IsDelete == 1 && (t.ParentID == 0 || t.ParentID == null));
var sonUser = users?.Where(t => t.ParentID != 0 && t.ParentID != null);
if (sonUser != null)
foreach (var user in sonUser)
{
if (user.Department == "")
continue;
var parentUser = userlist.Find(t => t.ID == user.ParentID);
var parentUser = userlist.FirstOrDefault(t => t.ID == user.ParentID);
if (parentUser == null) continue;
parentUser.Department = user.Department;
}
......@@ -157,18 +165,18 @@ public List<UserResponse> GetUserList(int userID)
}
else
{
var hospitalIds = _userhospitalRepository.GetEntities(t => t.UserID == userID)?.Select(t => t.HospitalID);
var hospitalIds = userHospitals?.Where(t => t.UserID == userID)?.Select(t => t.HospitalID);
if (hospitalIds == null || !hospitalIds.Any()) return result;
var userIds = _userhospitalRepository.GetEntities(t => hospitalIds.Contains(t.HospitalID)).Select(t => t.UserID).Distinct();
var userlist = _userRepository.GetEntities(t => t.ID != userID && userIds.Contains(t.ID) && t.IsDelete == 1 && (t.ParentID == 0 || t.ParentID == null));
var sonUser = _userRepository.GetEntities(t => t.ParentID != 0 && t.ParentID != null);
var userIds = userHospitals?.Where(t => hospitalIds.Contains(t.HospitalID)).Select(t => t.UserID).Distinct();
var userlist = users?.Where(t => t.ID != userID && userIds.Contains(t.ID) && t.IsDelete == 1 && (t.ParentID == 0 || t.ParentID == null));
var sonUser = users?.Where(t => t.ParentID != 0 && t.ParentID != null);
if (sonUser != null)
foreach (var user in sonUser)
{
if (user.Department == "")
continue;
var parentUser = userlist.Find(t => t.ID == user.ParentID);
var parentUser = userlist.FirstOrDefault(t => t.ID == user.ParentID);
if (parentUser == null) continue;
parentUser.Department = user?.Department;
}
......@@ -178,32 +186,35 @@ public List<UserResponse> GetUserList(int userID)
{
foreach (var item in result)
{
var hoslist = _userhospitalRepository.GetEntities(p => p.UserID == item.UserID);
var hoslist = userHospitals?.Where(p => p.UserID == item.UserID);
if (hoslist != null && hoslist.Count() > 0)
{
item.Hospital = string.Join(",", hoslist.Select(p => p.HospitalID.Value));
var hosids = hoslist.Select(p => p.HospitalID.Value).ToList();
item.Hospital = string.Join(",", hosids);
item.HospitalNameArr = hospitals?.Where(w => hosids.Contains(w.ID)).Select(w => w.HosName).ToArray();
}
List<int> roleId = new List<int>();
var userRole = _userroleRepository.GetEntity(t => t.UserID == item.UserID);
var userRole = userRoles?.FirstOrDefault(t => t.UserID == item.UserID);
if (userRole != null)
{
item.Role = userRole.RoleID;
roleId.Add(userRole.RoleID);
}
var diffUserRole = _userRepository.GetEntities(c => c.ParentID == item.UserID);
var diffUserRole = users?.Where(c => c.ParentID == item.UserID);
if (diffUserRole != null)
{
foreach (var user in diffUserRole)
{
var diffRole = _userroleRepository.GetEntity(t => t.UserID == user.ID);
var diffRole = userRoles?.FirstOrDefault(t => t.UserID == user.ID);
roleId.Add(diffRole.RoleID);
}
}
item.RoleArr = roleId?.ToArray();
item.RoleNameArr = roles?.Where(w => roleId.Contains(w.ID)).Select(w => w.RoleName).ToArray();
}
}
return result;
......
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