Bläddra i källkod

错题收藏 终端分类 修改

小么熊🐻 1 år sedan
förälder
incheckning
3201732a49

+ 4 - 3
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionCollectionController.java

@@ -48,7 +48,7 @@ public class QuestionCollectionController extends BaseController {
         QuestionCollectionListDTO dto = new QuestionCollectionListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
         List<QuestionCollection> list = questionCollectionService.selectQuestionCollectionList(dto);
-        long count = list.stream().filter(o -> questionCollectionDTO.getQuestionId().equals(o.getQuestionId()) && questionCollectionDTO.getKm().equals(o.getKm())).count();
+        long count = list.stream().filter(o -> questionCollectionDTO.getQuestionId().equals(o.getQuestionId()) && questionCollectionDTO.getKm().equals(o.getKm()) && o.getDeviceType()==1).count();
         if (count > 0) {
             Response response = new Response(200,"该题目已收藏过");
             return response;
@@ -67,11 +67,11 @@ public class QuestionCollectionController extends BaseController {
         QuestionCollectionListDTO dto = new QuestionCollectionListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
         List<QuestionCollection> dblist = questionCollectionService.selectQuestionCollectionList(dto);
-        List<String> questionIdsStr = dblist.stream().map(o -> (o.getQuestionId()+","+o.getKm())).collect(Collectors.toList());
+        List<String> questionIdsStr = dblist.stream().map(o -> (o.getQuestionId()+","+o.getKm()+","+o.getDeviceType())).collect(Collectors.toList());
 
         List<QuestionCollection> qlist = new ArrayList<QuestionCollection>();
         for (QuestionColYunDTO colDTO : col.getCols()) {
-            if (questionIdsStr.contains(colDTO.getId()+","+col.getKm())) {
+            if (questionIdsStr.contains(colDTO.getId()+","+col.getKm()+","+"1")) {
                 continue;
             }
             QuestionCollection questionCollection = new QuestionCollection();
@@ -99,6 +99,7 @@ public class QuestionCollectionController extends BaseController {
         QueryWrapper<QuestionCollection> queryWrapper = new QueryWrapper<QuestionCollection>();
         queryWrapper.eq("user_id",userId);
         queryWrapper.eq("km",col.getKm());
+        queryWrapper.eq("device_type",1);
         questionCollectionService.remove(queryWrapper);
 
         //保存上传的收藏题

+ 4 - 3
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionWrongController.java

@@ -43,7 +43,7 @@ public class QuestionWrongController extends BaseController {
         QuestionWrongListDTO dto = new QuestionWrongListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
         List<QuestionWrong> list = questionWrongService.selectQuestionWrongList(dto);
-        long count = list.stream().filter(o -> questionWrongDTO.getQuestionId().equals(o.getQuestionId()) && questionWrongDTO.getKm().equals(o.getKm())).count();
+        long count = list.stream().filter(o -> questionWrongDTO.getQuestionId().equals(o.getQuestionId()) && questionWrongDTO.getKm().equals(o.getKm()) && o.getDeviceType()==1 ).count();
         if (count > 0) {
             //throw new CustomException("该错已加入错题集");
             Response response = new Response(200, "该错已加入错题集");
@@ -63,11 +63,11 @@ public class QuestionWrongController extends BaseController {
         QuestionWrongListDTO dto = new QuestionWrongListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
         List<QuestionWrong> dblist = questionWrongService.selectQuestionWrongList(dto);
-        List<String> questionIdsStr = dblist.stream().map(o -> o.getQuestionId() + "," + o.getKm()).collect(Collectors.toList());
+        List<String> questionIdsStr = dblist.stream().map(o -> o.getQuestionId() + "," + o.getKm() + "," + o.getDeviceType()).collect(Collectors.toList());
 
         List<QuestionWrong> qlist = new ArrayList<QuestionWrong>();
         for (QuestionWgYunDTO wgYunDTO : wrong.getWrongs()) {
-            if (questionIdsStr.contains(wgYunDTO.getId() + "," + wrong.getKm())) {
+            if (questionIdsStr.contains(wgYunDTO.getId() + "," + wrong.getKm() + "," +"1")) {
                 continue;
             }
             QuestionWrong questionWrong = new QuestionWrong();
@@ -95,6 +95,7 @@ public class QuestionWrongController extends BaseController {
         QueryWrapper<QuestionWrong> queryWrapper = new QueryWrapper<QuestionWrong>();
         queryWrapper.eq("user_id", userId);
         queryWrapper.eq("km", wrong.getKm());
+        queryWrapper.eq("device_type", 1);
         questionWrongService.remove(queryWrapper);
 
         //保存上传的错题

+ 4 - 3
jpcj-admin/src/main/java/com/miaxis/pc/controller/question/PcQuestionWrongController.java

@@ -44,7 +44,7 @@ public class PcQuestionWrongController extends BaseController {
         QuestionWrongListDTO dto = new QuestionWrongListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
         List<QuestionWrong> list = questionWrongService.selectQuestionWrongList(dto);
-        long count = list.stream().filter(o -> questionWrongDTO.getQuestionId().equals(o.getQuestionId()) && questionWrongDTO.getKm().equals(o.getKm())).count();
+        long count = list.stream().filter(o -> questionWrongDTO.getQuestionId().equals(o.getQuestionId()) && questionWrongDTO.getKm().equals(o.getKm()) && o.getDeviceType()==2 ).count();
         if (count > 0) {
             //throw new CustomException("该错已加入错题集");
             Response response = new Response(200, "该错已加入错题集");
@@ -64,11 +64,11 @@ public class PcQuestionWrongController extends BaseController {
         QuestionWrongListDTO dto = new QuestionWrongListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
         List<QuestionWrong> dblist = questionWrongService.selectQuestionWrongList(dto);
-        List<String> questionIdsStr = dblist.stream().map(o -> o.getQuestionId() + "," + o.getKm()).collect(Collectors.toList());
+        List<String> questionIdsStr = dblist.stream().map(o -> o.getQuestionId() + "," + o.getKm() + "," + o.getDeviceType()).collect(Collectors.toList());
 
         List<QuestionWrong> qlist = new ArrayList<QuestionWrong>();
         for (QuestionWgYunDTO wgYunDTO : wrong.getWrongs()) {
-            if (questionIdsStr.contains(wgYunDTO.getId() + "," + wrong.getKm())) {
+            if (questionIdsStr.contains(wgYunDTO.getId() + "," + wrong.getKm() + "," + "2")) {
                 continue;
             }
             QuestionWrong questionWrong = new QuestionWrong();
@@ -96,6 +96,7 @@ public class PcQuestionWrongController extends BaseController {
         QueryWrapper<QuestionWrong> queryWrapper = new QueryWrapper<QuestionWrong>();
         queryWrapper.eq("user_id", userId);
         queryWrapper.eq("km", wrong.getKm());
+        queryWrapper.eq("device_type", 2);
         questionWrongService.remove(queryWrapper);
 
         //保存上传的错题