Ver Fonte

修改TaskVO和ProjectVO数据

xuexiaobo há 6 anos atrás
pai
commit
c4e3d75094

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/dao/CrowdTestTaskDao.java

@@ -27,7 +27,7 @@ public interface CrowdTestTaskDao extends CrudRepository<CrowdTestTaskPO, Long>
 
     List<CrowdTestTaskPO> findAllByIsDeleted(int isDeleted);
 
-    @Query(value = "SELECT new com.mooctest.crowd.domain.model.RankInfo(SUM(p.quotedPrice), p.evaluationAgencyId) FROM CrowdTestTaskPO p where p.evaluationAgencyId is not null GROUP BY p.evaluationAgencyId ORDER BY SUM(p.quotedPrice) DESC")
+    @Query(value = "SELECT new com.mooctest.crowd.domain.model.RankInfo(SUM(p.quotedPrice), p.evaluationAgencyId) FROM CrowdTestTaskPO p where p.evaluationAgencyId is not null and p.status>1 GROUP BY p.evaluationAgencyId ORDER BY SUM(p.quotedPrice) DESC")
     List<RankInfo> findTotalPriceOfAgency(Pageable pageable);
 
     @Query(nativeQuery = true, value = "select * from crowd_test_task where CTT_STATUS = 1 order by CTT_QUOTED_PRICE DESC LIMIT 4")

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdProjectVO.java

@@ -39,6 +39,7 @@ public class CrowdProjectVO {
     private Double price;
     private Double budget;
     private String usage;
+    private Integer status;
 
     public CrowdProjectVO(CrowdTestProject project){
         this.id = project.getCode();
@@ -59,6 +60,7 @@ public class CrowdProjectVO {
         this.budget = project.getQuotedPrice();
         this.price = project.getFixedPrice();
         this.usage = null;
+        this.status = project.getStatus();
     }
 
 }

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdTaskVO.java

@@ -29,6 +29,7 @@ public class CrowdTaskVO {
     private Double fixedPrice;
     private String requirementFile;
     private Long resource;
+    private Long agencyId;
     private Map<String, String> location;
     private String institution;
     private String serviceType;
@@ -49,6 +50,7 @@ public class CrowdTaskVO {
         serviceType = task.getType();
         requirementFile = task.getRequirementFile();
         status = task.getStatus();
+        agencyId = task.getEvaluationAgencyId();
         datetime = task.getDeadTime();
     }
 

+ 4 - 4
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -86,11 +86,11 @@ public class WebMediatorImpl implements ViewMediator {
         }).filter(Objects::nonNull).collect(Collectors.toList());
         //获取机构排名
         List<EvolutionAgencyVO> agencyRanks = taskDao.findTotalPriceOfAgency(pageable).stream().map(rankInfo -> {
-            Optional<EvaluationAgencyPO> agency = agencyDao.findById(rankInfo.getEntityId());
-            if (agency.isPresent()) {
+            EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
+            if (agency!=null) {
                 EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
-                agencyVO.setName(agency.get().getEvaluationAgencyName());
-                agencyVO.setLogo(agency.get().getAgencyPhoto());
+                agencyVO.setName(agency.getEvaluationAgencyName());
+                agencyVO.setLogo(agency.getAgencyPhoto());
                 agencyVO.setAllTaskPrice(rankInfo.getTotalPrice());
                 return agencyVO;
             }