【SaaS云会议系统开发】项目实训——2021.07.21
作者:互联网
【SaaS云会议系统开发】我的会议功能迭代开发
Model层修改
MyMeetingVo类将数据进行封装
package com.rjxy.Model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MyMeetingVo {
@JsonProperty("reserved_meeting_list")
private List<MyMeetingElement> reservedMeetingList;
@JsonProperty("holding_meeting_list")
private List<MyMeetingElement> holdingMeetingList;
}
新增MyMeetingElement类
package com.rjxy.Model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@AllArgsConstructor
@Data
public class MyMeetingElement {
@JsonProperty("meeting_id")
private Integer meetingId;
@JsonProperty("meeting_number")
private Integer meetingNumber;
@JsonProperty("type")
private Integer type;
@JsonProperty("host_id")
private Integer hostId;
@JsonProperty("hostname")
private String hostName;
@JsonProperty("topic")
private String topic;
@JsonProperty("scheduled_start_time")
private long scheduledStartTime;
@JsonProperty("scheduled_end_time")
private long scheduledEndTime;
@JsonProperty("start_time")
private long startTime;
@JsonProperty("participants")
private List<MeetingUser> participants;
}
Controller层修改
对ManageMeetingController的GetMyMeetingList方法进行对应的修改
@GetMapping("/my_meeting_list")
public Result<MyMeetingVo> GetMyMeetingList(HttpServletRequest request) {
User user = SessionUtil.GetUser(request);
if (user == null || user.getId() == 0) {
// 返回用户未登录状态
return Result.error(ErrorEnum.SessionNotExistError);
}
MyMeetingVo result = new MyMeetingVo(new ArrayList<>(), new ArrayList<>());
List<Meeting> meetingList = meetingService.getMeetingByUserId(user.getId());
for (Meeting meeting : meetingList) {
if (meeting != null) {
User host = userService.getUserById(meeting.getHostId());
List<MeetingUser> participants = new ArrayList<>();
//会议未开始,从mysql中获取参会人,参会人的概念这里指的是邀请的参会人
if (meeting.getStatus() == MeetingStatusEnum.NotStarted.getStatus()){
participants = meetingService.getParticipantsByMeetingId(meeting.getId());
result.getReservedMeetingList().add(new MyMeetingElement(meeting.getId(), meeting.getMeetingNumber(), meeting.getType(), host.getId(), host.getName(), meeting.getTopic(), meeting.getScheduledStartTime().getTime(), meeting.getScheduledEndTime().getTime(), 0, participants));
}
//会议进行中,从redis中获取参会人,参会人的概念这里指的是正在参会的人
else if (meeting.getStatus() == MeetingStatusEnum.Holding.getStatus()) {
Set<String> members = stringRedisTemplate.boundSetOps(meetingUserIntimeSetPrefix + meeting.getMeetingNumber()).members();
if (members != null) {
for (String member : members) {
User participant = userService.getUserById(Integer.parseInt(member));
participants.add(new MeetingUser(participant.getId(), participant.getName(), ""));
}
}
result.getHoldingMeetingList().add(new MyMeetingElement(meeting.getId(), meeting.getMeetingNumber(), meeting.getType(), host.getId(), host.getName(), meeting.getTopic(), meeting.getScheduledStartTime().getTime(), meeting.getScheduledEndTime().getTime(), meeting.getStartTime().getTime(), participants));
}
}
}
return Result.success(result);
}
标签:JsonProperty,2021.07,getId,SaaS,private,实训,new,import,meeting 来源: https://blog.csdn.net/tongye1984/article/details/119149318