|
@@ -1616,5 +1616,87 @@ public class PaperServiceImpl implements PaperService{
|
|
|
}
|
|
|
return pWordMl.toString();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getQuestionTypeNumbers(String paperId, Integer publicityType, Integer difficultyType) {
|
|
|
+ if(publicityType == null || difficultyType == null){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ Boolean publicity = null;
|
|
|
+ String difficulty = null;
|
|
|
+ if(publicityType == 1){
|
|
|
+ publicity = true;
|
|
|
+ }else {
|
|
|
+ publicity = false;
|
|
|
+ }
|
|
|
+ if(difficultyType == 1){
|
|
|
+ difficulty = "易";
|
|
|
+ }else if (difficultyType == 2) {
|
|
|
+ difficulty = "中";
|
|
|
+ }else {
|
|
|
+ difficulty = "难";
|
|
|
+ }
|
|
|
+ String needType = publicity + "-" + difficulty;
|
|
|
+ Paper paper = paperRepo.findOne(paperId);
|
|
|
+ List<PaperDetailUnit> units = paperDetailUnitRepo.findByPaperOrderByNumber(paper);
|
|
|
+ if(units != null && units.size()>0){
|
|
|
+ int total = 0;
|
|
|
+ for(PaperDetailUnit unit:units){
|
|
|
+ if(unit.getQuestion().getPublicity() == null){
|
|
|
+ unit.getQuestion().setPublicity(true);
|
|
|
+ }
|
|
|
+ if(unit.getQuestion().getDifficulty() == null){
|
|
|
+ unit.getQuestion().setDifficulty("中");
|
|
|
+ }
|
|
|
+ String factType = unit.getQuestion().getPublicity() + "-" + unit.getQuestion().getDifficulty();
|
|
|
+ if(needType.equals(factType)){
|
|
|
+ total += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public double getQuestionTypeScore(String paperId, Integer publicityType, Integer difficultyType) {
|
|
|
+ if(publicityType == null || difficultyType == null){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ Boolean publicity = null;
|
|
|
+ String difficulty = null;
|
|
|
+ if(publicityType == 1){
|
|
|
+ publicity = true;
|
|
|
+ }else {
|
|
|
+ publicity = false;
|
|
|
+ }
|
|
|
+ if(difficultyType == 1){
|
|
|
+ difficulty = "易";
|
|
|
+ }else if (difficultyType == 2) {
|
|
|
+ difficulty = "中";
|
|
|
+ }else {
|
|
|
+ difficulty = "难";
|
|
|
+ }
|
|
|
+ String needType = publicity + "-" + difficulty;
|
|
|
+ Paper paper = paperRepo.findOne(paperId);
|
|
|
+ List<PaperDetailUnit> units = paperDetailUnitRepo.findByPaperOrderByNumber(paper);
|
|
|
+ if(units != null && units.size()>0){
|
|
|
+ double total = 0;
|
|
|
+ for(PaperDetailUnit unit:units){
|
|
|
+ if(unit.getQuestion().getPublicity() == null){
|
|
|
+ unit.getQuestion().setPublicity(true);
|
|
|
+ }
|
|
|
+ if(unit.getQuestion().getDifficulty() == null){
|
|
|
+ unit.getQuestion().setDifficulty("中");
|
|
|
+ }
|
|
|
+ String factType = unit.getQuestion().getPublicity() + "-" + unit.getQuestion().getDifficulty();
|
|
|
+ if(needType.equals(factType)){
|
|
|
+ total += unit.getScore();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
|