RoomResult.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package com.ym.pojo;
  2. import com.alibaba.fastjson.JSONObject;
  3. import lombok.Data;
  4. import lombok.Getter;
  5. import lombok.Setter;
  6. import java.util.ArrayList;
  7. import java.util.Date;
  8. import java.util.List;
  9. import java.util.Map;
  10. /**
  11. * Created by weiqinxiao on 2019/2/28.
  12. */
  13. public class RoomResult {
  14. private @Getter @Setter String roomId;
  15. private @Getter @Setter Date startTime;
  16. private @Getter @Setter int surplusTime;
  17. private @Getter @Setter String imToken;
  18. private @Getter @Setter String authorization;
  19. private @Getter List<MemberResult> members = new ArrayList<>();
  20. private @Getter @Setter String display;
  21. private @Getter @Setter List<WhiteboardResult> whiteboards = new ArrayList<>();
  22. private @Getter @Setter MemberResult userInfo;
  23. @Data
  24. public static class MemberResult {
  25. String userId;
  26. String userName;
  27. String headUrl;
  28. int role;
  29. Date joinTime;
  30. boolean camera;
  31. boolean microphone;
  32. boolean handUpOn;
  33. boolean examSongDownloadOn;
  34. CustomMessage playMidiJson;
  35. }
  36. @Data
  37. public static class WhiteboardResult {
  38. String whiteboardId;
  39. String name;
  40. int curPg;
  41. }
  42. public void setMembers(List<RoomMember> roomMemberList, Map<Integer,String> midiMap,Map<Integer,String> examSongMap) {
  43. for (RoomMember member : roomMemberList) {
  44. MemberResult result = new MemberResult();
  45. result.setUserId(member.getUid());
  46. result.setJoinTime(member.getJoinDt());
  47. result.setRole(member.getRole());
  48. result.setMicrophone(member.isMic());
  49. result.setCamera(member.isCamera());
  50. result.setUserName(member.getName());
  51. result.setHandUpOn(member.isHand());
  52. result.setHeadUrl(member.getHeadUrl());
  53. result.setPlayMidiJson(JSONObject.parseObject(midiMap.get(Integer.parseInt(member.getUid())),CustomMessage.class));
  54. result.setExamSongDownloadOn(examSongMap.get(member.getRid())=="0"?false:true);
  55. members.add(result);
  56. }
  57. }
  58. public void setWhiteboards(List<Whiteboard> whiteboardList) {
  59. for (Whiteboard wb : whiteboardList) {
  60. WhiteboardResult r = new WhiteboardResult();
  61. r.setName(wb.getName());
  62. r.setWhiteboardId(wb.getWbid());
  63. r.setCurPg(wb.getCurPg());
  64. whiteboards.add(r);
  65. }
  66. }
  67. }