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
7252a0a3
Commit
7252a0a3
authored
Jan 23, 2018
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智评分数代码优化
parent
9368ace7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
112 deletions
+41
-112
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+1
-105
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+1
-1
ScoreInfoDTO.java
.../java/org/rcisoft/business/bchapter/dto/ScoreInfoDTO.java
+1
-0
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+12
-1
IntellEvaluation.java
...va/org/rcisoft/business/bcode/model/IntellEvaluation.java
+26
-5
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
7252a0a3
...
...
@@ -225,7 +225,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam
(
name
=
"slId"
,
value
=
"开课ID"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"chapterId"
,
value
=
"章节id"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"filePath"
,
value
=
"文件路径"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"student
Id
"
,
value
=
"学生学号"
,
required
=
true
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"student
Code
"
,
value
=
"学生学号"
,
required
=
true
,
dataType
=
"varchar"
)})
@PreAuthorize
(
"hasRole('ROLE_1003')"
)
@PostMapping
(
value
=
"/complete"
)
public
Result
complete
(
ScoreInfoDTO
scoreInfoDTO
)
{
...
...
@@ -239,110 +239,6 @@ public class BChapterController extends PaginationController<BChapter> {
}
private
Callable
<
Result
>
timeOutCallBack
(){
Callable
<
Result
>
callback
=
(()->
{
log
.
info
(
"请求超时"
);
Result
result
=
new
Result
();
result
.
setMessage
(
"请求超时"
);
return
result
;
});
return
callback
;
}
@ApiOperation
(
value
=
"关闭che"
,
notes
=
"根据端口关闭che"
)
@ApiImplicitParam
(
name
=
"port"
,
value
=
"che启动的端口"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/cheStopWithoutAuth"
)
public
WebAsyncTask
<
Result
>
cheStop
(
String
port
)
throws
Exception
{
Result
result
=
new
Result
();
log
.
info
(
"主线程开始"
);
Callable
<
Result
>
data
=
(()
->
{
log
.
info
(
"副线程开始"
);
/*action.cheStop(port);
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(ResultServiceEnums.SUCCESS.getMessage());
result.setData(null);*/
log
.
info
(
"副线程结束"
);
return
result
;
});
WebAsyncTask
<
Result
>
webAsyncTask
=
new
WebAsyncTask
<>(
300000
,
data
);
webAsyncTask
.
onTimeout
(
timeOutCallBack
());
log
.
info
(
"主线程结束"
);
return
webAsyncTask
;
}
@ApiOperation
(
value
=
"提交代码"
,
notes
=
"提交代码"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"slCode"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"stuCode"
,
value
=
"学生学号"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
value
=
"/pushCode"
)
public
Result
pushCode
(
String
port
,
String
slCode
,
String
stuCode
)
{
/*try {
action.pushCode(
global.getGIT_LAB_PROJECT_PREFIX() + slCode,
port,
global.getGIT_LAB_STU_PREFIX() + stuCode
);*/
return
Result
.
builder
(
new
PersistModel
(
1
),
ResultServiceEnums
.
SUCCESS
.
getMessage
(),
MessageConstant
.
MESSAGE_ALERT_ERROR
,
null
);
/*} catch (Exception e) {
throw new ServiceException(ResultServiceEnums.PUSH_ERROR);
}*/
}
@ApiOperation
(
value
=
"检出分支"
,
notes
=
"检出分支"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"slCode"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"stuCode"
,
value
=
"学生学号"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
value
=
"/checkoutCode"
)
public
Result
checkoutCode
(
String
port
,
String
slCode
,
String
stuCode
)
throws
IOException
,
InterruptedException
{
/*action.checkoutBranch(
global.getGIT_LAB_PROJECT_PREFIX() + slCode,
port,
global.getGIT_LAB_STU_PREFIX() + stuCode);*/
return
Result
.
builder
(
new
PersistModel
(
1
),
ResultServiceEnums
.
SUCCESS
.
getMessage
(),
MessageConstant
.
MESSAGE_ALERT_ERROR
,
null
);
}
@PostMapping
(
value
=
"/testCountDown"
)
public
String
testCountDown
()
throws
Exception
{
return
getPort
();
}
@ApiOperation
(
value
=
"刷新che启动时间"
,
notes
=
"根据端口刷新che启动时间"
)
@ApiImplicitParam
(
name
=
"port"
,
value
=
"che启动的端口"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/refreshChe"
)
public
Result
refreshChe
(
String
port
)
{
/*CountDown countDown = CountDown.portMap.get(port);
if (countDown.getMidTime() > 300)
throw new ServiceException(ResultServiceEnums.TEST_NOT_OVER);
countDown.setMidTime(Integer.parseInt(global.getCHE_START_TIME()));
return Result.builder(new PersistModel(1),ResultServiceEnums.SUCCESS.getMessage(),countDown.getEndTime().getTime());*/
return
Result
.
builder
(
new
PersistModel
(
1
),
ResultServiceEnums
.
SUCCESS
.
getMessage
(),
MessageConstant
.
MESSAGE_ALERT_ERROR
,
new
Date
().
getTime
());
}
private
String
getPort
()
throws
Exception
{
Random
random
=
new
Random
();
Integer
port
=
8000
+
random
.
nextInt
(
1000
);
/*while (CountDown.portMap.containsKey(port))
port = 8000 + random.nextInt(1000);*/
return
port
.
toString
();
}
@ApiOperation
(
value
=
"更改章节状态"
,
notes
=
"根据章节ID更改章节状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
),
...
...
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
7252a0a3
...
...
@@ -271,7 +271,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
List
<
BChapter
>
queryBchapterStudentById
(
String
chapterId
);
@Select
(
"<script>SELECT brc.
*
from b_r_student_chapter brc\n"
+
@Select
(
"<script>SELECT brc.
student_id as studentId
from b_r_student_chapter brc\n"
+
"LEFT JOIN b_student bs ON brc.student_id = bs.business_id\n"
+
"where bs.`code` = #{studentCode}\n"
+
"AND brc.chapter_id = #{chapterId}</script>"
)
...
...
src/main/java/org/rcisoft/business/bchapter/dto/ScoreInfoDTO.java
View file @
7252a0a3
...
...
@@ -11,6 +11,7 @@ public class ScoreInfoDTO extends IdEntity<ScoreInfoDTO> {
Integer
score
;
String
chapterId
;
String
studentId
;
String
studentCode
;
String
isComplete
;
String
slId
;
String
filePath
;
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
7252a0a3
...
...
@@ -206,8 +206,19 @@ public class BChapterServiceImpl implements BChapterService {
BChapter
bChapter
=
bChapterRepository
.
selectOne
(
new
BChapter
(
scoreInfoDTO
.
getChapterId
()));
if
(
bChapter
.
getAutomatic
().
equals
(
"1"
)){
//智评
String
codeType
=
global
.
getCOURSE_CODE_LOCATION
();
if
(
bChapter
.
getExperimentType
().
equals
(
"2"
)||
bChapter
.
getExperimentType
().
equals
(
"4"
)){
codeType
=
global
.
getCOURSE_PROJECT_LOCATION
();
}
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
global
.
getSL_LOCATION
()
+
File
.
separator
+
scoreInfoDTO
.
getSlId
()
+
File
.
separator
+
scoreInfoDTO
.
getChapterId
()
+
File
.
separator
+
codeType
+
File
.
separator
+
scoreInfoDTO
.
getStudentId
()
+
File
.
separator
;
//获取智评分数
int
score
=
IntellEvaluation
.
IntellEvaluation
(
scoreInfoDTO
.
getFilePath
(),
bChapter
.
getExperimentType
());
int
score
=
IntellEvaluation
.
IntellEvaluation
(
filePath
,
scoreInfoDTO
.
getStudentCode
(),
bChapter
.
getExperimentType
());
scoreInfoDTO
.
setScore
(
score
);
}
...
...
src/main/java/org/rcisoft/business/bcode/model/IntellEvaluation.java
View file @
7252a0a3
...
...
@@ -25,27 +25,42 @@ import java.io.File;
*/
public
class
IntellEvaluation
{
public
static
int
IntellEvaluation
(
String
filePath
,
String
experimentType
)
throws
Exception
{
public
static
int
IntellEvaluation
(
String
filePath
,
String
studentCode
,
String
experimentType
)
throws
Exception
{
int
score
=
0
;
String
content
=
""
;
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
()){
throw
new
ServiceException
(
ResultServiceEnums
.
PASSWORD_ERROR
);
}
if
(
experimentType
.
equals
(
"1"
)){
//java单文件
File
file
=
new
File
(
filePath
+
studentCode
+
".java"
);
if
(!
file
.
exists
()){
throw
new
ServiceException
(
ResultServiceEnums
.
PASSWORD_ERROR
);
}
content
=
FileUtils
.
readFileToString
(
file
);
score
=
getJavaSingleScore
(
content
);
}
else
if
(
experimentType
.
equals
(
"2"
)){
//java工程
File
file
=
new
File
(
filePath
+
studentCode
);
score
=
getJavaProjectScore
(
file
);
}
else
if
(
experimentType
.
equals
(
"3"
)){
//html单文件
File
file
=
new
File
(
filePath
+
studentCode
+
".html"
);
if
(!
file
.
exists
()){
throw
new
ServiceException
(
ResultServiceEnums
.
PASSWORD_ERROR
);
}
content
=
FileUtils
.
readFileToString
(
file
);
score
=
getHtmlSingleScore
(
content
);
}
else
if
(
experimentType
.
equals
(
"4"
)){
//html工程
File
file
=
new
File
(
filePath
+
studentCode
);
score
=
getHtmlProjectScore
(
file
);
}
return
score
;
}
...
...
@@ -71,6 +86,9 @@ public class IntellEvaluation {
//java工程评分
private
static
int
getJavaProjectScore
(
File
file
)
throws
Exception
{
if
(!
file
.
exists
()){
throw
new
ServiceException
(
ResultServiceEnums
.
PASSWORD_ERROR
);
}
File
[]
dirFiles
=
file
.
listFiles
();
int
score
=
0
;
int
javaFileNum
=
0
;
//java文件个数
...
...
@@ -118,6 +136,9 @@ public class IntellEvaluation {
//html工程评分
private
static
int
getHtmlProjectScore
(
File
file
)
throws
Exception
{
if
(!
file
.
exists
()){
throw
new
ServiceException
(
ResultServiceEnums
.
PASSWORD_ERROR
);
}
File
[]
dirFiles
=
file
.
listFiles
();
int
score
=
0
;
int
htmlFileNum
=
0
;
//java文件个数
...
...
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