|
|
|
|
@@ -1,12 +1,10 @@
|
|
|
|
|
package com.peanut.modules.common.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.peanut.common.utils.DateUtils;
|
|
|
|
|
import com.peanut.common.utils.R;
|
|
|
|
|
import com.peanut.common.utils.ShiroUtils;
|
|
|
|
|
import com.peanut.config.DelayQueueConfig;
|
|
|
|
|
@@ -22,10 +20,8 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@@ -678,6 +674,12 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|
|
|
|
classUser.setClassId(classEntity.getId());
|
|
|
|
|
classUser.setUserId(ShiroUtils.getUId());
|
|
|
|
|
classUserDao.insert(classUser);
|
|
|
|
|
//加班后24小时未买课踢出去
|
|
|
|
|
rabbitTemplate.convertAndSend(
|
|
|
|
|
DelayQueueConfig.COMMON_EXCHANGE,
|
|
|
|
|
DelayQueueConfig.COMMON_ROUTING_KEY,
|
|
|
|
|
"joinClass"+","+classEntity.getId()+","+ShiroUtils.getUId(),
|
|
|
|
|
messagePostProcessor(24*60*60*1000));
|
|
|
|
|
return R.ok();
|
|
|
|
|
}else {
|
|
|
|
|
return R.error("人数已满");
|
|
|
|
|
@@ -685,6 +687,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void quitClass(Map<String, Object> params) {
|
|
|
|
|
classUserDao.delete(new LambdaQueryWrapper<ClassUser>()
|
|
|
|
|
.eq(ClassUser::getClassId,params.get("classId"))
|
|
|
|
|
@@ -1014,6 +1017,36 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|
|
|
|
return replyPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getThinkQuestionListStudent(Map<String, Object> params) {
|
|
|
|
|
List<Map<String,Object>> res = new ArrayList<>();
|
|
|
|
|
MPJLambdaWrapper<CourseEntity> classCourseWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
classCourseWrapper.leftJoin(ClassCourse.class,ClassCourse::getCourseId,CourseEntity::getId);
|
|
|
|
|
classCourseWrapper.leftJoin(ClassEntity.class,ClassEntity::getModelId,ClassCourse::getModelId);
|
|
|
|
|
classCourseWrapper.eq(ClassEntity::getId,params.get("classId"));
|
|
|
|
|
classCourseWrapper.select(CourseEntity::getId,CourseEntity::getTitle);
|
|
|
|
|
List<CourseEntity> courseList = courseDao.selectList(classCourseWrapper);
|
|
|
|
|
for (CourseEntity courseEntity : courseList) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("courseEntity",courseEntity);
|
|
|
|
|
MPJLambdaWrapper<CourseCatalogueChapterEntity> chapterWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
chapterWrapper.eq(CourseCatalogueChapterEntity::getCourseId,courseEntity.getId());
|
|
|
|
|
chapterWrapper.select(CourseCatalogueChapterEntity::getId,CourseCatalogueChapterEntity::getTitle);
|
|
|
|
|
chapterWrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
|
|
|
|
|
List<Map<String,Object>> chapterList = courseCatalogueChapterDao.selectMaps(chapterWrapper);
|
|
|
|
|
for (Map<String, Object> m : chapterList) {
|
|
|
|
|
ClassTaskAndQuesReply reply = classTaskAndQuesReplyDao.selectOne(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
|
|
|
|
.eq(ClassTaskAndQuesReply::getRelationId,m.get("id"))
|
|
|
|
|
.eq(ClassTaskAndQuesReply::getType,"1")
|
|
|
|
|
.eq(ClassTaskAndQuesReply::getUserId,ShiroUtils.getUId()));
|
|
|
|
|
m.put("reply",reply);
|
|
|
|
|
}
|
|
|
|
|
map.put("chapterList",chapterList);
|
|
|
|
|
res.add(map);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getUserScore(Map<String, Object> params) {
|
|
|
|
|
ClassEntity classEntity = this.getBaseMapper().selectById(params.get("classId").toString());
|
|
|
|
|
|