Commit ca412231 authored by liudong1993's avatar liudong1993

OKR数据看板调整

parent 34d81ae3
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.OKR
{
/// <summary>
/// 事项类型枚举
/// </summary>
public enum MatterTypeEnum
{
/// <summary>
/// 未填写OKR
/// </summary>
[EnumField("未填写OKR")]
NotFilled = 1,
/// <summary>
/// 有OKR未更新进度
/// </summary>
[EnumField("有OKR未更新进度")]
NotUpdated = 2,
/// <summary>
/// 有OKR未打分
/// </summary>
[EnumField("有OKR未打分")]
NotScore = 3
}
}
......@@ -28,6 +28,26 @@ namespace Edu.Model.ViewModel.OKR
/// 目标数量
/// </summary>
public int ObjectiveNum { get; set; }
/// <summary>
/// 目标数量
/// </summary>
public int ObjectiveNum1 { get; set; }
/// <summary>
/// 目标数量
/// </summary>
public int ObjectiveNum2 { get; set; }
/// <summary>
/// 目标数量
/// </summary>
public int ObjectiveNum3 { get; set; }
/// <summary>
/// 目标数量
/// </summary>
public int ObjectiveNum4 { get; set; }
/// <summary>
/// 目标数量
/// </summary>
public int ObjectiveNum5 { get; set; }
/// <summary>
/// 目标创建人
......@@ -102,6 +122,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public string EmPhoto { get; set; }
/// <summary>
/// 部门id
/// </summary>
public int RB_Department_Id { get; set; }
/// <summary>
/// 部门名称
/// </summary>
......
......@@ -23,6 +23,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public int IsSelectLevelNor { get; set; }
/// <summary>
/// 离职状态
/// </summary>
public int LeaveStatus { get; set; }
/// <summary>
/// 学校名称
/// </summary>
......
......@@ -13,6 +13,7 @@ using System.Linq;
using VT.FW.DB;
using System.Threading;
using System.Threading.Tasks;
using Edu.Model.ViewModel.User;
namespace Edu.Module.OKR
{
......@@ -1075,7 +1076,7 @@ namespace Edu.Module.OKR
}
if (elist.Any()) {
string empIds = string.Join(",", elist.Select(x => x.RelationId));
var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds });
var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds, IsLeave = 1 });
foreach (var item in elist) {
var emModel = e2list.Where(x => x.Id == item.RelationId).FirstOrDefault();
item.RelationName = emModel?.EmployeeName ?? "";
......@@ -1167,7 +1168,7 @@ namespace Edu.Module.OKR
public object GetOKRMyChildEmployeeList(UserInfo userInfo)
{
var UserIdList = GetMyUnderlingUserIdList(userInfo);
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = string.Join(",", UserIdList) });
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = string.Join(",", UserIdList), IsLeave = 1 });
return list.Select(x => new
{
x.Id,
......@@ -2725,7 +2726,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
List<int> MyUnderlingList = GetMyUnderlingUserIdList(userInfo);
//查询所有用户
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, EmployeeName = userName });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, EmployeeName = userName });
emList = emList.Where(x => x.Id != userInfo.Id).ToList();//排除自己查询
var DQUserId = emList.Select(x => x.Id).ToList();
//用户周期权限
......@@ -4455,7 +4456,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var peopleList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(rids))
{
peopleList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = rids });
peopleList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = rids, IsLeave = 1 });
}
var departmentList = new List<Model.ViewModel.User.RB_Department_ViewModel>();
if (!string.IsNullOrEmpty(bids))
......@@ -4718,7 +4719,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (!string.IsNullOrEmpty(ManagerIds))
{
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds });
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds, IsLeave = 1 });
foreach (var item in list)
{
ZSList.Add(new Model.ViewModel.User.Employee_ViewModel()
......@@ -4736,7 +4737,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
#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 });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id });
if (emList.Any())
{
foreach (var item in emList)
......@@ -4756,7 +4757,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
if (em1List.Any())
{
......@@ -4785,7 +4786,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QIds = ManagerIds });
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......@@ -4804,7 +4805,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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) });
var em2List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisorIds = string.Join(",", ParentIdList) });
em2List = em2List.Where(x => x.Id != userInfo.Id && !UserIdList.Contains(x.Id)).ToList();
foreach (var item in em2List)
{
......@@ -4822,7 +4823,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (dlist.Any())
{
//上级所在部门下 所有的普通成员
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = string.Join(",", dlist.Select(x => x.DeptId)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, 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)
{
......@@ -4840,7 +4841,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QIds = ManagerIds });
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......@@ -4864,7 +4865,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
//继续查询同部门的 也算同级
if (!sjdlist.Any())
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = userInfo.DeptId });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, 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)
{
......@@ -4885,7 +4886,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (alist.Any())
{
string aids = string.Join(",", alist.Select(x => x.AttentionId));
var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids });
var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids, IsLeave = 1 });
foreach (var item in em3List)
{
AttentionList.Add(new Model.ViewModel.User.Employee_ViewModel()
......@@ -4960,7 +4961,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="QDeptIds"></param>
/// <returns></returns>
public List<Model.ViewModel.User.Employee_ViewModel> GetDepartmentEmployeeList(int Group_Id, string QDeptIds) {
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, QDeptIds = QDeptIds });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, IsLeave = 1, QDeptIds = QDeptIds });
return em1List;
}
......@@ -4969,11 +4970,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<int> GetMyUnderlingUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0)
public List<int> GetMyUnderlingUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0, int leaveStatus =0)
{
List<int> UserIdList = new List<int>();
#region 我的直属下级
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = userInfo.Id, Dept_Id = DeptId, Post_Id = PostId });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id, Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
{
foreach (var item in emList)
......@@ -4987,7 +4988,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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)), Post_Id = PostId });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)), Post_Id = PostId ,LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
if (em1List.Any())
{
......@@ -5010,7 +5011,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, QIds = ManagerIds, Post_Id = PostId });
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......@@ -5022,6 +5023,77 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
return UserIdList;
}
/// <summary>
/// 获取我所有下级
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<int> GetMyAllDownlineUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0, int leaveStatus = 0)
{
List<int> UserIdList = new List<int>() { userInfo.Id };
#region 我的所有下级(部门层级所有人+直属人)
//如果是部门主管 需要将部门下除自己其他人加入
//查询部门负责人 负责的所有部门
var xjdlist = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { DeptId = DeptId, Group_Id = userInfo.Group_Id, ManagerIds = userInfo.Id.ToString() });
if (xjdlist.Any())
{
List<int> DeptIdList = new List<int>();
foreach (var item in xjdlist)
{
//查询出所有的部门
string DeptIds = departmentRepository.GetCurrentAndChildDepartmentIdsRepository(item.DeptId);
if (!string.IsNullOrEmpty(DeptIds))
{
DeptIdList.AddRange(JsonHelper.DeserializeObject<List<int>>("[" + DeptIds + "]"));
}
}
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", DeptIdList.Distinct()), Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
UserIdList.Add(item.Id);
}
//上级部门下所有子部门的负责人
var d2list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = string.Join(",", DeptIdList.Distinct()) });
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
UserIdList.Add(item.Id);
}
}
UserIdList = UserIdList.Distinct().ToList();
//查询这些人的直属人
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisorIds = string.Join(",", UserIdList), Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
{
foreach (var item in emList)
{
UserIdList.Add(item.Id);
}
}
}
else {
//非部门负责人 直接查直属
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id, Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
{
foreach (var item in emList)
{
UserIdList.Add(item.Id);
}
}
}
#endregion
return UserIdList.Distinct().ToList();
}
/// <summary>
/// 获取我的审核人员列表
/// </summary>
......@@ -5041,7 +5113,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (list.Any())
{
string emIds = string.Join(",", list.Select(x => x.CreateBy));
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds });
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds, IsLeave = 1 });
foreach (var item in emlist)
{
AuditList.Add(new
......@@ -5074,7 +5146,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
string emIds = string.Join(",", list.Select(x => x.CreateBy));
var unlist = oKR_UpdateNotificationRepository.GetList(new RB_OKR_UpdateNotification_ViewModel() { ReceiveId = userInfo.Id, UpdateByIds = emIds, State = 2 });
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds });
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds, IsLeave = 1 });
foreach (var item in emlist)
{
AlignList.Add(new
......@@ -5374,7 +5446,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
if (!string.IsNullOrEmpty(ManagerIds))
{
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds });
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds, IsLeave = 1 });
foreach (var item in list)
{
ZSList.Add(new Model.ViewModel.User.Employee_ViewModel()
......@@ -5391,7 +5463,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
#endregion
#region 我的直属下级
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = userInfo.Id });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id });
if (emList.Any())
{
foreach (var item in emList)
......@@ -5405,7 +5477,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, 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)
{
......@@ -5416,7 +5488,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
#region 我的同级
if (ParentIdList.Any())
{
var em2List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisorIds = string.Join(",", ParentIdList) });
var em2List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisorIds = string.Join(",", ParentIdList) });
em2List = em2List.Where(x => x.Id != userInfo.Id && !UserIdList.Contains(x.Id)).ToList();
foreach (var item in em2List)
{
......@@ -5429,7 +5501,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
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)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, 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)
{
......@@ -5443,7 +5515,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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 });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......@@ -5458,7 +5530,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
//继续查询同部门的 也算同级
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 });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, Dept_Id = userInfo.DeptId });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......@@ -5472,7 +5544,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (alist.Any())
{
string aids = string.Join(",", alist.Select(x => x.AttentionId));
var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids });
var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids, IsLeave = 1 });
foreach (var item in em3List)
{
UserIdList.Add(item.Id);
......@@ -5483,7 +5555,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
List<object> AlignList = new List<object>();
var list2 = oKR_ObjectiveRepository.GetOKRMyEmployeeAlignList(userInfo.Group_Id, periodId, userInfo.Id);
string emIds = string.Join(",", list2.Select(x => x.CreateBy));
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds });
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds, IsLeave = 1 });
foreach (var item in emlist)
{
UserIdList.Add(item.Id);
......@@ -7098,16 +7170,24 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="periodId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKRGRDateDistribution(int periodId, UserInfo userInfo, bool IsAdmin = false)
public object GetOKRGRDateDistribution(int periodId, int rangeType, int departId, int postId, int leaveStatus, UserInfo userInfo, bool IsAdmin = false)
{
var userIdList = new List<int>();
if (IsAdmin == false)
{
//首先查询用户的所有直属下级
userIdList = GetMyUnderlingUserIdList(userInfo);
if (rangeType == 1)
{
//查询该用户下所有的下级用户
userIdList = GetMyAllDownlineUserIdList(userInfo, departId, postId, leaveStatus);
}
else
{
//首先查询用户的所有直属下级
userIdList = GetMyUnderlingUserIdList(userInfo, departId, postId, leaveStatus);
}
}
else {
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, IsSelectLevelNor = 1 });
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = departId, IsSelectLevelNor = 1 });
userIdList = accountList.Select(x => x.Id).ToList();
}
......@@ -7292,16 +7372,29 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="userInfo"></param>
/// <param name="IsAdmin"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRGRDateDistributionDetail(int pageIndex, int pageSize, out long count, int periodId, int type, int startValue, int endValue, int orderBy, UserInfo userInfo, bool IsAdmin = false)
public List<RB_OKR_Objective_ViewModel> GetOKRGRDateDistributionDetail(int pageIndex, int pageSize, out long count, int periodId, int type, int startValue, int endValue, int orderBy, int rangeType, int departId, int postId, int leaveStatus, UserInfo userInfo, bool IsAdmin = false)
{
count = 0;
var userIdList = new List<int>();
if (IsAdmin == false)
{
//首先查询用户的所有直属下级
userIdList = GetMyUnderlingUserIdList(userInfo);
if (rangeType == 1)
{
//查询该用户下所有的下级用户
userIdList = GetMyAllDownlineUserIdList(userInfo, departId, postId, leaveStatus);
}
else
{
//首先查询用户的所有直属下级
userIdList = GetMyUnderlingUserIdList(userInfo, departId, postId, leaveStatus);
}
}
else
{
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = departId, IsSelectLevelNor = 1 });
userIdList = accountList.Select(x => x.Id).ToList();
}
string userIds = string.Join(",", userIdList);
string userIds = string.Join(",", userIdList.Distinct());
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
......@@ -7321,6 +7414,471 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
return RList;
}
/// <summary>
/// 获取个人数据分布明细 - 员工
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="periodId"></param>
/// <param name="type"></param>
/// <param name="startValue"></param>
/// <param name="endValue"></param>
/// <param name="orderBy"></param>
/// <param name="userInfo"></param>
/// <param name="IsAdmin"></param>
/// <returns></returns>
public object GetOKRGRDateDistributionDetail_V2(int pageIndex, int pageSize, out long count, int periodId, int type, int orderBy, int orderByNum, int rangeType, int departId, int postId, int leaveStatus, UserInfo userInfo, bool IsAdmin = false)
{
count = 0;
var userIdList = new List<int>();
if (IsAdmin == false)
{
if (rangeType == 1)
{
//查询该用户下所有的下级用户
userIdList = GetMyAllDownlineUserIdList(userInfo, departId, postId, leaveStatus);
}
else
{
//首先查询用户的所有直属下级
userIdList = GetMyUnderlingUserIdList(userInfo, departId, postId, leaveStatus);
}
}
else
{
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = departId, IsSelectLevelNor = 1 });
userIdList = accountList.Select(x => x.Id).ToList();
}
string userIds = string.Join(",", userIdList.Distinct());
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
case 1: //数量
RList = oKR_ObjectiveRepository.GetObjectiveNumPageList(pageIndex, pageSize, out count, periodId, 0, 0, orderBy, userIds, userInfo.Group_Id);
return RList.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
ObjectiveNumList = new List<int>() { x.ObjectiveNum }
});
case 2: //状态
RList = oKR_ObjectiveRepository.GetObjectiveStatePageList_V2(pageIndex, pageSize, out count, periodId, orderBy, orderByNum, userIds, userInfo.Group_Id);
return RList.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
ObjectiveNumList = new List<int>() { x.ObjectiveNum1, x.ObjectiveNum2, x.ObjectiveNum3 }
});
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressPageList_V2(pageIndex, pageSize, out count, periodId, orderBy, orderByNum, userIds, userInfo.Group_Id);
return RList.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
ObjectiveNumList = new List<int>() { x.ObjectiveNum1, x.ObjectiveNum2, x.ObjectiveNum3, x.ObjectiveNum4, x.ObjectiveNum5 }
});
case 4: //打分
RList = oKR_ObjectiveRepository.GetObjectiveScorePageList_V2(pageIndex, pageSize, out count, periodId, orderBy, orderByNum, userIds, userInfo.Group_Id);
return RList.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
ObjectiveNumList = new List<int>() { x.ObjectiveNum1, x.ObjectiveNum2, x.ObjectiveNum3, x.ObjectiveNum4, x.ObjectiveNum5 }
});
}
return RList;
}
/// <summary>
/// 获取个人数据分布明细 - 部门统计
/// </summary>
/// <param name="periodId"></param>
/// <param name="type"></param>
/// <param name="startValue"></param>
/// <param name="endValue"></param>
/// <param name="orderBy"></param>
/// <param name="rangeType"></param>
/// <param name="departId"></param>
/// <param name="postId"></param>
/// <param name="leaveStatus"></param>
/// <param name="userInfo"></param>
/// <param name="v"></param>
/// <returns></returns>
public object GetOKRGRDateDistributionForDepartment(int periodId, int type, int orderBy, int orderByNum, int departId, int postId, int leaveStatus, UserInfo userInfo, bool IsAdmin)
{
List<object> Rlist = new List<object>();
if (IsAdmin == false)
{
var xjdlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, ManagerIds = userInfo.Id.ToString() });
if (xjdlist.Any())
{
List<int> DeptIdList = new List<int>();
foreach (var item in xjdlist)
{
//查询出所有的部门
string DeptIds = departmentRepository.GetCurrentAndChildDepartmentIdsRepository(item.DeptId);
if (!string.IsNullOrEmpty(DeptIds))
{
DeptIdList.AddRange(JsonHelper.DeserializeObject<List<int>>("[" + DeptIds + "]"));
}
}
string DeptIdStr = string.Join(",", DeptIdList.Distinct());
//上级部门下所有子部门的负责人
var d2list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = DeptIdStr });
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
List<Model.ViewModel.User.Employee_ViewModel> ManagerList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(ManagerIds))
{
ManagerList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = postId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
}
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
case 1: //数量
RList = oKR_ObjectiveRepository.GetObjectiveNumListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 2: //状态
RList = oKR_ObjectiveRepository.GetObjectiveStateListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 4: //打分
RList = oKR_ObjectiveRepository.GetObjectiveScoreListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
}
//返回部门树形结构
foreach (var item in xjdlist) {
List<Model.ViewModel.User.Employee_ViewModel> ManagerList1 = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
List<int> ManagerIdList = JsonHelper.DeserializeObject<List<int>>("[" + item.ManagerIds + "]");
ManagerList1 = ManagerList.Where(x => ManagerIdList.Contains(x.Id)).ToList();
}
var rmodel = RList.Where(x => x.RB_Department_Id == item.DeptId).FirstOrDefault() ?? new RB_OKR_Objective_ViewModel();
int Number = type == 1 ? rmodel.ObjectiveNum : (rmodel.ObjectiveNum1 + rmodel.ObjectiveNum2 + rmodel.ObjectiveNum3 + rmodel.ObjectiveNum4 + rmodel.ObjectiveNum5);
List<int> ObjectiveNumList = new List<int>
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1) {
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4) {
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
Number,
ObjectiveNumList,
ChildList = GetChildDepartmentForDateDistribution(item, d2list, ManagerList, RList, type, orderBy, orderByNum)
});
}
}
else
{
//只查询自己部门
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, DeptId = userInfo.DeptId });
string DeptIdStr = userInfo.DeptId.ToString();
string ManagerIds = string.Join(",", dlist.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
List<Employee_ViewModel> ManagerList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(ManagerIds))
{
ManagerList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = postId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
}
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
case 1: //数量
RList = oKR_ObjectiveRepository.GetObjectiveNumListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 2: //状态
RList = oKR_ObjectiveRepository.GetObjectiveStateListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 4: //打分
RList = oKR_ObjectiveRepository.GetObjectiveScoreListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
}
//返回部门树形结构
foreach (var item in dlist)
{
List<Model.ViewModel.User.Employee_ViewModel> ManagerList1 = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
List<int> ManagerIdList = JsonHelper.DeserializeObject<List<int>>("[" + item.ManagerIds + "]");
ManagerList1 = ManagerList.Where(x => ManagerIdList.Contains(x.Id)).ToList();
}
var rmodel = RList.Where(x => x.RB_Department_Id == item.DeptId).FirstOrDefault() ?? new RB_OKR_Objective_ViewModel();
int Number = type == 1 ? rmodel.ObjectiveNum : (rmodel.ObjectiveNum1 + rmodel.ObjectiveNum2 + rmodel.ObjectiveNum3 + rmodel.ObjectiveNum4 + rmodel.ObjectiveNum5);
List<int> ObjectiveNumList = new List<int>
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
Number,
ObjectiveNumList,
ChildList = GetChildDepartmentForDateDistribution(item, dlist, ManagerList, RList, type, orderBy, orderByNum)
});
}
}
}
else {
if (departId > 0)
{
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, DeptId = departId });
string DeptIdStr = departId.ToString();
string ManagerIds = string.Join(",", dlist.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
List<Employee_ViewModel> ManagerList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(ManagerIds))
{
ManagerList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = postId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
}
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
case 1: //数量
RList = oKR_ObjectiveRepository.GetObjectiveNumListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 2: //状态
RList = oKR_ObjectiveRepository.GetObjectiveStateListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 4: //打分
RList = oKR_ObjectiveRepository.GetObjectiveScoreListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
}
//返回部门树形结构
foreach (var item in dlist)
{
List<Model.ViewModel.User.Employee_ViewModel> ManagerList1 = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
List<int> ManagerIdList = JsonHelper.DeserializeObject<List<int>>("[" + item.ManagerIds + "]");
ManagerList1 = ManagerList.Where(x => ManagerIdList.Contains(x.Id)).ToList();
}
var rmodel = RList.Where(x => x.RB_Department_Id == item.DeptId).FirstOrDefault() ?? new RB_OKR_Objective_ViewModel();
int Number = type == 1 ? rmodel.ObjectiveNum : (rmodel.ObjectiveNum1 + rmodel.ObjectiveNum2 + rmodel.ObjectiveNum3 + rmodel.ObjectiveNum4 + rmodel.ObjectiveNum5);
List<int> ObjectiveNumList = new List<int>
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
Number,
ObjectiveNumList,
ChildList = GetChildDepartmentForDateDistribution(item, dlist, ManagerList, RList, type, orderBy, orderByNum)
});
}
}
else {
//直接查询所有部门
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id });
if (dlist.Any())
{
string DeptIdStr = string.Join(",", dlist.Select(x => x.DeptId));
//上级部门下所有子部门的负责人
string ManagerIds = string.Join(",", dlist.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
List<Model.ViewModel.User.Employee_ViewModel> ManagerList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(ManagerIds))
{
ManagerList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = postId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
}
List<RB_OKR_Objective_ViewModel> RList = new List<RB_OKR_Objective_ViewModel>();
switch (type)
{
case 1: //数量
RList = oKR_ObjectiveRepository.GetObjectiveNumListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 2: //状态
RList = oKR_ObjectiveRepository.GetObjectiveStateListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
case 4: //打分
RList = oKR_ObjectiveRepository.GetObjectiveScoreListForDept(periodId, DeptIdStr, userInfo.Group_Id);
break;
}
//返回部门树形结构
var firstList = dlist.Where(x => x.ParentId == 0).ToList();
foreach (var item in firstList)
{
List<Model.ViewModel.User.Employee_ViewModel> ManagerList1 = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
List<int> ManagerIdList = JsonHelper.DeserializeObject<List<int>>("[" + item.ManagerIds + "]");
ManagerList1 = ManagerList.Where(x => ManagerIdList.Contains(x.Id)).ToList();
}
var rmodel = RList.Where(x => x.RB_Department_Id == item.DeptId).FirstOrDefault() ?? new RB_OKR_Objective_ViewModel();
int Number = type == 1 ? rmodel.ObjectiveNum : (rmodel.ObjectiveNum1 + rmodel.ObjectiveNum2 + rmodel.ObjectiveNum3 + rmodel.ObjectiveNum4 + rmodel.ObjectiveNum5);
List<int> ObjectiveNumList = new List<int>
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
Number,
ObjectiveNumList,
ChildList = GetChildDepartmentForDateDistribution(item, dlist, ManagerList, RList, type, orderBy, orderByNum)
});
}
}
}
}
return Rlist;
}
/// <summary>
/// 获取部门子集
/// </summary>
/// <param name="model"></param>
/// <param name="d2list"></param>
/// <param name="ManagerList"></param>
/// <param name="RList"></param>
/// <param name="type"></param>
/// <param name="orderBy"></param>
/// <param name="orderByNum"></param>
/// <returns></returns>
private object GetChildDepartmentForDateDistribution(RB_Department_ViewModel model, List<RB_Department_ViewModel> d2list, List<Employee_ViewModel> ManagerList, List<RB_OKR_Objective_ViewModel> RList, int type, int orderBy, int orderByNum)
{
List<object> Rlist = new List<object>();
var clist = d2list.Where(x => x.ParentId == model.DeptId).ToList();
foreach (var item in clist) {
List<Employee_ViewModel> ManagerList1 = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
List<int> ManagerIdList = JsonHelper.DeserializeObject<List<int>>("[" + item.ManagerIds + "]");
ManagerList1 = ManagerList.Where(x => ManagerIdList.Contains(x.Id)).ToList();
}
var rmodel = RList.Where(x => x.RB_Department_Id == item.DeptId).FirstOrDefault() ?? new RB_OKR_Objective_ViewModel();
int Number = type == 1 ? rmodel.ObjectiveNum : (rmodel.ObjectiveNum1 + rmodel.ObjectiveNum2 + rmodel.ObjectiveNum3 + rmodel.ObjectiveNum4 + rmodel.ObjectiveNum5);
List<int> ObjectiveNumList = new List<int>
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
Number,
ObjectiveNumList,
ChildList = GetChildDepartmentForDateDistribution(item, d2list, ManagerList, RList, type, orderBy, orderByNum)
});
}
return Rlist;
}
#endregion
#region 春姐 统计
......@@ -7362,7 +7920,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
List<int> UserIdList = new List<int>();
List<OKRPersonalDimension> allList = new List<OKRPersonalDimension>();
#region 我的直属下级
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, DirectSupervisor = Id, Dept_Id = DeptId });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, IsLeave = 1, DirectSupervisor = Id, Dept_Id = DeptId });
if (emList.Any())
{
foreach (var item in emList)
......@@ -7384,7 +7942,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (xjdlist.Any())
{
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, IsLeave = 1, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
if (em1List.Any())
{
......@@ -7416,7 +7974,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, QIds = ManagerIds });
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, IsLeave = 1, QIds = ManagerIds });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
......
......@@ -528,6 +528,24 @@ where e.RB_Group_id={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds)
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveNumListForDept(int periodId, string deptIds, int group_Id)
{
string sql = $@"
select t.RB_Department_Id,count(0) as ObjectiveNum,
sum(case when t.ObjectiveNum=0 then 1 else 0 end) as ObjectiveNum1,
sum(case when t.ObjectiveNum>0 and t.ObjectiveNum<=2 then 1 else 0 end) as ObjectiveNum2,
sum(case when t.ObjectiveNum>2 and t.ObjectiveNum<=5 then 1 else 0 end) as ObjectiveNum3,
sum(case when t.ObjectiveNum>5 then 1 else 0 end) as ObjectiveNum4
from(
select e.EmployeeId,e.RB_Department_Id,SUM(CASE WHEN o.Id is null THEN 0 ELSE 1 END) as ObjectiveNum
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy AND o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id={group_Id} and e.IsLeave =0 and e.RB_Department_Id in ({deptIds}) group by e.EmployeeId
)t group by t.RB_Department_Id
";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveStatePageList(int pageIndex, int pageSize, out long count, int periodId, int startValue, int orderBy, string userIds, int group_Id)
{
string sql = $@"
......@@ -541,6 +559,36 @@ where o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2 and o.Pr
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveStatePageList_V2(int pageIndex, int pageSize, out long count, int periodId, int orderBy, int orderByNum, string userIds, int group_Id)
{
string sql = $@"
select * from(
select e.EmployeeId AS CreateBy,e.EmName,e.EmPhoto,e.DeptName,e.PostName,
sum(case when o.ProgressState = 1 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.ProgressState = 2 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.ProgressState = 3 then 1 else 0 end) as ObjectiveNum3
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds) ? "and e.EmployeeId in (" + userIds + ")" : "")} group by e.EmployeeId
)t order by t.ObjectiveNum{orderByNum} {(orderBy == 1 ? " asc" : " desc")}
";
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveStateListForDept( int periodId, string deptIds, int group_Id)
{
string sql = $@"
select e.RB_Department_Id,
sum(case when o.ProgressState = 1 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.ProgressState = 2 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.ProgressState = 3 then 1 else 0 end) as ObjectiveNum3
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 and e.RB_Department_Id in ({deptIds}) group by e.RB_Department_Id
";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveProgressPageList(int pageIndex, int pageSize, out long count, int periodId, int startValue, int endValue, int orderBy, string userIds, int group_Id)
{
string sql = $@"
......@@ -554,6 +602,40 @@ where o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2 and o.Pr
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveProgressPageList_V2(int pageIndex, int pageSize, out long count, int periodId, int orderBy, int orderByNum, string userIds, int group_Id)
{
string sql = $@"
select * from(
select e.EmployeeId AS CreateBy,e.EmName,e.EmPhoto,e.DeptName,e.PostName,
sum(case when o.Progress=0 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.Progress>0 and o.Progress <=30 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.Progress>30 and o.Progress <=60 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.Progress>60 and o.Progress <=90 then 1 else 0 end) as ObjectiveNum4,
sum(case when o.Progress>90 then 1 else 0 end) as ObjectiveNum5
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds) ? "and e.EmployeeId in (" + userIds + ")" : "")} group by e.EmployeeId
)t order by t.ObjectiveNum{orderByNum} {(orderBy == 1 ? " asc" : " desc")}
";
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveProgressListForDept(int periodId, string deptIds, int group_Id)
{
string sql = $@"
select e.RB_Department_Id,
sum(case when o.Progress=0 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.Progress>0 and o.Progress <=30 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.Progress>30 and o.Progress <=60 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.Progress>60 and o.Progress <=90 then 1 else 0 end) as ObjectiveNum4,
sum(case when o.Progress>90 then 1 else 0 end) as ObjectiveNum5
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 and e.RB_Department_Id in ({deptIds}) group by e.RB_Department_Id
";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveScorePageList(int pageIndex, int pageSize, out long count, int periodId, int startValue, int endValue, int orderBy, string userIds, int group_Id)
{
string sql = $@"
......@@ -567,6 +649,40 @@ where o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2 and o.Sc
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveScorePageList_V2(int pageIndex, int pageSize, out long count, int periodId, int orderBy, int orderByNum, string userIds, int group_Id)
{
string sql = $@"
select * from(
select e.EmployeeId AS CreateBy,e.EmName,e.EmPhoto,e.DeptName,e.PostName,
sum(case when o.Score=0 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.Score>0 and o.Score<=0.3 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.Score>0.3 and o.Score<=0.6 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.Score>0.6 and o.Score<=0.9 then 1 else 0 end) as ObjectiveNum4,
sum(case when o.Score>0.9 then 1 else 0 end) as ObjectiveNum5
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds) ? "and e.EmployeeId in (" + userIds + ")" : "")} group by e.EmployeeId
)t order by t.ObjectiveNum{orderByNum} {(orderBy == 1 ? " asc" : " desc")}
";
return GetPage<RB_OKR_Objective_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
public List<RB_OKR_Objective_ViewModel> GetObjectiveScoreListForDept(int periodId, string deptIds, int group_Id)
{
string sql = $@"
select e.RB_Department_Id,
sum(case when o.Score=0 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.Score>0 and o.Score<=0.3 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.Score>0.3 and o.Score<=0.6 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.Score>0.6 and o.Score<=0.9 then 1 else 0 end) as ObjectiveNum4,
sum(case when o.Score>0.9 then 1 else 0 end) as ObjectiveNum5
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy and o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2
where e.RB_Group_id ={group_Id} and e.IsLeave =0 and e.RB_Department_Id in ({deptIds}) group by e.RB_Department_Id
";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
#endregion
}
}
......@@ -141,7 +141,15 @@ WHERE 1=1
}
if (query.Post_Id>0)
{
where2.AppendFormat(" AND A.{0}={1} ", nameof(RB_Account_ViewModel.Post_Id), query.Post_Id);
where2.AppendFormat(" AND B.{0}={1} ", nameof(RB_Account_ViewModel.Post_Id), query.Post_Id);
}
if (query.Dept_Id > 0)
{
where2.AppendFormat(" AND B.{0}={1} ", nameof(RB_Account_ViewModel.Dept_Id), query.Dept_Id);
}
if (query.LeaveStatus > 0)
{
where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.LeaveStatus), query.LeaveStatus);
}
if (query.IsSelectLevelNor == 1)
{
......
......@@ -1885,6 +1885,138 @@ namespace Edu.WebApi.Controllers.OKR
#endregion
#region 数据看板-上面统计
/// <summary>
/// 获取个人端数据分布
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistribution()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
int RangeType = parms.GetInt("RangeType", 1);//范围类型 非管理端查询 1所有下级 2直属下级
int DepartId = parms.GetInt("DepartId", 0);//部门ID 管理端可用查询
int PostId = parms.GetInt("PostId", 0);//岗位ID
int LeaveStatus = parms.GetInt("LeaveStatus", 0);//在职状态
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
if (IsAdmin == 1)
{
RangeType = 0;
}
var obj = okrPeriodModule.GetOKRGRDateDistribution(PeriodId, RangeType, DepartId, PostId, LeaveStatus, userInfo, IsAdmin == 1 ? true : false);
return ApiResult.Success("", obj);
}
/// <summary>
/// 获取个人端数据分布明细
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistributionDetail()
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
int Type = parms.GetInt("Type", 1);//1234 对应4项统计
int StartValue = parms.GetInt("StartValue", 0);//开始值
int EndValue = parms.GetInt("EndValue", 0);//结束值
int OrderBy = parms.GetInt("OrderBy", 2);// 1升序 2降序
int RangeType = parms.GetInt("RangeType", 1);//范围类型 非管理端查询 1所有下级 2直属下级
int DepartId = parms.GetInt("DepartId", 0);//部门ID 管理端可用查询
int PostId = parms.GetInt("PostId", 0);//岗位ID
int LeaveStatus = parms.GetInt("LeaveStatus", 0);//在职状态
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
if (IsAdmin == 1)
{
RangeType = 0;
}
var list = okrPeriodModule.GetOKRGRDateDistributionDetail(pageModel.PageIndex, pageModel.PageSize, out long count, PeriodId, Type, StartValue, EndValue, OrderBy, RangeType, DepartId, PostId, LeaveStatus, userInfo, IsAdmin == 1 ? true : false);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
x.ObjectiveNum
});
return ApiResult.Success("", pageModel);
}
/// <summary>
/// 获取个人端数据分布明细 - 员工
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistributionDetail_V2()
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
int Type = parms.GetInt("Type", 1);//1234 对应4项统计
int OrderBy = parms.GetInt("OrderBy", 2);// 1升序 2降序
int OrderByNum = parms.GetInt("OrderByNum", 1);// 以第几个排序
int RangeType = parms.GetInt("RangeType", 1);//范围类型 非管理端查询 1所有下级 2直属下级
int DepartId = parms.GetInt("DepartId", 0);//部门ID 管理端可用查询
int PostId = parms.GetInt("PostId", 0);//岗位ID
int LeaveStatus = parms.GetInt("LeaveStatus", 0);//在职状态
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
if (IsAdmin == 1)
{
RangeType = 0;
}
OrderByNum = OrderByNum == 0 ? 1 : OrderByNum;
var list = okrPeriodModule.GetOKRGRDateDistributionDetail_V2(pageModel.PageIndex, pageModel.PageSize, out long count, PeriodId, Type, OrderBy, OrderByNum, RangeType, DepartId, PostId, LeaveStatus, userInfo, IsAdmin == 1 ? true : false);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list;
return ApiResult.Success("", pageModel);
}
/// <summary>
/// 获取个人端数据分布明细 - 部门
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistributionForDepartment()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
int Type = parms.GetInt("Type", 1);//1234 对应4项统计
int OrderBy = parms.GetInt("OrderBy", 2);// 1升序 2降序
int OrderByNum = parms.GetInt("OrderByNum", 1);// 以第几个排序
int DepartId = parms.GetInt("DepartId", 0);//部门ID 管理端可用查询
int PostId = parms.GetInt("PostId", 0);//岗位ID
int LeaveStatus = parms.GetInt("LeaveStatus", 0);//在职状态
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = okrPeriodModule.GetOKRGRDateDistributionForDepartment(PeriodId, Type, OrderBy, OrderByNum, DepartId, PostId, LeaveStatus, userInfo, IsAdmin == 1 ? true : false);
return ApiResult.Success("", list);
}
#endregion
#region 个人端数据看板
/// <summary>
/// 获取个人维度
......@@ -1941,58 +2073,6 @@ namespace Edu.WebApi.Controllers.OKR
}
}
/// <summary>
/// 获取个人端数据分布
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistribution()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
var obj = okrPeriodModule.GetOKRGRDateDistribution(PeriodId, userInfo, IsAdmin == 1 ? true : false);
return ApiResult.Success("", obj);
}
/// <summary>
/// 获取个人端数据分布明细
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistributionDetail() {
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int IsAdmin = parms.GetInt("IsAdmin", 2);//是否管理端查询 1是 2否
int Type = parms.GetInt("Type", 1);//1234 对应4项统计
int StartValue = parms.GetInt("StartValue", 0);//开始值
int EndValue = parms.GetInt("EndValue", 0);//结束值
int OrderBy = parms.GetInt("OrderBy", 2);// 1升序 2降序
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = okrPeriodModule.GetOKRGRDateDistributionDetail(pageModel.PageIndex,pageModel.PageSize, out long count, PeriodId, Type, StartValue, EndValue, OrderBy, userInfo, IsAdmin == 1 ? true : false);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
x.CreateBy,
x.EmName,
x.EmPhoto,
x.DeptName,
x.PostName,
x.ObjectiveNum
});
return ApiResult.Success("", pageModel);
}
#endregion
......
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