Commit af580f49 by yangyang

试题调整提交

parent 50991365
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
@Mapper @Mapper
public interface JudgeQuestionMapper { public interface JudgeQuestionMapper {
@Select("select * from judge_question where questionId in (select questionId from paper_manage where questionType = 3 and paperId = #{paperId}) order by rand() limit 1") @Select("select * from judge_question where questionId>10253 and questionId in (select questionId from paper_manage where questionType = 3 and paperId = #{paperId}) order by rand() limit 5")
List<JudgeQuestion> findByIdAndType(Integer paperId); List<JudgeQuestion> findByIdAndType(Integer paperId);
@Select("select * from judge_question") @Select("select * from judge_question")
......
...@@ -15,8 +15,8 @@ public interface MultiQuestionMapper { ...@@ -15,8 +15,8 @@ public interface MultiQuestionMapper {
* select questionId from papermanage where questionType = 1 and paperId = 1001 * select questionId from papermanage where questionType = 1 and paperId = 1001
* ) * )
*/ */
@Select("select * from multi_question where questionId in (select questionId from paper_manage where questionType = 1 and paperId = #{paperId}) order by rand() limit 1") @Select("select * from multi_question where questionId>10578 and oneOrmore = #{oneOrmore} and questionId in (select questionId from paper_manage where questionType = 1 and paperId = #{paperId}) order by rand() limit 5")
List<MultiQuestion> findByIdAndType(Integer PaperId); List<MultiQuestion> findByIdAndType(@Param("paperId") Integer paperId,@Param("oneOrmore") Integer oneOrmore);
@Select("select * from multi_question") @Select("select * from multi_question")
IPage<MultiQuestion> findAll(Page page); IPage<MultiQuestion> findAll(Page page);
......
...@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -34,7 +35,8 @@ public class MultiQuestionServiceImpl implements MultiQuestionService { ...@@ -34,7 +35,8 @@ public class MultiQuestionServiceImpl implements MultiQuestionService {
public String imagesUrl; public String imagesUrl;
@Override @Override
public List<MultiQuestion> findByIdAndType(Integer PaperId) { public List<MultiQuestion> findByIdAndType(Integer PaperId) {
List<MultiQuestion> list = multiQuestionMapper.findByIdAndType(PaperId); int oneOrMore = new Random().nextInt(2)+1;
List<MultiQuestion> list = multiQuestionMapper.findByIdAndType(PaperId,oneOrMore);
list.stream().forEach(p->{ list.stream().forEach(p->{
List<PaperPhoto> listPhoto = answerMapper.answersPhoto(String.valueOf(p.getQuestionId()),"1",String.valueOf(PaperId)); List<PaperPhoto> listPhoto = answerMapper.answersPhoto(String.valueOf(p.getQuestionId()),"1",String.valueOf(PaperId));
p.setImg(listPhoto.stream() p.setImg(listPhoto.stream()
...@@ -107,4 +109,5 @@ public class MultiQuestionServiceImpl implements MultiQuestionService { ...@@ -107,4 +109,5 @@ public class MultiQuestionServiceImpl implements MultiQuestionService {
public List<Integer> findBySubject(String subject, Integer pageNo) { public List<Integer> findBySubject(String subject, Integer pageNo) {
return multiQuestionMapper.findBySubject(subject,pageNo); return multiQuestionMapper.findBySubject(subject,pageNo);
} }
} }
...@@ -64,10 +64,10 @@ public class ScoreServiceImpl implements ScoreService { ...@@ -64,10 +64,10 @@ public class ScoreServiceImpl implements ScoreService {
studentScoreTj.setRight(bfs); studentScoreTj.setRight(bfs);
studentScoreTj.setDtcount(dtcount); studentScoreTj.setDtcount(dtcount);
if(null != studentScoreTj){ if(null != studentScoreTj){
dtcount = studentScoreTj.getCount() * 1; dtcount = studentScoreTj.getCount() * 5;
studentScoreTj.setDtcount(dtcount); studentScoreTj.setDtcount(dtcount);
if(dtcount!=0&studentScoreTj.getCountsum()!=0){ if(dtcount!=0&studentScoreTj.getCountsum()!=0){
String bfsRight = percentInstance.format((double) (studentScoreTj.getCountsum())/(dtcount)); String bfsRight = percentInstance.format((double) (studentScoreTj.getCountsum())/(dtcount*20));
studentScoreTj.setRight(bfsRight); studentScoreTj.setRight(bfsRight);
} }
} }
...@@ -83,9 +83,9 @@ public class ScoreServiceImpl implements ScoreService { ...@@ -83,9 +83,9 @@ public class ScoreServiceImpl implements ScoreService {
findTjDw.stream().forEach(p->{ findTjDw.stream().forEach(p->{
int dtcount = 0; int dtcount = 0;
String right = "0%"; String right = "0%";
dtcount = p.getCount() * 1; dtcount = p.getCount() * 5;
if(p.getCountsum()!=0&&dtcount!=0){ if(p.getCountsum()!=0&&dtcount!=0){
right = percentInstance.format((double) (p.getCountsum())/(dtcount)); right = percentInstance.format((double) (p.getCountsum())/(dtcount*20));
} }
p.setDtcount(dtcount); p.setDtcount(dtcount);
p.setRight(right); p.setRight(right);
...@@ -101,9 +101,9 @@ public class ScoreServiceImpl implements ScoreService { ...@@ -101,9 +101,9 @@ public class ScoreServiceImpl implements ScoreService {
listPage.getRecords().stream().forEach(p->{ listPage.getRecords().stream().forEach(p->{
int dtcount = 0; int dtcount = 0;
String right = "0%"; String right = "0%";
dtcount = p.getCount() * 1; dtcount = p.getCount() * 5;
if(p.getCountsum()!=0&&dtcount!=0){ if(p.getCountsum()!=0&&dtcount!=0){
right = percentInstance.format((double) (p.getCountsum())/(dtcount)); right = percentInstance.format((double) (p.getCountsum())/(dtcount*20));
} }
p.setDtcount(dtcount); p.setDtcount(dtcount);
p.setRight(right); p.setRight(right);
...@@ -122,9 +122,9 @@ public class ScoreServiceImpl implements ScoreService { ...@@ -122,9 +122,9 @@ public class ScoreServiceImpl implements ScoreService {
CompletableFuture.supplyAsync(() -> { CompletableFuture.supplyAsync(() -> {
int dtcount = 0; int dtcount = 0;
String right = "0%"; String right = "0%";
dtcount = p.getCount() * 1; dtcount = p.getCount() * 5;
if(p.getCountsum()!=0&&dtcount!=0){ if(p.getCountsum()!=0&&dtcount!=0){
right = percentInstance.format((double) (p.getCountsum())/(dtcount)); right = percentInstance.format((double) (p.getCountsum())/(dtcount*20));
} }
p.setDtcount(dtcount); p.setDtcount(dtcount);
p.setRight(right); p.setRight(right);
...@@ -141,10 +141,10 @@ public class ScoreServiceImpl implements ScoreService { ...@@ -141,10 +141,10 @@ public class ScoreServiceImpl implements ScoreService {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
// 总成绩/答题量 用户分数总和计算 // 总成绩/答题量 用户分数总和计算
int sumScore = list.stream().mapToInt(e->Integer.parseInt(e.getCountsum().toString())).sum(); int sumScore = list.stream().mapToInt(e->Integer.parseInt(e.getCountsum().toString())).sum();
int dtcount = list.stream().mapToInt(e->Integer.parseInt(e.getCount().toString())).sum(); int dtcount = list.stream().mapToInt(e->Integer.parseInt(e.getDtcount().toString())).sum();
String right = "0%"; String right = "0%";
if(dtcount!=0){ if(dtcount!=0){
right = percentInstance.format((double) (sumScore)/(dtcount)); right = percentInstance.format((double) (sumScore)/(dtcount*20));
} }
StudentScoreTj studentScoreTjAll = new StudentScoreTj(); StudentScoreTj studentScoreTjAll = new StudentScoreTj();
studentScoreTjAll.setRight(right); studentScoreTjAll.setRight(right);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment