|
|
|
@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
package com.yau.digitalrmb.issuance.domain.model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 模块二(发行数字货币)资产归属主体。
|
|
|
|
|
|
|
|
* 商业银行库存、央行发行库、准备金账户都按该主体隔离,互不影响。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public final class IssuanceOwner {
|
|
|
|
|
|
|
|
private final String userId;
|
|
|
|
|
|
|
|
private final long schoolId;
|
|
|
|
|
|
|
|
private final long classId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IssuanceOwner(String userId, long schoolId, long classId) {
|
|
|
|
|
|
|
|
if (userId == null || userId.trim().isEmpty()) {
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("资产归属用户不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.userId = userId.trim();
|
|
|
|
|
|
|
|
this.schoolId = schoolId;
|
|
|
|
|
|
|
|
this.classId = classId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static IssuanceOwner of(String userId, long schoolId, long classId) {
|
|
|
|
|
|
|
|
return new IssuanceOwner(userId, schoolId, classId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getUserId() {
|
|
|
|
|
|
|
|
return userId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getSchoolId() {
|
|
|
|
|
|
|
|
return schoolId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getClassId() {
|
|
|
|
|
|
|
|
return classId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean equals(Object other) {
|
|
|
|
|
|
|
|
if (this == other) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(other instanceof IssuanceOwner)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IssuanceOwner that = (IssuanceOwner) other;
|
|
|
|
|
|
|
|
return schoolId == that.schoolId && classId == that.classId && userId.equals(that.userId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
|
|
|
|
return Objects.hash(userId, schoolId, classId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
|
|
|
|
return "IssuanceOwner{" + userId + "@" + schoolId + "/" + classId + "}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|