|
@@ -7,6 +7,7 @@ import com.fs.common.annotation.DataSource;
|
|
|
import com.fs.common.enums.DataSourceType;
|
|
|
import com.fs.common.exception.base.BaseException;
|
|
|
import com.fs.common.utils.PubFun;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsUserCourse;
|
|
|
import com.fs.course.domain.FsUserCourseVideo;
|
|
@@ -32,6 +33,7 @@ import com.fs.sop.vo.VoiceVo;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -286,10 +288,14 @@ public class QwSopTempServiceImpl implements IQwSopTempService
|
|
|
@Override
|
|
|
public List<QwSopTempRedPackageVo> redList(String id) {
|
|
|
List<QwSopTempDay> dayList = qwSopTempRulesService.listByTempIdAll(id);
|
|
|
- if(dayList.isEmpty()){
|
|
|
+ if(CollectionUtils.isEmpty(dayList)){
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- List<QwSopTempRules> rules = dayList.stream().flatMap(e -> e.getList().stream()).collect(Collectors.toList());
|
|
|
+ List<QwSopTempRules> rules = dayList.stream()
|
|
|
+ .filter(e->e!= null && e.getList()!=null)
|
|
|
+ .flatMap(e -> e.getList().stream())
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
if(rules.isEmpty()){
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
@@ -297,7 +303,8 @@ public class QwSopTempServiceImpl implements IQwSopTempService
|
|
|
Map<Long, FsUserCourseVideoRedPackage> redMap = PubFun.listToMapByGroupObject(redPackageList, FsUserCourseVideoRedPackage::getVideoId);
|
|
|
List<FsUserCourseVideo> videoList = fsUserCourseVideoMapper.selectVideoByCourseId(rules.get(0).getCourseId());
|
|
|
Map<Long, FsUserCourseVideo> videoMap = PubFun.listToMapByGroupObject(videoList, FsUserCourseVideo::getVideoId);
|
|
|
- return rules.stream().filter(e -> redMap.containsKey(e.getVideoId()) && videoMap.containsKey(e.getVideoId())).map(e -> {
|
|
|
+ return rules.stream()
|
|
|
+ .filter(e -> e.getVideoId() != null && redMap.containsKey(e.getVideoId()) && videoMap.containsKey(e.getVideoId())).map(e -> {
|
|
|
FsUserCourseVideoRedPackage red = redMap.get(e.getVideoId());
|
|
|
FsUserCourseVideo video = videoMap.get(e.getVideoId());
|
|
|
QwSopTempRedPackageVo vo = new QwSopTempRedPackageVo();
|
|
@@ -414,12 +421,16 @@ public class QwSopTempServiceImpl implements IQwSopTempService
|
|
|
public QwSopTempDay selectRulesInfo(Long id) {
|
|
|
QwSopTempDay day = qwSopTempDayService.info(id);
|
|
|
List<QwSopTempRules> rulesList = qwSopTempRulesService.listByDayId(id);
|
|
|
- if(!rulesList.isEmpty()){
|
|
|
+ if(CollectionUtils.isNotEmpty(rulesList)){
|
|
|
List<QwSopTempContent> contentList = qwSopTempContentService.listByRulesIds(PubFun.listToNewList(rulesList, QwSopTempRules::getId));
|
|
|
Map<Long, List<QwSopTempContent>> contentMap = PubFun.listToMapByGroupList(contentList, QwSopTempContent::getRulesId);
|
|
|
rulesList.forEach(e -> {
|
|
|
List<QwSopTempContent> contents = contentMap.get(e.getId());
|
|
|
- e.setSetting(contents.stream().map(c -> JSON.parseObject(c.getContent())).collect(Collectors.toList()));
|
|
|
+ if(CollectionUtils.isNotEmpty(contents)){
|
|
|
+ e.setSetting(contents.stream()
|
|
|
+ .filter(c-> c!=null && StringUtils.isNotBlank(c.getContent()))
|
|
|
+ .map(c -> JSON.parseObject(c.getContent())).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
day.setList(rulesList);
|