| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | appUserQuery.setRegionId1(Long.valueOf(information.getRegionId())); |
| | | appUserQuery.setLevelId1(information.getLevel()); |
| | | |
| | | |
| | | List<Long> newIds = appUserService.getNewIds(appUserQuery); |
| | | for (Long newId : newIds) { |
| | | redisCache.setCacheObject("ALLERT:"+newId,information.getClassificationId()); |
| | |
| | | public R<Page<TConsultation>> list(@RequestBody ConsultationQuery informationQuery) { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | |
| | | Page<TConsultation> page = informationService.lambdaQuery() |
| | | Page<TConsultation> page; |
| | | if(StringUtils.isEmpty(informationQuery.getProvinceName())){ |
| | | if(informationQuery.getSortType()==1){ |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getClassificationName()), TConsultation::getClassificationName, informationQuery.getClassificationName()) |
| | | .eq(informationQuery.getRegionId() != null, TConsultation::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TConsultation::getTitleId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getClassificationId() != null, TConsultation::getClassificationId, informationQuery.getClassificationId()) |
| | | .eq(informationQuery.getMajorId() != null, TConsultation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TConsultation::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TConsultation::getCreateTime) |
| | | .orderByDesc(TConsultation::getPubTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | }else { |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getClassificationName()), TConsultation::getClassificationName, informationQuery.getClassificationName()) |
| | | .eq(informationQuery.getRegionId() != null, TConsultation::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TConsultation::getTitleId, informationQuery.getTechnicalId()) |
| | |
| | | .orderByDesc(TConsultation::getClassificationSort) |
| | | .orderByDesc(TConsultation::getPubTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | } |
| | | }else { |
| | | List<TRegion> list; |
| | | // 查询省份下的市 |
| | | if(informationQuery.getProvinceName().equals("直辖市")){ |
| | | List<String> cityList = new ArrayList<>(); |
| | | cityList.add("北京市"); |
| | | cityList.add("天津市"); |
| | | cityList.add("重庆市"); |
| | | cityList.add("上海市"); |
| | | list = regionService.lambdaQuery().in(TRegion::getProvinceName, cityList).list(); |
| | | }else { |
| | | list = regionService.lambdaQuery().eq(TRegion::getProvinceName, informationQuery.getProvinceName()).list(); |
| | | } |
| | | List<Integer> ids = list.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | if(informationQuery.getSortType()==1){ |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getClassificationName()), TConsultation::getClassificationName, informationQuery.getClassificationName()) |
| | | .in( TConsultation::getRegionId, ids) |
| | | .eq(informationQuery.getTechnicalId() != null, TConsultation::getTitleId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getClassificationId() != null, TConsultation::getClassificationId, informationQuery.getClassificationId()) |
| | | .eq(informationQuery.getMajorId() != null, TConsultation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TConsultation::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TConsultation::getCreateTime) |
| | | .orderByDesc(TConsultation::getPubTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | }else { |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getClassificationName()), TConsultation::getClassificationName, informationQuery.getClassificationName()) |
| | | .in( TConsultation::getRegionId, ids) |
| | | .eq(informationQuery.getTechnicalId() != null, TConsultation::getTitleId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getClassificationId() != null, TConsultation::getClassificationId, informationQuery.getClassificationId()) |
| | | .eq(informationQuery.getMajorId() != null, TConsultation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TConsultation::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TConsultation::getClassificationSort) |
| | | .orderByDesc(TConsultation::getPubTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | } |
| | | } |
| | | |
| | | |
| | | Set<Long> cacheSet = redisCache.getCacheSet("Consultation:" + userId); |
| | | |