Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
8355763d
Commit
8355763d
authored
Feb 06, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
okr调整
parent
f50aa0c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
32 deletions
+58
-32
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+53
-26
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+5
-6
No files found.
Edu.Module.OKR/OKRPeriodModule.cs
View file @
8355763d
...
...
@@ -1508,7 +1508,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem
.
IsLock
=
1
;
}
}
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -2027,7 +2027,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -2545,7 +2545,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -2775,7 +2775,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -3123,7 +3123,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -3415,7 +3415,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem
.
IsLock
=
1
;
}
}
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -3562,10 +3562,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="dmodel"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
string
SetOKRMyObjectiveInfo
(
RB_OKR_Objective_ViewModel
dmodel
,
UserInfo
userInfo
)
public
string
SetOKRMyObjectiveInfo
(
RB_OKR_Objective_ViewModel
dmodel
,
UserInfo
userInfo
,
out
int
ObjectiveId
)
{
ObjectiveId
=
0
;
if
(
dmodel
.
Id
>
0
)
{
ObjectiveId
=
dmodel
.
Id
;
var
hmodel
=
oKR_ObjectiveRepository
.
GetEntity
(
dmodel
.
Id
);
if
(
hmodel
.
ProgressRemark
==
dmodel
.
ProgressRemark
&&
hmodel
.
Title
==
dmodel
.
Title
)
{
return
""
;
...
...
@@ -3623,7 +3625,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
});
}
//更新提示
Task
.
Run
(()
=>
AddMyEmployeeUpdateNotification
(
dmodel
.
PeriodId
,
userInfo
));
//
Task.Run(() => AddMyEmployeeUpdateNotification(dmodel.PeriodId, userInfo));
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
...
...
@@ -3697,6 +3699,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
dmodel
.
UpdateTime
=
DateTime
.
Now
;
int
Id
=
oKR_ObjectiveRepository
.
Insert
(
dmodel
);
ObjectiveId
=
Id
;
if
(
Id
>
0
)
{
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
...
...
@@ -3721,7 +3724,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
Group_Id
=
userInfo
.
Group_Id
});
//更新提示
Task
.
Run
(()
=>
AddMyEmployeeUpdateNotification
(
dmodel
.
PeriodId
,
userInfo
));
//
Task.Run(() => AddMyEmployeeUpdateNotification(dmodel.PeriodId, userInfo));
}
return
Id
>
0
?
""
:
"出错了,请联系管理员"
;
}
...
...
@@ -3735,10 +3738,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="name"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
string
SetOKRMyKeyResultInfo
(
int
keyResultId
,
int
objectiveId
,
string
name
,
UserInfo
userInfo
)
public
string
SetOKRMyKeyResultInfo
(
int
keyResultId
,
int
objectiveId
,
string
name
,
UserInfo
userInfo
,
out
int
RKeyResultId
)
{
RKeyResultId
=
0
;
if
(
keyResultId
>
0
)
{
RKeyResultId
=
keyResultId
;
var
hmodel
=
oKR_KeyResultRepository
.
GetEntity
(
keyResultId
);
if
(
hmodel
.
Name
==
name
)
{
return
""
;
...
...
@@ -3780,7 +3785,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
Group_Id
=
userInfo
.
Group_Id
});
//更新提示
Task
.
Run
(()
=>
AddMyEmployeeUpdateNotification_V2
(
objectiveId
,
userInfo
));
//
Task.Run(() => AddMyEmployeeUpdateNotification_V2(objectiveId, userInfo));
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
...
...
@@ -3845,6 +3850,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
UpdateTime
=
DateTime
.
Now
,
Weight
=
NowWeight
});
RKeyResultId
=
Id
;
if
(
Id
>
0
)
{
if
(
IsUpdate
)
...
...
@@ -3880,14 +3886,14 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
Id
=
0
,
Type
=
2
,
SourceId
=
keyResult
Id
,
SourceId
=
Id
,
Content
=
name
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
});
//更新提示
Task
.
Run
(()
=>
AddMyEmployeeUpdateNotification_V2
(
objectiveId
,
userInfo
));
//
Task.Run(() => AddMyEmployeeUpdateNotification_V2(objectiveId, userInfo));
}
return
Id
>
0
?
""
:
"出错了,请联系管理员"
;
}
...
...
@@ -4438,6 +4444,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
int
MaxSort
=
list
.
Max
(
x
=>
x
.
Sort
);
var
MaxModel
=
list
.
Where
(
x
=>
x
.
Sort
==
MaxSort
).
FirstOrDefault
();
var
CurrentModel
=
list
.
Where
(
x
=>
x
.
Id
==
keyResultId
).
FirstOrDefault
();
if
(
model
.
Sort
==
MaxSort
)
{
return
ApiResult
.
Failed
(
"最后一个KeyResult无法修改权重"
);
...
...
@@ -4446,6 +4453,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
return
ApiResult
.
Failed
(
"总权重不能超过100%"
);
}
CurrentModel
.
Weight
=
weight
;
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_OKR_KeyResult_ViewModel
.
Weight
),
weight
}
};
...
...
@@ -4471,6 +4479,24 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
};
oKR_KeyResultRepository
.
Update
(
keyValues1
,
wheres1
);
MaxModel
.
Weight
-=
(
weight
-
model
.
Weight
);
#
region
更新目标进度
+
评分
//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
);
decimal
TScore
=
list
.
Sum
(
x
=>
x
.
Score
*
x
.
Weight
/
100
);
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_OKR_Objective_ViewModel
.
Progress
),(
int
)
TProgress
},
{
nameof
(
RB_OKR_Objective_ViewModel
.
Score
),(
int
)
TScore
}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_OKR_Objective_ViewModel
.
Id
),
FiledValue
=
model
.
ObjectiveId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
oKR_ObjectiveRepository
.
Update
(
keyValues2
,
wheres2
);
#
endregion
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
...
...
@@ -4483,11 +4509,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
School_Id
=
userInfo
.
School_Id
,
SourceId
=
0
});
return
ApiResult
.
Success
(
""
,
new
{
Weight
=
weight
,
LastWeight
=
MaxModel
.
Weight
-
(
weight
-
model
.
Weight
)
LastWeight
=
MaxModel
.
Weight
-
(
weight
-
model
.
Weight
),
TProgress
,
TScore
});
}
return
ApiResult
.
Failed
();
...
...
@@ -6180,7 +6207,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6240,7 +6267,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6301,7 +6328,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6448,7 +6475,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6606,7 +6633,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6736,7 +6763,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6745,7 +6772,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6755,7 +6782,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6844,7 +6871,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6891,7 +6918,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
@@ -6963,7 +6990,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
()
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
...
...
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
8355763d
...
...
@@ -444,11 +444,10 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
string
msg
=
okrPeriodModule
.
SetOKRMyObjectiveInfo
(
dmodel
,
userInfo
);
string
msg
=
okrPeriodModule
.
SetOKRMyObjectiveInfo
(
dmodel
,
userInfo
,
out
int
ObjectiveId
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
(
""
,
ObjectiveId
);
}
else
{
...
...
@@ -472,15 +471,15 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
ParamIsNull
(
"请传递结果值"
);
}
if
(
KeyResultId
<=
0
||
ObjectiveId
<=
0
)
if
(
KeyResultId
<=
0
&&
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"结果id不正确"
);
}
string
msg
=
okrPeriodModule
.
SetOKRMyKeyResultInfo
(
KeyResultId
,
ObjectiveId
,
Name
,
userInfo
);
string
msg
=
okrPeriodModule
.
SetOKRMyKeyResultInfo
(
KeyResultId
,
ObjectiveId
,
Name
,
userInfo
,
out
int
RKeyResultId
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
(
""
,
RKeyResultId
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment