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

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