| 1 | 0 | package jp.co.y_net.amm.dao; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.Comparator; |
| 5 | |
|
| 6 | |
import jp.co.y_net.amm.common.AppUtils; |
| 7 | |
|
| 8 | |
|
| 9 | 0 | public class Grpusr extends AppDto implements Serializable { |
| 10 | |
private static final long serialVersionUID = 1L; |
| 11 | |
|
| 12 | 0 | public static final Integer STATUS_未設定 = -1; |
| 13 | 0 | public static final Integer STATUS_招待中 = 0; |
| 14 | 0 | public static final Integer STATUS_参加中 = 1; |
| 15 | 0 | public static final Integer STATUS_脱退 = 2; |
| 16 | |
|
| 17 | 0 | public static final Integer STATUS_ADMIN_未設定 = -1; |
| 18 | 0 | public static final Integer STATUS_ADMIN_移管依頼中 = 0; |
| 19 | 0 | public static final Integer STATUS_ADMIN_移管完了 = 1; |
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
private Integer grpusrid; |
| 24 | |
private Integer grpid; |
| 25 | |
private Integer usrid; |
| 26 | |
|
| 27 | |
private Long invitationdate; |
| 28 | |
private Long joindate; |
| 29 | |
private Long leavedate; |
| 30 | |
private Long admindate; |
| 31 | |
|
| 32 | |
private Integer statusadmin; |
| 33 | |
private Integer status; |
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
public Integer getGrpusrid() { |
| 42 | 0 | return grpusrid; |
| 43 | |
} |
| 44 | |
public void setGrpusrid(Integer grpusrid) { |
| 45 | 0 | this.grpusrid = grpusrid; |
| 46 | 0 | } |
| 47 | |
public Integer getGrpid() { |
| 48 | 0 | return grpid; |
| 49 | |
} |
| 50 | |
public void setGrpid(Integer grpid) { |
| 51 | 0 | this.grpid = grpid; |
| 52 | 0 | } |
| 53 | |
public Integer getUsrid() { |
| 54 | 0 | return usrid; |
| 55 | |
} |
| 56 | |
public void setUsrid(Integer usrid) { |
| 57 | 0 | this.usrid = usrid; |
| 58 | 0 | } |
| 59 | |
public Long getInvitationdate() { |
| 60 | 0 | return invitationdate; |
| 61 | |
} |
| 62 | |
public void setInvitationdate(Long invitationdate) { |
| 63 | 0 | this.invitationdate = invitationdate; |
| 64 | 0 | } |
| 65 | |
public Long getJoindate() { |
| 66 | 0 | return joindate; |
| 67 | |
} |
| 68 | |
public void setJoindate(Long joindate) { |
| 69 | 0 | this.joindate = joindate; |
| 70 | 0 | } |
| 71 | |
public Long getLeavedate() { |
| 72 | 0 | return leavedate; |
| 73 | |
} |
| 74 | |
public void setLeavedate(Long leavedate) { |
| 75 | 0 | this.leavedate = leavedate; |
| 76 | 0 | } |
| 77 | |
public Long getAdmindate() { |
| 78 | 0 | return admindate; |
| 79 | |
} |
| 80 | |
public void setAdmindate(Long admindate) { |
| 81 | 0 | this.admindate = admindate; |
| 82 | 0 | } |
| 83 | |
public Integer getStatusadmin() { |
| 84 | 0 | return statusadmin; |
| 85 | |
} |
| 86 | |
public void setStatusadmin(Integer statusadmin) { |
| 87 | 0 | this.statusadmin = statusadmin; |
| 88 | 0 | } |
| 89 | |
public Integer getStatus() { |
| 90 | 0 | return status; |
| 91 | |
} |
| 92 | |
public void setStatus(Integer status) { |
| 93 | 0 | this.status = status; |
| 94 | 0 | } |
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
public static class JoindateComparator implements Comparator<Grpusr> { |
| 107 | |
|
| 108 | 0 | private boolean desc = false; |
| 109 | |
|
| 110 | 0 | public JoindateComparator(boolean desc) { |
| 111 | 0 | this.desc = desc; |
| 112 | 0 | } |
| 113 | |
|
| 114 | |
@Override |
| 115 | |
public int compare(Grpusr o1, Grpusr o2) { |
| 116 | 0 | int reverse = 1; |
| 117 | 0 | if(desc) { |
| 118 | 0 | reverse = -1; |
| 119 | |
} |
| 120 | |
|
| 121 | 0 | Long n1 = 0L; |
| 122 | 0 | Long n2 = 0L; |
| 123 | 0 | if(o1 != null && o1.getJoindate() != null) n1 = o1.getJoindate(); |
| 124 | 0 | if(o2 != null && o2.getJoindate() != null) n2 = o2.getJoindate(); |
| 125 | |
|
| 126 | |
|
| 127 | 0 | if(n1 == 0L) { |
| 128 | 0 | if(o1 != null && o1.getInvitationdate() != null) n1 = o1.getInvitationdate(); |
| 129 | |
} |
| 130 | 0 | if(n2 == 0L) { |
| 131 | 0 | if(o2 != null && o2.getInvitationdate() != null) n2 = o2.getInvitationdate(); |
| 132 | |
} |
| 133 | |
|
| 134 | 0 | return Long.compare(n1, n2) * reverse; |
| 135 | |
} |
| 136 | |
} |
| 137 | |
|
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
public String getStatus合算() { |
| 147 | 0 | if(this.status == null || STATUS_未設定.equals(this.status) ) { |
| 148 | 0 | return ""; |
| 149 | |
} |
| 150 | 0 | if(STATUS_招待中.equals(this.status)) { |
| 151 | 0 | return "招待中"; |
| 152 | |
} |
| 153 | 0 | if(STATUS_参加中.equals(this.status)) { |
| 154 | |
|
| 155 | 0 | if(STATUS_ADMIN_移管依頼中.equals(this.status)) { |
| 156 | 0 | return "移管依頼中"; |
| 157 | |
} |
| 158 | 0 | return "参加中"; |
| 159 | |
} |
| 160 | 0 | return ""; |
| 161 | |
} |
| 162 | |
public void set脱退設定() { |
| 163 | 0 | this.setLeavedate(AppUtils.createNowLong()); |
| 164 | 0 | this.setStatus(Grpusr.STATUS_脱退); |
| 165 | 0 | } |
| 166 | |
|
| 167 | |
|
| 168 | |
} |
| 169 | |
|