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

提交代码

parent 2ff0cd67
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using VT.FW.DB;
namespace Edu.Model.ViewModel.OKR namespace Edu.Model.ViewModel.OKR
{ {
/// <summary>
/// 对齐量
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class OKRPersonalDimension public class OKRPersonalDimension
{ {
/// <summary> /// <summary>
...@@ -39,6 +46,10 @@ namespace Edu.Model.ViewModel.OKR ...@@ -39,6 +46,10 @@ namespace Edu.Model.ViewModel.OKR
/// </summary> /// </summary>
public string DeptName { get; set; } public string DeptName { get; set; }
/// <summary>
/// 岗位
/// </summary>
public string PostName { get; set; }
/// <summary> /// <summary>
/// 员工负责人 /// 员工负责人
/// </summary> /// </summary>
...@@ -58,6 +69,11 @@ namespace Edu.Model.ViewModel.OKR ...@@ -58,6 +69,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary> /// </summary>
public decimal ScoreCount { get; set; } public decimal ScoreCount { get; set; }
/// <summary>
/// 距离上次更新进度时间
/// </summary>
public int DayNum { get; set; }
/// <summary> /// <summary>
/// 类型 1-我的上级,2-我的下级,3-我的同级,4-我的关注 /// 类型 1-我的上级,2-我的下级,3-我的同级,4-我的关注
/// </summary> /// </summary>
...@@ -87,7 +103,10 @@ namespace Edu.Model.ViewModel.OKR ...@@ -87,7 +103,10 @@ namespace Edu.Model.ViewModel.OKR
/// 打分率 /// 打分率
/// </summary> /// </summary>
public decimal ScoreRate { get; set; } public decimal ScoreRate { get; set; }
/// <summary>
/// 距离上次更新进度时间率
/// </summary>
public decimal DayNumRate { get; set; }
public int Post_Id { get; set; } public int Post_Id { get; set; }
......
This diff is collapsed.
...@@ -93,7 +93,7 @@ namespace Edu.Repository.OKR ...@@ -93,7 +93,7 @@ namespace Edu.Repository.OKR
} }
if (demodel.selectStatus > 0) if (demodel.selectStatus > 0)
{ {
if (demodel.selectStatus==1) if (demodel.selectStatus == 1)
{ {
where += $@" and {nameof(RB_OKR_Objective_ViewModel.Status)} in (2,3)"; where += $@" and {nameof(RB_OKR_Objective_ViewModel.Status)} in (2,3)";
} }
...@@ -600,7 +600,7 @@ where e.RB_Group_id ={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds ...@@ -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(); 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 = $@" string sql = $@"
select e.RB_Department_Id, 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 ...@@ -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="periodId"></param>
/// <param name="userIds"></param> /// <param name="userIds"></param>
/// <returns></returns> /// <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( 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 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 ...@@ -830,15 +830,89 @@ WHERE e.RB_Group_id={groupId} and e.EmployeeId in({userIds}) and o.Status <>5 an
#region 数据看板 #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) 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 = $@" string sql = $@"
select * from( 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 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 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")} )t where 1=1 {orderbyInfo} ";
"; var list= GetPage<OKRPersonalDimension>(pageIndex, pageSize, out count, sql).ToList();
return 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 #endregion
} }
......
...@@ -2052,7 +2052,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -2052,7 +2052,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRMatterList() { public ApiResult GetOKRMatterList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id int PeriodId = parms.GetInt("PeriodId", 0);//周期id
...@@ -2087,7 +2088,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -2087,7 +2088,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.ParamIsNull("请传递周期"); return ApiResult.ParamIsNull("请传递周期");
} }
if (Type <= 0) { if (Type <= 0)
{
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
var list = okrPeriodModule.GetOKRMatterDetailPageList(pageModel.PageIndex, pageModel.PageSize, out long count, PeriodId, Type, DepartId, PostId, LeaveStatus, userInfo); 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 ...@@ -2108,7 +2110,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRMatterIgnore() { public ApiResult SetOKRMatterIgnore()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id int PeriodId = parms.GetInt("PeriodId", 0);//周期id
...@@ -2130,7 +2133,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -2130,7 +2133,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRProbabilityStatistics() { public ApiResult GetOKRProbabilityStatistics()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id int PeriodId = parms.GetInt("PeriodId", 0);//周期id
...@@ -2188,12 +2192,46 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -2188,12 +2192,46 @@ namespace Edu.WebApi.Controllers.OKR
pageModel.Count = Convert.ToInt32(count); pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new 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); 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 #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