|
@@ -0,0 +1,319 @@
|
|
|
|
+//package cn.com.qmth.examcloud.core.questions.service.temp;
|
|
|
|
+//
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.dao.PaperDetailUnitRepo;
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.dao.QuesRepo;
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestPaper;
|
|
|
|
+//import cn.com.qmth.examcloud.core.questions.service.temp.vo.TestQuestion;
|
|
|
|
+//import org.slf4j.Logger;
|
|
|
|
+//import org.slf4j.LoggerFactory;
|
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+//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.stereotype.Component;
|
|
|
|
+//
|
|
|
|
+//import java.util.ArrayList;
|
|
|
|
+//import java.util.HashMap;
|
|
|
|
+//import java.util.List;
|
|
|
|
+//import java.util.Map;
|
|
|
|
+//import java.util.regex.Pattern;
|
|
|
|
+//
|
|
|
|
+///**
|
|
|
|
+// * @author weiwenhai
|
|
|
|
+// * @date 2018.7.19
|
|
|
|
+// * @describle 测试地大题库导入
|
|
|
|
+// */
|
|
|
|
+//@Component
|
|
|
|
+//public class DdCollegeUtilServiceTest {
|
|
|
|
+// private static final Logger log = LoggerFactory.getLogger(DdCollegeUtilServiceTest.class);
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private DdCollegeUtilService ddCollegeUtilService;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private MongoTemplate mongoTemplate;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private PaperDetailUnitRepo paperDetailUnitRepo;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private DdExcelService ddExcelService;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private QuesRepo quesRepo;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private UpdatePaperStruct updatePaperStruct;
|
|
|
|
+//
|
|
|
|
+// public void testPapers() throws Exception {
|
|
|
|
+// 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);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "D08020009", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F08020011", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F15020013", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "D10020013", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F00010018", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F06020035", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F27020019", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F24020021", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "D00010012", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "D09020001", 2);
|
|
|
|
+// ddCollegeUtilService.importPaper("1627", "F09020010", 2);
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
+// log.error(e.getMessage(), e);
|
|
|
|
+// }
|
|
|
|
+// List<TestQuestion> list = ddCollegeUtilService.querySubQuestions("24AE438A37B67D7F0430D434A9D0C929");
|
|
|
|
+// System.out.println(list);
|
|
|
|
+// int count = ddCollegeUtilService.testCount();
|
|
|
|
+// System.out.println(count);
|
|
|
|
+// //int count2 = ddCollegeUtilService.testCount();
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// 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.saveAll(pduList);
|
|
|
|
+// System.out.println("更新完..." + (i + 1) * 1000 + "记录");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void excelTest() {
|
|
|
|
+// try {
|
|
|
|
+// //ddExcelService.exporExcel("1627");
|
|
|
|
+// ddExcelService.exportPaperExcel("1387");
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
+// log.error(e.getMessage(), e);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void saveQuestionTest() {
|
|
|
|
+// Map<String, String> map = new HashMap<>();
|
|
|
|
+// map.put("a", "a");
|
|
|
|
+// Question question = new Question();
|
|
|
|
+// question.setOrgId("wwh");
|
|
|
|
+// question.setQuesBody("wwh");
|
|
|
|
+// question.setQuesAnswer("wwh");
|
|
|
|
+// question.setIsolated(true);
|
|
|
|
+// question.setProperties(map);
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map2 = new HashMap<>();
|
|
|
|
+// map2.put("a", "a");
|
|
|
|
+// map2.put("b", "b");
|
|
|
|
+// Question question2 = new Question();
|
|
|
|
+// question2.setOrgId("wwh");
|
|
|
|
+// question2.setQuesBody("wwh");
|
|
|
|
+// question2.setQuesAnswer("wwh");
|
|
|
|
+// question2.setIsolated(true);
|
|
|
|
+// question2.setProperties(map2);
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map3 = new HashMap<>();
|
|
|
|
+// map3.put("a", "a");
|
|
|
|
+// map3.put("b", "b");
|
|
|
|
+// map3.put("c", "c");
|
|
|
|
+// Question question3 = new Question();
|
|
|
|
+// question3.setOrgId("wwh");
|
|
|
|
+// question3.setQuesBody("wwh");
|
|
|
|
+// question3.setQuesAnswer("wwh");
|
|
|
|
+// question3.setIsolated(true);
|
|
|
|
+// question3.setProperties(map3);
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map4 = new HashMap<String, String>();
|
|
|
|
+// map4.put("d", "d");
|
|
|
|
+// Question question4 = new Question();
|
|
|
|
+// question4.setOrgId("wwh");
|
|
|
|
+// question4.setQuesBody("wwh");
|
|
|
|
+// question4.setQuesAnswer("wwh");
|
|
|
|
+// question4.setIsolated(true);
|
|
|
|
+// question4.setProperties(map4);
|
|
|
|
+//
|
|
|
|
+// List<Question> list = new ArrayList<Question>();
|
|
|
|
+// list.add(question);
|
|
|
|
+// list.add(question2);
|
|
|
|
+// list.add(question3);
|
|
|
|
+// list.add(question4);
|
|
|
|
+//
|
|
|
|
+// quesRepo.saveAll(list);
|
|
|
|
+// System.out.println("插入完毕...");
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void queryQuestionTest() {
|
|
|
|
+// Map<String, String> map = new HashMap<String, String>();
|
|
|
|
+// map.put("a", "x,j");
|
|
|
|
+// //map.put("b", "b");
|
|
|
|
+// Query query = new Query();
|
|
|
|
+// for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
|
+// String la = entry.getValue();
|
|
|
|
+// la = la.replaceAll(",", "*");
|
|
|
|
+// Pattern pattern = Pattern.compile(la, Pattern.CASE_INSENSITIVE);
|
|
|
|
+// String key = "properties." + entry.getKey();
|
|
|
|
+// query.addCriteria(Criteria.where(key).regex(pattern));
|
|
|
|
+// }
|
|
|
|
+// long count = this.mongoTemplate.count(query, Question.class);
|
|
|
|
+// List<Question> questionList = this.mongoTemplate.find(query, Question.class);
|
|
|
|
+// System.out.println("第一次查询:");
|
|
|
|
+// System.out.println("count:" + count);
|
|
|
|
+// for (Question question : questionList) {
|
|
|
|
+// System.out.println("question:" + question.getProperties());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// /*Map<String, String> map2 = new HashMap<String, String>();
|
|
|
|
+// map2.put("d", "d");
|
|
|
|
+// Query query2 = new Query();
|
|
|
|
+// for(Map.Entry<String, String> entry:map2.entrySet()){
|
|
|
|
+// String key = "properties." + entry.getKey();
|
|
|
|
+// query2.addCriteria(Criteria.where(key).is(entry.getValue()));
|
|
|
|
+// }
|
|
|
|
+// long count2 = this.mongoTemplate.count(query2, Question.class);
|
|
|
|
+// List<Question> questionList2 = this.mongoTemplate.find(query2, Question.class);
|
|
|
|
+// System.out.println("第二次查询:");
|
|
|
|
+// System.out.println("count:"+ count2);
|
|
|
|
+// for(Question question:questionList2){
|
|
|
|
+// System.out.println("question:"+question.getProperties());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map3 = new HashMap<String, String>();
|
|
|
|
+// map3.put("a", "a");
|
|
|
|
+// map3.put("b", "b");
|
|
|
|
+// Query query3 = new Query();
|
|
|
|
+// for(Map.Entry<String, String> entry:map3.entrySet()){
|
|
|
|
+// String key = "properties." + entry.getKey();
|
|
|
|
+// query3.addCriteria(Criteria.where(key).is(entry.getValue()));
|
|
|
|
+// }
|
|
|
|
+// long count3 = this.mongoTemplate.count(query3, Question.class);
|
|
|
|
+// List<Question> questionList3 = this.mongoTemplate.find(query3, Question.class);
|
|
|
|
+// System.out.println("第三次查询:");
|
|
|
|
+// System.out.println("count:"+ count3);
|
|
|
|
+// for(Question question:questionList3){
|
|
|
|
+// System.out.println("question:"+question.getProperties());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map4 = new HashMap<String, String>();
|
|
|
|
+// map4.put("a", "a");
|
|
|
|
+// map4.put("b", "b");
|
|
|
|
+// map4.put("c", "c");
|
|
|
|
+// Query query4 = new Query();
|
|
|
|
+// for(Map.Entry<String, String> entry:map4.entrySet()){
|
|
|
|
+// String key = "properties." + entry.getKey();
|
|
|
|
+// query4.addCriteria(Criteria.where(key).is(entry.getValue()));
|
|
|
|
+// }
|
|
|
|
+// long count4 = this.mongoTemplate.count(query4, Question.class);
|
|
|
|
+// List<Question> questionList4 = this.mongoTemplate.find(query4, Question.class);
|
|
|
|
+// System.out.println("第四次查询:");
|
|
|
|
+// System.out.println("count:"+ count4);
|
|
|
|
+// for(Question question:questionList4){
|
|
|
|
+// System.out.println("question:"+question.getProperties());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// Map<String, String> map5 = new HashMap<String, String>();
|
|
|
|
+// map5.put("a", "a");
|
|
|
|
+// map5.put("d", "d");
|
|
|
|
+// Query query5 = new Query();
|
|
|
|
+// for(Map.Entry<String, String> entry:map5.entrySet()){
|
|
|
|
+// String key = "properties." + entry.getKey();
|
|
|
|
+// query5.addCriteria(Criteria.where(key).is(entry.getValue()));
|
|
|
|
+// }
|
|
|
|
+// long count5 = this.mongoTemplate.count(query5, Question.class);
|
|
|
|
+// List<Question> questionList5 = this.mongoTemplate.find(query5, Question.class);
|
|
|
|
+// System.out.println("第五次查询:");
|
|
|
|
+// System.out.println("count:"+ count5);
|
|
|
|
+// for(Question question:questionList5){
|
|
|
|
+// System.out.println("question:"+question.getProperties());
|
|
|
|
+// }*/
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void updateP() {
|
|
|
|
+// updatePaperStruct.updatePaperStruct("303"); //测试大学
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void updatePaperStruct() {
|
|
|
|
+// //updatePaperStruct.updatePaperStruct("0"); //启明泰和
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1"); //石油大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("115"); //测试
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("135"); //山东大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("136"); //电子科技大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("137"); //陕西师范大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("302"); //天津大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("371"); //西安交通大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("372"); //武汉理工大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("718"); //西南交通大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1065"); //华中科技大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1226"); //河南优特
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1251"); //湖北职业技术学院
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1252"); //武汉软件工程职业学院
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1256"); //华南师范大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1347"); //华中师范大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1348"); //福建师范大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1350"); //优特教育
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1353"); //奥鹏教育
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1384"); //西南财经大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1385"); //北京师范大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1387"); //中国地质大学(北京)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1388"); //北京开放大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1394"); //西安电子科技大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1407"); //重庆大学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1408"); //中国医科大学(奥鹏)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1562"); //北京交通大学(奥鹏)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1627"); //中国地质大学(武汉)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1680"); //南开大学(奥鹏)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1681"); //东北师范大学(奥鹏)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1734"); //北京航空航天大学(奥鹏)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1745"); //中国石油大学(华东)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1759"); //教务平台(全日制)
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1769"); //地质大学(武汉)入学
|
|
|
|
+//
|
|
|
|
+// updatePaperStruct.updatePaperStruct("1775"); //演示-ACC
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//}
|