feat: schoolName field, 입사일 label, password reset for admin
This commit is contained in:
@@ -257,6 +257,15 @@ public class EmployeeController {
|
||||
return ResponseEntity.ok(ApiResponse.ok("비밀번호가 변경되었습니다", null));
|
||||
}
|
||||
|
||||
@Operation(summary = "비밀번호 초기화", description = "관리자가 직원 비밀번호를 초기화합니다 (ADMIN 전용)")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@PutMapping("/{empId}/reset-password")
|
||||
public ResponseEntity<ApiResponse<Void>> resetPassword(
|
||||
@PathVariable Long empId, @RequestBody Map<String, String> body) {
|
||||
employeeService.resetPassword(empId, body.get("newPassword"));
|
||||
return ResponseEntity.ok(ApiResponse.ok("비밀번호가 초기화되었습니다", null));
|
||||
}
|
||||
|
||||
// ---- Batch ----
|
||||
|
||||
@Operation(summary = "직원 일괄 등록", description = "엑셀 파일로 직원을 일괄 등록합니다")
|
||||
@@ -279,6 +288,7 @@ public class EmployeeController {
|
||||
emp.setPassword("batch1234!");
|
||||
if (row.containsKey("생년월일")) emp.setBirthDate(java.time.LocalDate.parse(row.get("생년월일")));
|
||||
if (row.containsKey("학력")) emp.setEducation(row.get("학력"));
|
||||
if (row.containsKey("학교명")) emp.setSchoolName(row.get("학교명"));
|
||||
if (row.containsKey("학과")) emp.setMajor(row.get("학과"));
|
||||
if (row.containsKey("입사일")) emp.setJoinedDate(java.time.LocalDate.parse(row.get("입사일")));
|
||||
return emp;
|
||||
@@ -318,7 +328,7 @@ public class EmployeeController {
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping("/batch/template")
|
||||
public ResponseEntity<byte[]> downloadTemplate() throws Exception {
|
||||
String[] headers = {"로그인ID", "이름", "이메일", "전화번호", "권한", "재직상태", "파견상태", "생년월일", "학력", "학과", "입사일"};
|
||||
String[] headers = {"로그인ID", "이름", "이메일", "전화번호", "권한", "재직상태", "파견상태", "생년월일", "학력", "학교명", "학과", "입사일"};
|
||||
Map<Integer, String[]> dropdowns = Map.of(
|
||||
4, new String[]{"ADMIN", "MANAGER", "EMPLOYEE"},
|
||||
5, new String[]{"ACTIVE", "ON_LEAVE", "RESIGNED"},
|
||||
|
||||
@@ -21,5 +21,6 @@ public record EmployeeSummary(
|
||||
String major,
|
||||
LocalDate graduationDate,
|
||||
String residence,
|
||||
String profileImage
|
||||
String profileImage,
|
||||
String schoolName
|
||||
) {}
|
||||
|
||||
@@ -74,6 +74,9 @@ public class Employee extends BaseEntity {
|
||||
@Column(name = "major", length = 100)
|
||||
private String major;
|
||||
|
||||
@Column(name = "school_name", length = 200)
|
||||
private String schoolName;
|
||||
|
||||
@Column(name = "graduation_date")
|
||||
private LocalDate graduationDate;
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ public class EmployeeService {
|
||||
employee.setGraduationDate(updateRequest.getGraduationDate());
|
||||
employee.setResidence(updateRequest.getResidence());
|
||||
employee.setProfileImage(updateRequest.getProfileImage());
|
||||
employee.setSchoolName(updateRequest.getSchoolName());
|
||||
|
||||
return employee;
|
||||
}
|
||||
@@ -144,6 +145,13 @@ public class EmployeeService {
|
||||
return employeeRepository.save(employee);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void resetPassword(Long empId, String newPassword) {
|
||||
Employee employee = findById(empId);
|
||||
employee.setPassword(passwordEncoder.encode(newPassword));
|
||||
employeeRepository.save(employee);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void delete(Long empId) {
|
||||
Employee employee = findById(empId);
|
||||
@@ -171,7 +179,8 @@ public class EmployeeService {
|
||||
employee.getMajor(),
|
||||
employee.getGraduationDate(),
|
||||
employee.getResidence(),
|
||||
employee.getProfileImage()
|
||||
employee.getProfileImage(),
|
||||
employee.getSchoolName()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE tb_employee ADD COLUMN IF NOT EXISTS school_name VARCHAR(200);
|
||||
Reference in New Issue
Block a user