Kaynağa Gözat

作者:张哲
时间:2023/08/29
类型:优化
描述:修改bug

zizg 1 yıl önce
ebeveyn
işleme
530229ea09

+ 5 - 3
src/main/java/com/redxun/knowledge/album/service/AlbumCategoryServiceImpl.java

@@ -250,16 +250,18 @@ public class AlbumCategoryServiceImpl extends SuperServiceImpl<AlbumCategoryMapp
      * @return
      */
     public String edit(AlbumCategory albumCategory) {
+        String pkId = albumCategory.getPkId();
+        AlbumCategory albumCategoryBefore = this.get(pkId);
         if (albumCategory.getSort() == null) {
             return "排序不能为空";
         }
         //判断是否能进行修改(创建人或维护人满足一个即可修改)
         String userId = userService.queryLoginUser();
-        if (!userId.equals(albumCategory.getCreateBy())){
+        if (!userId.equals(albumCategoryBefore.getCreateBy())){
             throw new RuntimeException("您没有权限进行此操作");
         }
-        if (StringUtils.isNotEmpty(albumCategory.getMaintainer())){
-            if (!Arrays.asList(albumCategory.getMaintainer().split(",")).contains(userId)){
+        if (StringUtils.isNotEmpty(albumCategoryBefore.getMaintainer())){
+            if (!Arrays.asList(albumCategoryBefore.getMaintainer().split(",")).contains(userId)){
                 throw new RuntimeException("您没有权限进行此操作");
             }
         }

+ 1 - 1
src/main/java/com/redxun/knowledge/map/controller/MapController.java

@@ -181,7 +181,7 @@ public class MapController extends BaseController<Map> {
         if (validResult.hasErrors()) {
             return jsonResult.setMessage("参数错误");
         }
-        mapService.updateLearningStateV2(pkIdDto.getPkId(),pkIdDto.getUserId());
+        mapService.updateLearningStateV2(pkIdDto.getContentId(),pkIdDto.getUserId());
         //jsonResult.setMessage("考试完成!");
         return jsonResult.setData("");
     }

+ 1 - 1
src/main/java/com/redxun/knowledge/map/entity/dto/PkIdDto.java

@@ -18,7 +18,7 @@ import java.io.Serializable;
 public class PkIdDto implements Serializable {
 
     @NotEmpty(message = "内容id不能为空")
-    private String pkId;
+    private String contentId;
 
     @NotEmpty(message = "用户id不能为空")
     private String userId;

+ 6 - 6
src/main/java/com/redxun/knowledge/map/service/MapServiceImpl.java

@@ -348,16 +348,16 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
     /**
      * 设置地图学习内容学习状态-PC端
      *
-     * @param pkId
+     * @param contentId
      */
-    public void updateLearningStateV2(String pkId,String userId) {
-        String mapId = mapContentMapper.selectById(pkId).getMapId();
-        if (mapContentMapper.selectById(pkId) != null) {
+    public void updateLearningStateV2(String contentId,String userId) {
+        String mapId = mapContentMapper.selectById(contentId).getMapId();
+        if (mapContentMapper.selectById(contentId) != null) {
             MapLearning mapLearning = new MapLearning();
             mapLearning.setPkId(IdGenerator.getIdStr());
             mapLearning.setMapId(mapId);
-            mapLearning.setRouteId(mapContentMapper.selectById(pkId).getRouteId());
-            mapLearning.setContentId(pkId);
+            mapLearning.setRouteId(mapContentMapper.selectById(contentId).getRouteId());
+            mapLearning.setContentId(contentId);
             mapLearning.setUserId(userId);
             mapLearningMapper.insert(mapLearning);
         }