Browse Source

paper-edit

tangss 8 years ago
parent
commit
2adced3045

+ 1 - 1
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/Application.java

@@ -109,7 +109,7 @@ public class Application {
 
 
         // To disabled web environment, change `true` to `false`
         // To disabled web environment, change `true` to `false`
         application.setWebEnvironment(true);
         application.setWebEnvironment(true);
-        application.addListeners(new ApplicationStartup());
+//        application.addListeners(new ApplicationStartup());
         application.run(args);
         application.run(args);
     }
     }
 }
 }

+ 1 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/dao/Exam2CaseDao.java

@@ -1,6 +1,7 @@
 package cn.iselab.mooctest.site.dao;
 package cn.iselab.mooctest.site.dao;
 
 
 import cn.iselab.mooctest.site.models.Exam2Case;
 import cn.iselab.mooctest.site.models.Exam2Case;
+import cn.iselab.mooctest.site.models.Exam2Paper;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.data.repository.CrudRepository;
 
 
 
 

+ 2 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/service/DetailStatisticsService.java

@@ -20,4 +20,6 @@ public interface DetailStatisticsService {
     List<Task> findTaskByCaseId(long caseId);
     List<Task> findTaskByCaseId(long caseId);
 
 
     Page<Paper> findPaperByCaseId(long caseId, Pageable pageable);
     Page<Paper> findPaperByCaseId(long caseId, Pageable pageable);
+
+    List<Task> findTaskByPaperId(long paperId);
 }
 }

+ 10 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/service/impl/DetailStatisticsServiceImpl.java

@@ -11,6 +11,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * Created by HenryLee on 2017/9/29.
  * Created by HenryLee on 2017/9/29.
@@ -21,6 +22,8 @@ public class DetailStatisticsServiceImpl implements DetailStatisticsService {
     @Autowired
     @Autowired
     CaseExtendsDao caseExtendsDao;
     CaseExtendsDao caseExtendsDao;
     @Autowired
     @Autowired
+    Exam2PaperDao exam2PaperDao;
+    @Autowired
     Exam2CaseDao exam2CaseDao;
     Exam2CaseDao exam2CaseDao;
     @Autowired
     @Autowired
     Task2CaseDao task2CaseDao;
     Task2CaseDao task2CaseDao;
@@ -63,4 +66,11 @@ public class DetailStatisticsServiceImpl implements DetailStatisticsService {
     public Page<Paper> findPaperByCaseId(long caseId, Pageable pageable) {
     public Page<Paper> findPaperByCaseId(long caseId, Pageable pageable) {
         return paperDao.findByCaseId(caseId,pageable);
         return paperDao.findByCaseId(caseId,pageable);
     }
     }
+
+    @Override
+    public List<Task> findTaskByPaperId(long paperId) {
+        List<Exam2Paper> exam2Papers = exam2PaperDao.findByPaperId(paperId);
+        List<Long> examIds = exam2Papers.stream().map(Exam2Paper::getExamId).collect(Collectors.toList());
+        return taskService.getTasks(examIds);
+    }
 }
 }

+ 1 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/data/PaperVO.java

@@ -17,6 +17,7 @@ public class PaperVO {
     private String ownerName;
     private String ownerName;
     private String description;
     private String description;
     private List<CaseBlockVO> caseBlocks;
     private List<CaseBlockVO> caseBlocks;
+    private List<ExamVO> exams;
 
 
     private Byte difficult;
     private Byte difficult;
 
 

+ 0 - 11
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/data/wrapper/ExamVOWrapper.java

@@ -20,17 +20,6 @@ import java.util.List;
 @Service
 @Service
 public class ExamVOWrapper extends BaseWrapper<ExamVO, Task> {
 public class ExamVOWrapper extends BaseWrapper<ExamVO, Task> {
     @Autowired
     @Autowired
-    private SubsiteDao subsiteDao;
-
-    @Autowired
-    private SubsiteVOWrapper subsiteVOWrapper;
-
-    @Autowired
-    private ManagerVOWrapper managerVOWrapper;
-
-    @Autowired
-    ManagerService managerService;
-    @Autowired
     UserService userService;
     UserService userService;
 
 
     @Autowired
     @Autowired

+ 4 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/data/wrapper/PaperVOWrapper.java

@@ -5,6 +5,7 @@ import cn.iselab.mooctest.site.models.Paper;
 import cn.iselab.mooctest.site.models.User;
 import cn.iselab.mooctest.site.models.User;
 import cn.iselab.mooctest.site.service.*;
 import cn.iselab.mooctest.site.service.*;
 import cn.iselab.mooctest.site.web.data.PaperVO;
 import cn.iselab.mooctest.site.web.data.PaperVO;
+import cn.iselab.mooctest.site.web.logic.DetailStatisticsLogic;
 import cn.iselab.mooctest.site.web.util.Converter;
 import cn.iselab.mooctest.site.web.util.Converter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
@@ -29,6 +30,8 @@ public class PaperVOWrapper extends BaseWrapper<PaperVO, Paper> {
 
 
     @Autowired
     @Autowired
     private PaperService paperService;
     private PaperService paperService;
+    @Autowired
+    private DetailStatisticsLogic detailStatisticsLogic;
 
 
     @Autowired
     @Autowired
     private WeightService weightService;
     private WeightService weightService;
@@ -49,6 +52,7 @@ public class PaperVOWrapper extends BaseWrapper<PaperVO, Paper> {
         vo.setCaseBlocks(caseBlockVOWrapper.wrap(caseBlocks));
         vo.setCaseBlocks(caseBlockVOWrapper.wrap(caseBlocks));
         vo.setOwnerName(user.getName());
         vo.setOwnerName(user.getName());
         vo.setUsedByExam(paperService.isUsedByExam(paper.getId()));
         vo.setUsedByExam(paperService.isUsedByExam(paper.getId()));
+        vo.setExams(detailStatisticsLogic.findExamByPaperId(paper.getId()));
         return vo;
         return vo;
     }
     }
 
 

+ 2 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/DetailStatisticsLogic.java

@@ -26,6 +26,8 @@ public interface DetailStatisticsLogic {
 
 
     List<ExamVO> findExamByTargetId(long targetId);
     List<ExamVO> findExamByTargetId(long targetId);
 
 
+    List<ExamVO> findExamByPaperId(long paperId);
+
     HashMap countUserByCase(long caseId);
     HashMap countUserByCase(long caseId);
 
 
     int countUserByTarget(long targetId);
     int countUserByTarget(long targetId);

+ 6 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/DetailStatisticsLogicImpl.java

@@ -102,6 +102,12 @@ public class DetailStatisticsLogicImpl implements DetailStatisticsLogic {
     }
     }
 
 
     @Override
     @Override
+    public List<ExamVO> findExamByPaperId(long paperId) {
+        List<Task> exams = detailStatisticsService.findTaskByPaperId(paperId);
+        return examVOWrapper.wrap(exams);
+    }
+
+    @Override
     public HashMap countUserByCase(long caseId) {
     public HashMap countUserByCase(long caseId) {
         HashMap<Long,Double> scores = new HashMap();
         HashMap<Long,Double> scores = new HashMap();
         List<Task> tasks = detailStatisticsService.findTaskByCaseId(caseId);
         List<Task> tasks = detailStatisticsService.findTaskByCaseId(caseId);