파견 관리 UX 고도화, 비동기 알림 트리거 연동 보강, 스마트 라우팅 반영 작업
This commit is contained in:
@@ -26,6 +26,7 @@ public class DispatchHistoryService {
|
||||
private final DispatchHistoryRepository dispatchHistoryRepository;
|
||||
private final EmployeeRepository employeeRepository;
|
||||
private final ProjectRepository projectRepository;
|
||||
private final NotificationPublisher notificationPublisher;
|
||||
|
||||
public List<DispatchHistory> findByEmployeeId(Long empId) {
|
||||
employeeRepository.findById(empId)
|
||||
@@ -78,7 +79,22 @@ public class DispatchHistoryService {
|
||||
.startDate(request.startDate() != null ? request.startDate() : LocalDate.now())
|
||||
.build();
|
||||
|
||||
return dispatchHistoryRepository.save(history);
|
||||
DispatchHistory saved = dispatchHistoryRepository.save(history);
|
||||
|
||||
// Update employee dispatch status to DISPATCHED
|
||||
employee.setDispatchStatus(com.srsystem.entity.enums.DispatchStatus.DISPATCHED);
|
||||
employeeRepository.save(employee);
|
||||
|
||||
// Send notification
|
||||
notificationPublisher.publish(new com.srsystem.dto.NotificationEvent(
|
||||
"DISPATCH_ASSIGNED",
|
||||
"신규 파견 발령: " + project.getProjectName(),
|
||||
String.format("'%s' 프로젝트에 %s 역할로 파견 등록되었습니다.", project.getProjectName(), request.roleTitle()),
|
||||
"/dispatch",
|
||||
employee.getEmpId()
|
||||
));
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -86,6 +102,16 @@ public class DispatchHistoryService {
|
||||
DispatchHistory history = dispatchHistoryRepository.findById(dispatchId)
|
||||
.orElseThrow(() -> new BusinessException(ErrorCode.DISPATCH_NOT_FOUND));
|
||||
history.setEndDate(LocalDate.now());
|
||||
return dispatchHistoryRepository.save(history);
|
||||
DispatchHistory saved = dispatchHistoryRepository.save(history);
|
||||
|
||||
// Check active dispatches remaining
|
||||
List<DispatchHistory> active = dispatchHistoryRepository.findByEmployee_EmpIdAndEndDateIsNull(history.getEmployee().getEmpId());
|
||||
if (active.isEmpty()) {
|
||||
Employee emp = history.getEmployee();
|
||||
emp.setDispatchStatus(com.srsystem.entity.enums.DispatchStatus.WAITING);
|
||||
employeeRepository.save(emp);
|
||||
}
|
||||
|
||||
return saved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,13 +159,20 @@ public class ReportService {
|
||||
|
||||
Report updated = reportRepository.save(report);
|
||||
|
||||
// Send notification if rejected
|
||||
if (request.status() == ReportStatus.REJECTED) {
|
||||
// Send notification for approval or rejection
|
||||
if (request.status() == ReportStatus.REJECTED || request.status() == ReportStatus.APPROVED) {
|
||||
String type = request.status() == ReportStatus.APPROVED ? "REPORT_APPROVED" : "REPORT_REJECTED";
|
||||
String title = request.status() == ReportStatus.APPROVED ? "업무 보고서 승인 완료" : "업무 보고서 반려 안내";
|
||||
String message = request.status() == ReportStatus.APPROVED
|
||||
? String.format("%s 일자 보고서가 승인되었습니다.", report.getTargetDate())
|
||||
: String.format("%s 일자 보고서가 반려되었습니다. 사유: %s", report.getTargetDate(), request.reviewComment());
|
||||
|
||||
Notification notification = Notification.builder()
|
||||
.user(report.getUser())
|
||||
.type("REPORT_REJECTED")
|
||||
.title("Daily report rejected")
|
||||
.message(String.format("Your report for %s was rejected. Reason: %s", report.getTargetDate(), request.reviewComment()))
|
||||
.type(type)
|
||||
.title(title)
|
||||
.message(message)
|
||||
.linkUrl("/work-reports")
|
||||
.isRead('N')
|
||||
.build();
|
||||
notificationRepository.save(notification);
|
||||
|
||||
@@ -33,6 +33,7 @@ public class TicketService {
|
||||
private final TicketCommentRepository ticketCommentRepository;
|
||||
private final EmployeeRepository employeeRepository;
|
||||
private final ProjectRepository projectRepository;
|
||||
private final com.srsystem.listener.NotificationPublisher notificationPublisher;
|
||||
|
||||
public Page<IssueTicket> getTickets(TicketStatus status, String category, String priority, String keyword, Pageable pageable, Long requesterId) {
|
||||
Page<Ticket> tickets;
|
||||
@@ -132,6 +133,16 @@ public class TicketService {
|
||||
}
|
||||
|
||||
Ticket updated = ticketRepository.save(ticket);
|
||||
|
||||
// Send notification to assignee
|
||||
notificationPublisher.publish(new com.srsystem.dto.NotificationEvent(
|
||||
"TICKET_ASSIGNED",
|
||||
"SR 티켓 담당 지정: #" + updated.getTicketId(),
|
||||
String.format("'%s' 티켓 담당자로 지정되었습니다.", updated.getTitle()),
|
||||
"/issues",
|
||||
assignee.getEmpId()
|
||||
));
|
||||
|
||||
return toIssueTicket(updated);
|
||||
}
|
||||
|
||||
@@ -149,6 +160,18 @@ public class TicketService {
|
||||
ticket.setResolutionNote(resolutionNote);
|
||||
|
||||
Ticket updated = ticketRepository.save(ticket);
|
||||
|
||||
// Send notification to requester
|
||||
if (updated.getRequester() != null) {
|
||||
notificationPublisher.publish(new com.srsystem.dto.NotificationEvent(
|
||||
"TICKET_RESOLVED",
|
||||
"SR 티켓 처리 완료: #" + updated.getTicketId(),
|
||||
String.format("요청하신 '%s' 티켓이 처리 완료되었습니다.", updated.getTitle()),
|
||||
"/issues",
|
||||
updated.getRequester().getEmpId()
|
||||
));
|
||||
}
|
||||
|
||||
return toIssueTicket(updated);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user