|
@@ -10,6 +10,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.RankInfo;
|
|
|
import com.mooctest.crowd.domain.model.UserPO;
|
|
|
import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
|
|
|
import com.mooctest.crowd.domain.repository.UserRepo;
|
|
@@ -23,7 +24,10 @@ import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
import com.mooctest.crowd.site.service.AgencyService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -41,6 +45,7 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class AgencyServiceImpl implements AgencyService {
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private UserAntiCorruption userAnti;
|
|
|
@Autowired
|
|
@@ -59,15 +64,37 @@ public class AgencyServiceImpl implements AgencyService {
|
|
|
private EvaluationAgencyDao agencyDao;
|
|
|
|
|
|
@Override
|
|
|
+ public EvolutionAgencyVO getDetailById(long agencyId) {
|
|
|
+ /*
|
|
|
+ 先根据机构id查询出机构信息,再从task-to-user表里面找到这个机构的接的任务的数量。
|
|
|
+ */
|
|
|
+ EvaluationAgencyPO agencyPO = agencyDao.findByUserId(agencyId);
|
|
|
+ log.info("机构popopopo===========" + agencyPO);
|
|
|
+ EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
|
+ List<RankCountInfo> rankCountInfoList = taskToUserDao.findTotalCountOfUser();
|
|
|
+ long ids[] = new long[rankCountInfoList.size()];
|
|
|
+ for (int i = 0; i < ids.length; i++) {
|
|
|
+ ids[i] = rankCountInfoList.get(i).getEntityId();
|
|
|
+ if (ids[i] == agencyId) {
|
|
|
+ agencyVO.setTaskCount(rankCountInfoList.get(i).getCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(agencyPO, agencyVO);
|
|
|
+
|
|
|
+ return agencyVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<EvolutionAgencyVO> findMoreAgencyVO() {
|
|
|
- List<EvolutionAgencyVO> list = new ArrayList<EvolutionAgencyVO>();
|
|
|
- List<RankCountInfo> rankInfos = taskToUserDao.findTotalCountOfUser();
|
|
|
- long[] ids = new long[rankInfos.size()];
|
|
|
+ List<EvolutionAgencyVO> list = new ArrayList<EvolutionAgencyVO>();//机构列表
|
|
|
+ List<RankCountInfo> rankInfos = taskToUserDao.findTotalCountOfUser();//用户接包信息
|
|
|
+ long[] ids = new long[rankInfos.size()];//用户id数组ru
|
|
|
for (int i = 0; i < rankInfos.size(); i++) {
|
|
|
ids[i] = rankInfos.get(i).getEntityId();
|
|
|
Optional<UserPO> user = userDao.findById(ids[i]);
|
|
|
EvaluationAgencyPO evaluationAgencyPO = agencyDao.findByUserId(ids[i]);
|
|
|
ids[i] = rankInfos.get(i).getEntityId();
|
|
|
+ //
|
|
|
if (evaluationAgencyPO != null) {
|
|
|
EvaluationAgency evaluationAgency = new EvaluationAgency(evaluationAgencyPO);
|
|
|
EvolutionAgencyVO evolutionAgencyVO = new EvolutionAgencyVO(evaluationAgency);
|