|
|
|
@ -8,15 +8,23 @@ 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.records.KnowledgeLearningRecordMapper; |
|
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; |
|
|
|
|
import com.teaching.backend.model.entity.KnowGraph.Know; |
|
|
|
|
import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber; |
|
|
|
|
import com.teaching.backend.model.entity.Knowtemp.Knowtemp; |
|
|
|
|
import com.teaching.backend.model.entity.courses.CourseLearningNumber; |
|
|
|
|
|
|
|
|
|
import com.teaching.backend.model.entity.courses.Courses; |
|
|
|
|
import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; |
|
|
|
|
|
|
|
|
|
import com.teaching.backend.model.vo.courses.CoursesVO; |
|
|
|
|
import com.teaching.backend.model.vo.knowGraph.KnowVO; |
|
|
|
|
import com.teaching.backend.model.vo.records.KnowledgeLearningRecordVo; |
|
|
|
|
import com.teaching.backend.service.KnowGraph.KnowService; |
|
|
|
|
import com.teaching.backend.service.impl.courses.CourseLearningNumberServiceImpl; |
|
|
|
|
import com.teaching.backend.service.impl.knowledge.KnowledgeLearningNumberServiceImpl; |
|
|
|
|
import com.teaching.backend.service.records.IKnowledgeLearningRecordService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -39,6 +47,12 @@ import java.util.List; |
|
|
|
|
public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLearningRecordMapper, KnowledgeLearningRecord> implements IKnowledgeLearningRecordService { |
|
|
|
|
@Resource |
|
|
|
|
private KnowledgeLearningNumberServiceImpl knowledgeLearningNumberService; |
|
|
|
|
@Autowired |
|
|
|
|
private UmsUserMapper umsUserMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private KnowledgeLearningRecordMapper knowledgeLearningRecordMapper; |
|
|
|
|
@Resource |
|
|
|
|
private KnowService knowService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BaseResponse<String> saveCoursesRecords(KnowledgeLearningRecord knowledgeLearningRecord) { |
|
|
|
@ -115,4 +129,42 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
removeByIds(ids); |
|
|
|
|
return ResultUtils.success("删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<KnowVO> queryMaxKnowledge(String userId) { |
|
|
|
|
String roleId = umsUserMapper.getbyIdRoleId(userId); |
|
|
|
|
List<KnowVO> coursesList = new ArrayList<>(); |
|
|
|
|
KnowVO knowVO = null; |
|
|
|
|
if (roleId.equals("1")){ |
|
|
|
|
//老师
|
|
|
|
|
List<String> knowledgeIdList = knowledgeLearningRecordMapper.queryStudyKnowledgeMaxNumber(); |
|
|
|
|
for (String knowledgeId : knowledgeIdList) { |
|
|
|
|
BaseResponse<Knowtemp> knowledge = knowService.query(Long.valueOf(knowledgeId)); |
|
|
|
|
if (knowledge.getData() != null){ |
|
|
|
|
knowVO = new KnowVO(); |
|
|
|
|
knowVO.setId(knowledge.getData().getId()); |
|
|
|
|
knowVO.setLabel(knowledge.getData().getName()); |
|
|
|
|
knowVO.setColor(knowledge.getData().getInfo()); |
|
|
|
|
coursesList.add(knowVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return coursesList; |
|
|
|
|
}else if (roleId.equals("2")){ |
|
|
|
|
//学生
|
|
|
|
|
List<String> knowledgeIdList = knowledgeLearningRecordMapper.queryStudyMaxKnowledgeId(userId); |
|
|
|
|
for (String knowledgeId : knowledgeIdList) { |
|
|
|
|
BaseResponse<Knowtemp> knowledge = knowService.query(Long.valueOf(knowledgeId)); |
|
|
|
|
if (knowledge.getData() != null) { |
|
|
|
|
knowVO = new KnowVO(); |
|
|
|
|
knowVO.setId(knowledge.getData().getId()); |
|
|
|
|
knowVO.setLabel(knowledge.getData().getName()); |
|
|
|
|
knowVO.setColor(knowledge.getData().getInfo()); |
|
|
|
|
coursesList.add(knowVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return coursesList; |
|
|
|
|
}else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|