小班相关
This commit is contained in:
@@ -122,12 +122,24 @@ public class ClassController {
|
|||||||
return R.ok().put("result",classEntityService.getClassInfo(params));
|
return R.ok().put("result",classEntityService.getClassInfo(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询未加入小班
|
||||||
|
@RequestMapping("/getClassNoUser")
|
||||||
|
public R getClassNoUser(){
|
||||||
|
return R.ok().put("result",classEntityService.getClassNoUser());
|
||||||
|
}
|
||||||
|
|
||||||
//查询包含课程的小班(登陆人未加入)
|
//查询包含课程的小班(登陆人未加入)
|
||||||
@RequestMapping("/getClassByCourseIdNoUser")
|
@RequestMapping("/getClassByCourseIdNoUser")
|
||||||
public R getClassByCourseIdNoUser(@RequestBody Map<String,Object> params){
|
public R getClassByCourseIdNoUser(@RequestBody Map<String,Object> params){
|
||||||
return R.ok().put("result",classEntityService.getClassByCourseIdNoUser(params));
|
return R.ok().put("result",classEntityService.getClassByCourseIdNoUser(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询登陆人已加入小班
|
||||||
|
@RequestMapping("/getClassByUser")
|
||||||
|
public R getClassByUser(@RequestBody Map<String,Object> params){
|
||||||
|
return R.ok().put("result",classEntityService.getClassByUser(params));
|
||||||
|
}
|
||||||
|
|
||||||
//加入小班
|
//加入小班
|
||||||
@RequestMapping("/joinClass")
|
@RequestMapping("/joinClass")
|
||||||
public R joinClass(@RequestBody Map<String,Object> params){
|
public R joinClass(@RequestBody Map<String,Object> params){
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.modules.common.entity.ClassExamOption;
|
import com.peanut.modules.common.entity.ClassExamOption;
|
||||||
import com.peanut.modules.common.entity.ClassExamSubject;
|
import com.peanut.modules.common.entity.ClassExamSubject;
|
||||||
|
import com.peanut.modules.common.service.ClassExamOptionService;
|
||||||
import com.peanut.modules.common.service.ClassExamService;
|
import com.peanut.modules.common.service.ClassExamService;
|
||||||
|
import com.peanut.modules.common.service.ClassExamSubjectService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.util.Map;
|
import java.io.InputStream;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController("commonClassExam")
|
@RestController("commonClassExam")
|
||||||
@@ -21,10 +27,98 @@ public class ClassExamController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClassExamService classExamService;
|
private ClassExamService classExamService;
|
||||||
|
@Autowired
|
||||||
|
private ClassExamSubjectService classExamSubjectService;
|
||||||
|
@Autowired
|
||||||
|
private ClassExamOptionService classExamOptionService;
|
||||||
|
|
||||||
//导入考试题
|
//导入考试题
|
||||||
@RequestMapping("/importSubject")
|
@RequestMapping("/importSubject")
|
||||||
|
@Transactional
|
||||||
public R importSubject(@RequestParam("file") MultipartFile file, @RequestParam("courseId") int courseId) {
|
public R importSubject(@RequestParam("file") MultipartFile file, @RequestParam("courseId") int courseId) {
|
||||||
|
try (InputStream fis = file.getInputStream()) {
|
||||||
|
Workbook workbook = WorkbookFactory.create(fis);
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Date date = new Date();
|
||||||
|
List<ClassExamSubject> subjectList = new ArrayList<>();
|
||||||
|
List<ClassExamOption> optionList = new ArrayList<>();
|
||||||
|
// 遍历行
|
||||||
|
for (Row row : sheet) {
|
||||||
|
if (!isRowEmpty(row)){
|
||||||
|
if (row.getRowNum()==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ClassExamSubject subject = new ClassExamSubject();
|
||||||
|
subject.setCourseId(courseId);
|
||||||
|
//类型
|
||||||
|
String type = row.getCell(0)==null?"":row.getCell(0).toString();
|
||||||
|
if (type.contains("单选")){
|
||||||
|
subject.setType(0);
|
||||||
|
}else if (type.contains("多选")){
|
||||||
|
subject.setType(1);
|
||||||
|
}else {
|
||||||
|
System.out.println(row.getRowNum()+"此题无题目类型");
|
||||||
|
}
|
||||||
|
//题目
|
||||||
|
subject.setContent(row.getCell(1)==null?"":row.getCell(1).toString());
|
||||||
|
//所属章节
|
||||||
|
subject.setChapter(row.getCell(13)==null?"":row.getCell(13).toString());
|
||||||
|
//音视频序号
|
||||||
|
subject.setMedia(row.getCell(14)==null?"":row.getCell(14).toString());
|
||||||
|
//音视频时间
|
||||||
|
subject.setMediaTime(row.getCell(15)==null?"":row.getCell(15).toString());
|
||||||
|
//出题人
|
||||||
|
subject.setCreateUser(row.getCell(16)==null?"":row.getCell(16).toString());
|
||||||
|
classExamSubjectService.save(subject);
|
||||||
|
//选项1-6
|
||||||
|
for (int i=2; i<=7;i++) {
|
||||||
|
if (row.getCell(i)!=null&&!"".equals(row.getCell(i).toString())){
|
||||||
|
ClassExamOption option = new ClassExamOption();
|
||||||
|
option.setSubjectId(subject.getId());
|
||||||
|
String content = row.getCell(i).toString();
|
||||||
|
String raw = row.getCell(8)==null?"":row.getCell(8).toString();
|
||||||
|
if (raw.contains(content.substring(0,1))){
|
||||||
|
option.setRightWrong(1);
|
||||||
|
}else {
|
||||||
|
option.setRightWrong(0);
|
||||||
|
}
|
||||||
|
char[] c = content.toCharArray();
|
||||||
|
if (c.length>1){
|
||||||
|
if (c[1]=='、'||c[1]==':'||c[1]==';'||c[1]==':'||c[1]==';'||c[1]==' '||c[1]=='.'){
|
||||||
|
content = content.substring(2);
|
||||||
|
}else {
|
||||||
|
content = content.substring(1);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
content = "";
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(content)){
|
||||||
|
option.setContent(content);
|
||||||
|
optionList.add(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
classExamOptionService.saveBatch(optionList);
|
||||||
|
System.out.println("结束"+(new Date().getTime()-date.getTime()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
private static boolean isRowEmpty(Row row) {
|
||||||
|
for (Cell cell : row) {
|
||||||
|
if (cell.getCellTypeEnum() != CellType.BLANK) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入考试题
|
||||||
|
@RequestMapping("/importSubject1")
|
||||||
|
public R importSubject1(@RequestParam("file") MultipartFile file, @RequestParam("courseId") int courseId) {
|
||||||
String res = classExamService.importSubject(file,courseId);
|
String res = classExamService.importSubject(file,courseId);
|
||||||
if (res==null){
|
if (res==null){
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ public class ClassTaskAndQuesReply {
|
|||||||
@TableId
|
@TableId
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer classId;
|
||||||
|
|
||||||
private Integer relationId;
|
private Integer relationId;
|
||||||
|
|
||||||
private String type;//类型0任务1课后题
|
private String type;//类型0任务1课后题
|
||||||
|
|||||||
@@ -37,8 +37,12 @@ public interface ClassEntityService extends IService<ClassEntity> {
|
|||||||
|
|
||||||
Object getClassInfo(Map<String ,Object> params);
|
Object getClassInfo(Map<String ,Object> params);
|
||||||
|
|
||||||
|
List<ClassEntity> getClassNoUser();
|
||||||
|
|
||||||
List<ClassEntity> getClassByCourseIdNoUser(Map<String ,Object> params);
|
List<ClassEntity> getClassByCourseIdNoUser(Map<String ,Object> params);
|
||||||
|
|
||||||
|
ClassEntity getClassByUser(Map<String, Object> params);
|
||||||
|
|
||||||
R joinClass(Map<String ,Object> params);
|
R joinClass(Map<String ,Object> params);
|
||||||
|
|
||||||
void quitClass(Map<String ,Object> params);
|
void quitClass(Map<String ,Object> params);
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.ClassExamOption;
|
||||||
|
|
||||||
|
public interface ClassExamOptionService extends IService<ClassExamOption> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.ClassExamSubject;
|
||||||
|
|
||||||
|
public interface ClassExamSubjectService extends IService<ClassExamSubject> {
|
||||||
|
}
|
||||||
@@ -495,6 +495,17 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClassEntity> getClassNoUser() {
|
||||||
|
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.selectAll(ClassEntity.class);
|
||||||
|
String classSql = "select 1 from ( select c.id from class c left join class_course cc on cc.model_id = c.model_id left join class_user cu on cu.class_id = c.id where c.del_flag = 0 and cc.del_flag = 0 and cu.del_flag = 0 and cu.user_id = "+ShiroUtils.getUId()+" ) s where s.id = t.id";
|
||||||
|
String courseSql = "select 1 from (select cc.model_id from class_course cc where cc.del_flag = 0 and cc.course_id in (select cc.course_id from class_course cc left join class_model cm on cm.id = cc.model_id left join class c on c.model_id = cm.id left join class_user cu on cu.class_id = c.id where cc.del_flag = 0 and cm.del_flag = 0 and c.del_flag = 0 and cu.del_flag = 0 and cu.user_id = "+ShiroUtils.getUId()+")) q where q.model_id = t.model_id";
|
||||||
|
wrapper.notExists(classSql);
|
||||||
|
wrapper.notExists(courseSql);
|
||||||
|
return this.baseMapper.selectList(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ClassEntity> getClassByCourseIdNoUser(Map<String, Object> params) {
|
public List<ClassEntity> getClassByCourseIdNoUser(Map<String, Object> params) {
|
||||||
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
@@ -504,7 +515,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
wrapper.leftJoin(ClassUser.class,ClassUser::getClassId,ClassEntity::getId);
|
wrapper.leftJoin(ClassUser.class,ClassUser::getClassId,ClassEntity::getId);
|
||||||
wrapper.eq(ClassCourse::getCourseId,params.get("courseId"));
|
wrapper.eq(ClassCourse::getCourseId,params.get("courseId"));
|
||||||
wrapper.eq(ClassUser::getUserId,ShiroUtils.getUId());
|
wrapper.eq(ClassUser::getUserId,ShiroUtils.getUId());
|
||||||
wrapper.eq(ClassEntity::getState,"2");
|
wrapper.ne(ClassEntity::getState,"2");
|
||||||
List<ClassEntity> classesUser = this.baseMapper.selectList(wrapper);
|
List<ClassEntity> classesUser = this.baseMapper.selectList(wrapper);
|
||||||
if (classesUser.size() > 0){
|
if (classesUser.size() > 0){
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@@ -513,18 +524,26 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassEntity getClassByUser(Map<String, Object> params) {
|
||||||
|
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.selectAll(ClassEntity.class);
|
||||||
|
wrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassEntity::getModelId);
|
||||||
|
wrapper.leftJoin(ClassCourse.class,ClassCourse::getModelId,ClassModel::getId);
|
||||||
|
wrapper.leftJoin(ClassUser.class,ClassUser::getClassId,ClassEntity::getId);
|
||||||
|
wrapper.eq(ClassCourse::getCourseId,params.get("courseId"));
|
||||||
|
wrapper.eq(ClassUser::getUserId,ShiroUtils.getUId());
|
||||||
|
wrapper.ne(ClassEntity::getState,"2");
|
||||||
|
return this.baseMapper.selectOne(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
public List<ClassEntity> getClassByCourseId(Map<String, Object> params) {
|
public List<ClassEntity> getClassByCourseId(Map<String, Object> params) {
|
||||||
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<ClassEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.selectAll(ClassEntity.class);
|
wrapper.selectAll(ClassEntity.class);
|
||||||
wrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassEntity::getModelId);
|
wrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassEntity::getModelId);
|
||||||
wrapper.leftJoin(ClassCourse.class,ClassCourse::getModelId,ClassModel::getId);
|
wrapper.leftJoin(ClassCourse.class,ClassCourse::getModelId,ClassModel::getId);
|
||||||
wrapper.eq(ClassCourse::getCourseId,params.get("courseId"));
|
wrapper.eq(ClassCourse::getCourseId,params.get("courseId"));
|
||||||
if (StringUtils.isNotEmpty(params.get("state").toString())){
|
wrapper.ne(ClassEntity::getState,"2");
|
||||||
wrapper.eq(ClassEntity::getState,params.get("state"));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
|
||||||
wrapper.eq(ClassModel::getType,params.get("type"));
|
|
||||||
}
|
|
||||||
List<ClassEntity> classes = this.baseMapper.selectList(wrapper);
|
List<ClassEntity> classes = this.baseMapper.selectList(wrapper);
|
||||||
if (classes.size() > 0){
|
if (classes.size() > 0){
|
||||||
for (ClassEntity classEntity:classes){
|
for (ClassEntity classEntity:classes){
|
||||||
@@ -655,7 +674,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
ClassTask classTask = new ClassTask();
|
ClassTask classTask = new ClassTask();
|
||||||
classTask.setClassId(classEntity.getId());
|
classTask.setClassId(classEntity.getId());
|
||||||
classTask.setUserId(ShiroUtils.getUId());
|
classTask.setUserId(ShiroUtils.getUId());
|
||||||
classTask.setSort(i*10+"");
|
classTask.setSort(i*30+"");
|
||||||
classTask.setTitle("第"+i+"周的笔记");
|
classTask.setTitle("第"+i+"周的笔记");
|
||||||
classTask.setContent("请提交第"+i+"周的笔记");
|
classTask.setContent("请提交第"+i+"周的笔记");
|
||||||
classTaskDao.insert(classTask);
|
classTaskDao.insert(classTask);
|
||||||
@@ -669,20 +688,23 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
LambdaQueryWrapper<ClassTask> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ClassTask> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ClassTask::getClassId,params.get("classId"));
|
wrapper.eq(ClassTask::getClassId,params.get("classId"));
|
||||||
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
||||||
|
if ("2".equals(params.get("type").toString())){
|
||||||
|
wrapper.orderByAsc(ClassTask::getScoreSuccess);
|
||||||
|
}
|
||||||
wrapper.eq(ClassTask::getType,params.get("type"));
|
wrapper.eq(ClassTask::getType,params.get("type"));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(params.get("title").toString())){
|
if (StringUtils.isNotEmpty(params.get("title").toString())){
|
||||||
wrapper.like(ClassTask::getTitle,params.get("title"));
|
wrapper.like(ClassTask::getTitle,params.get("title"));
|
||||||
}
|
}
|
||||||
wrapper.orderByAsc(ClassTask::getScoreSuccess);
|
|
||||||
wrapper.orderByAsc(ClassTask::getSort);
|
wrapper.orderByAsc(ClassTask::getSort);
|
||||||
|
wrapper.orderByDesc(ClassTask::getId);
|
||||||
Page<ClassTask> classTaskPage = classTaskDao.selectPage(new Page<>(page, limit), wrapper);
|
Page<ClassTask> classTaskPage = classTaskDao.selectPage(new Page<>(page, limit), wrapper);
|
||||||
for (ClassTask classTask:classTaskPage.getRecords()){
|
for (ClassTask classTask:classTaskPage.getRecords()){
|
||||||
int alreadyReply = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
int alreadyReply = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId()));
|
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId()));
|
||||||
int noScore = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
int noScore = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId())
|
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId())
|
||||||
.eq(ClassTaskAndQuesReply::getScoreSuccess,0));
|
.lt(ClassTaskAndQuesReply::getScoreSuccess,2));
|
||||||
Map<String,Object> result = new HashMap<>();
|
Map<String,Object> result = new HashMap<>();
|
||||||
result.put("setGiveHomeWorkNumber",alreadyReply);
|
result.put("setGiveHomeWorkNumber",alreadyReply);
|
||||||
result.put("setNoGiveScoreNumber",noScore);
|
result.put("setNoGiveScoreNumber",noScore);
|
||||||
@@ -882,6 +904,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
MPJLambdaWrapper<ClassTaskAndQuesReply> replyWrap = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<ClassTaskAndQuesReply> replyWrap = new MPJLambdaWrapper<>();
|
||||||
replyWrap.leftJoin(CourseCatalogueChapterEntity.class,CourseCatalogueChapterEntity::getId,ClassTaskAndQuesReply::getRelationId);
|
replyWrap.leftJoin(CourseCatalogueChapterEntity.class,CourseCatalogueChapterEntity::getId,ClassTaskAndQuesReply::getRelationId);
|
||||||
replyWrap.leftJoin(ClassCourse.class,ClassCourse::getCourseId,CourseCatalogueChapterEntity::getCourseId);
|
replyWrap.leftJoin(ClassCourse.class,ClassCourse::getCourseId,CourseCatalogueChapterEntity::getCourseId);
|
||||||
|
replyWrap.leftJoin(CourseEntity.class,CourseEntity::getId,ClassCourse::getCourseId);
|
||||||
replyWrap.leftJoin(ClassEntity.class,ClassEntity::getModelId,ClassCourse::getModelId);
|
replyWrap.leftJoin(ClassEntity.class,ClassEntity::getModelId,ClassCourse::getModelId);
|
||||||
replyWrap.eq(ClassEntity::getId,params.get("classId"));
|
replyWrap.eq(ClassEntity::getId,params.get("classId"));
|
||||||
replyWrap.eq(ClassTaskAndQuesReply::getType,"1");
|
replyWrap.eq(ClassTaskAndQuesReply::getType,"1");
|
||||||
@@ -892,6 +915,8 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
replyWrap.selectAs(ClassTaskAndQuesReply::getScoreSuccess,"scoreSuccess");
|
replyWrap.selectAs(ClassTaskAndQuesReply::getScoreSuccess,"scoreSuccess");
|
||||||
replyWrap.selectAs(ClassTaskAndQuesReply::getScore,"score");
|
replyWrap.selectAs(ClassTaskAndQuesReply::getScore,"score");
|
||||||
replyWrap.selectAs(CourseCatalogueChapterEntity::getId,"chapterId");
|
replyWrap.selectAs(CourseCatalogueChapterEntity::getId,"chapterId");
|
||||||
|
replyWrap.selectAs(CourseCatalogueChapterEntity::getTitle,"chapterTitle");
|
||||||
|
replyWrap.selectAs(CourseEntity::getTitle,"courseTitle");
|
||||||
replyWrap.selectAs(CourseCatalogueChapterEntity::getQuestions,"questions");
|
replyWrap.selectAs(CourseCatalogueChapterEntity::getQuestions,"questions");
|
||||||
replyWrap.orderByAsc(ClassTaskAndQuesReply::getScoreSuccess);
|
replyWrap.orderByAsc(ClassTaskAndQuesReply::getScoreSuccess);
|
||||||
Page<Map<String,Object>> replyPage = classTaskAndQuesReplyDao.selectMapsPage(new Page<>(page, limit), replyWrap);
|
Page<Map<String,Object>> replyPage = classTaskAndQuesReplyDao.selectMapsPage(new Page<>(page, limit), replyWrap);
|
||||||
@@ -911,7 +936,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
List<ClassTaskAndQuesReply> task0Replys = classTaskAndQuesReplyDao.selectList(task0wrapper);
|
List<ClassTaskAndQuesReply> task0Replys = classTaskAndQuesReplyDao.selectList(task0wrapper);
|
||||||
if (task0Replys.size() > 0) {
|
if (task0Replys.size() > 0) {
|
||||||
for (ClassTaskAndQuesReply reply : task0Replys) {
|
for (ClassTaskAndQuesReply reply : task0Replys) {
|
||||||
if (reply.getScoreSuccess()>=1){
|
if (reply.getScoreSuccess()>1){
|
||||||
task0Score += reply.getScore();
|
task0Score += reply.getScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -926,7 +951,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
List<ClassTaskAndQuesReply> task1Replys = classTaskAndQuesReplyDao.selectList(task1wrapper);
|
List<ClassTaskAndQuesReply> task1Replys = classTaskAndQuesReplyDao.selectList(task1wrapper);
|
||||||
if (task1Replys.size() > 0) {
|
if (task1Replys.size() > 0) {
|
||||||
for (ClassTaskAndQuesReply reply : task1Replys) {
|
for (ClassTaskAndQuesReply reply : task1Replys) {
|
||||||
if (reply.getScoreSuccess()>=1){
|
if (reply.getScoreSuccess()>1){
|
||||||
task1Score += reply.getScore();
|
task1Score += reply.getScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -953,6 +978,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
questionWrapper.selectAll(ClassTaskAndQuesReply.class);
|
questionWrapper.selectAll(ClassTaskAndQuesReply.class);
|
||||||
questionWrapper.eq(ClassEntity::getId,params.get("classId"));
|
questionWrapper.eq(ClassEntity::getId,params.get("classId"));
|
||||||
questionWrapper.eq(ClassTaskAndQuesReply::getUserId,ShiroUtils.getUId());
|
questionWrapper.eq(ClassTaskAndQuesReply::getUserId,ShiroUtils.getUId());
|
||||||
|
questionWrapper.eq(ClassTaskAndQuesReply::getClassId,params.get("classId"));
|
||||||
List<ClassTaskAndQuesReply> questionReplys = classTaskAndQuesReplyDao.selectList(questionWrapper);
|
List<ClassTaskAndQuesReply> questionReplys = classTaskAndQuesReplyDao.selectList(questionWrapper);
|
||||||
if (questionReplys.size() > 0) {
|
if (questionReplys.size() > 0) {
|
||||||
for (ClassTaskAndQuesReply reply : questionReplys) {
|
for (ClassTaskAndQuesReply reply : questionReplys) {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.ClassExamOptionDao;
|
||||||
|
import com.peanut.modules.common.entity.ClassExamOption;
|
||||||
|
import com.peanut.modules.common.service.ClassExamOptionService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonClassExamOptionService")
|
||||||
|
public class ClassExamOptionServiceImpl extends ServiceImpl<ClassExamOptionDao, ClassExamOption> implements ClassExamOptionService {
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
|||||||
try (InputStream fis = file.getInputStream()) {
|
try (InputStream fis = file.getInputStream()) {
|
||||||
Workbook workbook = WorkbookFactory.create(fis);
|
Workbook workbook = WorkbookFactory.create(fis);
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Date date = new Date();
|
||||||
// 遍历行
|
// 遍历行
|
||||||
for (Row row : sheet) {
|
for (Row row : sheet) {
|
||||||
if (!isRowEmpty(row)){
|
if (!isRowEmpty(row)){
|
||||||
@@ -98,6 +99,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println("结束"+(new Date().getTime()-date.getTime()));
|
||||||
} catch (IOException | InvalidFormatException e) {
|
} catch (IOException | InvalidFormatException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.ClassExamSubjectDao;
|
||||||
|
import com.peanut.modules.common.entity.ClassExamSubject;
|
||||||
|
import com.peanut.modules.common.service.ClassExamSubjectService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonClassExamSubjectService")
|
||||||
|
public class ClassExamSubjectServiceImpl extends ServiceImpl<ClassExamSubjectDao, ClassExamSubject> implements ClassExamSubjectService {
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test
|
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: HSXY1234hsxy
|
# password: HSXY1234hsxy
|
||||||
# password: Jgll2023Nutty
|
# password: Jgll2023Nutty
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test
|
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: HSXY1234hsxy
|
# password: HSXY1234hsxy
|
||||||
# password: Jgll2023Nutty
|
# password: Jgll2023Nutty
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book
|
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: HSXY1234hsxy
|
# password: HSXY1234hsxy
|
||||||
# password: Jgll2023Nutty
|
# password: Jgll2023Nutty
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test
|
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: HSXY1234hsxy
|
# password: HSXY1234hsxy
|
||||||
# password: Jgll2023Nutty
|
# password: Jgll2023Nutty
|
||||||
|
|||||||
Reference in New Issue
Block a user