fix: 403 handler, data integrity handler, phone column size
This commit is contained in:
@@ -10,6 +10,7 @@ import com.srsystem.entity.enums.EmpStatus;
|
||||
import com.srsystem.entity.enums.RoleCode;
|
||||
import com.srsystem.exception.BusinessException;
|
||||
import com.srsystem.exception.ErrorCode;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import com.srsystem.repository.DispatchHistoryRepository;
|
||||
import com.srsystem.repository.EmployeeEmergencyContactRepository;
|
||||
import com.srsystem.repository.EmployeeRepository;
|
||||
@@ -90,7 +91,11 @@ public class EmployeeService {
|
||||
if (employee.getDispatchStatus() == null) employee.setDispatchStatus(DispatchStatus.WAITING);
|
||||
|
||||
employee.setPassword(passwordEncoder.encode(employee.getPassword()));
|
||||
return employeeRepository.save(employee);
|
||||
try {
|
||||
return employeeRepository.save(employee);
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
throw new BusinessException(ErrorCode.DUPLICATE_LOGIN_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
Reference in New Issue
Block a user