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
822ddba1
Commit
822ddba1
authored
Feb 26, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OKR评论调整
parent
01c759eb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
593 additions
and
7 deletions
+593
-7
RB_OKR_Comment.cs
Edu.Model/Entity/OKR/RB_OKR_Comment.cs
+20
-0
RB_OKR_Comment_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
+20
-0
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+311
-5
RB_OKR_CommentRepository.cs
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
+119
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+123
-2
No files found.
Edu.Model/Entity/OKR/RB_OKR_Comment.cs
View file @
822ddba1
...
...
@@ -66,5 +66,25 @@ namespace Edu.Model.Entity.OKR
/// 修改时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 类型 1目标 2结果 3进度 4周期
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 目标/结果 id
/// </summary>
public
int
TargetId
{
get
;
set
;
}
/// <summary>
/// 上级评论id
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 标识
/// </summary>
public
string
Identify
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
View file @
822ddba1
...
...
@@ -28,5 +28,25 @@ namespace Edu.Model.ViewModel.OKR
/// 创建时间
/// </summary>
public
string
CreateTimeStr
{
get
;
set
;
}
/// <summary>
/// 选中字符
/// </summary>
public
string
CheckedName
{
get
;
set
;
}
/// <summary>
/// 查询类型 1只查询目标/结果的选中评论
/// </summary>
public
int
SelectType
{
get
;
set
;
}
/// <summary>
/// 父级ids
/// </summary>
public
string
ParentIds
{
get
;
set
;
}
/// <summary>
/// 子评论列表
/// </summary>
public
List
<
RB_OKR_Comment_ViewModel
>
ChildList
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.OKR/OKRPeriodModule.cs
View file @
822ddba1
...
...
@@ -1322,7 +1322,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
foreach
(
var
item
in
list
)
{
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
item
.
IsDefaultPermission
==
2
||
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
...
...
@@ -1331,7 +1331,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
foreach
(
var
qitem
in
item
.
KeyResultList
)
{
qitem
.
IsLock
=
2
;
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
qitem
.
Id
).
Any
())
if
(
qitem
.
IsDefaultPermission
==
2
||
pkrList
.
Where
(
x
=>
x
.
TargetId
==
qitem
.
Id
).
Any
())
{
qitem
.
IsLock
=
1
;
}
...
...
@@ -2608,6 +2608,173 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
};
}
/// <summary>
/// 根据姓名查询
/// </summary>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="userName"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKROthersObjectiveDropListByName
(
int
periodId
,
int
objectiveId
,
string
userName
,
UserInfo
userInfo
)
{
List
<
int
>
MyUnderlingList
=
GetMyUnderlingUserIdList
(
userInfo
);
//查询所有用户
var
emList
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
EmployeeName
=
userName
});
emList
=
emList
.
Where
(
x
=>
x
.
Id
!=
userInfo
.
Id
).
ToList
();
//排除自己查询
var
DQUserId
=
emList
.
Select
(
x
=>
x
.
Id
).
ToList
();
//用户周期权限
List
<
RB_OKR_Objective_ViewModel
>
UserLookList
=
new
List
<
RB_OKR_Objective_ViewModel
>();
if
(
DQUserId
.
Any
())
{
DQUserId
=
DQUserId
.
Distinct
().
ToList
();
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
periodId
,
CreateByIds
=
string
.
Join
(
","
,
DQUserId
)
});
if
(
zpList
.
Any
())
{
var
pplist
=
oKR_PeriodPermissionRepository
.
GetList
(
new
Model
.
Entity
.
OKR
.
RB_OKR_PeriodPermission
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
periodId
},
string
.
Join
(
","
,
DQUserId
));
foreach
(
var
UserId
in
DQUserId
)
{
int
IsLook
=
2
;
if
(
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
).
Any
())
{
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
IsLook
=
1
;
}
}
if
(
LookList
.
Any
()
&&
pplist
.
Where
(
x
=>
x
.
CreateBy
==
UserId
).
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
{
IsLook
=
1
;
}
}
}
else
{
if
(
pplist
.
Where
(
x
=>
x
.
CreateBy
==
UserId
).
Any
())
{
IsLook
=
1
;
}
}
UserLookList
.
Add
(
new
RB_OKR_Objective_ViewModel
()
{
CreateBy
=
UserId
,
IsLock
=
IsLook
});
}
}
}
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
periodId
,
CreateByIds
=
string
.
Join
(
","
,
DQUserId
),
Status
=
2
});
if
(
list
.
Any
())
{
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
objectiveIds
});
//查询是否有权限
var
pList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
2
,
ObjectiveIds
=
objectiveIds
});
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
});
}
#
region
查询已对齐目标
//查询向上对齐
var
sdqList
=
oKR_ObjectiveRelationRepository
.
GetList
(
new
Model
.
Entity
.
OKR
.
RB_OKR_ObjectiveRelation
()
{
ObjectiveId
=
objectiveId
});
#
endregion
foreach
(
var
item
in
list
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
GetDQListLookPermission
(
userInfo
,
MyUnderlingList
,
pList
,
pkrList
,
item
);
if
(
item
.
IsDefaultState
==
1
&&
item
.
KeyResultList
.
Any
())
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
item
.
IsParent
=
2
;
if
(
sdqList
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
Any
())
{
item
.
IsParent
=
1
;
}
}
}
list
=
list
.
Where
(
x
=>
x
.
IsNotLook
==
2
).
ToList
();
List
<
object
>
RList
=
new
List
<
object
>();
foreach
(
var
item
in
DQUserId
)
{
var
emModel
=
emList
.
Where
(
x
=>
x
.
Id
==
item
).
FirstOrDefault
();
if
((
UserLookList
.
Where
(
x
=>
x
.
CreateBy
==
item
).
FirstOrDefault
()?.
IsLock
??
0
)
==
1
)
{
RList
.
Add
(
new
{
IsNotLook
=
1
,
UserId
=
emModel
.
Id
,
UserName
=
emModel
.
EmployeeName
,
UserPhoto
=
emModel
.
UserIcon
,
emModel
.
DeptName
,
emModel
.
PostName
,
List
=
new
List
<
object
>()
});
}
else
{
RList
.
Add
(
new
{
IsNotLook
=
2
,
UserId
=
emModel
.
Id
,
UserName
=
emModel
.
EmployeeName
,
UserPhoto
=
emModel
.
UserIcon
,
emModel
.
DeptName
,
emModel
.
PostName
,
List
=
list
.
Where
(
x
=>
x
.
CreateBy
==
item
).
Select
(
x
=>
new
{
x
.
Id
,
x
.
Title
,
x
.
Sort
,
x
.
Progress
,
x
.
ProgressState
,
ProgressStateName
=
x
.
ProgressState
.
ToName
(),
x
.
IsParent
,
x
.
IsLock
,
x
.
IsNotLook
,
KeyResultList
=
x
.
KeyResultList
.
Where
(
x
=>
x
.
IsNotLook
==
2
).
Select
(
z
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
Progress
,
z
.
ProgressState
,
ProgressStateName
=
z
.
ProgressState
.
ToName
(),
x
.
IsLock
,
x
.
IsNotLook
})
})
});
}
}
return
RList
;
}
/// <summary>
/// 获取我的单个目标
/// </summary>
...
...
@@ -2668,7 +2835,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
item
.
IsLock
=
2
;
item
.
IsNotLook
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
item
.
IsDefaultPermission
==
2
||
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
...
...
@@ -2677,7 +2844,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
foreach
(
var
qitem
in
item
.
KeyResultList
)
{
qitem
.
IsLock
=
2
;
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
qitem
.
Id
).
Any
())
if
(
qitem
.
IsDefaultPermission
==
2
||
pkrList
.
Where
(
x
=>
x
.
TargetId
==
qitem
.
Id
).
Any
())
{
qitem
.
IsLock
=
1
;
}
...
...
@@ -6636,7 +6803,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
else
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
),
model
.
State
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
Content
),
model
.
Content
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateTime
),
DateTime
.
Now
},
};
...
...
@@ -6650,6 +6817,145 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
return
oKR_CommentRepository
.
Update
(
keyValues
,
wheres
);
}
}
/// <summary>
/// 设置评论状态
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetCommentStatus
(
RB_OKR_Comment_ViewModel
model
)
{
var
omodel
=
oKR_CommentRepository
.
GetEntity
(
model
.
Id
);
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
),
model
.
State
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateTime
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_OKR_Comment_ViewModel
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
oKR_CommentRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
if
(
omodel
.
ParentId
>
0
&&
model
.
State
==
3
)
{
//查询该父级下是否还有未删除的评论 没有的话删除该父级评论
var
list
=
oKR_CommentRepository
.
GetList
(
new
RB_OKR_Comment_ViewModel
()
{
Group_Id
=
omodel
.
Group_Id
,
ParentId
=
omodel
.
ParentId
});
if
(!
list
.
Any
())
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
),
3
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_OKR_Comment_ViewModel
.
UpdateTime
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_OKR_Comment_ViewModel
.
Id
),
FiledValue
=
omodel
.
ParentId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
oKR_CommentRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
}
return
flag
;
}
/// <summary>
/// 设置目标/结果选择评论
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetOKRCheckedComment
(
RB_OKR_Comment_ViewModel
extModel
,
out
int
CommentId
)
{
//先新增主标题
int
Id
=
oKR_CommentRepository
.
Insert
(
new
Model
.
Entity
.
OKR
.
RB_OKR_Comment
()
{
Id
=
extModel
.
Id
,
Type
=
extModel
.
Type
,
AccountId
=
extModel
.
AccountId
,
Content
=
extModel
.
CheckedName
,
CreateBy
=
extModel
.
CreateBy
,
CreateTime
=
extModel
.
CreateTime
,
Group_Id
=
extModel
.
Group_Id
,
Identify
=
extModel
.
Identify
,
ParentId
=
0
,
PeriodId
=
extModel
.
PeriodId
,
School_Id
=
extModel
.
School_Id
,
State
=
1
,
TargetId
=
extModel
.
TargetId
,
UpdateBy
=
extModel
.
UpdateBy
,
UpdateTime
=
extModel
.
UpdateTime
});
//增加子评论
if
(
Id
>
0
)
{
oKR_CommentRepository
.
Insert
(
new
Model
.
Entity
.
OKR
.
RB_OKR_Comment
()
{
Id
=
extModel
.
Id
,
Type
=
extModel
.
Type
,
AccountId
=
extModel
.
AccountId
,
Content
=
extModel
.
Content
,
CreateBy
=
extModel
.
CreateBy
,
CreateTime
=
extModel
.
CreateTime
,
Group_Id
=
extModel
.
Group_Id
,
Identify
=
""
,
ParentId
=
Id
,
PeriodId
=
extModel
.
PeriodId
,
School_Id
=
extModel
.
School_Id
,
State
=
1
,
TargetId
=
0
,
UpdateBy
=
extModel
.
UpdateBy
,
UpdateTime
=
extModel
.
UpdateTime
});
}
CommentId
=
Id
;
return
Id
>
0
;
}
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetCommentPageList_V2
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_OKR_Comment_ViewModel
query
)
{
var
list
=
oKR_CommentRepository
.
GetCommentPageList_V2
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
.
Any
())
{
//非周期评论的 都需要查询下级评论
string
cids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
Type
!=
4
).
Select
(
x
=>
x
.
Id
));
List
<
RB_OKR_Comment_ViewModel
>
ChildList
=
new
List
<
RB_OKR_Comment_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
cids
))
{
ChildList
=
oKR_CommentRepository
.
GetList_V2
(
new
RB_OKR_Comment_ViewModel
()
{
Group_Id
=
query
.
Group_Id
,
ParentIds
=
cids
});
}
foreach
(
var
item
in
list
)
{
item
.
ChildList
=
new
List
<
RB_OKR_Comment_ViewModel
>();
if
(
item
.
Type
==
4
)
{
//组装成新数据
item
.
ChildList
.
Add
(
new
RB_OKR_Comment_ViewModel
()
{
Id
=
item
.
Id
,
Type
=
item
.
Type
,
Content
=
item
.
Content
,
CreateByName
=
item
.
CreateByName
,
CreateByIco
=
item
.
CreateByIco
,
CreateTime
=
item
.
CreateTime
});
item
.
Content
=
"评论"
;
}
else
{
item
.
ChildList
=
ChildList
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
}
}
}
return
list
;
}
#
endregion
#
region
数据分布
...
...
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
View file @
822ddba1
using
Edu.Common.Enum
;
using
Edu.Model.Entity.OKR
;
using
Edu.Model.ViewModel.OKR
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -45,6 +46,19 @@ namespace Edu.Repository.OKR
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_OKR_Comment_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
...
...
@@ -80,5 +94,110 @@ namespace Edu.Repository.OKR
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取分页列表(历史评论+选中评论)
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetCommentPageList_V2
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_OKR_Comment_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and c.State <> 3 and c.ParentId =0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
PeriodId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
PeriodId
)}
=
{
demodel
.
PeriodId
}
"
;
}
if
(
demodel
.
State
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(
demodel
.
AccountId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
if
(
demodel
.
SelectType
==
1
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
in(1,2,3)"
;
}
string
sql
=
$@" select c.*,e.EmName as UpdateByName from RB_OKR_Comment c
left join rb_employee e on c.UpdateBy = e.EmployeeId
where
{
where
}
order by c.Id asc"
;
return
GetPage
<
RB_OKR_Comment_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetList_V2
(
RB_OKR_Comment_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and c.State <> 3"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
PeriodId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
PeriodId
)}
=
{
demodel
.
PeriodId
}
"
;
}
if
(
demodel
.
State
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(
demodel
.
AccountId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ParentIds
))
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
in(
{
demodel
.
ParentIds
}
)"
;
}
string
sql
=
$@" select c.*,e.EmName as CreateByName,e.EmPhoto as CreateByIco from RB_OKR_Comment c
left join rb_employee e on c.CreateBy = e.EmployeeId
where
{
where
}
order by c.Id asc"
;
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
822ddba1
...
...
@@ -832,6 +832,35 @@ namespace Edu.WebApi.Controllers.OKR
var
list
=
okrPeriodModule
.
GetOKROthersObjectiveDropList
(
PeriodId
,
ObjectiveId
,
UserId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取他人的目标列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKROthersObjectiveDropListByName
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
//周期id
string
UserName
=
parms
.
GetStringValue
(
"UserName"
);
//用户名称
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
//当前目标
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
string
.
IsNullOrEmpty
(
UserName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递用户名称"
);
}
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递当前目标id"
);
}
var
list
=
okrPeriodModule
.
GetOKROthersObjectiveDropListByName
(
PeriodId
,
ObjectiveId
,
UserName
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
#
endregion
#
region
权限控制
...
...
@@ -1676,6 +1705,7 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
query
.
Type
=
4
;
var
list
=
okrPeriodModule
.
GetCommentPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
...
...
@@ -1706,7 +1736,9 @@ namespace Edu.WebApi.Controllers.OKR
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
),
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
),
Content
=
base
.
ParmJObj
.
GetStringValue
(
"Content"
),
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
)
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
),
Type
=
base
.
ParmJObj
.
GetInt
(
"Type"
,
0
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
,
0
)
};
if
(
extModel
.
PeriodId
<=
0
)
{
...
...
@@ -1750,11 +1782,100 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
ParamIsNull
(
message
:
"请传递评论状态!"
);
}
extModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
bool
flag
=
okrPeriodModule
.
Set
OKRComment
(
extModel
);
bool
flag
=
okrPeriodModule
.
Set
CommentStatus
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 新增评论状态
/// </summary>
/// <returns></returns>
public
ApiResult
SetOKRCheckedComment
()
{
var
userInfo
=
base
.
UserInfo
;
var
extModel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Comment_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
extModel
.
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
extModel
.
AccountId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
if
(
string
.
IsNullOrEmpty
(
extModel
.
CheckedName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递选中内容"
);
}
if
(
string
.
IsNullOrEmpty
(
extModel
.
Content
))
{
return
ApiResult
.
ParamIsNull
(
"请传递内容"
);
}
if
(
extModel
.
Type
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递类型"
);
}
if
(
extModel
.
TargetId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标/结果id"
);
}
extModel
.
CreateBy
=
userInfo
.
Id
;
extModel
.
State
=
1
;
extModel
.
CreateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateBy
=
userInfo
.
Id
;
extModel
.
Group_Id
=
userInfo
.
Group_Id
;
bool
flag
=
okrPeriodModule
.
SetOKRCheckedComment
(
extModel
,
out
int
Id
);
return
flag
?
ApiResult
.
Success
(
""
,
Id
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommentPageList_V2
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_OKR_Comment_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
),
State
=
base
.
ParmJObj
.
GetInt
(
"State"
,
0
),
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
,
0
),
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
),
SelectType
=
base
.
ParmJObj
.
GetInt
(
"SelectType"
,
0
)
};
if
(
query
.
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递期数"
);
}
if
(
query
.
AccountId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetCommentPageList_V2
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
UpdateByName
,
x
.
Content
,
x
.
Type
,
x
.
TargetId
,
x
.
Identify
,
x
.
State
,
CreateTimeStr
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
ChildList
=
x
.
ChildList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
CreateByName
,
z
.
CreateByIco
,
z
.
Content
,
z
.
Type
,
CreateTimeStr
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
})
});
return
ApiResult
.
Success
(
data
:
pageModel
);
}
#
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