|
|
@@ -1,6 +1,7 @@
|
|
|
package com.mooctest.crowd.domain.domainobject;
|
|
|
|
|
|
import com.mooctest.crowd.domain.exception.BaseException;
|
|
|
+import com.mooctest.crowd.domain.exception.SystemAdministratorException;
|
|
|
import lombok.Data;
|
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
@@ -30,6 +31,7 @@ public class User {
|
|
|
private EvaluationAgency evaluationAgency;
|
|
|
private PersonalAuthentication personalAuthentication;
|
|
|
private EnterpriseAuthentication enterpriseAuthentication;
|
|
|
+ private SystemAdministratorToUser systemAdministratorToUser;
|
|
|
private List<Role> roleList;
|
|
|
|
|
|
@Override
|
|
|
@@ -50,8 +52,9 @@ public class User {
|
|
|
", createTime=" + createTime +
|
|
|
", regionalManager=" + regionalManager +
|
|
|
", evaluationAgency=" + evaluationAgency +
|
|
|
- ", personalAuth=" + personalAuthentication +
|
|
|
- ", companyAuth=" + enterpriseAuthentication +
|
|
|
+ ", personalAuthentication=" + personalAuthentication +
|
|
|
+ ", enterpriseAuthentication=" + enterpriseAuthentication +
|
|
|
+ ", systemAdministratorToUser=" + systemAdministratorToUser +
|
|
|
", roleList=" + roleList +
|
|
|
'}';
|
|
|
}
|
|
|
@@ -89,15 +92,20 @@ public class User {
|
|
|
* 同意通过个人认证
|
|
|
* @return
|
|
|
*/
|
|
|
- public User passPersonalAuthApplication() {
|
|
|
- PersonalAuthentication personalAuth = this.getPersonalAuthentication();
|
|
|
+ public User passPersonalAuthApplication(User personalUser) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ if(this.getSystemAdministratorToUser() == null){
|
|
|
+ throw new SystemAdministratorException("当前用户不是系统管理员,没有权限进行认证审核操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ PersonalAuthentication personalAuth = personalUser.getPersonalAuthentication();
|
|
|
if(personalAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
throw new BaseException("当前是未通过认证状态,不可通过认证,需对认证信息进行修改后再提交认证申请");
|
|
|
}else if(personalAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
}else{
|
|
|
- this.setPersonalAuthentication(personalAuth.passAuthentication());
|
|
|
- return this;
|
|
|
+ personalAuth.passAuthentication();
|
|
|
+ return personalUser;
|
|
|
// List<Role> roleList = this.getRoleList();
|
|
|
// Role role = new Role();
|
|
|
// role.setId(1L);
|
|
|
@@ -106,8 +114,18 @@ public class User {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public User personalAuthFailure(String explain) {
|
|
|
- PersonalAuthentication personalAuth = this.getPersonalAuthentication();
|
|
|
+ /**
|
|
|
+ * 驳回个人认证,并说明驳回原因
|
|
|
+ * @param explain
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User personalAuthFailure(User personalUser, String explain) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ if(this.getSystemAdministratorToUser() == null){
|
|
|
+ throw new SystemAdministratorException("当前用户不是系统管理员,没有权限进行认证审核操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ PersonalAuthentication personalAuth = personalUser.getPersonalAuthentication();
|
|
|
if(personalAuth.getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
}else {
|
|
|
@@ -116,9 +134,26 @@ public class User {
|
|
|
}else if(personalAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
throw new BaseException("当前已通过认证,不可拒绝认证");
|
|
|
}else {
|
|
|
- this.setPersonalAuthentication(personalAuth.rejectAuthentication(explain));
|
|
|
- return this;
|
|
|
+ personalAuth.rejectAuthentication(explain);
|
|
|
+ return personalUser;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人认证信息
|
|
|
+ * @param modifyAuth
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User updatePersonalAuthInfo(PersonalAuthentication modifyAuth){
|
|
|
+ if (this.getEvaluationAgency()!=null || this.getEnterpriseAuthentication()!=null)
|
|
|
+ throw new BaseException("已有其他认证信息,不可对个人认证进行操作");
|
|
|
+ this.getPersonalAuthentication().updateAuthInfo(modifyAuth);
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public User deletePersonalAuthInfo() {
|
|
|
+ this.getPersonalAuthentication().deleteAuth();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
}
|