Commit 569949cd authored by liudong1993's avatar liudong1993

okr 进度更新状态

parent bb81ee33
......@@ -122,5 +122,10 @@ namespace Edu.Model.Entity.OKR
/// 是否默认全部可见权限 1是 2否
/// </summary>
public int IsDefaultPermission { get; set; }
/// <summary>
/// 是否更新过进度状态 1是
/// </summary>
public int IsUpdated { get; set; }
}
}
......@@ -3259,6 +3259,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
dmodel.UpdateBy = userInfo.Id;
dmodel.UpdateTime = DateTime.Now;
dmodel.IsDefaultPermission = 1;
dmodel.IsUpdated = 2;
int Id = oKR_ObjectiveRepository.Insert(dmodel);
ObjectiveId = Id;
......@@ -3725,6 +3726,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (type == 1)
{
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.IsDefaultState), 1);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.IsUpdated), 1);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateBy), userInfo.Id);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateTime), DateTime.Now);
LogContent = "修改OKR目标默认风险最高的 Key Result 状态【" + objectiveId + "】";
......@@ -3733,6 +3735,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
else if (type == 2)
{
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.IsDefaultState), 2);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.IsUpdated), 1);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.ProgressState), progressState);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateBy), userInfo.Id);
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateTime), DateTime.Now);
......@@ -3829,6 +3832,20 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
bool flag = oKR_KeyResultRepository.Update(keyValues, wheres);
if (flag)
{
if (type == 1) {
var kmodel = oKR_KeyResultRepository.GetEntity(keyResultId);
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_OKR_Objective_ViewModel.IsUpdated),1}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_Objective_ViewModel.Id),
FiledValue=kmodel.ObjectiveId,
OperatorEnum=OperatorEnum.Equal
}
};
oKR_ObjectiveRepository.Update(keyValues1, wheres1);
}
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
......@@ -3889,7 +3906,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var list = oKR_KeyResultRepository.GetList(new RB_OKR_KeyResult_ViewModel() { Group_Id = userInfo.Group_Id, ObjectiveId = model.ObjectiveId });
decimal TProgress = list.Sum(x => x.Progress * x.Weight / 100);
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_OKR_Objective_ViewModel.Progress),(int)TProgress}
{ nameof(RB_OKR_Objective_ViewModel.Progress),(int)TProgress},
{ nameof(RB_OKR_Objective_ViewModel.IsUpdated),1}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
......@@ -3947,7 +3965,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var list = oKR_KeyResultRepository.GetList(new RB_OKR_KeyResult_ViewModel() { Group_Id = userInfo.Group_Id, ObjectiveId = model.ObjectiveId });
decimal TProgress = list.Sum(x => x.Progress * x.Weight / 100);
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_OKR_Objective_ViewModel.Progress),(int)TProgress}
{ nameof(RB_OKR_Objective_ViewModel.Progress),(int)TProgress},
{ nameof(RB_OKR_Objective_ViewModel.IsUpdated),1}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
......@@ -7252,6 +7271,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
//查询目标状态
List<object> ObjectiveState = new List<object>();
ObjectiveState.Add(new
{
ProgressState = 0,
Name = "未更新",
Number = olist.Where(x => x.IsUpdated != 1).Count()
});
var ProgressStateList = EnumHelper.EnumToList(typeof(Common.Enum.OKR.ProgressStateEnum));
foreach (var item in ProgressStateList)
{
......@@ -7259,7 +7284,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
ProgressState = item.Id,
item.Name,
Number = olist.Where(x => x.ProgressState == (Common.Enum.OKR.ProgressStateEnum)item.Id).Count()
Number = olist.Where(x => x.IsUpdated == 1 && x.ProgressState == (Common.Enum.OKR.ProgressStateEnum)item.Id).Count()
});
}
......@@ -7478,7 +7503,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.EmPhoto,
x.DeptName,
x.PostName,
ObjectiveNumList = new List<int>() { x.ObjectiveNum1, x.ObjectiveNum2, x.ObjectiveNum3 }
ObjectiveNumList = new List<int>() { x.ObjectiveNum1, x.ObjectiveNum2, x.ObjectiveNum3, x.ObjectiveNum4 }
});
case 3: //进度
RList = oKR_ObjectiveRepository.GetObjectiveProgressPageList_V2(pageIndex, pageSize, out count, periodId, orderBy, orderByNum, userIds, userInfo.Group_Id);
......@@ -7581,13 +7606,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
rmodel.ObjectiveNum3,
rmodel.ObjectiveNum4
};
if (type == 1) {
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4) {
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
if (type == 3 || type == 4) {
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
......@@ -7649,15 +7671,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
rmodel.ObjectiveNum3,
rmodel.ObjectiveNum4
};
if (type == 1)
if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
......@@ -7720,15 +7738,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
rmodel.ObjectiveNum3,
rmodel.ObjectiveNum4
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
......@@ -7794,15 +7808,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
rmodel.ObjectiveNum3,
rmodel.ObjectiveNum4
};
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4)
if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
......@@ -7852,18 +7862,14 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
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)
rmodel.ObjectiveNum1,
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3,
rmodel.ObjectiveNum4
};
if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
Rlist.Add(new
......
......@@ -564,9 +564,10 @@ where o.Group_Id ={group_Id} and o.PeriodId ={periodId} AND o.Status =2 and o.Pr
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
sum(case when o.IsUpdated <> 1 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.IsUpdated = 1 and o.ProgressState = 1 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.IsUpdated = 1 and o.ProgressState = 2 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.IsUpdated = 1 and o.ProgressState = 3 then 1 else 0 end) as ObjectiveNum4
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
......@@ -579,9 +580,10 @@ where e.RB_Group_id ={group_Id} and e.IsLeave =0 {(!string.IsNullOrEmpty(userIds
{
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
sum(case when o.IsUpdated <> 1 then 1 else 0 end) as ObjectiveNum1,
sum(case when o.IsUpdated = 1 and o.ProgressState = 1 then 1 else 0 end) as ObjectiveNum2,
sum(case when o.IsUpdated = 1 and o.ProgressState = 2 then 1 else 0 end) as ObjectiveNum3,
sum(case when o.IsUpdated = 1 and o.ProgressState = 3 then 1 else 0 end) as ObjectiveNum4
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
......
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