浏览代码

培训优化

shenhao 3 年之前
父节点
当前提交
0237134ee5

+ 36 - 0
src/main/java/com/aijia/kmt/controller/KmtExerciseController.java

@@ -13,7 +13,11 @@ import com.aijia.kmt.vo.rollbackai.ExerciseBooksEditRequest;
 import com.aijia.kmt.vo.rollbackai.ExerciseQuestionDealRequest;
 import com.aijia.kmt.vo.rollbackai.ExerciseQuestionsEditRequest;
 import com.aijia.train.bean.TrTrainPartUser;
+import com.aijia.train.bean.TrTrainQuestionCheck;
+import com.aijia.train.mapper.TrainCheckQuestion;
+import com.aijia.train.mapper.TrainUserServiceMapper;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections4.CollectionUtils;
@@ -54,6 +58,12 @@ public class KmtExerciseController extends BaseController {
     @Autowired
     private KmtExerciseQuestionDealService kmtExerciseQuestionDealService;
 
+    @Autowired
+    private TrainCheckQuestion checkQuestionMapper;
+
+    @Autowired
+    private TrainUserServiceMapper userServiceMapper;
+
     @RequestMapping(value = "/getHandlingQuestions", method = RequestMethod.POST)
     @ApiOperation(value = "待加工/待审核题目", httpMethod = "POST",  notes = "待加工/待审核题目")
     public ResponseEntity getHandlingQuestions(@RequestParam(name = "accessToken") String accessToken,
@@ -141,6 +151,9 @@ public class KmtExerciseController extends BaseController {
                     type = 2;
                 }
             }
+            if(request.getSearchType()==3){
+                type = 3;
+            }
 
             data.put("units", kmtExerciseMapperService.findExerciseBookDetail(request, userId,type));
             responseEntity.success(data, "成功");
@@ -301,5 +314,28 @@ public class KmtExerciseController extends BaseController {
         return responseEntity;
     }
 
+    @RequestMapping(value = "/queryAllotInfo", method = RequestMethod.POST)
+    @ApiOperation(value = "查询题目是否分配", httpMethod = "POST",  notes = "查询题目是否分配")
+    public ResponseEntity queryAllotInfo(@RequestParam(name = "accessToken") String accessToken) {
+        ResponseEntity responseEntity = new ResponseEntity();
+        try {
+            Map<String,Object> data = new HashMap<>();
+            TrTrainPartUser user = userServiceMapper.selectById(tokenManager.getUserId(accessToken));
+            int count = checkQuestionMapper.selectCount(
+                    new QueryWrapper<TrTrainQuestionCheck>().eq("role_type",user.getRoleType()).eq("subject",user.getSubject()).eq("status",1));
+            if(count>0){
+                data.put("allotStat",1);
+            }else{
+                data.put("allotStat",2);
+            }
+            responseEntity.success(data,"查询成功");
+        } catch (Exception e){
+            logger.error("入参={}", request);
+            logger.error("异常", e);
+            responseEntity.failure(ResponseConstant.CODE_500, "暂未加载到数据,请稍后重试");
+        }
+        return responseEntity;
+    }
+
 
 }

+ 2 - 1
src/main/java/com/aijia/kmt/controller/KmtExerciseQuestionListController.java

@@ -56,7 +56,8 @@ public class KmtExerciseQuestionListController extends BaseController {
         ResponseEntity responseEntity = new ResponseEntity();
         try {
             String userId = tokenManager.getUserId(accessToken);
-            responseEntity = kmtExerciseQuestionListService.findQuestionList(userId, request,2);
+            int type = request.getSearchType()==1?1:2;
+            responseEntity = kmtExerciseQuestionListService.findQuestionList(userId, request,type);
         } catch (Exception e) {
             logger.error("入参={}", request);
             logger.error("待加工/待审核题目", e);

+ 14 - 8
src/main/java/com/aijia/kmt/service/impl/KmtExerciseMapperServiceImpl.java

@@ -626,23 +626,29 @@ public class KmtExerciseMapperServiceImpl implements KmtExerciseMapperService {
             list = kmtExerciseMapper.findUnHandleExerciseBookCourseNew(request.getExerciseBookId(), request.getDealType(),
                     request.getQuestionId(), userId);
         } else {
-            //管理员
+
             if (StringUtil.isNotBlank(request.getQuestionId())){
                 list = kmtExerciseMapper.findExerciseBookCourseByQuestionIdNew(request.getQuestionId().trim());
             } else {
                 if (!request.getExerciseBookId().startsWith("book_")){
                     KmtExerciseBook book = kmtExerciseBookMapper.selectById(request.getExerciseBookId());
                     if (book != null) {
-                        if (book.getBookType() == 1 || book.getBookType() == 2){
-                            //上半或下半
-                            list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(null,book.getId(),null,type);
-                        } else {
-                            if (request.getBookPartType() == 2){
-                                list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(null,book.getId(),1,type);//查询差异题目的单元
+                        //管理员
+                        if(type == 3){
+                            list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(book.getParentBookId(),null,null,2);//查询差异题目的单元
+                        }else{
+                            if (book.getBookType() == 1 || book.getBookType() == 2){
+                                //上半或下半
+                                list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(null,book.getId(),null,type);
                             } else {
-                                list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(book.getParentBookId(),null,null,type);//查询差异题目的单元
+                                if (request.getBookPartType() == 2){
+                                    list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(null,book.getId(),1,type);//查询差异题目的单元
+                                } else {
+                                    list = kmtExerciseMapper.findAllExerciseBookCourseByExerciseBookIdNew(book.getParentBookId(),null,null,type);//查询差异题目的单元
+                                }
                             }
                         }
+
                     }
                 }
             }

+ 20 - 20
src/main/java/com/aijia/kmt/service/impl/KmtExerciseQuestionDealServiceImpl.java

@@ -628,26 +628,26 @@ public class KmtExerciseQuestionDealServiceImpl implements KmtExerciseQuestionDe
 
 
                 // 判断为 1
-                if (request.getEnumerate()==1){
-                        String path = this.removeQuestionNumMark(request.getStartX(), request.getStartY(), request.getEndX(), request.getEndY(), kmtExerciseQuestion.getImage());
-                        String content = JSONFileUtil.readJSONFile(PropertiesUtil.getValue("EXERCISE_JSON_FILE_PATH") + kmtExerciseQuestion.getQuestionPath());
-                        if (StringUtil.isNotBlank(content) && StringUtil.isNotBlank(path)) {
-                            Map<String, Object> map = JSON.parseObject(content, Map.class);
-                            ExerciseQuestionAnswerValue questionAnswerValue = ExerciseUtil.getExerciseQuestionAnswerValue(path);
-                            if (questionAnswerValue == null){
-                                map.put("question_json", "[]");
-                            } else {
-                                map.put("question_json", Collections.singletonList(questionAnswerValue));
-                            }
-                            map.put("question", "<img src='" + PropertiesUtil.getValue("STATIC_FILE_URL") + path + "'/>");
-                            map.put("userId",userId);
-                            map.put("questionPath",path);
-                            map.put("bookId",kmtExerciseQuestion.getBookId());
-                            //JSONFileUtil.saveJSONFile(PropertiesUtil.getValue("EXERCISE_JSON_FILE_PATH") + kmtExerciseQuestion.getQuestionPath(), JSON.toJSONString(map));
-                            questionInfoService.updateQuestionAndJsonByQuestionId(kmtExerciseQuestion.getId(), map);
-                            //AijiaThreadPool.getInstance().submit(new SyncSaveExerciseQuestionsTask(kmtExerciseMapper, exerciseQuestionSearchService,  Collections.singletonList(kmtExerciseQuestion.getId())));
-                        }
-                }
+//                if (request.getEnumerate()==1){
+//                        String path = this.removeQuestionNumMark(request.getStartX(), request.getStartY(), request.getEndX(), request.getEndY(), kmtExerciseQuestion.getImage());
+//                        String content = JSONFileUtil.readJSONFile(PropertiesUtil.getValue("EXERCISE_JSON_FILE_PATH") + kmtExerciseQuestion.getQuestionPath());
+//                        if (StringUtil.isNotBlank(content) && StringUtil.isNotBlank(path)) {
+//                            Map<String, Object> map = JSON.parseObject(content, Map.class);
+//                            ExerciseQuestionAnswerValue questionAnswerValue = ExerciseUtil.getExerciseQuestionAnswerValue(path);
+//                            if (questionAnswerValue == null){
+//                                map.put("question_json", "[]");
+//                            } else {
+//                                map.put("question_json", Collections.singletonList(questionAnswerValue));
+//                            }
+//                            map.put("question", "<img src='" + PropertiesUtil.getValue("STATIC_FILE_URL") + path + "'/>");
+//                            map.put("userId",userId);
+//                            map.put("questionPath",path);
+//                            map.put("bookId",kmtExerciseQuestion.getBookId());
+//                            //JSONFileUtil.saveJSONFile(PropertiesUtil.getValue("EXERCISE_JSON_FILE_PATH") + kmtExerciseQuestion.getQuestionPath(), JSON.toJSONString(map));
+//                            questionInfoService.updateQuestionAndJsonByQuestionId(kmtExerciseQuestion.getId(), map);
+//                            //AijiaThreadPool.getInstance().submit(new SyncSaveExerciseQuestionsTask(kmtExerciseMapper, exerciseQuestionSearchService,  Collections.singletonList(kmtExerciseQuestion.getId())));
+//                        }
+//                }
             }
             return responseEntity.success("成功");
         }

+ 11 - 0
src/main/java/com/aijia/kmt/vo/ExerciseBookIdDealTypeRequest.java

@@ -37,6 +37,9 @@ public class ExerciseBookIdDealTypeRequest extends BaseRequest {
     @ApiModelProperty(name = "userId", value = "用户id", required = false)
     private String userId;
 
+    @ApiModelProperty(name = "searchType", value = "搜索类型", required = false)
+    private int searchType = 0;
+
 
     public String getId() {
         return id;
@@ -101,4 +104,12 @@ public class ExerciseBookIdDealTypeRequest extends BaseRequest {
     public void setUserId(String userId) {
         this.userId = userId;
     }
+
+    public int getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(int searchType) {
+        this.searchType = searchType;
+    }
 }

+ 11 - 0
src/main/java/com/aijia/kmt/vo/ExerciseQuestionsRequest.java

@@ -63,6 +63,9 @@ public class ExerciseQuestionsRequest extends BaseRequest {
     @ApiModelProperty(name = "publishStatus", value = "发布状态,1未发布,2已发布", required = false)
     private int publishStatus;
 
+    @ApiModelProperty(name = "searchType", value = "查询类型,1查看", required = false)
+    private int searchType=0;
+
     public String getSubject() {
         return subject;
     }
@@ -215,4 +218,12 @@ public class ExerciseQuestionsRequest extends BaseRequest {
     public void setUserId(String userId) {
         this.userId = userId;
     }
+
+    public int getSearchType() {
+        return searchType;
+    }
+
+    public void setSearchType(int searchType) {
+        this.searchType = searchType;
+    }
 }

+ 6 - 5
src/main/resources/mybatis/mapper/KmtExerciseMapper.xml

@@ -2220,11 +2220,11 @@
 	t.number as num,
 	t.page_index,
 	ifnull(ue.question_path,eq.image) question_image,
-	ifnull(ue.concise_id,eq.concise_id) start_X,
-	ifnull(ue.analysis_submit_type,eq.analysis_submit_type) start_Y,
-	ifnull(ue.update_type,eq.update_type) end_X,
-	ifnull(ue.es_loaded,eq.es_loaded) end_Y,
-	ifnull(ue.enumerate,eq.enumerate) as enumerate,
+	case when ue.concise_id is not null and ue.concise_id >0 then ue.concise_id else eq.concise_id end as start_X,
+	case when ue.analysis_submit_type is not null and ue.analysis_submit_type >0 then ue.analysis_submit_type else eq.analysis_submit_type end as start_Y,
+	case when ue.update_type is not null and ue.update_type >0 then ue.update_type else eq.update_type end as end_X,
+	case when ue.es_loaded is not null and ue.es_loaded >0 then ue.es_loaded else eq.es_loaded end as end_Y,
+	case when ue.es_loaded is not null and ue.es_loaded >0 then ue.enumerate else eq.enumerate end as enumerate,
 	eq.exercise_book_id
 	FROM
 	  q_question_workbook t 
@@ -2236,6 +2236,7 @@
     </if>
     <if test="searchType==1">
         inner JOIN  tr_train_question_check tk on tk.question_id=t.question_id and tk.status = 1
+        inner join tr_train_part_user tu on tk.role_type = tu.role_type and tk.subject = tu.subject and tu.id=#{userId}
     </if>
 	WHERE eq.deal_status != 6
     and t.sub_book_id=#{req.exerciseBookId}