|
@@ -19,17 +19,15 @@ import com.qmth.themis.business.enums.MqTagEnum;
|
|
|
import com.qmth.themis.business.enums.MqTopicEnum;
|
|
|
import com.qmth.themis.business.enums.SystemOperationEnum;
|
|
|
import com.qmth.themis.business.service.*;
|
|
|
-import com.qmth.themis.business.util.OssUtil;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
|
import com.qmth.themis.business.util.SessionUtil;
|
|
|
+import com.qmth.themis.business.util.UidUtil;
|
|
|
import com.qmth.themis.common.contanst.Constants;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.enums.Platform;
|
|
|
import com.qmth.themis.common.enums.Source;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
-import com.qmth.themis.common.signature.SignatureInfo;
|
|
|
-import com.qmth.themis.common.signature.SignatureType;
|
|
|
import com.qmth.themis.common.util.AesUtil;
|
|
|
import com.qmth.themis.common.util.Result;
|
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
@@ -56,6 +54,7 @@ import java.util.*;
|
|
|
@RestController
|
|
|
@RequestMapping("/${prefix.url.admin}/user")
|
|
|
public class TBUserController {
|
|
|
+
|
|
|
private final static Logger log = LoggerFactory.getLogger(TBUserController.class);
|
|
|
|
|
|
@Resource
|
|
@@ -76,14 +75,17 @@ public class TBUserController {
|
|
|
@Resource
|
|
|
TBOrgService tbOrgService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ UidUtil uidUtil;
|
|
|
+
|
|
|
@ApiOperation(value = "用户登录接口")
|
|
|
@RequestMapping(value = "/login/account", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUser.class)})
|
|
|
- public Result login(@ApiJsonObject(name = "loginAccount", value = {
|
|
|
- @ApiJsonProperty(key = "loginName", description = "登录名"),
|
|
|
- @ApiJsonProperty(key = "password", description = "密码"),
|
|
|
- @ApiJsonProperty(key = "code", description = "机构代码")
|
|
|
- }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) throws NoSuchAlgorithmException {
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "用户信息", response = TBUser.class) })
|
|
|
+ public Result login(
|
|
|
+ @ApiJsonObject(name = "loginAccount", value = { @ApiJsonProperty(key = "loginName", description = "登录名"),
|
|
|
+ @ApiJsonProperty(key = "password", description = "密码"),
|
|
|
+ @ApiJsonProperty(key = "code", description = "机构代码") }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter)
|
|
|
+ throws NoSuchAlgorithmException {
|
|
|
if (Objects.isNull(mapParameter)) {
|
|
|
throw new BusinessException(ExceptionResultEnum.USER_INFO_IS_NULL);
|
|
|
}
|
|
@@ -152,8 +154,9 @@ public class TBUserController {
|
|
|
|
|
|
@ApiOperation(value = "短信验证码登陆接口")
|
|
|
@RequestMapping(value = "/login/verifyCode", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUser.class)})
|
|
|
- public Result verifyCode(@ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) throws NoSuchAlgorithmException {
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "用户信息", response = TBUser.class) })
|
|
|
+ public Result verifyCode(@ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter)
|
|
|
+ throws NoSuchAlgorithmException {
|
|
|
if (Objects.isNull(mapParameter.get("loginName")) || Objects.equals(mapParameter.get("loginName"), "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
|
|
|
}
|
|
@@ -195,30 +198,36 @@ public class TBUserController {
|
|
|
//添加用户缓存
|
|
|
redisUtil.setUser(user.getId(), user);
|
|
|
String source = null;
|
|
|
- if (Objects.equals(platform.name(), Platform.WIN.name()) || Objects.equals(platform.name(), Platform.MAC.name()) || Objects.equals(platform.name(), Platform.IOS.name()) || Objects.equals(platform.name(), Platform.ANDROID.name())) {
|
|
|
+ if (Objects.equals(platform.name(), Platform.WIN.name()) || Objects.equals(platform.name(), Platform.MAC.name())
|
|
|
+ || Objects.equals(platform.name(), Platform.IOS.name()) || Objects
|
|
|
+ .equals(platform.name(), Platform.ANDROID.name())) {
|
|
|
source = platform.getSource().split(",")[0];
|
|
|
} else {
|
|
|
source = platform.getSource();
|
|
|
}
|
|
|
//添加用户会话缓存
|
|
|
- String sessionId = SessionUtil.digest(user.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), source);
|
|
|
+ String sessionId = SessionUtil
|
|
|
+ .digest(user.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), source);
|
|
|
|
|
|
Map<String, Object> expireMap = SystemConstant.getExpireTime(platform);
|
|
|
Date expire = (Date) expireMap.get("date");
|
|
|
Long redisExpire = Long.parseLong(String.valueOf(expireMap.get("redisExpire")));
|
|
|
- TBSession tbSession = new TBSession(sessionId, String.valueOf(user.getId()), authDto.getRoleCodes().toString(), source, platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token, expire.getTime());
|
|
|
+ TBSession tbSession = new TBSession(sessionId, String.valueOf(user.getId()), authDto.getRoleCodes().toString(),
|
|
|
+ source, platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token, expire.getTime());
|
|
|
redisUtil.setUserSession(sessionId, tbSession, redisExpire);
|
|
|
//mq发送消息start
|
|
|
- MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), platform.name(), tbSession, MqTagEnum.valueOf(platform.name()), tbSession.getId(), user.getLoginName());
|
|
|
+ MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), platform.name(), tbSession,
|
|
|
+ MqTagEnum.valueOf(platform.name()), tbSession.getId(), user.getLoginName());
|
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
- MqDto mqDtoLog = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.USER.name(), SystemOperationEnum.LOGIN, MqTagEnum.USER, String.valueOf(user.getId()), user.getLoginName());
|
|
|
+ MqDto mqDtoLog = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.USER.name(), SystemOperationEnum.LOGIN,
|
|
|
+ MqTagEnum.USER, String.valueOf(user.getId()), user.getLoginName());
|
|
|
mqDtoService.assembleSendOneWayMsg(mqDtoLog);
|
|
|
//mq发送消息end
|
|
|
//测试
|
|
|
-// String test = SignatureInfo.build(SignatureType.TOKEN, sessionId, token);
|
|
|
+ // String test = SignatureInfo.build(SignatureType.TOKEN, sessionId, token);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put(SystemConstant.ACCESS_TOKEN, token);
|
|
|
-// map.put(SystemConstant.ACCESS_TOKEN, test);
|
|
|
+ // map.put(SystemConstant.ACCESS_TOKEN, test);
|
|
|
map.put(SystemConstant.ACCOUNT, user);
|
|
|
map.put(SystemConstant.SESSION_ID, sessionId);
|
|
|
map.put("roleCodes", authDto.getRoleCodes());
|
|
@@ -233,303 +242,303 @@ public class TBUserController {
|
|
|
return ResultUtil.ok(map);
|
|
|
}
|
|
|
|
|
|
-// @ApiOperation(value = "es查询接口")
|
|
|
-// @RequestMapping(value = "/websocketPush", method = RequestMethod.POST)
|
|
|
-// public Result websocketPush(@RequestBody String message) throws IOException {
|
|
|
-// TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
|
|
|
-// WebSocketServer.sendInfo(message, String.valueOf(tbUser.getId()));
|
|
|
-// return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
-// }
|
|
|
+ // @ApiOperation(value = "es查询接口")
|
|
|
+ // @RequestMapping(value = "/websocketPush", method = RequestMethod.POST)
|
|
|
+ // public Result websocketPush(@RequestBody String message) throws IOException {
|
|
|
+ // TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
|
|
|
+ // WebSocketServer.sendInfo(message, String.valueOf(tbUser.getId()));
|
|
|
+ // return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ // }
|
|
|
|
|
|
-// @Resource
|
|
|
-// TEExamActivityService teExamActivityService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// TEExamService teExamService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// TEStudentService teStudentService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// TEExamStudentService teExamStudentService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// TEExamCourseService teExamCourseService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// TEExamPaperService teExamPaperService;
|
|
|
-//
|
|
|
-// @Value("${db.name}")
|
|
|
-// String dbName;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// MongoTemplate mongoTemplate;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// ETEStudentService eteStudentService;
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// ETEStudentRepo eteStudentRepo;
|
|
|
+ // @Resource
|
|
|
+ // TEExamActivityService teExamActivityService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // TEExamService teExamService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // TEStudentService teStudentService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // TEExamStudentService teExamStudentService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // TEExamCourseService teExamCourseService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // TEExamPaperService teExamPaperService;
|
|
|
+ //
|
|
|
+ // @Value("${db.name}")
|
|
|
+ // String dbName;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // MongoTemplate mongoTemplate;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // ETEStudentService eteStudentService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // ETEStudentRepo eteStudentRepo;
|
|
|
|
|
|
-// @ApiOperation(value = "es查询接口")
|
|
|
-// @RequestMapping(value = "/es/list", method = RequestMethod.POST)
|
|
|
-// @Transactional
|
|
|
-// public Result esList() {
|
|
|
-//// eteStudentService.createIndex();
|
|
|
-//// List<ETEStudentEntity> list = new ArrayList<>();
|
|
|
-//// for (int i = 0; i < 10; i++) {
|
|
|
-//// //学生档案
|
|
|
-//// ETEStudentEntity eteStudentEntity = new ETEStudentEntity();
|
|
|
-//// eteStudentEntity.setId(Constants.idGen.next());
|
|
|
-//// eteStudentEntity.setOrgId(1L);
|
|
|
-//// eteStudentEntity.setIdentity("test" + i);
|
|
|
-//// eteStudentEntity.setPassword("123456");
|
|
|
-//// eteStudentEntity.setIdcardNumber(RandomStringUtils.randomAlphanumeric(18));
|
|
|
-//// eteStudentEntity.setMobileNumber(RandomStringUtils.randomNumeric(11));
|
|
|
-//// eteStudentEntity.setName("java" + i + RandomStringUtils.randomAlphanumeric(30));
|
|
|
-//// eteStudentEntity.setGender(1);
|
|
|
-//// eteStudentEntity.setBasePhotoPath("http://11111");
|
|
|
-//// eteStudentEntity.setCreateTime(new Date());
|
|
|
-//// list.add(eteStudentEntity);
|
|
|
-//// }
|
|
|
-//// eteStudentService.saveAll(list);
|
|
|
-////// Iterator<ETEStudentEntity> iterator = eteStudentService.findAll();
|
|
|
-//// org.springframework.data.domain.Page<ETEStudentEntity> eteStudentEntityPage1 = (org.springframework.data.domain.Page<ETEStudentEntity>) eteStudentService.queryName("2");
|
|
|
-////// List<ETEStudentEntity> eteStudentEntityList = eteStudentService.findByNameLike("java");
|
|
|
-//// org.springframework.data.domain.Page<ETEStudentEntity> eteStudentEntityPage2 = (org.springframework.data.domain.Page<ETEStudentEntity>) eteStudentService.queryMobileNumber("2");
|
|
|
-////// Optional<ETEStudentEntity> eteStudentEntity = eteStudentRepo.findById(eteStudentEntityPage.getContent().get(0).getId());
|
|
|
-//// Map map = new HashMap();
|
|
|
-//// map.put(SystemConstant.RECORDS, eteStudentEntityPage1);
|
|
|
-//// map.put(SystemConstant.RECORDS + 2, eteStudentEntityPage2);
|
|
|
-////// map.put("bean", eteStudentEntity.get());
|
|
|
-//// return ResultUtil.ok(map);
|
|
|
-//
|
|
|
-//// for (int i = 0; i < 5; i++) {
|
|
|
-//
|
|
|
-//// mqDtoService.assembleSendOneWayMsg("imTopic", "teacher", "老师发送的一条消息1", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
-//// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "用户发送的一条消息2", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
-//// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "学生发送的一条消息3", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
-// Map map = new HashMap();
|
|
|
-// map.put("sendUserId", "10");
|
|
|
-// map.put("toUserId", "20");
|
|
|
-// map.put("model", MessageModel.BROADCASTING);
|
|
|
-//// map.put("model", MessageModel.CLUSTERING);
|
|
|
-// MqDto mqDto = new MqDto("websocketImTopic", "im", "学生发送的一条消息4", MqEnum.MESSAGE_LOG, "1", map, "2");
|
|
|
-//// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "学生发送的一条消息3", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
-// mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
-// // }
|
|
|
-// return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
-// }
|
|
|
+ // @ApiOperation(value = "es查询接口")
|
|
|
+ // @RequestMapping(value = "/es/list", method = RequestMethod.POST)
|
|
|
+ // @Transactional
|
|
|
+ // public Result esList() {
|
|
|
+ //// eteStudentService.createIndex();
|
|
|
+ //// List<ETEStudentEntity> list = new ArrayList<>();
|
|
|
+ //// for (int i = 0; i < 10; i++) {
|
|
|
+ //// //学生档案
|
|
|
+ //// ETEStudentEntity eteStudentEntity = new ETEStudentEntity();
|
|
|
+ //// eteStudentEntity.setId(Constants.idGen.next());
|
|
|
+ //// eteStudentEntity.setOrgId(1L);
|
|
|
+ //// eteStudentEntity.setIdentity("test" + i);
|
|
|
+ //// eteStudentEntity.setPassword("123456");
|
|
|
+ //// eteStudentEntity.setIdcardNumber(RandomStringUtils.randomAlphanumeric(18));
|
|
|
+ //// eteStudentEntity.setMobileNumber(RandomStringUtils.randomNumeric(11));
|
|
|
+ //// eteStudentEntity.setName("java" + i + RandomStringUtils.randomAlphanumeric(30));
|
|
|
+ //// eteStudentEntity.setGender(1);
|
|
|
+ //// eteStudentEntity.setBasePhotoPath("http://11111");
|
|
|
+ //// eteStudentEntity.setCreateTime(new Date());
|
|
|
+ //// list.add(eteStudentEntity);
|
|
|
+ //// }
|
|
|
+ //// eteStudentService.saveAll(list);
|
|
|
+ ////// Iterator<ETEStudentEntity> iterator = eteStudentService.findAll();
|
|
|
+ //// org.springframework.data.domain.Page<ETEStudentEntity> eteStudentEntityPage1 = (org.springframework.data.domain.Page<ETEStudentEntity>) eteStudentService.queryName("2");
|
|
|
+ ////// List<ETEStudentEntity> eteStudentEntityList = eteStudentService.findByNameLike("java");
|
|
|
+ //// org.springframework.data.domain.Page<ETEStudentEntity> eteStudentEntityPage2 = (org.springframework.data.domain.Page<ETEStudentEntity>) eteStudentService.queryMobileNumber("2");
|
|
|
+ ////// Optional<ETEStudentEntity> eteStudentEntity = eteStudentRepo.findById(eteStudentEntityPage.getContent().get(0).getId());
|
|
|
+ //// Map map = new HashMap();
|
|
|
+ //// map.put(SystemConstant.RECORDS, eteStudentEntityPage1);
|
|
|
+ //// map.put(SystemConstant.RECORDS + 2, eteStudentEntityPage2);
|
|
|
+ ////// map.put("bean", eteStudentEntity.get());
|
|
|
+ //// return ResultUtil.ok(map);
|
|
|
+ //
|
|
|
+ //// for (int i = 0; i < 5; i++) {
|
|
|
+ //
|
|
|
+ //// mqDtoService.assembleSendOneWayMsg("imTopic", "teacher", "老师发送的一条消息1", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
+ //// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "用户发送的一条消息2", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
+ //// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "学生发送的一条消息3", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
+ // Map map = new HashMap();
|
|
|
+ // map.put("sendUserId", "10");
|
|
|
+ // map.put("toUserId", "20");
|
|
|
+ // map.put("model", MessageModel.BROADCASTING);
|
|
|
+ //// map.put("model", MessageModel.CLUSTERING);
|
|
|
+ // MqDto mqDto = new MqDto("websocketImTopic", "im", "学生发送的一条消息4", MqEnum.MESSAGE_LOG, "1", map, "2");
|
|
|
+ //// mqDtoService.assembleSendOneWayMsg("imTopic", "user", "学生发送的一条消息3", MqEnum.MESSAGE_LOG.name(), "1", "2");
|
|
|
+ // mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
+ // // }
|
|
|
+ // return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ // }
|
|
|
|
|
|
-// @ApiOperation(value = "用户查询接口")
|
|
|
-// @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
-// @Transactional
|
|
|
-// public Result list() {
|
|
|
-// String tableName = "t_e_exam_activity_test1";
|
|
|
-// Integer count = teExamActivityService.existTable(tableName, dbName);
|
|
|
-// log.info("count:{}", count);
|
|
|
-// if (count == 0) {
|
|
|
-// teExamActivityService.createNewTable(tableName);
|
|
|
-// }
|
|
|
-// //学生档案
|
|
|
-// 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.setEnable(1);
|
|
|
-// 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.setCameraPhotoUpload(1);
|
|
|
-// teExam.setReexamAuditing(1);
|
|
|
-// teExam.setShowObjectiveScore(1);
|
|
|
-// teExam.setMode(0);
|
|
|
-// teExam.setEnable(1);
|
|
|
-// teExam.setArchived(0);
|
|
|
-// teExam.setOpeningSeconds(30);
|
|
|
-// teExam.setMaxDurationSeconds(30);
|
|
|
-// teExam.setForceFinish(1);
|
|
|
-// teExam.setEntryAuthenticationPolicy(1);
|
|
|
-// teExam.setInProcessFaceVerify(1);
|
|
|
-// teExam.setInProcessFaceStrangerIgnore(1);
|
|
|
-// teExam.setInProcessLivenessVerify(1);
|
|
|
-// teExam.setInProcessLivenessIntervalSeconds(30);
|
|
|
-// teExam.setInProcessLivenessJudgePolicy(1);
|
|
|
-// teExam.setRecordSelectStrategy(1);
|
|
|
-// teExam.setEnableIpLimit(1);
|
|
|
-// teExam.setIpAllow("1");
|
|
|
-// teExam.setScoreStatus(1);
|
|
|
-// teExamService.save(teExam);
|
|
|
-//
|
|
|
-// //考试场次
|
|
|
-// TEExamActivity teExamActivity = new TEExamActivity();
|
|
|
-// teExamActivity.setId(Constants.idGen.next());
|
|
|
-// teExamActivity.setExamId(teExam.getId());
|
|
|
-// teExamActivity.setCode(RandomStringUtils.randomAlphanumeric(20));
|
|
|
-// teExamActivity.setPrepareSeconds(30);
|
|
|
-// teExamActivity.setMaxDurationSeconds(30);
|
|
|
-// teExamActivity.setEnable(1);
|
|
|
-// teExamActivity.setOpeningSeconds(30);
|
|
|
-// teExamActivity.setStartTime(new Date());
|
|
|
-// teExamActivity.setFinishTime(new Date());
|
|
|
-// teExamActivity.setCreateTime(new Date());
|
|
|
-// teExamActivityService.insertInfo(tableName, teExamActivity);
|
|
|
-//
|
|
|
-// //考试科目
|
|
|
-// TEExamCourse teExamCourse = new TEExamCourse();
|
|
|
-// teExamCourse.setId(Constants.idGen.next());
|
|
|
-// teExamCourse.setExamId(teExam.getId());
|
|
|
-// teExamCourse.setCourseCode(RandomStringUtils.randomAlphanumeric(5));
|
|
|
-// teExamCourse.setCourseName("测试科目1");
|
|
|
-// teExamCourse.setObjectiveShuffle(1);
|
|
|
-// teExamCourse.setOptionShuffle(1);
|
|
|
-// teExamCourse.setPaperCount(1);
|
|
|
-// teExamCourse.setHasAnswer(1);
|
|
|
-// teExamCourse.setAudioPlayCount(1);
|
|
|
-// teExamCourseService.save(teExamCourse);
|
|
|
-//
|
|
|
-// //考试试卷
|
|
|
-// TEExamPaper teExamPaper = new TEExamPaper();
|
|
|
-// teExamPaper.setId(Constants.idGen.next());
|
|
|
-// teExamPaper.setName("test1");
|
|
|
-// teExamPaper.setTotalScore(100D);
|
|
|
-// teExamPaper.setPaperPath("123");
|
|
|
-// teExamPaper.setDecryptSecret("345");
|
|
|
-// teExamPaper.setEncryptMode(1);
|
|
|
-// teExamPaper.setNeedVoiceAnswer(1);
|
|
|
-// teExamPaper.setExamId(teExam.getId());
|
|
|
-// teExamPaper.setCode("test1");
|
|
|
-// teExamPaper.setCourseCode(teExamCourse.getCourseCode());
|
|
|
-// teExamPaper.setAnswerPath("123");
|
|
|
-// teExamPaper.setHasAudio(1);
|
|
|
-// teExamPaper.setWeight(1D);
|
|
|
-// teExamPaper.setAudioPlayCount(1);
|
|
|
-// teExamPaperService.save(teExamPaper);
|
|
|
-//
|
|
|
-// //考生
|
|
|
-// 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);
|
|
|
-// teExamStudent.setRoomName("test1");
|
|
|
-// teExamStudent.setEnable(1);
|
|
|
-// teExamStudentService.save(teExamStudent);
|
|
|
-//
|
|
|
-// //todo
|
|
|
-//// 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);
|
|
|
-// //todo
|
|
|
-//
|
|
|
-//// 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);
|
|
|
-//
|
|
|
-// //todo
|
|
|
-//// mongoTemplate.save(mteStudentEntity);
|
|
|
-//// mongoTemplate.save(mteExamEntity);
|
|
|
-//// mongoTemplate.save(mteExamActivityEntity);
|
|
|
-//// mongoTemplate.save(mteExamPaperEntity);
|
|
|
-//// mongoTemplate.save(mteExamCourseEntity);
|
|
|
-//// mongoTemplate.save(mteExamStudentEntity);
|
|
|
-////
|
|
|
-//// IPage<TEExamActivity> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
|
-//// log.info("mysql map:{}", JacksonUtil.parseJson(map));
|
|
|
-////
|
|
|
-//// 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));
|
|
|
-////// 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<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);
|
|
|
-//// 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));
|
|
|
-//// 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);
|
|
|
-//// });
|
|
|
-// //todo
|
|
|
-//// teExamActivityService.dropTable(tableName);
|
|
|
-// return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
-// }
|
|
|
+ // @ApiOperation(value = "用户查询接口")
|
|
|
+ // @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
+ // @Transactional
|
|
|
+ // public Result list() {
|
|
|
+ // String tableName = "t_e_exam_activity_test1";
|
|
|
+ // Integer count = teExamActivityService.existTable(tableName, dbName);
|
|
|
+ // log.info("count:{}", count);
|
|
|
+ // if (count == 0) {
|
|
|
+ // teExamActivityService.createNewTable(tableName);
|
|
|
+ // }
|
|
|
+ // //学生档案
|
|
|
+ // 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.setEnable(1);
|
|
|
+ // 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.setCameraPhotoUpload(1);
|
|
|
+ // teExam.setReexamAuditing(1);
|
|
|
+ // teExam.setShowObjectiveScore(1);
|
|
|
+ // teExam.setMode(0);
|
|
|
+ // teExam.setEnable(1);
|
|
|
+ // teExam.setArchived(0);
|
|
|
+ // teExam.setOpeningSeconds(30);
|
|
|
+ // teExam.setMaxDurationSeconds(30);
|
|
|
+ // teExam.setForceFinish(1);
|
|
|
+ // teExam.setEntryAuthenticationPolicy(1);
|
|
|
+ // teExam.setInProcessFaceVerify(1);
|
|
|
+ // teExam.setInProcessFaceStrangerIgnore(1);
|
|
|
+ // teExam.setInProcessLivenessVerify(1);
|
|
|
+ // teExam.setInProcessLivenessIntervalSeconds(30);
|
|
|
+ // teExam.setInProcessLivenessJudgePolicy(1);
|
|
|
+ // teExam.setRecordSelectStrategy(1);
|
|
|
+ // teExam.setEnableIpLimit(1);
|
|
|
+ // teExam.setIpAllow("1");
|
|
|
+ // teExam.setScoreStatus(1);
|
|
|
+ // teExamService.save(teExam);
|
|
|
+ //
|
|
|
+ // //考试场次
|
|
|
+ // TEExamActivity teExamActivity = new TEExamActivity();
|
|
|
+ // teExamActivity.setId(Constants.idGen.next());
|
|
|
+ // teExamActivity.setExamId(teExam.getId());
|
|
|
+ // teExamActivity.setCode(RandomStringUtils.randomAlphanumeric(20));
|
|
|
+ // teExamActivity.setPrepareSeconds(30);
|
|
|
+ // teExamActivity.setMaxDurationSeconds(30);
|
|
|
+ // teExamActivity.setEnable(1);
|
|
|
+ // teExamActivity.setOpeningSeconds(30);
|
|
|
+ // teExamActivity.setStartTime(new Date());
|
|
|
+ // teExamActivity.setFinishTime(new Date());
|
|
|
+ // teExamActivity.setCreateTime(new Date());
|
|
|
+ // teExamActivityService.insertInfo(tableName, teExamActivity);
|
|
|
+ //
|
|
|
+ // //考试科目
|
|
|
+ // TEExamCourse teExamCourse = new TEExamCourse();
|
|
|
+ // teExamCourse.setId(Constants.idGen.next());
|
|
|
+ // teExamCourse.setExamId(teExam.getId());
|
|
|
+ // teExamCourse.setCourseCode(RandomStringUtils.randomAlphanumeric(5));
|
|
|
+ // teExamCourse.setCourseName("测试科目1");
|
|
|
+ // teExamCourse.setObjectiveShuffle(1);
|
|
|
+ // teExamCourse.setOptionShuffle(1);
|
|
|
+ // teExamCourse.setPaperCount(1);
|
|
|
+ // teExamCourse.setHasAnswer(1);
|
|
|
+ // teExamCourse.setAudioPlayCount(1);
|
|
|
+ // teExamCourseService.save(teExamCourse);
|
|
|
+ //
|
|
|
+ // //考试试卷
|
|
|
+ // TEExamPaper teExamPaper = new TEExamPaper();
|
|
|
+ // teExamPaper.setId(Constants.idGen.next());
|
|
|
+ // teExamPaper.setName("test1");
|
|
|
+ // teExamPaper.setTotalScore(100D);
|
|
|
+ // teExamPaper.setPaperPath("123");
|
|
|
+ // teExamPaper.setDecryptSecret("345");
|
|
|
+ // teExamPaper.setEncryptMode(1);
|
|
|
+ // teExamPaper.setNeedVoiceAnswer(1);
|
|
|
+ // teExamPaper.setExamId(teExam.getId());
|
|
|
+ // teExamPaper.setCode("test1");
|
|
|
+ // teExamPaper.setCourseCode(teExamCourse.getCourseCode());
|
|
|
+ // teExamPaper.setAnswerPath("123");
|
|
|
+ // teExamPaper.setHasAudio(1);
|
|
|
+ // teExamPaper.setWeight(1D);
|
|
|
+ // teExamPaper.setAudioPlayCount(1);
|
|
|
+ // teExamPaperService.save(teExamPaper);
|
|
|
+ //
|
|
|
+ // //考生
|
|
|
+ // 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);
|
|
|
+ // teExamStudent.setRoomName("test1");
|
|
|
+ // teExamStudent.setEnable(1);
|
|
|
+ // teExamStudentService.save(teExamStudent);
|
|
|
+ //
|
|
|
+ // //todo
|
|
|
+ //// 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);
|
|
|
+ // //todo
|
|
|
+ //
|
|
|
+ //// 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);
|
|
|
+ //
|
|
|
+ // //todo
|
|
|
+ //// mongoTemplate.save(mteStudentEntity);
|
|
|
+ //// mongoTemplate.save(mteExamEntity);
|
|
|
+ //// mongoTemplate.save(mteExamActivityEntity);
|
|
|
+ //// mongoTemplate.save(mteExamPaperEntity);
|
|
|
+ //// mongoTemplate.save(mteExamCourseEntity);
|
|
|
+ //// mongoTemplate.save(mteExamStudentEntity);
|
|
|
+ ////
|
|
|
+ //// IPage<TEExamActivity> map = teExamActivityService.selectListPage(new Page<>(0, 10), tableName);
|
|
|
+ //// log.info("mysql map:{}", JacksonUtil.parseJson(map));
|
|
|
+ ////
|
|
|
+ //// 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));
|
|
|
+ ////// 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<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);
|
|
|
+ //// 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));
|
|
|
+ //// 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);
|
|
|
+ //// });
|
|
|
+ // //todo
|
|
|
+ //// teExamActivityService.dropTable(tableName);
|
|
|
+ // return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ // }
|
|
|
|
|
|
@ApiOperation(value = "登出接口")
|
|
|
@RequestMapping(value = "/logout", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
public Result logout() throws NoSuchAlgorithmException {
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
|
|
@@ -541,7 +550,8 @@ public class TBUserController {
|
|
|
//循环检查该用户下其他平台是否存在session,不存在则删除用户缓存和鉴权缓存
|
|
|
boolean delete = true;
|
|
|
for (Source s : Source.values()) {
|
|
|
- String sessionId = SessionUtil.digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), s.name());
|
|
|
+ String sessionId = SessionUtil
|
|
|
+ .digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), s.name());
|
|
|
if (Objects.nonNull(redisUtil.getUserSession(sessionId))) {
|
|
|
delete = false;
|
|
|
break;
|
|
@@ -552,7 +562,8 @@ public class TBUserController {
|
|
|
cacheService.removeAccountCache(tbUser.getId());
|
|
|
}
|
|
|
//mq发送消息start
|
|
|
- MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.USER.name(), SystemOperationEnum.LOGOUT, MqTagEnum.USER, String.valueOf(tbUser.getId()), tbUser.getLoginName());
|
|
|
+ MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.USER.name(), SystemOperationEnum.LOGOUT,
|
|
|
+ MqTagEnum.USER, String.valueOf(tbUser.getId()), tbUser.getLoginName());
|
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
//mq发送消息end
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
@@ -561,10 +572,17 @@ public class TBUserController {
|
|
|
// @CachePut(value = "user_cache", key = "'userCacheQuery'")
|
|
|
@ApiOperation(value = "用户查询接口")
|
|
|
@RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUserDto.class)})
|
|
|
- public Result query(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "登录名", required = false) @RequestParam(required = false) String loginName, @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name, @ApiParam(value = "角色", required = false) @RequestParam(required = false) String roleCode, @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "用户信息", response = TBUserDto.class) })
|
|
|
+ public Result query(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long id,
|
|
|
+ @ApiParam(value = "登录名", required = false) @RequestParam(required = false) String loginName,
|
|
|
+ @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
|
|
|
+ @ApiParam(value = "角色", required = false) @RequestParam(required = false) String roleCode,
|
|
|
+ @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable,
|
|
|
+ @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
|
|
|
+ @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
- IPage<TBUserDto> tbUserIPage = tbUserService.userQuery(new Page<>(pageNumber, pageSize), id, loginName, name, roleCode, enable, tbUser.getOrgId());
|
|
|
+ IPage<TBUserDto> tbUserIPage = tbUserService
|
|
|
+ .userQuery(new Page<>(pageNumber, pageSize), id, loginName, name, roleCode, enable, tbUser.getOrgId());
|
|
|
tbUserIPage.getRecords().forEach(s -> {
|
|
|
if (Objects.nonNull(s.getRoleNameStr())) {
|
|
|
s.setRoleName(Arrays.asList(s.getRoleNameStr().split(",")));
|
|
@@ -579,7 +597,7 @@ public class TBUserController {
|
|
|
// @CacheEvict(value = "user_cache", key = "'userCacheQuery'")
|
|
|
@ApiOperation(value = "用户新增/编辑接口")
|
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
@Transactional
|
|
|
public Result save(@ApiJsonObject(name = "userSave", value = {
|
|
|
@ApiJsonProperty(key = "id", type = "long", example = "1", description = "新增不需要主键"),
|
|
@@ -589,8 +607,7 @@ public class TBUserController {
|
|
|
@ApiJsonProperty(key = "password", description = "密码,新增必须"),
|
|
|
@ApiJsonProperty(key = "enable", type = "int", example = "1", description = "是否启用"),
|
|
|
@ApiJsonProperty(key = "mobileNumber", description = "手机号"),
|
|
|
- @ApiJsonProperty(key = "roleCode", description = "角色")
|
|
|
- }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
+ @ApiJsonProperty(key = "roleCode", description = "角色") }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
if (Objects.isNull(mapParameter)) {
|
|
|
throw new BusinessException(ExceptionResultEnum.USER_INFO_IS_NULL);
|
|
|
}
|
|
@@ -611,7 +628,7 @@ public class TBUserController {
|
|
|
throw new BusinessException("暂不支持多个角色");
|
|
|
}
|
|
|
if (Objects.isNull(tbUser.getId())) {
|
|
|
- tbUser.setId(Constants.idGen.next());
|
|
|
+ tbUser.setId(uidUtil.getId());
|
|
|
tbUser.setOrgId(orgId);
|
|
|
tbUser.setCreateId(loginUser.getId());
|
|
|
if (Objects.nonNull(roleSet) && roleSet.size() > 0) {
|
|
@@ -640,7 +657,9 @@ public class TBUserController {
|
|
|
AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
|
|
|
if (Objects.nonNull(authDto)) {
|
|
|
for (Source s : Source.values()) {
|
|
|
- String sessionId = SessionUtil.digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), s.name());
|
|
|
+ String sessionId = SessionUtil
|
|
|
+ .digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()),
|
|
|
+ s.name());
|
|
|
redisUtil.deleteUserSession(sessionId);
|
|
|
}
|
|
|
}
|
|
@@ -651,8 +670,10 @@ public class TBUserController {
|
|
|
log.error("请求出错", e);
|
|
|
if (e instanceof DuplicateKeyException) {
|
|
|
String errorColumn = e.getCause().toString();
|
|
|
- String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
- throw new BusinessException("机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
|
|
|
+ String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
|
|
|
+ .replaceAll("'", "");
|
|
|
+ throw new BusinessException(
|
|
|
+ "机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
|
|
|
} else if (e instanceof BusinessException) {
|
|
|
throw new BusinessException(e.getMessage());
|
|
|
} else {
|
|
@@ -664,7 +685,7 @@ public class TBUserController {
|
|
|
|
|
|
@ApiOperation(value = "获取短信验证码接口")
|
|
|
@RequestMapping(value = "/getVerifyCode", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"verifyCode\":123456}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"verifyCode\":123456}", response = Result.class) })
|
|
|
public Result getVerifyCode(@ApiParam(value = "登录名", required = true) @RequestParam String loginName) {
|
|
|
if (Objects.isNull(loginName) || Objects.equals(loginName, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
|
|
@@ -674,7 +695,7 @@ public class TBUserController {
|
|
|
|
|
|
@ApiOperation(value = "获取短信验证码接口")
|
|
|
@RequestMapping(value = "/validate/verifyCode", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
public Result validateVerifyCode(@ApiParam(value = "验证码", required = true) @RequestParam String verifyCode) {
|
|
|
if (Objects.isNull(verifyCode) || Objects.equals(verifyCode, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.VERIFYCODE_IS_NULL);
|
|
@@ -684,7 +705,7 @@ public class TBUserController {
|
|
|
|
|
|
@ApiOperation(value = "二次验证获取短信验证码接口")
|
|
|
@RequestMapping(value = "/validate/getVerifyCode", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
public Result validateGetVerifyCode() {
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
@@ -692,11 +713,10 @@ public class TBUserController {
|
|
|
@ApiOperation(value = "用户停用/启用接口")
|
|
|
@RequestMapping(value = "/enable", method = RequestMethod.POST)
|
|
|
@Transactional
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
public Result enableUser(@ApiJsonObject(name = "enableUser", value = {
|
|
|
@ApiJsonProperty(key = "id", type = "long", example = "1", description = "用户id"),
|
|
|
- @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "停用/启用")
|
|
|
- }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> user) {
|
|
|
+ @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "停用/启用") }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> user) {
|
|
|
if (Objects.isNull(user.get("id")) || Objects.equals(user.get("id"), "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.USER_ID_IS_NULL);
|
|
|
}
|
|
@@ -718,12 +738,11 @@ public class TBUserController {
|
|
|
|
|
|
@ApiOperation(value = "用户修改密码接口")
|
|
|
@RequestMapping(value = "/updatePwd", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class) })
|
|
|
@Transactional
|
|
|
public Result userUpdatePwd(@ApiJsonObject(name = "userUpdatePwd", value = {
|
|
|
@ApiJsonProperty(key = "id", type = "long", example = "1", description = "用户ID"),
|
|
|
- @ApiJsonProperty(key = "password", description = "新密码")
|
|
|
- }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
+ @ApiJsonProperty(key = "password", description = "新密码") }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
if (Objects.isNull(mapParameter.get("id")) || Objects.equals(mapParameter.get("id"), "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.USER_ID_IS_NULL);
|
|
|
}
|