|
|
@@ -28,8 +28,8 @@ public class User {
|
|
|
|
|
|
private RegionalManager regionalManager;
|
|
|
private EvaluationAgency evaluationAgency;
|
|
|
- private PersonalAuth personalAuth;
|
|
|
- private CompanyAuth companyAuth;
|
|
|
+ private PersonalAuthentication personalAuthentication;
|
|
|
+ private EnterpriseAuthentication enterpriseAuthentication;
|
|
|
private List<Role> roleList;
|
|
|
|
|
|
@Override
|
|
|
@@ -50,124 +50,23 @@ public class User {
|
|
|
", createTime=" + createTime +
|
|
|
", regionalManager=" + regionalManager +
|
|
|
", evaluationAgency=" + evaluationAgency +
|
|
|
- ", personalAuth=" + personalAuth +
|
|
|
- ", companyAuth=" + companyAuth +
|
|
|
+ ", personalAuth=" + personalAuthentication +
|
|
|
+ ", companyAuth=" + enterpriseAuthentication +
|
|
|
", roleList=" + roleList +
|
|
|
'}';
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 创建测试项目(普通用户)
|
|
|
-// * @param crowdTestProject
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public CrowdTestProject createCrowdTestProject(CrowdTestProject crowdTestProject) {
|
|
|
-// crowdTestProject.setUserId(this.getId());
|
|
|
-// crowdTestProject.setDistributionProvince(this.getProvince());
|
|
|
-// crowdTestProject.setDistributionCity(this.getCity());
|
|
|
-// crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_CREATED);
|
|
|
-// return crowdTestProject;
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 接收任务(测评机构)
|
|
|
-// * @param crowdTestProject
|
|
|
-// * @param crowdTestTaskCode
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public CrowdTestProject receiveTask(CrowdTestProject crowdTestProject, String crowdTestTaskCode) {
|
|
|
-//
|
|
|
-// List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
|
|
|
-// List<CrowdTestTask> crowdTestTaskListResult = new ArrayList<>();
|
|
|
-// for(CrowdTestTask crowdTestTask : crowdTestTaskList){
|
|
|
-// if(crowdTestTaskCode.equals(crowdTestTask.getCode())){
|
|
|
-// if(crowdTestTask.getStatus() != (CrowdTestTaskStatus.HAS_RECEIVED - 1)){
|
|
|
-// throw new CrowdTestTaskException("任务当前状态不能被接收,当前状态为:"+crowdTestTask.getStatus());
|
|
|
-// }else if(!(this.getProvince().equals(crowdTestTask.getDistributionProvince())&&this.getCity().equals(crowdTestTask.getDistributionCity()))){
|
|
|
-// throw new CrowdTestTaskException("测评机构区域不符合任务区域的要求");
|
|
|
-// }else{
|
|
|
-// crowdTestTask.setEvaluationAgencyId(this.getId());
|
|
|
-// crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// crowdTestTaskListResult.add(crowdTestTask);
|
|
|
-// }
|
|
|
-// crowdTestProject.setCrowdTestTaskList(crowdTestTaskList);
|
|
|
-// return crowdTestProject;
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 创建测试报告(测评机构)
|
|
|
-// * @param crowdTestTaskCode
|
|
|
-// * @param crowdTestReport
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public CrowdTestProject createCrowdTestReport(CrowdTestProject crowdTestProject,String crowdTestTaskCode, CrowdTestReport crowdTestReport) {
|
|
|
-// List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
|
|
|
-// List<CrowdTestTask> crowdTestTaskListResult = new ArrayList<>();
|
|
|
-// for(CrowdTestTask crowdTestTask : crowdTestTaskList){
|
|
|
-// if(crowdTestTask.getCode().equals(crowdTestTaskCode)){
|
|
|
-// List<CrowdTestReport> crowdTestReportList = crowdTestTask.getCrowdTestReportList();
|
|
|
-// crowdTestReportList.add(crowdTestReport);
|
|
|
-// crowdTestTask.setCrowdTestReportList(crowdTestReportList);
|
|
|
-// }
|
|
|
-// crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_REPORTED);
|
|
|
-// crowdTestTaskListResult.add(crowdTestTask);
|
|
|
-// }
|
|
|
-// crowdTestProject.setCrowdTestTaskList(crowdTestTaskListResult);
|
|
|
-// return crowdTestProject;
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 提交测试任务
|
|
|
-// * @param crowdTestProject
|
|
|
-// * @param crowdTestTaskCode
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public CrowdTestProject commitCrowdTestTask(CrowdTestProject crowdTestProject, String crowdTestTaskCode) {
|
|
|
-// List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
|
|
|
-// List<CrowdTestTask> crowdTestTaskListResult = new ArrayList<>();
|
|
|
-// for(CrowdTestTask crowdTestTask : crowdTestTaskList){
|
|
|
-// if(crowdTestTask.getCode().equals(crowdTestTaskCode)){
|
|
|
-// System.out.println("list:"+crowdTestTask.getCrowdTestReportList());
|
|
|
-// if(crowdTestTask.getCrowdTestReportList().size() == 0){
|
|
|
-// throw new CrowdTestTaskException("当前任务中没有报告,不能提交此任务");
|
|
|
-// }else if(crowdTestTask.getStatus() != (CrowdTestTaskStatus.HAS_COMMITED-1)){
|
|
|
-// throw new CrowdTestTaskException("任务状态有误,无法提交,任务状态为:"+crowdTestTask.getStatus());
|
|
|
-// }else if((CrowdTestTaskStatus.HAS_COMMITED - 1) == crowdTestTask.getStatus()){
|
|
|
-// crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_COMMITED);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// crowdTestTaskListResult.add(crowdTestTask);
|
|
|
-// }
|
|
|
-// crowdTestProject.setCrowdTestTaskList(crowdTestTaskListResult);
|
|
|
-// return crowdTestProject;
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 结束项目
|
|
|
-// * @param crowdTestProject
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public CrowdTestProject finishCrowdTestProjet(CrowdTestProject crowdTestProject) {
|
|
|
-// if(crowdTestProject.getStatus() != (CrowdTestProjectStatus.HAS_FINISHED - 1)){
|
|
|
-// throw new CrowdTestProjectException("项目不能被提交,当前状态为:"+crowdTestProject.getStatus());
|
|
|
-// }else{
|
|
|
-// crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_FINISHED);
|
|
|
-// }
|
|
|
-// return crowdTestProject;
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 机构认证
|
|
|
+ * @param evaluationAgency
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public User applyAgencyAuthentication(EvaluationAgency evaluationAgency) {
|
|
|
if (this.getEvaluationAgency()!=null)
|
|
|
throw new BaseException("已认证为评测机构,不可重复认证");
|
|
|
- if (this.getPersonalAuth()!=null)
|
|
|
+ if (this.getPersonalAuthentication()!=null)
|
|
|
throw new BaseException("已实名认证,不可认证为评测机构");
|
|
|
- if (this.getCompanyAuth()!=null)
|
|
|
+ if (this.getEnterpriseAuthentication()!=null)
|
|
|
throw new BaseException("已认证为企业用户,不可认证为评测机构");
|
|
|
evaluationAgency.setUserId(this.id);
|
|
|
evaluationAgency.setIsAuthentication(AuthenticationStatus.isAuthenIng);
|
|
|
@@ -187,34 +86,34 @@ public class User {
|
|
|
* 个人实名认证
|
|
|
* @return
|
|
|
*/
|
|
|
- public User applyPersonalAuthentication(PersonalAuth personalAuth) {
|
|
|
+ public User applyPersonalAuthentication(PersonalAuthentication personalAuthentication) {
|
|
|
if (this.getEvaluationAgency()!=null)
|
|
|
throw new BaseException("已认证为评测机构,不可认证为个人用户");
|
|
|
- if (this.getPersonalAuth()!=null)
|
|
|
+ if (this.getPersonalAuthentication()!=null)
|
|
|
throw new BaseException("已实名认证,不可重复认证");
|
|
|
- if (this.getCompanyAuth()!=null)
|
|
|
+ if (this.getEnterpriseAuthentication()!=null)
|
|
|
throw new BaseException("已认证为企业用户,不可认证为个人用户");
|
|
|
- personalAuth.setUserId(this.id);
|
|
|
- personalAuth.setIsAuthentication(AuthenticationStatus.isAuthenIng);
|
|
|
- personalAuth.setIsDeleted(DeletedStatus.isNotDeleted);
|
|
|
- personalAuth.setApplyTime(new Timestamp(System.currentTimeMillis()));
|
|
|
- personalAuth.setExplain("");
|
|
|
- this.setPersonalAuth(personalAuth);
|
|
|
+ personalAuthentication.setUserId(this.id);
|
|
|
+ personalAuthentication.setIsAuthentication(AuthenticationStatus.isAuthenIng);
|
|
|
+ personalAuthentication.setIsDeleted(DeletedStatus.isNotDeleted);
|
|
|
+ personalAuthentication.setApplyTime(new Timestamp(System.currentTimeMillis()));
|
|
|
+ personalAuthentication.setExplain("");
|
|
|
+ this.setPersonalAuthentication(personalAuthentication);
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
public User passPersonalAuthApplication() {
|
|
|
- if(this.getPersonalAuth().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
+ if(this.getPersonalAuthentication().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
}else{
|
|
|
- if(this.getPersonalAuth().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
throw new BaseException("当前是未通过认证状态,不可通过认证");
|
|
|
- }else if(this.getPersonalAuth().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ }else if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
throw new BaseException("当前已通过认证,不可再次进行认证");
|
|
|
}else{
|
|
|
- this.getPersonalAuth().setIsAuthentication(AuthenticationStatus.isAuthenticated);
|
|
|
- this.getPersonalAuth().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
- this.getPersonalAuth().setExplain("");
|
|
|
+ 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);
|
|
|
@@ -226,17 +125,17 @@ public class User {
|
|
|
}
|
|
|
|
|
|
public User personalAuthFailure(String explain) {
|
|
|
- if(this.getPersonalAuth().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
+ if(this.getPersonalAuthentication().getIsDeleted() == DeletedStatus.isDeleted){
|
|
|
throw new BaseException("当前认证信息已被删除,不可做认证状态改变操作");
|
|
|
}else {
|
|
|
- if(this.getPersonalAuth().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
+ if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
|
|
|
throw new BaseException("当前已是未通过认证状态,不可再次拒绝认证");
|
|
|
- }else if(this.getPersonalAuth().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
+ }else if(this.getPersonalAuthentication().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
|
|
|
throw new BaseException("当前已通过认证,不可拒绝认证");
|
|
|
}else {
|
|
|
- this.getPersonalAuth().setIsAuthentication(AuthenticationStatus.isNotAuthenticated);
|
|
|
- this.getPersonalAuth().setExplain(explain);
|
|
|
- this.getPersonalAuth().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
+ this.getPersonalAuthentication().setIsAuthentication(AuthenticationStatus.isNotAuthenticated);
|
|
|
+ this.getPersonalAuthentication().setExplain(explain);
|
|
|
+ this.getPersonalAuthentication().setCheckTime(new Timestamp(System.currentTimeMillis()));
|
|
|
return this;
|
|
|
}
|
|
|
}
|