Commit e63610b3 authored by 吴春's avatar 吴春

提交okr个人看板

parent 13f6823a
......@@ -6106,6 +6106,244 @@ namespace Edu.Module.OKR
}
#endregion
/// <summary>
/// 获取个人维度打分以及目标量
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="id"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRPersonalAlignList(int group_Id, int periodId, string CreateBys)
{
return oKR_ObjectiveRepository.GetOKRPersonalAlignList(group_Id, periodId, CreateBys);
}
/// <summary>
/// 获取个人维度对齐量
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="id"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRPersonalRelationAlignList(int group_Id, int periodId, string CreateBys, int id)
{
return oKR_ObjectiveRepository.GetOKRPersonalRelationAlignList(group_Id, periodId, CreateBys, id);
}
/// <summary>
/// 获取左边人员列表
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<OKRPersonalDimension> GetOKRPersonalDimensionList(UserInfo userInfo)
{
var deptModel = departmentRepository.GetEntity(userInfo.DeptId);
List<int> UserIdList = new List<int>();
List<int> ParentIdList = new List<int>();
List<OKRPersonalDimension> allList = new List<OKRPersonalDimension>();
#region 我的直属上级
List<Model.ViewModel.User.Employee_ViewModel> ZSList = new List<Model.ViewModel.User.Employee_ViewModel>();
var accountModel = accountRepository.GetEntity(userInfo.Id);
if (accountModel.DirectSupervisor > 0)
{
var directModel = accountRepository.GetEmployeeInfo(accountModel.DirectSupervisor);
allList.Add(new OKRPersonalDimension()
{
Id = directModel.Id,
EmployeeName = directModel.EmployeeName,
UserIcon = directModel.UserIcon,
Dept_Id = directModel.Dept_Id,
Type = 1
});
UserIdList.Add(directModel.Id);
ParentIdList.Add(directModel.Id);
}
else
{
//根据部门查询
string ManagerIds = "";
if (("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
//说明自己是当前部门的主管 再查上级部门主管
var deptpModel = departmentRepository.GetEntity(deptModel.ParentId);
ManagerIds = deptpModel?.ManagerIds ?? "";
}
else
{
ManagerIds = deptModel.ManagerIds;
}
if (!string.IsNullOrEmpty(ManagerIds))
{
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds });
foreach (var item in list)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 1
});
UserIdList.Add(item.Id);
ParentIdList.Add(item.Id);
}
}
}
#endregion
#region 我的直属下级
List<Model.ViewModel.User.Employee_ViewModel> ChildList = new List<Model.ViewModel.User.Employee_ViewModel>();
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = userInfo.Id });
if (emList.Any())
{
foreach (var item in emList)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
}
//如果是部门主管 需要将部门下除自己其他人加入
//查询部门负责人 负责的所有部门
var xjdlist = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, ManagerIds = userInfo.Id.ToString() });
if (xjdlist.Any())
{
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
}
#endregion
#region 我的同级
List<Model.ViewModel.User.Employee_ViewModel> SiblingList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (ParentIdList.Any())
{
var em2List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisorIds = string.Join(",", ParentIdList) });
em2List = em2List.Where(x => x.Id != userInfo.Id && !UserIdList.Contains(x.Id)).ToList();
foreach (var item in em2List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 3
});
UserIdList.Add(item.Id);
}
//查询部门负责人 负责的所有部门
var dlist = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, ManagerIds = string.Join(",", ParentIdList) });
if (dlist.Any())
{
if (!("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = string.Join(",", dlist.Select(x => x.DeptId)) });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 3
});
UserIdList.Add(item.Id);
}
}
else
{
//表示自己也是部门负责人 上级所在部门下的所有部门的负责人
var d2list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, QParentIds = string.Join(",", ZSList.Select(x => x.Dept_Id)) });
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QIds = ManagerIds });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 3
});
UserIdList.Add(item.Id);
}
}
}
}
}
else
{
//继续查询同部门的 也算同级
if (!("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = userInfo.DeptId });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 3
});
UserIdList.Add(item.Id);
}
}
}
#endregion
#region 我的关注
//List<Model.ViewModel.User.Employee_ViewModel> AttentionList = new List<Model.ViewModel.User.Employee_ViewModel>();
//var alist = oKR_AttentionRepository.GetList(new RB_OKR_Attention_ViewModel() { Group_Id = userInfo.Group_Id, AccountId = userInfo.Id });
//if (alist.Any())
//{
// string aids = string.Join(",", alist.Select(x => x.AttentionId));
// var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids });
// foreach (var item in em3List)
// {
// allList.Add(new OKRPersonalDimension()
// {
// Id = item.Id,
// EmployeeName = item.EmployeeName,
// UserIcon = item.UserIcon,
// Dept_Id = item.Dept_Id,
// Type = 3
// });
// UserIdList.Add(item.Id);
// }
//}
#endregion
return allList;
}
}
}
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