|
@@ -6,12 +6,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
import com.fs.common.exception.ServiceException;
|
|
|
|
|
+import com.fs.common.utils.bean.BeanUtils;
|
|
|
import com.fs.course.domain.FsUserCoursePeriod;
|
|
import com.fs.course.domain.FsUserCoursePeriod;
|
|
|
|
|
+import com.fs.course.domain.FsUserCoursePeriodCompany;
|
|
|
import com.fs.course.domain.FsUserCoursePeriodDays;
|
|
import com.fs.course.domain.FsUserCoursePeriodDays;
|
|
|
import com.fs.course.mapper.FsUserCoursePeriodDaysMapper;
|
|
import com.fs.course.mapper.FsUserCoursePeriodDaysMapper;
|
|
|
import com.fs.course.mapper.FsUserCoursePeriodMapper;
|
|
import com.fs.course.mapper.FsUserCoursePeriodMapper;
|
|
|
import com.fs.course.mapper.FsUserCourseVideoRedPackageMapper;
|
|
import com.fs.course.mapper.FsUserCourseVideoRedPackageMapper;
|
|
|
import com.fs.course.param.PeriodStatisticCountParam;
|
|
import com.fs.course.param.PeriodStatisticCountParam;
|
|
|
|
|
+import com.fs.course.service.IFsUserCoursePeriodCompanyService;
|
|
|
|
|
+import com.fs.course.service.IFsUserCoursePeriodDaysService;
|
|
|
import com.fs.course.service.IFsUserCoursePeriodService;
|
|
import com.fs.course.service.IFsUserCoursePeriodService;
|
|
|
import com.fs.course.vo.FsCourseStaticsCountVO;
|
|
import com.fs.course.vo.FsCourseStaticsCountVO;
|
|
|
import com.fs.course.vo.FsUserCoursePeriodVO;
|
|
import com.fs.course.vo.FsUserCoursePeriodVO;
|
|
@@ -46,6 +50,10 @@ public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
|
|
|
private FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
|
|
private FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
|
|
|
@Resource
|
|
@Resource
|
|
|
private FsUserCourseVideoRedPackageMapper fsUserCourseVideoRedPackageMapper;
|
|
private FsUserCourseVideoRedPackageMapper fsUserCourseVideoRedPackageMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IFsUserCoursePeriodDaysService fsUserCoursePeriodDaysService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IFsUserCoursePeriodCompanyService fsUserCoursePeriodCompanyService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询会员营期
|
|
* 查询会员营期
|
|
@@ -214,6 +222,59 @@ public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
|
|
|
return fsUserCoursePeriodMapper.selectFsUserCoursePeriodPage(fsUserCoursePeriod);
|
|
return fsUserCoursePeriodMapper.selectFsUserCoursePeriodPage(fsUserCoursePeriod);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 复制营期(含课程及关联公司)
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long copyPeriod(Long periodId) {
|
|
|
|
|
+ FsUserCoursePeriod source = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(periodId);
|
|
|
|
|
+ if (Objects.isNull(source)) {
|
|
|
|
|
+ throw new ServiceException("营期不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.equals(source.getDelFlag(), 1)) {
|
|
|
|
|
+ throw new ServiceException("营期已删除,无法复制");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCoursePeriod copy = new FsUserCoursePeriod();
|
|
|
|
|
+ BeanUtils.copyProperties(source, copy, "periodId");
|
|
|
|
|
+ copy.setPeriodName(source.getPeriodName() + " - 副本");
|
|
|
|
|
+ copy.setDelFlag(0);
|
|
|
|
|
+ copy.setUpdateTime(null);
|
|
|
|
|
+ insertFsUserCoursePeriod(copy);
|
|
|
|
|
+
|
|
|
|
|
+ Long newPeriodId = copy.getPeriodId();
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCoursePeriodDays queryDays = new FsUserCoursePeriodDays();
|
|
|
|
|
+ queryDays.setPeriodId(periodId);
|
|
|
|
|
+ List<FsUserCoursePeriodDays> courseList = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysList(queryDays);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(courseList)) {
|
|
|
|
|
+ List<FsUserCoursePeriodDays> copyCourseList = courseList.stream().map(day -> {
|
|
|
|
|
+ FsUserCoursePeriodDays copyDay = new FsUserCoursePeriodDays();
|
|
|
|
|
+ BeanUtils.copyProperties(day, copyDay, "id");
|
|
|
|
|
+ copyDay.setPeriodId(newPeriodId);
|
|
|
|
|
+ copyDay.setCreateTime(new Date());
|
|
|
|
|
+ copyDay.setUpdateTime(null);
|
|
|
|
|
+ return copyDay;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ fsUserCoursePeriodDaysService.saveBatch(copyCourseList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<FsUserCoursePeriodCompany> companyList = fsUserCoursePeriodCompanyService.list(
|
|
|
|
|
+ Wrappers.<FsUserCoursePeriodCompany>lambdaQuery().eq(FsUserCoursePeriodCompany::getPeriodId, periodId));
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(companyList)) {
|
|
|
|
|
+ List<FsUserCoursePeriodCompany> copyCompanyList = companyList.stream().map(company -> {
|
|
|
|
|
+ FsUserCoursePeriodCompany copyCompany = new FsUserCoursePeriodCompany();
|
|
|
|
|
+ BeanUtils.copyProperties(company, copyCompany, "id");
|
|
|
|
|
+ copyCompany.setPeriodId(newPeriodId);
|
|
|
|
|
+ return copyCompany;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ fsUserCoursePeriodCompanyService.saveBatch(copyCompanyList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return newPeriodId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 结束营期
|
|
* 结束营期
|
|
|
* @param id 营期ID
|
|
* @param id 营期ID
|