|
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -268,7 +269,7 @@ public class TBUserController {
|
|
teExamCourse.setId(Constants.idGen.next());
|
|
teExamCourse.setId(Constants.idGen.next());
|
|
teExamCourse.setExamId(teExam.getId());
|
|
teExamCourse.setExamId(teExam.getId());
|
|
teExamCourse.setExamActivityId(teExamActivity.getId());
|
|
teExamCourse.setExamActivityId(teExamActivity.getId());
|
|
- teExamCourse.setCourseCode("T0001");
|
|
|
|
|
|
+ teExamCourse.setCourseCode(RandomStringUtils.randomAlphanumeric(5));
|
|
teExamCourse.setCourseName("测试科目1");
|
|
teExamCourse.setCourseName("测试科目1");
|
|
teExamCourse.setObjectiveShuffle(1);
|
|
teExamCourse.setObjectiveShuffle(1);
|
|
teExamCourse.setOptionShuffle(1);
|
|
teExamCourse.setOptionShuffle(1);
|
|
@@ -305,17 +306,17 @@ public class TBUserController {
|
|
MTEExamCourseEntity mteExamCourseEntity = gson.fromJson(gson.toJson(teExamCourse), MTEExamCourseEntity.class);
|
|
MTEExamCourseEntity mteExamCourseEntity = gson.fromJson(gson.toJson(teExamCourse), MTEExamCourseEntity.class);
|
|
MTEExamStudentEntity mteExamStudentEntity = gson.fromJson(gson.toJson(teExamStudent), MTEExamStudentEntity.class);
|
|
MTEExamStudentEntity mteExamStudentEntity = gson.fromJson(gson.toJson(teExamStudent), MTEExamStudentEntity.class);
|
|
|
|
|
|
- List list = Arrays.asList(mteExamPaperEntity);
|
|
|
|
- mteExamCourseEntity.setMteExamPaperEntityList(list);
|
|
|
|
|
|
+// List list = Arrays.asList(mteExamPaperEntity);
|
|
|
|
+// mteExamCourseEntity.setMteExamPaperEntityList(list);
|
|
|
|
|
|
- list = Arrays.asList(mteExamActivityEntity);
|
|
|
|
- mteExamEntity.setMteExamActivityEntityList(list);
|
|
|
|
|
|
+// list = Arrays.asList(mteExamActivityEntity);
|
|
|
|
+// mteExamEntity.setMteExamActivityEntityList(list);
|
|
|
|
|
|
- list = Arrays.asList(mteExamCourseEntity);
|
|
|
|
- mteExamStudentEntity.setMteExamEntity(mteExamEntity);
|
|
|
|
- mteExamStudentEntity.setMteExamActivityEntity(mteExamActivityEntity);
|
|
|
|
- mteExamStudentEntity.setMteStudentEntity(mteStudentEntity);
|
|
|
|
- mteExamStudentEntity.setMteExamCourseEntityList(list);
|
|
|
|
|
|
+// list = Arrays.asList(mteExamCourseEntity);
|
|
|
|
+// mteExamStudentEntity.setMteExamEntity(mteExamEntity);
|
|
|
|
+// mteExamStudentEntity.setMteExamActivityEntity(mteExamActivityEntity);
|
|
|
|
+// mteExamStudentEntity.setMteStudentEntity(mteStudentEntity);
|
|
|
|
+// mteExamStudentEntity.setMteExamCourseEntityList(list);
|
|
|
|
|
|
mongoTemplate.save(mteStudentEntity);
|
|
mongoTemplate.save(mteStudentEntity);
|
|
mongoTemplate.save(mteExamEntity);
|
|
mongoTemplate.save(mteExamEntity);
|
|
@@ -324,17 +325,29 @@ public class TBUserController {
|
|
mongoTemplate.save(mteExamCourseEntity);
|
|
mongoTemplate.save(mteExamCourseEntity);
|
|
mongoTemplate.save(mteExamStudentEntity);
|
|
mongoTemplate.save(mteExamStudentEntity);
|
|
|
|
|
|
- IPage<Map> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
|
|
|
|
+ IPage<TEExamActivity> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
log.info("mysql map:{}", JacksonUtil.parseJson(map));
|
|
log.info("mysql map:{}", JacksonUtil.parseJson(map));
|
|
|
|
|
|
- List<MTEStudentEntity> mteStudentEntityList = mongoTemplate.findAll(MTEStudentEntity.class);
|
|
|
|
|
|
+ Query query = new Query();
|
|
|
|
+// query.addCriteria(Criteria.where("questionId").in(setQuestionId).andOperator(Criteria.where("examRecordDataId").is(examSessionInfo.getExamRecordDataId())));
|
|
|
|
+ query.skip((1 - 1) * 10).limit(10);//设置起始数和查询条数
|
|
|
|
+ List<MTEStudentEntity> mteStudentEntityList = mongoTemplate.find(query, MTEStudentEntity.class);
|
|
log.info("mongodb mteStudentEntityList:{}", JacksonUtil.parseJson(mteStudentEntityList));
|
|
log.info("mongodb mteStudentEntityList:{}", JacksonUtil.parseJson(mteStudentEntityList));
|
|
|
|
+// List<MTEStudentEntity> mteStudentEntityList = mongoTemplate.findAll(MTEStudentEntity.class);
|
|
|
|
+// log.info("mongodb mteStudentEntityList:{}", JacksonUtil.parseJson(mteStudentEntityList));
|
|
|
|
|
|
List<MTEExamEntity> mteExamEntityList = mongoTemplate.findAll(MTEExamEntity.class);
|
|
List<MTEExamEntity> mteExamEntityList = mongoTemplate.findAll(MTEExamEntity.class);
|
|
log.info("mongodb mteExamEntityList:{}", JacksonUtil.parseJson(mteExamEntityList));
|
|
log.info("mongodb mteExamEntityList:{}", JacksonUtil.parseJson(mteExamEntityList));
|
|
|
|
|
|
List<MTEExamActivityEntity> mteExamActivityEntityList = mongoTemplate.findAll(MTEExamActivityEntity.class);
|
|
List<MTEExamActivityEntity> mteExamActivityEntityList = mongoTemplate.findAll(MTEExamActivityEntity.class);
|
|
log.info("mongodb mteExamActivityEntityList:{}", JacksonUtil.parseJson(mteExamActivityEntityList));
|
|
log.info("mongodb mteExamActivityEntityList:{}", JacksonUtil.parseJson(mteExamActivityEntityList));
|
|
|
|
+// List<TEExamActivity> ps = new ArrayList<>();
|
|
|
|
+// mteExamActivityEntityList.forEach(s -> {
|
|
|
|
+// TEExamActivity t = gson.fromJson(gson.toJson(s), TEExamActivity.class);
|
|
|
|
+// ps.add(t);
|
|
|
|
+// });
|
|
|
|
+//// List<TEExamActivity> ps = gson.fromJson(JacksonUtil.parseJson(mteExamActivityEntityList), new TypeToken<List<TEExamActivity>>(){}.getType());
|
|
|
|
+// map.setRecords(ps);
|
|
|
|
|
|
List<MTEExamPaperEntity> mteExamPaperEntityList = mongoTemplate.findAll(MTEExamPaperEntity.class);
|
|
List<MTEExamPaperEntity> mteExamPaperEntityList = mongoTemplate.findAll(MTEExamPaperEntity.class);
|
|
log.info("mongodb mteExamPaperEntityList:{}", JacksonUtil.parseJson(mteExamPaperEntityList));
|
|
log.info("mongodb mteExamPaperEntityList:{}", JacksonUtil.parseJson(mteExamPaperEntityList));
|
|
@@ -344,6 +357,17 @@ public class TBUserController {
|
|
|
|
|
|
List<MTEExamStudentEntity> mteExamStudentEntityList = mongoTemplate.findAll(MTEExamStudentEntity.class);
|
|
List<MTEExamStudentEntity> mteExamStudentEntityList = mongoTemplate.findAll(MTEExamStudentEntity.class);
|
|
log.info("mongodb mteExamStudentEntityList:{}", JacksonUtil.parseJson(mteExamStudentEntityList));
|
|
log.info("mongodb mteExamStudentEntityList:{}", JacksonUtil.parseJson(mteExamStudentEntityList));
|
|
|
|
+ List<TEExamStudent> ps = new ArrayList<>();
|
|
|
|
+ mteExamStudentEntityList.forEach(s -> {
|
|
|
|
+ TEExamStudent t = gson.fromJson(gson.toJson(s), TEExamStudent.class);
|
|
|
|
+ ps.add(t);
|
|
|
|
+ });
|
|
|
|
+ List<MTEExamStudentEntity> ps1 = new ArrayList<>();
|
|
|
|
+ List<TEExamStudent> list1 = teExamStudentService.list();
|
|
|
|
+ list1.forEach(s -> {
|
|
|
|
+ MTEExamStudentEntity t = gson.fromJson(gson.toJson(s), MTEExamStudentEntity.class);
|
|
|
|
+ ps1.add(t);
|
|
|
|
+ });
|
|
// teExamActivityService.dropTable(tableName);
|
|
// teExamActivityService.dropTable(tableName);
|
|
return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
}
|
|
}
|