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
003b9580
Commit
003b9580
authored
Sep 18, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
a36b4184
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
174 additions
and
131 deletions
+174
-131
RB_Examination_Details.cs
Edu.Model/Entity/Exam/RB_Examination_Details.cs
+5
-0
RB_Examination_Group.cs
Edu.Model/Entity/Exam/RB_Examination_Group.cs
+15
-3
RB_Examination_Paper.cs
Edu.Model/Entity/Exam/RB_Examination_Paper.cs
+12
-1
RB_Examination_Template.cs
Edu.Model/Entity/Exam/RB_Examination_Template.cs
+6
-0
ExamTemplate.cs
Edu.Model/ViewModel/Exam/ExamTemplate.cs
+4
-30
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+75
-53
QuestionModule.cs
Edu.Module.Question/QuestionModule.cs
+15
-39
RB_QuestionRepository.cs
Edu.Repository/Question/RB_QuestionRepository.cs
+5
-0
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+20
-3
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+17
-2
No files found.
Edu.Model/Entity/Exam/RB_Examination_Details.cs
View file @
003b9580
...
@@ -127,5 +127,10 @@ namespace Edu.Model.Entity.Exam
...
@@ -127,5 +127,10 @@ namespace Edu.Model.Entity.Exam
/// 题目分数
/// 题目分数
/// </summary>
/// </summary>
public
decimal
Score
{
get
;
set
;
}
public
decimal
Score
{
get
;
set
;
}
/// <summary>
/// 分组编号
/// </summary>
public
int
GId
{
get
;
set
;
}
}
}
}
}
Edu.Model/Entity/Exam/RB_Examination_Group.cs
View file @
003b9580
using
System
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Exam
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
VT.FW.DB
;
using
VT.FW.DB
;
...
@@ -28,12 +30,12 @@ namespace Edu.Model.Entity.Exam
...
@@ -28,12 +30,12 @@ namespace Edu.Model.Entity.Exam
public
string
GroupName
{
get
;
set
;
}
public
string
GroupName
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题类型编号
/// 问题类型编号
【GroupType=1时使用】
/// </summary>
/// </summary>
public
int
QuestionTypeId
{
get
;
set
;
}
public
int
QuestionTypeId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题类型Key
/// 问题类型Key
【GroupType=1时使用】
/// </summary>
/// </summary>
public
string
QuestionTypeKey
{
get
;
set
;
}
public
string
QuestionTypeKey
{
get
;
set
;
}
...
@@ -46,5 +48,15 @@ namespace Edu.Model.Entity.Exam
...
@@ -46,5 +48,15 @@ namespace Edu.Model.Entity.Exam
/// 分数
/// 分数
/// </summary>
/// </summary>
public
decimal
GScore
{
get
;
set
;
}
public
decimal
GScore
{
get
;
set
;
}
/// <summary>
/// 组卷类型
/// </summary>
public
ExamGroupTypeEnum
GroupType
{
get
;
set
;
}
/// <summary>
/// 题目分类编号【GroupType=2时使用】
/// </summary>
public
QuestionCategoryEnum
CategoryId
{
get
;
set
;
}
}
}
}
}
Edu.Model/Entity/Exam/RB_Examination_Paper.cs
View file @
003b9580
using
Edu.Common.Enum.Question
;
using
Edu.Common.Enum.Exam
;
using
Edu.Common.Enum.Question
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
...
@@ -102,5 +103,15 @@ namespace Edu.Model.Entity.Exam
...
@@ -102,5 +103,15 @@ namespace Edu.Model.Entity.Exam
/// 审核和备注
/// 审核和备注
/// </summary>
/// </summary>
public
string
ExamineRemark
{
get
;
set
;
}
public
string
ExamineRemark
{
get
;
set
;
}
/// <summary>
/// 组卷类型
/// </summary>
public
ExamGroupTypeEnum
GroupType
{
get
;
set
;
}
/// <summary>
/// 试卷总分数
/// </summary>
public
decimal
PaperScore
{
get
;
set
;
}
}
}
}
}
Edu.Model/Entity/Exam/RB_Examination_Template.cs
View file @
003b9580
using
Edu.Common.Enum
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Exam
;
using
Edu.Common.Enum.Question
;
using
Edu.Common.Enum.Question
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -73,5 +74,10 @@ namespace Edu.Model.Entity.Exam
...
@@ -73,5 +74,10 @@ namespace Edu.Model.Entity.Exam
/// 模板题库编号
/// 模板题库编号
/// </summary>
/// </summary>
public
string
TemplateBankIds
{
get
;
set
;
}
public
string
TemplateBankIds
{
get
;
set
;
}
/// <summary>
/// 组卷类型
/// </summary>
public
ExamGroupTypeEnum
GroupType
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Exam/ExamTemplate.cs
View file @
003b9580
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Exam
;
using
Edu.Common.Enum.Question
;
using
Edu.Common.Enum.Question
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Exam
namespace
Edu.Model.ViewModel.Exam
{
{
...
@@ -11,13 +10,14 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -11,13 +10,14 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
/// </summary>
public
class
ExamTemplate
public
class
ExamTemplate
{
{
/// <summary>
/// <summary>
/// 问题类型编号
/// 问题类型编号
【GroupType=1时使用】
/// </summary>
/// </summary>
public
int
QuestionTypeId
{
get
;
set
;
}
public
int
QuestionTypeId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 问题类型Key
/// 问题类型Key
【GroupType=1时使用】
/// </summary>
/// </summary>
public
string
QuestionTypeKey
{
get
;
set
;
}
public
string
QuestionTypeKey
{
get
;
set
;
}
...
@@ -51,10 +51,6 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -51,10 +51,6 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
/// </summary>
public
List
<
DifficultyTypeItem
>
ChooseList
{
get
;
set
;
}
public
List
<
DifficultyTypeItem
>
ChooseList
{
get
;
set
;
}
/// <summary>
/// 题目分类列表
/// </summary>
public
List
<
CategoryItem
>
CategoryList
{
get
;
set
;
}
}
}
/// <summary>
/// <summary>
...
@@ -72,26 +68,4 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -72,26 +68,4 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
/// </summary>
public
int
ChooseNum
{
get
;
set
;
}
public
int
ChooseNum
{
get
;
set
;
}
}
}
/// <summary>
/// 题型分类
/// </summary>
public
class
CategoryItem
{
/// <summary>
/// 题型分类
/// </summary>
public
QuestionCategoryEnum
Category
{
get
;
set
;
}
/// <summary>
/// 选择题目数
/// </summary>
public
int
ChooseNum
{
get
;
set
;
}
/// <summary>
/// 难易程度选题【ChooseType=2时使用】
/// </summary>
public
List
<
DifficultyTypeItem
>
ChooseList
{
get
;
set
;
}
}
}
}
Edu.Module.Exam/PaperModule.cs
View file @
003b9580
...
@@ -18,6 +18,7 @@ using Edu.Model.ViewModel.EduTask;
...
@@ -18,6 +18,7 @@ using Edu.Model.ViewModel.EduTask;
using
Edu.Common.Enum.Finance
;
using
Edu.Common.Enum.Finance
;
using
Edu.Repository.EduTask
;
using
Edu.Repository.EduTask
;
using
Edu.Common.Enum.Exam
;
using
Edu.Common.Enum.Exam
;
using
Edu.Common.Enum.Course
;
namespace
Edu.Module.Exam
namespace
Edu.Module.Exam
{
{
...
@@ -309,6 +310,8 @@ namespace Edu.Module.Exam
...
@@ -309,6 +310,8 @@ namespace Edu.Module.Exam
{
nameof
(
RB_Examination_Group_ViewModel
.
QuestionTypeKey
),
gitem
.
QuestionTypeKey
},
{
nameof
(
RB_Examination_Group_ViewModel
.
QuestionTypeKey
),
gitem
.
QuestionTypeKey
},
{
nameof
(
RB_Examination_Group_ViewModel
.
GSortNum
),
gitem
.
GSortNum
},
{
nameof
(
RB_Examination_Group_ViewModel
.
GSortNum
),
gitem
.
GSortNum
},
{
nameof
(
RB_Examination_Group_ViewModel
.
GScore
),
gitem
.
GScore
},
{
nameof
(
RB_Examination_Group_ViewModel
.
GScore
),
gitem
.
GScore
},
{
nameof
(
RB_Examination_Group_ViewModel
.
GroupType
),
gitem
.
GroupType
},
{
nameof
(
RB_Examination_Group_ViewModel
.
CategoryId
),
gitem
.
CategoryId
},
};
};
flag
=
examination_GroupRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
GId
),
gitem
.
GId
));
flag
=
examination_GroupRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
GId
),
gitem
.
GId
));
}
}
...
@@ -324,6 +327,7 @@ namespace Edu.Module.Exam
...
@@ -324,6 +327,7 @@ namespace Edu.Module.Exam
foreach
(
var
dItem
in
gitem
.
DetailsList
)
foreach
(
var
dItem
in
gitem
.
DetailsList
)
{
{
dItem
.
PaperId
=
model
.
PaperId
;
dItem
.
PaperId
=
model
.
PaperId
;
dItem
.
GId
=
gitem
.
GId
;
if
(
dItem
.
Id
>
0
)
if
(
dItem
.
Id
>
0
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
@@ -347,6 +351,7 @@ namespace Edu.Module.Exam
...
@@ -347,6 +351,7 @@ namespace Edu.Module.Exam
{
nameof
(
RB_Examination_Details_ViewModel
.
Category
),
dItem
.
Category
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Category
),
dItem
.
Category
},
{
nameof
(
RB_Examination_Details_ViewModel
.
LevelType
),
dItem
.
LevelType
},
{
nameof
(
RB_Examination_Details_ViewModel
.
LevelType
),
dItem
.
LevelType
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Score
),
dItem
.
Score
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Score
),
dItem
.
Score
},
{
nameof
(
RB_Examination_Details_ViewModel
.
GId
),
dItem
.
GId
},
};
};
flag
=
examination_DetailsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
Id
),
dItem
.
Id
));
flag
=
examination_DetailsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
Id
),
dItem
.
Id
));
}
}
...
@@ -383,6 +388,7 @@ namespace Edu.Module.Exam
...
@@ -383,6 +388,7 @@ namespace Edu.Module.Exam
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateDifficultyType
),
model
.
TemplateDifficultyType
},
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateDifficultyType
),
model
.
TemplateDifficultyType
},
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateData
),
model
.
TemplateData
},
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateData
),
model
.
TemplateData
},
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateBankIds
),
model
.
TemplateBankIds
},
{
nameof
(
RB_Examination_Template_ViewModel
.
TemplateBankIds
),
model
.
TemplateBankIds
},
//{nameof(RB_Examination_Template_ViewModel.GroupType),model.GroupType },
};
};
flag
=
examination_TemplateRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Template_ViewModel
.
TemplateId
),
model
.
TemplateId
));
flag
=
examination_TemplateRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Template_ViewModel
.
TemplateId
),
model
.
TemplateId
));
}
}
...
@@ -395,6 +401,7 @@ namespace Edu.Module.Exam
...
@@ -395,6 +401,7 @@ namespace Edu.Module.Exam
}
}
//获取问题列表
//获取问题列表
var
questionList
=
new
List
<
RB_Question_ViewModel
>();
var
questionList
=
new
List
<
RB_Question_ViewModel
>();
string
Q_QuestionTypeIds
=
""
;
string
Q_QuestionTypeIds
=
""
;
if
(
model
.
TempDataList
!=
null
&&
model
.
TempDataList
.
Count
>
0
)
if
(
model
.
TempDataList
!=
null
&&
model
.
TempDataList
.
Count
>
0
)
{
{
...
@@ -403,32 +410,39 @@ namespace Edu.Module.Exam
...
@@ -403,32 +410,39 @@ namespace Edu.Module.Exam
questionList
=
questionRepository
.
GetQuestionListRepository
(
new
RB_Question_ViewModel
()
questionList
=
questionRepository
.
GetQuestionListRepository
(
new
RB_Question_ViewModel
()
{
{
QBankIds
=
model
.
TemplateBankIds
,
QBankIds
=
model
.
TemplateBankIds
,
Q_QuestionTypeIds
=
Q_QuestionTypeIds
Q_QuestionTypeIds
=
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionType
?
Q_QuestionTypeIds
:
""
,
QCategoryId
=
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionClassify
?
Q_QuestionTypeIds
:
""
,
});
});
//文件夹
var
newPaperId
=
0
;
var
paperModel
=
new
RB_Examination_Paper_ViewModel
(
)
if
(
model
.
TemplateNum
>
1
)
{
{
PaperId
=
0
,
//文件夹
PaperName
=
model
.
TemplateName
,
var
paperModel
=
new
RB_Examination_Paper_ViewModel
()
QuestionBandIds
=
model
.
TemplateBankIds
,
{
DifficultyType
=
model
.
TemplateDifficultyType
,
PaperId
=
0
,
CreateTime
=
model
.
CreateTime
,
PaperName
=
model
.
TemplateName
,
CreateBy
=
model
.
CreateBy
,
QuestionBandIds
=
model
.
TemplateBankIds
,
PublishCount
=
0
,
DifficultyType
=
model
.
TemplateDifficultyType
,
Group_Id
=
model
.
Group_Id
,
CreateTime
=
model
.
CreateTime
,
School_Id
=
model
.
School_Id
,
CreateBy
=
model
.
CreateBy
,
GenerateType
=
1
,
PublishCount
=
0
,
CreateNum
=
model
.
TemplateNum
,
Group_Id
=
model
.
Group_Id
,
PaperType
=
1
,
School_Id
=
model
.
School_Id
,
ParentId
=
model
.
ParentId
,
GenerateType
=
1
,
IsOpen
=
model
.
IsOpen
,
CreateNum
=
model
.
TemplateNum
,
};
PaperType
=
1
,
var
newPaperId
=
examination_PaperRepository
.
Insert
(
paperModel
);
ParentId
=
model
.
ParentId
,
paperModel
.
PaperId
=
newPaperId
;
IsOpen
=
model
.
IsOpen
,
flag
=
newPaperId
>
0
;
GroupType
=
model
.
GroupType
,
if
(
paperModel
.
CreateNum
>
0
)
};
newPaperId
=
examination_PaperRepository
.
Insert
(
paperModel
);
paperModel
.
PaperId
=
newPaperId
;
flag
=
newPaperId
>
0
;
}
if
(
model
.
TemplateNum
>
0
)
{
{
for
(
var
i
=
0
;
i
<
paperModel
.
Cre
ateNum
;
i
++)
for
(
var
i
=
0
;
i
<
model
.
Templ
ateNum
;
i
++)
{
{
var
subModel
=
new
RB_Examination_Paper_ViewModel
()
var
subModel
=
new
RB_Examination_Paper_ViewModel
()
{
{
...
@@ -446,8 +460,9 @@ namespace Edu.Module.Exam
...
@@ -446,8 +460,9 @@ namespace Edu.Module.Exam
PaperType
=
2
,
PaperType
=
2
,
ParentId
=
newPaperId
,
ParentId
=
newPaperId
,
IsOpen
=
model
.
IsOpen
,
IsOpen
=
model
.
IsOpen
,
GroupType
=
model
.
GroupType
,
PaperScore
=
model
.
TemplateScore
,
};
};
var
newSubPaperId
=
examination_PaperRepository
.
Insert
(
subModel
);
var
newSubPaperId
=
examination_PaperRepository
.
Insert
(
subModel
);
subModel
.
PaperId
=
newSubPaperId
;
subModel
.
PaperId
=
newSubPaperId
;
flag
=
newSubPaperId
>
0
;
flag
=
newSubPaperId
>
0
;
...
@@ -456,7 +471,15 @@ namespace Edu.Module.Exam
...
@@ -456,7 +471,15 @@ namespace Edu.Module.Exam
int
G_Sort
=
1
;
int
G_Sort
=
1
;
foreach
(
var
item
in
model
.
TempDataList
)
foreach
(
var
item
in
model
.
TempDataList
)
{
{
var
tempQuestioinList
=
questionList
?.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)?.
ToList
();
var
tempQuestioinList
=
new
List
<
RB_Question_ViewModel
>();
if
(
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionType
)
{
tempQuestioinList
=
questionList
?.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)?.
ToList
();
}
else
if
(
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionClassify
)
{
tempQuestioinList
=
questionList
?.
Where
(
qitem
=>
qitem
.
Category
.
ToInt
()
==
item
.
QuestionTypeId
)?.
ToList
();
}
var
subTempQuestionList
=
new
List
<
RB_Question_ViewModel
>();
var
subTempQuestionList
=
new
List
<
RB_Question_ViewModel
>();
//题库随机选题
//题库随机选题
if
(
item
.
ChooseType
==
1
)
if
(
item
.
ChooseType
==
1
)
...
@@ -475,29 +498,26 @@ namespace Edu.Module.Exam
...
@@ -475,29 +498,26 @@ namespace Edu.Module.Exam
}
}
}
}
}
}
else
if
(
item
.
ChooseType
==
3
)
{
if
(
item
.
CategoryList
!=
null
&&
item
.
CategoryList
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
CategoryList
.
Where
(
qitem
=>
qitem
.
ChooseNum
>
0
))
{
var
tempList
=
tempQuestioinList
?.
Where
(
qitem
=>
qitem
.
Category
==
subItem
.
Category
)?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
Take
(
subItem
.
ChooseNum
)?.
ToList
();
if
(
tempList
!=
null
&&
tempList
.
Count
>
0
)
{
subTempQuestionList
.
AddRange
(
tempList
);
}
}
}
}
var
groupModel
=
new
RB_Examination_Group_ViewModel
()
var
groupModel
=
new
RB_Examination_Group_ViewModel
()
{
{
GId
=
0
,
GId
=
0
,
PaperId
=
subModel
.
PaperId
,
PaperId
=
subModel
.
PaperId
,
GroupName
=
!
string
.
IsNullOrEmpty
(
item
.
QuestionDesc
)
?
item
.
QuestionDesc
:
item
.
QuestionTypeName
,
GroupName
=
!
string
.
IsNullOrEmpty
(
item
.
QuestionDesc
)
?
item
.
QuestionDesc
:
item
.
QuestionTypeName
,
GSortNum
=
G_Sort
,
GSortNum
=
G_Sort
,
QuestionTypeId
=
item
.
QuestionTypeId
,
GScore
=
item
.
QuestionScore
,
QuestionTypeKey
=
item
.
QuestionTypeKey
,
QuestionTypeKey
=
item
.
QuestionTypeKey
,
GroupType
=
model
.
GroupType
,
};
};
if
(
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionType
)
{
groupModel
.
QuestionTypeId
=
item
.
QuestionTypeId
;
groupModel
.
CategoryId
=
0
;
}
else
if
(
model
.
GroupType
==
ExamGroupTypeEnum
.
QuestionClassify
)
{
groupModel
.
QuestionTypeId
=
0
;
groupModel
.
CategoryId
=
(
QuestionCategoryEnum
)
item
.
QuestionTypeId
;
}
G_Sort
++;
G_Sort
++;
var
newGId
=
examination_GroupRepository
.
Insert
(
groupModel
);
var
newGId
=
examination_GroupRepository
.
Insert
(
groupModel
);
groupModel
.
GId
=
newGId
;
groupModel
.
GId
=
newGId
;
...
@@ -508,6 +528,7 @@ namespace Edu.Module.Exam
...
@@ -508,6 +528,7 @@ namespace Edu.Module.Exam
var
detailsModel
=
new
RB_Examination_Details_ViewModel
()
var
detailsModel
=
new
RB_Examination_Details_ViewModel
()
{
{
Id
=
0
,
Id
=
0
,
GId
=
groupModel
.
GId
,
PaperId
=
subModel
.
PaperId
,
PaperId
=
subModel
.
PaperId
,
BankId
=
qItem
.
BankId
,
BankId
=
qItem
.
BankId
,
QuestionId
=
qItem
.
QuestionId
,
QuestionId
=
qItem
.
QuestionId
,
...
@@ -523,7 +544,7 @@ namespace Edu.Module.Exam
...
@@ -523,7 +544,7 @@ namespace Edu.Module.Exam
UpdateBy
=
model
.
CreateBy
,
UpdateBy
=
model
.
CreateBy
,
UpdateTime
=
model
.
CreateTime
,
UpdateTime
=
model
.
CreateTime
,
IsUpdateJobExam
=
qItem
.
IsUpdateJobExam
,
IsUpdateJobExam
=
qItem
.
IsUpdateJobExam
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
Status
=
DateStateEnum
.
Normal
,
SortNum
=
Q_SortNum
,
SortNum
=
Q_SortNum
,
Answer
=
qItem
.
Answer
,
Answer
=
qItem
.
Answer
,
IsMutex
=
qItem
.
IsMutex
,
IsMutex
=
qItem
.
IsMutex
,
...
@@ -569,16 +590,18 @@ namespace Edu.Module.Exam
...
@@ -569,16 +590,18 @@ namespace Edu.Module.Exam
if
(
model
.
PaperId
>
0
)
if
(
model
.
PaperId
>
0
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
{
nameof
(
RB_Examination_Paper_ViewModel
.
PaperName
),
model
.
PaperName
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
PaperName
),
model
.
PaperName
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
QuestionBandIds
),
model
.
QuestionBandIds
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
QuestionBandIds
),
model
.
QuestionBandIds
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
DifficultyType
),
model
.
DifficultyType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
DifficultyType
),
model
.
DifficultyType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
GenerateType
),
model
.
GenerateType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
GenerateType
),
model
.
GenerateType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
CreateNum
),
model
.
CreateNum
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
CreateNum
),
model
.
CreateNum
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
PaperType
),
model
.
PaperType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
PaperType
),
model
.
PaperType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
model
.
ParentId
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
model
.
ParentId
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
IsOpen
),
model
.
IsOpen
}
{
nameof
(
RB_Examination_Paper_ViewModel
.
IsOpen
),
model
.
IsOpen
},
};
{
nameof
(
RB_Examination_Paper_ViewModel
.
GroupType
),
model
.
GroupType
},
{
nameof
(
RB_Examination_Paper_ViewModel
.
PaperScore
),
model
.
PaperScore
},
};
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
model
.
PaperId
));
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
model
.
PaperId
));
}
}
else
else
...
@@ -691,11 +714,10 @@ namespace Edu.Module.Exam
...
@@ -691,11 +714,10 @@ namespace Edu.Module.Exam
}
}
foreach
(
var
gItem
in
extModel
.
GroupList
)
foreach
(
var
gItem
in
extModel
.
GroupList
)
{
{
gItem
.
DetailsList
=
detailsList
?.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
gItem
.
QuestionType
Id
)?.
OrderBy
(
qitem
=>
qitem
.
SortNum
)?.
ToList
()
??
new
List
<
RB_Examination_Details_ViewModel
>();
gItem
.
DetailsList
=
detailsList
?.
Where
(
qitem
=>
qitem
.
GId
==
gItem
.
G
Id
)?.
OrderBy
(
qitem
=>
qitem
.
SortNum
)?.
ToList
()
??
new
List
<
RB_Examination_Details_ViewModel
>();
if
(
gItem
.
DetailsList
!=
null
&&
gItem
.
DetailsList
.
Count
>
0
)
if
(
gItem
.
DetailsList
!=
null
&&
gItem
.
DetailsList
.
Count
>
0
)
{
{
gItem
.
GScore
=
gItem
?.
DetailsList
?.
Sum
(
qitem
=>
qitem
.
Score
)
??
0
;
gItem
.
GScore
=
gItem
?.
DetailsList
?.
Sum
(
qitem
=>
qitem
.
Score
)
??
0
;
foreach
(
var
sItem
in
gItem
.
DetailsList
)
foreach
(
var
sItem
in
gItem
.
DetailsList
)
{
{
List
<
object
>
quesAnswerList
=
new
List
<
object
>();
List
<
object
>
quesAnswerList
=
new
List
<
object
>();
...
...
Edu.Module.Question/QuestionModule.cs
View file @
003b9580
...
@@ -143,7 +143,7 @@ namespace Edu.Module.Question
...
@@ -143,7 +143,7 @@ namespace Edu.Module.Question
/// </summary>
/// </summary>
/// <param name="query"></param>
/// <param name="query"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
object
>
GetQuestion
Category
ListModule
(
RB_Question_ViewModel
query
)
public
List
<
object
>
GetQuestion
TypeStatic
ListModule
(
RB_Question_ViewModel
query
)
{
{
List
<
object
>
list
=
new
List
<
object
>();
List
<
object
>
list
=
new
List
<
object
>();
var
dataList
=
questionRepository
.
GetQuestionStaticsListRepository
(
query
);
var
dataList
=
questionRepository
.
GetQuestionStaticsListRepository
(
query
);
...
@@ -158,11 +158,12 @@ namespace Edu.Module.Question
...
@@ -158,11 +158,12 @@ namespace Edu.Module.Question
{
{
var
qType
=
questionTypeList
?.
Where
(
qitem
=>
qitem
.
QId
==
item
.
QuestionTypeId
)?.
FirstOrDefault
();
var
qType
=
questionTypeList
?.
Where
(
qitem
=>
qitem
.
QId
==
item
.
QuestionTypeId
)?.
FirstOrDefault
();
var
diffTypeList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)
var
diffTypeList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)
.
GroupBy
(
qitem
=>
new
{
qitem
.
DifficultyType
})
.
Select
(
qitem
=>
new
.
Select
(
qitem
=>
new
{
{
qitem
.
DifficultyType
,
qitem
.
Key
.
DifficultyType
,
DifficultyTypeName
=
qitem
.
DifficultyType
.
ToName
(),
DifficultyTypeName
=
qitem
.
Key
.
DifficultyType
.
ToName
(),
DifficultyTypeCount
=
qitem
.
QuestionCount
,
DifficultyTypeCount
=
qitem
.
Sum
(
sItem
=>
sItem
.
QuestionCount
)
,
ChooseNum
=
0
ChooseNum
=
0
});
});
...
@@ -190,22 +191,21 @@ namespace Edu.Module.Question
...
@@ -190,22 +191,21 @@ namespace Edu.Module.Question
/// </summary>
/// </summary>
/// <param name="query"></param>
/// <param name="query"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
object
>
GetQuestionCategory
List_V2
Module
(
RB_Question_ViewModel
query
)
public
List
<
object
>
GetQuestionCategory
StaticList
Module
(
RB_Question_ViewModel
query
)
{
{
List
<
object
>
list
=
new
List
<
object
>();
List
<
object
>
list
=
new
List
<
object
>();
var
dataList
=
questionRepository
.
GetQuestionStaticsListRepository
(
query
);
var
dataList
=
questionRepository
.
GetQuestionStaticsListRepository
(
query
);
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
{
var
questionTypeList
=
GetQuestionTypeListModule
(
new
RB_Question_Type_ViewModel
());
var
questionTypeList
=
GetQuestionTypeListModule
(
new
RB_Question_Type_ViewModel
());
var
groupList
=
dataList
.
GroupBy
(
qitem
=>
new
{
qitem
.
QuestionTypeId
,
}).
Select
(
qitem
=>
new
var
groupList
=
dataList
.
GroupBy
(
qitem
=>
new
{
qitem
.
Category
,
}).
Select
(
qitem
=>
new
{
{
qitem
.
Key
.
QuestionTypeId
qitem
.
Key
.
Category
});
});
foreach
(
var
item
in
groupList
)
foreach
(
var
item
in
groupList
)
{
{
var
qType
=
questionTypeList
?.
Where
(
qitem
=>
qitem
.
QId
==
item
.
QuestionTypeId
)?.
FirstOrDefault
();
var
diffTypeList
=
dataList
.
Where
(
qitem
=>
qitem
.
Category
==
item
.
Category
)
var
diffTypeList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)
.
GroupBy
(
qitem
=>
new
{
qitem
.
DifficultyType
})
.
GroupBy
(
qitem
=>
new
{
qitem
.
QuestionTypeId
,
qitem
.
DifficultyType
})
.
Select
(
qitem
=>
new
.
Select
(
qitem
=>
new
{
{
qitem
.
Key
.
DifficultyType
,
qitem
.
Key
.
DifficultyType
,
...
@@ -213,41 +213,17 @@ namespace Edu.Module.Question
...
@@ -213,41 +213,17 @@ namespace Edu.Module.Question
DifficultyTypeCount
=
qitem
.
Sum
(
c
=>
c
.
QuestionCount
),
DifficultyTypeCount
=
qitem
.
Sum
(
c
=>
c
.
QuestionCount
),
ChooseNum
=
0
ChooseNum
=
0
});
});
var
categoryList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
).
GroupBy
(
qitem
=>
new
{
qitem
.
Category
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
Category
});
List
<
object
>
resultCategoryList
=
new
List
<
object
>();
foreach
(
var
subItem
in
categoryList
)
{
var
tempCategoryList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
&&
qitem
.
Category
==
subItem
.
Category
)?.
ToList
();
if
(
tempCategoryList
!=
null
&&
tempCategoryList
.
Count
>
0
)
{
var
cObj
=
new
{
subItem
.
Category
,
CategoryName
=
subItem
.
Category
.
ToName
(),
QuestionTypeNum
=
tempCategoryList
.
Sum
(
qitem
=>
qitem
.
QuestionCount
),
ChooseNum
=
0
,
ChooseList
=
tempCategoryList
?.
Select
(
qitem
=>
new
{
qitem
.
DifficultyType
,
DifficultyTypeName
=
qitem
.
DifficultyType
.
ToName
(),
DifficultyTypeCount
=
qitem
.
QuestionCount
,
ChooseNum
=
0
})
};
resultCategoryList
.
Add
(
cObj
);
}
}
var
obj
=
new
var
obj
=
new
{
{
item
.
QuestionTypeId
,
QuestionTypeId
=
item
.
Category
,
QuestionTypeKey
=
qType
?.
Key
,
QuestionTypeKey
=
""
,
QuestionTypeName
=
qType
?.
Name
,
QuestionTypeName
=
item
.
Category
.
ToName
()
,
QuestionScore
=
0
,
QuestionScore
=
0
,
QuestionDesc
=
""
,
QuestionDesc
=
""
,
ChooseType
=
1
,
ChooseType
=
1
,
ChooseNum
=
0
,
ChooseNum
=
0
,
QuestionTypeNum
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
).
Sum
(
qitem
=>
qitem
.
QuestionCount
),
QuestionTypeNum
=
dataList
.
Where
(
qitem
=>
qitem
.
Category
==
item
.
Category
).
Sum
(
qitem
=>
qitem
.
QuestionCount
),
CategoryList
=
resultCategoryList
,
ChooseList
=
diffTypeList
,
ChooseList
=
diffTypeList
,
};
};
list
.
Add
(
obj
);
list
.
Add
(
obj
);
...
...
Edu.Repository/Question/RB_QuestionRepository.cs
View file @
003b9580
...
@@ -44,6 +44,10 @@ WHERE 1=1
...
@@ -44,6 +44,10 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
query
.
Q_QuestionTypeIds
);
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
query
.
Q_QuestionTypeIds
);
}
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QCategoryId
))
{
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
Category
),
query
.
QCategoryId
);
}
return
Get
<
RB_Question_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Question_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
}
}
...
@@ -84,6 +88,7 @@ WHERE 1=1 AND `Status`=0
...
@@ -84,6 +88,7 @@ WHERE 1=1 AND `Status`=0
}
}
}
}
/// <summary>
/// <summary>
/// 获取问题分页列表
/// 获取问题分页列表
/// </summary>
/// </summary>
...
...
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
003b9580
...
@@ -241,13 +241,31 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -241,13 +241,31 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Success
(
data
:
pageModel
);
return
ApiResult
.
Success
(
data
:
pageModel
);
}
}
/// <summary>
/// 根据题库编号获取题库题型列表【试卷组卷使用】
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetQuestionTypeStaticList
()
{
var
query
=
new
RB_Question_ViewModel
()
{
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
PointName
=
base
.
ParmJObj
.
GetStringValue
(
"PointName"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
QBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"QBankIds"
),
};
var
data
=
questionModule
.
GetQuestionTypeStaticListModule
(
query
);
return
ApiResult
.
Success
(
data
:
data
);
}
/// <summary>
/// <summary>
/// 根据题库编号获取题库题型分类列表【试卷组卷使用】
/// 根据题库编号获取题库题型分类列表【试卷组卷使用】
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetQuestionCategoryList
()
public
ApiResult
GetQuestionCategory
Static
List
()
{
{
var
query
=
new
RB_Question_ViewModel
()
var
query
=
new
RB_Question_ViewModel
()
{
{
...
@@ -257,11 +275,10 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -257,11 +275,10 @@ namespace Edu.WebApi.Controllers.Course
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
QBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"QBankIds"
),
QBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"QBankIds"
),
};
};
var
data
=
questionModule
.
GetQuestionCategory
List_V2
Module
(
query
);
var
data
=
questionModule
.
GetQuestionCategory
StaticList
Module
(
query
);
return
ApiResult
.
Success
(
data
:
data
);
return
ApiResult
.
Success
(
data
:
data
);
}
}
/// <summary>
/// <summary>
/// 获取问题难易列表
/// 获取问题难易列表
/// </summary>
/// </summary>
...
...
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
003b9580
...
@@ -136,6 +136,8 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -136,6 +136,8 @@ namespace Edu.WebApi.Controllers.Exam
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
IsOpen
=
base
.
ParmJObj
.
GetInt
(
"IsOpen"
),
IsOpen
=
base
.
ParmJObj
.
GetInt
(
"IsOpen"
),
GroupType
=(
ExamGroupTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"GroupType"
),
PaperScore
=
base
.
ParmJObj
.
GetDecimal
(
"PaperScore"
),
};
};
if
(
string
.
IsNullOrEmpty
(
extModel
.
PaperName
))
if
(
string
.
IsNullOrEmpty
(
extModel
.
PaperName
))
{
{
...
@@ -157,12 +159,24 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -157,12 +159,24 @@ namespace Edu.WebApi.Controllers.Exam
GId
=
jobj
.
GetInt
(
"GId"
),
GId
=
jobj
.
GetInt
(
"GId"
),
PaperId
=
jobj
.
GetInt
(
"PaperId"
),
PaperId
=
jobj
.
GetInt
(
"PaperId"
),
GroupName
=
jobj
.
GetStringValue
(
"GroupName"
),
GroupName
=
jobj
.
GetStringValue
(
"GroupName"
),
QuestionTypeId
=
jobj
.
GetInt
(
"QuestionTypeId"
),
QuestionTypeKey
=
jobj
.
GetStringValue
(
"QuestionTypeKey"
),
GSortNum
=
gSortNum
,
GSortNum
=
gSortNum
,
GScore
=
jobj
.
GetDecimal
(
"GScore"
),
GScore
=
jobj
.
GetDecimal
(
"GScore"
),
DetailsList
=
new
List
<
RB_Examination_Details_ViewModel
>(),
DetailsList
=
new
List
<
RB_Examination_Details_ViewModel
>(),
GroupType
=
extModel
.
GroupType
,
};
};
if
(
extModel
.
GroupType
==
ExamGroupTypeEnum
.
QuestionType
)
{
gModel
.
QuestionTypeId
=
jobj
.
GetInt
(
"QuestionTypeId"
);
gModel
.
QuestionTypeKey
=
jobj
.
GetStringValue
(
"QuestionTypeKey"
);
gModel
.
CategoryId
=
0
;
}
else
if
(
extModel
.
GroupType
==
ExamGroupTypeEnum
.
QuestionClassify
)
{
gModel
.
QuestionTypeId
=
0
;
gModel
.
QuestionTypeKey
=
""
;
gModel
.
CategoryId
=
(
QuestionCategoryEnum
)
jobj
.
GetInt
(
"QuestionTypeId"
);
}
gSortNum
++;
gSortNum
++;
string
details
=
jobj
.
GetStringValue
(
"DetailsList"
);
string
details
=
jobj
.
GetStringValue
(
"DetailsList"
);
if
(!
string
.
IsNullOrEmpty
(
details
))
if
(!
string
.
IsNullOrEmpty
(
details
))
...
@@ -245,6 +259,7 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -245,6 +259,7 @@ namespace Edu.WebApi.Controllers.Exam
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
IsOpen
=
base
.
ParmJObj
.
GetInt
(
"IsOpen"
),
IsOpen
=
base
.
ParmJObj
.
GetInt
(
"IsOpen"
),
GroupType
=(
ExamGroupTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"GroupType"
),
};
};
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
...
...
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