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
b3e80f90
Commit
b3e80f90
authored
Mar 04, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
ca412231
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
37 deletions
+147
-37
OKRPersonalDimension.cs
Edu.Model/ViewModel/OKR/OKRPersonalDimension.cs
+6
-0
RB_Department_ViewModel.cs
Edu.Model/ViewModel/User/RB_Department_ViewModel.cs
+1
-0
RB_OKR_ObjectiveRepository.cs
Edu.Repository/OKR/RB_OKR_ObjectiveRepository.cs
+24
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+116
-37
No files found.
Edu.Model/ViewModel/OKR/OKRPersonalDimension.cs
View file @
b3e80f90
...
...
@@ -88,5 +88,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public
decimal
ScoreRate
{
get
;
set
;
}
public
int
Post_Id
{
get
;
set
;
}
public
int
LeaveStatus
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/User/RB_Department_ViewModel.cs
View file @
b3e80f90
...
...
@@ -45,6 +45,7 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
string
QDeptIds
{
get
;
set
;
}
/// <summary>
/// 上级ids
/// </summary>
...
...
Edu.Repository/OKR/RB_OKR_ObjectiveRepository.cs
View file @
b3e80f90
...
...
@@ -387,6 +387,21 @@ WHERE o1.CreateBy in({CreateBys}) and o2.CreateBy ={id} and o1.`Status`=2 and
/// <summary>
/// 获取个人维度对齐量
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="id"></param>
/// <returns></returns>
public
List
<
RB_OKR_Objective_ViewModel
>
GetOKRPersonalRelationAlignList_V2
(
int
group_Id
,
int
periodId
,
string
CreateBys
)
{
string
sql
=
$@"SELECT COUNT(0) as ChildNum,o1.CreateBy FROM
rb_okr_objectiverelation or1
LEFT JOIN rb_okr_objective o1 on or1.ObjectiveId = o1.Id
WHERE o1.CreateBy in(
{
CreateBys
}
) and o1.`Status`=2 and o1.Group_Id=
{
group_Id
}
and o1.PeriodId =
{
periodId
}
group by o1.CreateBy "
;
return
Get
<
RB_OKR_Objective_ViewModel
>(
sql
).
ToList
();
}
...
...
@@ -423,6 +438,15 @@ WHERE o1.CreateBy in({CreateBys}) and o2.CreateBy ={id} and o1.`Status`=2 and
{
where
.
AppendFormat
(
" AND B.{0}={1} "
,
nameof
(
OKRPersonalDimension
.
Dept_Id
),
query
.
Dept_Id
);
}
if
(
query
.
Post_Id
>
0
)
{
where
.
AppendFormat
(
" AND B.{0}={1} "
,
nameof
(
OKRPersonalDimension
.
Post_Id
),
query
.
Post_Id
);
}
if
(
query
.
LeaveStatus
>
0
)
{
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
);
...
...
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
b3e80f90
...
...
@@ -712,7 +712,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRObjectiveUpdateHistoryList
()
{
public
ApiResult
GetOKRObjectiveUpdateHistoryList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_UpdateHistory_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
...
...
@@ -960,12 +961,14 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRDefaultPermissionInfo
()
{
public
ApiResult
GetOKRDefaultPermissionInfo
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PermissionType
=
parms
.
GetInt
(
"PermissionType"
,
0
);
// 权限类型 1周期 2目标 3结果
int
TargetId
=
parms
.
GetInt
(
"TargetId"
,
0
);
//周期/目标/结果 的id
if
(
PermissionType
<=
0
||
TargetId
<=
0
)
{
if
(
PermissionType
<=
0
||
TargetId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
obj
=
okrPeriodModule
.
GetOKRDefaultPermissionInfo
(
PermissionType
,
TargetId
,
userInfo
);
...
...
@@ -993,7 +996,8 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
Success
();
}
else
{
else
{
return
ApiResult
.
Failed
();
}
}
...
...
@@ -1321,7 +1325,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRRulePageList
()
{
public
ApiResult
GetOKRRulePageList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
...
...
@@ -1353,7 +1358,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRRuleDownLoadList
()
{
public
ApiResult
GetOKRRuleDownLoadList
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
...
...
@@ -1372,28 +1378,36 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOKRRuleInfo
()
{
public
ApiResult
SetOKRRuleInfo
()
{
var
userInfo
=
base
.
UserInfo
;
RB_OKR_Rule_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
RuleName
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
RuleName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入规则名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
DataBase
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
DataBase
))
{
return
ApiResult
.
ParamIsNull
(
"请输入数据库名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Table
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Table
))
{
return
ApiResult
.
ParamIsNull
(
"请输入表名"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Field
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Field
))
{
return
ApiResult
.
ParamIsNull
(
"请输入统计字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
State
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
State
))
{
return
ApiResult
.
ParamIsNull
(
"请输入状态字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Identity
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Identity
))
{
return
ApiResult
.
ParamIsNull
(
"请输入身份字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Time
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Time
))
{
return
ApiResult
.
ParamIsNull
(
"请输入操作时间字段"
);
}
...
...
@@ -1409,7 +1423,8 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
Success
();
}
else
{
else
{
return
ApiResult
.
Failed
();
}
}
...
...
@@ -1419,7 +1434,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOKRRuleState
()
{
public
ApiResult
SetOKRRuleState
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
RuleId
=
parms
.
GetInt
(
"RuleId"
,
0
);
...
...
@@ -1430,7 +1446,8 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
Success
();
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
...
...
@@ -1459,29 +1476,38 @@ namespace Edu.WebApi.Controllers.OKR
{
var
userInfo
=
base
.
UserInfo
;
RB_OKR_KeyResult_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_KeyResult_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
dmodel
.
Id
<=
0
)
{
if
(
dmodel
.
Id
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关键结果id"
);
}
if
(
dmodel
.
RuleId
<=
0
)
{
if
(
dmodel
.
RuleId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递规则Id"
);
}
if
(!
dmodel
.
RuleSTime
.
HasValue
)
{
if
(!
dmodel
.
RuleSTime
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择规则适配开始时间"
);
}
if
(!
dmodel
.
RuleETime
.
HasValue
)
{
if
(!
dmodel
.
RuleETime
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择规则适配结束时间"
);
}
if
(
dmodel
.
StartValue
<
0
)
{
if
(
dmodel
.
StartValue
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入结果的起始值"
);
}
if
(
dmodel
.
EndValue
<=
0
)
{
if
(
dmodel
.
EndValue
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入结果的目标值"
);
}
if
(
dmodel
.
RelationList
==
null
||
!
dmodel
.
RelationList
.
Any
())
{
if
(
dmodel
.
RelationList
==
null
||
!
dmodel
.
RelationList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择适配部门/直属人员"
);
}
foreach
(
var
item
in
dmodel
.
RelationList
)
{
if
(
item
.
RelationId
<=
0
)
{
foreach
(
var
item
in
dmodel
.
RelationList
)
{
if
(
item
.
RelationId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"关联部门/直属人员有误"
);
}
}
...
...
@@ -1504,7 +1530,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
CancelOKRKeyResultUseRule
()
{
public
ApiResult
CancelOKRKeyResultUseRule
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
...
...
@@ -1525,11 +1552,13 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRKeyResultRuleReList
()
{
public
ApiResult
GetOKRKeyResultRuleReList
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
if
(
KeyResultId
<=
0
)
{
if
(
KeyResultId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关键结果id"
);
}
...
...
@@ -1551,7 +1580,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRMyManageDepartment
()
{
public
ApiResult
GetOKRMyManageDepartment
()
{
var
userInfo
=
base
.
UserInfo
;
var
list
=
okrPeriodModule
.
GetOKRMyManageDepartment_V2
(
userInfo
);
...
...
@@ -1815,10 +1845,12 @@ namespace Edu.WebApi.Controllers.OKR
{
return
ApiResult
.
ParamIsNull
(
"请传递内容"
);
}
if
(
extModel
.
Type
<=
0
)
{
if
(
extModel
.
Type
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递类型"
);
}
if
(
extModel
.
TargetId
<=
0
)
{
if
(
extModel
.
TargetId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标/结果id"
);
}
extModel
.
CreateBy
=
userInfo
.
Id
;
...
...
@@ -1827,7 +1859,7 @@ namespace Edu.WebApi.Controllers.OKR
extModel
.
UpdateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateBy
=
userInfo
.
Id
;
extModel
.
Group_Id
=
userInfo
.
Group_Id
;
bool
flag
=
okrPeriodModule
.
SetOKRCheckedComment
(
extModel
,
out
int
Id
);
bool
flag
=
okrPeriodModule
.
SetOKRCheckedComment
(
extModel
,
out
int
Id
);
return
flag
?
ApiResult
.
Success
(
""
,
Id
)
:
ApiResult
.
Failed
();
}
...
...
@@ -2078,7 +2110,7 @@ namespace Edu.WebApi.Controllers.OKR
#
region
管理端数据看板
/// <summary>
/// 获取
评论
分页列表
/// 获取
管理端数据看板员工
分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
...
...
@@ -2092,13 +2124,21 @@ namespace Edu.WebApi.Controllers.OKR
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
,
0
),
QDeptIds
=
base
.
ParmJObj
.
GetStringValue
(
"QDeptIds"
),
Post_Id
=
base
.
ParmJObj
.
GetInt
(
"PostId"
,
0
),
//岗位ID
LeaveStatus
=
base
.
ParmJObj
.
GetInt
(
"LeaveStatus"
,
0
),
//在职状态
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetAllEmployeeOKRPPageRepository
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Any
())
{
string
ids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
var
objRelation
=
okrPeriodModule
.
GetOKRPersonalRelationAlignList_V2
(
base
.
UserInfo
.
Group_Id
,
query
.
PeriodId
,
ids
);
foreach
(
var
item
in
list
)
{
var
objRelation
=
okrPeriodModule
.
GetOKRPersonalRelationAlignList
(
base
.
UserInfo
.
Group_Id
,
query
.
PeriodId
,
item
.
AccountId
.
ToString
(),
item
.
AccountId
);
item
.
OBjectiveRelation
=
objRelation
.
Where
(
x
=>
x
.
CreateBy
==
item
.
Id
).
Sum
(
x
=>
x
.
ChildNum
);
}
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
;
...
...
@@ -2150,6 +2190,45 @@ namespace Edu.WebApi.Controllers.OKR
}
return
ApiResult
.
Success
(
data
:
listResult
.
Select
(
x
=>
new
{
x
.
DeptName
,
x
.
Dept_Id
,
x
.
ObjectiveRate
,
x
.
ObjectiveRelationRate
,
x
.
ScoreRate
,
x
.
ChildrenNum
}));
}
/// <summary>
/// 获取部门树形列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDeptOKR_V2
()
{
int
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
,
0
);
var
query
=
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
// School_Id = base.ParmJObj.GetInt("School_Id"),
QDeptIds
=
base
.
ParmJObj
.
GetStringValue
(
"QDeptIds"
),
};
var
list
=
departmentModule
.
GetOrganizationOKRModule
(
query
,
true
);
var
okrPersonalList
=
okrPeriodModule
.
GetAllEmployeeOKRPList
(
new
OKRPersonalDimension
{
School_Id
=
query
.
School_Id
,
Group_Id
=
query
.
Group_Id
,
Dept_Ids
=
query
.
QDeptIds
,
PeriodId
=
PeriodId
});
List
<
OKRPersonalDimension
>
listResult
=
new
List
<
OKRPersonalDimension
>();
foreach
(
var
item
in
list
.
Where
(
x
=>
x
.
DataType
==
1
))
{
OKRPersonalDimension
model
=
new
OKRPersonalDimension
();
model
.
DeptName
=
item
.
DeptName
;
model
.
DeptPersonName
=
string
.
IsNullOrWhiteSpace
(
item
.
ManagerIds
)
?
""
:
string
.
Join
(
","
,
okrPersonalList
.
Where
(
x
=>
item
.
ManagerIds
.
Contains
(
x
.
AccountId
.
ToString
())).
Select
(
x
=>
x
.
EmployeeName
));
model
.
ChildrenNum
=
list
.
Where
(
x
=>
x
.
DataType
==
2
&&
x
.
DeptId
==
item
.
DeptId
).
Count
();
if
(
model
.
ChildrenNum
>
0
)
{
string
ids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
DataType
==
2
&&
x
.
DeptId
==
item
.
DeptId
).
Select
(
x
=>
x
.
DeptId
));
var
objRelation
=
okrPeriodModule
.
GetOKRPersonalRelationAlignList_V2
(
base
.
UserInfo
.
Group_Id
,
PeriodId
,
ids
);
model
.
ObjectiveRate
=
decimal
.
Round
((
okrPersonalList
.
Where
(
x
=>
x
.
Dept_Id
==
item
.
DeptId
&&
x
.
ObjectiveNCount
>
0
).
Count
())
/
model
.
ChildrenNum
,
2
);
model
.
ScoreRate
=
decimal
.
Round
((
okrPersonalList
.
Where
(
x
=>
x
.
Dept_Id
==
item
.
DeptId
&&
x
.
ScoreCount
>
0
).
Count
())
/
model
.
ChildrenNum
,
2
);
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));
}
return
ApiResult
.
Success
(
data
:
listResult
.
Select
(
x
=>
new
{
x
.
DeptName
,
x
.
Dept_Id
,
x
.
ObjectiveRate
,
x
.
ObjectiveRelationRate
,
x
.
ScoreRate
,
x
.
ChildrenNum
}));
}
#
endregion
}
...
...
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