浏览代码

增加群智首页查询更多品牌机构接口。

xuxuan 5 年之前
父节点
当前提交
8e9e0436f0

+ 16 - 2
site/src/main/java/com/mooctest/crowd/site/controller/AgencyController.java

@@ -15,6 +15,7 @@ import com.mooctest.crowd.site.data.vo.AgencyVO;
 import com.mooctest.crowd.site.data.vo.EvolutionAgencyVO;
 import com.mooctest.crowd.site.data.vo.SearchConditionVO;
 import com.mooctest.crowd.site.service.AgencyService;
+import com.mooctest.crowd.site.service.ResidentAgencyService;
 import com.mooctest.crowd.site.util.DataUtils;
 import lombok.extern.java.Log;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +40,8 @@ public class AgencyController extends BaseSearchController {
 
     @Autowired
     private AgencyService agencyService;
+    @Autowired
+    private ResidentAgencyService residentAgencyService;
 
     /**
      * 绿色通道:未登录情况直接录入认证信息,生成用户和评测机构信息
@@ -148,7 +151,7 @@ public class AgencyController extends BaseSearchController {
 
 
     @RequestMapping(value = "/agency/list/more", method = RequestMethod.GET)
-    public ResponseVO getMoreAgencyList(@RequestBody SearchConditionVO searchConditionVO) {
+    public ResponseVO getMoreAgencyList(@RequestBody SearchConditionVO searchConditionVO){
         Pageable pageable = this.getPageable(searchConditionVO);
         List<EvolutionAgencyVO> list = agencyService.findMoreAgencyVO();
         Page<EvolutionAgencyVO> page = DataUtils.listToPage(list, pageable);
@@ -156,8 +159,19 @@ public class AgencyController extends BaseSearchController {
     }
 
 
+    @RequestMapping(value = "resident/agency/more",method = RequestMethod.GET)
+    public  ResponseVO  getMoreResidentList(@RequestBody SearchConditionVO searchConditionVO){
+        Pageable pageable=this.getPageable(searchConditionVO);
+        return  new ResponseVO(ServerCode.SUCCESS,residentAgencyService.findAll(pageable));
+    }
+
+
+
+
+
+
     @Override
-    public Page<?> search(String searchCondition) {
+    public Page<?> search(String searchCondition){
         return null;
     }
 }

文件差异内容过多而无法显示
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/controller/CommonController.java


+ 2 - 2
site/src/main/java/com/mooctest/crowd/site/controller/CrowTestSquareController.java

@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
 
 
 /**
@@ -45,6 +46,7 @@ public class CrowTestSquareController extends BaseSearchController {
 
     /**
      * 获取众测广场首页所有的数据,包装到CrowdTestSquareIndexDTO里面     *
+     *
      * @return
      */
     @GetMapping("/list")
@@ -59,7 +61,6 @@ public class CrowTestSquareController extends BaseSearchController {
     }
 
 
-
     /**
      * 搜索框模糊分页查询接口
      */
@@ -97,7 +98,6 @@ public class CrowTestSquareController extends BaseSearchController {
         Page<CrowdTaskVO> taskVOPage = DataUtils.listToPage(crowdTestProjectVOList, pageable);
         return new ResponseVO(ServerCode.SUCCESS, taskVOPage);
 
-
     }
 
 

+ 12 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/ResidentAgencyVO.java

@@ -12,10 +12,22 @@ public class ResidentAgencyVO {
     private Long id;
     private Long agencyId;
     private Long userId;
+    private long   taskCount;
+    private String address;
+    private  String name;//机构名称
+
+
+
 
     public ResidentAgencyVO(ResidentAgency residentAgency){
         id = residentAgency.getId();
         agencyId = residentAgency.getAgencyId();
         userId = residentAgency.getUserId();
+
+    }
+
+
+    public  ResidentAgencyVO(){
+
     }
 }

+ 16 - 0
site/src/main/java/com/mooctest/crowd/site/service/ResidentAgencyService.java

@@ -0,0 +1,16 @@
+package com.mooctest.crowd.site.service;
+
+
+import com.mooctest.crowd.domain.model.ResidentAgencyPO;
+import com.mooctest.crowd.site.data.vo.ResidentAgencyVO;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.awt.*;
+
+public interface ResidentAgencyService {
+
+    Page<ResidentAgencyVO> findAll(Pageable pageable);
+
+
+}

+ 0 - 1
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -43,7 +43,6 @@ public class AgencyServiceImpl implements AgencyService {
 
     @Autowired
     private UserAntiCorruption userAnti;
-
     @Autowired
     private UserDao userDao;
     @Autowired

+ 68 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/ResidentServiceImpl.java

@@ -0,0 +1,68 @@
+package com.mooctest.crowd.site.service.impl;
+
+import com.mooctest.crowd.domain.dao.EvaluationAgencyDao;
+import com.mooctest.crowd.domain.dao.ResidentAgencyDao;
+import com.mooctest.crowd.domain.dao.TaskToUserDao;
+import com.mooctest.crowd.domain.dao.UserDao;
+import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
+import com.mooctest.crowd.domain.model.RankCountInfo;
+import com.mooctest.crowd.domain.model.ResidentAgencyPO;
+import com.mooctest.crowd.domain.model.UserPO;
+import com.mooctest.crowd.site.data.vo.ResidentAgencyVO;
+import com.mooctest.crowd.site.service.ResidentAgencyService;
+import com.mooctest.crowd.site.util.DataUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @author:xx
+ * @date:2020/7/8
+ * @description:
+ */
+@Slf4j
+@Service
+public class ResidentServiceImpl implements ResidentAgencyService {
+    @Autowired
+    private TaskToUserDao taskToUserDao;
+    @Autowired
+    private ResidentAgencyDao residentAgencyDao;
+    @Autowired
+    private EvaluationAgencyDao agencyDao;
+    @Autowired
+    private UserDao userDao;
+
+
+    @Override
+    public Page<ResidentAgencyVO> findAll(Pageable pageable) {
+        List<ResidentAgencyVO> list = new ArrayList<>();
+        List<RankCountInfo> totalCountOfUser = taskToUserDao.findTotalCountOfUser();
+        long ids[] = new long[totalCountOfUser.size()];
+        List<ResidentAgencyPO> residentAgencyPOS = residentAgencyDao.findAll();
+        //获取品牌机构的用户id
+        long resagency[] = new long[residentAgencyPOS.size()];
+        for (int i = 0; i < residentAgencyPOS.size(); i++) {
+            ResidentAgencyVO residentAgencyVO = new ResidentAgencyVO();
+            Optional<UserPO> userPO = userDao.findById(residentAgencyPOS.get(i).getUserId());
+            resagency[i] = residentAgencyPOS.get(i).getUserId();
+            EvaluationAgencyPO evaluationAgencyPO = agencyDao.findByUserId(resagency[i]);
+            residentAgencyVO.setName(evaluationAgencyPO.getEvaluationAgencyName());
+            residentAgencyVO.setTaskCount(totalCountOfUser.get(i).getCount());
+            residentAgencyVO.setAddress(evaluationAgencyPO.getAddress());
+            residentAgencyVO.setAgencyId(residentAgencyPOS.get(i).getAgencyId());
+            residentAgencyVO.setId(residentAgencyPOS.get(i).getId());
+            residentAgencyVO.setUserId(residentAgencyPOS.get(i).getUserId());
+            list.add(residentAgencyVO);
+        }
+
+
+        Page<ResidentAgencyVO> page = DataUtils.listToPage(list, pageable);
+        return page;
+    }
+}

部分文件因为文件数量过多而无法显示