|
@@ -2,9 +2,9 @@ package com.fs.course.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.sql.Wrapper;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -25,6 +25,7 @@ import com.fs.course.vo.newfs.FsCourseAnalysisCountVO;
|
|
|
import com.fs.store.mapper.FsUserMapper;
|
|
|
import com.fs.store.param.h5.CourseAnalysisParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.fs.course.mapper.FsUserCoursePeriodDaysMapper;
|
|
@@ -39,12 +40,15 @@ import com.fs.course.service.IFsUserCoursePeriodDaysService;
|
|
|
*/
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
+@Slf4j
|
|
|
public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCoursePeriodDaysMapper, FsUserCoursePeriodDays> implements IFsUserCoursePeriodDaysService {
|
|
|
|
|
|
private final FsUserCoursePeriodMapper fsUserCoursePeriodMapper;
|
|
|
|
|
|
private final FsUserMapper fsUserMapper;
|
|
|
|
|
|
+ private final FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询营期课程
|
|
|
*
|
|
@@ -218,6 +222,38 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R periodCourseMove(Long id, Long targetId) {
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
|
+ idList.add(id);
|
|
|
+ idList.add(targetId);
|
|
|
+ List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = baseMapper.selectBatchIds(idList);
|
|
|
+ if(fsUserCoursePeriodDays.isEmpty()){
|
|
|
+ return R.error(404, "当前数据或者移动的目标数据不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FsUserCoursePeriodDays> list = new ArrayList<>();
|
|
|
+ FsUserCoursePeriodDays periodDays = fsUserCoursePeriodDays.get(0);
|
|
|
+ LocalDate currentDayDate = periodDays.getDayDate();
|
|
|
+ Integer lesson = periodDays.getLesson();
|
|
|
+
|
|
|
+ FsUserCoursePeriodDays periodDaysTarget = fsUserCoursePeriodDays.get(1);
|
|
|
+ periodDays.setDayDate(periodDaysTarget.getDayDate());
|
|
|
+ periodDays.setLesson(periodDaysTarget.getLesson());
|
|
|
+ list.add(periodDays);
|
|
|
+
|
|
|
+ periodDaysTarget.setDayDate(currentDayDate);
|
|
|
+ periodDaysTarget.setLesson(lesson);
|
|
|
+ list.add(periodDaysTarget);
|
|
|
+ try {
|
|
|
+ fsUserCoursePeriodDaysMapper.batchUpdateCoursePeriodDays(list);
|
|
|
+ } catch (RuntimeException e) {
|
|
|
+ log.error("上移/下移异常,当前id:{}, 目标id:{}", id, targetId);
|
|
|
+ return R.error();
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
private static FsCourseAnalysisCountVO getCourseAnalysisCountVO(FsUserCoursePeriodDays v, Map<Long, FsCourseAnalysisCountVO> courseMap, Map<Long, FsCourseAnalysisCountVO> redPacketMap, Map<Long, FsCourseAnalysisCountVO> answerMap) {
|
|
|
FsCourseAnalysisCountVO countVO = new FsCourseAnalysisCountVO();
|
|
|
FsCourseAnalysisCountVO courseVO = courseMap.getOrDefault(v.getVideoId(), countVO);
|