|
|
@@ -17,10 +17,7 @@ import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
import com.zhongzheng.modules.course.bo.*;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseMenuExam;
|
|
|
-import com.zhongzheng.modules.course.domain.CoursePhotoLog;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseSection;
|
|
|
+import com.zhongzheng.modules.course.domain.*;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
|
|
|
import com.zhongzheng.modules.course.service.*;
|
|
|
import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
|
|
|
@@ -28,6 +25,7 @@ import com.zhongzheng.modules.course.vo.CourseSectionVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
@@ -48,6 +46,8 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.polyv.bo.PolyvLiveQueryBo;
|
|
|
import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
|
|
|
@@ -158,6 +158,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
@Autowired
|
|
|
private IGoodsCourseService iGoodsCourseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuService iCourseMenuService;
|
|
|
+
|
|
|
@Override
|
|
|
public UserStudyRecordVo queryById(Long recordId) {
|
|
|
UserStudyRecord db = this.baseMapper.selectById(recordId);
|
|
|
@@ -280,6 +286,10 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
lqw.eq(bo.getStudyDuration() != null, UserStudyRecord::getStudyDuration, bo.getStudyDuration());
|
|
|
lqw.eq(bo.getStartTime() != null, UserStudyRecord::getStartTime, bo.getStartTime());
|
|
|
lqw.eq(bo.getEndTime() != null, UserStudyRecord::getEndTime, bo.getEndTime());
|
|
|
+ lqw.eq(bo.getOrderGoodsId() != null, UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
+ lqw.eq(bo.getGradeId() != null, UserStudyRecord::getGradeId, bo.getGradeId());
|
|
|
+ lqw.eq(bo.getChapterId() != null, UserStudyRecord::getChapterId, bo.getChapterId());
|
|
|
+ lqw.eq(bo.getCurrentStatus() != null, UserStudyRecord::getCurrentStatus, bo.getCurrentStatus());
|
|
|
return entity2Vo(this.list(lqw));
|
|
|
}
|
|
|
|
|
|
@@ -1208,6 +1218,115 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
return baseMapper.getStudyRecord(userId, gradeId, asc);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public Integer syncSevenPublicClass(Long orderGoodsId,Long userId) {
|
|
|
+ if(Validator.isEmpty(orderGoodsId)||Validator.isEmpty(userId)){
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
+ OrderGoods newOrderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, orderGoodsId));
|
|
|
+ if(newOrderGoods.getSevenClassStatus()==1||newOrderGoods.getSevenClassStatus()==2||newOrderGoods.getSevenClassStatus()==3){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, newOrderGoods.getGoodsId()));
|
|
|
+ String fullName;
|
|
|
+ CourseBusinessQueryBo queryBusinessBo = new CourseBusinessQueryBo();
|
|
|
+ queryBusinessBo.setId(goods.getBusinessId());
|
|
|
+ fullName = iCourseBusinessService.queryFullName(queryBusinessBo);
|
|
|
+ if(!fullName.contains("继续教育")||!fullName.contains("施工现场专业人员")){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(newOrderGoods.getSevenYear())){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ OrderGoods copyOrderGoods = iOrderGoodsService.getSevenLastOne(goods.getProjectId(),newOrderGoods.getSevenYear(),userId);
|
|
|
+ if(Validator.isEmpty(copyOrderGoods)){
|
|
|
+ newOrderGoods.setSevenClassVersion(newOrderGoods.getSevenClassVersion()+1);
|
|
|
+ newOrderGoods.setSevenClassStatus(1);
|
|
|
+ newOrderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(newOrderGoods);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ UserStudyRecord userStudyRecord = baseMapper.getSevenStudyRecord(copyOrderGoods.getOrderGoodsId(),copyOrderGoods.getGradeId());
|
|
|
+ if(Validator.isEmpty(userStudyRecord)){
|
|
|
+ throw new CustomException("公共章学习数据错误");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<GoodsCourse> lqwCourse = Wrappers.lambdaQuery();
|
|
|
+ lqwCourse.eq(GoodsCourse::getGoodsId, goods.getGoodsId());;
|
|
|
+ List<GoodsCourse> courseList = iGoodsCourseService.list(lqwCourse);
|
|
|
+ Long courseId = null;
|
|
|
+ for(GoodsCourse course : courseList){
|
|
|
+ CourseMenu courseMenu = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getCourseId, course.getCourseId())
|
|
|
+ .eq(CourseMenu::getType, 2).eq(CourseMenu::getMenuId, userStudyRecord.getChapterId()).eq(CourseMenu::getParentId, 0));
|
|
|
+ if(Validator.isNotEmpty(courseMenu)){
|
|
|
+ courseId = course.getCourseId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(courseId)){
|
|
|
+ throw new CustomException("课程定位错误");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<UserStudyRecord> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(UserStudyRecord::getOrderGoodsId, userStudyRecord.getOrderGoodsId());
|
|
|
+ lqw.eq(UserStudyRecord::getGradeId, userStudyRecord.getGradeId());
|
|
|
+ lqw.eq(UserStudyRecord::getChapterId, userStudyRecord.getChapterId());
|
|
|
+ lqw.eq(UserStudyRecord::getCurrentStatus, 1);
|
|
|
+ List<UserStudyRecord> list = this.list(lqw);
|
|
|
+ for(UserStudyRecord vo : list){
|
|
|
+ UserStudyRecord copyVo = BeanUtil.toBean(vo, UserStudyRecord.class);
|
|
|
+ copyVo.setOrderGoodsId(newOrderGoods.getOrderGoodsId());
|
|
|
+ copyVo.setGradeId(newOrderGoods.getGradeId());
|
|
|
+ copyVo.setCourseId(courseId);
|
|
|
+ copyVo.setRecordId(null);
|
|
|
+ this.save(copyVo);
|
|
|
+ Long periodId = null;
|
|
|
+ UserPeriod copyUserPeriod = baseMapper.selectSevenUserPeriod(copyVo);
|
|
|
+ UserPeriodStatus copyUserPeriodStatus;
|
|
|
+ UserPeriod userPeriod = baseMapper.selectSevenUserPeriod(vo);
|
|
|
+ if(Validator.isEmpty(userPeriod)){
|
|
|
+ throw new CustomException("学时数据错误");
|
|
|
+ }
|
|
|
+ UserPeriodStatus userPeriodStatus = iUserPeriodStatusService.getOne(new LambdaQueryWrapper<UserPeriodStatus>()
|
|
|
+ .eq(UserPeriodStatus::getPeriodId, userPeriod.getId())
|
|
|
+ .eq(UserPeriodStatus::getStatus, 1)
|
|
|
+ .eq(UserPeriodStatus::getPeriodStatus, 1));
|
|
|
+ if(Validator.isEmpty(copyUserPeriod)){
|
|
|
+ copyUserPeriod = BeanUtil.toBean(userPeriod, UserPeriod.class);
|
|
|
+ copyUserPeriod.setOrderGoodsId(newOrderGoods.getOrderGoodsId());
|
|
|
+ copyUserPeriod.setGradeId(newOrderGoods.getGradeId());
|
|
|
+ copyUserPeriod.setCourseId(courseId);
|
|
|
+ copyUserPeriod.setId(null);
|
|
|
+ iUserPeriodService.save(copyUserPeriod);
|
|
|
+
|
|
|
+ copyUserPeriodStatus = BeanUtil.toBean(userPeriodStatus, UserPeriodStatus.class);
|
|
|
+ copyUserPeriodStatus.setPeriodId(copyUserPeriod.getId());
|
|
|
+ copyUserPeriodStatus.setId(null);
|
|
|
+ iUserPeriodStatusService.save(copyUserPeriodStatus);
|
|
|
+ }else{
|
|
|
+ copyUserPeriodStatus = iUserPeriodStatusService.getOne(new LambdaQueryWrapper<UserPeriodStatus>()
|
|
|
+ .eq(UserPeriodStatus::getPeriodId, copyUserPeriod.getId())
|
|
|
+ .eq(UserPeriodStatus::getStatus, 1)
|
|
|
+ .eq(UserPeriodStatus::getPeriodStatus, 1));
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<UserStudyRecordPhoto> lqwPhoto = Wrappers.lambdaQuery();
|
|
|
+ lqwPhoto.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatus.getId());
|
|
|
+ lqwPhoto.eq(UserStudyRecordPhoto::getRecordId, vo.getRecordId());
|
|
|
+ lqwPhoto.eq(UserStudyRecordPhoto::getStatus, 1);
|
|
|
+ List<UserStudyRecordPhoto> listPhoto = userStudyRecordPhotoService.list(lqwPhoto);
|
|
|
+ for(UserStudyRecordPhoto photo : listPhoto){
|
|
|
+ UserStudyRecordPhoto copyPhoto = BeanUtil.toBean(photo, UserStudyRecordPhoto.class);
|
|
|
+ copyPhoto.setRecordId(copyVo.getRecordId());
|
|
|
+ copyPhoto.setPeriodId(copyUserPeriodStatus.getId());
|
|
|
+ copyPhoto.setId(null);
|
|
|
+ userStudyRecordPhotoService.save(copyPhoto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newOrderGoods.setSevenClassVersion(copyOrderGoods.getSevenClassVersion());
|
|
|
+ newOrderGoods.setSevenClassStatus(2);
|
|
|
+ newOrderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(newOrderGoods);
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取最后一次看完的节
|
|
|
@@ -1264,6 +1383,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
userPeriod.setModuleId(entity.getModuleId());
|
|
|
userPeriod.setChapterId(entity.getChapterId());
|
|
|
userPeriod.setGradeId(entity.getGradeId());
|
|
|
+ userPeriod.setOrderGoodsId(entity.getOrderGoodsId());
|
|
|
iUserPeriodService.save(userPeriod);
|
|
|
periodId = userPeriod.getId();
|
|
|
UserPeriodStatus userPeriodStatusAddBo = new UserPeriodStatus();
|
|
|
@@ -1566,4 +1686,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
public SectionStudyRecordVo listExamRecord(SubjectStudyRecordQueryBo bo) {
|
|
|
return this.baseMapper.listExamRecord(bo);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|