记得上下班打卡 | git大法好,push需谨慎

Commit 34b7380e authored by anjiabin's avatar anjiabin

提交chime社交相关

parent 7b449ff4
...@@ -2,16 +2,21 @@ package com.liquidnet.service.chime.dto; ...@@ -2,16 +2,21 @@ package com.liquidnet.service.chime.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@Data
@ApiModel(value = "ChimeTagVo", description = "标签库") @ApiModel(value = "ChimeTagVo", description = "标签库")
public class ChimeTagVo implements Serializable, Cloneable { public class ChimeTagVo implements Serializable, Cloneable {
private static final long serialVersionUID = 5852327873275898342L; private static final long serialVersionUID = 5852327873275898342L;
@ApiModelProperty(position = 0, value = "用户ID[64]")
private String userId;
@ApiModelProperty(position = 11, value = "标签Key") @ApiModelProperty(position = 11, value = "标签Key")
private String val; private String tagCode;
@ApiModelProperty(position = 12, value = "标签名称") @ApiModelProperty(position = 12, value = "标签名称")
private String desc; private String tagDesc;
private static final ChimeTagVo obj = new ChimeTagVo(); private static final ChimeTagVo obj = new ChimeTagVo();
...@@ -23,22 +28,4 @@ public class ChimeTagVo implements Serializable, Cloneable { ...@@ -23,22 +28,4 @@ public class ChimeTagVo implements Serializable, Cloneable {
} }
return new ChimeTagVo(); return new ChimeTagVo();
} }
public String getVal() {
return val;
}
public ChimeTagVo setVal(String val) {
this.val = val;
return this;
}
public String getDesc() {
return desc;
}
public ChimeTagVo setDesc(String desc) {
this.desc = desc;
return this;
}
} }
...@@ -14,10 +14,7 @@ import org.springframework.data.domain.PageRequest; ...@@ -14,10 +14,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
import org.springframework.data.mongodb.core.aggregation.LookupOperation;
import org.springframework.data.mongodb.core.aggregation.ProjectionOperation;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -69,17 +66,24 @@ public class ChimePerformanceServiceImpl implements IChimePerformanceService{ ...@@ -69,17 +66,24 @@ public class ChimePerformanceServiceImpl implements IChimePerformanceService{
criteria = criteria.and("userTag.tagCode").in(Arrays.asList(reqDto.getTags().split(","))); criteria = criteria.and("userTag.tagCode").in(Arrays.asList(reqDto.getTags().split(",")));
} }
AggregationOperation matchToLots = Aggregation.match(criteria); AggregationOperation matchToLots = Aggregation.match(criteria);
ProjectionOperation project = Aggregation.project("mid","userId","sex","avatar","joinPerformanceId"); ProjectionOperation project = Aggregation.project("mid","userId","sex","avatar","joinPerformanceId","userTag.tagCode","userTag.tagDesc");
// if (!reqDto.getPerformanceId().isEmpty()) { // if (!reqDto.getPerformanceId().isEmpty()) {
// criteria.and("title").regex(".*?\\" + reqDto.getTitle()); // criteria.and("title").regex(".*?\\" + reqDto.getTitle());
// } // }
project.andInclude("_id"); project.andInclude("_id");
//获取总数
Aggregation newAggregation = Aggregation.newAggregation(lookupToLots,matchToLots,project); Aggregation newAggregation = Aggregation.newAggregation(lookupToLots,matchToLots,project);
List<ChimeUserInfoVo> tempChimeUserInfoVoList = mongoTemplate.aggregate(newAggregation,ChimeUserInfoVo.class.getSimpleName(),ChimeUserInfoVo.class).getMappedResults();
long count = tempChimeUserInfoVoList.size();
//查询分页数据
SkipOperation skipOperation = Aggregation.skip(pageNum*pageSize);
LimitOperation limitOperation = Aggregation.limit(pageSize);
Aggregation aggregation = Aggregation.newAggregation(lookupToLots,matchToLots,project,skipOperation,limitOperation);
List<ChimeUserInfoVo> chimeUserInfoVoList = mongoTemplate.aggregate(aggregation,ChimeUserInfoVo.class.getSimpleName(),ChimeUserInfoVo.class).getMappedResults();
List<ChimeUserInfoVo> chimeUserInfoVoList = mongoTemplate.aggregate(newAggregation,ChimeUserInfoVo.class.getSimpleName(),ChimeUserInfoVo.class).getMappedResults();
// 查询总数
long count = chimeUserInfoVoList.size();
//处理Vo //处理Vo
List<ChimeUserInfoDto> dtoList = new ArrayList<>(); List<ChimeUserInfoDto> dtoList = new ArrayList<>();
for (ChimeUserInfoVo item : chimeUserInfoVoList) { for (ChimeUserInfoVo item : chimeUserInfoVoList) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment