Ver Fonte

修改密码退出和新增违纪日志

wangliang há 2 anos atrás
pai
commit
319bb06992

+ 14 - 1
themis-admin/src/main/java/com/qmth/themis/admin/api/TBUserController.java

@@ -762,7 +762,7 @@ public class TBUserController {
     @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) throws NoSuchAlgorithmException {
         if (Objects.isNull(mapParameter.get(SystemConstant.ID)) || Objects.equals(mapParameter.get(SystemConstant.ID), "")) {
             throw new BusinessException(ExceptionResultEnum.USER_ID_IS_NULL);
         }
@@ -779,7 +779,20 @@ public class TBUserController {
         tbUser.setPassword(password);
         tbUser.setUpdateId(currentUser.getId());
         tbUserService.updateById(tbUser);
+
+        AuthDto authDto = cacheService.addAccountAuthCache(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());
+                if (Objects.nonNull(redisUtil.getUserSession(sessionId))) {
+                    redisUtil.deleteUserSession(sessionId);
+                }
+            }
+        }
+
         cacheService.removeAccountCache(tbUser.getId());
+        cacheService.removeAccountAuthCache(tbUser.getId());
         return ResultUtil.ok(true);
     }
 }

+ 2 - 2
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -321,8 +321,8 @@ public class TIeInvigilateController {
         QueryWrapper<TEExamStudentLog> teExamStudentLogQueryWrapper = new QueryWrapper<>();
         teExamStudentLogQueryWrapper.lambda().eq(TEExamStudentLog::getExamStudentId, examStudentId)
                 .eq(TEExamStudentLog::getExamRecordId, examRecordId)
-                .ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_HANDLE.name())
-                .ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_REVOKE.name())
+//                .ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_HANDLE.name())
+//                .ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_REVOKE.name())
                 .orderByAsc(TEExamStudentLog::getCreateTime);
 //                .and(w -> w.ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_HANDLE.name()).or().ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_REVOKE.name()));
         List<TEExamStudentLog> teExamStudentLogList = teExamStudentLogService.list(teExamStudentLogQueryWrapper);