|
|
@@ -60,7 +60,7 @@ public class User {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 机构认证
|
|
|
+ * 机构认证——申请
|
|
|
* @param evaluationAgency
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -71,14 +71,80 @@ public class User {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public User passApplication() {
|
|
|
- this.getEvaluationAgency().setIsAuthentication(AuthenticationStatus.isAuthenticated);
|
|
|
- this.getEvaluationAgency().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构认证——通过
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User passAgencyAuthApplication(User agencyUser) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
+
|
|
|
+ EvaluationAgency evaluationAgency = agencyUser.getEvaluationAgency();
|
|
|
+ if(evaluationAgency.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ throw new BaseException("当前是未通过认证状态,不可通过认证,需对认证信息进行修改后再提交认证申请");
|
|
|
+ }else if(evaluationAgency.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
+ }else{
|
|
|
+ evaluationAgency.passAuthentication();
|
|
|
+ List<Role> roleList = this.getRoleList();
|
|
|
+ Role role = new Role();
|
|
|
+ role.setId(2L);
|
|
|
+ roleList.add(role);
|
|
|
+ agencyUser.setRoleList(roleList);
|
|
|
+ return agencyUser;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构认证——驳回,并说明驳回原因
|
|
|
+ * @param explain
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User rejectAgencyAuth(User agencyUser, String explain) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
+
|
|
|
+ EvaluationAgency evaluationAgency = agencyUser.getEvaluationAgency();
|
|
|
+ if(evaluationAgency.getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
+ throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
+ }else {
|
|
|
+ if(evaluationAgency.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ throw new BaseException("当前已是未通过认证状态,不可再次拒绝认证");
|
|
|
+ }else if(evaluationAgency.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ throw new BaseException("当前已通过认证,不可拒绝认证");
|
|
|
+ }else {
|
|
|
+ evaluationAgency.rejectAuthentication(explain);
|
|
|
+ return agencyUser;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构认证——信息修改
|
|
|
+ * @param modifyAuth
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User updateAgencyAuthInfo(EvaluationAgency modifyAuth){
|
|
|
+ if (this.getEnterpriseAuthentication()!=null || this.getPersonalAuthentication()!=null)
|
|
|
+ throw new BaseException("已有其他认证信息,不可对认证未企业用户");
|
|
|
+
|
|
|
+ this.getEvaluationAgency().updateAuthInfo(modifyAuth);
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 个人实名认证
|
|
|
+ * 机构认证——删除
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User deleteAgencyAuthInfo() {
|
|
|
+ this.getEvaluationAgency().deleteAuth();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 个人认证——申请
|
|
|
* @return
|
|
|
*/
|
|
|
public User applyPersonalAuthentication(PersonalAuthentication personalAuth) {
|
|
|
@@ -89,14 +155,12 @@ public class User {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 同意通过个人认证
|
|
|
+ * 个人认证——通过
|
|
|
* @return
|
|
|
*/
|
|
|
public User passPersonalAuthApplication(User personalUser) {
|
|
|
//判断是否为系统管理员
|
|
|
- if(this.getSystemAdministratorToUser() == null){
|
|
|
- throw new SystemAdministratorException("当前用户不是系统管理员,没有权限进行认证审核操作");
|
|
|
- }
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
|
|
|
PersonalAuthentication personalAuth = personalUser.getPersonalAuthentication();
|
|
|
if(personalAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
@@ -115,15 +179,13 @@ public class User {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 驳回个人认证,并说明驳回原因
|
|
|
+ * 个人认证——驳回,并说明驳回原因
|
|
|
* @param explain
|
|
|
* @return
|
|
|
*/
|
|
|
- public User personalAuthFailure(User personalUser, String explain) {
|
|
|
+ public User personalAuthReject(User personalUser, String explain) {
|
|
|
//判断是否为系统管理员
|
|
|
- if(this.getSystemAdministratorToUser() == null){
|
|
|
- throw new SystemAdministratorException("当前用户不是系统管理员,没有权限进行认证审核操作");
|
|
|
- }
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
|
|
|
PersonalAuthentication personalAuth = personalUser.getPersonalAuthentication();
|
|
|
if(personalAuth.getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
@@ -141,19 +203,112 @@ public class User {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改个人认证信息
|
|
|
+ * 个人认证——信息修改
|
|
|
* @param modifyAuth
|
|
|
* @return
|
|
|
*/
|
|
|
public User updatePersonalAuthInfo(PersonalAuthentication modifyAuth){
|
|
|
if (this.getEvaluationAgency()!=null || this.getEnterpriseAuthentication()!=null)
|
|
|
throw new BaseException("已有其他认证信息,不可对个人认证进行操作");
|
|
|
+
|
|
|
this.getPersonalAuthentication().updateAuthInfo(modifyAuth);
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 个人认证——删除
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public User deletePersonalAuthInfo() {
|
|
|
this.getPersonalAuthentication().deleteAuth();
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证——申请
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User applyEnterpriseAuthentication(EnterpriseAuthentication enterpriseAuth) {
|
|
|
+ if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
|
|
|
+ throw new BaseException("已有认证信息,不可再次认证");
|
|
|
+ this.setEnterpriseAuthentication(enterpriseAuth.applyAuthentication(this.id));
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证——通过
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User passEnterpriseAuthApplication(User enterpriseUser) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
+
|
|
|
+ EnterpriseAuthentication enterpriseAuth = enterpriseUser.getEnterpriseAuthentication();
|
|
|
+ if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ throw new BaseException("当前是未通过认证状态,不可通过认证,需对认证信息进行修改后再提交认证申请");
|
|
|
+ }else if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
+ }else{
|
|
|
+ enterpriseAuth.passAuthentication();
|
|
|
+ List<Role> roleList = this.getRoleList();
|
|
|
+ Role role = new Role();
|
|
|
+ role.setId(5L);
|
|
|
+ roleList.add(role);
|
|
|
+ enterpriseUser.setRoleList(roleList);
|
|
|
+ return enterpriseUser;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证——驳回,并说明驳回原因
|
|
|
+ * @param explain
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User enterpriseAuthReject(User enterpriseUser, String explain) {
|
|
|
+ //判断是否为系统管理员
|
|
|
+ judgeIsSystemAdministrator();
|
|
|
+
|
|
|
+ EnterpriseAuthentication enterpriseAuth = enterpriseUser.getEnterpriseAuthentication();
|
|
|
+ if(enterpriseAuth.getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
+ throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
+ }else {
|
|
|
+ if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ throw new BaseException("当前已是未通过认证状态,不可再次拒绝认证");
|
|
|
+ }else if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ throw new BaseException("当前已通过认证,不可拒绝认证");
|
|
|
+ }else {
|
|
|
+ enterpriseAuth.rejectAuthentication(explain);
|
|
|
+ return enterpriseUser;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证——修改
|
|
|
+ * @param modifyAuth
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User updateEnterpriseAuthInfo(EnterpriseAuthentication modifyAuth){
|
|
|
+ if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null)
|
|
|
+ throw new BaseException("已有其他认证信息,不可对认证未企业用户");
|
|
|
+
|
|
|
+ this.getEnterpriseAuthentication().updateAuthInfo(modifyAuth);
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证——删除
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public User deleteEnterpriseAuthInfo() {
|
|
|
+ this.getEnterpriseAuthentication().deleteAuth();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断是否为系统管理员
|
|
|
+ private void judgeIsSystemAdministrator(){
|
|
|
+ if(this.getSystemAdministratorToUser() == null){
|
|
|
+ throw new SystemAdministratorException("当前用户不是系统管理员,没有权限进行认证审核操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|