Commit 097c32a4 authored by 吴春's avatar 吴春

提交代码

parent 2ff0cd67
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.ViewModel.OKR
{
/// <summary>
/// 对齐量
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class OKRPersonalDimension
{
/// <summary>
......@@ -39,6 +46,10 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 岗位
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 员工负责人
/// </summary>
......@@ -58,6 +69,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public decimal ScoreCount { get; set; }
/// <summary>
/// 距离上次更新进度时间
/// </summary>
public int DayNum { get; set; }
/// <summary>
/// 类型 1-我的上级,2-我的下级,3-我的同级,4-我的关注
/// </summary>
......@@ -87,12 +103,15 @@ namespace Edu.Model.ViewModel.OKR
/// 打分率
/// </summary>
public decimal ScoreRate { get; set; }
/// <summary>
/// 距离上次更新进度时间率
/// </summary>
public decimal DayNumRate { get; set; }
public int Post_Id { get; set; }
public int LeaveStatus { get; set; }
public int LeaveStatus { get; set; }
}
}
......@@ -8244,7 +8244,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
else
{
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = 0, IsSelectLevelNor = 1 });
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, DeptIds = departIds, Post_Id = postId, LeaveStatus = leaveStatus, IsSelectLevelNor = 1 });
userIdList = accountList.Select(x => x.Id).ToList();
}
string userIds = string.Join(",", userIdList.Distinct());
......@@ -8254,6 +8254,295 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <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 GetOKRGRDateDistributionForDept(int periodId, int type, int orderBy, int orderByNum, string 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<OKRPersonalDimension> RList = oKR_ObjectiveRepository.GetOKRGRDateDistributionDept(periodId, DeptIdStr, userInfo.Group_Id);
//返回部门树形结构
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 PeopleNum = RList.Where(x => x.Dept_Id == item.DeptId).Count();
var ObjectiveNCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count();
var ScoreCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count();
var OBjectiveRelation = RList.Where(x => x.Dept_Id == item.DeptId&&x.OBjectiveRelation>0).Count();
var DayNum = RList.Where(x => x.Dept_Id == item.DeptId && x.DayNum > -1).Count();
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
PeopleNum,//总人数部门
ObjectiveNCount,
ScoreCount,
OBjectiveRelation,
DayNum,
ChildList = GetChildDeptForDateDistribution(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<OKRPersonalDimension> RList = oKR_ObjectiveRepository.GetOKRGRDateDistributionDept(periodId, DeptIdStr, userInfo.Group_Id);
//返回部门树形结构
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 PeopleNum = RList.Where(x => x.Dept_Id == item.DeptId).Count();
var ObjectiveNCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count();
var ScoreCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count();
var OBjectiveRelation = RList.Where(x => x.Dept_Id == item.DeptId && x.OBjectiveRelation > 0).Count();
var DayNum = RList.Where(x => x.Dept_Id == item.DeptId && x.DayNum > -1).Count();
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
PeopleNum,//总人数部门
ObjectiveNCount,
ScoreCount,
OBjectiveRelation,
DayNum,
ChildList = GetChildDeptForDateDistribution(item, dlist, ManagerList, RList, type, orderBy, orderByNum)
});
}
}
}
else
{
if (!string.IsNullOrEmpty(departId))
{
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = 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<OKRPersonalDimension> RList = oKR_ObjectiveRepository.GetOKRGRDateDistributionDept(periodId, DeptIdStr, userInfo.Group_Id);
//返回部门树形结构
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 PeopleNum = RList.Where(x => x.Dept_Id == item.DeptId).Count();
var ObjectiveNCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count();
var ScoreCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count();
var OBjectiveRelation = RList.Where(x => x.Dept_Id == item.DeptId && x.OBjectiveRelation > 0).Count();
var DayNum = RList.Where(x => x.Dept_Id == item.DeptId && x.DayNum > -1).Count();
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
PeopleNum,//总人数部门
ObjectiveNCount,
ScoreCount,
OBjectiveRelation,
DayNum,
ChildList = GetChildDeptForDateDistribution(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<OKRPersonalDimension> RList = oKR_ObjectiveRepository.GetOKRGRDateDistributionDept(periodId, DeptIdStr, userInfo.Group_Id);
//返回部门树形结构
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 PeopleNum = RList.Where(x => x.Dept_Id == item.DeptId).Count();
var ObjectiveNCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count();
var ScoreCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count();
var OBjectiveRelation = RList.Where(x => x.Dept_Id == item.DeptId && x.OBjectiveRelation > 0).Count();
var DayNum = RList.Where(x => x.Dept_Id == item.DeptId && x.DayNum > -1).Count();
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
PeopleNum,//总人数部门
ObjectiveNCount,
ScoreCount,
OBjectiveRelation,
DayNum,
ChildList = GetChildDeptForDateDistribution(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 GetChildDeptForDateDistribution(RB_Department_ViewModel model, List<RB_Department_ViewModel> d2list, List<Employee_ViewModel> ManagerList, List<OKRPersonalDimension> 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 PeopleNum = RList.Where(x => x.Dept_Id == item.DeptId).Count();
var ObjectiveNCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count();
var ScoreCount = RList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count();
var OBjectiveRelation = RList.Where(x => x.Dept_Id == item.DeptId && x.OBjectiveRelation > 0).Count();
var DayNum = RList.Where(x => x.Dept_Id == item.DeptId && x.DayNum > -1).Count();
Rlist.Add(new
{
item.DeptId,
item.DeptName,
ManagerList = ManagerList1.Select(x => new
{
x.Id,
x.EmployeeName,
x.UserIcon
}),
PeopleNum,//总人数部门
ObjectiveNCount,
ScoreCount,
OBjectiveRelation,
DayNum,
ChildList = GetChildDeptForDateDistribution(item, d2list, ManagerList, RList, type, orderBy, orderByNum)
});
}
return Rlist;
}
/// <summary>
/// 获取个人维度打分以及目标量
/// </summary>
......
......@@ -93,7 +93,7 @@ namespace Edu.Repository.OKR
}
if (demodel.selectStatus > 0)
{
if (demodel.selectStatus==1)
if (demodel.selectStatus == 1)
{
where += $@" and {nameof(RB_OKR_Objective_ViewModel.Status)} in (2,3)";
}
......@@ -446,7 +446,7 @@ WHERE o1.CreateBy in({CreateBys}) and o1.`Status`=2 and o1.Group_Id={group_Id}
{
where.AppendFormat(" AND B.{0}={1} ", nameof(OKRPersonalDimension.LeaveStatus), query.LeaveStatus);
}
if (query.PeriodId > 0)
{
whereperiodId.AppendFormat(" AND a.{0}={1} ", nameof(OKRPersonalDimension.PeriodId), query.PeriodId);
......@@ -600,7 +600,7 @@ 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> GetObjectiveStateListForDept( int periodId, string deptIds, int group_Id)
public List<RB_OKR_Objective_ViewModel> GetObjectiveStateListForDept(int periodId, string deptIds, int group_Id)
{
string sql = $@"
select e.RB_Department_Id,
......@@ -720,7 +720,7 @@ where e.RB_Group_id ={group_Id} and e.IsLeave =0 and e.RB_Department_Id in ({dep
/// <param name="periodId"></param>
/// <param name="userIds"></param>
/// <returns></returns>
public int GetNotFilledList(int groupId,int periodId, string userIds)
public int GetNotFilledList(int groupId, int periodId, string userIds)
{
string sql = $@"SELECT COUNT(0) FROM(
SELECT CreateBy FROM rb_okr_objective WHERE Group_Id={groupId} and Status <>5 and PeriodId={periodId} and CreateBy in({userIds}) GROUP BY CreateBy
......@@ -830,15 +830,89 @@ WHERE e.RB_Group_id={groupId} and e.EmployeeId in({userIds}) and o.Status <>5 an
#region 数据看板
public List<OKRPersonalDimension> GetOKRGRDateDistributionPage(int pageIndex, int pageSize, out long count, int periodId, int startValue, int endValue, int orderBy, 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.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 {(!string.IsNullOrEmpty(userIds) ? "and e.EmployeeId in (" + userIds + ")" : "")} group by e.EmployeeId
//)t where t.ObjectiveNum >={startValue} {(endValue >= 0 ? "and t.ObjectiveNum <=" + endValue : "")} order by t.ObjectiveNum {(orderBy == 1 ? " asc" : " desc")}
//";
string orderbyInfo = string.Empty;
if (orderBy == 1)
{
orderbyInfo = " order by t.ObjectiveNCount asc";
}
else if (orderBy == 2)
{
orderbyInfo = " order by t.ObjectiveNCount desc";
}
else if (orderBy == 3)
{
orderbyInfo = " order by t.OBjectiveRelation desc";
}
else if (orderBy == 4)
{
orderbyInfo = " order by t.OBjectiveRelation desc";
}
else if (orderBy == 5)
{
orderbyInfo = " order by t.DayNum desc";
}
else if (orderBy == 6)
{
orderbyInfo = " order by t.DayNum desc";
}
else if (orderBy == 7)
{
orderbyInfo = " order by t.ScoreCount desc";
}
else if (orderBy == 8)
{
orderbyInfo = " order by t.ScoreCount desc";
}
string sql = $@"
select * from(
select e.EmployeeId AS CreateBy,e.EmName,e.EmPhoto,e.DeptName,e.PostName,SUM(CASE WHEN o.Id is null THEN 0 ELSE 1 END) as ObjectiveNum
select e.EmployeeId AS Id,e.EmName as EmployeeName ,e.EmPhoto as UserIcon,e.DeptName,e.PostName,SUM(CASE WHEN o.Id is null THEN 0 ELSE 1 END) as ObjectiveNCount ,
sum(case when o.Score>0 then 1 else 0 end) as ScoreCount, IFNULL(obj.OBjectiveRelation,0) as OBjectiveRelation,IFNULL(okrp.daysum,-1) as DayNum
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy AND o.PeriodId ={periodId} AND o.Status =2
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy AND o.PeriodId ={periodId} AND o.Status =2 and o.Group_Id={group_Id}
LEFT JOIN (SELECT COUNT(0) as OBjectiveRelation,o1.CreateBy FROM
rb_okr_objectiverelation or1
LEFT JOIN rb_okr_objective o1 on or1.ObjectiveId = o1.Id
WHERE o1.`Status`=2 and o1.Group_Id={group_Id} and o1.PeriodId ={periodId} group by o1.CreateBy) as obj on e.EmployeeId =obj.CreateBy
LEFT JOIN (SELECT DATEDIFF(NOW(), MAX(UpdateTime)) as daysum,UserId from rb_okr_updateprogress GROUP BY UserId) as okrp on e.EmployeeId=okrp.UserId
where e.RB_Group_id={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds) ? "and e.EmployeeId in (" + userIds + ")" : "")} group by e.EmployeeId
)t where t.ObjectiveNum >={startValue} {(endValue >= 0 ? "and t.ObjectiveNum <=" + endValue : "")} order by t.ObjectiveNum {(orderBy == 1 ? " asc" : " desc")}
";
return GetPage<OKRPersonalDimension>(pageIndex, pageSize, out count, sql).ToList();
)t where 1=1 {orderbyInfo} ";
var list= GetPage<OKRPersonalDimension>(pageIndex, pageSize, out count, sql).ToList();
return list;
}
public List<OKRPersonalDimension> GetOKRGRDateDistributionDept( int periodId, string deptIdStr, int group_Id)
{
string orderbyInfo = string.Empty;
string sql = $@"
select * from(
select e.EmployeeId AS Id,e.EmName as EmployeeName ,e.RB_Department_Id as Dept_Id,e.EmPhoto as UserIcon,e.DeptName,e.PostName,SUM(CASE WHEN o.Id is null THEN 0 ELSE 1 END) as ObjectiveNCount ,
sum(case when o.Score>0 then 1 else 0 end) as ScoreCount, IFNULL(obj.OBjectiveRelation,0) as OBjectiveRelation,IFNULL(okrp.daysum,-1) as DayNum
from rb_employee e
LEFT JOIN RB_OKR_Objective o on e.EmployeeId = o.CreateBy AND o.PeriodId ={periodId} AND o.Status =2 and o.Group_Id={group_Id}
LEFT JOIN (SELECT COUNT(0) as OBjectiveRelation,o1.CreateBy FROM
rb_okr_objectiverelation or1
LEFT JOIN rb_okr_objective o1 on or1.ObjectiveId = o1.Id
WHERE o1.`Status`=2 and o1.Group_Id={group_Id} and o1.PeriodId ={periodId} group by o1.CreateBy) as obj on e.EmployeeId =obj.CreateBy
LEFT JOIN (SELECT DATEDIFF(NOW(), MAX(UpdateTime)) as daysum,UserId from rb_okr_updateprogress GROUP BY UserId) as okrp on e.EmployeeId=okrp.UserId
where e.RB_Group_id={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(deptIdStr) ? "and e.RB_Department_Id in (" + deptIdStr + ")" : "")} group by e.EmployeeId
)t where 1=1 ";
var list = Get<OKRPersonalDimension>(sql).ToList();
return list;
}
#endregion
}
......
......@@ -2052,7 +2052,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMatterList() {
public ApiResult GetOKRMatterList()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
......@@ -2073,7 +2074,7 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMatterDetailPageList()
public ApiResult GetOKRMatterDetailPageList()
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
......@@ -2087,7 +2088,8 @@ namespace Edu.WebApi.Controllers.OKR
{
return ApiResult.ParamIsNull("请传递周期");
}
if (Type <= 0) {
if (Type <= 0)
{
return ApiResult.ParamIsNull("请传递类型");
}
var list = okrPeriodModule.GetOKRMatterDetailPageList(pageModel.PageIndex, pageModel.PageSize, out long count, PeriodId, Type, DepartId, PostId, LeaveStatus, userInfo);
......@@ -2108,7 +2110,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetOKRMatterIgnore() {
public ApiResult SetOKRMatterIgnore()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
......@@ -2130,7 +2133,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRProbabilityStatistics() {
public ApiResult GetOKRProbabilityStatistics()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
......@@ -2188,12 +2192,46 @@ namespace Edu.WebApi.Controllers.OKR
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
x.Id,
x.DeptName,
x.PostName,
x.ObjectiveNCount,
x.OBjectiveRelation,
x.ScoreCount,
x.DayNum,
x.UserIcon,
x.EmployeeName
});
return ApiResult.Success("", pageModel);
}
/// <summary>
/// 获取个人端数据分布明细 - 部门
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRGRDateDistributionForDept()
{
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);// 以第几个排序
string DepartId = parms.GetStringValue("DepartId");//部门ID 管理端可用查询
int PostId = parms.GetInt("PostId", 0);//岗位ID
int LeaveStatus = parms.GetInt("LeaveStatus", 0);//在职状态
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = okrPeriodModule.GetOKRGRDateDistributionForDept(PeriodId, Type, OrderBy, OrderByNum, DepartId, PostId, LeaveStatus, userInfo, IsAdmin == 1 ? true : false);
return ApiResult.Success("", list);
}
#endregion
......@@ -2350,7 +2388,7 @@ namespace Edu.WebApi.Controllers.OKR
var query = new Model.ViewModel.User.RB_Department_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
// School_Id = base.ParmJObj.GetInt("School_Id"),
// School_Id = base.ParmJObj.GetInt("School_Id"),
QDeptIds = base.ParmJObj.GetStringValue("QDeptIds"),
};
var list = departmentModule.GetOrganizationOKRModule(query, true);
......@@ -2373,7 +2411,7 @@ namespace Edu.WebApi.Controllers.OKR
model.ObjectiveRelationRate = decimal.Round((objRelation.Where(x => x.ChildNum > 0).Count()) / model.ChildrenNum, 2);
}
listResult.Add(model);
// model.OKRPersonalDimensionList.AddRange(GetChildDeptOKR(item.ChildList, PeriodId, okrPersonalList, listResult));
// model.OKRPersonalDimensionList.AddRange(GetChildDeptOKR(item.ChildList, PeriodId, okrPersonalList, listResult));
}
return ApiResult.Success(data: listResult.Select(x => new { x.DeptName, x.Dept_Id, x.ObjectiveRate, x.ObjectiveRelationRate, x.ScoreRate, x.ChildrenNum }));
}
......
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