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
c00dd070
Commit
c00dd070
authored
Aug 12, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
bc682a4f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
202 additions
and
9 deletions
+202
-9
RB_Examination_Template.cs
Edu.Model/Entity/Exam/RB_Examination_Template.cs
+1
-0
RB_Examination_Details_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Details_ViewModel.cs
+5
-0
RB_Examination_Template_ViewModel.cs
...Model/ViewModel/Exam/RB_Examination_Template_ViewModel.cs
+6
-1
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+158
-6
RB_Examination_DetailsRepository.cs
Edu.Repository/Exam/RB_Examination_DetailsRepository.cs
+30
-1
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+2
-1
No files found.
Edu.Model/Entity/Exam/RB_Examination_Template.cs
View file @
c00dd070
using
Edu.Common.Enum
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Question
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
...
...
Edu.Model/ViewModel/Exam/RB_Examination_Details_ViewModel.cs
View file @
c00dd070
...
@@ -24,5 +24,10 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -24,5 +24,10 @@ namespace Edu.Model.ViewModel.Exam
/// 选项
/// 选项
/// </summary>
/// </summary>
public
object
QuestionContentObj
{
get
;
set
;
}
public
object
QuestionContentObj
{
get
;
set
;
}
/// <summary>
/// 问题数量
/// </summary>
public
int
QuestionCount
{
get
;
set
;
}
}
}
}
}
Edu.Model/ViewModel/Exam/RB_Examination_Template_ViewModel.cs
View file @
c00dd070
...
@@ -13,6 +13,11 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -13,6 +13,11 @@ namespace Edu.Model.ViewModel.Exam
/// <summary>
/// <summary>
/// 是否保存未组卷模板(1-是)
/// 是否保存未组卷模板(1-是)
/// </summary>
/// </summary>
public
int
IsSaveTemplate
{
get
;
set
;
}
public
bool
IsSaveTemplate
{
get
;
set
;
}
/// <summary>
/// 模板数据
/// </summary>
public
List
<
ExamTemplate
>
TempDataList
{
get
;
set
;
}
}
}
}
}
Edu.Module.Exam/PaperModule.cs
View file @
c00dd070
...
@@ -9,6 +9,8 @@ using System.Text.RegularExpressions;
...
@@ -9,6 +9,8 @@ using System.Text.RegularExpressions;
using
Edu.Cache.User
;
using
Edu.Cache.User
;
using
Edu.Common.Plugin
;
using
Edu.Common.Plugin
;
using
Edu.Module.Question
;
using
Edu.Module.Question
;
using
Edu.Repository.Question
;
using
Edu.Model.ViewModel.Question
;
namespace
Edu.Module.Exam
namespace
Edu.Module.Exam
{
{
...
@@ -42,6 +44,11 @@ namespace Edu.Module.Exam
...
@@ -42,6 +44,11 @@ namespace Edu.Module.Exam
/// </summary>
/// </summary>
private
readonly
RB_Examination_TemplateRepository
examination_TemplateRepository
=
new
RB_Examination_TemplateRepository
();
private
readonly
RB_Examination_TemplateRepository
examination_TemplateRepository
=
new
RB_Examination_TemplateRepository
();
/// <summary>
/// 题库仓储层对象
/// </summary>
private
readonly
RB_QuestionRepository
questionRepository
=
new
RB_QuestionRepository
();
/// <summary>
/// <summary>
/// 获取试卷分页列表
/// 获取试卷分页列表
/// </summary>
/// </summary>
...
@@ -62,6 +69,28 @@ namespace Edu.Module.Exam
...
@@ -62,6 +69,28 @@ namespace Edu.Module.Exam
{
{
childList
=
examination_PaperRepository
.
GetExaminationPaperChildRepository
(
ids
);
childList
=
examination_PaperRepository
.
GetExaminationPaperChildRepository
(
ids
);
}
}
List
<
int
>
qIdList
=
new
List
<
int
>();
if
(
childList
!=
null
&&
childList
.
Count
>
0
)
{
var
childIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
childList
.
Select
(
qitem
=>
qitem
.
PaperId
)));
if
(
childIds
!=
null
&&
childIds
.
Count
>
0
)
{
qIdList
.
AddRange
(
childIds
);
}
}
var
idList
=
Common
.
ConvertHelper
.
StringToList
(
ids
);
if
(
idList
!=
null
&&
idList
.
Count
>
0
)
{
qIdList
.
AddRange
(
idList
);
}
var
detailsList
=
new
List
<
RB_Examination_Details_ViewModel
>();
if
(
qIdList
!=
null
&&
qIdList
.
Count
>
0
)
{
detailsList
=
examination_DetailsRepository
.
GetExaminationDetailsStaticListRepository
(
new
RB_Examination_Details_ViewModel
()
{
QPaperIds
=
string
.
Join
(
","
,
qIdList
)
});
}
foreach
(
var
item
in
data
)
foreach
(
var
item
in
data
)
{
{
ExaminationPaperTreeModel
model
=
new
ExaminationPaperTreeModel
()
ExaminationPaperTreeModel
model
=
new
ExaminationPaperTreeModel
()
...
@@ -77,10 +106,10 @@ namespace Edu.Module.Exam
...
@@ -77,10 +106,10 @@ namespace Edu.Module.Exam
CreateNum
=
item
.
CreateNum
,
CreateNum
=
item
.
CreateNum
,
PaperType
=
item
.
PaperType
,
PaperType
=
item
.
PaperType
,
ParentId
=
item
.
ParentId
,
ParentId
=
item
.
ParentId
,
QuestionCount
=
0
,
QuestionCount
=
detailsList
?.
Where
(
qitem
=>
qitem
.
PaperId
==
item
.
PaperId
)?.
Count
()??
0
,
ChildList
=
new
List
<
ExaminationPaperTreeModel
>(),
ChildList
=
new
List
<
ExaminationPaperTreeModel
>(),
};
};
model
.
ChildList
=
GetPaperChild
(
childList
,
item
.
PaperId
);
model
.
ChildList
=
GetPaperChild
(
childList
,
detailsList
,
item
.
PaperId
);
treeList
.
Add
(
model
);
treeList
.
Add
(
model
);
}
}
}
}
...
@@ -93,7 +122,7 @@ namespace Edu.Module.Exam
...
@@ -93,7 +122,7 @@ namespace Edu.Module.Exam
/// <param name="sourceList">源数据</param>
/// <param name="sourceList">源数据</param>
/// <param name="parentId">父节点编号</param>
/// <param name="parentId">父节点编号</param>
/// <returns></returns>
/// <returns></returns>
public
List
<
ExaminationPaperTreeModel
>
GetPaperChild
(
List
<
RB_Examination_Paper_ViewModel
>
sourceList
,
int
parentId
)
public
List
<
ExaminationPaperTreeModel
>
GetPaperChild
(
List
<
RB_Examination_Paper_ViewModel
>
sourceList
,
List
<
RB_Examination_Details_ViewModel
>
detailsList
,
int
parentId
)
{
{
List
<
ExaminationPaperTreeModel
>
resultList
=
new
List
<
ExaminationPaperTreeModel
>();
List
<
ExaminationPaperTreeModel
>
resultList
=
new
List
<
ExaminationPaperTreeModel
>();
//获取下级节点
//获取下级节点
...
@@ -116,10 +145,10 @@ namespace Edu.Module.Exam
...
@@ -116,10 +145,10 @@ namespace Edu.Module.Exam
CreateNum
=
childItem
.
CreateNum
,
CreateNum
=
childItem
.
CreateNum
,
PaperType
=
childItem
.
PaperType
,
PaperType
=
childItem
.
PaperType
,
ParentId
=
childItem
.
ParentId
,
ParentId
=
childItem
.
ParentId
,
QuestionCount
=
0
,
QuestionCount
=
detailsList
?.
Where
(
qitem
=>
qitem
.
PaperId
==
childItem
.
PaperId
)?.
Count
()
??
0
,
ChildList
=
new
List
<
ExaminationPaperTreeModel
>(),
ChildList
=
new
List
<
ExaminationPaperTreeModel
>(),
};
};
childModel
.
ChildList
.
AddRange
(
GetPaperChild
(
sourceList
,
childItem
.
PaperId
));
childModel
.
ChildList
.
AddRange
(
GetPaperChild
(
sourceList
,
detailsList
,
childItem
.
PaperId
));
resultList
.
Add
(
childModel
);
resultList
.
Add
(
childModel
);
}
}
}
}
...
@@ -232,7 +261,7 @@ namespace Edu.Module.Exam
...
@@ -232,7 +261,7 @@ namespace Edu.Module.Exam
public
virtual
bool
SetPaperTemplateModule
(
RB_Examination_Template_ViewModel
model
)
public
virtual
bool
SetPaperTemplateModule
(
RB_Examination_Template_ViewModel
model
)
{
{
bool
flag
=
true
;
bool
flag
=
true
;
if
(
model
.
IsSaveTemplate
==
1
)
if
(
model
.
IsSaveTemplate
)
{
{
if
(
model
.
TemplateId
>
0
)
if
(
model
.
TemplateId
>
0
)
{
{
...
@@ -254,6 +283,129 @@ namespace Edu.Module.Exam
...
@@ -254,6 +283,129 @@ namespace Edu.Module.Exam
flag
=
newTempId
>
0
;
flag
=
newTempId
>
0
;
}
}
}
}
//获取问题列表
var
questionList
=
questionRepository
.
GetQuestionListRepository
(
new
RB_Question_ViewModel
()
{
QBankIds
=
model
.
TemplateBankIds
});
//文件夹
var
paperModel
=
new
RB_Examination_Paper_ViewModel
()
{
PaperId
=
0
,
PaperName
=
model
.
TemplateName
,
QuestionBandIds
=
model
.
TemplateBankIds
,
DifficultyType
=
model
.
TemplateDifficultyType
,
CreateTime
=
model
.
CreateTime
,
CreateBy
=
model
.
CreateBy
,
PublishCount
=
0
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
GenerateType
=
1
,
CreateNum
=
model
.
TemplateNum
,
PaperType
=
1
,
ParentId
=
0
,
};
var
newPaperId
=
examination_PaperRepository
.
Insert
(
paperModel
);
paperModel
.
PaperId
=
newPaperId
;
flag
=
newPaperId
>
0
;
if
(
paperModel
.
CreateNum
>
0
)
{
for
(
var
i
=
0
;
i
<
paperModel
.
CreateNum
;
i
++)
{
var
subModel
=
new
RB_Examination_Paper_ViewModel
()
{
PaperId
=
0
,
PaperName
=
model
.
TemplateName
+(
i
+
1
),
QuestionBandIds
=
model
.
TemplateBankIds
,
DifficultyType
=
model
.
TemplateDifficultyType
,
CreateTime
=
model
.
CreateTime
,
CreateBy
=
model
.
CreateBy
,
PublishCount
=
0
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
GenerateType
=
1
,
CreateNum
=
model
.
TemplateNum
,
PaperType
=
2
,
ParentId
=
newPaperId
,
};
var
newSubPaperId
=
examination_PaperRepository
.
Insert
(
subModel
);
subModel
.
PaperId
=
newSubPaperId
;
flag
=
newSubPaperId
>
0
;
if
(
model
.
TempDataList
!=
null
&&
model
.
TempDataList
.
Count
>
0
)
{
int
G_Sort
=
1
;
foreach
(
var
item
in
model
.
TempDataList
)
{
var
tempQuestioinList
=
questionList
?.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)?.
ToList
();
var
subTempQuestionList
=
new
List
<
RB_Question_ViewModel
>();
//题库随机选题
if
(
item
.
ChooseType
==
1
)
{
subTempQuestionList
=
tempQuestioinList
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
Take
(
item
.
ChooseNum
)?.
ToList
();
}
//题库难易程度随机选题
else
if
(
item
.
ChooseType
==
2
)
{
foreach
(
var
subItem
in
item
.
ChooseList
)
{
var
tempList
=
tempQuestioinList
?.
Where
(
qitem
=>
qitem
.
DifficultyType
==
subItem
.
DifficultyType
)?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
Take
(
subItem
.
ChooseNum
)?.
ToList
();
if
(
tempList
!=
null
&&
tempList
.
Count
>
0
)
{
subTempQuestionList
.
AddRange
(
tempList
);
}
}
}
var
groupModel
=
new
RB_Examination_Group_ViewModel
()
{
GId
=
0
,
PaperId
=
subModel
.
PaperId
,
GroupName
=
item
.
QuestionTypeName
,
GSortNum
=
G_Sort
,
QuestionTypeId
=
item
.
QuestionTypeId
,
QuestionTypeKey
=
item
.
QuestionTypeKey
,
};
G_Sort
++;
var
newGId
=
examination_GroupRepository
.
Insert
(
groupModel
);
groupModel
.
GId
=
newGId
;
flag
=
newGId
>
0
;
int
Q_SortNum
=
1
;
foreach
(
var
qItem
in
subTempQuestionList
)
{
var
detailsModel
=
new
RB_Examination_Details_ViewModel
()
{
Id
=
0
,
PaperId
=
subModel
.
PaperId
,
BankId
=
qItem
.
BankId
,
QuestionId
=
qItem
.
QuestionId
,
Title
=
qItem
.
Title
,
QuestionContent
=
qItem
.
QuestionContent
,
DifficultyType
=
qItem
.
DifficultyType
,
AnswerParse
=
qItem
.
AnswerParse
,
QuestionTypeId
=
qItem
.
QuestionTypeId
,
QuestionTypeKey
=
qItem
.
QuestionTypeKey
,
Knowledge
=
qItem
.
Knowledge
,
CreateBy
=
model
.
CreateBy
,
CreateTime
=
model
.
CreateTime
,
UpdateBy
=
model
.
CreateBy
,
UpdateTime
=
model
.
CreateTime
,
IsUpdateJobExam
=
qItem
.
IsUpdateJobExam
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
SortNum
=
Q_SortNum
,
Answer
=
qItem
.
Answer
,
IsMutex
=
qItem
.
IsMutex
,
Category
=
qItem
.
Category
,
LevelType
=
qItem
.
LevelType
,
Score
=
item
.
QuestionScore
/
subTempQuestionList
.
Count
()
};
Q_SortNum
++;
var
newDetailsId
=
examination_DetailsRepository
.
Insert
(
detailsModel
);
detailsModel
.
Id
=
newDetailsId
;
flag
=
newDetailsId
>
0
;
}
}
}
}
}
return
flag
;
return
flag
;
}
}
...
...
Edu.Repository/Exam/RB_Examination_DetailsRepository.cs
View file @
c00dd070
...
@@ -40,6 +40,35 @@ WHERE 1=1
...
@@ -40,6 +40,35 @@ WHERE 1=1
}
}
return
Get
<
RB_Examination_Details_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Examination_Details_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
/// <summary>
/// 获取试卷题目列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Examination_Details_ViewModel
>
GetExaminationDetailsStaticListRepository
(
RB_Examination_Details_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.PaperId,COUNT(1) AS QuestionCount
FROM RB_Examination_Details AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Examination_Details_ViewModel
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
PaperId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
query
.
PaperId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QPaperIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
query
.
QPaperIds
);
}
}
builder
.
Append
(
" GROUP BY A.PaperId "
);
return
Get
<
RB_Examination_Details_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
}
}
}
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
c00dd070
...
@@ -175,7 +175,7 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -175,7 +175,7 @@ namespace Edu.WebApi.Controllers.Exam
Group_Id
=
base
.
UserInfo
.
Group_Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
base
.
UserInfo
.
School_Id
,
School_Id
=
base
.
UserInfo
.
School_Id
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
IsSaveTemplate
=
base
.
ParmJObj
.
Get
Int
(
"IsSaveTemplate"
),
IsSaveTemplate
=
base
.
ParmJObj
.
Get
BoolValue
(
"IsSaveTemplate"
),
};
};
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
...
@@ -184,6 +184,7 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -184,6 +184,7 @@ namespace Edu.WebApi.Controllers.Exam
if
(
list
!=
null
&&
list
.
Count
>
0
)
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
{
extModel
.
TemplateData
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
list
);
extModel
.
TemplateData
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
list
);
extModel
.
TempDataList
=
list
;
}
}
}
}
bool
flag
=
paperModule
.
SetPaperTemplateModule
(
extModel
);
bool
flag
=
paperModule
.
SetPaperTemplateModule
(
extModel
);
...
...
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