Kaynağa Gözat

修改个人认证和企业认证字段

guochao 6 yıl önce
ebeveyn
işleme
c0abfd1ad8

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
core/src/main/java/com/mooctest/crowd/domain/controller/TestUserController.java


+ 0 - 24
core/src/main/java/com/mooctest/crowd/domain/dao/CompanyAuthDao.java

@@ -1,24 +0,0 @@
-package com.mooctest.crowd.domain.dao;
-
-import com.mooctest.crowd.domain.model.CompanyAuthPO;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
-import javax.transaction.Transactional;
-import java.util.List;
-import java.util.Optional;
-
-@Transactional
-public interface CompanyAuthDao extends PagingAndSortingRepository<CompanyAuthPO, Long>, JpaSpecificationExecutor<CompanyAuthPO> {
-
-    Optional<CompanyAuthPO> findByIdAndIsDeleted(Long Id, int deletedStatus);
-
-    Optional<CompanyAuthPO> findById(Long Id);
-
-    CompanyAuthPO findByUserId(Long userId);
-
-    List<CompanyAuthPO> findAll();
-
-    CompanyAuthPO save(CompanyAuthPO companyAuthPO);
-
-}

+ 24 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/EnterpriseAuthenticationDao.java

@@ -0,0 +1,24 @@
+package com.mooctest.crowd.domain.dao;
+
+import com.mooctest.crowd.domain.model.EnterpriseAuthenticationPO;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import javax.transaction.Transactional;
+import java.util.List;
+import java.util.Optional;
+
+@Transactional
+public interface EnterpriseAuthenticationDao extends PagingAndSortingRepository<EnterpriseAuthenticationPO, Long>, JpaSpecificationExecutor<EnterpriseAuthenticationPO> {
+
+    Optional<EnterpriseAuthenticationPO> findByIdAndIsDeleted(Long Id, int deletedStatus);
+
+    Optional<EnterpriseAuthenticationPO> findById(Long Id);
+
+    EnterpriseAuthenticationPO findByUserId(Long userId);
+
+    List<EnterpriseAuthenticationPO> findAll();
+
+    EnterpriseAuthenticationPO save(EnterpriseAuthenticationPO enterpriseAuthenticationPO);
+
+}

+ 0 - 26
core/src/main/java/com/mooctest/crowd/domain/dao/PersonalAuthDao.java

@@ -1,26 +0,0 @@
-package com.mooctest.crowd.domain.dao;
-
-import com.mooctest.crowd.domain.model.PersonalAuthPO;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
-import javax.transaction.Transactional;
-import java.util.List;
-import java.util.Optional;
-
-@Transactional
-public interface PersonalAuthDao extends PagingAndSortingRepository<PersonalAuthPO, Long>, JpaSpecificationExecutor<PersonalAuthPO> {
-
-    Optional<PersonalAuthPO> findById(Long Id);
-
-    Optional<PersonalAuthPO> findByIdAndIsDeleted(Long Id, int deletedStatus);
-
-    PersonalAuthPO findByUserId(Long userId);
-
-    PersonalAuthPO findByUserIdAndIsDeleted(Long userId, int deletedStatus);
-
-    List<PersonalAuthPO> findAll();
-
-    PersonalAuthPO save(PersonalAuthPO personalAuthPO);
-
-}

+ 26 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/PersonalAuthenticationDao.java

@@ -0,0 +1,26 @@
+package com.mooctest.crowd.domain.dao;
+
+import com.mooctest.crowd.domain.model.PersonalAuthenticationPO;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import javax.transaction.Transactional;
+import java.util.List;
+import java.util.Optional;
+
+@Transactional
+public interface PersonalAuthenticationDao extends PagingAndSortingRepository<PersonalAuthenticationPO, Long>, JpaSpecificationExecutor<PersonalAuthenticationPO> {
+
+    Optional<PersonalAuthenticationPO> findById(Long Id);
+
+    Optional<PersonalAuthenticationPO> findByIdAndIsDeleted(Long Id, int deletedStatus);
+
+    PersonalAuthenticationPO findByUserId(Long userId);
+
+    PersonalAuthenticationPO findByUserIdAndIsDeleted(Long userId, int deletedStatus);
+
+    List<PersonalAuthenticationPO> findAll();
+
+    PersonalAuthenticationPO save(PersonalAuthenticationPO personalAuthenticationPO);
+
+}

+ 62 - 49
core/src/main/java/com/mooctest/crowd/domain/domainobject/CrowdTestProject.java

@@ -139,8 +139,7 @@ public class CrowdTestProject {
      */
     public CrowdTestProject removeCrowdTestProject(User user) {
         //判断用户是否认证
-        List<Role> roleList = user.getRoleList();
-        if(roleList.size() == 1 && roleList.get(0).getId() == 6L){
+        if(user.getPersonalAuthentication() == null && user.getEnterpriseAuthentication() == null && user.getRegionalManager() == null && user.getEvaluationAgency() == null){
             throw new CrowdTestProjectException("当前用户未进行认证,无权限对项目操作");
         }
         //判断用户是否为项目发起者
@@ -280,9 +279,8 @@ public class CrowdTestProject {
      */
     public CrowdTestProject createCrowdTestProject(User user) {
         //判断用户是否认证
-        List<Role> roleList = user.getRoleList();
-        if(roleList.size() == 1 && roleList.get(0).getId() == 6L){
-            throw new CrowdTestProjectException("当前用户未进行认证,无创建项目权限");
+        if(user.getPersonalAuthentication() == null && user.getEnterpriseAuthentication() == null && user.getRegionalManager() == null && user.getEvaluationAgency() == null){
+            throw new CrowdTestProjectException("当前用户未进行认证,无权限对项目操作");
         }
         //增加设置项目code ---------需要补上
 //        String projectCode = GenerateFlowCodeUtil.generateFlowCode("PROJ");
@@ -299,9 +297,8 @@ public class CrowdTestProject {
      */
     public CrowdTestProject releaseCrowdTestProject(User user) {
         //判断用户是否认证
-        List<Role> roleList = user.getRoleList();
-        if(roleList.size() == 1 && roleList.get(0).getId() == 6L){
-            throw new CrowdTestProjectException("当前用户未进行认证,无创建项目权限");
+        if(user.getPersonalAuthentication() == null && user.getEnterpriseAuthentication() == null && user.getRegionalManager() == null && user.getEvaluationAgency() == null){
+            throw new CrowdTestProjectException("当前用户未进行认证,无权限对项目操作");
         }
         //判断用户是否为项目发起者
         if(!this.getUserId().equals(user.getId())){
@@ -444,49 +441,66 @@ public class CrowdTestProject {
         //判断是否为测评机构
         EvaluationAgency evaluationAgency = user.getEvaluationAgency();
         if(evaluationAgency == null){
-            throw new UserNotExistException("当前用户不是测评机构,没有权限接收任务");
-        }
-
-        List<CrowdTestTask> crowdTestTaskList = this.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(crowdTestTask.getDistributionType() == 0){
-                        if(!crowdTestTask.getEvaluationAgencyId().equals(user.getId())){
-                            throw new CrowdTestTaskException("当前用户没有权限接收此定向发布的任务!");
-                        }else{
-                            crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
-                        }
-                    }
-                    //任务是区域发布
-                    else if(crowdTestTask.getDistributionType() == 1){
-                        //判断测评机构的区域是否符合要求
-                        if(!crowdTestTask.getDistributionCity().equals(user.getCity())){
-                            throw new CrowdTestTaskException("任务发布的区域不符合当前测评机构的区域!");
-                        }else{
-                            crowdTestTask.setEvaluationAgencyId(user.getId());
-                            crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
-                        }
-                    }
-                    //任务是广场发布
-                    else{
-                        crowdTestTask.setEvaluationAgencyId(user.getId());
-                        crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
-                    }
-                }
-            }
-            crowdTestTaskListResult.add(crowdTestTask);
+            throw new UnauthorizedException("当前用户不是测评机构,没有权限接收任务");
         }
-        this.setCrowdTestTaskList(crowdTestTaskList);
+        Optional<CrowdTestTask> taskOp = this.getCrowdTestTaskList().stream().filter(task -> task.getCode().equals(crowdTestTaskCode)).findFirst();
+        //任务是否不存在
+        if (!taskOp.isPresent())
+            throw new CrowdTestTaskNotExistException();
+        CrowdTestTask task = taskOp.get();
+        //任务当前状态
+        if (task.getStatus()!=CrowdTestTaskStatus.HAS_RELEASED)
+            throw new CrowdTestTaskException("任务当前状态不能被接收,当前状态为:"+task.getStatus());
+        //定向发布类型
+        if (task.getDistributionType() == 0) {
+            if (!task.getEvaluationAgencyId().equals(user.getId()))
+                throw new CrowdTestTaskException("当前用户没有权限接收此定向发布的任务!");
+        }
+        task.setEvaluationAgencyId(user.getId());
+        task.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
+//
+//        List<CrowdTestTask> crowdTestTaskList = this.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(crowdTestTask.getDistributionType() == 0){
+//                        if(!crowdTestTask.getEvaluationAgencyId().equals(user.getId())){
+//                            throw new CrowdTestTaskException("当前用户没有权限接收此定向发布的任务!");
+//                        }else{
+//                            crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
+//                        }
+//                    }
+//                    //任务是区域发布
+//                    else if(crowdTestTask.getDistributionType() == 1){
+//                        //判断测评机构的区域是否符合要求
+//                        if(!crowdTestTask.getDistributionCity().equals(user.getCity())){
+//                            throw new CrowdTestTaskException("任务发布的区域不符合当前测评机构的区域!");
+//                        }else{
+//                            crowdTestTask.setEvaluationAgencyId(user.getId());
+//                            crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
+//                        }
+//                    }
+//                    //任务是广场发布
+//                    else{
+//                        crowdTestTask.setEvaluationAgencyId(user.getId());
+//                        crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RECEIVED);
+//                    }
+//                }
+//            }
+//            crowdTestTaskListResult.add(crowdTestTask);
+//        }
+//        this.setCrowdTestTaskList(crowdTestTaskList);
         return this;
 
     }
 
+
+
     /**
      * 创建测试报告(测评机构)
      * @param crowdTestTaskCode
@@ -684,9 +698,8 @@ public class CrowdTestProject {
      */
     public CrowdTestProject finishCrowdTestProject(User user) {
         //判断用户是否认证
-        List<Role> roleList = user.getRoleList();
-        if(roleList.size() == 1 && roleList.get(0).getId() == 6L){
-            throw new CrowdTestProjectException("当前用户未进行认证,无创建项目权限");
+        if(user.getPersonalAuthentication() == null && user.getEnterpriseAuthentication() == null && user.getRegionalManager() == null && user.getEvaluationAgency() == null){
+            throw new CrowdTestProjectException("当前用户未进行认证,无权限对项目操作");
         }
         //判断是否为项目发起者
         if(!this.getUserId().equals(user.getId())){

+ 3 - 3
core/src/main/java/com/mooctest/crowd/domain/domainobject/CompanyAuth.java → core/src/main/java/com/mooctest/crowd/domain/domainobject/EnterpriseAuthentication.java

@@ -9,11 +9,11 @@ import java.sql.Timestamp;
  * @date 2019-08-19 15:47
  */
 @Data
-public class CompanyAuth {
+public class EnterpriseAuthentication {
 
     private Long id;
     private Long userId;
-    private String companyName;
+    private String enterpriseName;
     private String legalPersonName;
     private String businessLicensePhoto;
     private String unifiedSocialCreditCode;
@@ -30,7 +30,7 @@ public class CompanyAuth {
         return "CompanyAuth{" +
                 "id=" + id +
                 ", userId=" + userId +
-                ", companyName='" + companyName + '\'' +
+                ", enterpriseName='" + enterpriseName + '\'' +
                 ", legalPersonName='" + legalPersonName + '\'' +
                 ", businessLicensePhoto='" + businessLicensePhoto + '\'' +
                 ", unifiedSocialCreditCode='" + unifiedSocialCreditCode + '\'' +

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/domainobject/PersonalAuth.java → core/src/main/java/com/mooctest/crowd/domain/domainobject/PersonalAuthentication.java

@@ -9,7 +9,7 @@ import java.sql.Timestamp;
  * @date 2019-08-19 15:47
  */
 @Data
-public class PersonalAuth {
+public class PersonalAuthentication {
 
     private Long id;
     private Long userId;

+ 0 - 142
core/src/main/java/com/mooctest/crowd/domain/domainobject/RegionalManager.java

@@ -27,146 +27,4 @@ public class RegionalManager {
                 ", createTime=" + createTime +
                 '}';
     }
-
-//    /**
-//     * 区域管理员接收项目
-//     * @param crowdTestProject
-//     * @return
-//     */
-//    public CrowdTestProject receiveProject(CrowdTestProject crowdTestProject) {
-//        List<Regional> regionalList = this.getRegionalList();
-//        if(crowdTestProject.getRegionalManagerId() != null){
-//            throw new CrowdTestProjectException("项目已被接收");
-//        }else if(crowdTestProject.getStatus() != (CrowdTestProjectStatus.HAS_RECEIVED-1)){
-//            throw new CrowdTestProjectException("项目不能被接收,项目状态为: " + crowdTestProject.getStatus());
-//        }else{
-//            boolean couldReceive = false;
-//            for(Regional regional : regionalList){
-//                if(crowdTestProject.getDistributionProvince().equals(regional.getProvince())&&crowdTestProject.getDistributionCity().equals(regional.getCity())){
-//                    couldReceive = true;
-//                }
-//            }
-//            if(!couldReceive){
-//                throw new CrowdTestProjectException("项目区域不符合区域管理员的要求");
-//            }else{
-//                crowdTestProject.setRegionalManagerId(this.getUserId());
-//                crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_RECEIVED);
-//            }
-//        }
-//        return crowdTestProject;
-//    }
-
-//    /**
-//     * 创建测试任务
-//     * @param crowdTestTask
-//     * @return
-//     */
-//    public CrowdTestProject createCrowdTestTask(CrowdTestProject crowdTestProject, CrowdTestTask crowdTestTask) {
-//        List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
-//
-//        crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_CREATED);
-//        crowdTestTask.setDistributionProvince(crowdTestProject.getDistributionProvince());
-//        crowdTestTask.setDistributionCity(crowdTestProject.getDistributionCity());
-//
-//        //添加测试任务
-//        crowdTestTaskList.add(crowdTestTask);
-//
-//        //修改项目状态
-//        if(CrowdTestProjectStatus.HAS_SPLITED != crowdTestProject.getStatus()){
-//            crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_SPLITED);
-//        }
-//        crowdTestProject.setCrowdTestTaskList(crowdTestTaskList);
-//        return crowdTestProject;
-//    }
-
-
-//    /**
-//     * 发布任务
-//     * @param crowdTestProject
-//     * @param crowdTestTaskCode
-//     * @return
-//     */
-//    public CrowdTestProject releaseCrowdTestTask(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_RELEASED-1)){
-//                    throw new CrowdTestTaskException("当前任务不能被发布,当前状态为:"+crowdTestTask.getStatus());
-//                }else{
-//                    crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_RELEASED);
-//                }
-//            }
-//            crowdTestTaskListResult.add(crowdTestTask);
-//        }
-//
-//        crowdTestProject.setCrowdTestTaskList(crowdTestTaskListResult);
-//        return crowdTestProject;
-//    }
-
-//    /**
-//     * 结束任务
-//     * @param crowdTestProject
-//     * @return
-//     */
-//    public CrowdTestProject finishCrowdTestTask(CrowdTestProject crowdTestProject) {
-//        List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
-//        List<CrowdTestTask> crowdTestTaskListResult = new ArrayList<>();
-//        //结束任务时修改任务状态为"已结束"
-//        for(CrowdTestTask crowdTestTask : crowdTestTaskList){
-//            if(crowdTestTask.getStatus() != (CrowdTestTaskStatus.HAS_FINISHED-1)){
-//                throw new CrowdTestTaskException("存在任务不能被结束,状态为:"+crowdTestTask.getStatus());
-//            }else{
-//                crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_FINISHED);
-//            }
-//            crowdTestTaskListResult.add(crowdTestTask);
-//        }
-//
-//        crowdTestProject.setCrowdTestTaskList(crowdTestTaskListResult);
-//        return crowdTestProject;
-//    }
-
-
-//    /**
-//     * 创建项目报告
-//     * @param crowdTestProject
-//     * @param crowdTestReport
-//     * @return
-//     */
-//    public CrowdTestProject createCrowdTestProjectReport(CrowdTestProject crowdTestProject, CrowdTestReport crowdTestReport) {
-//        crowdTestProject.setCrowdTestReportForProject(crowdTestReport);
-//        if(crowdTestProject.getStatus() != (CrowdTestProjectStatus.HAS_REPORTED - 1)){
-//            throw new CrowdTestProjectException("项目报告不能被提交,当前状态为:"+crowdTestProject.getStatus());
-//        }else {
-//            crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_REPORTED);
-//        }
-//        return crowdTestProject;
-//    }
-
-
-//    /**
-//     * 提交项目
-//     * @param crowdTestProject
-//     * @return
-//     */
-//    public CrowdTestProject commitCrowdTestProject(CrowdTestProject crowdTestProject) {
-//        List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
-//        if(crowdTestProject.getCrowdTestReportForProject() == null){
-//            throw new CrowdTestProjectException("还未创建项目报告,项目不能被提交");
-//        }
-//
-//        //结束项目时查看是否已结束任务
-//        if(crowdTestProject.getStatus() != (CrowdTestProjectStatus.HAS_COMMITED - 1)){
-//            throw new CrowdTestProjectException("项目不能被结束,状态为:"+crowdTestProject.getStatus());
-//        }else{
-//            for(CrowdTestTask crowdTestTask : crowdTestTaskList){
-//                if(crowdTestTask.getStatus() != CrowdTestTaskStatus.HAS_FINISHED){
-//                    throw new CrowdTestTaskException("存在未结束的任务,项目不能被提交");
-//                }
-//            }
-//        }
-//        crowdTestProject.setStatus(CrowdTestProjectStatus.HAS_COMMITED);
-//        return crowdTestProject;
-//    }
 }

+ 1 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/SystemAdministrator.java

@@ -10,4 +10,5 @@ import lombok.Data;
 public class SystemAdministrator extends User {
     private Long id;
     private Long userId;
+
 }

+ 32 - 133
core/src/main/java/com/mooctest/crowd/domain/domainobject/User.java

@@ -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;
             }
         }

+ 4 - 0
core/src/main/java/com/mooctest/crowd/domain/exception/UnauthorizedException.java

@@ -9,4 +9,8 @@ public class UnauthorizedException extends BaseException {
     public UnauthorizedException(){
         super("请登录后访问");
     }
+
+    public UnauthorizedException(String msg){
+        super(msg);
+    }
 }

+ 4 - 4
core/src/main/java/com/mooctest/crowd/domain/model/CompanyAuthPO.java → core/src/main/java/com/mooctest/crowd/domain/model/EnterpriseAuthenticationPO.java

@@ -11,8 +11,8 @@ import java.sql.Timestamp;
  */
 @Data
 @Entity
-@Table(name = "company_authentication")
-public class CompanyAuthPO {
+@Table(name = "enterprise_authentication")
+public class EnterpriseAuthenticationPO {
 
     @Id
     @Column(name = "CA_ID")
@@ -22,8 +22,8 @@ public class CompanyAuthPO {
     @Column(name = "CA_USER_ID")
     private Long userId;
 
-    @Column(name = "CA_COMPANY_NAME")
-    private String companyName;
+    @Column(name = "CA_ENTERPRISE_NAME")
+    private String enterpriseName;
 
     @Column(name = "CA_LEGAL_PERSON_NAME")
     private String legalPersonName;

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/model/PersonalAuthPO.java → core/src/main/java/com/mooctest/crowd/domain/model/PersonalAuthenticationPO.java

@@ -12,7 +12,7 @@ import java.sql.Timestamp;
 @Data
 @Entity
 @Table(name = "personal_authentication")
-public class PersonalAuthPO {
+public class PersonalAuthenticationPO {
 
     @Id
     @Column(name = "PA_ID")

+ 10 - 10
core/src/main/java/com/mooctest/crowd/domain/repository/UserRepo.java

@@ -59,10 +59,10 @@ public class UserRepo implements IUserRepo {
     private EvaluationAgencyRepo resourceRepo;
 
     @Autowired
-    private PersonalAuthDao personalAuthDao;
+    private PersonalAuthenticationDao personalAuthenticationDao;
 
     @Autowired
-    private CompanyAuthDao companyAuthDao;
+    private EnterpriseAuthenticationDao enterpriseAuthenticationDao;
 
 
     private Timestamp currentTime = new Timestamp(System.currentTimeMillis());
@@ -214,7 +214,7 @@ public class UserRepo implements IUserRepo {
         if (roleList==null || roleList.size()==0){
             UserToRolePO u2r = new UserToRolePO();
             u2r.setUserId(userPO.getId());
-            u2r.setRoleId(6L);
+            u2r.setRoleId(1L);
             userToRoleDao.save(u2r);
         }
         List<UserToRolePO> userToRolePOList = userToRoleDao.findByUserId(userPO.getId());
@@ -255,13 +255,13 @@ public class UserRepo implements IUserRepo {
         }
 
         /*实名认证保存个人信息*/
-        if(user.getPersonalAuth() != null){
-            personalAuthDao.save(Converter.convert(PersonalAuthPO.class, user.getPersonalAuth()));
+        if(user.getPersonalAuthentication() != null){
+            personalAuthenticationDao.save(Converter.convert(PersonalAuthenticationPO.class, user.getPersonalAuthentication()));
         }
 
         /*企业认证保存企业信息*/
-        if(user.getCompanyAuth() != null){
-            companyAuthDao.save(Converter.convert(CompanyAuthPO.class, user.getCompanyAuth()));
+        if(user.getEnterpriseAuthentication() != null){
+            enterpriseAuthenticationDao.save(Converter.convert(EnterpriseAuthenticationPO.class, user.getEnterpriseAuthentication()));
         }
 
         return getByID(userPO.getId());
@@ -358,9 +358,9 @@ public class UserRepo implements IUserRepo {
         }
 
         /*获取个人认证的信息*/
-        PersonalAuthPO personalAuthPO = personalAuthDao.findByUserIdAndIsDeleted(userPO.getId(), DeletedStatus.isNotDeleted);
-        if(personalAuthPO != null){
-            userResult.setPersonalAuth(Converter.convert(PersonalAuth.class, personalAuthPO));
+        PersonalAuthenticationPO personalAuthenticationPO = personalAuthenticationDao.findByUserIdAndIsDeleted(userPO.getId(), DeletedStatus.isNotDeleted);
+        if(personalAuthenticationPO != null){
+            userResult.setPersonalAuthentication(Converter.convert(PersonalAuthentication.class, personalAuthenticationPO));
         }
 
         /*获取区域管理员信息*/

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor