-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EVDOC01-163: Afegir missatge i opció de mostrar informes d'assistènci…
…a (CSV) (#39)
- Loading branch information
Showing
20 changed files
with
417 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,7 @@ | |
import org.sakaiproject.authz.api.SecurityService; | ||
import org.sakaiproject.exception.IdUnusedException; | ||
import org.sakaiproject.meetings.api.MeetingService; | ||
import org.sakaiproject.meetings.api.model.AttendeeType; | ||
import org.sakaiproject.meetings.api.model.Meeting; | ||
import org.sakaiproject.meetings.api.model.MeetingAttendee; | ||
import org.sakaiproject.meetings.api.model.*; | ||
import org.sakaiproject.meetings.controller.data.GroupData; | ||
import org.sakaiproject.meetings.controller.data.MeetingData; | ||
import org.sakaiproject.meetings.controller.data.NotificationType; | ||
|
@@ -43,17 +41,18 @@ | |
import org.sakaiproject.microsoft.api.MicrosoftCommonService; | ||
import org.sakaiproject.microsoft.api.MicrosoftSynchronizationService; | ||
import org.sakaiproject.microsoft.api.SakaiProxy; | ||
import org.sakaiproject.microsoft.api.data.MeetingRecordingData; | ||
import org.sakaiproject.microsoft.api.data.SakaiCalendarEvent; | ||
import org.sakaiproject.microsoft.api.data.TeamsMeetingData; | ||
import org.sakaiproject.microsoft.api.data.*; | ||
import org.sakaiproject.microsoft.api.exceptions.MicrosoftCredentialsException; | ||
import org.sakaiproject.site.api.Group; | ||
import org.sakaiproject.site.api.Site; | ||
import org.sakaiproject.user.api.User; | ||
import org.sakaiproject.util.ResourceLoader; | ||
import org.springframework.beans.BeanUtils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ContentDisposition; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
@@ -104,7 +103,17 @@ public class MeetingsController { | |
private static final String NOTIF_CONTENT = "notification.content"; | ||
private static final String SMTP_FROM = "[email protected]"; | ||
private static final String NO_REPLY = "no-reply@"; | ||
|
||
private static final String MEETING_ATTENDANCE_REPORT = rb.getString("meeting.attendance_report"); | ||
private static final String MEETING_COLUMN_NAME = rb.getString("meeting.column_name"); | ||
private static final String MEETING_COLUMN_EMAIL = rb.getString("meeting.column_email"); | ||
private static final String MEETING_COLUMN_ROL = rb.getString("meeting.column_role"); | ||
private static final String MEETING_COLUMN_DURATION = rb.getString("meeting.column_duration"); | ||
private static final String MEETING_DURATION_INTERVAL = rb.getString("meeting.interval_duration"); | ||
private static final String MEETING_ENTRY_DATE = rb.getString("meeting.entry_date"); | ||
private static final String MEETING_EXIT_DATE = rb.getString("meeting.exit_date"); | ||
private static final String MEETING_DETAILS= rb.getString("meeting.details"); | ||
|
||
|
||
/** | ||
* Check if there's an user logged | ||
* @return | ||
|
@@ -593,6 +602,42 @@ public void deleteMeeting(@PathVariable String meetingId) throws MeetingsExcepti | |
throw new MeetingsException(e.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
@GetMapping(value = "/meeting/{meetingId}/attendanceReport", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<?> getMeetingAttendanceReport(@PathVariable String meetingId, @RequestParam(required = false) String format) throws MeetingsException { | ||
checkCurrentUserInMeeting(meetingId); | ||
Meeting meeting = meetingService.getMeeting(meetingId); | ||
String onlineMeetingId = meetingService.getMeetingProperty(meeting, ONLINE_MEETING_ID); | ||
String organizerEmail = meetingService.getMeetingProperty(meeting, ORGANIZER_USER); | ||
checkUpdatePermissions(meeting.getSiteId()); | ||
microsoftCommonService.inicializeMeetingNameColumns(MEETING_ATTENDANCE_REPORT, MEETING_COLUMN_NAME, MEETING_COLUMN_EMAIL, MEETING_COLUMN_ROL, MEETING_COLUMN_DURATION, MEETING_DURATION_INTERVAL, MEETING_ENTRY_DATE, MEETING_EXIT_DATE, MEETING_DETAILS); | ||
|
||
try { | ||
List<AttendanceRecord> attendanceRecords = microsoftCommonService.getMeetingAttendanceReport(onlineMeetingId, organizerEmail); | ||
if ("pdf".equalsIgnoreCase(format)) { | ||
String filename = "attendance_report.pdf"; | ||
ContentDisposition contentDisposition = ContentDisposition.builder("attachment").filename(filename).build(); | ||
|
||
byte[] pdfContent = microsoftCommonService.createAttendanceReportPdf(attendanceRecords); | ||
|
||
return ResponseEntity.ok() | ||
.headers(h -> h.setContentDisposition(contentDisposition)) | ||
.contentType(MediaType.APPLICATION_PDF) | ||
.body(pdfContent); | ||
} else if ("csv".equalsIgnoreCase(format)) { | ||
byte[] csvContent = microsoftCommonService.createAttendanceReportCsv(attendanceRecords); | ||
return ResponseEntity.ok() | ||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"attendance_report.csv\"") | ||
.contentType(MediaType.TEXT_PLAIN) | ||
.body(csvContent); | ||
} else { | ||
return ResponseEntity.ok(attendanceRecords); | ||
} | ||
} catch (Exception e) { | ||
log.error("Error al obtener el reporte de asistencia", e); | ||
throw new MeetingsException(e.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Get i18n bundle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
notification.subject=A new meeting \u0027{0}\u0027 has been published in the site \u0027{1}\u0027 | ||
notification.content=You have been invited to participate in the meeting <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.attendance_report=Attendance Report | ||
meeting.column_name=Name | ||
meeting.column_email=Email | ||
meeting.column_role=Role | ||
meeting.column_duration=Duration (seconds) | ||
meeting.entry_date=Entry Date | ||
meeting.exit_date=Exit Date | ||
meeting.interval_duration=Interval Duration (seconds) | ||
meeting.details=Assistance Details for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
notification.subject=S\u2019ha publicat una nova reuni\u00F3 \u0027{0}\u0027 a l\u2019espai {1} | ||
notification.content=Ha sigut convidat a participar en la reuni\u00F3 <i>{0}</i>. | ||
notification.content=Ha sigut convidat a participar en la reuni\u00F3 <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.attendance_report=Report d\u2019assitencia | ||
meeting.column_name=Nom | ||
meeting.column_email=Correu | ||
meeting.column_role=Rol | ||
meeting.column_duration=Duraci\u00F3 (segons) | ||
meeting.entry_date=Data d\u2019entrada | ||
meeting.exit_date=Data d\u2019eixida | ||
meeting.interval_duration=Interval Duration (seconds) | ||
meeting.details=Detalls d\u2019assist\u00e8ncia per a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
notification.subject=Se ha publicado una nueva reuni\u00F3n \u0027{0}\u0027 en el sitio {1} | ||
notification.content=Ha sido invitado a participar en la reuni\u00F3n <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.attendance_report=Reporte de assistencia | ||
meeting.column_name=Nombre | ||
meeting.column_email=Email | ||
meeting.column_role=Rol | ||
meeting.column_duration=Duraci\u00f3n (segundos) | ||
meeting.entry_date=Fecha de entrada | ||
meeting.exit_date=Fecha de salida | ||
meeting.interval_duration=Intervalo de Duraci\u00f3n (segundos) | ||
meeting.details=Detalles de asistencia para |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...soft-integration/api/src/java/org/sakaiproject/microsoft/api/data/AttendanceInterval.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.sakaiproject.microsoft.api.data; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Data; | ||
|
||
import java.time.Instant; | ||
|
||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class AttendanceInterval { | ||
public String joinDateTime; | ||
public String leaveDateTime; | ||
public int durationInSeconds; | ||
|
||
public String getJoinDateTime() { return joinDateTime; } | ||
public void setJoinDateTime(String joinDateTime) { this.joinDateTime = joinDateTime; } | ||
|
||
public String getLeaveDateTime() { return leaveDateTime; } | ||
public void setLeaveDateTime(String leaveDateTime) { this.leaveDateTime = leaveDateTime; } | ||
|
||
public int getDurationInSeconds() { return durationInSeconds; } | ||
public void setDurationInSeconds(int durationInSeconds) { this.durationInSeconds = durationInSeconds; } | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
microsoft-integration/api/src/java/org/sakaiproject/microsoft/api/data/AttendanceRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.sakaiproject.microsoft.api.data; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import java.util.List; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class AttendanceRecord { | ||
|
||
private String email; | ||
public String id; | ||
public String displayName; | ||
private String role; | ||
private int totalAttendanceInSeconds; | ||
private List<AttendanceInterval> attendanceIntervals; | ||
|
||
public String getEmail() { return email; } | ||
public void setEmail(String email) { this.email = email; } | ||
|
||
public String getId() { return id; } | ||
public void setId(String id) { this.id = id; } | ||
|
||
public String getDisplayName() { return displayName; } | ||
public void setDisplayName(String displayName) { this.displayName = displayName; } | ||
|
||
public String getRole() { return role; } | ||
public void setRole(String role) { this.role = role; } | ||
|
||
public int getTotalAttendanceInSeconds() { return totalAttendanceInSeconds; } | ||
public void setTotalAttendanceInSeconds(int totalAttendanceInSeconds) { this.totalAttendanceInSeconds = totalAttendanceInSeconds; } | ||
|
||
public List<AttendanceInterval> getAttendanceIntervals() { return attendanceIntervals; } | ||
public void setAttendanceIntervals(List<AttendanceInterval> attendanceIntervals) { this.attendanceIntervals = attendanceIntervals; } | ||
} | ||
|
Oops, something went wrong.