|  | @@ -55,8 +55,7 @@ import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  @AllArgsConstructor
 | 
	
		
			
				|  |  | -public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  | -{
 | 
	
		
			
				|  |  | +public class QwSopTempServiceImpl implements IQwSopTempService {
 | 
	
		
			
				|  |  |      private final QwSopTempMapper qwSopTempMapper;
 | 
	
		
			
				|  |  |      private final FastGptChatReplaceWordsMapper fastGptChatReplaceWordsMapper;
 | 
	
		
			
				|  |  |      private final IQwSopTempRulesService qwSopTempRulesService;
 | 
	
	
		
			
				|  | @@ -76,10 +75,10 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return sop模板
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public QwSopTemp selectQwSopTempById(String id){
 | 
	
		
			
				|  |  | +    public QwSopTemp selectQwSopTempById(String id) {
 | 
	
		
			
				|  |  |  //        QwSopTemp qwSopTemp = qwSopTempMapper.selectQwSopTempById(id);
 | 
	
		
			
				|  |  |          QwSopTemp qwSopTemp = qwSopTempMapper.selectQwSopTempById(id);
 | 
	
		
			
				|  |  | -        if(qwSopTemp == null) return null;
 | 
	
		
			
				|  |  | +        if (qwSopTemp == null) return null;
 | 
	
		
			
				|  |  |          List<QwSopTempDay> qwSopTempDays = qwSopTempDayService.listByTempId(id);
 | 
	
		
			
				|  |  |          qwSopTemp.setList(qwSopTempDays);
 | 
	
		
			
				|  |  |  //        List<QwSopTempRules> rulesList = qwSopTempRulesService.listByTempId(id);
 | 
	
	
		
			
				|  | @@ -107,8 +106,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return sop模板
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public List<QwSopTemp> selectQwSopTempList(QwSopTemp qwSopTemp)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | +    public List<QwSopTemp> selectQwSopTempList(QwSopTemp qwSopTemp) {
 | 
	
		
			
				|  |  |          return qwSopTempMapper.selectQwSopTempList(qwSopTemp);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -119,7 +117,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public int insertQwSopTemp(QwSopTemp qwSopTemp){
 | 
	
		
			
				|  |  | +    public int insertQwSopTemp(QwSopTemp qwSopTemp) {
 | 
	
		
			
				|  |  |          qwSopTemp.setId(UUID.randomUUID().toString());
 | 
	
		
			
				|  |  |          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |          qwSopTemp.setCreateTime(sdf.format(new Date()));
 | 
	
	
		
			
				|  | @@ -145,7 +143,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public int updateQwSopTemp(QwSopTemp qwSopTemp){
 | 
	
		
			
				|  |  | +    public int updateQwSopTemp(QwSopTemp qwSopTemp) {
 | 
	
		
			
				|  |  |          return qwSopTempMapper.updateQwSopTemp(qwSopTemp);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -156,8 +154,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public int deleteQwSopTempByIds(String[] ids)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | +    public int deleteQwSopTempByIds(String[] ids) {
 | 
	
		
			
				|  |  |          return qwSopTempMapper.deleteQwSopTempByIds(ids);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -183,8 +180,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public int deleteQwSopTempById(String id)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | +    public int deleteQwSopTempById(String id) {
 | 
	
		
			
				|  |  |          return qwSopTempMapper.deleteQwSopTempById(id);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -213,11 +209,11 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |              day.setSorts(day.getDayNum());
 | 
	
		
			
				|  |  |              day.setList(new ArrayList<>());
 | 
	
		
			
				|  |  |              List<String> timeList = new ArrayList<>();
 | 
	
		
			
				|  |  | -            if(temp.getTimeList() != null){
 | 
	
		
			
				|  |  | +            if (temp.getTimeList() != null) {
 | 
	
		
			
				|  |  |                  timeList = JSON.parseArray(JSON.toJSONString(temp.getTimeList()), String.class);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
 | 
	
		
			
				|  |  | -            if(e.getViewStartTime() == null){
 | 
	
		
			
				|  |  | +            if (e.getViewStartTime() == null) {
 | 
	
		
			
				|  |  |                  e.setViewStartTime(LocalTime.of(9, 0));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              timeList.add(0, e.getViewStartTime().format(formatter));
 | 
	
	
		
			
				|  | @@ -234,11 +230,11 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |                  rules.setVideoId(e.getVideoId());
 | 
	
		
			
				|  |  |                  rules.setSorts(sorts.getAndIncrement());
 | 
	
		
			
				|  |  |                  // 设置消息类型
 | 
	
		
			
				|  |  | -                if(rules.getSorts() == 0){
 | 
	
		
			
				|  |  | +                if (rules.getSorts() == 0) {
 | 
	
		
			
				|  |  |                      rules.setCourseType(0);
 | 
	
		
			
				|  |  | -                }else if(rules.getSorts() == 1){
 | 
	
		
			
				|  |  | +                } else if (rules.getSorts() == 1) {
 | 
	
		
			
				|  |  |                      rules.setCourseType(1);
 | 
	
		
			
				|  |  | -                }else{
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  |                      rules.setCourseType(4);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  QwSopTempContent content = new QwSopTempContent();
 | 
	
	
		
			
				|  | @@ -270,15 +266,14 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          CourseConfig courseConfig = JSON.parseObject(sysConfig.getConfigValue(), CourseConfig.class);
 | 
	
		
			
				|  |  |          List<Long> videoIdList = PubFun.listToNewList(ruleList, QwSopTempRules::getVideoId);
 | 
	
		
			
				|  |  |          Map<Long, Optional<BigDecimal>> redMap;
 | 
	
		
			
				|  |  | -        if(!videoIdList.isEmpty()){
 | 
	
		
			
				|  |  | +        if (!videoIdList.isEmpty()) {
 | 
	
		
			
				|  |  |              List<FsUserCourseVideoRedPackage> redPackageList = fsUserCourseVideoRedPackageService.listByCompanyIdAndVideoIds(temp.getCompanyId(), videoIdList);
 | 
	
		
			
				|  |  |              redMap = redPackageList.stream().collect(Collectors.groupingBy(FsUserCourseVideoRedPackage::getVideoId, Collectors.mapping(FsUserCourseVideoRedPackage::getRedPacketMoney, Collectors.reducing((e1, e2) -> e1))));
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              redMap = new HashMap<>();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            FsUserCourseVideoRedPackage red = new FsUserCourseVideoRedPackage();List<FsUserCourseVideoRedPackage> redPackage = ruleList.stream().filter(e -> e.getVideoId() != null && e.getSorts() == 0).map(e -> {
 | 
	
		
			
				|  |  | +        FsUserCourseVideoRedPackage red = new FsUserCourseVideoRedPackage();
 | 
	
		
			
				|  |  | +        List<FsUserCourseVideoRedPackage> redPackage = ruleList.stream().filter(e -> e.getVideoId() != null && e.getSorts() == 0).map(e -> {
 | 
	
		
			
				|  |  |              red.setCompanyId(temp.getCompanyId());
 | 
	
		
			
				|  |  |              red.setVideoId(e.getVideoId());
 | 
	
		
			
				|  |  |              red.setRedPacketMoney(redMap.getOrDefault(e.getVideoId(), Optional.of(courseConfig.getRedPackageMoney())).orElse(BigDecimal.ZERO));
 | 
	
	
		
			
				|  | @@ -292,15 +287,15 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<QwSopTempRedPackageVo> redList(String id) {
 | 
	
		
			
				|  |  |          List<QwSopTempDay> dayList = qwSopTempRulesService.listByTempIdAll(id);
 | 
	
		
			
				|  |  | -        if(CollectionUtils.isEmpty(dayList)){
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(dayList)) {
 | 
	
		
			
				|  |  |              return Collections.emptyList();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<QwSopTempRules> rules = dayList.stream()
 | 
	
		
			
				|  |  | -                .filter(e->e!= null && e.getList()!=null)
 | 
	
		
			
				|  |  | +                .filter(e -> e != null && e.getList() != null)
 | 
	
		
			
				|  |  |                  .flatMap(e -> e.getList().stream())
 | 
	
		
			
				|  |  |                  .filter(Objects::nonNull)
 | 
	
		
			
				|  |  |                  .collect(Collectors.toList());
 | 
	
		
			
				|  |  | -        if(rules.isEmpty()){
 | 
	
		
			
				|  |  | +        if (rules.isEmpty()) {
 | 
	
		
			
				|  |  |              return Collections.emptyList();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<FsUserCourseVideoRedPackage> redPackageList = fsUserCourseVideoRedPackageService.listByRuleIds(PubFun.listToNewList(rules, QwSopTempRules::getId));
 | 
	
	
		
			
				|  | @@ -309,19 +304,19 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          Map<Long, FsUserCourseVideo> videoMap = PubFun.listToMapByGroupObject(videoList, FsUserCourseVideo::getVideoId);
 | 
	
		
			
				|  |  |          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();
 | 
	
		
			
				|  |  | -            vo.setId(red.getId());
 | 
	
		
			
				|  |  | -            vo.setRuleId(e.getId());
 | 
	
		
			
				|  |  | -            vo.setName(e.getName());
 | 
	
		
			
				|  |  | -            vo.setVideoId(e.getVideoId());
 | 
	
		
			
				|  |  | -            vo.setVideoName(video.getTitle());
 | 
	
		
			
				|  |  | -            vo.setCompanyId(red.getCompanyId());
 | 
	
		
			
				|  |  | -            vo.setRedPacketMoney(red.getRedPacketMoney());
 | 
	
		
			
				|  |  | -            vo.setDataType(red.getDataType());
 | 
	
		
			
				|  |  | -            return vo;
 | 
	
		
			
				|  |  | -        }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                    FsUserCourseVideoRedPackage red = redMap.get(e.getVideoId());
 | 
	
		
			
				|  |  | +                    FsUserCourseVideo video = videoMap.get(e.getVideoId());
 | 
	
		
			
				|  |  | +                    QwSopTempRedPackageVo vo = new QwSopTempRedPackageVo();
 | 
	
		
			
				|  |  | +                    vo.setId(red.getId());
 | 
	
		
			
				|  |  | +                    vo.setRuleId(e.getId());
 | 
	
		
			
				|  |  | +                    vo.setName(e.getName());
 | 
	
		
			
				|  |  | +                    vo.setVideoId(e.getVideoId());
 | 
	
		
			
				|  |  | +                    vo.setVideoName(video.getTitle());
 | 
	
		
			
				|  |  | +                    vo.setCompanyId(red.getCompanyId());
 | 
	
		
			
				|  |  | +                    vo.setRedPacketMoney(red.getRedPacketMoney());
 | 
	
		
			
				|  |  | +                    vo.setDataType(red.getDataType());
 | 
	
		
			
				|  |  | +                    return vo;
 | 
	
		
			
				|  |  | +                }).collect(Collectors.toList());
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -344,7 +339,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("course.config");
 | 
	
		
			
				|  |  |          CourseConfig courseConfig = JSON.parseObject(sysConfig.getConfigValue(), CourseConfig.class);
 | 
	
		
			
				|  |  |          List<CourseConfig.DisabledTimeVo> disabledTimeList = courseConfig.getDisabledTimeList();
 | 
	
		
			
				|  |  | -        if(disabledTimeList == null){
 | 
	
		
			
				|  |  | +        if (disabledTimeList == null) {
 | 
	
		
			
				|  |  |              return Collections.emptyList();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return TimeCalculator.calculateAvailableTimes(disabledTimeList);
 | 
	
	
		
			
				|  | @@ -355,7 +350,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |      public int update(QwSopTemp qwSopTemp) {
 | 
	
		
			
				|  |  |          QwSopTemp temp = qwSopTempMapper.selectById(qwSopTemp.getId());
 | 
	
		
			
				|  |  |          int i = qwSopTempMapper.updateById(qwSopTemp);
 | 
	
		
			
				|  |  | -        if(!Objects.equals(temp.getGap(), qwSopTemp.getGap())){
 | 
	
		
			
				|  |  | +        if (!Objects.equals(temp.getGap(), qwSopTemp.getGap())) {
 | 
	
		
			
				|  |  |              // 重新排序
 | 
	
		
			
				|  |  |              reorder(qwSopTemp.getId());
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -367,14 +362,14 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          List<QwSopTempRules> list = day.getList();
 | 
	
		
			
				|  |  |          List<QwSopTempContent> collect = list.stream().flatMap(e -> e.getSettingList().stream()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |          List<QwSopTempContent> voiceList = collect.stream().filter(e -> e.getContentType() == 7).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -        if(!voiceList.isEmpty()){
 | 
	
		
			
				|  |  | +        if (!voiceList.isEmpty()) {
 | 
	
		
			
				|  |  |  //            day.setVoice(1);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          qwSopTempDayService.saveOrUpdate(day);
 | 
	
		
			
				|  |  |          qwSopTempRulesService.removeByDayId(day.getId());
 | 
	
		
			
				|  |  |          qwSopTempContentService.removeByDayId(day.getId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        list.forEach(item-> item.setDayId(day.getId()));
 | 
	
		
			
				|  |  | +        list.forEach(item -> item.setDayId(day.getId()));
 | 
	
		
			
				|  |  |          processAndReplaceContent(list);
 | 
	
		
			
				|  |  |          QwSopTempRules rules = list.get(0);
 | 
	
		
			
				|  |  |          String tempId = rules.getTempId();
 | 
	
	
		
			
				|  | @@ -392,19 +387,19 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          reorder(day.getTempId());
 | 
	
		
			
				|  |  |          Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  |          map.put("id", day.getId());
 | 
	
		
			
				|  |  | -        if(!voiceList.isEmpty()){
 | 
	
		
			
				|  |  | +        if (!voiceList.isEmpty()) {
 | 
	
		
			
				|  |  |              rocketMQTemplate.syncSend("voice-generation", JSON.toJSONString(VoiceVo.builder().type(0).id(day.getId().toString()).build()));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return map;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void processAndReplaceContent(List<QwSopTempRules> tempSettings){
 | 
	
		
			
				|  |  | +    private void processAndReplaceContent(List<QwSopTempRules> tempSettings) {
 | 
	
		
			
				|  |  |          List<FastGptChatReplaceWords> words = fastGptChatReplaceWordsMapper.selectAllFastGptChatReplaceWords();
 | 
	
		
			
				|  |  |          //循环天
 | 
	
		
			
				|  |  | -        tempSettings.forEach(settingList->{
 | 
	
		
			
				|  |  | +        tempSettings.forEach(settingList -> {
 | 
	
		
			
				|  |  |              //循环单日
 | 
	
		
			
				|  |  | -            settingList.getSettingList().forEach(item->{
 | 
	
		
			
				|  |  | +            settingList.getSettingList().forEach(item -> {
 | 
	
		
			
				|  |  |                  JSONObject obj = JSON.parseObject(item.getContent());
 | 
	
		
			
				|  |  |                  List<String> list = Arrays.asList("linkTitle", "linkDescribe", "desc", "nickname", "value");
 | 
	
		
			
				|  |  |                  list.stream().filter(obj::containsKey).forEach(key -> {
 | 
	
	
		
			
				|  | @@ -417,25 +412,26 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void delRules(Long id) {
 | 
	
		
			
				|  |  | -        if(id == null) return;
 | 
	
		
			
				|  |  | +        if (id == null) return;
 | 
	
		
			
				|  |  |          QwSopTempDay day = qwSopTempDayService.info(id);
 | 
	
		
			
				|  |  | -        if(day == null) return;
 | 
	
		
			
				|  |  | +        if (day == null) return;
 | 
	
		
			
				|  |  |          qwSopTempDayService.removeById(day.getId());
 | 
	
		
			
				|  |  |          qwSopTempContentService.removeByDayId(day.getId());
 | 
	
		
			
				|  |  |          reorder(day.getTempId());
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public QwSopTempDay selectRulesInfo(Long id) {
 | 
	
		
			
				|  |  |          QwSopTempDay day = qwSopTempDayService.info(id);
 | 
	
		
			
				|  |  |          List<QwSopTempRules> rulesList = qwSopTempRulesService.listByDayId(id);
 | 
	
		
			
				|  |  | -        if(CollectionUtils.isNotEmpty(rulesList)){
 | 
	
		
			
				|  |  | +        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());
 | 
	
		
			
				|  |  | -                if(CollectionUtils.isNotEmpty(contents)){
 | 
	
		
			
				|  |  | +                if (CollectionUtils.isNotEmpty(contents)) {
 | 
	
		
			
				|  |  |                      e.setSetting(contents.stream()
 | 
	
		
			
				|  |  | -                            .filter(c-> c!=null && StringUtils.isNotBlank(c.getContent()))
 | 
	
		
			
				|  |  | +                            .filter(c -> c != null && StringUtils.isNotBlank(c.getContent()))
 | 
	
		
			
				|  |  |                              .map(c -> JSON.parseObject(c.getContent())).collect(Collectors.toList()));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              });
 | 
	
	
		
			
				|  | @@ -447,7 +443,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<QwSopTemp> selectQwSopTempListNew(QwSopTemp qwSopTemp) {
 | 
	
		
			
				|  |  |          List<QwSopTemp> list = qwSopTempMapper.selectQwSopTempListNew(qwSopTemp);
 | 
	
		
			
				|  |  | -        if(qwSopTemp.isCuoser()){
 | 
	
		
			
				|  |  | +        if (qwSopTemp.isCuoser()) {
 | 
	
		
			
				|  |  |              List<QwSopTempRules> rulesList = qwSopTempRulesService.selectByTemplateIds(PubFun.listToNewList(list, QwSopTemp::getId));
 | 
	
		
			
				|  |  |              rulesList.sort(Comparator.comparing(
 | 
	
		
			
				|  |  |                      e -> {
 | 
	
	
		
			
				|  | @@ -476,18 +472,18 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |          qwSopTemp.setId(newId);
 | 
	
		
			
				|  |  |          qwSopTempMapper.insertQwSopTemp(qwSopTemp);
 | 
	
		
			
				|  |  |          List<QwSopTempDay> dayList = qwSopTempRulesService.listByTempIdAll(oldId);
 | 
	
		
			
				|  |  | -        if(dayList.isEmpty()) return;
 | 
	
		
			
				|  |  | +        if (dayList.isEmpty()) return;
 | 
	
		
			
				|  |  |          List<QwSopTempRules> ruleList = dayList.stream().filter(e -> e.getList() != null).flatMap(e -> e.getList().stream()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -        if(ruleList.isEmpty()) return;
 | 
	
		
			
				|  |  | +        if (ruleList.isEmpty()) return;
 | 
	
		
			
				|  |  |          List<FsUserCourseVideoRedPackage> redList = fsUserCourseVideoRedPackageService.selectByRuleIds(PubFun.listToNewList(ruleList, QwSopTempRules::getId));
 | 
	
		
			
				|  |  |          Map<Long, FsUserCourseVideoRedPackage> redMap = PubFun.listToMapByGroupObject(redList, FsUserCourseVideoRedPackage::getRuleId);
 | 
	
		
			
				|  |  |          dayList.forEach(day -> {
 | 
	
		
			
				|  |  |              day.setTempId(newId);
 | 
	
		
			
				|  |  | -            if(day.getList() != null && !day.getList().isEmpty()){
 | 
	
		
			
				|  |  | +            if (day.getList() != null && !day.getList().isEmpty()) {
 | 
	
		
			
				|  |  |                  day.getList().forEach(e -> {
 | 
	
		
			
				|  |  |                      e.setRed(redMap.get(e.getId()));
 | 
	
		
			
				|  |  |                      e.setTempId(newId);
 | 
	
		
			
				|  |  | -                    if(e.getSettingList() != null && !e.getSettingList().isEmpty()){
 | 
	
		
			
				|  |  | +                    if (e.getSettingList() != null && !e.getSettingList().isEmpty()) {
 | 
	
		
			
				|  |  |                          e.getSettingList().forEach(item -> {
 | 
	
		
			
				|  |  |                              item.setTempId(newId);
 | 
	
		
			
				|  |  |                          });
 | 
	
	
		
			
				|  | @@ -503,9 +499,9 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |              item.setRulesId(e.getId());
 | 
	
		
			
				|  |  |              item.setDayId(e.getDayId());
 | 
	
		
			
				|  |  |          }));
 | 
	
		
			
				|  |  | -        qwSopTempContentService.insertBatch(collect.stream().flatMap(e ->e.getSettingList().stream()).collect(Collectors.toList()));
 | 
	
		
			
				|  |  | +        qwSopTempContentService.insertBatch(collect.stream().flatMap(e -> e.getSettingList().stream()).collect(Collectors.toList()));
 | 
	
		
			
				|  |  |          List<FsUserCourseVideoRedPackage> redSaveList = collect.stream().filter(e -> e.getRed() != null).peek(e -> e.getRed().setRuleId(e.getId())).map(QwSopTempRules::getRed).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -        if(!redSaveList.isEmpty()){
 | 
	
		
			
				|  |  | +        if (!redSaveList.isEmpty()) {
 | 
	
		
			
				|  |  |              fsUserCourseVideoRedPackageService.batchSaveCompanyRedPackage(redSaveList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -521,7 +517,7 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |      public void sortDay(List<SortDayVo> list) {
 | 
	
		
			
				|  |  |          Collection<QwSopTempDay> days = qwSopTempDayService.listByIds(PubFun.listToNewList(list, SortDayVo::getId));
 | 
	
		
			
				|  |  |          Map<Long, Integer> dayMap = list.stream().collect(Collectors.toMap(SortDayVo::getId, SortDayVo::getDayNum));
 | 
	
		
			
				|  |  | -        if(days.stream().anyMatch(e -> !dayMap.containsKey(e.getId()))){
 | 
	
		
			
				|  |  | +        if (days.stream().anyMatch(e -> !dayMap.containsKey(e.getId()))) {
 | 
	
		
			
				|  |  |              throw new BaseException("数据错误!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          days.forEach(day -> day.setDayNum(dayMap.get(day.getId())));
 | 
	
	
		
			
				|  | @@ -535,10 +531,10 @@ public class QwSopTempServiceImpl implements IQwSopTempService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @DataSource(DataSourceType.SOP)
 | 
	
		
			
				|  |  | -    private void reorder(String tempId){
 | 
	
		
			
				|  |  | +    private void reorder(String tempId) {
 | 
	
		
			
				|  |  |          QwSopTemp qwSopTemp = qwSopTempMapper.selectQwSopTempById(tempId);
 | 
	
		
			
				|  |  |          List<QwSopTempDay> days = qwSopTempDayService.listByTempId(tempId);
 | 
	
		
			
				|  |  | -        if(days.isEmpty()) return;
 | 
	
		
			
				|  |  | +        if (days.isEmpty()) return;
 | 
	
		
			
				|  |  |          for (int i = 0; i < days.size(); i++) {
 | 
	
		
			
				|  |  |              QwSopTempDay entity = days.get(i);
 | 
	
		
			
				|  |  |              entity.setSorts(i);
 |