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

npe fix

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