|
|
|
@ -15,6 +15,7 @@ import com.teaching.backend.model.entity.records.KnowledgeLearningNumber; |
|
|
|
|
import com.teaching.backend.model.entity.knowtmp.Knowtmp; |
|
|
|
|
import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; |
|
|
|
|
|
|
|
|
|
import com.teaching.backend.model.entity.records.RecordKnowledgeFinish; |
|
|
|
|
import com.teaching.backend.model.vo.knowGraph.KnowVO; |
|
|
|
|
import com.teaching.backend.model.vo.records.KnowledgeLearningRecordVo; |
|
|
|
|
|
|
|
|
@ -50,6 +51,8 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
private KnowledgeLearningRecordMapper knowledgeLearningRecordMapper; |
|
|
|
|
@Resource |
|
|
|
|
private KnowtmpService knowtmpService; |
|
|
|
|
@Resource |
|
|
|
|
private RecordKnowledgeFinishServiceImpl recordKnowledgeFinishService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BaseResponse<String> saveCoursesRecords(KnowledgeLearningRecord knowledgeLearningRecord) { |
|
|
|
@ -78,7 +81,14 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
.eq("course_id", courseId) |
|
|
|
|
.eq("knowledge_id",knowledgeId).update(); |
|
|
|
|
System.out.println("用户:"+userId+":第一次学这门课"); |
|
|
|
|
|
|
|
|
|
//添加完成状态
|
|
|
|
|
recordKnowledgeFinishService.addFinish(knowledgeLearningRecord); |
|
|
|
|
}//自己学过
|
|
|
|
|
else { |
|
|
|
|
if (knowledgeLearningRecord.getFinish() == 1){ |
|
|
|
|
//改变完成状态
|
|
|
|
|
recordKnowledgeFinishService.editFinish(knowledgeLearningRecord); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else {//没人学过(自己肯定也没学)
|
|
|
|
|
//该课程第一次被学,人数设置为1
|
|
|
|
@ -87,18 +97,25 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
knowledgeLearningNumber.setCourseId(courseId); |
|
|
|
|
knowledgeLearningNumber.setKnowledgeId(knowledgeId); |
|
|
|
|
knowledgeLearningNumberService.save(knowledgeLearningNumber); |
|
|
|
|
//添加完成状态
|
|
|
|
|
recordKnowledgeFinishService.addFinish(knowledgeLearningRecord); |
|
|
|
|
} |
|
|
|
|
//设置人数
|
|
|
|
|
String numberId = knowledgeLearningNumberService.query() |
|
|
|
|
.eq("course_id", courseId) |
|
|
|
|
.eq("knowledge_id",knowledgeId).one().getId(); |
|
|
|
|
knowledgeLearningRecord.setNumber(numberId); |
|
|
|
|
//设置完成状态
|
|
|
|
|
Integer finishId = recordKnowledgeFinishService.query() |
|
|
|
|
.eq("course_id", courseId) |
|
|
|
|
.eq("knowledge_id", knowledgeId) |
|
|
|
|
.eq("user_id",userId).one().getId(); |
|
|
|
|
knowledgeLearningRecord.setFinish(finishId); |
|
|
|
|
//保存记录
|
|
|
|
|
save(knowledgeLearningRecord); |
|
|
|
|
return ResultUtils.success("添加成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BaseResponse<Page> getPage(int pagenum, int pagesize, String userId, String courseId) { |
|
|
|
|
//格式化时间
|
|
|
|
@ -122,6 +139,8 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
knowledgeLearningRecordVo.setTime(sdf.format(date)); |
|
|
|
|
// //填充学习人数
|
|
|
|
|
knowledgeLearningRecordVo.setNumber(knowledgeLearningNumberService.getById(knowledgeLearningRecord.getNumber()).getNumber()); |
|
|
|
|
//获取完成状态
|
|
|
|
|
knowledgeLearningRecordVo.setFinish(recordKnowledgeFinishService.getById(knowledgeLearningRecord.getFinish()).getFinish()); |
|
|
|
|
recordsVos.add(knowledgeLearningRecordVo); |
|
|
|
|
}); |
|
|
|
|
//System.out.println(recordsVos);
|
|
|
|
|