|
|
@@ -62,17 +62,9 @@ public class User {
|
|
|
* @return
|
|
|
*/
|
|
|
public User applyAgencyAuthentication(EvaluationAgency evaluationAgency) {
|
|
|
- if (this.getEvaluationAgency()!=null)
|
|
|
- throw new BaseException("已认证为评测机构,不可重复认证");
|
|
|
- if (this.getPersonalAuthentication()!=null)
|
|
|
- throw new BaseException("已实名认证,不可认证为评测机构");
|
|
|
- if (this.getEnterpriseAuthentication()!=null)
|
|
|
- throw new BaseException("已认证为企业用户,不可认证为评测机构");
|
|
|
- evaluationAgency.setUserId(this.id);
|
|
|
- evaluationAgency.setIsAuthentication(AuthenticationStatus.isAuthenIng);
|
|
|
- evaluationAgency.setIsDeleted(DeletedStatus.isNotDeleted);
|
|
|
- evaluationAgency.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
|
|
- this.setEvaluationAgency(evaluationAgency);
|
|
|
+ if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
|
|
|
+ throw new BaseException("已有认证信息,不可再次认证");
|
|
|
+ this.setEvaluationAgency(evaluationAgency.applyAuthentication(this.id));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
@@ -86,56 +78,45 @@ public class User {
|
|
|
* 个人实名认证
|
|
|
* @return
|
|
|
*/
|
|
|
- public User applyPersonalAuthentication(PersonalAuthentication personalAuthentication) {
|
|
|
- if (this.getEvaluationAgency()!=null)
|
|
|
- throw new BaseException("已认证为评测机构,不可认证为个人用户");
|
|
|
- if (this.getPersonalAuthentication()!=null)
|
|
|
- throw new BaseException("已实名认证,不可重复认证");
|
|
|
- if (this.getEnterpriseAuthentication()!=null)
|
|
|
- throw new BaseException("已认证为企业用户,不可认证为个人用户");
|
|
|
- personalAuthentication.setUserId(this.id);
|
|
|
- personalAuthentication.setIsAuthentication(AuthenticationStatus.isAuthenIng);
|
|
|
- personalAuthentication.setIsDeleted(DeletedStatus.isNotDeleted);
|
|
|
- personalAuthentication.setApplyTime(new Timestamp(System.currentTimeMillis()));
|
|
|
- personalAuthentication.setExplain("");
|
|
|
- this.setPersonalAuthentication(personalAuthentication);
|
|
|
+ public User applyPersonalAuthentication(PersonalAuthentication personalAuth) {
|
|
|
+ if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
|
|
|
+ throw new BaseException("已有认证信息,不可再次认证");
|
|
|
+ this.setPersonalAuthentication(personalAuth.applyAuthentication(this.id));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 同意通过个人认证
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public User passPersonalAuthApplication() {
|
|
|
- if(this.getPersonalAuthentication().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
- throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
+ PersonalAuthentication personalAuth = this.getPersonalAuthentication();
|
|
|
+ if(personalAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ throw new BaseException("当前是未通过认证状态,不可通过认证,需对认证信息进行修改后再提交认证申请");
|
|
|
+ }else if(personalAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
}else{
|
|
|
- if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
- throw new BaseException("当前是未通过认证状态,不可通过认证");
|
|
|
- }else if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
- throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
- }else{
|
|
|
- this.getPersonalAuthentication().setIsAuthentication(AuthenticationStatus.isAuthenticated);
|
|
|
- this.getPersonalAuthentication().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
- this.getPersonalAuthentication().setExplain("");
|
|
|
- List<Role> roleList = this.getRoleList();
|
|
|
- Role role = new Role();
|
|
|
- role.setId(1L);
|
|
|
- roleList.add(role);
|
|
|
- this.setRoleList(roleList);
|
|
|
- return this;
|
|
|
- }
|
|
|
+ this.setPersonalAuthentication(personalAuth.passAuthentication());
|
|
|
+ return this;
|
|
|
+// List<Role> roleList = this.getRoleList();
|
|
|
+// Role role = new Role();
|
|
|
+// role.setId(1L);
|
|
|
+// roleList.add(role);
|
|
|
+// this.setRoleList(roleList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public User personalAuthFailure(String explain) {
|
|
|
- if(this.getPersonalAuthentication().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
+ PersonalAuthentication personalAuth = this.getPersonalAuthentication();
|
|
|
+ if(personalAuth.getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
}else {
|
|
|
- if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ if(personalAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
throw new BaseException("当前已是未通过认证状态,不可再次拒绝认证");
|
|
|
- }else if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ }else if(personalAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
throw new BaseException("当前已通过认证,不可拒绝认证");
|
|
|
}else {
|
|
|
- this.getPersonalAuthentication().setIsAuthentication(AuthenticationStatus.isNotAuthenticated);
|
|
|
- this.getPersonalAuthentication().setExplain(explain);
|
|
|
- this.getPersonalAuthentication().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
+ this.setPersonalAuthentication(personalAuth.rejectAuthentication(explain));
|
|
|
return this;
|
|
|
}
|
|
|
}
|