|
@@ -210,55 +210,46 @@ public class QwSopTempServiceImpl implements IQwSopTempService
|
|
|
day.setName("第" + day.getDayNum() + "天");
|
|
|
day.setSorts(day.getDayNum());
|
|
|
day.setList(new ArrayList<>());
|
|
|
- QwSopTempRules rules = new QwSopTempRules();
|
|
|
- rules.setTempId(temp.getId());
|
|
|
- rules.setName(day.getName());
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
- rules.setTime(e.getViewStartTime().format(formatter));
|
|
|
- rules.setContentType(2);
|
|
|
- rules.setType(2);
|
|
|
- rules.setCourseType(0);
|
|
|
- rules.setCourseId(e.getCourseId());
|
|
|
- rules.setVideoId(e.getVideoId());
|
|
|
- rules.setSorts(0);
|
|
|
- day.getList().add(rules);
|
|
|
- QwSopTempContent content = new QwSopTempContent();
|
|
|
- content.setTempId(temp.getId());
|
|
|
- content.setContentType(3);
|
|
|
- QwSopTempSetting2.Content.Setting setting = new QwSopTempSetting2.Content.Setting();
|
|
|
- setting.setLinkTitle(fsUserCourse.getCourseName());
|
|
|
- setting.setIsBindUrl(1);
|
|
|
- setting.setLinkDescribe(e.getTitle());
|
|
|
- setting.setLinkImageUrl(fsUserCourse.getImgUrl());
|
|
|
- setting.setContentType("3");
|
|
|
- content.setContent(JSON.toJSONString(setting));
|
|
|
- content.setIsBindUrl(1);
|
|
|
- rules.setList(Collections.singletonList(content));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(temp.getTimeList() != null && !temp.getTimeList().isEmpty()){
|
|
|
- AtomicInteger sorts = new AtomicInteger(1);
|
|
|
- List<QwSopTempRules> rulesList = temp.getTimeList().stream().map(time -> {
|
|
|
- QwSopTempRules rulesSub = new QwSopTempRules();
|
|
|
- rulesSub.setTempId(temp.getId());
|
|
|
- rulesSub.setName(day.getName());
|
|
|
- rulesSub.setTime(time);
|
|
|
- rulesSub.setContentType(1);
|
|
|
- rulesSub.setType(1);
|
|
|
- rulesSub.setSorts(sorts.getAndIncrement());
|
|
|
- QwSopTempContent contentSbu = new QwSopTempContent();
|
|
|
- contentSbu.setTempId(temp.getId());
|
|
|
- contentSbu.setContentType(1);
|
|
|
- QwSopTempSetting2.Content.Setting settingSub = new QwSopTempSetting2.Content.Setting();
|
|
|
- settingSub.setContentType("1");
|
|
|
- settingSub.setValue("");
|
|
|
- contentSbu.setContent(JSON.toJSONString(settingSub));
|
|
|
- rulesSub.setList(Collections.singletonList(contentSbu));
|
|
|
- return rulesSub;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- day.getList().addAll(rulesList);
|
|
|
+ if(temp.getTimeList() == null){
|
|
|
+ temp.setTimeList(new ArrayList<>());
|
|
|
}
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
+ temp.getTimeList().add(0, e.getViewStartTime().format(formatter));
|
|
|
+ AtomicInteger sorts = new AtomicInteger(0);
|
|
|
+ List<QwSopTempRules> rulesList = temp.getTimeList().stream().map(time -> {
|
|
|
+ QwSopTempRules rules = new QwSopTempRules();
|
|
|
+ rules.setTempId(temp.getId());
|
|
|
+ rules.setName(day.getName());
|
|
|
+ rules.setTime(time);
|
|
|
+ rules.setContentType(2);
|
|
|
+ rules.setType(2);
|
|
|
+ rules.setCourseType(0);
|
|
|
+ rules.setCourseId(e.getCourseId());
|
|
|
+ rules.setVideoId(e.getVideoId());
|
|
|
+ rules.setSorts(sorts.getAndIncrement());
|
|
|
+ // 设置消息类型
|
|
|
+ if(rules.getSorts() == 0){
|
|
|
+ rules.setCourseType(0);
|
|
|
+ }else if(rules.getSorts() == 1){
|
|
|
+ rules.setCourseType(1);
|
|
|
+ }else{
|
|
|
+ rules.setCourseType(4);
|
|
|
+ }
|
|
|
+ QwSopTempContent content = new QwSopTempContent();
|
|
|
+ content.setTempId(temp.getId());
|
|
|
+ content.setContentType(3);
|
|
|
+ QwSopTempSetting2.Content.Setting setting = new QwSopTempSetting2.Content.Setting();
|
|
|
+ setting.setLinkTitle(fsUserCourse.getCourseName());
|
|
|
+ setting.setIsBindUrl(1);
|
|
|
+ setting.setLinkDescribe(e.getTitle());
|
|
|
+ setting.setLinkImageUrl(fsUserCourse.getImgUrl());
|
|
|
+ setting.setContentType("3");
|
|
|
+ content.setContent(JSON.toJSONString(setting));
|
|
|
+ content.setIsBindUrl(1);
|
|
|
+ rules.setList(Collections.singletonList(content));
|
|
|
+ return rules;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ day.getList().addAll(rulesList);
|
|
|
return day;
|
|
|
}).collect(Collectors.toList());
|
|
|
qwSopTempDayService.addOrUpdateBatch(collect);
|