|
@@ -7,6 +7,7 @@ import com.fs.course.domain.FsUserCoursePeriod;
|
|
|
import com.fs.course.domain.FsUserCoursePeriodDays;
|
|
|
import com.fs.course.mapper.FsUserCoursePeriodDaysMapper;
|
|
|
import com.fs.course.mapper.FsUserCoursePeriodMapper;
|
|
|
+import com.fs.course.mapper.FsUserCourseVideoRedPackageMapper;
|
|
|
import com.fs.course.service.IFsUserCoursePeriodService;
|
|
|
import com.fs.course.vo.FsUserCoursePeriodVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,6 +37,8 @@ public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
|
|
|
private FsUserCoursePeriodMapper fsUserCoursePeriodMapper;
|
|
|
@Resource
|
|
|
private FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
|
|
|
+ @Resource
|
|
|
+ private FsUserCourseVideoRedPackageMapper fsUserCourseVideoRedPackageMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询会员营期
|
|
@@ -139,7 +142,18 @@ public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
|
|
|
if (checkPeriodStatus(periodIds)) {
|
|
|
throw new ServiceException("存在进行中或已结束的营期,不允许删除");
|
|
|
}
|
|
|
- return fsUserCoursePeriodMapper.updateBatchDelFlag(periodIds,1);
|
|
|
+ int flag = fsUserCoursePeriodMapper.updateBatchDelFlag(periodIds,1);
|
|
|
+ //删除课程
|
|
|
+ Set<Long> set = Arrays.asList(periodIds).stream().collect(Collectors.toSet());
|
|
|
+ List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectCourseVideoList(set);
|
|
|
+ List<Long> periodDayIds = fsUserCoursePeriodDays.stream().map(FsUserCoursePeriodDays::getId).collect(Collectors.toList());
|
|
|
+ List<Long> videoIds = fsUserCoursePeriodDays.stream().map(FsUserCoursePeriodDays::getVideoId).collect(Collectors.toList());
|
|
|
+ if(!periodDayIds.isEmpty()){
|
|
|
+ fsUserCoursePeriodDaysMapper.updateBatchDelFlag(periodDayIds.toArray(new Long[0]),1);
|
|
|
+ //删除红包记录
|
|
|
+ fsUserCourseVideoRedPackageMapper.updateBatchDelFlag(videoIds.toArray(new Long[0]),1);
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
}
|
|
|
private boolean checkPeriodStatus(Long[] ids) {
|
|
|
LocalDate currentDate = LocalDate.now(); // 2025-06-30
|