加班后24小时未买课踢出去

思考题列表(学员)
模型添加创建时间
This commit is contained in:
wuchunlei
2024-09-20 10:07:58 +08:00
parent f0917d820d
commit 77b7d5b38b
5 changed files with 86 additions and 8 deletions

View File

@@ -365,6 +365,12 @@ public class ClassController {
return R.ok().put("thinkQuestionList",classEntityService.getThinkQuestionList(params));
}
//思考题列表(学员)
@RequestMapping("/getThinkQuestionListStudent")
public R getThinkQuestionListStudent(@RequestBody Map<String,Object> params){
return R.ok().put("getThinkQuestionListStudent",classEntityService.getThinkQuestionListStudent(params));
}
//学员成绩
@RequestMapping("/getUserScore")
public R getUserScore(@RequestBody Map<String,Object> params){

View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@@ -15,6 +16,8 @@ public class ClassModel {
@TableId
private Integer id;
private Date createTime;
private String title;
private Integer directorId;

View File

@@ -87,6 +87,8 @@ public interface ClassEntityService extends IService<ClassEntity> {
Page getThinkQuestionList(Map<String,Object> params);
List<Map<String, Object>> getThinkQuestionListStudent(Map<String,Object> params);
Map<String,Object> getUserScore(Map<String,Object> params);
List userScoreList(Map<String,Object> params);

View File

@@ -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());