Commit 3f343171 authored by 王明生's avatar 王明生

fixed: 修改主体编码以及数据为空的情况

parent a28cbd2f
...@@ -4,10 +4,10 @@ import java.util.Arrays; ...@@ -4,10 +4,10 @@ import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
public enum PrincipalEnum { public enum PrincipalEnum {
BYD_WC("1270917477950984192", "比亚迪-王朝"), BYD_WC("869753006697992192", "比亚迪-王朝"),
BYD_HY("1270917477950984192", "比亚迪-海洋"), BYD_HY("1181731554985156608", "比亚迪-海洋"),
BYD_TS("1270917477950984192", "比亚迪-腾势"), BYD_TS("1059328720988442624", "比亚迪-腾势"),
BYD_FCB("1270917477950984192", "比亚迪-方程豹"), BYD_FCB("xxxxx", "比亚迪-方程豹"),
SQDZ("869753088184930304", "SWM斯威汽车"); SQDZ("869753088184930304", "SWM斯威汽车");
// TODO: 修改ID // TODO: 修改ID
......
...@@ -57,16 +57,19 @@ public class BydOpenService { ...@@ -57,16 +57,19 @@ public class BydOpenService {
Page<XiaoHongShuAuthorDay> data = authorDayMapper.queryAuthorDayByPrincipalId(page, principal.id, startDate, endDate); Page<XiaoHongShuAuthorDay> data = authorDayMapper.queryAuthorDayByPrincipalId(page, principal.id, startDate, endDate);
List<String> authorIds = data.getRecords().stream().map(XiaoHongShuAuthorDay::getAuthorId).distinct().collect(Collectors.toList()); List<String> authorIds = data.getRecords().stream().map(XiaoHongShuAuthorDay::getAuthorId).distinct().collect(Collectors.toList());
// QueryWrapper<XiaoHongShuAuthorInfo> wrapper = new QueryWrapper<>();
// wrapper.in("author_id", authorIds); Map<String, XiaoHongShuAuthorInfo> authorInfos = authorInfoMapper
Map<String, XiaoHongShuAuthorInfo> authorInfos = authorInfoMapper.queryAuthorInfoListByAuthorIds(authorIds).stream().distinct() .queryAuthorInfoListByAuthorIds(authorIds.isEmpty() ? Collections.singletonList("XXX") : authorIds)
.stream().distinct()
.collect(Collectors.toMap(XiaoHongShuAuthorInfo::getAuthorId, Function.identity())); .collect(Collectors.toMap(XiaoHongShuAuthorInfo::getAuthorId, Function.identity()));
List<String> memberIds = authorInfos.values().stream() List<String> memberIds = authorInfos.values().stream()
.flatMap(o-> o.getMemberIds().stream()) .flatMap(o-> o.getMemberIds().stream())
.collect(Collectors.toList()); .collect(Collectors.toList());
Map<String, MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds).stream().distinct() Map<String, MemberInfo> memberInfos = memberInfoMapper
.queryMemberInfoListByMemberIds(memberIds.isEmpty() ? Collections.singletonList("XXX"): memberIds)
.stream().distinct()
.collect(Collectors.toMap(MemberInfo::getMatrixMemberId, Function.identity())); .collect(Collectors.toMap(MemberInfo::getMatrixMemberId, Function.identity()));
List<BydXiaoHongShuAuthorDayVO> voList = data.getRecords().stream().map(x->{ List<BydXiaoHongShuAuthorDayVO> voList = data.getRecords().stream().map(x->{
...@@ -80,22 +83,22 @@ public class BydOpenService { ...@@ -80,22 +83,22 @@ public class BydOpenService {
vo.setIncludeTime(authorInfo.getIncludedTime()); vo.setIncludeTime(authorInfo.getIncludedTime());
if (Optional.ofNullable(authorInfo.getMemberIds()).isPresent()) { if (Optional.ofNullable(authorInfo.getMemberIds()).isPresent()) {
vo.setMemberInfos(authorInfo.getMemberIds().stream().map(id->{ vo.setMemberInfos(authorInfo.getMemberIds().stream().map(id->{
System.out.println("memberId: " + id);
MemberInfo info = memberInfos.get(id);
BydXiaoHongShuAuthorDayVO.MemberInfo infoVo = new BydXiaoHongShuAuthorDayVO.MemberInfo(); BydXiaoHongShuAuthorDayVO.MemberInfo infoVo = new BydXiaoHongShuAuthorDayVO.MemberInfo();
infoVo.setMemberId(info.getMatrixMemberId()); MemberInfo info = memberInfos.get(id);
infoVo.setMemberCode(info.getMatrixMemberCode()); if (Objects.nonNull(info)) {
infoVo.setMemberName(info.getMatrixMemberName()); infoVo.setMemberId(info.getMatrixMemberId());
infoVo.setAreaName(info.getAreaName()); infoVo.setMemberCode(info.getMatrixMemberCode());
infoVo.setVillageName(info.getVillageName()); infoVo.setMemberName(info.getMatrixMemberName());
infoVo.setPrincipalName(info.getPrincipalName()); infoVo.setAreaName(info.getAreaName());
infoVo.setCityName(info.getCityName()); infoVo.setVillageName(info.getVillageName());
infoVo.setProvinceName(info.getProvinceName()); infoVo.setPrincipalName(info.getPrincipalName());
infoVo.setCityName(info.getCityName());
infoVo.setProvinceName(info.getProvinceName());
}
return infoVo; return infoVo;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} else { } else {
vo.setMemberInfos(new ArrayList<>()); vo.setMemberInfos(new ArrayList<>());
System.out.println(authorInfo.getAuthorId());
} }
vo.setStatsDate(x.getStatisticsDay()); vo.setStatsDate(x.getStatisticsDay());
vo.setFansCntTotal(x.getFansCountTotal()); vo.setFansCntTotal(x.getFansCountTotal());
...@@ -122,7 +125,9 @@ public class BydOpenService { ...@@ -122,7 +125,9 @@ public class BydOpenService {
List<String> noteIds = data.getRecords().stream().map(XiaoHongShuNoteDay::getNoteId).distinct().collect(Collectors.toList()); List<String> noteIds = data.getRecords().stream().map(XiaoHongShuNoteDay::getNoteId).distinct().collect(Collectors.toList());
Map<String, XiaoHongShuNoteInfo> noteInfos = noteInfoMapper.queryNoteInfoListByNoteIds(noteIds).stream().distinct() Map<String, XiaoHongShuNoteInfo> noteInfos = noteInfoMapper
.queryNoteInfoListByNoteIds(noteIds.isEmpty() ? Collections.singletonList("XXX") : noteIds)
.stream().distinct()
.collect(Collectors.toMap(XiaoHongShuNoteInfo::getNoteId, Function.identity())); .collect(Collectors.toMap(XiaoHongShuNoteInfo::getNoteId, Function.identity()));
EsBaseQuery esQuery = new EsBaseQuery(); EsBaseQuery esQuery = new EsBaseQuery();
...@@ -145,8 +150,6 @@ public class BydOpenService { ...@@ -145,8 +150,6 @@ public class BydOpenService {
vo.setShareUrl(noteInfo.getShareUrl()); vo.setShareUrl(noteInfo.getShareUrl());
vo.setCoverUrl(noteInfo.getCoverUrl()); vo.setCoverUrl(noteInfo.getCoverUrl());
vo.setTopicNames(noteInfo.getTopicNames()); vo.setTopicNames(noteInfo.getTopicNames());
}else {
System.out.println(x.getNoteId());
} }
vo.setAuthorId(x.getAuthorId()); vo.setAuthorId(x.getAuthorId());
vo.setLikeCnt(x.getDiggCount()); vo.setLikeCnt(x.getDiggCount());
......
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