mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 00:57:13 +08:00 
			
		
		
		
	chore: 优化部分代码
This commit is contained in:
		| @@ -69,7 +69,7 @@ public class OnlineUserServiceImpl implements OnlineUserService { | |||||||
|         }) |         }) | ||||||
|             .map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true)) |             .map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true)) | ||||||
|             .collect(Collectors.groupingBy(token -> Convert.toLong(StpUtil.getLoginIdByToken(token)))); |             .collect(Collectors.groupingBy(token -> Convert.toLong(StpUtil.getLoginIdByToken(token)))); | ||||||
|         // 过滤 Token |         // 筛选数据 | ||||||
|         for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) { |         for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) { | ||||||
|             Long userId = entry.getKey(); |             Long userId = entry.getKey(); | ||||||
|             UserContext userContext = UserContextHolder.getContext(userId); |             UserContext userContext = UserContextHolder.getContext(userId); | ||||||
|   | |||||||
| @@ -65,8 +65,6 @@ import java.io.IOException; | |||||||
|     Api.EXPORT}) |     Api.EXPORT}) | ||||||
| public class UserController extends BaseController<UserService, UserResp, UserDetailResp, UserQuery, UserReq> { | public class UserController extends BaseController<UserService, UserResp, UserDetailResp, UserQuery, UserReq> { | ||||||
|  |  | ||||||
|     private final UserService userService; |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public BaseIdResp<Long> add(@Validated(CrudValidationGroup.Add.class) @RequestBody UserReq req) { |     public BaseIdResp<Long> add(@Validated(CrudValidationGroup.Add.class) @RequestBody UserReq req) { | ||||||
|         String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword())); |         String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword())); | ||||||
| @@ -81,7 +79,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe | |||||||
|     @SaCheckPermission("system:user:import") |     @SaCheckPermission("system:user:import") | ||||||
|     @GetMapping(value = "/import/template", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) |     @GetMapping(value = "/import/template", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) | ||||||
|     public void downloadImportTemplate(HttpServletResponse response) throws IOException { |     public void downloadImportTemplate(HttpServletResponse response) throws IOException { | ||||||
|         userService.downloadImportTemplate(response); |         baseService.downloadImportTemplate(response); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "解析导入数据", description = "解析导入数据") |     @Operation(summary = "解析导入数据", description = "解析导入数据") | ||||||
| @@ -89,14 +87,14 @@ public class UserController extends BaseController<UserService, UserResp, UserDe | |||||||
|     @PostMapping("/import/parse") |     @PostMapping("/import/parse") | ||||||
|     public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") MultipartFile file) { |     public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") MultipartFile file) { | ||||||
|         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); |         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); | ||||||
|         return userService.parseImport(file); |         return baseService.parseImport(file); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "导入数据", description = "导入数据") |     @Operation(summary = "导入数据", description = "导入数据") | ||||||
|     @SaCheckPermission("system:user:import") |     @SaCheckPermission("system:user:import") | ||||||
|     @PostMapping(value = "/import") |     @PostMapping(value = "/import") | ||||||
|     public UserImportResp importUser(@Validated @RequestBody UserImportReq req) { |     public UserImportResp importUser(@Validated @RequestBody UserImportReq req) { | ||||||
|         return userService.importUser(req); |         return baseService.importUser(req); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "重置密码", description = "重置用户登录密码") |     @Operation(summary = "重置密码", description = "重置用户登录密码") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user