Commit f3279cea authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents d52d61a9 5fa12dc8
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; }
}
}
This diff is collapsed.
......@@ -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} {(!string.IsNullOrEmpty(userIds)? "and CreateBy in("+ userIds + ")":"")} GROUP BY CreateBy
......@@ -1052,15 +1052,89 @@ SELECT UserId FROM rb_okr_updateprogress WHERE Group_Id={group_Id} and PeriodId=
#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
}
......
......@@ -2053,7 +2053,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
......@@ -2074,7 +2075,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());
......@@ -2088,7 +2089,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);
......@@ -2109,7 +2111,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
......@@ -2131,7 +2134,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
......@@ -2252,12 +2256,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
......@@ -2414,7 +2452,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);
......@@ -2437,7 +2475,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