|
@@ -9,7 +9,6 @@ import com.mooctest.crowd.domain.exception.UserNotExistException;
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
|
|
import com.mooctest.crowd.domain.model.RankCountInfo;
|
|
import com.mooctest.crowd.domain.model.RankCountInfo;
|
|
import com.mooctest.crowd.domain.model.UserTaskCountPO;
|
|
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.EvaluationAgencyRepo;
|
|
import com.mooctest.crowd.domain.repository.UserRepo;
|
|
import com.mooctest.crowd.domain.repository.UserRepo;
|
|
import com.mooctest.crowd.site.anticorruption.UserAntiCorruption;
|
|
import com.mooctest.crowd.site.anticorruption.UserAntiCorruption;
|
|
@@ -75,7 +74,7 @@ public class AgencyServiceImpl implements AgencyService {
|
|
先根据机构id查询出机构信息,再从task-to-user表里面找到这个机构的接的任务的数量。
|
|
先根据机构id查询出机构信息,再从task-to-user表里面找到这个机构的接的任务的数量。
|
|
*/
|
|
*/
|
|
Optional<EvaluationAgencyPO> agencyPO = agencyDao.findById(agencyId);
|
|
Optional<EvaluationAgencyPO> agencyPO = agencyDao.findById(agencyId);
|
|
- if(!agencyPO.isPresent()){
|
|
|
|
|
|
+ if (!agencyPO.isPresent()) {
|
|
throw new HttpBadRequestException("机构不存在!");
|
|
throw new HttpBadRequestException("机构不存在!");
|
|
}
|
|
}
|
|
EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO.get());
|
|
EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO.get());
|
|
@@ -93,11 +92,12 @@ public class AgencyServiceImpl implements AgencyService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取首页机构 more模糊查询
|
|
* 获取首页机构 more模糊查询
|
|
|
|
+ *
|
|
* @param keyword
|
|
* @param keyword
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<EvaluationAgencyVO> findMoreAgencyVO(String keyword){
|
|
|
|
|
|
+ public List<EvaluationAgencyVO> findMoreAgencyVO(String keyword) {
|
|
List<EvaluationAgencyVO> list = userTaskCountDao.findByType(RoleType.AGENCY.getId())
|
|
List<EvaluationAgencyVO> list = userTaskCountDao.findByType(RoleType.AGENCY.getId())
|
|
.stream().sorted(Comparator.comparing(UserTaskCountPO::getCount)).collect(Collectors.toList())
|
|
.stream().sorted(Comparator.comparing(UserTaskCountPO::getCount)).collect(Collectors.toList())
|
|
.stream().map(userTaskCountPO -> {
|
|
.stream().map(userTaskCountPO -> {
|
|
@@ -114,11 +114,12 @@ public class AgencyServiceImpl implements AgencyService {
|
|
if (keyword == null) {
|
|
if (keyword == null) {
|
|
return list.stream().sorted(Comparator.comparing(EvaluationAgencyVO::getTaskCount).reversed()).collect(Collectors.toList());
|
|
return list.stream().sorted(Comparator.comparing(EvaluationAgencyVO::getTaskCount).reversed()).collect(Collectors.toList());
|
|
} else {
|
|
} else {
|
|
- list=list.stream().sorted(Comparator.comparing(EvaluationAgencyVO::getTaskCount).reversed()).collect(Collectors.toList());
|
|
|
|
|
|
+ list = list.stream().sorted(Comparator.comparing(EvaluationAgencyVO::getTaskCount).reversed()).collect(Collectors.toList());
|
|
|
|
|
|
- return list.stream().filter(evaluationAgencyVO-> evaluationAgencyVO.getEvaluationAgencyName().contains(keyword)).collect(Collectors.toList());
|
|
|
|
|
|
+ return list.stream().filter(evaluationAgencyVO -> evaluationAgencyVO.getEvaluationAgencyName().contains(keyword)).collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public UserDTO applyAgency(Long userId, ApplyAgencyAuthCommand command) {
|
|
public UserDTO applyAgency(Long userId, ApplyAgencyAuthCommand command) {
|
|
EvaluationAgency agency = command.toAgency();
|
|
EvaluationAgency agency = command.toAgency();
|
|
@@ -169,8 +170,8 @@ public class AgencyServiceImpl implements AgencyService {
|
|
@Override
|
|
@Override
|
|
public AgencyVO updateAgencyInfo(Long userId, ApplyAgencyAuthCommand command) {
|
|
public AgencyVO updateAgencyInfo(Long userId, ApplyAgencyAuthCommand command) {
|
|
User user = userRepo.getByID(userId);
|
|
User user = userRepo.getByID(userId);
|
|
- evaluationAgencyRepo.moveEvaluationAgencyAbility(user.getEvaluationAgency().getEvaluationAgencyAbilityList());
|
|
|
|
- evaluationAgencyRepo.moveEvaluationAgencyResource(user.getEvaluationAgency().getEvaluationAgencyResourceList());
|
|
|
|
|
|
+// evaluationAgencyRepo.moveEvaluationAgencyAbility(user.getEvaluationAgency().getEvaluationAgencyAbilityList());
|
|
|
|
+// evaluationAgencyRepo.moveEvaluationAgencyResource(user.getEvaluationAgency().getEvaluationAgencyResourceList());
|
|
user.getEvaluationAgency().updateAuthInfo(command.toAgency());
|
|
user.getEvaluationAgency().updateAuthInfo(command.toAgency());
|
|
return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
|
|
return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
|
|
}
|
|
}
|
|
@@ -198,35 +199,17 @@ public class AgencyServiceImpl implements AgencyService {
|
|
if (user.getEvaluationAgency() == null)
|
|
if (user.getEvaluationAgency() == null)
|
|
throw new BaseException("该用户未申请机构认证!");
|
|
throw new BaseException("该用户未申请机构认证!");
|
|
user.getEvaluationAgency().passAuthentication();
|
|
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"));
|
|
|
|
|
|
+ if (user.getEvaluationAgency().getType().contains("0") && user.getEvaluationAgency().getType().contains("1")) {
|
|
|
|
+ user.getRoleList().add(userRepo.getRole(RoleType.PARTY_AGENCY.getName()));
|
|
|
|
+ user.getRoleList().add(userRepo.getRole(RoleType.AGENCY.getName()));
|
|
|
|
+ }
|
|
|
|
+ //1是认证为研发机构0是认证为评测机构
|
|
|
|
+ else if (user.getEvaluationAgency().getType().contains("1")) {
|
|
|
|
+ user.getRoleList().add(userRepo.getRole(RoleType.PARTY_AGENCY.getName()));
|
|
|
|
+ } else if (user.getEvaluationAgency().getType().contains("0")) {
|
|
|
|
+ //给接包角色
|
|
|
|
+ user.getRoleList().add(userRepo.getRole(RoleType.AGENCY.getName()));
|
|
|
|
+ }
|
|
return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
|
|
return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -247,7 +230,7 @@ public class AgencyServiceImpl implements AgencyService {
|
|
throw new EvaluationAgencyNotExistException("当前用户未申请机构认证");
|
|
throw new EvaluationAgencyNotExistException("当前用户未申请机构认证");
|
|
AgencyVO agencyVO = new AgencyVO(user.getEvaluationAgency());
|
|
AgencyVO agencyVO = new AgencyVO(user.getEvaluationAgency());
|
|
UserTaskCount userTaskCount = userRepo.getUserTaskCountByUserId(userId);
|
|
UserTaskCount userTaskCount = userRepo.getUserTaskCountByUserId(userId);
|
|
- if(userTaskCount != null){
|
|
|
|
|
|
+ if (userTaskCount != null) {
|
|
agencyVO.setTaskCount(userTaskCount.getCount());
|
|
agencyVO.setTaskCount(userTaskCount.getCount());
|
|
}
|
|
}
|
|
return agencyVO;
|
|
return agencyVO;
|