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
b776b5e2
Commit
b776b5e2
authored
Aug 10, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
914bafc4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
216 additions
and
28 deletions
+216
-28
RB_Examination_Paper_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
+14
-1
Edu.Module.Exam.csproj
Edu.Module.Exam/Edu.Module.Exam.csproj
+8
-0
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+56
-27
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+137
-0
Edu.WebApi.csproj
Edu.WebApi/Edu.WebApi.csproj
+1
-0
No files found.
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
View file @
b776b5e2
...
...
@@ -8,8 +8,21 @@ namespace Edu.Model.ViewModel.Exam
/// <summary>
/// 试卷师徒实体类
/// </summary>
public
class
RB_Examination_Paper_ViewModel
:
RB_Examination_Paper
public
class
RB_Examination_Paper_ViewModel
:
RB_Examination_Paper
{
/// <summary>
/// 创建人
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
string
CreateTimeStr
{
get
{
return
Common
.
ConvertHelper
.
FormatDate
(
this
.
CreateTime
);
}
}
/// <summary>
/// 试卷问题列表
/// </summary>
public
List
<
RB_Examination_Details_ViewModel
>
DetailsList
{
get
;
set
;
}
}
}
Edu.Module.Exam/Edu.Module.Exam.csproj
View file @
b776b5e2
...
...
@@ -4,4 +4,12 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Aop\Edu.Aop.csproj" />
<ProjectReference Include="..\Edu.Cache\Edu.Cache.csproj" />
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
</ItemGroup>
</Project>
Edu.Module.Exam/PaperModule.cs
View file @
b776b5e2
using
Edu.Model.ViewModel.Exam
;
using
Edu.AOP.CustomerAttribute
;
using
Edu.Model.ViewModel.Exam
;
using
Edu.Repository.Exam
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -49,6 +50,7 @@ namespace Edu.Module.Exam
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
virtual
bool
SetExaminationPaperModule
(
RB_Examination_Paper_ViewModel
model
)
{
bool
flag
;
...
...
@@ -62,43 +64,70 @@ namespace Edu.Module.Exam
}
else
{
var
newId
=
examination_PaperRepository
.
Insert
(
model
);
model
.
PaperId
=
newId
;
flag
=
newId
>
0
;
var
newPaperId
=
examination_PaperRepository
.
Insert
(
model
);
model
.
PaperId
=
newPaperId
;
flag
=
newPaperId
>
0
;
}
if
(
model
.
DetailsList
!=
null
&&
model
.
DetailsList
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
DetailsList
)
{
item
.
PaperId
=
model
.
PaperId
;
if
(
flag
)
{
if
(
item
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
item
.
PaperId
},
{
nameof
(
RB_Examination_Details_ViewModel
.
BankId
),
item
.
BankId
},
{
nameof
(
RB_Examination_Details_ViewModel
.
QuestionId
),
item
.
QuestionId
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Title
),
item
.
Title
},
{
nameof
(
RB_Examination_Details_ViewModel
.
QuestionContent
),
item
.
QuestionContent
},
{
nameof
(
RB_Examination_Details_ViewModel
.
DifficultyType
),
item
.
DifficultyType
},
{
nameof
(
RB_Examination_Details_ViewModel
.
AnswerParse
),
item
.
AnswerParse
},
{
nameof
(
RB_Examination_Details_ViewModel
.
QuestionTypeId
),
item
.
QuestionTypeId
},
{
nameof
(
RB_Examination_Details_ViewModel
.
QuestionTypeKey
),
item
.
QuestionTypeKey
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Knowledge
),
item
.
Knowledge
},
{
nameof
(
RB_Examination_Details_ViewModel
.
UpdateBy
),
item
.
UpdateBy
},
{
nameof
(
RB_Examination_Details_ViewModel
.
UpdateTime
),
item
.
UpdateTime
},
{
nameof
(
RB_Examination_Details_ViewModel
.
IsUpdateJobExam
),
item
.
IsUpdateJobExam
},
{
nameof
(
RB_Examination_Details_ViewModel
.
SortNum
),
item
.
SortNum
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Answer
),
item
.
Answer
},
{
nameof
(
RB_Examination_Details_ViewModel
.
IsMutex
),
item
.
IsMutex
},
{
nameof
(
RB_Examination_Details_ViewModel
.
Category
),
item
.
Category
},
{
nameof
(
RB_Examination_Details_ViewModel
.
LevelType
),
item
.
LevelType
},
};
flag
=
examination_DetailsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
Id
),
item
.
Id
));
}
else
{
var
newId
=
examination_DetailsRepository
.
Insert
(
item
);
item
.
Id
=
newId
;
flag
=
newId
>
0
;
}
}
}
}
return
flag
;
}
/// <summary>
///
新增试卷题目
///
根据试卷编号获取试卷实体
/// </summary>
/// <param name="
list
"></param>
/// <param name="
PaperId
"></param>
/// <returns></returns>
public
virtual
bool
SetExaminationDetailsModule
(
List
<
RB_Examination_Details_ViewModel
>
list
)
public
RB_Examination_Paper_ViewModel
GetExaminationPaperModule
(
object
PaperId
)
{
bool
flag
=
true
;
foreach
(
var
item
in
list
)
var
extModel
=
examination_PaperRepository
.
GetEntity
<
RB_Examination_Paper_ViewModel
>(
PaperId
)
;
if
(
extModel
!=
null
&&
extModel
.
PaperId
>
0
)
{
if
(
flag
)
extModel
.
DetailsList
=
GetExaminationDetailsListModule
(
new
RB_Examination_Details_ViewModel
(
)
{
if
(
item
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Examination_Details_ViewModel
.
Title
),
item
.
Title
}
};
flag
=
examination_DetailsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
Id
),
item
.
Id
));
}
else
{
var
newId
=
examination_DetailsRepository
.
Insert
(
item
);
item
.
PaperId
=
newId
;
flag
=
newId
>
0
;
}
}
PaperId
=
extModel
.
PaperId
});
}
return
flag
;
return
extModel
;
}
}
}
Edu.WebApi/Controllers/Exam/ExamController.cs
0 → 100644
View file @
b776b5e2
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Question
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Exam
;
using
Edu.Module.Exam
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Edu.WebApi.Controllers.Exam
{
/// <summary>
/// 改变流程相关申请
/// </summary>
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
ExamController
:
BaseController
{
/// <summary>
/// 试卷处理类对象
/// </summary>
private
readonly
PaperModule
paperModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
PaperModule
>();
/// <summary>
/// 获取试卷分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPaperPage
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Examination_Paper_ViewModel
()
{
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
paperModule
.
GetExaminationPaperPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
result
.
Add
(
new
{
item
.
PaperId
,
item
.
PaperName
,
item
.
CreateTimeStr
,
item
.
CreateByName
,
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
result
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 添加修改试卷
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetPaper
()
{
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
{
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
QuestionBandIds
=
base
.
ParmJObj
.
GetStringValue
(
"QuestionBandIds"
),
CreateBy
=
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
};
extModel
.
DetailsList
=
new
List
<
RB_Examination_Details_ViewModel
>();
string
details
=
base
.
ParmJObj
.
GetStringValue
(
"DetailsList"
);
if
(!
string
.
IsNullOrEmpty
(
details
))
{
JArray
jarray
=
JArray
.
Parse
(
details
);
if
(
jarray
!=
null
&&
jarray
.
Count
>
0
)
{
foreach
(
var
jItem
in
jarray
)
{
JObject
jobj
=
JObject
.
Parse
(
jItem
.
ToString
());
extModel
.
DetailsList
.
Add
(
new
RB_Examination_Details_ViewModel
()
{
Id
=
jobj
.
GetInt
(
"Id"
),
PaperId
=
jobj
.
GetInt
(
"PaperId"
),
BankId
=
jobj
.
GetInt
(
"BankId"
),
QuestionId
=
jobj
.
GetInt
(
"QuestionId"
),
Title
=
jobj
.
GetStringValue
(
"Title"
),
QuestionContent
=
jobj
.
GetStringValue
(
"QuestionContent"
),
DifficultyType
=
(
DifficultyTypeEnum
)
jobj
.
GetInt
(
"DifficultyType"
),
AnswerParse
=
jobj
.
GetStringValue
(
"AnswerParse"
),
QuestionTypeId
=
jobj
.
GetInt
(
"QuestionTypeId"
),
QuestionTypeKey
=
jobj
.
GetStringValue
(
"QuestionTypeKey"
),
Knowledge
=
jobj
.
GetStringValue
(
"Knowledge"
),
CreateBy
=
base
.
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
UpdateBy
=
base
.
UserInfo
.
Id
,
UpdateTime
=
DateTime
.
Now
,
IsUpdateJobExam
=
base
.
ParmJObj
.
GetInt
(
"IsUpdateJobExam"
),
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
SortNum
=
base
.
ParmJObj
.
GetInt
(
"SortNum"
),
Answer
=
base
.
ParmJObj
.
GetStringValue
(
"Answer"
),
IsMutex
=
base
.
ParmJObj
.
GetInt
(
"IsMutex"
),
Category
=
(
QuestionCategoryEnum
)
base
.
ParmJObj
.
GetInt
(
"Category"
),
LevelType
=
(
LevelTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"LevelType"
),
});
}
}
}
bool
flag
=
paperModule
.
SetExaminationPaperModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据编号获取试卷信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
model
=
paperModule
.
GetExaminationPaperModule
(
PaperId
);
return
ApiResult
.
Success
(
data
:
model
);
}
}
}
Edu.WebApi/Edu.WebApi.csproj
View file @
b776b5e2
...
...
@@ -41,6 +41,7 @@
<ProjectReference Include="..\Edu.Module.Course\Edu.Module.Course.csproj" />
<ProjectReference Include="..\Edu.Module.Duty\Edu.Module.Duty.csproj" />
<ProjectReference Include="..\Edu.Module.EduTask\Edu.Module.EduTask.csproj" />
<ProjectReference Include="..\Edu.Module.Exam\Edu.Module.Exam.csproj" />
<ProjectReference Include="..\Edu.Module.Finance\Edu.Module.Finance.csproj" />
<ProjectReference Include="..\Edu.Module.OKR\Edu.Module.OKR.csproj" />
<ProjectReference Include="..\Edu.Module.Public\Edu.Module.Public.csproj" />
...
...
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