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
6607a38b
Commit
6607a38b
authored
Jan 05, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
a6b7e41d
d456a39e
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
574 additions
and
178 deletions
+574
-178
StringHelper.cs
Edu.Common/Plugin/StringHelper.cs
+58
-1
RB_Question.cs
Edu.Model/Entity/Question/RB_Question.cs
+86
-80
RB_Question_Point.cs
Edu.Model/Entity/Question/RB_Question_Point.cs
+0
-5
RB_OKR_Comment_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
+18
-0
RB_Question_Answer_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_Answer_ViewModel.cs
+1
-20
RB_Question_Point_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_Point_ViewModel.cs
+5
-0
RB_Question_Type_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_Type_ViewModel.cs
+65
-1
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+23
-2
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+57
-0
QuestionModule.cs
Edu.Module.Question/QuestionModule.cs
+4
-2
RB_OKR_CommentRepository.cs
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
+8
-2
RB_QuestionRepository.cs
Edu.Repository/Question/RB_QuestionRepository.cs
+12
-6
RB_Question_PointRepository.cs
Edu.Repository/Question/RB_Question_PointRepository.cs
+4
-4
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+43
-3
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+190
-52
No files found.
Edu.Common/Plugin/StringHelper.cs
View file @
6607a38b
...
@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin
...
@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin
#
endregion
#
endregion
#
region
"日期相关"
#
region
"日期相关"
public
static
string
DateFormatToString
(
DateTime
dt
)
{
//TimeSpan表示时间间隔
TimeSpan
span
=
(
DateTime
.
Now
-
dt
).
Duration
();
//表示取timespan绝对值
//if (span.TotalDays > 60)
//{
// return dt.ToString("yyyy-MM-dd");
//}
//else if (span.TotalDays > 30)
//{
// return "1个月前";
//}
//else if (span.TotalDays > 14)
//{
// return "2周前";
//}
if
(
dt
.
Year
==
DateTime
.
Now
.
Year
)
{
if
(
span
.
TotalDays
>
7
)
{
return
dt
.
ToString
(
"yyyy-MM-dd"
);
}
else
if
(
span
.
TotalDays
>
1
)
{
return
string
.
Format
(
"{0}天前"
,
(
int
)
Math
.
Floor
(
span
.
TotalDays
));
}
else
if
(
span
.
TotalHours
>
1
)
{
return
string
.
Format
(
"{0}小时前"
,
(
int
)
Math
.
Floor
(
span
.
TotalHours
));
}
else
if
(
span
.
TotalMinutes
>
1
)
{
return
string
.
Format
(
"{0}分钟前"
,
(
int
)
Math
.
Floor
(
span
.
TotalMinutes
));
}
else
if
(
span
.
TotalSeconds
>=
1
)
{
return
string
.
Format
(
"{0}秒前"
,
(
int
)
Math
.
Floor
(
span
.
TotalSeconds
));
}
else
{
return
"1秒前"
;
}
}
else
{
return
dt
.
ToString
(
"yyyy-MM-dd"
);
}
}
/// <summary>
/// <summary>
/// 获取星期的字符串
/// 获取星期的字符串
/// </summary>
/// </summary>
...
@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin
...
@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin
{
{
TotalDay
=
Saturday
+
Sunday
+
2
;
TotalDay
=
Saturday
+
Sunday
+
2
;
}
}
else
{
else
{
TotalDay
=
Saturday
+
Sunday
+
1
;
TotalDay
=
Saturday
+
Sunday
+
1
;
}
}
}
}
...
...
Edu.Model/Entity/Question/RB_Question.cs
View file @
6607a38b
...
@@ -12,84 +12,90 @@ namespace Edu.Model.Entity.Question
...
@@ -12,84 +12,90 @@ namespace Edu.Model.Entity.Question
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Question
public
class
RB_Question
{
{
/// <summary>
/// <summary>
/// 主键(问题编号)
/// 主键(问题编号)
/// </summary>
/// </summary>
public
int
QuestionId
{
get
;
set
;
}
public
int
QuestionId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 课程编号
/// 课程编号
/// </summary>
/// </summary>
public
int
CourseId
{
get
;
set
;
}
public
int
CourseId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题名称
/// 问题名称
/// </summary>
/// </summary>
public
string
Title
{
get
;
set
;
}
public
string
Title
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 难易程度(1-易,2-中,3-难)
/// 难易程度(1-易,2-中,3-难)
/// </summary>
/// </summary>
public
DifficultyTypeEnum
DifficultyType
{
get
;
set
;
}
public
DifficultyTypeEnum
DifficultyType
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 答案解析
/// 答案解析
/// </summary>
/// </summary>
public
string
AnswerParse
{
get
;
set
;
}
public
string
AnswerParse
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题类型编号
/// 问题类型编号
/// </summary>
/// </summary>
public
int
QuestionTypeId
{
get
;
set
;
}
public
int
QuestionTypeId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 知识点
/// 问题类型Key
/// </summary>
/// </summary>
public
string
Knowledge
{
get
;
set
;
}
public
string
QuestionTypeKey
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 创建人
/// 知识点
/// </summary>
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
public
string
Knowledge
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 创建时间
/// 创建人
/// </summary>
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 修改人
/// 创建时间
/// </summary>
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 更新时间
/// 修改人
/// </summary>
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 是否同步修改引用此题目的作业和考试(1-是)
/// 更新时间
/// </summary>
/// </summary>
public
int
IsUpdateJobExam
{
get
;
set
;
}
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 删除状态
/// 是否同步修改引用此题目的作业和考试(1-是)
/// </summary>
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
public
int
IsUpdateJobExam
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 排序
/// 删除状态
/// </summary>
/// </summary>
public
int
SortNum
{
get
;
set
;
}
public
DateStateEnum
Status
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题答案【JSON字符串】
/// 排序
/// </summary>
/// </summary>
public
string
Answer
{
get
;
set
;
}
public
int
SortNum
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题分数
/// 问题答案【JSON字符串】
/// </summary>
/// </summary>
public
decimal
Score
{
get
;
set
;
}
public
string
Answer
{
get
;
set
;
}
}
/// <summary>
/// 问题分数
/// </summary>
public
decimal
Score
{
get
;
set
;
}
}
}
}
Edu.Model/Entity/Question/RB_Question_Point.cs
View file @
6607a38b
...
@@ -16,11 +16,6 @@ namespace Edu.Model.Entity.Question
...
@@ -16,11 +16,6 @@ namespace Edu.Model.Entity.Question
/// </summary>
/// </summary>
public
int
PointId
{
get
;
set
;
}
public
int
PointId
{
get
;
set
;
}
/// <summary>
/// 问题编号
/// </summary>
public
int
QuestionId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 课程编号
/// 课程编号
/// </summary>
/// </summary>
...
...
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
View file @
6607a38b
...
@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR
...
@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR
[
Serializable
]
[
Serializable
]
public
class
RB_OKR_Comment_ViewModel
:
Model
.
Entity
.
OKR
.
RB_OKR_Comment
public
class
RB_OKR_Comment_ViewModel
:
Model
.
Entity
.
OKR
.
RB_OKR_Comment
{
{
/// <summary>
/// 创建人
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
/// <summary>
/// 创建人头像
/// </summary>
public
string
CreateByIco
{
get
;
set
;
}
/// <summary>
/// 操作人
/// </summary>
public
string
UpdateByName
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
string
CreateTimeStr
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Question/RB_Question_Answer_ViewModel.cs
View file @
6607a38b
namespace
Edu.Model.ViewModel.Question
namespace
Edu.Model.ViewModel.Question
{
{
/// <summary>
/// 问题答案视图实体类
/// </summary>
public
class
Answer_ViewModel
{
/// <summary>
/// 答案选项(A、B、C、D、E)
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 答案内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 是否是正确答案
/// </summary>
public
bool
Isanswer
{
get
;
set
;
}
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Question/RB_Question_Point_ViewModel.cs
View file @
6607a38b
...
@@ -26,5 +26,10 @@ namespace Edu.Model.ViewModel.Question
...
@@ -26,5 +26,10 @@ namespace Edu.Model.ViewModel.Question
/// 更新时间字符串
/// 更新时间字符串
/// </summary>
/// </summary>
public
string
UpdateTimeStr
{
get
{
return
this
.
UpdateTime
.
FormatTime
();
}
}
public
string
UpdateTimeStr
{
get
{
return
this
.
UpdateTime
.
FormatTime
();
}
}
/// <summary>
/// 问题知识点编号【查询使用】
/// </summary>
public
string
QPointIds
{
get
;
set
;
}
}
}
}
}
Edu.Model/ViewModel/Question/RB_Question_Type_ViewModel.cs
View file @
6607a38b
using
System
;
using
Edu.Common.Enum.Question
;
using
System
;
using
System.Collections.Generic
;
namespace
Edu.Model.ViewModel.Question
namespace
Edu.Model.ViewModel.Question
{
{
...
@@ -10,4 +12,66 @@ namespace Edu.Model.ViewModel.Question
...
@@ -10,4 +12,66 @@ namespace Edu.Model.ViewModel.Question
{
{
}
}
public
class
QuestionTypeItem
{
/// <summary>
/// 题目类型Key
/// </summary>
public
string
Key
{
get
;
set
;
}
/// <summary>
/// 题目数据
/// </summary>
public
object
Data
{
get
;
set
;
}
}
/// <summary>
/// 选择题选项列表
/// </summary>
public
class
optionItem
{
/// <summary>
/// 选项编号【例如:A,B,C,D】
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 选项内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 是否是选项答案
/// </summary>
public
bool
IsAnswer
{
get
;
set
;
}
}
/// <summary>
/// 单选题
/// </summary>
public
class
singleQuestion
{
/// <summary>
/// 题目名称
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 答案解析
/// </summary>
public
string
AnswerAnalysis
{
get
;
set
;
}
/// <summary>
/// 选项列表
/// </summary>
public
List
<
optionItem
>
AnswerOptionList
{
get
;
set
;
}
/// <summary>
/// 难易程度
/// </summary>
public
DifficultyTypeEnum
EasyType
{
get
;
set
;
}
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
6607a38b
...
@@ -29,8 +29,29 @@ namespace Edu.Model.ViewModel.Question
...
@@ -29,8 +29,29 @@ namespace Edu.Model.ViewModel.Question
public
string
UpdateTimeStr
{
get
{
return
this
.
UpdateTime
.
FormatTime
();
}
}
public
string
UpdateTimeStr
{
get
{
return
this
.
UpdateTime
.
FormatTime
();
}
}
/// <summary>
/// <summary>
///
答案列表
///
问题类型名称
/// </summary>
/// </summary>
public
List
<
Answer_ViewModel
>
AnswerList
{
get
;
set
;
}
public
string
QuestionTypeName
{
get
;
set
;
}
/// <summary>
/// 知识点列表
/// </summary>
public
List
<
RB_Question_Point_ViewModel
>
QuestionPointList
{
get
;
set
;
}
/// <summary>
/// 问题类型【查询使用,多选】
/// </summary>
public
string
QQuestionTypeStr
{
get
;
set
;
}
/// <summary>
/// 知识点【查询使用,多选】
/// </summary>
public
string
QPointStr
{
get
;
set
;
}
/// <summary>
/// 难易程度【查询使用,多选】
/// </summary>
public
string
QDifficultyType
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Edu.Module.OKR/OKRPeriodModule.cs
View file @
6607a38b
...
@@ -2576,5 +2576,62 @@ namespace Edu.Module.OKR
...
@@ -2576,5 +2576,62 @@ namespace Edu.Module.OKR
}
}
#
endregion
#
endregion
#
region
okr
任务评论
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetCommentPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_OKR_Comment_ViewModel
demodel
)
{
return
oKR_CommentRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
rowsCount
,
demodel
);
}
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetCommentList
(
RB_OKR_Comment_ViewModel
demodel
)
{
return
oKR_CommentRepository
.
GetList
(
demodel
);
}
/// <summary>
/// 新增/修改ork评论
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetOKRComment
(
RB_OKR_Comment_ViewModel
model
)
{
if
(
model
.
Id
==
0
)
{
return
oKR_CommentRepository
.
Insert
(
model
)
>
0
;
}
else
{
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
}
};
return
oKR_CommentRepository
.
Update
(
keyValues
,
wheres
);
}
}
#
endregion
}
}
}
}
Edu.Module.Question/QuestionModule.cs
View file @
6607a38b
...
@@ -3,6 +3,7 @@ using Edu.Common.Enum;
...
@@ -3,6 +3,7 @@ using Edu.Common.Enum;
using
Edu.Model.ViewModel.Question
;
using
Edu.Model.ViewModel.Question
;
using
Edu.Repository.Question
;
using
Edu.Repository.Question
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.DB
;
using
VT.FW.DB
;
namespace
Edu.Module.Question
namespace
Edu.Module.Question
...
@@ -66,7 +67,7 @@ namespace Edu.Module.Question
...
@@ -66,7 +67,7 @@ namespace Edu.Module.Question
/// </summary>
/// </summary>
/// <param name="model"></param>
/// <param name="model"></param>
/// <returns></returns>
/// <returns></returns>
public
bool
SetQuestionModule
(
RB_Question_ViewModel
model
)
public
virtual
bool
SetQuestionModule
(
RB_Question_ViewModel
model
)
{
{
bool
flag
;
bool
flag
;
if
(
model
.
QuestionId
>
0
)
if
(
model
.
QuestionId
>
0
)
...
@@ -77,6 +78,7 @@ namespace Edu.Module.Question
...
@@ -77,6 +78,7 @@ namespace Edu.Module.Question
{
nameof
(
RB_Question_ViewModel
.
DifficultyType
),(
int
)
model
.
DifficultyType
},
{
nameof
(
RB_Question_ViewModel
.
DifficultyType
),(
int
)
model
.
DifficultyType
},
{
nameof
(
RB_Question_ViewModel
.
AnswerParse
),
model
.
AnswerParse
},
{
nameof
(
RB_Question_ViewModel
.
AnswerParse
),
model
.
AnswerParse
},
{
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
model
.
QuestionTypeId
},
{
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
model
.
QuestionTypeId
},
{
nameof
(
RB_Question_ViewModel
.
QuestionTypeKey
),
model
.
QuestionTypeKey
},
{
nameof
(
RB_Question_ViewModel
.
Knowledge
),
model
.
Knowledge
},
{
nameof
(
RB_Question_ViewModel
.
Knowledge
),
model
.
Knowledge
},
{
nameof
(
RB_Question_ViewModel
.
IsUpdateJobExam
),
model
.
IsUpdateJobExam
},
{
nameof
(
RB_Question_ViewModel
.
IsUpdateJobExam
),
model
.
IsUpdateJobExam
},
{
nameof
(
RB_Question_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Question_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
...
@@ -115,7 +117,7 @@ namespace Edu.Module.Question
...
@@ -115,7 +117,7 @@ namespace Edu.Module.Question
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
TransactionCallHandler
]
[
TransactionCallHandler
]
public
virtual
bool
UpdateQuestionSortModule
(
int
curQId
,
int
targetQId
)
public
virtual
bool
UpdateQuestionSortModule
(
int
curQId
,
int
targetQId
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
...
...
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
View file @
6607a38b
...
@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR
...
@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR
{
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
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
();
return
GetPage
<
RB_OKR_Comment_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
}
...
@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR
...
@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR
{
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
}
}
...
...
Edu.Repository/Question/RB_QuestionRepository.cs
View file @
6607a38b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
VT.FW.DB.Dapper
;
namespace
Edu.Repository.Question
namespace
Edu.Repository.Question
{
{
...
@@ -48,12 +49,12 @@ WHERE 1=1
...
@@ -48,12 +49,12 @@ WHERE 1=1
public
List
<
RB_Question_ViewModel
>
GetQuestionPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Question_ViewModel
query
)
public
List
<
RB_Question_ViewModel
>
GetQuestionPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Question_ViewModel
query
)
{
{
rowsCount
=
0
;
rowsCount
=
0
;
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
SELECT *
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
FROM RB_Question
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
WHERE 1=1
WHERE 1=1 "
);
"
);
if
(
query
==
null
)
if
(
query
==
null
)
{
{
return
new
List
<
RB_Question_ViewModel
>();
return
new
List
<
RB_Question_ViewModel
>();
...
@@ -62,9 +63,14 @@ WHERE 1=1
...
@@ -62,9 +63,14 @@ WHERE 1=1
{
{
if
(
query
.
CourseId
>
0
)
if
(
query
.
CourseId
>
0
)
{
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Question_ViewModel
.
CourseId
),
query
.
CourseId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Title
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @Title "
,
nameof
(
RB_Question_ViewModel
.
Title
));
parameters
.
Add
(
"Title"
,
"%"
+
query
.
Title
.
Trim
()
+
"%"
);
}
}
return
GetPage
<
RB_Question_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
return
GetPage
<
RB_Question_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()
,
parameters
).
ToList
();
}
}
}
}
}
}
...
...
Edu.Repository/Question/RB_Question_PointRepository.cs
View file @
6607a38b
...
@@ -31,9 +31,9 @@ WHERE 1=1
...
@@ -31,9 +31,9 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
}
}
if
(
query
.
QuestionId
>
0
)
if
(
!
string
.
IsNullOrEmpty
(
query
.
QPointIds
)
)
{
{
builder
.
AppendFormat
(
" AND {0}
={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND {0}
IN({1}) "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
QPointIds
);
}
}
}
}
return
Get
<
RB_Question_Point_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Question_Point_ViewModel
>(
builder
.
ToString
()).
ToList
();
...
@@ -62,9 +62,9 @@ WHERE 1=1
...
@@ -62,9 +62,9 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
}
}
if
(
query
.
QuestionId
>
0
)
if
(
!
string
.
IsNullOrEmpty
(
query
.
QPointIds
)
)
{
{
builder
.
AppendFormat
(
" AND {0}
={1} "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND {0}
IN({1}) "
,
nameof
(
RB_Question_Point_ViewModel
.
CourseId
),
query
.
QPointIds
);
}
}
}
}
return
GetPage
<
RB_Question_Point_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
return
GetPage
<
RB_Question_Point_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
...
...
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
6607a38b
using
Edu.Cache.User
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Question
;
using
Edu.Common.Plugin
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Question
;
using
Edu.Model.ViewModel.Question
;
using
Edu.Module.Question
;
using
Edu.Module.Question
;
...
@@ -7,6 +8,7 @@ using Edu.WebApi.Filter;
...
@@ -7,6 +8,7 @@ using Edu.WebApi.Filter;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System
;
using
System.Collections.Generic
;
namespace
Edu.WebApi.Controllers.Course
namespace
Edu.WebApi.Controllers.Course
{
{
...
@@ -43,8 +45,14 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -43,8 +45,14 @@ namespace Edu.WebApi.Controllers.Course
public
ApiResult
GetQuestionPageList
()
public
ApiResult
GetQuestionPageList
()
{
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_Question_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Question_ViewModel
()
{
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
};
var
list
=
questionModule
.
GetQuestionPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
var
list
=
questionModule
.
GetQuestionPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
resultList
=
new
List
<
object
>();
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
if
(
item
.
CreateBy
>
0
)
if
(
item
.
CreateBy
>
0
)
...
@@ -55,12 +63,44 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -55,12 +63,44 @@ namespace Edu.WebApi.Controllers.Course
{
{
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
}
}
resultList
.
Add
(
new
{
item
.
QuestionId
,
item
.
CourseId
,
item
.
Title
,
item
.
QuestionTypeId
,
item
.
QuestionTypeKey
,
item
.
QuestionTypeName
,
item
.
CreateByName
,
item
.
CreateTimeStr
,
item
.
DifficultyType
,
DifficultyTypeName
=
item
.
DifficultyType
.
ToName
(),
});
}
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
l
ist
;
pageModel
.
PageData
=
resultL
ist
;
return
ApiResult
.
Success
(
data
:
pageModel
);
return
ApiResult
.
Success
(
data
:
pageModel
);
}
}
/// <summary>
/// 获取问题难易列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDifficultyType
()
{
var
list
=
Common
.
Plugin
.
EnumHelper
.
EnumToList
(
typeof
(
DifficultyTypeEnum
));
if
(
list
!=
null
)
{
list
.
Insert
(
0
,
new
EnumItem
()
{
Id
=
0
,
Name
=
"全部难度"
});
}
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// <summary>
/// 获取课程问题列表
/// 获取课程问题列表
/// </summary>
/// </summary>
...
@@ -106,7 +146,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -106,7 +146,7 @@ namespace Edu.WebApi.Controllers.Course
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
Remove
CourseCategory
()
public
ApiResult
Remove
Question
()
{
{
var
QuestionId
=
base
.
ParmJObj
.
GetInt
(
"QuestionId"
,
0
);
var
QuestionId
=
base
.
ParmJObj
.
GetInt
(
"QuestionId"
,
0
);
var
flag
=
questionModule
.
RemoveQuestionModule
(
QuestionId
);
var
flag
=
questionModule
.
RemoveQuestionModule
(
QuestionId
);
...
...
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
6607a38b
...
@@ -33,7 +33,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -33,7 +33,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetOKRPeriodConfigInfo
()
{
public
ApiResult
GetOKRPeriodConfigInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
var
model
=
okrPeriodModule
.
GetOKRPeriodConfigInfo
(
userInfo
.
Group_Id
);
var
model
=
okrPeriodModule
.
GetOKRPeriodConfigInfo
(
userInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
new
return
ApiResult
.
Success
(
""
,
new
...
@@ -54,28 +55,36 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -54,28 +55,36 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetOKRPeriodConfigInfo
()
{
public
ApiResult
SetOKRPeriodConfigInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
RB_OKR_PeriodConfig_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_PeriodConfig_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
RB_OKR_PeriodConfig_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_PeriodConfig_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
dmodel
.
PeriodMonth
<=
0
)
{
if
(
dmodel
.
PeriodMonth
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择周期长度"
);
return
ApiResult
.
ParamIsNull
(
"请选择周期长度"
);
}
}
if
(!
dmodel
.
StartDate
.
HasValue
)
{
if
(!
dmodel
.
StartDate
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择新周期生效时间"
);
return
ApiResult
.
ParamIsNull
(
"请选择新周期生效时间"
);
}
}
if
(!
dmodel
.
EndDate
.
HasValue
){
if
(!
dmodel
.
EndDate
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择新周期生效时间"
);
return
ApiResult
.
ParamIsNull
(
"请选择新周期生效时间"
);
}
}
if
(
dmodel
.
BeforeNum
<=
0
)
{
if
(
dmodel
.
BeforeNum
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择新周期出现时间"
);
return
ApiResult
.
ParamIsNull
(
"请选择新周期出现时间"
);
}
}
if
(
dmodel
.
BeforeType
<=
0
)
{
if
(
dmodel
.
BeforeType
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择类型"
);
return
ApiResult
.
ParamIsNull
(
"请选择类型"
);
}
}
if
(
dmodel
.
YearOKR
<=
0
)
{
if
(
dmodel
.
YearOKR
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择年度是否开启"
);
return
ApiResult
.
ParamIsNull
(
"请选择年度是否开启"
);
}
}
if
(
dmodel
.
DirectorAudit
<=
0
)
{
if
(
dmodel
.
DirectorAudit
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择主管审核是否开启"
);
return
ApiResult
.
ParamIsNull
(
"请选择主管审核是否开启"
);
}
}
if
(
dmodel
.
StartDate
.
Value
.
AddMonths
((
int
)
dmodel
.
PeriodMonth
-
1
).
ToString
(
"yyyy-MM"
)
!=
dmodel
.
EndDate
.
Value
.
ToString
(
"yyyy-MM"
))
if
(
dmodel
.
StartDate
.
Value
.
AddMonths
((
int
)
dmodel
.
PeriodMonth
-
1
).
ToString
(
"yyyy-MM"
)
!=
dmodel
.
EndDate
.
Value
.
ToString
(
"yyyy-MM"
))
...
@@ -96,7 +105,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -96,7 +105,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
...
@@ -106,7 +116,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -106,7 +116,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetOKRRemindList
()
{
public
ApiResult
GetOKRRemindList
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
var
list
=
okrPeriodModule
.
GetOKRRemindList
(
userInfo
.
Group_Id
);
var
list
=
okrPeriodModule
.
GetOKRRemindList
(
userInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
...
@@ -124,16 +135,20 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -124,16 +135,20 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetOKRRemindInfo
()
{
public
ApiResult
SetOKRRemindInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
RB_OKR_Remind_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Remind_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
RB_OKR_Remind_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Remind_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Days
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Days
))
{
return
ApiResult
.
ParamIsNull
(
"请选择工作日"
);
return
ApiResult
.
ParamIsNull
(
"请选择工作日"
);
}
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Time
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Time
))
{
return
ApiResult
.
ParamIsNull
(
"请选择时间"
);
return
ApiResult
.
ParamIsNull
(
"请选择时间"
);
}
}
if
(
dmodel
.
Type
<=
0
)
{
if
(
dmodel
.
Type
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递类型"
);
return
ApiResult
.
ParamIsNull
(
"请传递类型"
);
}
}
...
@@ -149,7 +164,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -149,7 +164,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
...
@@ -159,11 +175,13 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -159,11 +175,13 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetOKRRemindEnable
()
{
public
ApiResult
SetOKRRemindEnable
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
prams
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
prams
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
Type
=
prams
.
GetInt
(
"Type"
,
0
);
int
Type
=
prams
.
GetInt
(
"Type"
,
0
);
if
(
Type
<=
0
)
{
if
(
Type
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
return
ApiResult
.
ParamIsNull
();
}
}
...
@@ -172,7 +190,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -172,7 +190,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
();
return
ApiResult
.
Failed
();
}
}
}
}
...
@@ -182,7 +201,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -182,7 +201,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetOKRScoreConfigPageList
()
{
public
ApiResult
GetOKRScoreConfigPageList
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Score_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Score_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
...
@@ -211,27 +231,35 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -211,27 +231,35 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetOKRScoreConfigInfo
()
{
public
ApiResult
SetOKRScoreConfigInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
RB_OKR_Score_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Score_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
RB_OKR_Score_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Score_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递规则名称"
);
return
ApiResult
.
ParamIsNull
(
"请传递规则名称"
);
}
}
if
(
dmodel
.
DetailList
==
null
||
!
dmodel
.
DetailList
.
Any
())
{
if
(
dmodel
.
DetailList
==
null
||
!
dmodel
.
DetailList
.
Any
())
return
ApiResult
.
ParamIsNull
(
"请传递分数明细"
);
{
return
ApiResult
.
ParamIsNull
(
"请传递分数明细"
);
}
}
decimal
min
=
0
;
decimal
min
=
0
;
foreach
(
var
item
in
dmodel
.
DetailList
)
{
foreach
(
var
item
in
dmodel
.
DetailList
)
if
(
string
.
IsNullOrEmpty
(
item
.
Name
))
{
{
if
(
string
.
IsNullOrEmpty
(
item
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递颜色名称"
);
return
ApiResult
.
ParamIsNull
(
"请传递颜色名称"
);
}
}
if
(
item
.
ScoreMin
<
0
||
item
.
ScoreMin
>=
1
)
{
if
(
item
.
ScoreMin
<
0
||
item
.
ScoreMin
>=
1
)
{
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
}
}
if
(
item
.
ScoreMax
<=
0
||
item
.
ScoreMax
>
1
)
{
if
(
item
.
ScoreMax
<=
0
||
item
.
ScoreMax
>
1
)
{
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
}
}
if
(
item
.
ScoreMax
<
item
.
ScoreMin
)
{
if
(
item
.
ScoreMax
<
item
.
ScoreMin
)
{
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
return
ApiResult
.
ParamIsNull
(
"分数有误"
);
}
}
if
(
min
==
0
)
if
(
min
==
0
)
...
@@ -241,7 +269,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -241,7 +269,8 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
ParamIsNull
(
"分数有交集"
);
return
ApiResult
.
ParamIsNull
(
"分数有交集"
);
}
}
}
}
else
{
else
{
if
(
item
.
ScoreMin
<=
min
)
if
(
item
.
ScoreMin
<=
min
)
{
{
return
ApiResult
.
ParamIsNull
(
"分数有交集"
);
return
ApiResult
.
ParamIsNull
(
"分数有交集"
);
...
@@ -264,7 +293,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -264,7 +293,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
();
return
ApiResult
.
Failed
();
}
}
}
}
...
@@ -274,12 +304,14 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -274,12 +304,14 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetOKRScoreConfigState
()
{
public
ApiResult
SetOKRScoreConfigState
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ScoreId
=
parms
.
GetInt
(
"ScoreId"
,
0
);
int
ScoreId
=
parms
.
GetInt
(
"ScoreId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
// 类型 1设置默认 2删除
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
// 类型 1设置默认 2删除
if
(
ScoreId
<=
0
)
{
if
(
ScoreId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递id"
);
return
ApiResult
.
ParamIsNull
(
"请传递id"
);
}
}
...
@@ -288,7 +320,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -288,7 +320,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
();
return
ApiResult
.
Failed
();
}
}
}
}
...
@@ -342,7 +375,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -342,7 +375,8 @@ namespace Edu.WebApi.Controllers.OKR
/// 获取周期列表
/// 获取周期列表
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
ApiResult
GetOKRPeriodList
()
{
public
ApiResult
GetOKRPeriodList
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
var
list
=
okrPeriodModule
.
GetOKRPeriodList
(
userInfo
.
Group_Id
);
var
list
=
okrPeriodModule
.
GetOKRPeriodList
(
userInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
...
@@ -361,11 +395,13 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -361,11 +395,13 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetOKRMyObjectiveList
()
{
public
ApiResult
GetOKRMyObjectiveList
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
if
(
PeriodId
<=
0
)
{
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
}
var
list
=
okrPeriodModule
.
GetOKRMyObjectiveList
(
PeriodId
,
userInfo
);
var
list
=
okrPeriodModule
.
GetOKRMyObjectiveList
(
PeriodId
,
userInfo
);
...
@@ -394,13 +430,16 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -394,13 +430,16 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SgetOKRMyObjectiveInfo
()
{
public
ApiResult
SgetOKRMyObjectiveInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
RB_OKR_Objective_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Objective_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
RB_OKR_Objective_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Objective_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Title
))
{
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Title
))
{
return
ApiResult
.
ParamIsNull
(
"请输入Objective"
);
return
ApiResult
.
ParamIsNull
(
"请输入Objective"
);
}
}
if
(
dmodel
.
PeriodId
<=
0
)
{
if
(
dmodel
.
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
}
...
@@ -409,7 +448,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -409,7 +448,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
...
@@ -419,16 +459,19 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -419,16 +459,19 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SgetOKRMyKeyResultInfo
()
{
public
ApiResult
SgetOKRMyKeyResultInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
string
Name
=
parms
.
GetStringValue
(
"Name"
);
string
Name
=
parms
.
GetStringValue
(
"Name"
);
if
(
string
.
IsNullOrEmpty
(
Name
))
{
if
(
string
.
IsNullOrEmpty
(
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递结果值"
);
return
ApiResult
.
ParamIsNull
(
"请传递结果值"
);
}
}
if
(
KeyResultId
<=
0
&&
ObjectiveId
<=
0
)
{
if
(
KeyResultId
<=
0
&&
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"结果id不正确"
);
return
ApiResult
.
ParamIsNull
(
"结果id不正确"
);
}
}
...
@@ -437,7 +480,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -437,7 +480,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
...
@@ -447,18 +491,22 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -447,18 +491,22 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SgetOKRMyObjectiveSort
()
{
public
ApiResult
SgetOKRMyObjectiveSort
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ObjectiveId1
=
parms
.
GetInt
(
"ObjectiveId1"
,
0
);
int
ObjectiveId1
=
parms
.
GetInt
(
"ObjectiveId1"
,
0
);
int
ObjectiveId2
=
parms
.
GetInt
(
"ObjectiveId2"
,
0
);
//目标的后面
int
ObjectiveId2
=
parms
.
GetInt
(
"ObjectiveId2"
,
0
);
//目标的后面
if
(
ObjectiveId1
<=
0
)
{
if
(
ObjectiveId1
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
return
ApiResult
.
ParamIsNull
();
}
}
if
(
ObjectiveId2
<
0
)
{
if
(
ObjectiveId2
<
0
)
{
return
ApiResult
.
ParamIsNull
();
return
ApiResult
.
ParamIsNull
();
}
}
if
(
ObjectiveId1
==
ObjectiveId2
)
{
if
(
ObjectiveId1
==
ObjectiveId2
)
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
...
@@ -513,13 +561,15 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -513,13 +561,15 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SgetOKRMyObjectiveState
()
{
public
ApiResult
SgetOKRMyObjectiveState
()
{
var
userInfo
=
base
.
UserInfo
;
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
// 类型 1设置默认状态 2设置自定义状态 3删除
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
// 类型 1设置默认状态 2设置自定义状态 3删除
int
ProgressState
=
parms
.
GetInt
(
"ProgressState"
,
0
);
int
ProgressState
=
parms
.
GetInt
(
"ProgressState"
,
0
);
if
(
ObjectiveId
<=
0
)
{
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标id"
);
return
ApiResult
.
ParamIsNull
(
"请传递目标id"
);
}
}
if
(
Type
==
2
&&
ProgressState
<=
0
)
if
(
Type
==
2
&&
ProgressState
<=
0
)
...
@@ -532,7 +582,8 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -532,7 +582,8 @@ namespace Edu.WebApi.Controllers.OKR
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
(
msg
);
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
...
@@ -934,5 +985,92 @@ namespace Edu.WebApi.Controllers.OKR
...
@@ -934,5 +985,92 @@ namespace Edu.WebApi.Controllers.OKR
#
endregion
#
endregion
#
endregion
#
endregion
#
region
okr
评论管理
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommentPageList
()
{
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
)
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetCommentPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
item
.
CreateByIco
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
UserIcon
??
""
;
}
if
(
item
.
UpdateBy
>
0
)
{
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
}
item
.
CreateTimeStr
=
StringHelper
.
DateFormatToString
(
item
.
CreateTime
);
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
CreateByName
,
x
.
Id
,
x
.
CreateByIco
,
x
.
UpdateByName
,
x
.
Content
,
x
.
CreateTimeStr
});
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 新增评论状态
/// </summary>
/// <returns></returns>
public
ApiResult
SetComment
()
{
var
extModel
=
new
RB_OKR_Comment_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
),
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
),
Content
=
base
.
ParmJObj
.
GetStringValue
(
"Content"
),
};
extModel
.
CreateBy
=
base
.
UserInfo
.
Id
;
extModel
.
State
=
1
;
extModel
.
CreateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
extModel
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
bool
flag
=
okrPeriodModule
.
SetOKRComment
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 修改评论状态
/// </summary>
/// <returns></returns>
public
ApiResult
SetCommentStatus
()
{
var
extModel
=
new
RB_OKR_Comment_ViewModel
()
{
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
),
State
=
base
.
ParmJObj
.
GetInt
(
"State"
),
};
if
(
extModel
.
Id
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"未获取到评论编号,请刷新页面重试!"
);
}
if
(
extModel
.
State
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"请传递评论状态!"
);
}
extModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
bool
flag
=
okrPeriodModule
.
SetOKRComment
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
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