Commit af580f49 by yangyang

试题调整提交

parent 50991365
......@@ -15,7 +15,7 @@ import java.util.List;
@Mapper
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);
@Select("select * from judge_question")
......
......@@ -15,8 +15,8 @@ public interface MultiQuestionMapper {
* 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")
List<MultiQuestion> findByIdAndType(Integer PaperId);
@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(@Param("paperId") Integer paperId,@Param("oneOrmore") Integer oneOrmore);
@Select("select * from multi_question")
IPage<MultiQuestion> findAll(Page page);
......
......@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
@Service
......@@ -34,7 +35,8 @@ public class MultiQuestionServiceImpl implements MultiQuestionService {
public String imagesUrl;
@Override
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<PaperPhoto> listPhoto = answerMapper.answersPhoto(String.valueOf(p.getQuestionId()),"1",String.valueOf(PaperId));
p.setImg(listPhoto.stream()
......@@ -107,4 +109,5 @@ public class MultiQuestionServiceImpl implements MultiQuestionService {
public List<Integer> findBySubject(String subject, Integer pageNo) {
return multiQuestionMapper.findBySubject(subject,pageNo);
}
}
......@@ -64,10 +64,10 @@ public class ScoreServiceImpl implements ScoreService {
studentScoreTj.setRight(bfs);
studentScoreTj.setDtcount(dtcount);
if(null != studentScoreTj){
dtcount = studentScoreTj.getCount() * 1;
dtcount = studentScoreTj.getCount() * 5;
studentScoreTj.setDtcount(dtcount);
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);
}
}
......@@ -83,9 +83,9 @@ public class ScoreServiceImpl implements ScoreService {
findTjDw.stream().forEach(p->{
int dtcount = 0;
String right = "0%";
dtcount = p.getCount() * 1;
dtcount = p.getCount() * 5;
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.setRight(right);
......@@ -101,9 +101,9 @@ public class ScoreServiceImpl implements ScoreService {
listPage.getRecords().stream().forEach(p->{
int dtcount = 0;
String right = "0%";
dtcount = p.getCount() * 1;
dtcount = p.getCount() * 5;
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.setRight(right);
......@@ -122,9 +122,9 @@ public class ScoreServiceImpl implements ScoreService {
CompletableFuture.supplyAsync(() -> {
int dtcount = 0;
String right = "0%";
dtcount = p.getCount() * 1;
dtcount = p.getCount() * 5;
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.setRight(right);
......@@ -141,10 +141,10 @@ public class ScoreServiceImpl implements ScoreService {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
// 总成绩/答题量 用户分数总和计算
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%";
if(dtcount!=0){
right = percentInstance.format((double) (sumScore)/(dtcount));
right = percentInstance.format((double) (sumScore)/(dtcount*20));
}
StudentScoreTj studentScoreTjAll = new StudentScoreTj();
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