Kaynağa Gözat

Merge branch 'feature-V2.0' of ssh://git.mooctest.com:1022/crowd-2019/crowd-test-service-backend into feature-V2.0

guo00guo 5 yıl önce
ebeveyn
işleme
0b6676922d

+ 2 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/ResourceDao.java

@@ -25,4 +25,6 @@ public interface ResourceDao extends CrudRepository<ResourcePO, Long>, JpaSpecif
     List<ResourcePO> findAll();
 
     Page<ResourcePO> findAll(Specification<ResourcePO> spec , Pageable pageable);
+
+    List<ResourcePO> findByNameLike(String name);
 }

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/domainobject/Resource.java

@@ -21,7 +21,7 @@ public class Resource {
     private String unitWork;
     private String standard;
     private String unit;
-    private String state;
+    private int state;
     private Timestamp startTime;
     private String personnel;
     private String remarks;

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/model/ResourcePO.java

@@ -48,7 +48,7 @@ public class ResourcePO {
     private String unit;
 
     @Column(name = "R_STATE")
-    private String state;
+    private int state;
 
     @Column(name = "R_DATE")
     private Timestamp startTime;

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/repository/CommonRepo.java

@@ -208,7 +208,7 @@ public class CommonRepo {
                 Predicate predicate = cb.conjunction();
                 if(code != null) {
                     predicate.getExpressions().add(
-                            cb.equal(a.get("platform"), code)
+                            cb.equal(a.get("applicationType"), code)
                     );
                 }
                 return predicate;

+ 11 - 9
site/src/main/java/com/mooctest/crowd/site/controller/AgencyController.java

@@ -151,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);
@@ -159,19 +159,21 @@ 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));
+    @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));
     }
 
+    @RequestMapping(value = "agency/{agencyId}", method = RequestMethod.GET)
+    public ResponseVO getAgencyDetails(@PathVariable("agencyId") long agencyId) {
 
-
-
-
+        EvolutionAgencyVO agencyVO = agencyService.getDetailById(agencyId);
+        return new ResponseVO(ServerCode.SUCCESS, agencyVO);
+    }
 
     @Override
-    public Page<?> search(String searchCondition){
+    public Page<?> search(String searchCondition) {
         return null;
     }
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/controller/CommonController.java


+ 14 - 5
site/src/main/java/com/mooctest/crowd/site/data/vo/EvolutionAgencyVO.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
+import java.sql.Timestamp;
 
 /**
  * @Author: xuexb
@@ -18,18 +19,26 @@ public class EvolutionAgencyVO implements Serializable {
 
     private Long id;
     private Long userId;
-    private String logo;
-    private String name;
+    private String agencyPhoto;
+    private String evaluationAgencyName;
     private Double allTaskPrice;
     private Long taskCount;
     private String address;
+    private Timestamp updateTime;
+    private Timestamp expireTime;
+    private Timestamp checkTime;
+    private Timestamp applyTime;
 
 
 
-    public EvolutionAgencyVO(EvaluationAgency evaluationAgency) {
+    public EvolutionAgencyVO(EvaluationAgency evaluationAgency){
         id = evaluationAgency.getId();
-        logo = evaluationAgency.getAgencyPhoto();
-        name = evaluationAgency.getEvaluationAgencyName();
+        agencyPhoto = evaluationAgency.getAgencyPhoto();
+        evaluationAgencyName = evaluationAgency.getEvaluationAgencyName();
         userId = evaluationAgency.getUserId();
+        updateTime=evaluationAgency.getUpdateTime();
+        expireTime=evaluationAgency.getExpireTime();
+        checkTime=evaluationAgency.getCheckTime();
+        applyTime=evaluationAgency.getApplyTime();
     }
 }

+ 1 - 1
site/src/main/java/com/mooctest/crowd/site/data/vo/ResourceVO.java

@@ -26,7 +26,7 @@ public class ResourceVO implements Serializable {
     private String unitWork;
     private String standard;
     private String unit;
-    private String state;
+    private int state;
     private Timestamp startTime;
     private String personnel;
     private String remarks;

+ 3 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/UserVO.java

@@ -41,6 +41,9 @@ public class UserVO implements Serializable {
     private String unit;
     private String county;
     private String address;
+
+
+
     public UserVO(User user) {
         BeanUtils.copyProperties(user, this);
         this.address=this.province+this.city;

+ 6 - 0
site/src/main/java/com/mooctest/crowd/site/mediator/ViewMediator.java

@@ -99,4 +99,10 @@ public interface ViewMediator {
     BankCardDTO deleteBankCard(long id,long userId);
 
     TechnicalArticlesDTO  updateRanking(long id);
+
+    List<ResourceVO>  getResource();
+
+    ResourceVO getResourceDetailed(String code);
+
+    List<ResourceVO>  getSearchResource(String name);
 }

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

@@ -105,6 +105,12 @@ public class WebMediatorImpl implements ViewMediator {
     private ApplicationTypeDao applicationTypeDao;
 
     @Autowired
+    private  ResourceDao resourceDao;
+
+    @Autowired
+    private ResourceTypeDao resourceTypeDao;
+
+    @Autowired
     private FieldDao fieldDao;
 
     @Value("${agency}")
@@ -217,8 +223,8 @@ public class WebMediatorImpl implements ViewMediator {
             EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
             if (agency != null && !agency.getEvaluationAgencyName().equals(agencyName)) {
                 EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
-                agencyVO.setName(agency.getEvaluationAgencyName());
-                agencyVO.setLogo(agency.getAgencyPhoto());
+                agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
+                agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
                 agencyVO.setTaskCount(rankInfo.getCount());
                 agencyVO.setId(agency.getId());
                 agencyVO.setUserId(agency.getUserId());
@@ -354,8 +360,8 @@ public class WebMediatorImpl implements ViewMediator {
             EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
             if (agency != null) {
                 EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
-                agencyVO.setName(agency.getEvaluationAgencyName());
-                agencyVO.setLogo(agency.getAgencyPhoto());
+                agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
+                agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
                 agencyVO.setAllTaskPrice(rankInfo.getTotalPrice());
                 return agencyVO;
             }
@@ -745,10 +751,10 @@ public class WebMediatorImpl implements ViewMediator {
         agencyDao.findAll().forEach(evaluationAgencyPO -> {
             EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
             agencyVO.setId(evaluationAgencyPO.getUserId());
-            agencyVO.setName(evaluationAgencyPO.getEvaluationAgencyName());
+            agencyVO.setEvaluationAgencyName(evaluationAgencyPO.getEvaluationAgencyName());
             agencyList.add(agencyVO);
         });
-        return agencyList.stream().filter(agency -> !agency.getName().equals(agencyTemplate.getEvaluationAgencyName())).collect(Collectors.toList());
+        return agencyList.stream().filter(agency -> !agency.getEvaluationAgencyName().equals(agencyTemplate.getEvaluationAgencyName())).collect(Collectors.toList());
     }
 
     @Override
@@ -996,6 +1002,80 @@ public class WebMediatorImpl implements ViewMediator {
         return technicalArticlesDTO;
     }
 
+    @Override
+    public List<ResourceVO> getResource() {
+        List<ResourceVO> resourceVOList = new ArrayList<>();
+        resourceDao.findAll().forEach(resourcePO -> {
+            ResourceVO resourceVO = new ResourceVO();
+            resourceVO.setCode(resourcePO.getCode());
+            resourceVO.setName(resourcePO.getName());
+            Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.getType());
+            resourceVO.setType(type.get().getName());
+            resourceVO.setQuantity(resourcePO.getQuantity());
+            resourceVO.setPhotoUrl(resourcePO.getPhotoUrl());
+            resourceVO.setDescription(resourcePO.getDescription());
+            resourceVO.setScene(resourcePO.getScene());
+            resourceVO.setUnitWork(resourcePO.getUnitWork());
+            resourceVO.setStandard(resourcePO.getStandard());
+            resourceVO.setUnit(resourcePO.getUnit());
+            resourceVO.setState(resourcePO.getState());
+            resourceVO.setStartTime(resourcePO.getStartTime());
+            resourceVO.setPersonnel(resourcePO.getPersonnel());
+            resourceVO.setRemarks(resourcePO.getRemarks());
+            resourceVOList.add(resourceVO);
+        });
+        List<ResourceVO> results=resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
+        return results;
+    }
+
+    @Override
+    public ResourceVO getResourceDetailed(String code) {
+        Optional<ResourcePO> resourcePO=resourceDao.findByCode(code);
+        ResourceVO resourceVO = new ResourceVO();
+        resourceVO.setCode(resourcePO.get().getCode());
+        resourceVO.setName(resourcePO.get().getName());
+        Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.get().getType());
+        resourceVO.setType(type.get().getName());
+        resourceVO.setQuantity(resourcePO.get().getQuantity());
+        resourceVO.setPhotoUrl(resourcePO.get().getPhotoUrl());
+        resourceVO.setDescription(resourcePO.get().getDescription());
+        resourceVO.setScene(resourcePO.get().getScene());
+        resourceVO.setUnitWork(resourcePO.get().getUnitWork());
+        resourceVO.setStandard(resourcePO.get().getStandard());
+        resourceVO.setUnit(resourcePO.get().getUnit());
+        resourceVO.setState(resourcePO.get().getState());
+        resourceVO.setStartTime(resourcePO.get().getStartTime());
+        resourceVO.setPersonnel(resourcePO.get().getPersonnel());
+        resourceVO.setRemarks(resourcePO.get().getRemarks());
+        return resourceVO;
+    }
+
+    @Override
+    public List<ResourceVO> getSearchResource(String name) {
+        List<ResourceVO> resourceVOList = new ArrayList<>();
+        resourceDao.findByNameLike("%" + name + "%").forEach(resourcePO -> {
+            ResourceVO resourceVO = new ResourceVO();
+            resourceVO.setCode(resourcePO.getCode());
+            resourceVO.setName(resourcePO.getName());
+            Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.getType());
+            resourceVO.setType(type.get().getName());
+            resourceVO.setQuantity(resourcePO.getQuantity());
+            resourceVO.setPhotoUrl(resourcePO.getPhotoUrl());
+            resourceVO.setDescription(resourcePO.getDescription());
+            resourceVO.setScene(resourcePO.getScene());
+            resourceVO.setUnitWork(resourcePO.getUnitWork());
+            resourceVO.setStandard(resourcePO.getStandard());
+            resourceVO.setUnit(resourcePO.getUnit());
+            resourceVO.setState(resourcePO.getState());
+            resourceVO.setStartTime(resourcePO.getStartTime());
+            resourceVO.setPersonnel(resourcePO.getPersonnel());
+            resourceVO.setRemarks(resourcePO.getRemarks());
+            resourceVOList.add(resourceVO);
+        });
+        List<ResourceVO> results=resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
+        return results;
+    }
+
     private ProjectOperationControl initProjectPermission(CrowdTestProject project, User user) {
         ProjectOperationControl operationControl = new ProjectOperationControl();
         if (user == null)

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/service/AgencyService.java

@@ -16,6 +16,8 @@ import java.util.List;
  */
 public interface AgencyService {
 
+    EvolutionAgencyVO   getDetailById(long agencyId);
+
     List<EvolutionAgencyVO> findMoreAgencyVO();
 
     UserDTO applyAgency(Long userId, ApplyAgencyAuthCommand command);

+ 8 - 2
site/src/main/java/com/mooctest/crowd/site/service/CommonService.java

@@ -4,6 +4,7 @@ import com.mooctest.crowd.site.data.dto.IndexDTO;
 import com.mooctest.crowd.site.data.dto.IndexInfoDTO;
 import com.mooctest.crowd.site.data.dto.IndexPageDTO;
 import com.mooctest.crowd.site.data.dto.MyCrowdDTO;
+import com.mooctest.crowd.site.data.response.ResponseVO;
 import com.mooctest.crowd.site.data.vo.*;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -34,7 +35,12 @@ public interface CommonService {
 
     Page<CompetitionVO> getCompetition(Pageable pageable,String keyword);
 
-    Page<ResourceVO> getResource(Pageable pageable,String keyword);
-
     Page<CrowdProjectVO> getProjectList(Pageable pageable,String code);
+
+    List<ResourceVO>  getResource();
+
+    ResourceVO getResourceDetailed(String code);
+
+    ResponseVO findByNameLike(SearchConditionVO searchConditionVO);
+
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/service/UserService.java


+ 30 - 3
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -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);

+ 43 - 4
site/src/main/java/com/mooctest/crowd/site/service/impl/CommonServiceImpl.java

@@ -1,19 +1,30 @@
 package com.mooctest.crowd.site.service.impl;
 
 import com.mooctest.crowd.domain.repository.*;
+import com.mooctest.crowd.site.constants.CommonConstant;
+import com.mooctest.crowd.site.data.ColumnFilter;
 import com.mooctest.crowd.site.data.dto.IndexDTO;
 import com.mooctest.crowd.site.data.dto.IndexInfoDTO;
 import com.mooctest.crowd.site.data.dto.IndexPageDTO;
 import com.mooctest.crowd.site.data.dto.MyCrowdDTO;
+import com.mooctest.crowd.site.data.enums.ColumnFilterType;
+import com.mooctest.crowd.site.data.response.ResponseVO;
+import com.mooctest.crowd.site.data.response.ServerCode;
 import com.mooctest.crowd.site.data.vo.*;
 import com.mooctest.crowd.site.mediator.ViewMediator;
 import com.mooctest.crowd.site.service.CommonService;
+import com.mooctest.crowd.site.util.DataUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -103,12 +114,40 @@ public class CommonServiceImpl implements CommonService {
     }
 
     @Override
-    public Page<ResourceVO> getResource(Pageable pageable, String keyword) {
-        return commonRepo.findAllResourceByPage(pageable, keyword).map(resource -> new ResourceVO(resource));
+    public Page<CrowdProjectVO> getProjectList(Pageable pageable, String code) {
+        return commonRepo.getProjectList(pageable,code).map(project->new CrowdProjectVO(project));
     }
 
     @Override
-    public Page<CrowdProjectVO> getProjectList(Pageable pageable, String code) {
-        return commonRepo.getProjectList(pageable,code).map(project->new CrowdProjectVO(project));
+    public List<ResourceVO> getResource() {
+        return viewMediator.getResource();
+    }
+
+    @Override
+    public ResourceVO getResourceDetailed(String code) {
+        return viewMediator.getResourceDetailed(code);
+    }
+
+    @Override
+    public ResponseVO findByNameLike(SearchConditionVO searchConditionVO) {
+        Pageable pageable = this.getPageable(searchConditionVO);
+        String keyword = searchConditionVO.getKeyword();
+        List<ResourceVO> resourceList=viewMediator.getSearchResource(keyword);
+        Page<ResourceVO> resourcePage = DataUtils.listToPage(resourceList, pageable);
+        return new ResponseVO<>(ServerCode.SUCCESS, resourcePage);
+    }
+
+    Pageable getPageable(SearchConditionVO searchConditionVO) {
+        int activePage = searchConditionVO.getActivePage() == 0 ? 1 : searchConditionVO.getActivePage();
+        Sort sort = new Sort(Sort.Direction.DESC, "id");
+        if (searchConditionVO.getColumnFilters() != null) {
+            for (ColumnFilter columnFilter : searchConditionVO.getColumnFilters()) {
+                if (ColumnFilterType.SORT.getName().equals(columnFilter.getType()) && columnFilter.getValue() != null) {
+                    sort = new Sort(Sort.Direction.fromString(columnFilter.getValue()), columnFilter.getField());
+                    break;
+                }
+            }
+        }
+        return new PageRequest(activePage - 1, CommonConstant.SQUARE_ROWS_ON_PAGE, sort);
     }
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/UserServiceImpl.java


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor