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
d34a8b37
Commit
d34a8b37
authored
Jan 07, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f00e9096
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1125 additions
and
189 deletions
+1125
-189
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+1009
-187
RB_OKR_ObjectiveRelationRepository.cs
Edu.Repository/OKR/RB_OKR_ObjectiveRelationRepository.cs
+24
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+92
-2
No files found.
Edu.Module.OKR/OKRPeriodModule.cs
View file @
d34a8b37
...
@@ -897,6 +897,8 @@ namespace Edu.Module.OKR
...
@@ -897,6 +897,8 @@ namespace Edu.Module.OKR
{
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
item
.
CreateBy
!=
userInfo
.
Id
)
{
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
...
@@ -935,10 +937,13 @@ namespace Edu.Module.OKR
...
@@ -935,10 +937,13 @@ namespace Edu.Module.OKR
}
}
}
}
}
}
}
foreach
(
var
item
in
xdqlist
)
foreach
(
var
item
in
xdqlist
)
{
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
item
.
CreateBy
!=
userInfo
.
Id
)
{
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
...
@@ -977,6 +982,7 @@ namespace Edu.Module.OKR
...
@@ -977,6 +982,7 @@ namespace Edu.Module.OKR
}
}
}
}
}
}
}
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
...
@@ -1122,9 +1128,9 @@ namespace Edu.Module.OKR
...
@@ -1122,9 +1128,9 @@ namespace Edu.Module.OKR
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
{
z
.
Id
,
z
.
Id
,
Name
=
z
.
IsLock
==
1
?
""
:
z
.
Name
,
Name
=
y
.
AccountId
!=
userInfo
.
Id
&&
z
.
IsLock
==
1
?
""
:
z
.
Name
,
z
.
Sort
,
z
.
Sort
,
z
.
IsLock
IsLock
=
y
.
AccountId
==
userInfo
.
Id
?
2
:
z
.
IsLock
}),
}),
})
})
}),
}),
...
@@ -1142,9 +1148,9 @@ namespace Edu.Module.OKR
...
@@ -1142,9 +1148,9 @@ namespace Edu.Module.OKR
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
{
z
.
Id
,
z
.
Id
,
Name
=
z
.
IsLock
==
1
?
""
:
z
.
Name
,
Name
=
y
.
AccountId
!=
userInfo
.
Id
&&
z
.
IsLock
==
1
?
""
:
z
.
Name
,
z
.
Sort
,
z
.
Sort
,
z
.
IsLock
IsLock
=
y
.
AccountId
==
userInfo
.
Id
?
2
:
z
.
IsLock
}),
}),
})
})
}),
}),
...
@@ -1153,44 +1159,66 @@ namespace Edu.Module.OKR
...
@@ -1153,44 +1159,66 @@ namespace Edu.Module.OKR
}
}
/// <summary>
/// <summary>
/// 获取
待我审核列表
/// 获取
他人单个目标
/// </summary>
/// </summary>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="userId"></param>
/// <param name="userInfo"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
/// <returns></returns>
public
ApiResult
GetOKRObjectiveAuditList
(
int
PeriodId
,
int
user
Id
,
UserInfo
userInfo
)
public
object
GetOKROthersObjectiveInfo
(
int
PeriodId
,
int
userId
,
int
objective
Id
,
UserInfo
userInfo
)
{
{
List
<
int
>
UserIdList
=
new
List
<
int
>();
//查询是否有权限
#
region
我的直属下级
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
PeriodId
,
CreateBy
=
userId
});
var
deptModel
=
departmentRepository
.
GetEntity
(
userInfo
.
DeptId
);
if
(
zpList
.
Any
())
var
emList
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
DirectSupervisor
=
userInfo
.
Id
});
if
(
emList
.
Any
())
{
{
foreach
(
var
item
in
emList
)
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
{
UserIdList
.
Add
(
item
.
Id
);
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
return
new
{
Status
=
2
,
Msg
=
"没有权限查询"
};
}
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
return
new
{
Status
=
2
,
Msg
=
"没有权限查询"
};
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
{
//查询该部门下所有人
return
new
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
{
UserIdList
.
Add
(
item
.
Id
);
Status
=
2
,
Msg
=
"没有权限查询"
};
}
}
}
}
#
endregion
if
(
LookList
.
Any
())
if
(!
UserIdList
.
Contains
(
userId
))
{
{
return
ApiResult
.
Failed
(
"该用户不是直属下级,无法审核"
);
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
}
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
CreateBy
=
userId
,
Status
=
1
});
else
{
return
new
{
Status
=
2
,
Msg
=
"没有权限查询"
};
}
}
}
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Id
=
objectiveId
,
PeriodId
=
PeriodId
,
CreateBy
=
userId
,
Status
=
2
});
if
(
list
.
Any
())
if
(
list
.
Any
())
{
{
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
...
@@ -1229,35 +1257,173 @@ namespace Edu.Module.OKR
...
@@ -1229,35 +1257,173 @@ namespace Edu.Module.OKR
{
{
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
{
item
.
IsLock
=
1
;
item
.
IsLock
=
1
;
}
}
}
}
}
}
}
foreach
(
var
item
in
sdqlist
)
foreach
(
var
item
in
sdqlist
)
{
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
item
.
CreateBy
!=
userInfo
.
Id
)
{
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
{
item
.
IsLock
=
1
;
item
.
IsLock
=
1
;
}
}
}
}
}
}
}
}
foreach
(
var
item
in
xdqlist
)
foreach
(
var
item
in
xdqlist
)
{
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
item
.
CreateBy
!=
userInfo
.
Id
)
{
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
{
item
.
IsLock
=
1
;
item
.
IsLock
=
1
;
}
}
}
}
}
}
}
}
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
item
.
IsLock
=
2
;
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
{
item
.
IsLock
=
1
;
item
.
IsLock
=
1
;
}
}
}
}
}
//结果列表
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
if
(
item
.
IsDefaultState
==
1
)
...
@@ -1313,7 +1479,10 @@ namespace Edu.Module.OKR
...
@@ -1313,7 +1479,10 @@ namespace Edu.Module.OKR
#
endregion
#
endregion
}
}
}
}
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
var
x
=
list
.
Where
(
x
=>
x
.
IsLock
==
2
).
FirstOrDefault
();
if
(
x
==
null
)
{
return
null
;
}
return
new
{
{
x
.
Id
,
x
.
Id
,
x
.
Title
,
x
.
Title
,
...
@@ -1329,7 +1498,7 @@ namespace Edu.Module.OKR
...
@@ -1329,7 +1498,7 @@ namespace Edu.Module.OKR
x
.
IsLock
,
x
.
IsLock
,
x
.
ScoreName
,
x
.
ScoreName
,
x
.
ScoreColor
,
x
.
ScoreColor
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
KeyResultList
=
x
.
KeyResultList
.
Where
(
x
=>
x
.
IsLock
==
2
).
Select
(
z
=>
new
{
{
z
.
Id
,
z
.
Id
,
z
.
Name
,
z
.
Name
,
...
@@ -1355,15 +1524,15 @@ namespace Edu.Module.OKR
...
@@ -1355,15 +1524,15 @@ namespace Edu.Module.OKR
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
{
q
.
Id
,
q
.
Id
,
q
.
Title
,
Title
=
q
.
IsLock
==
1
?
""
:
q
.
Title
,
q
.
Sort
,
q
.
Sort
,
q
.
IsLock
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
{
z
.
Id
,
z
.
Id
,
z
.
Name
,
Name
=
y
.
AccountId
!=
userInfo
.
Id
&&
z
.
IsLock
==
1
?
""
:
z
.
Name
,
z
.
Sort
,
z
.
Sort
,
z
.
IsLock
IsLock
=
y
.
AccountId
==
userInfo
.
Id
?
2
:
z
.
IsLock
}),
}),
})
})
}),
}),
...
@@ -1375,53 +1544,291 @@ namespace Edu.Module.OKR
...
@@ -1375,53 +1544,291 @@ namespace Edu.Module.OKR
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
{
q
.
Id
,
q
.
Id
,
q
.
Title
,
Title
=
q
.
IsLock
==
1
?
""
:
q
.
Title
,
q
.
Sort
,
q
.
Sort
,
q
.
IsLock
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
{
z
.
Id
,
z
.
Id
,
z
.
Name
,
Name
=
y
.
AccountId
!=
userInfo
.
Id
&&
z
.
IsLock
==
1
?
""
:
z
.
Name
,
z
.
Sort
,
z
.
Sort
,
z
.
IsLock
IsLock
=
y
.
AccountId
==
userInfo
.
Id
?
2
:
z
.
IsLock
}),
}),
})
})
}),
}),
})
};
);
}
}
/// <summary>
/// <summary>
/// 获取
他人的目标下拉
列表
/// 获取
待我审核
列表
/// </summary>
/// </summary>
/// <param name="periodId"></param>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="userId"></param>
/// <param name="userId"></param>
/// <param name="userInfo"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
/// <returns></returns>
public
object
GetOKROthersObjectiveDropList
(
int
periodId
,
int
objectiveId
,
int
userId
,
UserInfo
userInfo
)
public
ApiResult
GetOKRObjectiveAuditList
(
int
PeriodId
,
int
userId
,
UserInfo
userInfo
)
{
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
periodId
,
CreateBy
=
userId
});
if
(
zpList
.
Any
())
{
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
return
new
{
{
Status
=
2
,
List
<
int
>
UserIdList
=
new
List
<
int
>();
Msg
=
"没有权限查询"
#
region
我的直属下级
}
;
var
deptModel
=
departmentRepository
.
GetEntity
(
userInfo
.
DeptId
)
;
}
var
emList
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
DirectSupervisor
=
userInfo
.
Id
});
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
)
.
Any
())
if
(
emList
.
Any
())
{
{
return
new
foreach
(
var
item
in
emList
)
{
{
Status
=
2
,
UserIdList
.
Add
(
item
.
Id
);
Msg
=
"没有权限查询"
}
};
}
//如果是部门主管 需要将部门下除自己其他人加入
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
UserIdList
.
Add
(
item
.
Id
);
}
}
#
endregion
if
(!
UserIdList
.
Contains
(
userId
))
{
return
ApiResult
.
Failed
(
"该用户不是直属下级,无法审核"
);
}
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
CreateBy
=
userId
,
Status
=
1
});
if
(
list
.
Any
())
{
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
//查询向上对齐
var
sdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ObjectiveIds
=
objectiveIds
});
//查询向下对齐
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ParentIds
=
objectiveIds
});
string
jObjectiveIds
=
objectiveIds
;
if
(
sdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
}
if
(
xdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
}
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
//查询是否有权限
var
pList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
2
,
ObjectiveIds
=
jObjectiveIds
});
var
pkrList
=
new
List
<
RB_OKR_Permission_ViewModel
>();
if
(
krList
.
Any
())
{
string
krIds
=
string
.
Join
(
","
,
krList
.
Select
(
x
=>
x
.
Id
));
pkrList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
3
,
ObjectiveIds
=
krIds
});
}
string
scoreRuleIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ScoreRuleId
>
0
).
Select
(
x
=>
x
.
ScoreRuleId
));
var
ScoreRuleList
=
new
List
<
RB_OKR_ScoreDetail_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
scoreRuleIds
))
{
ScoreRuleList
=
oKR_ScoreDetailRepository
.
GetList
(
new
RB_OKR_ScoreDetail_ViewModel
()
{
ScoreIds
=
scoreRuleIds
});
}
foreach
(
var
item
in
krList
)
{
item
.
IsLock
=
2
;
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
}
foreach
(
var
item
in
sdqlist
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
}
foreach
(
var
item
in
xdqlist
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
}
foreach
(
var
item
in
list
)
{
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
#
region
对齐列表
var
sdqclist
=
sdqlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList
=
sdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ParentList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList
)
{
item
.
ParentList
.
Add
(
new
ObjectiveEmployeeModel
()
{
AccountId
=
qitem
,
AccountName
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
}
var
xdqclist
=
xdqlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList2
=
xdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ChildList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList2
)
{
item
.
ChildList
.
Add
(
new
ObjectiveEmployeeModel
()
{
AccountId
=
qitem
,
AccountName
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
}
#
endregion
#
region
分数显示
item
.
ScoreName
=
""
;
item
.
ScoreColor
=
""
;
if
(
item
.
ScoreRuleId
>
0
)
{
var
scoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
item
.
Score
&&
x
.
ScoreMax
>=
item
.
Score
).
FirstOrDefault
();
item
.
ScoreName
=
scoreRuleModel
?.
Name
??
""
;
item
.
ScoreColor
=
scoreRuleModel
?.
Color
??
""
;
foreach
(
var
qitem
in
item
.
KeyResultList
)
{
var
qscoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
qitem
.
Score
&&
x
.
ScoreMax
>=
qitem
.
Score
).
FirstOrDefault
();
qitem
.
ScoreName
=
qscoreRuleModel
?.
Name
??
""
;
qitem
.
ScoreColor
=
qscoreRuleModel
?.
Color
??
""
;
}
}
#
endregion
}
}
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Title
,
x
.
Sort
,
x
.
Progress
,
x
.
Weight
,
x
.
Score
,
x
.
ProgressRemark
,
x
.
IsDefaultState
,
x
.
ProgressState
,
ProgressStateName
=
x
.
ProgressState
.
ToName
(),
x
.
Status
,
x
.
IsLock
,
x
.
ScoreName
,
x
.
ScoreColor
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
Progress
,
z
.
Weight
,
z
.
Score
,
z
.
ProgressState
,
ProgressStateName
=
z
.
ProgressState
.
ToName
(),
z
.
StartValue
,
z
.
EndValue
,
z
.
CurrentValue
,
z
.
IsEasyMode
,
z
.
IsLock
,
z
.
ScoreName
,
z
.
ScoreColor
}),
ParentList
=
x
.
ParentList
.
Select
(
y
=>
new
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
IsLock
}),
})
}),
ChildList
=
x
.
ChildList
.
Select
(
y
=>
new
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
IsLock
}),
})
}),
})
);
}
/// <summary>
/// 获取他人的目标下拉列表
/// </summary>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="userId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKROthersObjectiveDropList
(
int
periodId
,
int
objectiveId
,
int
userId
,
UserInfo
userInfo
)
{
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
periodId
,
CreateBy
=
userId
});
if
(
zpList
.
Any
())
{
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
return
new
{
Status
=
2
,
Msg
=
"没有权限查询"
};
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
return
new
{
Status
=
2
,
Msg
=
"没有权限查询"
};
}
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
{
...
@@ -2867,7 +3274,7 @@ namespace Edu.Module.OKR
...
@@ -2867,7 +3274,7 @@ namespace Edu.Module.OKR
{
{
var
vlist
=
oKR_ObjectiveRelationRepository
.
GetList
(
new
Model
.
Entity
.
OKR
.
RB_OKR_ObjectiveRelation
()
{
ObjectiveId
=
objectiveId
,
ParentId
=
parentId
});
var
vlist
=
oKR_ObjectiveRelationRepository
.
GetList
(
new
Model
.
Entity
.
OKR
.
RB_OKR_ObjectiveRelation
()
{
ObjectiveId
=
objectiveId
,
ParentId
=
parentId
});
if
(
vlist
.
Any
())
{
if
(
vlist
.
Any
())
{
return
"已
存在
对齐,无法再次对齐"
;
return
"已
向该 Objective
对齐,无法再次对齐"
;
}
}
var
omodel
=
oKR_ObjectiveRepository
.
GetEntity
(
objectiveId
);
var
omodel
=
oKR_ObjectiveRepository
.
GetEntity
(
objectiveId
);
var
pmodel
=
oKR_ObjectiveRepository
.
GetEntity
(
parentId
);
var
pmodel
=
oKR_ObjectiveRepository
.
GetEntity
(
parentId
);
...
@@ -2887,8 +3294,12 @@ namespace Edu.Module.OKR
...
@@ -2887,8 +3294,12 @@ namespace Edu.Module.OKR
if
(
pmodel
.
Status
!=
2
)
{
if
(
pmodel
.
Status
!=
2
)
{
return
"未审核目标,无法对齐"
;
return
"未审核目标,无法对齐"
;
}
}
//验证是否会出现循环对齐 父级继续向上找, 当前向下找;看是否有交集
//验证是否会出现循环对齐 父级继续向上找/当前向下找;看是否有交集
string
childIds
=
oKR_ObjectiveRelationRepository
.
GetObjectiveChildIds
(
objectiveId
);
if
(
childIds
.
Split
(
','
).
Contains
(
parentId
.
ToString
()))
{
return
"对齐失败,该 Objective 已向你对齐"
;
}
int
Id
=
oKR_ObjectiveRelationRepository
.
Insert
(
new
Model
.
Entity
.
OKR
.
RB_OKR_ObjectiveRelation
()
int
Id
=
oKR_ObjectiveRelationRepository
.
Insert
(
new
Model
.
Entity
.
OKR
.
RB_OKR_ObjectiveRelation
()
{
{
...
@@ -4485,6 +4896,417 @@ namespace Edu.Module.OKR
...
@@ -4485,6 +4896,417 @@ namespace Edu.Module.OKR
}
}
}
}
/// <summary>
/// 获取管理端 对齐视图
/// </summary>
/// <param name="PeriodId"></param>
/// <param name="UserId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKRAdminAlignView
(
int
PeriodId
,
int
UserId
,
UserInfo
userInfo
)
{
var
list
=
oKR_ObjectiveRepository
.
GetListForEmName
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
Status
=
2
,
CreateBy
=
UserId
});
if
(
list
.
Any
())
{
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
//查询向上对齐
var
sdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ObjectiveIds
=
objectiveIds
});
if
(
sdqlist
.
Any
())
{
//查询上对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetParentAlignNum
(
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
sdqlist
)
{
item
.
ParentNum
=
rlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
FirstOrDefault
()?.
ParentId
??
0
;
}
}
//查询向下对齐
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ParentIds
=
objectiveIds
});
if
(
xdqlist
.
Any
())
{
//查询下对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetChildAlignNum
(
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
xdqlist
)
{
item
.
ChildNum
=
rlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
FirstOrDefault
()?.
ObjectiveId
??
0
;
}
}
List
<
int
>
DQUserId
=
new
List
<
int
>();
string
jObjectiveIds
=
objectiveIds
;
if
(
sdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
sdqlist
.
Select
(
x
=>
x
.
CreateBy
));
}
if
(
xdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
xdqlist
.
Select
(
x
=>
x
.
CreateBy
));
}
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
foreach
(
var
item
in
sdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
}
foreach
(
var
item
in
xdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
}
foreach
(
var
item
in
list
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
#
region
对齐列表
item
.
ParentSingleList
=
sdqlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
ChildSingleList
=
xdqlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
#
endregion
}
}
return
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Title
,
x
.
Sort
,
x
.
Progress
,
x
.
ProgressState
,
ProgressStateName
=
x
.
ProgressState
.
ToName
(),
x
.
Status
,
x
.
EmName
,
x
.
EmPhoto
,
ParentList
=
x
.
ParentSingleList
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
ProgressState
,
IsLock
=
2
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ParentNum
,
y
.
EmName
,
y
.
EmPhoto
}),
ChildList
=
x
.
ChildSingleList
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
ProgressState
,
IsLock
=
2
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ChildNum
,
y
.
EmName
,
y
.
EmPhoto
}),
});
}
/// <summary>
/// 获取我的对齐视图 再下一级
/// </summary>
/// <param name="PeriodId"></param>
/// <param name="objectiveId"></param>
/// <param name="type"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKRAdminAlignViewNext
(
int
PeriodId
,
int
objectiveId
,
int
type
,
UserInfo
userInfo
)
{
if
(
type
==
1
)
{
//查询向上对齐
var
sdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ObjectiveIds
=
objectiveId
.
ToString
()
});
if
(
sdqlist
.
Any
())
{
//查询上对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetParentAlignNum
(
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
sdqlist
)
{
item
.
ParentNum
=
rlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
FirstOrDefault
()?.
ParentId
??
0
;
}
}
else
{
return
new
List
<
object
>();
}
string
jObjectiveIds
=
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
foreach
(
var
item
in
sdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
}
return
sdqlist
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
ProgressState
,
IsLock
=
2
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ParentNum
,
y
.
EmName
,
y
.
EmPhoto
});
}
else
{
//查询向下对齐
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ParentIds
=
objectiveId
.
ToString
()
});
if
(
xdqlist
.
Any
())
{
//查询下对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetChildAlignNum
(
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
xdqlist
)
{
item
.
ChildNum
=
rlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
FirstOrDefault
()?.
ObjectiveId
??
0
;
}
}
else
{
return
new
List
<
object
>();
}
string
jObjectiveIds
=
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
foreach
(
var
item
in
xdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
}
return
xdqlist
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
ProgressState
,
IsLock
=
2
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ChildNum
,
y
.
EmName
,
y
.
EmPhoto
});
}
}
/// <summary>
/// 获取管理员查看单个目标
/// </summary>
/// <param name="objectiveId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKRAdminLookObjectiveInfo
(
int
objectiveId
,
UserInfo
userInfo
)
{
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Id
=
objectiveId
});
if
(
list
.
Any
())
{
var
mdoel
=
list
.
FirstOrDefault
();
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
//查询向上对齐
var
sdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
mdoel
.
PeriodId
,
ObjectiveIds
=
objectiveIds
});
//查询向下对齐
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
mdoel
.
PeriodId
,
ParentIds
=
objectiveIds
});
string
jObjectiveIds
=
objectiveIds
;
if
(
sdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
}
if
(
xdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
}
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
string
scoreRuleIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ScoreRuleId
>
0
).
Select
(
x
=>
x
.
ScoreRuleId
));
var
ScoreRuleList
=
new
List
<
RB_OKR_ScoreDetail_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
scoreRuleIds
))
{
ScoreRuleList
=
oKR_ScoreDetailRepository
.
GetList
(
new
RB_OKR_ScoreDetail_ViewModel
()
{
ScoreIds
=
scoreRuleIds
});
}
foreach
(
var
item
in
sdqlist
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
}
foreach
(
var
item
in
xdqlist
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
}
foreach
(
var
item
in
list
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
#
region
对齐列表
var
sdqclist
=
sdqlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList
=
sdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ParentList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList
)
{
item
.
ParentList
.
Add
(
new
ObjectiveEmployeeModel
()
{
AccountId
=
qitem
,
AccountName
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
}
var
xdqclist
=
xdqlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList2
=
xdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ChildList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList2
)
{
item
.
ChildList
.
Add
(
new
ObjectiveEmployeeModel
()
{
AccountId
=
qitem
,
AccountName
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
}
#
endregion
#
region
分数显示
item
.
ScoreName
=
""
;
item
.
ScoreColor
=
""
;
if
(
item
.
ScoreRuleId
>
0
)
{
var
scoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
item
.
Score
&&
x
.
ScoreMax
>=
item
.
Score
).
FirstOrDefault
();
item
.
ScoreName
=
scoreRuleModel
?.
Name
??
""
;
item
.
ScoreColor
=
scoreRuleModel
?.
Color
??
""
;
foreach
(
var
qitem
in
item
.
KeyResultList
)
{
var
qscoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
qitem
.
Score
&&
x
.
ScoreMax
>=
qitem
.
Score
).
FirstOrDefault
();
qitem
.
ScoreName
=
qscoreRuleModel
?.
Name
??
""
;
qitem
.
ScoreColor
=
qscoreRuleModel
?.
Color
??
""
;
}
}
#
endregion
}
}
var
x
=
list
.
FirstOrDefault
();
if
(
x
==
null
)
{
return
null
;
}
return
new
{
x
.
Id
,
x
.
Title
,
x
.
Sort
,
x
.
Progress
,
x
.
Weight
,
x
.
Score
,
x
.
ProgressRemark
,
x
.
IsDefaultState
,
x
.
ProgressState
,
ProgressStateName
=
x
.
ProgressState
.
ToName
(),
x
.
Status
,
IsLock
=
2
,
x
.
ScoreName
,
x
.
ScoreColor
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
Progress
,
z
.
Weight
,
z
.
Score
,
z
.
ProgressState
,
ProgressStateName
=
z
.
ProgressState
.
ToName
(),
z
.
StartValue
,
z
.
EndValue
,
z
.
CurrentValue
,
z
.
IsEasyMode
,
IsLock
=
2
,
z
.
ScoreName
,
z
.
ScoreColor
}),
ParentList
=
x
.
ParentList
.
Select
(
y
=>
new
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
IsLock
=
2
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
IsLock
=
2
,
}),
})
}),
ChildList
=
x
.
ChildList
.
Select
(
y
=>
new
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
IsLock
=
2
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
IsLock
=
2
,
}),
})
}),
};
}
#
endregion
#
endregion
#
region
okr
任务评论
#
region
okr
任务评论
...
...
Edu.Repository/OKR/RB_OKR_ObjectiveRelationRepository.cs
View file @
d34a8b37
...
@@ -56,5 +56,29 @@ namespace Edu.Repository.OKR
...
@@ -56,5 +56,29 @@ namespace Edu.Repository.OKR
string
sql
=
$@" select ParentId,COUNT(0) AS ObjectiveId from RB_OKR_ObjectiveRelation WHERE ParentId in(
{
ObjectiveIds
}
) GROUP BY ParentId"
;
string
sql
=
$@" select ParentId,COUNT(0) AS ObjectiveId from RB_OKR_ObjectiveRelation WHERE ParentId in(
{
ObjectiveIds
}
) GROUP BY ParentId"
;
return
Get
<
RB_OKR_ObjectiveRelation
>(
sql
).
ToList
();
return
Get
<
RB_OKR_ObjectiveRelation
>(
sql
).
ToList
();
}
}
/// <summary>
/// 获取目标的上对齐 所有的目标
/// </summary>
/// <param name="objectiveId"></param>
/// <returns></returns>
public
string
GetObjectiveParentIds
(
int
objectiveId
)
{
string
sql
=
$" SELECT func_okr_getobjectiveparentids(
{
objectiveId
}
);"
;
var
obj
=
ExecuteScalar
(
sql
);
return
obj
==
null
?
""
:
obj
.
ToString
();
}
/// <summary>
/// 获取目标的下对齐 所有的目标
/// </summary>
/// <param name="objectiveId"></param>
/// <returns></returns>
public
string
GetObjectiveChildIds
(
int
objectiveId
)
{
string
sql
=
$" SELECT func_okr_getobjectivechildids(
{
objectiveId
}
);"
;
var
obj
=
ExecuteScalar
(
sql
);
return
obj
==
null
?
""
:
obj
.
ToString
();
}
}
}
}
}
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
d34a8b37
...
@@ -980,6 +980,39 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -980,6 +980,39 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
Success
(
""
,
list
);
return
ApiResult
.
Success
(
""
,
list
);
}
}
/// <summary>
/// 获取他人的单个目标
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKROthersObjectiveInfo
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
int
UserId
=
parms
.
GetInt
(
"UserId"
,
0
);
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标id"
);
}
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
UserId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递当前用户id"
);
}
if
(
UserId
==
userInfo
.
Id
)
{
return
ApiResult
.
Failed
(
"只能查看他人目标"
);
}
var
obj
=
okrPeriodModule
.
GetOKROthersObjectiveInfo
(
PeriodId
,
UserId
,
ObjectiveId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
obj
);
}
#
endregion
#
endregion
#
region
关注
#
region
关注
...
@@ -1209,12 +1242,69 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -1209,12 +1242,69 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
Success
(
""
,
obj
);
return
ApiResult
.
Success
(
""
,
obj
);
}
}
#
endregion
/// <summary>
/// 获取管理员对齐视图
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRAdminAlignView
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
int
UserId
=
parms
.
GetInt
(
"UserId"
,
0
);
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
var
obj
=
okrPeriodModule
.
GetOKRAdminAlignView
(
PeriodId
,
UserId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
obj
);
}
#
region
后台管理
/// <summary>
/// 获取管理员对齐视图 再下一级
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRAdminAlignViewNext
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
//目标id
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
//类型 1向上 2向下
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关联目标id"
);
}
var
obj
=
okrPeriodModule
.
GetOKRAdminAlignViewNext
(
PeriodId
,
ObjectiveId
,
Type
,
userInfo
);
return
ApiResult
.
Success
(
""
,
obj
);
}
/// <summary>
/// 获取管理员查看单个目标
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRAdminLookObjectiveInfo
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标id"
);
}
var
obj
=
okrPeriodModule
.
GetOKRAdminLookObjectiveInfo
(
ObjectiveId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
obj
);
}
#
endregion
#
endregion
#
region
okr
评论管理
#
region
okr
评论管理
...
...
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