|
@@ -6,9 +6,16 @@ import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.core.questions.service.temp.DdCollegeUtilService;
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.PaperDetailUnitRepo;
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestOption;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestPaper;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestQuestion;
|
|
@@ -23,16 +30,16 @@ import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestQuestion;
|
|
|
@SpringBootTest
|
|
|
public class DdCollegeUtilTest {
|
|
|
|
|
|
- @Autowired
|
|
|
+ /*@Autowired
|
|
|
private DdCollegeUtilService ddCollegeUtilService;
|
|
|
|
|
|
@Test
|
|
|
public void testPapers() {
|
|
|
- /*String codeName = "基础工程学/D06020008";
|
|
|
+ String codeName = "基础工程学/D06020008";
|
|
|
List<TestPaper> testPapers = ddCollegeUtilService.queryByCourse(codeName);
|
|
|
for(TestPaper testPaper:testPapers){
|
|
|
System.out.println(testPaper.toString());
|
|
|
- }*/
|
|
|
+ }
|
|
|
try {
|
|
|
//ddCollegeUtilService.importPaper("1627", "D09020014",2);
|
|
|
//ddCollegeUtilService.importPaper("1627", "D01020019",2);
|
|
@@ -54,30 +61,36 @@ public class DdCollegeUtilTest {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- /*List<TestQuestion> list = ddCollegeUtilService.querySubQuestions("24AE438A37B67D7F0430D434A9D0C929");
|
|
|
- System.out.println(list);*/
|
|
|
- /*int count = ddCollegeUtilService.testCount();
|
|
|
- System.out.println(count);*/
|
|
|
+ List<TestQuestion> list = ddCollegeUtilService.querySubQuestions("24AE438A37B67D7F0430D434A9D0C929");
|
|
|
+ System.out.println(list);
|
|
|
+ int count = ddCollegeUtilService.testCount();
|
|
|
+ System.out.println(count);
|
|
|
//int count = ddCollegeUtilService.testCount();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }*/
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MongoTemplate mongoTemplate;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PaperDetailUnitRepo paperDetailUnitRepo;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void updatePaperType(){
|
|
|
+ System.out.println("开始更新paperType...");
|
|
|
+ Query query = new Query();
|
|
|
+ long count = this.mongoTemplate.count(query, PaperDetailUnit.class);
|
|
|
+ int size = (int) (count/1000);
|
|
|
+ for(int i=0;i<=size;i++){
|
|
|
+ query.skip(i * 1000);
|
|
|
+ query.limit(1000);
|
|
|
+ List<PaperDetailUnit> pduList = this.mongoTemplate.find(query, PaperDetailUnit.class);
|
|
|
+ for(PaperDetailUnit pdu:pduList){
|
|
|
+ pdu.setPaperType(pdu.getPaper().getPaperType());
|
|
|
+ }
|
|
|
+ paperDetailUnitRepo.save(pduList);
|
|
|
+ System.out.println("更新完..."+ (i+1)*1000 + "记录");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|