|
@@ -22,7 +22,18 @@ import com.zhongzheng.modules.alisms.vo.ResultBean;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
import com.zhongzheng.modules.base.vo.ProfileTpVo;
|
|
|
import com.zhongzheng.modules.base.vo.UserProfileVo;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseChapterSectionQueryBo;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseSectionVo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamApply;
|
|
@@ -35,17 +46,21 @@ import com.zhongzheng.modules.exam.vo.ExamApplyVo;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamBeforeVo;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamNumberVo;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
|
|
|
+import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsCourseVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUserTemp;
|
|
|
-import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
|
-import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
-import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
-import com.zhongzheng.modules.grade.service.IClassGradeUserTempService;
|
|
|
+import com.zhongzheng.modules.grade.domain.UserPeriod;
|
|
|
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
|
|
|
+import com.zhongzheng.modules.grade.service.*;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeUserVo;
|
|
|
+import com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo;
|
|
|
+import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
|
|
|
import com.zhongzheng.modules.inform.bo.InformQueryBo;
|
|
|
import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
import com.zhongzheng.modules.inform.domain.Inform;
|
|
@@ -78,6 +93,7 @@ import com.zhongzheng.modules.schedule.service.IScheduleService;
|
|
|
import com.zhongzheng.modules.user.bo.*;
|
|
|
import com.zhongzheng.modules.user.domain.*;
|
|
|
import com.zhongzheng.modules.user.mapper.UserPlanMapper;
|
|
|
+import com.zhongzheng.modules.user.mapper.UserStudyRecordMapper;
|
|
|
import com.zhongzheng.modules.user.service.*;
|
|
|
import com.zhongzheng.modules.user.vo.*;
|
|
|
import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
@@ -138,6 +154,16 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
private IClassGradeUserService iClassGradeUserService;
|
|
|
@Autowired
|
|
|
private IOrderService iOrderService;
|
|
|
+ @Autowired
|
|
|
+ private IGoodsCourseService iGoodsCourseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseSectionService iCourseSectionService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuService iCourseMenuService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserPeriodStatusService iUserPeriodStatusService;
|
|
|
|
|
|
@Autowired
|
|
|
private IUserService iUserService;
|
|
@@ -148,10 +174,16 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
@Autowired
|
|
|
private IClassGradeUserTempService iClassGradeUserTempService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseChapterSectionService iCourseChapterSectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleChapterService iCourseModuleChapterService;
|
|
|
|
|
|
@Autowired
|
|
|
private IUserSubscribeService iUserSubscribeService;
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private IUserPlanService userPlanService;
|
|
|
|
|
@@ -167,6 +199,12 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
@Autowired
|
|
|
private ExamNumberMapper examNumberMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserPeriodService iUserPeriodService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserStudyRecordMapper userStudyRecordMapper;
|
|
|
+
|
|
|
@Value("${aliyun.sms.OpenTheGoodsCode}")
|
|
|
private String OpenTheGoodsCode;
|
|
|
|
|
@@ -874,6 +912,130 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 直播结束
|
|
|
+ * @param bo
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void overLive(UserQueryBo bo) {
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ Long startTime = nowTime - 3600 * 24 ;
|
|
|
+ List<CourseSectionVo> list = iCourseSectionService.overSectionList(startTime,nowTime);
|
|
|
+ List<Long> courseIds = new ArrayList<>();//课程ID
|
|
|
+ List<ClassPeriodVo> periodList = new ArrayList<>();//学时列表
|
|
|
+ for(CourseSectionVo sectionVo : list){
|
|
|
+ System.out.println(sectionVo.getSectionId());
|
|
|
+ //当节为根目录时
|
|
|
+ CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
|
|
|
+ menuQueryBo.setType(3);
|
|
|
+ menuQueryBo.setMenuId(sectionVo.getSectionId());
|
|
|
+ List<CourseMenuVo> menuList = iCourseMenuService.queryList(menuQueryBo);
|
|
|
+ for(CourseMenuVo menuVo : menuList){
|
|
|
+ GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
|
|
|
+ courseQueryBo.setCourseId(menuVo.getCourseId());
|
|
|
+ List<GoodsCourseVo> goodsList = iGoodsCourseService.queryList(courseQueryBo);
|
|
|
+ for(GoodsCourseVo goodsCourseVo :goodsList){
|
|
|
+ ClassPeriodVo periodVo = new ClassPeriodVo();
|
|
|
+ periodVo.setGoodsId(goodsCourseVo.getGoodsId());
|
|
|
+ periodVo.setCourseId(menuVo.getCourseId());
|
|
|
+ periodVo.setModuleId(0L);
|
|
|
+ periodVo.setChapterId(0L);
|
|
|
+ periodVo.setSectionId(sectionVo.getSectionId());
|
|
|
+ periodList.add(periodVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //当节在章下
|
|
|
+ CourseChapterSectionQueryBo chapterSectionQueryBo = new CourseChapterSectionQueryBo();
|
|
|
+ chapterSectionQueryBo.setSectionId(sectionVo.getSectionId());
|
|
|
+ List<CourseChapterSectionVo> chapterList = iCourseChapterSectionService.queryList(chapterSectionQueryBo);
|
|
|
+ for(CourseChapterSectionVo chapterSectionVo : chapterList){
|
|
|
+ //当章在根目录时
|
|
|
+ CourseMenuQueryBo menuQueryBo2 = new CourseMenuQueryBo();
|
|
|
+ menuQueryBo2.setType(2);
|
|
|
+ menuQueryBo2.setMenuId(chapterSectionVo.getChapterId());
|
|
|
+ List<CourseMenuVo> menuList2 = iCourseMenuService.queryList(menuQueryBo2);
|
|
|
+ for(CourseMenuVo menuVo : menuList2){
|
|
|
+ GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
|
|
|
+ courseQueryBo.setCourseId(menuVo.getCourseId());
|
|
|
+ List<GoodsCourseVo> goodsList = iGoodsCourseService.queryList(courseQueryBo);
|
|
|
+ for(GoodsCourseVo goodsCourseVo :goodsList){
|
|
|
+ ClassPeriodVo periodVo = new ClassPeriodVo();
|
|
|
+ periodVo.setGoodsId(goodsCourseVo.getGoodsId());
|
|
|
+ periodVo.setCourseId(menuVo.getCourseId());
|
|
|
+ periodVo.setModuleId(0L);
|
|
|
+ periodVo.setChapterId(chapterSectionVo.getChapterId());
|
|
|
+ periodVo.setSectionId(sectionVo.getSectionId());
|
|
|
+ periodList.add(periodVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //当章在模块下
|
|
|
+ CourseModuleChapterQueryBo moduleChapterQueryBo = new CourseModuleChapterQueryBo();
|
|
|
+ moduleChapterQueryBo.setChapterId(chapterSectionVo.getChapterId());
|
|
|
+ List<CourseModuleChapterVo> moduleList = iCourseModuleChapterService.queryList(moduleChapterQueryBo);
|
|
|
+ for(CourseModuleChapterVo moduleChapterVo : moduleList){
|
|
|
+ //当模块在根目录时
|
|
|
+ CourseMenuQueryBo menuQueryBo3 = new CourseMenuQueryBo();
|
|
|
+ menuQueryBo3.setType(1);
|
|
|
+ menuQueryBo3.setMenuId(moduleChapterVo.getModuleId());
|
|
|
+ List<CourseMenuVo> menuList3 = iCourseMenuService.queryList(menuQueryBo3);
|
|
|
+ for(CourseMenuVo menuVo : menuList3){
|
|
|
+ GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
|
|
|
+ courseQueryBo.setCourseId(menuVo.getCourseId());
|
|
|
+ List<GoodsCourseVo> goodsList = iGoodsCourseService.queryList(courseQueryBo);
|
|
|
+ for(GoodsCourseVo goodsCourseVo :goodsList){
|
|
|
+ ClassPeriodVo periodVo = new ClassPeriodVo();
|
|
|
+ periodVo.setGoodsId(goodsCourseVo.getGoodsId());
|
|
|
+ periodVo.setCourseId(menuVo.getCourseId());
|
|
|
+ periodVo.setModuleId(moduleChapterVo.getModuleId());
|
|
|
+ periodVo.setChapterId(chapterSectionVo.getChapterId());
|
|
|
+ periodVo.setSectionId(sectionVo.getSectionId());
|
|
|
+ periodList.add(periodVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取所有直播结束节对应的用户班级列表
|
|
|
+ for(ClassPeriodVo periodVo :periodList){
|
|
|
+ List<ClassGradeUserGoodsVo> gradeList = iClassGradeUserService.selectGoodsGradeList(periodVo.getGoodsId());
|
|
|
+ for(ClassGradeUserGoodsVo gradeUserGoodsVo : gradeList){
|
|
|
+ UserStudyRecord entity = BeanUtil.toBean(periodVo, UserStudyRecord.class);
|
|
|
+ entity.setGradeId(gradeUserGoodsVo.getGradeId());
|
|
|
+ entity.setUserId(gradeUserGoodsVo.getUserId());
|
|
|
+ System.out.println(entity);
|
|
|
+ Long periodId = null;
|
|
|
+ // 学习无记录加一条学时审核记录
|
|
|
+ if (userStudyRecordMapper.selectStudyRecord(entity) < 1) {
|
|
|
+ UserPeriod userPeriod = new UserPeriod();
|
|
|
+ userPeriod.setUserId(entity.getUserId());
|
|
|
+ userPeriod.setCourseId(entity.getCourseId());
|
|
|
+ userPeriod.setSectionId(entity.getSectionId());
|
|
|
+ userPeriod.setGoodsId(entity.getGoodsId());
|
|
|
+ userPeriod.setType(1);
|
|
|
+ userPeriod.setCreateTime(DateUtils.getNowTime());
|
|
|
+ userPeriod.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ userPeriod.setModuleId(entity.getModuleId());
|
|
|
+ userPeriod.setChapterId(entity.getChapterId());
|
|
|
+ userPeriod.setGradeId(entity.getGradeId());
|
|
|
+ iUserPeriodService.save(userPeriod);
|
|
|
+ periodId = userPeriod.getId();
|
|
|
+ UserPeriodStatus userPeriodStatusAddBo = new UserPeriodStatus();
|
|
|
+ userPeriodStatusAddBo.setPeriodStatus(1);
|
|
|
+ userPeriodStatusAddBo.setStatus(2); //待审核状态
|
|
|
+ userPeriodStatusAddBo.setPeriodId(userPeriod.getId());
|
|
|
+ userPeriodStatusAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ userPeriodStatusAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iUserPeriodStatusService.save(userPeriodStatusAddBo);
|
|
|
+ periodId = userPeriodStatusAddBo.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//获得可用学习天数
|
|
|
private static int getDutyDays(Date startDateStr, Date endDateStr,Long[] longs,Long studyDay) {
|
|
|
int result = 0;
|