|
@@ -3,19 +3,17 @@ package com.qmth.themis.backend.api;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.google.gson.Gson;
|
|
import com.qmth.themis.backend.config.DictionaryConfig;
|
|
import com.qmth.themis.backend.config.DictionaryConfig;
|
|
|
|
+import com.qmth.themis.backend.mongodb.entity.*;
|
|
import com.qmth.themis.backend.util.ServletUtil;
|
|
import com.qmth.themis.backend.util.ServletUtil;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
-import com.qmth.themis.business.dao.TEExamActivityMapper;
|
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
-import com.qmth.themis.business.entity.TBSession;
|
|
|
|
-import com.qmth.themis.business.entity.TBUser;
|
|
|
|
-import com.qmth.themis.business.entity.TEExamActivity;
|
|
|
|
|
|
+import com.qmth.themis.business.entity.*;
|
|
import com.qmth.themis.business.enums.MqEnum;
|
|
import com.qmth.themis.business.enums.MqEnum;
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
import com.qmth.themis.business.enums.SystemOperationEnum;
|
|
import com.qmth.themis.business.enums.SystemOperationEnum;
|
|
-import com.qmth.themis.business.service.EhcacheService;
|
|
|
|
-import com.qmth.themis.business.service.TBUserService;
|
|
|
|
|
|
+import com.qmth.themis.business.service.*;
|
|
import com.qmth.themis.business.util.EhcacheUtil;
|
|
import com.qmth.themis.business.util.EhcacheUtil;
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
@@ -36,6 +34,8 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.slf4j.Logger;
|
|
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.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;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
@@ -46,10 +46,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.spec.InvalidKeySpecException;
|
|
import java.security.spec.InvalidKeySpecException;
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 用户 前端控制器
|
|
* @Description: 用户 前端控制器
|
|
@@ -138,47 +135,215 @@ public class TBUserController {
|
|
}
|
|
}
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- TEExamActivityMapper teExamActivityService;
|
|
|
|
|
|
+ TEExamActivityService teExamActivityService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamService teExamService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEStudentService teStudentService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamStudentService teExamStudentService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamCourseService teExamCourseService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamPaperService teExamPaperService;
|
|
|
|
|
|
@Value("${db.name}")
|
|
@Value("${db.name}")
|
|
String dbName;
|
|
String dbName;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ MongoTemplate mongoTemplate;
|
|
|
|
+
|
|
@ApiOperation(value = "用户查询接口")
|
|
@ApiOperation(value = "用户查询接口")
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
|
+ @Transactional
|
|
public Result list() {
|
|
public Result list() {
|
|
String tableName = "t_e_exam_activity_test1";
|
|
String tableName = "t_e_exam_activity_test1";
|
|
Integer count = teExamActivityService.existTable(tableName, dbName);
|
|
Integer count = teExamActivityService.existTable(tableName, dbName);
|
|
log.info("count:{}", count);
|
|
log.info("count:{}", count);
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
teExamActivityService.createNewTable(tableName);
|
|
teExamActivityService.createNewTable(tableName);
|
|
- TEExamActivity teExamActivity = new TEExamActivity();
|
|
|
|
- teExamActivity.setId(Constants.idGen.next());
|
|
|
|
- teExamActivity.setExamId(123L);
|
|
|
|
- teExamActivity.setCode("123");
|
|
|
|
- teExamActivity.setName("123");
|
|
|
|
- teExamActivity.setPrepareSeconds(30);
|
|
|
|
- teExamActivity.setMinStartTime(new Date());
|
|
|
|
- teExamActivity.setMaxStartTime(new Date());
|
|
|
|
- teExamActivity.setMaxDurationSeconds(30);
|
|
|
|
- teExamActivity.setMinDurationSeconds(30);
|
|
|
|
- teExamActivity.setMaxFinishTime(new Date());
|
|
|
|
- teExamActivity.setExamCount(1);
|
|
|
|
- teExamActivity.setBreakExpireSeconds(1);
|
|
|
|
- teExamActivity.setBreakResumeCount(1);
|
|
|
|
- teExamActivity.setEntryFaceVerify(1);
|
|
|
|
- teExamActivity.setEntryLivenessVerify(1);
|
|
|
|
- teExamActivity.setConstantFaceVerify(1);
|
|
|
|
- teExamActivity.setConstantLivenessVerifyCount(1);
|
|
|
|
- teExamActivity.setClientVideoPush(1);
|
|
|
|
- teExamActivity.setClientVideoRecord(1);
|
|
|
|
- teExamActivity.setWxappPhotoUpload(1);
|
|
|
|
- teExamActivity.setWxappVideoPush(1);
|
|
|
|
- teExamActivity.setWxappVideoRecord(1);
|
|
|
|
- teExamActivity.setCameraPhotoUpload(1);
|
|
|
|
- teExamActivityService.insertInfo(tableName, teExamActivity);
|
|
|
|
}
|
|
}
|
|
|
|
+ //学生档案
|
|
|
|
+ TEStudent teStudent = new TEStudent();
|
|
|
|
+ teStudent.setId(Constants.idGen.next());
|
|
|
|
+ teStudent.setOrgId(1L);
|
|
|
|
+ teStudent.setIdentity(RandomStringUtils.randomAlphanumeric(30));
|
|
|
|
+ teStudent.setPassword("123456");
|
|
|
|
+ teStudent.setIdcardNumber(RandomStringUtils.randomAlphanumeric(18));
|
|
|
|
+ teStudent.setMobileNumber(RandomStringUtils.randomNumeric(11));
|
|
|
|
+ teStudent.setName("aaa");
|
|
|
|
+ teStudent.setGender(1);
|
|
|
|
+ teStudent.setBasePhotoPath("http://11111");
|
|
|
|
+ teStudent.setCreateTime(new Date());
|
|
|
|
+ teStudentService.save(teStudent);
|
|
|
|
+
|
|
|
|
+ //考试批次
|
|
|
|
+ TEExam teExam = new TEExam();
|
|
|
|
+ teExam.setId(Constants.idGen.next());
|
|
|
|
+ teExam.setOrgId(1L);
|
|
|
|
+ teExam.setCode(RandomStringUtils.randomAlphanumeric(20));
|
|
|
|
+ teExam.setName("123");
|
|
|
|
+ teExam.setTag("test1");
|
|
|
|
+ teExam.setStartTime(new Date());
|
|
|
|
+ teExam.setEndTime(new Date());
|
|
|
|
+ teExam.setStatus(0);
|
|
|
|
+ teExam.setShortCode("123456");
|
|
|
|
+ teExam.setPrepareSeconds(30);
|
|
|
|
+ teExam.setMinDurationSeconds(30);
|
|
|
|
+ teExam.setPreNotice("99999");
|
|
|
|
+ teExam.setPreNoticeStaySeconds(30);
|
|
|
|
+ teExam.setPostNotice("88888");
|
|
|
|
+ teExam.setExamCount(5);
|
|
|
|
+ teExam.setBreakResumeCount(3);
|
|
|
|
+ teExam.setBreakExpireSeconds(30);
|
|
|
|
+ teExam.setLivenessActionCount(5);
|
|
|
|
+ teExam.setLivenessActionRetryCount(5);
|
|
|
|
+ teExam.setEntryFaceVerify(1);
|
|
|
|
+ teExam.setEntryLivenessVerify(1);
|
|
|
|
+ teExam.setConstantFaceVerify(1);
|
|
|
|
+ teExam.setConstantLivenessRetryCount(1);
|
|
|
|
+ teExam.setConstantLivenessVerifyCount(1);
|
|
|
|
+ teExam.setClientVideoPush(1);
|
|
|
|
+ teExam.setClientVideoRecord(1);
|
|
|
|
+ teExam.setWxappPhotoUpload(1);
|
|
|
|
+ teExam.setWxappVideoPush(1);
|
|
|
|
+ teExam.setWxappVideoRecord(1);
|
|
|
|
+ teExam.setCameraPhotoUpload(1);
|
|
|
|
+ teExam.setWxappPhotoUpload(1);
|
|
|
|
+ teExam.setReexamAuditing(1);
|
|
|
|
+ teExam.setSelectStrategy(1);
|
|
|
|
+ teExam.setIpLimit("123");
|
|
|
|
+ teExam.setShowObjectiveScore(1);
|
|
|
|
+ teExam.setCreateTime(new Date());
|
|
|
|
+ teExamService.save(teExam);
|
|
|
|
+
|
|
|
|
+ //考试场次
|
|
|
|
+ TEExamActivity teExamActivity = new TEExamActivity();
|
|
|
|
+ teExamActivity.setId(Constants.idGen.next());
|
|
|
|
+ teExamActivity.setExamId(teExam.getId());
|
|
|
|
+ teExamActivity.setCode(RandomStringUtils.randomAlphanumeric(20));
|
|
|
|
+ teExamActivity.setName("456");
|
|
|
|
+ teExamActivity.setPrepareSeconds(30);
|
|
|
|
+ teExamActivity.setMinStartTime(new Date());
|
|
|
|
+ teExamActivity.setMaxStartTime(new Date());
|
|
|
|
+ teExamActivity.setMaxDurationSeconds(30);
|
|
|
|
+ teExamActivity.setMinDurationSeconds(30);
|
|
|
|
+ teExamActivity.setMaxFinishTime(new Date());
|
|
|
|
+ teExamActivity.setExamCount(1);
|
|
|
|
+ teExamActivity.setBreakExpireSeconds(1);
|
|
|
|
+ teExamActivity.setBreakResumeCount(1);
|
|
|
|
+ teExamActivity.setEntryFaceVerify(1);
|
|
|
|
+ teExamActivity.setEntryLivenessVerify(1);
|
|
|
|
+ teExamActivity.setConstantFaceVerify(1);
|
|
|
|
+ teExamActivity.setConstantLivenessVerifyCount(1);
|
|
|
|
+ teExamActivity.setClientVideoPush(1);
|
|
|
|
+ teExamActivity.setClientVideoRecord(1);
|
|
|
|
+ teExamActivity.setWxappPhotoUpload(1);
|
|
|
|
+ teExamActivity.setWxappVideoPush(1);
|
|
|
|
+ teExamActivity.setWxappVideoRecord(1);
|
|
|
|
+ teExamActivity.setCameraPhotoUpload(1);
|
|
|
|
+ teExamActivityService.insertInfo(tableName, teExamActivity);
|
|
|
|
+
|
|
|
|
+ //考试试卷
|
|
|
|
+ TEExamPaper teExamPaper = new TEExamPaper();
|
|
|
|
+ teExamPaper.setId(Constants.idGen.next());
|
|
|
|
+ teExamPaper.setName("test1");
|
|
|
|
+ teExamPaper.setTotalScore(100D);
|
|
|
|
+ teExamPaper.setPaperPath("123");
|
|
|
|
+ teExamPaper.setStandardAnswerPath("234");
|
|
|
|
+ teExamPaper.setDecryptSecret("345");
|
|
|
|
+ teExamPaper.setEncryptMode(1);
|
|
|
|
+ teExamPaper.setHasVideo(1);
|
|
|
|
+ teExamPaper.setNeedVoiceAnswer(1);
|
|
|
|
+ teExamPaper.setCreateTime(new Date());
|
|
|
|
+ teExamPaperService.save(teExamPaper);
|
|
|
|
+
|
|
|
|
+ //考试科目
|
|
|
|
+ TEExamCourse teExamCourse = new TEExamCourse();
|
|
|
|
+ teExamCourse.setId(Constants.idGen.next());
|
|
|
|
+ teExamCourse.setExamId(teExam.getId());
|
|
|
|
+ teExamCourse.setExamActivityId(teExamActivity.getId());
|
|
|
|
+ teExamCourse.setCourseCode("T0001");
|
|
|
|
+ teExamCourse.setCourseName("测试科目1");
|
|
|
|
+ teExamCourse.setObjectiveShuffle(1);
|
|
|
|
+ teExamCourse.setOptionShuffle(1);
|
|
|
|
+ List paperIdsList = new ArrayList();
|
|
|
|
+ paperIdsList.add(teExamPaper.getId());
|
|
|
|
+ paperIdsList.add(0L);
|
|
|
|
+ Map paperMap = new HashMap();
|
|
|
|
+ paperMap.put("paperIds", paperIdsList);
|
|
|
|
+ teExamCourse.setPaperIds(JacksonUtil.parseJson(paperMap));
|
|
|
|
+ teExamCourseService.save(teExamCourse);
|
|
|
|
+
|
|
|
|
+ //考生
|
|
|
|
+ TEExamStudent teExamStudent = new TEExamStudent();
|
|
|
|
+ teExamStudent.setId(Constants.idGen.next());
|
|
|
|
+ teExamStudent.setExamId(teExam.getId());
|
|
|
|
+ teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
|
+ teExamStudent.setStudentId(teStudent.getId());
|
|
|
|
+ teExamStudent.setCourseCode(teExamCourse.getCourseCode());
|
|
|
|
+ teExamStudent.setRoomCode("1");
|
|
|
|
+ teExamStudent.setIdentity(RandomStringUtils.randomAlphanumeric(20));
|
|
|
|
+ teExamStudent.setName("132");
|
|
|
|
+ Map stuMap = new HashMap();
|
|
|
|
+ stuMap.put("examTest1", "aaa");
|
|
|
|
+ stuMap.put("examTest2", "bbb");
|
|
|
|
+ teExamStudent.setParameter(JacksonUtil.parseJson(stuMap));
|
|
|
|
+ teExamStudent.setLeftExamCount(1);
|
|
|
|
+ teExamStudentService.save(teExamStudent);
|
|
|
|
+
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
+ MTEStudentEntity mteStudentEntity = gson.fromJson(gson.toJson(teStudent), MTEStudentEntity.class);
|
|
|
|
+ MTEExamEntity mteExamEntity = gson.fromJson(gson.toJson(teExam), MTEExamEntity.class);
|
|
|
|
+ MTEExamActivityEntity mteExamActivityEntity = gson.fromJson(gson.toJson(teExamActivity), MTEExamActivityEntity.class);
|
|
|
|
+ MTEExamPaperEntity mteExamPaperEntity = gson.fromJson(gson.toJson(teExamPaper), MTEExamPaperEntity.class);
|
|
|
|
+ MTEExamCourseEntity mteExamCourseEntity = gson.fromJson(gson.toJson(teExamCourse), MTEExamCourseEntity.class);
|
|
|
|
+ MTEExamStudentEntity mteExamStudentEntity = gson.fromJson(gson.toJson(teExamStudent), MTEExamStudentEntity.class);
|
|
|
|
+
|
|
|
|
+ List list = Arrays.asList(mteExamPaperEntity);
|
|
|
|
+ mteExamCourseEntity.setMteExamPaperEntityList(list);
|
|
|
|
+
|
|
|
|
+ list = Arrays.asList(mteExamActivityEntity);
|
|
|
|
+ mteExamEntity.setMteExamActivityEntityList(list);
|
|
|
|
+
|
|
|
|
+ list = Arrays.asList(mteExamCourseEntity);
|
|
|
|
+ mteExamStudentEntity.setMteExamEntity(mteExamEntity);
|
|
|
|
+ mteExamStudentEntity.setMteExamActivityEntity(mteExamActivityEntity);
|
|
|
|
+ mteExamStudentEntity.setMteStudentEntity(mteStudentEntity);
|
|
|
|
+ mteExamStudentEntity.setMteExamCourseEntityList(list);
|
|
|
|
+
|
|
|
|
+ mongoTemplate.save(mteStudentEntity);
|
|
|
|
+ mongoTemplate.save(mteExamEntity);
|
|
|
|
+ mongoTemplate.save(mteExamActivityEntity);
|
|
|
|
+ mongoTemplate.save(mteExamPaperEntity);
|
|
|
|
+ mongoTemplate.save(mteExamCourseEntity);
|
|
|
|
+ mongoTemplate.save(mteExamStudentEntity);
|
|
|
|
+
|
|
IPage<Map> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
IPage<Map> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
- log.info("map:{}", JacksonUtil.parseJson(map));
|
|
|
|
|
|
+ log.info("mysql map:{}", JacksonUtil.parseJson(map));
|
|
|
|
+
|
|
|
|
+ List<MTEStudentEntity> mteStudentEntityList = mongoTemplate.findAll(MTEStudentEntity.class);
|
|
|
|
+ log.info("mongodb mteStudentEntityList:{}", JacksonUtil.parseJson(mteStudentEntityList));
|
|
|
|
+
|
|
|
|
+ List<MTEExamEntity> mteExamEntityList = mongoTemplate.findAll(MTEExamEntity.class);
|
|
|
|
+ log.info("mongodb mteExamEntityList:{}", JacksonUtil.parseJson(mteExamEntityList));
|
|
|
|
+
|
|
|
|
+ List<MTEExamActivityEntity> mteExamActivityEntityList = mongoTemplate.findAll(MTEExamActivityEntity.class);
|
|
|
|
+ log.info("mongodb mteExamActivityEntityList:{}", JacksonUtil.parseJson(mteExamActivityEntityList));
|
|
|
|
+
|
|
|
|
+ List<MTEExamPaperEntity> mteExamPaperEntityList = mongoTemplate.findAll(MTEExamPaperEntity.class);
|
|
|
|
+ log.info("mongodb mteExamPaperEntityList:{}", JacksonUtil.parseJson(mteExamPaperEntityList));
|
|
|
|
+
|
|
|
|
+ List<MTEExamCourseEntity> mteExamCourseEntityList = mongoTemplate.findAll(MTEExamCourseEntity.class);
|
|
|
|
+ log.info("mongodb mteExamCourseEntityList:{}", JacksonUtil.parseJson(mteExamCourseEntityList));
|
|
|
|
+
|
|
|
|
+ List<MTEExamStudentEntity> mteExamStudentEntityList = mongoTemplate.findAll(MTEExamStudentEntity.class);
|
|
|
|
+ log.info("mongodb mteExamStudentEntityList:{}", JacksonUtil.parseJson(mteExamStudentEntityList));
|
|
// teExamActivityService.dropTable(tableName);
|
|
// teExamActivityService.dropTable(tableName);
|
|
return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
}
|
|
}
|