Skip to content

Add Excel import feature for admin and instructors, fix student photo update - #50

Merged
NguyenTuKien merged 2 commits into
mainfrom
TOAN-04
May 3, 2026
Merged

NguyenTuKien merged 2 commits into
mainfrom
TOAN-04

Conversation

@NguyenTuKien

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 3, 2026 07:59
@sonarqubecloud

sonarqubecloud Bot commented May 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
10.3% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces async Excel import/export flows for admin and lecturer user management, and expands the student face-profile UX (including a required enrollment modal + improved update workflow).

Changes:

  • Add async Excel import with batch status polling (Redis-backed) and export endpoints for admin students/lecturers; update lecturer student import to queue/poll.
  • Add student face-profile navigation entry and a blocking enrollment modal when face is not enrolled; improve face-profile panel with polling + image validation.
  • UI pagination/page-size adjustments in admin/lecturer management screens.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
frontend/src/pages/StudentPage.jsx Adds face enrollment status check and required blocking modal + feature registration.
frontend/src/features/student/components/StudentUtilitiesPanel.jsx Adds “Ảnh khuôn mặt” utility item.
frontend/src/features/student/components/StudentMobileNav.jsx Adds face-profile to mobile utilities features set.
frontend/src/features/student/components/StudentFaceProfilePanel.jsx Adds silent refresh/polling, image validation, and pending overlay UX.
frontend/src/features/lecturer/components/LecturerStudentManagement.jsx Changes import to queued polling UX and adjusts page size/pagination rendering.
frontend/src/features/admin/hooks/useAdminStudentWorkspace.js Adds admin student import/export helpers and batch polling.
frontend/src/features/admin/hooks/useAdminLecturerWorkspace.js Adds admin lecturer import/export helpers and batch polling.
frontend/src/features/admin/components/AdminStudentManagement.jsx Adds import/export UI, import result modal, and client-side pagination.
frontend/src/features/admin/components/AdminSemesterManagement.jsx Minor confirmation/header text adjustments.
frontend/src/features/admin/components/AdminLecturerManagement.jsx Adds import/export UI, import result modal, and client-side pagination.
frontend/src/api/faceApi.js Adds cache-busting query params to face status/update-request endpoints.
frontend/src/api/adminUserExcelApi.js New API module for admin excel import/export + filename extraction.
frontend/package.json Adds xlsx dependency.
frontend/package-lock.json Lockfile updates for xlsx and related transitive deps.
backend/src/main/java/ct01/n06/backend/service/impl/LecturerServiceImpl.java Removes old synchronous lecturer import implementation.
backend/src/main/java/ct01/n06/backend/service/impl/AdminStudentServiceImpl.java Adds Excel export and introduces password-hash caching for created students.
backend/src/main/java/ct01/n06/backend/service/impl/AdminLecturerServiceImpl.java Adds Excel export helpers.
backend/src/main/java/ct01/n06/backend/service/RedisImportTrackerService.java New Redis tracker for import job status persistence.
backend/src/main/java/ct01/n06/backend/service/LecturerService.java Removes synchronous import method from interface.
backend/src/main/java/ct01/n06/backend/service/AsyncLecturerExcelImportService.java New async lecturer Excel import processor using EasyExcel + Redis job tracking.
backend/src/main/java/ct01/n06/backend/service/AsyncExcelImportService.java New async student Excel import processor using EasyExcel + Redis job tracking.
backend/src/main/java/ct01/n06/backend/service/AdminStudentService.java Adds exportStudentsExcel() API.
backend/src/main/java/ct01/n06/backend/service/AdminLecturerService.java Adds exportLecturersExcel() API.
backend/src/main/java/ct01/n06/backend/repository/UserRepository.java Adds queries to fetch all emails/usernames lower-cased for import dedupe.
backend/src/main/java/ct01/n06/backend/repository/StudentRepository.java Adds query to fetch all student codes lower-cased.
backend/src/main/java/ct01/n06/backend/repository/LecturerRepository.java Adds query to fetch all lecturer codes lower-cased.
backend/src/main/java/ct01/n06/backend/dto/admin/JobStatus.java New DTO for import batch tracking.
backend/src/main/java/ct01/n06/backend/controller/admin/AdminStudentController.java Adds async import endpoints + export endpoint for students.
backend/src/main/java/ct01/n06/backend/controller/admin/AdminLecturerController.java Adds async import/status endpoints + export endpoint for lecturers.
backend/src/main/java/ct01/n06/backend/controller/LecturerController.java Switches lecturer student import to async queue + adds batch status endpoint.
backend/src/main/java/ct01/n06/backend/config/AsyncConfig.java Enables Spring async processing.
backend/pom.xml Adds EasyExcel dependency.
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

frontend/src/features/lecturer/components/LecturerStudentManagement.jsx:550

  • Phân trang cho bảng desktop đã bị xóa, trong khi footer hiện tại dùng class mobile-pagination bị CSS ẩn ở ≥768px. Kết quả là trên desktop không còn cách chuyển trang (chỉ xem được PAGE_SIZE dòng đầu). Cần thêm lại pagination cho .table-panel hoặc hiển thị footer pagination cho cả desktop.

        </div>

        {/* Mobile pagination */}
        <footer className="table-footer mobile-pagination">

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (result) {
setImportResult(result);
setShowErrors(false);
}
Comment on lines +54 to +57
private final java.util.concurrent.ConcurrentHashMap<String, String> passwordHashCache = new java.util.concurrent.ConcurrentHashMap<>();

private String getCachedPasswordHash(String rawPassword) {
return passwordHashCache.computeIfAbsent(rawPassword, passwordEncoder::encode);
Comment on lines +299 to +303
setIsImporting(true);
try {
const result = await importLecturers(files);
if (result) {
setImportResult(result);
Comment on lines +66 to +70
setStatus((prevStatus) => {
if (silent && prevStatus?.status === "PENDING_APPROVAL" && statusPayload?.status === "APPROVED") {
if (onCompleted) setTimeout(onCompleted, 1500);
}
return statusPayload;
Comment on lines +81 to +85
@PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public java.util.Map<String, String> importExcel(@RequestParam("file") org.springframework.web.multipart.MultipartFile file) {
if (file.isEmpty()) {
throw new ct01.n06.backend.exception.ApiException(HttpStatus.BAD_REQUEST, "File Excel trống.");
}
Comment on lines 27 to 31
@RestController
@RequestMapping("/lecturer/students")
public class LecturerController {

private final LecturerService lecturerService;
Comment on lines +100 to +105
boolean isExcel = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)
|| "application/vnd.ms-excel".equals(contentType)
|| (originalFilename != null && originalFilename.endsWith(".xlsx"));

if (!isExcel) {
throw new ApiException(HttpStatus.BAD_REQUEST, "Chỉ chấp nhận file Excel (.xlsx)");
Comment thread frontend/package.json
Comment on lines +23 to +24
"react-router-dom": "^7.13.2",
"xlsx": "^0.18.5"
Comment on lines 72 to 76
@PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ImportStudentsResponse importExcel(
public java.util.Map<String, String> importExcel(
@RequestParam String lecturerId,
@RequestPart("file") MultipartFile file
@RequestParam("file") org.springframework.web.multipart.MultipartFile file
) {
@NguyenTuKien
NguyenTuKien merged commit fcba854 into main May 3, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants