فهرست منبع

个人认证 机构认证修改

xuxuan 5 سال پیش
والد
کامیت
879f0184ba

+ 18 - 6
site/src/main/java/com/mooctest/crowd/site/command/ApplyAgencyAuthCommand.java

@@ -1,11 +1,14 @@
 package com.mooctest.crowd.site.command;
 
+import com.alibaba.fastjson.JSONObject;
 import com.mooctest.crowd.domain.domainobject.EvaluationAgency;
 import com.mooctest.crowd.domain.domainobject.EvaluationAgencyAbility;
 import com.mooctest.crowd.domain.factory.UserFactory;
 import lombok.Data;
 import org.springframework.beans.BeanUtils;
 import javax.validation.constraints.NotNull;
+import java.sql.Timestamp;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -15,19 +18,28 @@ import java.util.stream.Collectors;
  * @date 2019-08-12 01:05
  */
 @Data
-public class ApplyAgencyAuthCommand {
+public class ApplyAgencyAuthCommand{
+    @NotNull(message = "请选择性别")
+    private String sex;
     @NotNull(message = "机构名称不可为空")
     private String evaluationAgencyName;
-    @NotNull(message = "银行卡号不可为空")
-    private String bankAccount;
+    @NotNull(message = "请上传身份证正面照")
+    private String idCardPositivePhoto;//身份证正面照
+    @NotNull(message = "请上传身份证反面照")
+    private String idCardBackPhoto;//身份证反面照
+    @NotNull(message = "请正确填写身份证过期时间")
+    private Timestamp idCardDeadTime;
     @NotNull(message = "机构地址不可为空")
     private String address;
-    @NotNull(message = "评测能力不可为空")
+//    @NotNull(message = "评测能力不可为空")
     private List<String> evaluationAgencyAbilityList;
-    @NotNull(message = "机构资源不可为空")
+//    @NotNull(message = "机构资源不可为空")
     private List<AgencyResourceCommand> evaluationAgencyResourceList;
     @NotNull(message = "LOGO不可为空")
     private String agencyPhoto;
+    @NotNull(message = "请选择认证研发机构或者评测机构")
+    private ArrayList<Integer> roleList;
+
 
     public EvaluationAgency toAgency(){
         EvaluationAgency agency = UserFactory.defaultAgency();
@@ -40,7 +52,7 @@ public class ApplyAgencyAuthCommand {
             agency.setEvaluationAgencyAbilityList(this.evaluationAgencyAbilityList.stream().map(EvaluationAgencyAbility::new).collect(Collectors.toList()));
             agency.setEvaluationAgencyResourceList(this.evaluationAgencyResourceList.stream().map(AgencyResourceCommand::toAgencyResource).collect(Collectors.toList()));
         }
-
+        agency.setType(JSONObject.toJSONString(this.roleList));
         agency.setIsDeleted(0);
         agency.setIsAuthentication(0);
         return agency;

+ 33 - 5
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -1,9 +1,6 @@
 package com.mooctest.crowd.site.service.impl;
 
-import com.mooctest.crowd.domain.dao.EvaluationAgencyDao;
-import com.mooctest.crowd.domain.dao.TaskToUserDao;
-import com.mooctest.crowd.domain.dao.UserDao;
-import com.mooctest.crowd.domain.dao.UserTaskCountDao;
+import com.mooctest.crowd.domain.dao.*;
 import com.mooctest.crowd.domain.domainobject.*;
 import com.mooctest.crowd.domain.exception.BaseException;
 import com.mooctest.crowd.domain.exception.EvaluationAgencyNotExistException;
@@ -12,6 +9,7 @@ import com.mooctest.crowd.domain.exception.UserNotExistException;
 import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
 import com.mooctest.crowd.domain.model.RankCountInfo;
 import com.mooctest.crowd.domain.model.UserTaskCountPO;
+import com.mooctest.crowd.domain.model.UserToRolePO;
 import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
 import com.mooctest.crowd.domain.repository.UserRepo;
 import com.mooctest.crowd.site.anticorruption.UserAntiCorruption;
@@ -53,6 +51,8 @@ public class AgencyServiceImpl implements AgencyService {
     private UserDao userDao;
     @Autowired
     private UserRepo userRepo;
+    @Autowired
+    private UserToRoleDao userToRoleDao;
 
     @Autowired
     private ViewMediator mediator;
@@ -118,13 +118,13 @@ public class AgencyServiceImpl implements AgencyService {
 
             return list.stream().filter(evaluationAgencyVO-> evaluationAgencyVO.getEvaluationAgencyName().contains(keyword)).collect(Collectors.toList());
         }
-
     }
     @Override
     public UserDTO applyAgency(Long userId, ApplyAgencyAuthCommand command) {
         EvaluationAgency agency = command.toAgency();
         User user = userRepo.getByID(userId);
         user.applyAgencyAuthentication(agency);
+        user.setEvaluationAgency(agency);
         return mediator.renderUser(userRepo.saveUser(user));
     }
 
@@ -198,6 +198,34 @@ public class AgencyServiceImpl implements AgencyService {
         if (user.getEvaluationAgency() == null)
             throw new BaseException("该用户未申请机构认证!");
         user.getEvaluationAgency().passAuthentication();
+         if(user.getEvaluationAgency().getType().contains("1")&&user.getEvaluationAgency().getType().contains("2")){
+             UserToRolePO userToRolePO=new UserToRolePO();
+             userToRolePO.setUserId(userId);
+             //给发包角色
+             userToRolePO.setRoleId(RoleType.PARTY_USER.getId());
+              userToRoleDao.save(userToRolePO);
+              //给接包角色
+             UserToRolePO u2r=new UserToRolePO();
+             u2r.setUserId(userId);
+             u2r.setRoleId(RoleType.EVALUATION_USER.getId());
+             userToRoleDao.save(u2r); }
+
+         //1是认证为研发机构0是认证为评测机构
+      else   if(user.getEvaluationAgency().getType().contains("1")){
+
+             UserToRolePO userToRolePO=new UserToRolePO();
+             userToRolePO.setUserId(userId);
+            //给发包角色
+             userToRolePO.setRoleId(RoleType.PARTY_AGENCY.getId());
+             userToRoleDao.save(userToRolePO);
+         }
+      else if(user.getEvaluationAgency().getType().contains("0"))   {
+          //给接包角色
+             UserToRolePO userToRolePO=new UserToRolePO();
+             userToRolePO.setUserId(userId);
+             userToRolePO.setRoleId(RoleType.AGENCY.getId());
+             userToRoleDao.save(userToRolePO);
+         }
         user.getRoleList().add(userRepo.getRole("evaluationAgency"));
         return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
     }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/UserServiceImpl.java


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است