|
@@ -48,7 +48,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
@Override
|
|
@Override
|
|
public ResponseEntity findQuestionList (String userId, ExerciseQuestionsRequest request,int type) {
|
|
public ResponseEntity findQuestionList (String userId, ExerciseQuestionsRequest request,int type) {
|
|
TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
- String paramUserId = user.getManagerType()==1?request.getUserId():userId;
|
|
|
|
|
|
+ String paramUserId = StringUtils.isBlank(request.getUserId())?userId:request.getUserId();
|
|
|
|
|
|
TrTrainPartUser partUser = userServiceMapper.selectById(paramUserId);
|
|
TrTrainPartUser partUser = userServiceMapper.selectById(paramUserId);
|
|
int roleType = partUser.getRoleType();
|
|
int roleType = partUser.getRoleType();
|
|
@@ -56,8 +56,6 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
if(partUser.getManagerType() == 1){
|
|
if(partUser.getManagerType() == 1){
|
|
roleType = 0;
|
|
roleType = 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
ResponseEntity responseEntity = new ResponseEntity();
|
|
ResponseEntity responseEntity = new ResponseEntity();
|
|
Map<String, Object> data = new HashMap<>();
|
|
Map<String, Object> data = new HashMap<>();
|
|
Page page = new Page(request.getPageNo(), request.getPageSize());
|
|
Page page = new Page(request.getPageNo(), request.getPageSize());
|
|
@@ -68,7 +66,8 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
}
|
|
}
|
|
List<ExerciseQuetionDto> questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request, paramUserId, page,user.getManagerType(), type,roleType);
|
|
List<ExerciseQuetionDto> questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request, paramUserId, page,user.getManagerType(), type,roleType);
|
|
//管理员看到的题目列表是两层级, 老师看到的列表是一层级
|
|
//管理员看到的题目列表是两层级, 老师看到的列表是一层级
|
|
- List<QuestionListV1Dto> list = changeDbQuestion(questions,true,paramUserId,type); //默认两层级的结构
|
|
|
|
|
|
+ //默认两层级的结构
|
|
|
|
+ List<QuestionListV1Dto> list = changeDbQuestion(questions,true,paramUserId,type);
|
|
data.put("list", list);
|
|
data.put("list", list);
|
|
data.put("pageNo", page.getCurrent());
|
|
data.put("pageNo", page.getCurrent());
|
|
data.put("pageSize", page.getSize());
|
|
data.put("pageSize", page.getSize());
|
|
@@ -121,7 +120,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
kmtExerciseQuestion.setAnswer(check && StringUtil.isNotBlank(userExercise.getAnswer())?userExercise.getAnswer():jsonObject.getString("option_answer"));
|
|
kmtExerciseQuestion.setAnswer(check && StringUtil.isNotBlank(userExercise.getAnswer())?userExercise.getAnswer():jsonObject.getString("option_answer"));
|
|
kmtExerciseQuestion.setAnswerJson(check && StringUtil.isNotBlank(userExercise.getAnswerJson())?userExercise.getAnswerJson():jsonObject.getString("answer_json"));
|
|
kmtExerciseQuestion.setAnswerJson(check && StringUtil.isNotBlank(userExercise.getAnswerJson())?userExercise.getAnswerJson():jsonObject.getString("answer_json"));
|
|
// kmtExerciseQuestion.setQuestionAnalysis(check && StringUtil.isNotBlank(userExercise.getAnalysis())?userExercise.getAnalysis():jsonObject.getString("analysis"));
|
|
// kmtExerciseQuestion.setQuestionAnalysis(check && StringUtil.isNotBlank(userExercise.getAnalysis())?userExercise.getAnalysis():jsonObject.getString("analysis"));
|
|
-// kmtExerciseQuestion.setAnalysisJson(check && StringUtil.isNotBlank(userExercise.getAnalysisJson())?userExercise.getAnalysisJson():jsonObject.getString("analysis_json"));
|
|
|
|
|
|
+ kmtExerciseQuestion.setAnalysisJson(check && StringUtil.isNotBlank(userExercise.getAnalysisJson())?userExercise.getAnalysisJson():"");
|
|
kmtExerciseQuestion.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():jsonObject.getString("question_answer"));
|
|
kmtExerciseQuestion.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():jsonObject.getString("question_answer"));
|
|
}else{
|
|
}else{
|
|
kmtExerciseQuestion.setQuestion(check && StringUtil.isNotBlank(userExercise.getQuestion())?userExercise.getQuestion():"");
|
|
kmtExerciseQuestion.setQuestion(check && StringUtil.isNotBlank(userExercise.getQuestion())?userExercise.getQuestion():"");
|
|
@@ -129,7 +128,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
kmtExerciseQuestion.setAnswer(check && StringUtil.isNotBlank(userExercise.getAnswer())?userExercise.getAnswer():"");
|
|
kmtExerciseQuestion.setAnswer(check && StringUtil.isNotBlank(userExercise.getAnswer())?userExercise.getAnswer():"");
|
|
kmtExerciseQuestion.setAnswerJson(check && StringUtil.isNotBlank(userExercise.getAnswerJson())?userExercise.getAnswerJson():"");
|
|
kmtExerciseQuestion.setAnswerJson(check && StringUtil.isNotBlank(userExercise.getAnswerJson())?userExercise.getAnswerJson():"");
|
|
// kmtExerciseQuestion.setQuestionAnalysis(check && StringUtil.isNotBlank(userExercise.getAnalysis())?userExercise.getAnalysis():"");
|
|
// kmtExerciseQuestion.setQuestionAnalysis(check && StringUtil.isNotBlank(userExercise.getAnalysis())?userExercise.getAnalysis():"");
|
|
-// kmtExerciseQuestion.setAnalysisJson(check && StringUtil.isNotBlank(userExercise.getAnalysisJson())?userExercise.getAnalysisJson():"");
|
|
|
|
|
|
+ kmtExerciseQuestion.setAnalysisJson(check && StringUtil.isNotBlank(userExercise.getAnalysisJson())?userExercise.getAnalysisJson():"");
|
|
kmtExerciseQuestion.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():"");
|
|
kmtExerciseQuestion.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():"");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -171,13 +170,13 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
List<QuestionListV1Dto> result = new ArrayList<>();
|
|
List<QuestionListV1Dto> result = new ArrayList<>();
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
List<String> questionIds = list.stream().map(ExerciseQuetionDto::getQuestionId).collect(Collectors.toList());
|
|
List<String> questionIds = list.stream().map(ExerciseQuetionDto::getQuestionId).collect(Collectors.toList());
|
|
- List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(questionIds,null);
|
|
|
|
|
|
+ List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(questionIds,null,0);
|
|
List<TbLibManager> users = getDealUsers(list);
|
|
List<TbLibManager> users = getDealUsers(list);
|
|
|
|
|
|
list.forEach(temp -> {
|
|
list.forEach(temp -> {
|
|
QuestionListV1Dto tar = changeExerciseDto2QuestionListDto(temp, questionKnows, users,null);
|
|
QuestionListV1Dto tar = changeExerciseDto2QuestionListDto(temp, questionKnows, users,null);
|
|
if (isTwoLevel && StringUtil.isNotBlank(temp.getParentId())){
|
|
if (isTwoLevel && StringUtil.isNotBlank(temp.getParentId())){
|
|
- addTar2Result(tar, result, temp.getParentId(), temp.getExerciseBookId(),null);
|
|
|
|
|
|
+ addTar2Result(tar, result, temp.getParentId(), temp.getExerciseBookId(),null,0);
|
|
} else {
|
|
} else {
|
|
result.add(tar);
|
|
result.add(tar);
|
|
}
|
|
}
|
|
@@ -196,13 +195,49 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
List<String> questionIds = list.stream().map(ExerciseQuetionDto::getQuestionId).collect(Collectors.toList());
|
|
List<String> questionIds = list.stream().map(ExerciseQuetionDto::getQuestionId).collect(Collectors.toList());
|
|
|
|
|
|
- List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(questionIds,userId);
|
|
|
|
|
|
+ TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
|
|
+ //已提交
|
|
|
|
+ List<QuestionListKnowModel> questionKnows = null;
|
|
|
|
+ if(type == 2){
|
|
|
|
+ questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds2(questionIds);
|
|
|
|
+ }else{
|
|
|
|
+ if(user.getStudyStatus()>3){
|
|
|
|
+ questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(questionIds,userId,type);
|
|
|
|
+ }else{
|
|
|
|
+ //查询用户提交记录
|
|
|
|
+ List<TrTrainUserExercise> userExerciseList = userExerciseMapper.selectList(
|
|
|
|
+ new QueryWrapper<TrTrainUserExercise>().eq("user_id",userId)
|
|
|
|
+ );
|
|
|
|
+ List<String> postList = new ArrayList<>();
|
|
|
|
+ List<String> copyList = new ArrayList<>();
|
|
|
|
+ copyList.addAll(questionIds);
|
|
|
|
+ questionIds.forEach(s->{
|
|
|
|
+ userExerciseList.forEach(ue->{
|
|
|
|
+ if(ue.getQuestionId().equals(s) && ue.getStatus()>0){
|
|
|
|
+ postList.add(s);
|
|
|
|
+ copyList.remove(s);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ if(postList.size()>0){
|
|
|
|
+ questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(postList,userId,type);
|
|
|
|
+ }
|
|
|
|
+ if(questionKnows == null || questionKnows.size()==0){
|
|
|
|
+ questionKnows = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ if(user.getRoleType()>1){
|
|
|
|
+ questionKnows.addAll(kmtExerciseMapper.findQuestionKnowByQuestionIds2(copyList));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
List<TbLibManager> users = getDealUsers(list);
|
|
List<TbLibManager> users = getDealUsers(list);
|
|
|
|
|
|
|
|
+ List<QuestionListKnowModel> finalQuestionKnows = questionKnows;
|
|
list.forEach(temp -> {
|
|
list.forEach(temp -> {
|
|
- QuestionListV1Dto tar = changeExerciseDto2QuestionListDto(temp, questionKnows, users,userId);
|
|
|
|
|
|
+ QuestionListV1Dto tar = changeExerciseDto2QuestionListDto(temp, finalQuestionKnows, users,userId);
|
|
if (isTwoLevel && StringUtil.isNotBlank(temp.getParentId())){
|
|
if (isTwoLevel && StringUtil.isNotBlank(temp.getParentId())){
|
|
- addTar2Result(tar, result, temp.getParentId(), temp.getExerciseBookId(),userId);
|
|
|
|
|
|
+ addTar2Result(tar, result, temp.getParentId(), temp.getExerciseBookId(),userId,type);
|
|
} else {
|
|
} else {
|
|
result.add(tar);
|
|
result.add(tar);
|
|
}
|
|
}
|
|
@@ -221,14 +256,12 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
private QuestionListV1Dto changeExerciseDto2QuestionListDto (ExerciseQuetionDto exerciseDto, List<QuestionListKnowModel> questionKnows,
|
|
private QuestionListV1Dto changeExerciseDto2QuestionListDto (ExerciseQuetionDto exerciseDto, List<QuestionListKnowModel> questionKnows,
|
|
List<TbLibManager> users,String userId) {
|
|
List<TbLibManager> users,String userId) {
|
|
QuestionListV1Dto tar = new QuestionListV1Dto();
|
|
QuestionListV1Dto tar = new QuestionListV1Dto();
|
|
- TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
|
|
- if(user.getRoleType()>1){
|
|
|
|
- //设置知识点
|
|
|
|
- setQuestionKnowledge(tar, questionKnows.stream().filter(map ->
|
|
|
|
- exerciseDto.getQuestionId().equals(map.getQuestionId())).collect(Collectors.toList()));
|
|
|
|
- }
|
|
|
|
|
|
+// TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
|
|
+ //设置知识点
|
|
|
|
+ setQuestionKnowledge(tar, questionKnows.stream().filter(map ->
|
|
|
|
+ exerciseDto.getQuestionId().equals(map.getQuestionId())).collect(Collectors.toList()));
|
|
//设置打回人和被打回人
|
|
//设置打回人和被打回人
|
|
- setFromUserAndToUser(tar, exerciseDto);
|
|
|
|
|
|
+// setFromUserAndToUser(tar, exerciseDto);
|
|
//设置加工审核人
|
|
//设置加工审核人
|
|
// appendQuestionDealUser(users, tar, exerciseDto);
|
|
// appendQuestionDealUser(users, tar, exerciseDto);
|
|
//状态
|
|
//状态
|
|
@@ -238,7 +271,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
return tar;
|
|
return tar;
|
|
}
|
|
}
|
|
|
|
|
|
- private void addTar2Result (QuestionListV1Dto tar, List<QuestionListV1Dto> result, String parentId, String bookId,String userId){
|
|
|
|
|
|
+ private void addTar2Result (QuestionListV1Dto tar, List<QuestionListV1Dto> result, String parentId, String bookId,String userId,int type){
|
|
if (StringUtil.isNotBlank(parentId)){
|
|
if (StringUtil.isNotBlank(parentId)){
|
|
boolean exist = false;
|
|
boolean exist = false;
|
|
for (QuestionListV1Dto questionListV1Dto : result) {
|
|
for (QuestionListV1Dto questionListV1Dto : result) {
|
|
@@ -251,7 +284,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
|
|
|
//如果大题不存在, 新增空大题(只有题目id), 可能大题已经被加工
|
|
//如果大题不存在, 新增空大题(只有题目id), 可能大题已经被加工
|
|
if (!exist){
|
|
if (!exist){
|
|
- QuestionListV1Dto parent = getParentQuestionV1Dto(parentId, bookId,userId);
|
|
|
|
|
|
+ QuestionListV1Dto parent = getParentQuestionV1Dto(parentId, bookId,userId,type);
|
|
parent.setIsQuestionCanDeal(1); //大题不可加工
|
|
parent.setIsQuestionCanDeal(1); //大题不可加工
|
|
parent.getChildQuestions().add(tar);
|
|
parent.getChildQuestions().add(tar);
|
|
result.add(parent);
|
|
result.add(parent);
|
|
@@ -263,7 +296,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
* 查询父题dto
|
|
* 查询父题dto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private QuestionListV1Dto getParentQuestionV1Dto (String parentId, String bookId,String userId) {
|
|
|
|
|
|
+ private QuestionListV1Dto getParentQuestionV1Dto (String parentId, String bookId,String userId,int type) {
|
|
QuestionListV1Dto parent = new QuestionListV1Dto();
|
|
QuestionListV1Dto parent = new QuestionListV1Dto();
|
|
if (StringUtil.isNotBlank(parentId)){
|
|
if (StringUtil.isNotBlank(parentId)){
|
|
String temp = kmtExerciseMapper.findDifferentExerciseBookId(parentId);
|
|
String temp = kmtExerciseMapper.findDifferentExerciseBookId(parentId);
|
|
@@ -274,7 +307,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
q.setIsCommonFlag(q.getIsCommonFlag() == 0 ? 1 : 0);
|
|
q.setIsCommonFlag(q.getIsCommonFlag() == 0 ? 1 : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(Collections.singletonList(parentId),userId);
|
|
|
|
|
|
+ List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(Collections.singletonList(parentId),userId,type);
|
|
List<TbLibManager> users = getDealUsers(questions);
|
|
List<TbLibManager> users = getDealUsers(questions);
|
|
this.appendQuestionDtoDataFromJSONFile(questions,userId);
|
|
this.appendQuestionDtoDataFromJSONFile(questions,userId);
|
|
for (ExerciseQuetionDto q : questions){
|
|
for (ExerciseQuetionDto q : questions){
|