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