|
@@ -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 (StringUtils.isNotBlank(request.getPeriodId())){
|
|
|
+
|
|
|
if (StringUtil.isNotBlank(request.getQuestionId())){
|
|
|
//搜索题目id
|
|
|
- //questions = kmtExerciseMapper.findExerciseQuestionByQuestionIdAndBookId(request.getQuestionId().trim(), request.getExerciseBookId());
|
|
|
page = new Page(1, 10, 1);
|
|
|
}
|
|
|
- questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request, paramUserId, page,user.getManagerType(), type);
|
|
|
-// } else if (request.getExerciseBookId().startsWith("book_")) {
|
|
|
-// //选择全部
|
|
|
-// String[] param = request.getExerciseBookId().split("_");
|
|
|
-// Map<String, Object> params = new HashMap<>();
|
|
|
-// params.put("grade", param[1]);
|
|
|
-// params.put("subject", param[2]);
|
|
|
-// params.put("versionType", Integer.parseInt(param[3]));
|
|
|
-// params.put("semester", Integer.parseInt(param[4]));
|
|
|
-// params.put("questionType", request.getQuestionType());
|
|
|
-// params.put("publishStatus", request.getPublishStatus());
|
|
|
-// params.put("rollbackType", request.getRollbackType());
|
|
|
-// questions = kmtExerciseMapper.findQuestionByBookCourseIdAndUserIdNew(request,userId, page);
|
|
|
-// }
|
|
|
+ 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.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.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);
|
|
|
+// appendQuestionDealUser(users, tar, exerciseDto);
|
|
|
//状态
|
|
|
tar.setQuestionStatus(this.getQuestionStatus(exerciseDto.getQuestionStatus()));
|
|
|
//设置一致的字段
|