|
@@ -49,34 +49,26 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
public ResponseEntity findQuestionList (String userId, ExerciseQuestionsRequest request,int type) {
|
|
|
TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
|
String paramUserId = user.getManagerType()==1?request.getUserId():userId;
|
|
|
+
|
|
|
+ TrTrainPartUser partUser = userServiceMapper.selectById(paramUserId);
|
|
|
+ int roleType = partUser.getRoleType();
|
|
|
+
|
|
|
+ if(partUser.getManagerType() == 1){
|
|
|
+ roleType = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
ResponseEntity responseEntity = new ResponseEntity();
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
|
Page page = new Page(request.getPageNo(), request.getPageSize());
|
|
|
- List<ExerciseQuetionDto> questions = null;
|
|
|
-
|
|
|
+
|
|
|
if (StringUtil.isNotBlank(request.getQuestionId())){
|
|
|
|
|
|
-
|
|
|
page = new Page(1, 10, 1);
|
|
|
}
|
|
|
- questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request, paramUserId, page,user.getManagerType(), type);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ List<ExerciseQuetionDto> questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request, paramUserId, page,user.getManagerType(), type,roleType);
|
|
|
|
|
|
- List<QuestionListV1Dto> list = null;
|
|
|
-
|
|
|
- list = changeDbQuestion(questions,true,paramUserId);
|
|
|
+ List<QuestionListV1Dto> list = changeDbQuestion(questions,true,paramUserId,type);
|
|
|
data.put("list", list);
|
|
|
data.put("pageNo", page.getCurrent());
|
|
|
data.put("pageSize", page.getSize());
|
|
@@ -90,7 +82,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
* 把数据库结构的题目转成前端反参的形式
|
|
|
* @param questions
|
|
|
*/
|
|
|
- private List<QuestionListV1Dto> changeDbQuestion (List<ExerciseQuetionDto> questions, boolean isTwoLevel,String userId) {
|
|
|
+ private List<QuestionListV1Dto> changeDbQuestion (List<ExerciseQuetionDto> questions, boolean isTwoLevel,String userId,int type) {
|
|
|
List<QuestionListV1Dto> list = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(questions)){
|
|
|
this.appendQuestionDtoDataFromJSONFile(questions,userId);
|
|
@@ -99,7 +91,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
q.setQuestion("<img src='" + PropertiesUtil.getValue("STATIC_FILE_URL") + q.getQuestionImage() + "'/>");
|
|
|
}
|
|
|
}
|
|
|
- list = this.getQuestionGroupList(questions, isTwoLevel,userId);
|
|
|
+ list = this.getQuestionGroupList(questions, isTwoLevel,userId,type);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -128,16 +120,16 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
kmtExerciseQuestion.setQuestionText(check && StringUtil.isNotBlank(userExercise.getQuestionText())?userExercise.getQuestionText():jsonObject.getString("question_text"));
|
|
|
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.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.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():jsonObject.getString("question_answer"));
|
|
|
}else{
|
|
|
kmtExerciseQuestion.setQuestion(check && StringUtil.isNotBlank(userExercise.getQuestion())?userExercise.getQuestion():"");
|
|
|
kmtExerciseQuestion.setQuestionText(check && StringUtil.isNotBlank(userExercise.getQuestionText())?userExercise.getQuestionText():"");
|
|
|
kmtExerciseQuestion.setAnswer(check && StringUtil.isNotBlank(userExercise.getAnswer())?userExercise.getAnswer():"");
|
|
|
kmtExerciseQuestion.setAnswerJson(check && StringUtil.isNotBlank(userExercise.getAnswerJson())?userExercise.getAnswerJson():"");
|
|
|
- kmtExerciseQuestion.setQuestionAnalysis(check && StringUtil.isNotBlank(userExercise.getAnalysis())?userExercise.getAnalysis():"");
|
|
|
- kmtExerciseQuestion.setAnalysisJson(check && StringUtil.isNotBlank(userExercise.getAnalysisJson())?userExercise.getAnalysisJson():"");;
|
|
|
+
|
|
|
+
|
|
|
kmtExerciseQuestion.setOriginAnswer(check && StringUtil.isNotBlank(userExercise.getAnswerText())?userExercise.getAnswerText():"");
|
|
|
}
|
|
|
}
|
|
@@ -199,10 +191,17 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
* @param isTwoLevel 是否是两层级
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<QuestionListV1Dto> getQuestionGroupList (List<ExerciseQuetionDto> list, boolean isTwoLevel,String userId){
|
|
|
+ public List<QuestionListV1Dto> getQuestionGroupList (List<ExerciseQuetionDto> list, boolean isTwoLevel,String userId,int type){
|
|
|
List<QuestionListV1Dto> result = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
|
List<String> questionIds = list.stream().map(ExerciseQuetionDto::getQuestionId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(type == 1){
|
|
|
+ TrTrainPartUser user = userServiceMapper.selectById(userId);
|
|
|
+ if(user.getRoleType()==1){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
List<QuestionListKnowModel> questionKnows = kmtExerciseMapper.findQuestionKnowByQuestionIds(questionIds,userId);
|
|
|
List<TbLibManager> users = getDealUsers(list);
|
|
|
|
|
@@ -234,7 +233,7 @@ public class KmtExerciseQuestionListServiceImpl implements KmtExerciseQuestionLi
|
|
|
|
|
|
setFromUserAndToUser(tar, exerciseDto);
|
|
|
|
|
|
- appendQuestionDealUser(users, tar, exerciseDto);
|
|
|
+
|
|
|
|
|
|
tar.setQuestionStatus(this.getQuestionStatus(exerciseDto.getQuestionStatus()));
|
|
|
|