|
@@ -6,7 +6,6 @@ import com.mooctest.crowd.domain.domainobject.*;
|
|
|
import com.mooctest.crowd.domain.exception.PermissionNotFoundException;
|
|
|
import com.mooctest.crowd.domain.exception.RoleNotFoundException;
|
|
|
import com.mooctest.crowd.domain.exception.UserNotExistException;
|
|
|
-import com.mooctest.crowd.domain.exception.UserTaskCountNoExistException;
|
|
|
import com.mooctest.crowd.domain.model.*;
|
|
|
import com.mooctest.crowd.domain.util.Converter;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -84,6 +83,17 @@ public class UserRepo implements IUserRepo {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public User getByUserIDJustAgencyInfo(Long userId) throws UserNotExistException, RoleNotFoundException {
|
|
|
+ Optional<UserPO> userPOOptional = userDao.findById(userId);
|
|
|
+ if (!userPOOptional.isPresent()) {
|
|
|
+ throw new UserNotExistException("用户不存在");
|
|
|
+ }else{
|
|
|
+ User user = getUserAndRoleAndPermissionByUserPO(userPOOptional.get());
|
|
|
+ return this.getEvaluationInfo(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public User getByIDJustInfo(Long userId) throws UserNotExistException, RoleNotFoundException {
|
|
|
Optional<UserPO> userPOOptional = userDao.findById(userId);
|
|
|
if (!userPOOptional.isPresent()) {
|
|
@@ -146,7 +156,7 @@ public class UserRepo implements IUserRepo {
|
|
|
public UserTaskCount getUserTaskCountByUserId(Long userId){
|
|
|
Optional<UserTaskCountPO> userTaskCountPO = userTaskCountDao.findByUserId(userId);
|
|
|
if(!userTaskCountPO.isPresent()){
|
|
|
- throw new UserTaskCountNoExistException();
|
|
|
+ return null;
|
|
|
}else{
|
|
|
return Converter.convert(UserTaskCount.class, userTaskCountPO.get());
|
|
|
}
|
|
@@ -378,35 +388,7 @@ public class UserRepo implements IUserRepo {
|
|
|
}
|
|
|
}
|
|
|
userResult.setRoleList(roleResultList);
|
|
|
-
|
|
|
- /*获取测评机构信息*/
|
|
|
- EvaluationAgencyPO evaluationAgencyPO = evaluationAgencyDao.findByUserIdAndIsDeleted(userPO.getId(), DeletedStatus.isNotDeleted);
|
|
|
- if(evaluationAgencyPO != null){
|
|
|
- EvaluationAgency evaluationAgencyResult = Converter.convert(EvaluationAgency.class, evaluationAgencyPO);
|
|
|
-
|
|
|
- /*获取测评机构能力*/
|
|
|
- List<EvaluationAgencyAbilityPO> evaluationAgencyAbilityPOList = agencyAbilityDao.findByEvaluationAgencyIdAndIsDeleted(evaluationAgencyResult.getId(), DeletedStatus.isNotDeleted);
|
|
|
- List<EvaluationAgencyAbility> evaluationAgencyAbilityList = new ArrayList<>();
|
|
|
- if(evaluationAgencyAbilityPOList.size() != 0){
|
|
|
- for(EvaluationAgencyAbilityPO evaluationAgencyAbilityPO : evaluationAgencyAbilityPOList){
|
|
|
- EvaluationAgencyAbility evaluationAgencyAbility = Converter.convert(EvaluationAgencyAbility.class, evaluationAgencyAbilityPO);
|
|
|
- evaluationAgencyAbilityList.add(evaluationAgencyAbility);
|
|
|
- }
|
|
|
- }
|
|
|
- evaluationAgencyResult.setEvaluationAgencyAbilityList(evaluationAgencyAbilityList);
|
|
|
-
|
|
|
- /*获取测评机构资源*/
|
|
|
- List<EvaluationAgencyResourcePO> evaluationAgencyResourcePOList = agencyResourceDao.findByEvaluationAgencyIdAndIsDeleted(evaluationAgencyResult.getId(), DeletedStatus.isNotDeleted);
|
|
|
- List<EvaluationAgencyResource> evaluationAgencyResourceList = new ArrayList<>();
|
|
|
- if(evaluationAgencyResourcePOList.size() != 0){
|
|
|
- for(EvaluationAgencyResourcePO evaluationAgencyResourcePO : evaluationAgencyResourcePOList){
|
|
|
- EvaluationAgencyResource evaluationAgencyResource = Converter.convert(EvaluationAgencyResource.class, evaluationAgencyResourcePO);
|
|
|
- evaluationAgencyResourceList.add(evaluationAgencyResource);
|
|
|
- }
|
|
|
- }
|
|
|
- evaluationAgencyResult.setEvaluationAgencyResourceList(evaluationAgencyResourceList);
|
|
|
- userResult.setEvaluationAgency(evaluationAgencyResult);
|
|
|
- }
|
|
|
+ userResult = getEvaluationInfo(userResult);
|
|
|
|
|
|
/*获取个人认证的信息*/
|
|
|
PersonalAuthenticationPO personalAuthenticationPO = personalAuthenticationDao.findByUserIdAndIsDeleted(userPO.getId(), DeletedStatus.isNotDeleted);
|
|
@@ -448,6 +430,38 @@ public class UserRepo implements IUserRepo {
|
|
|
return userResult;
|
|
|
}
|
|
|
|
|
|
+ private User getEvaluationInfo(User userResult) {
|
|
|
+ /*获取测评机构信息*/
|
|
|
+ EvaluationAgencyPO evaluationAgencyPO = evaluationAgencyDao.findByUserIdAndIsDeleted(userResult.getId(), DeletedStatus.isNotDeleted);
|
|
|
+ if(evaluationAgencyPO != null){
|
|
|
+ EvaluationAgency evaluationAgencyResult = Converter.convert(EvaluationAgency.class, evaluationAgencyPO);
|
|
|
+
|
|
|
+ /*获取测评机构能力*/
|
|
|
+ List<EvaluationAgencyAbilityPO> evaluationAgencyAbilityPOList = agencyAbilityDao.findByEvaluationAgencyIdAndIsDeleted(evaluationAgencyResult.getId(), DeletedStatus.isNotDeleted);
|
|
|
+ List<EvaluationAgencyAbility> evaluationAgencyAbilityList = new ArrayList<>();
|
|
|
+ if(evaluationAgencyAbilityPOList.size() != 0){
|
|
|
+ for(EvaluationAgencyAbilityPO evaluationAgencyAbilityPO : evaluationAgencyAbilityPOList){
|
|
|
+ EvaluationAgencyAbility evaluationAgencyAbility = Converter.convert(EvaluationAgencyAbility.class, evaluationAgencyAbilityPO);
|
|
|
+ evaluationAgencyAbilityList.add(evaluationAgencyAbility);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ evaluationAgencyResult.setEvaluationAgencyAbilityList(evaluationAgencyAbilityList);
|
|
|
+
|
|
|
+ /*获取测评机构资源*/
|
|
|
+ List<EvaluationAgencyResourcePO> evaluationAgencyResourcePOList = agencyResourceDao.findByEvaluationAgencyIdAndIsDeleted(evaluationAgencyResult.getId(), DeletedStatus.isNotDeleted);
|
|
|
+ List<EvaluationAgencyResource> evaluationAgencyResourceList = new ArrayList<>();
|
|
|
+ if(evaluationAgencyResourcePOList.size() != 0){
|
|
|
+ for(EvaluationAgencyResourcePO evaluationAgencyResourcePO : evaluationAgencyResourcePOList){
|
|
|
+ EvaluationAgencyResource evaluationAgencyResource = Converter.convert(EvaluationAgencyResource.class, evaluationAgencyResourcePO);
|
|
|
+ evaluationAgencyResourceList.add(evaluationAgencyResource);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ evaluationAgencyResult.setEvaluationAgencyResourceList(evaluationAgencyResourceList);
|
|
|
+ userResult.setEvaluationAgency(evaluationAgencyResult);
|
|
|
+ }
|
|
|
+ return userResult;
|
|
|
+ }
|
|
|
+
|
|
|
public Role getRole(String roleName){
|
|
|
Role role = new Role();
|
|
|
BeanUtils.copyProperties(roleDao.findByName(roleName), role);
|