Commit 74e78a6a authored by 刘基明's avatar 刘基明

npe fix

parent aafc72e2
...@@ -240,34 +240,43 @@ public class TopicService { ...@@ -240,34 +240,43 @@ public class TopicService {
} else { } else {
fund = Arrays.asList(new ProductInfoVO()); fund = Arrays.asList(new ProductInfoVO());
} }
if (CollectionUtils.isNotEmpty(fund)) {
TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.FUND.type) TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.FUND.type)
.subType(String.valueOf(entity.getSubjectSubType())) .subType(String.valueOf(entity.getSubjectSubType()))
.detail(TopicAttachmentDetail.builder().fund(fund.get(0)).build()).build(); .detail(TopicAttachmentDetail.builder().fund(fund.get(0)).build()).build();
attachements.add(attach); attachements.add(attach);
}
} else if (RelTypeEnum.FUND_COMPANY.type.equals(entity.getSubjectType().toString())) { } else if (RelTypeEnum.FUND_COMPANY.type.equals(entity.getSubjectType().toString())) {
// 资管人 // 资管人
List<FundCompanyVO> fundCompany = feignService.getFundCompany(Collections.singletonList(entity.getSubjectId())); List<FundCompanyVO> fundCompany = feignService.getFundCompany(Collections.singletonList(entity.getSubjectId()));
if (CollectionUtils.isNotEmpty(fundCompany)) {
FundCompanyVO company = fundCompany.get(0); FundCompanyVO company = fundCompany.get(0);
company.setType(String.valueOf(entity.getSubjectSubType())); // 公司类型 company.setType(String.valueOf(entity.getSubjectSubType())); // 公司类型
TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.FUND_COMPANY.type) TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.FUND_COMPANY.type)
.detail(TopicAttachmentDetail.builder().fundCompany(company).build()).build(); .detail(TopicAttachmentDetail.builder().fundCompany(company).build()).build();
attachements.add(attach); attachements.add(attach);
}
} else if (RelTypeEnum.NEW_COURSE_WARE.type.equals(entity.getSubjectType().toString())) { } else if (RelTypeEnum.NEW_COURSE_WARE.type.equals(entity.getSubjectType().toString())) {
// 课程包 // 课程包
List<CoursePackageSimpleResp> coursePackage = feignService.getCoursePackageList(Collections.singletonList(entity.getSubjectId())); List<CoursePackageSimpleResp> coursePackage = feignService.getCoursePackageList(Collections.singletonList(entity.getSubjectId()));
if (CollectionUtils.isNotEmpty(coursePackage)){
TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.NEW_COURSE_WARE.type) TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.NEW_COURSE_WARE.type)
.detail(TopicAttachmentDetail.builder().coursePackage(coursePackage.get(0)).build()).build(); .detail(TopicAttachmentDetail.builder().coursePackage(coursePackage.get(0)).build()).build();
attachements.add(attach); attachements.add(attach);
}
} else if (RelTypeEnum.OFFLINE_ACTIVITY.type.equals(entity.getSubjectType().toString())) { } else if (RelTypeEnum.OFFLINE_ACTIVITY.type.equals(entity.getSubjectType().toString())) {
// 线下活动 // 线下活动
List<OfflineActivitySimpleResp> activitySimpleList = feignService.getActivitySimpleList(Collections.singletonList(entity.getSubjectId())); List<OfflineActivitySimpleResp> activitySimpleList = feignService.getActivitySimpleList(Collections.singletonList(entity.getSubjectId()));
if (CollectionUtils.isNotEmpty(activitySimpleList)){
TopicAttachmentDetail detailVo = TopicAttachmentDetail.builder().activity(activitySimpleList.get(0)).build(); TopicAttachmentDetail detailVo = TopicAttachmentDetail.builder().activity(activitySimpleList.get(0)).build();
TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.OFFLINE_ACTIVITY.type).detail(detailVo).build(); TopicAttachment attach = TopicAttachment.builder().type(RelTypeEnum.OFFLINE_ACTIVITY.type).detail(detailVo).build();
attachements.add(attach); attachements.add(attach);
} }
} }
}
topic.setAttachments(attachements); topic.setAttachments(attachements);
......
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