Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exam_master
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
ai-tech
exam_master
Commits
12386a01
Commit
12386a01
authored
Jul 05, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
69aba966
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
H5Controller.java
src/main/java/cn/aibreeze/exam/api/H5Controller.java
+11
-5
No files found.
src/main/java/cn/aibreeze/exam/api/H5Controller.java
View file @
12386a01
...
@@ -22,6 +22,7 @@ import java.io.PrintWriter;
...
@@ -22,6 +22,7 @@ import java.io.PrintWriter;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Controller
@Controller
...
@@ -82,8 +83,8 @@ public class H5Controller {
...
@@ -82,8 +83,8 @@ public class H5Controller {
List
<
ElehSessionQaRecordDo
>
qaRecordDos
=
qaRecordMapper
.
selectList
(
queryWrapper
);
List
<
ElehSessionQaRecordDo
>
qaRecordDos
=
qaRecordMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
qaRecordDos
))
{
if
(!
CollectionUtils
.
isEmpty
(
qaRecordDos
))
{
Double
totalScore
=
qaRecordDos
.
stream
().
mapToDouble
(
ElehSessionQaRecordDo:
:
getScore
).
sum
();
Double
totalScore
=
qaRecordDos
.
stream
().
filter
(
v
->
Objects
.
nonNull
(
v
.
getScore
())).
mapToDouble
(
ElehSessionQaRecordDo:
:
getScore
).
sum
();
int
examNum
=
qaRecordDos
.
size
();
long
examNum
=
qaRecordDos
.
stream
().
filter
(
v
->
Objects
.
nonNull
(
v
.
getScore
())).
count
();
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
String
avgScore
=
df
.
format
(
totalScore
/
examNum
);
String
avgScore
=
df
.
format
(
totalScore
/
examNum
);
...
@@ -107,10 +108,10 @@ public class H5Controller {
...
@@ -107,10 +108,10 @@ public class H5Controller {
out
.
println
(
"<p><strong>考试题目:</strong>"
+
knowledgeDo
.
getQuestion
()+
"</p>"
);
out
.
println
(
"<p><strong>考试题目:</strong>"
+
knowledgeDo
.
getQuestion
()+
"</p>"
);
out
.
println
(
"<p><strong>你的得分:</strong>"
+
v
.
getScore
(
)+
"</p>"
);
out
.
println
(
"<p><strong>你的得分:</strong>"
+
getOrEmpty
(
v
.
getScore
()
)+
"</p>"
);
out
.
println
(
"<p><strong>参考答案:</strong>"
+
knowledgeDo
.
getAnswer
()+
"</p>"
);
out
.
println
(
"<p><strong>参考答案:</strong>"
+
knowledgeDo
.
getAnswer
()+
"</p>"
);
out
.
println
(
"<p><strong>你的答案:</strong>"
+
v
.
getAnswer
(
)+
"</p>"
);
out
.
println
(
"<p><strong>你的答案:</strong>"
+
getOrEmpty
(
v
.
getAnswer
()
)+
"</p>"
);
out
.
println
(
"<p><strong>得分点评:</strong>"
+
v
.
getScoreCriteria
(
)+
"</p>"
);
out
.
println
(
"<p><strong>得分点评:</strong>"
+
getOrEmpty
(
v
.
getScoreCriteria
()
)+
"</p>"
);
out
.
println
(
"<br/>"
);
out
.
println
(
"<br/>"
);
});
});
...
@@ -125,4 +126,9 @@ public class H5Controller {
...
@@ -125,4 +126,9 @@ public class H5Controller {
out
.
println
(
"</html>"
);
out
.
println
(
"</html>"
);
}
}
private
String
getOrEmpty
(
Object
str
)
{
str
=
Objects
.
isNull
(
str
)
?
""
:
str
;
return
str
.
toString
();
}
}
}
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