文章上传发布时间

master
wenyu441069198 3 months ago
parent a2209869a6
commit 42eecfa10f
  1. 2
      src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java
  2. 12
      src/main/java/com/teaching/backend/controller/records/KnowledgeLearningRecordController.java
  3. 16
      src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java
  4. 2
      src/main/java/com/teaching/backend/service/records/IKnowledgeLearningRecordService.java

@ -33,7 +33,7 @@ public class CmsEssayController {
* @return
*/
@PostMapping("/add")
public BaseResponse<String> addEssay(CmsEssay cmsEssay){
public BaseResponse<String> addEssay(@RequestBody CmsEssay cmsEssay){
return cmsEssayService.addEssay(cmsEssay);
}

@ -96,4 +96,16 @@ public class KnowledgeLearningRecordController {
return CommonResult.success(coursesVOList);
}
/**
* 学生知识点的完成度
* @param userId
* @param courseId
* @return
*/
@ApiOperation("学生知识点的完成度")
@PostMapping("/studentfinish")
public BaseResponse<String> studentFinish(@RequestParam String userId, @RequestParam String courseId) {
return knowledgeLearningRecordService.studentFinish(userId,courseId);
}
}

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.Knowtemp.KnowtmpMapper;
import com.teaching.backend.mapper.records.KnowledgeLearningRecordMapper;
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper;
@ -54,6 +55,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
@Resource
private RecordKnowledgeFinishServiceImpl recordKnowledgeFinishService;
@Override
public BaseResponse<String> saveCoursesRecords(KnowledgeLearningRecord knowledgeLearningRecord) {
//知识点id
@ -213,4 +215,18 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
return coursesList;
}
@Override
public BaseResponse<String> studentFinish(String userId, String courseId) {
//获取学生该课程已完成的知识点数量
Long count = recordKnowledgeFinishService.query()
.eq("user_id", userId)
.eq("course_id", courseId)
.count();
//获取这门课程的总知识点数
BaseResponse<Long> allKnows = knowtmpService.getAllKnows(courseId);
double finish = (double) count /allKnows.getData() * 100;
System.out.println(finish);
return ResultUtils.success(String.valueOf(finish));
}
}

@ -31,5 +31,7 @@ public interface IKnowledgeLearningRecordService extends IService<KnowledgeLearn
List<KnowVO> queryMaxKnowledge(String userId);
List<KnowVO> queryRecommendKnowledge(String userId);
BaseResponse<String> studentFinish(String userId, String courseId);
}

Loading…
Cancel
Save