Quellcode durchsuchen

修改认证申请时转态判断

guochao vor 6 Jahren
Ursprung
Commit
66060a4dee
1 geänderte Dateien mit 5 neuen und 14 gelöschten Zeilen
  1. 5 14
      core/src/main/java/com/mooctest/crowd/domain/domainobject/User.java

+ 5 - 14
core/src/main/java/com/mooctest/crowd/domain/domainobject/User.java

@@ -65,12 +65,9 @@ public class User {
      * @return
      */
     public User applyAgencyAuthentication(EvaluationAgency evaluationAgency) {
-        if (this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
+        if (this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null || this.getPersonalAuthentication() != null)
             throw new BaseException("已有认证信息,不可再次认证");
-        if (this.getEvaluationAgency()!=null && this.getEvaluationAgency().getIsAuthentication() != AuthenticationStatus.isAuthenticated){
-            evaluationAgency.setId(this.getEvaluationAgency().getId());
-            this.setEvaluationAgency(evaluationAgency.applyAuthentication(this.id));
-        }
+        this.setEvaluationAgency(evaluationAgency.applyAuthentication(this.id));
         return this;
     }
 
@@ -140,12 +137,9 @@ public class User {
      * @return
      */
     public User applyPersonalAuthentication(PersonalAuthentication personalAuth) {
-        if (this.getEvaluationAgency()!=null || this.getEnterpriseAuthentication()!=null)
+        if (this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null || this.getPersonalAuthentication() != null)
             throw new BaseException("已有认证信息,不可再次认证");
-        if (this.getPersonalAuthentication()!=null && this.getPersonalAuthentication().getIsAuthentication() != AuthenticationStatus.isAuthenticated){
-            personalAuth.setId(this.getPersonalAuthentication().getId());
-            this.setPersonalAuthentication(personalAuth.applyAuthentication(this.id));
-        }
+        this.setPersonalAuthentication(personalAuth.applyAuthentication(this.id));
         return this;
     }
 
@@ -207,10 +201,7 @@ public class User {
     public User applyEnterpriseAuthentication(EnterpriseAuthentication enterpriseAuth) {
         if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
             throw new BaseException("已有认证信息,不可再次认证");
-        if (this.getEnterpriseAuthentication()!=null && this.getEnterpriseAuthentication().getIsAuthentication() != AuthenticationStatus.isAuthenticated){
-            enterpriseAuth.setId(this.getEnterpriseAuthentication().getId());
-            this.setEnterpriseAuthentication(enterpriseAuth.applyAuthentication(this.id));
-        }
+        this.setEnterpriseAuthentication(enterpriseAuth.applyAuthentication(this.id));
         return this;
     }