Jelajahi Sumber

视频模块完成

wuweihao 5 tahun lalu
induk
melakukan
6be8b43d80
32 mengubah file dengan 354 tambahan dan 88 penghapusan
  1. 5 1
      gis_common/src/main/java/com/gis/common/constant/TypeCode.java
  2. 2 2
      gis_domain/src/main/java/com/gis/domain/dto/CommentRequest.java
  3. 6 3
      gis_domain/src/main/java/com/gis/domain/dto/FodderDto.java
  4. 4 1
      gis_domain/src/main/java/com/gis/domain/dto/GoodsDto.java
  5. 8 0
      gis_domain/src/main/java/com/gis/domain/dto/VideoDto.java
  6. 2 2
      gis_domain/src/main/java/com/gis/domain/po/FodderEntity.java
  7. 3 0
      gis_domain/src/main/java/com/gis/domain/po/MenuEntity.java
  8. 3 0
      gis_domain/src/main/java/com/gis/domain/po/SceneEntity.java
  9. 7 0
      gis_domain/src/main/java/com/gis/domain/po/VideoEntity.java
  10. 4 1
      gis_domain/src/main/java/com/gis/domain/vo/VideoVo.java
  11. 3 0
      gis_mapper/src/main/java/com/gis/mapper/FileMapper.java
  12. 1 1
      gis_mapper/src/main/java/com/gis/mapper/GoodsMapper.java
  13. 11 23
      gis_mapper/src/main/java/com/gis/mapper/provider/GoodsProvider.java
  14. 6 1
      gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java
  15. 6 1
      gis_mapper/src/main/java/com/gis/mapper/provider/SpiritProvider.java
  16. 1 1
      gis_mapper/src/main/java/com/gis/mapper/provider/VideoProvider.java
  17. 2 0
      gis_service/src/main/java/com/gis/service/FileService.java
  18. 1 1
      gis_service/src/main/java/com/gis/service/GoodsService.java
  19. 5 0
      gis_service/src/main/java/com/gis/service/impl/FileServiceImpl.java
  20. 2 2
      gis_service/src/main/java/com/gis/service/impl/GoodsServiceImpl.java
  21. 9 2
      gis_web/src/main/java/com/gis/web/aop/WebLogAspect.java
  22. 91 4
      gis_web/src/main/java/com/gis/web/controller/FodderController.java
  23. 77 19
      gis_web/src/main/java/com/gis/web/controller/GoodsController.java
  24. 5 0
      gis_web/src/main/java/com/gis/web/controller/MenuController.java
  25. 10 4
      gis_web/src/main/java/com/gis/web/controller/NewsController.java
  26. 23 0
      gis_web/src/main/java/com/gis/web/controller/SceneController.java
  27. 19 5
      gis_web/src/main/java/com/gis/web/controller/SlideshowController.java
  28. 18 4
      gis_web/src/main/java/com/gis/web/controller/SpiritController.java
  29. 1 1
      gis_web/src/main/java/com/gis/web/controller/SysUserController.java
  30. 3 3
      gis_web/src/main/java/com/gis/web/controller/WebController.java
  31. 8 6
      gis_web/src/main/java/com/gis/web/shiro/MyRealm.java
  32. 8 0
      help.md

+ 5 - 1
gis_common/src/main/java/com/gis/common/constant/TypeCode.java

@@ -6,7 +6,7 @@ package com.gis.common.constant;
 public class TypeCode {
 
     /**redis token 前缀*/
-    public static final String REDIS_LOGIN_TOKEN = "ding_token_";
+    public static final String REDIS_LOGIN_TOKEN = "cms_army_token_";
 
     /**api token key*/
     public static final String TOKEN_API_KEY = "apiKey";
@@ -20,5 +20,9 @@ public class TypeCode {
     public static final String MODEL_GOODS_MODEL = "goodsModel";
 
     public static final String MODEL_GOODS_VIDEO = "goodsVideo";
+
+    public static final String MODEL_FODDER_IMG = "fodderImg";
+
+    public static final String MODEL_FODDER_VIDEO = "fodderVideo";
 }
 

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/dto/CommentRequest.java

@@ -12,8 +12,8 @@ import javax.validation.constraints.NotNull;
 @Data
 public class CommentRequest {
 
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
+//    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+//    private Long id;
 
     @NotBlank(message = "留言不能为空")
     @ApiModelProperty(value = "留言", required = true)

+ 6 - 3
gis_domain/src/main/java/com/gis/domain/dto/FodderDto.java

@@ -19,12 +19,12 @@ public class FodderDto {
     @ApiModelProperty(value = "名称")
     private String name;
 
-    @NotBlank(message = "类型不能为空")
+    @NotNull(message = "类型不能为空")
     @ApiModelProperty(value = "类型:1:图片, 2:视频" , required = true)
     private Integer type;
 
-    @ApiModelProperty(value = "文件url")
-    private String fileUrl;
+//    @ApiModelProperty(value = "文件url")
+//    private String fileUrl;
 
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
@@ -32,4 +32,7 @@ public class FodderDto {
     @ApiModelProperty(value = "描述")
     private String description;
 
+    @ApiModelProperty(value = "文件id")
+    private String fileId;
+
 }

+ 4 - 1
gis_domain/src/main/java/com/gis/domain/dto/GoodsDto.java

@@ -29,10 +29,13 @@ public class GoodsDto {
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
 
-    @ApiModelProperty(value = "文件id")
+    @ApiModelProperty(value = "文件ids")
     private String fileId;
 
     @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
     private Integer status;
 
+    @ApiModelProperty(value = "封面图文件id")
+    private Long thumbFileId;
+
 }

+ 8 - 0
gis_domain/src/main/java/com/gis/domain/dto/VideoDto.java

@@ -35,4 +35,12 @@ public class VideoDto {
 
     @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
     private Integer status;
+
+    @NotBlank(message = "文件id不能为空")
+    @ApiModelProperty(value = "文件id" , required = true)
+    private String fileId;
+
+    @NotBlank(message = "文件名称不能为空")
+    @ApiModelProperty(value = "文件名称" , required = true)
+    private String fileName;
 }

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/po/FodderEntity.java

@@ -21,8 +21,8 @@ public class FodderEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "类型:1:图片, 2:视频")
     private Integer type;
 
-    @ApiModelProperty(value = "文件url")
-    private String fileUrl;
+//    @ApiModelProperty(value = "文件url")
+//    private String fileUrl;
 
     @ApiModelProperty(value = "缩略图url")
     private String thumb;

+ 3 - 0
gis_domain/src/main/java/com/gis/domain/po/MenuEntity.java

@@ -21,6 +21,9 @@ public class MenuEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "父级id")
     private Long parentId;
 
+    @ApiModelProperty(value = "编辑者名称")
+    private String editName;
+
 
 
 

+ 3 - 0
gis_domain/src/main/java/com/gis/domain/po/SceneEntity.java

@@ -32,6 +32,9 @@ public class SceneEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "提交用户Id")
     private Long submitId;
 
+    @ApiModelProperty(value = "提交用户名称")
+    private String submitName;
+
     @ApiModelProperty(value = "审核者Id")
     private Long auditId;
 

+ 7 - 0
gis_domain/src/main/java/com/gis/domain/po/VideoEntity.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
 
 /**
  * Created by owen on 2020/6/10 0010 17:39
@@ -34,5 +35,11 @@ public class VideoEntity extends BaseEntity {
     @ApiModelProperty(value = "提交用户Id")
     private Long submitId;
 
+    @ApiModelProperty(value = "文件id")
+    private String fileId;
+
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
 
 }

+ 4 - 1
gis_domain/src/main/java/com/gis/domain/vo/VideoVo.java

@@ -21,7 +21,7 @@ public class VideoVo extends BaseEntity {
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
 
-    @ApiModelProperty(value = "缩略图url")
+    @ApiModelProperty(value = "视频url")
     private String video;
 
     @ApiModelProperty(value = "是否显示,1:是, 0:否")
@@ -33,5 +33,8 @@ public class VideoVo extends BaseEntity {
     @ApiModelProperty(value = "提交者名称")
     private String submitName;
 
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
 
 }

+ 3 - 0
gis_mapper/src/main/java/com/gis/mapper/FileMapper.java

@@ -27,4 +27,7 @@ public interface FileMapper extends IBaseMapper<FileEntity, Long> {
 
     @Update(value = "update tb_file set cover = 1 where id = #{id}")
     void setCover(Long id);
+
+    @Update(value = "update tb_file set cover = 0 where type = #{modelType} and fk_id = #{fkId} ")
+    void setCoverByFkId(Long fkId, String modelType);
 }

+ 1 - 1
gis_mapper/src/main/java/com/gis/mapper/GoodsMapper.java

@@ -18,5 +18,5 @@ import java.util.List;
 public interface GoodsMapper extends IBaseMapper<GoodsEntity, Long> {
 
     @SelectProvider(type = GoodsProvider.class, method = "search")
-    List<GoodsVo> search(GoodsPageDateDto param);
+    List<GoodsVo> search(GoodsPageDateDto param, Long userId);
 }

+ 11 - 23
gis_mapper/src/main/java/com/gis/mapper/provider/GoodsProvider.java

@@ -12,7 +12,7 @@ import org.apache.commons.lang3.StringUtils;
 public class GoodsProvider {
 
 
-    public String search(GoodsPageDateDto param){
+    public String search(GoodsPageDateDto param, Long userId){
         StringBuffer sql = new StringBuffer(
                 "select a.id, a.title, a.type, a.img, a.thumb, a.display, a.view_count, a.status, a.reason, a.create_time, a.update_time, a.view_count," +
                         "a.submit_id, b.real_name as submit_name from tb_goods a left join sys_user b on b.id = a.submit_id where a.rec_status = 'A' ");
@@ -32,27 +32,9 @@ public class GoodsProvider {
             sql.append(" and ( a.title like '%").append(searchKey).append("%' )");
         }
 
-
-//        /**
-//         * 待审核,0:草稿中、待审核、审核不通过
-//         * 审核通过,1:审核通过
-//         */
-//        Integer auditStatus = param.getAuditStatus();
-//
-//        if (auditStatus != null) {
-//
-//            if (auditStatus == 0) {
-//                sql.append(" and a.status <> ").append(4);
-//            } else {
-//                sql.append(" and a.status = ").append(4);
-//            }
-//        }
-//
-//
-//        Integer status = param.getStatus();
-//        if (status != null) {
-//            sql.append(" and a.status = ").append(status);
-//        }
+        if (userId != null) {
+            sql.append(" and a.submit_id = ").append(userId);
+        }
 
 
         /**
@@ -74,7 +56,13 @@ public class GoodsProvider {
         }
 
 
-        sql.append(" order by a.create_time desc");
+        if (status == 4) {
+            sql.append(" order by a.display desc, a.create_time desc");
+        } else {
+
+            sql.append(" order by a.create_time desc");
+        }
+
         log.info("sql: {}", sql.toString());
         return sql.toString();
     }

+ 6 - 1
gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java

@@ -54,7 +54,12 @@ public class NewsProvider {
         }
 
 
-        sql.append(" order by a.create_time desc");
+        if (status == 4) {
+            sql.append(" order by a.display desc, a.create_time desc");
+        } else {
+
+            sql.append(" order by a.create_time desc");
+        }
         log.info("sql: {}", sql.toString());
         return sql.toString();
     }

+ 6 - 1
gis_mapper/src/main/java/com/gis/mapper/provider/SpiritProvider.java

@@ -49,7 +49,12 @@ public class SpiritProvider {
 
         }
 
-        sql.append(" order by a.create_time desc");
+        if (status == 4) {
+            sql.append(" order by a.display desc, a.create_time desc");
+        } else {
+
+            sql.append(" order by a.create_time desc");
+        }
         log.info("sql: {}", sql.toString());
         return sql.toString();
     }

+ 1 - 1
gis_mapper/src/main/java/com/gis/mapper/provider/VideoProvider.java

@@ -13,7 +13,7 @@ public class VideoProvider {
 
     public String search(PageDto param){
         StringBuffer sql = new StringBuffer(
-                "select a.id, a.title, a.img, a.thumb, a.display, a.video, a.create_time, a.update_time, " +
+                "select a.id, a.title, a.img, a.thumb, a.display, a.video, a.create_time, a.update_time, a.file_name, a.file_id, " +
                         "a.submit_id, b.real_name as submit_name from tb_video a left join sys_user b on b.id = a.submit_id where a.rec_status = 'A' ");
 
 

+ 2 - 0
gis_service/src/main/java/com/gis/service/FileService.java

@@ -24,4 +24,6 @@ public interface FileService extends IBaseService<FileEntity, Long> {
      * @param fileId
      */
     void setCover(Long fileId);
+
+    void setCoverByFkId(Long fkId, String modelType);
 }

+ 1 - 1
gis_service/src/main/java/com/gis/service/GoodsService.java

@@ -13,7 +13,7 @@ import java.util.List;
  */
 public interface GoodsService extends IBaseService<GoodsEntity, Long> {
 
-    List<GoodsVo> search(GoodsPageDateDto param);
+    List<GoodsVo> search(GoodsPageDateDto param, Long userId);
 
 
 }

+ 5 - 0
gis_service/src/main/java/com/gis/service/impl/FileServiceImpl.java

@@ -49,4 +49,9 @@ public class FileServiceImpl extends IBaseServiceImpl<FileEntity, Long> implemen
     public void setCover(Long fileId) {
         entityMapper.setCover(fileId);
     }
+
+    @Override
+    public void setCoverByFkId(Long fkId, String modelType) {
+        entityMapper.setCoverByFkId(fkId, modelType);
+    }
 }

+ 2 - 2
gis_service/src/main/java/com/gis/service/impl/GoodsServiceImpl.java

@@ -28,7 +28,7 @@ public class GoodsServiceImpl extends IBaseServiceImpl<GoodsEntity, Long> implem
 
 
     @Override
-    public List<GoodsVo> search(GoodsPageDateDto param) {
-        return entityMapper.search(param);
+    public List<GoodsVo> search(GoodsPageDateDto param, Long userId) {
+        return entityMapper.search(param, userId);
     }
 }

+ 9 - 2
gis_web/src/main/java/com/gis/web/aop/WebLogAspect.java

@@ -51,13 +51,13 @@ public class WebLogAspect {
 //        log.info( request.getRequestURI());
         // 排查登录接口
         boolean contains = request.getRequestURI().contains("/admin/login");
-        if (contains) {
+        if (request.getRequestURI().contains("/admin/login") || request.getRequestURI().contains("/api/")) {
             return;
         }
 
 
         Long userId = null;
-        if (token != null) {
+        if (StringUtils.isNotBlank(token)) {
             userId = JwtUtil.getUserId(token);
         }
 
@@ -121,4 +121,11 @@ public class WebLogAspect {
         String[] split = str.split("-");
         return Arrays.asList(split);
     }
+
+
+    public static void main(String[] args) {
+        String url = "api/";
+        System.out.println("api/scene".contains(url));
+        System.out.println("api/".contains("api/scene"));
+    }
 }

+ 91 - 4
gis_web/src/main/java/com/gis/web/controller/FodderController.java

@@ -1,10 +1,12 @@
 package com.gis.web.controller;
 
+import cn.hutool.core.io.FileUtil;
+import com.gis.common.constant.TypeCode;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.FodderDto;
 import com.gis.domain.dto.FodderPageDto;
+import com.gis.domain.po.FileEntity;
 import com.gis.domain.po.FodderEntity;
-import com.gis.domain.po.NewsEntity;
 import com.gis.service.FodderService;
 import com.gis.web.aop.WebControllerLog;
 import com.github.pagehelper.PageInfo;
@@ -20,6 +22,8 @@ import tk.mybatis.mapper.entity.Condition;
 
 import javax.validation.Valid;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
 
 /**
  * Created by owen on 2020/5/8 0008 9:54
@@ -58,6 +62,19 @@ public class FodderController extends BaseController {
             entity = new FodderEntity();
             BeanUtils.copyProperties(param, entity);
             fodderService.save(entity);
+
+
+            String modelType = null;
+            if (entity.getType() == 1) {
+                modelType = TypeCode.MODEL_FODDER_IMG;
+            } else if (entity.getType() == 2) {
+                modelType = TypeCode.MODEL_FODDER_VIDEO;
+            }
+
+            // 图片信息跟goodsId绑定
+            fileService.setFkIdByIds(param.getFileId(), entity.getId(), modelType);
+
+
         } else {
             entity = fodderService.findById(param.getId());
             if (entity == null) {
@@ -79,8 +96,29 @@ public class FodderController extends BaseController {
      */
     @WebControllerLog(description = "场景素材-删除")
     @ApiOperation("删除")
-    @GetMapping("removes/{ids}")
-    public Result detail(@PathVariable String ids) {
+    @GetMapping("removes/{id}")
+    public Result removes(@PathVariable Long id) {
+
+        FodderEntity fodderEntity = fodderService.findById(id);
+        Integer type = fodderEntity.getType();
+
+        String modelType = null;
+        if (type == 1 ) {
+            modelType = TypeCode.MODEL_FODDER_IMG;
+        } else {
+            modelType = TypeCode.MODEL_FODDER_VIDEO;
+        }
+
+        Condition condition = new Condition(FileEntity.class);
+        condition.and().andEqualTo("fkId", id);
+        condition.and().andEqualTo("type", modelType);
+        List<FileEntity> fileEntityList = fileService.findAll(condition);
+        for (FileEntity file :fileEntityList) {
+            FileUtil.del(file.getFilePath());
+            fileService.delete(file);
+        }
+
+        fodderService.delete(fodderEntity);
 
 
         return Result.success();
@@ -88,6 +126,18 @@ public class FodderController extends BaseController {
 
 
 
+//    @ApiOperation("详情")
+//    @GetMapping("detail/{id}")
+//    public Result detail(@PathVariable Long id) {
+//        FodderEntity entity = fodderService.findById(id);
+//        if (entity == null) {
+//            log.error("对象id不存在 : {}", id);
+//            return Result.failure("对象id不存在");
+//        }
+//        return Result.success(entity);
+//    }
+
+
     @ApiOperation("详情")
     @GetMapping("detail/{id}")
     public Result detail(@PathVariable Long id) {
@@ -96,7 +146,44 @@ public class FodderController extends BaseController {
             log.error("对象id不存在 : {}", id);
             return Result.failure("对象id不存在");
         }
-        return Result.success(entity);
+
+
+//        List<FileEntity> fileList = fileService.findByFkId(TypeCode.FILE_GOODS + id);
+
+        String modelType = null;
+        if (entity.getType() == 1) {
+            modelType = TypeCode.MODEL_FODDER_IMG;
+        } else if (entity.getType() == 2) {
+            modelType = TypeCode.MODEL_FODDER_VIDEO;
+        }
+
+        Condition condition = new Condition(FileEntity.class);
+        condition.and().andEqualTo("fkId", id);
+        condition.and().andEqualTo("type", modelType);
+        List<FileEntity> fileList  = fileService.findAll(condition);
+
+        HashMap<Object, Object> result = new HashMap<>();
+        result.put("entity", entity);
+        result.put("file", fileList);
+
+        return Result.success(result);
+    }
+
+
+    /**
+     * 设置封面后,把封面url设置到(可以在这里设置,也可以在保存方法设置)
+     *
+     */
+    @ApiOperation("设置封面")
+    @GetMapping("setCover/{fileId}")
+    public Result setCover(@PathVariable Long fileId) {
+        // 对应模块封面设置默认
+        fileService.setCoverDefault(TypeCode.MODEL_FODDER_IMG);
+        // 设置封面
+        fileService.setCover(fileId);
+
+
+        return Result.success();
     }
 
 

+ 77 - 19
gis_web/src/main/java/com/gis/web/controller/GoodsController.java

@@ -7,7 +7,9 @@ import com.gis.domain.dto.GoodsDto;
 import com.gis.domain.dto.GoodsPageDateDto;
 import com.gis.domain.po.FileEntity;
 import com.gis.domain.po.GoodsEntity;
+import com.gis.domain.po.SysUserEntity;
 import com.gis.domain.vo.GoodsVo;
+import com.gis.domain.vo.SpiritVo;
 import com.gis.service.FileService;
 import com.gis.service.GoodsService;
 import com.gis.web.aop.WebControllerLog;
@@ -15,6 +17,7 @@ import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresRoles;
 import org.springframework.beans.BeanUtils;
@@ -52,9 +55,24 @@ public class GoodsController extends BaseController {
     @PostMapping("list")
     public Result<GoodsVo> list(@RequestBody GoodsPageDateDto param) {
 
+        SysUserEntity sysUser = getSysUser();
         startPage(param);
+        List<GoodsVo> search;
 
-        PageInfo<GoodsVo> page = new PageInfo<>(goodsService.search(param));
+
+        // 已审核
+        if (param.getStatus() == 4) {
+            search = goodsService.search(param, null);
+            // 待审核
+        } else {
+            if ("sys_normal".equals(sysUser.getRole())) {
+                search = goodsService.search(param, sysUser.getId());
+            } else {
+                search = goodsService.search(param, null);
+            }
+        }
+
+        PageInfo<GoodsVo> page = new PageInfo<>(search);
         return Result.success(page);
     }
 
@@ -63,27 +81,16 @@ public class GoodsController extends BaseController {
     @PostMapping("save")
     public Result save(@Valid @RequestBody GoodsDto param) {
 
+
+
         GoodsEntity entity = null;
         if (param.getId() == null) {
             entity = new GoodsEntity();
             BeanUtils.copyProperties(param, entity);
             // 默认值279
-            entity.setStatus(1);
+//            entity.setStatus(1);
+            entity.setSubmitId(getTokenUserId());
             goodsService.save(entity);
-
-
-            String modelType = null;
-            if (entity.getType() == 1) {
-                modelType = TypeCode.MODEL_GOODS_IMG;
-            } else if (entity.getType() == 2) {
-                modelType = TypeCode.MODEL_GOODS_VIDEO;
-            } else if (entity.getType() == 3) {
-                modelType = TypeCode.MODEL_GOODS_MODEL;
-            }
-
-            // 图片信息跟goodsId绑定
-            fileService.setFkIdByIds(param.getFileId(), entity.getId(), modelType);
-
         } else {
             entity = goodsService.findById(param.getId());
             if (entity == null) {
@@ -96,9 +103,49 @@ public class GoodsController extends BaseController {
 
         }
 
+        // 编辑封面
+        editCover(param, entity);
+
         return Result.success();
     }
 
+    // 设置封面
+    private void editCover(GoodsDto param, GoodsEntity entity){
+
+
+
+        String modelType = null;
+        if (entity.getType() == 1) {
+            modelType = TypeCode.MODEL_GOODS_IMG;
+        } else if (entity.getType() == 2) {
+            modelType = TypeCode.MODEL_GOODS_VIDEO;
+        } else if (entity.getType() == 3) {
+            modelType = TypeCode.MODEL_GOODS_MODEL;
+        }
+
+        // 图片信息跟goodsId绑定
+        String fileIds = param.getFileId();
+        String[] split = StringUtils.split(fileIds, ",");
+        for (String fileId: split) {
+            fileService.setFkIdByIds(fileId, entity.getId(), modelType);
+        }
+
+        // 修改封面为默认值
+        fileService.setCoverByFkId(entity.getId(), modelType);
+
+        // 设置封面
+        FileEntity fileEntity = fileService.findById(param.getThumbFileId());
+        fileEntity.setCover(1);
+        fileEntity.setUpdateTime(new Date());
+        fileService.update(fileEntity);
+
+        // 更新缩略图
+        entity.setThumb(fileEntity.getThumb());
+        entity.setUpdateTime(new Date());
+        goodsService.update(entity);
+
+    }
+
 
     /**
      * 素材文件,真删除
@@ -116,9 +163,8 @@ public class GoodsController extends BaseController {
 
 
     /**
-     * 设置封面后,把封面url设置到(可以在这里设置,也可以在保存方法设置)
-     *
-    */
+     * 有且只有一个封面
+     */
     @ApiOperation("设置封面")
     @GetMapping("setCover/{fileId}")
     public Result setCover(@PathVariable Long fileId) {
@@ -127,6 +173,18 @@ public class GoodsController extends BaseController {
         // 设置封面
         fileService.setCover(fileId);
 
+        // 更新封面图
+
+        FileEntity fileEntity = fileService.findById(fileId);
+        if (fileEntity == null) {
+            log.error("文件不存在");
+            return Result.failure("文件不存在");
+        }
+        GoodsEntity entity = goodsService.findById(Long.valueOf(fileEntity.getFkId()));
+        entity.setThumb(fileEntity.getThumb());
+        entity.setUpdateTime(new Date());
+
+        goodsService.update(entity);
 
         return Result.success();
     }

+ 5 - 0
gis_web/src/main/java/com/gis/web/controller/MenuController.java

@@ -4,6 +4,7 @@ import com.gis.common.util.Result;
 import com.gis.domain.po.MenuEntity;
 import com.gis.domain.dto.MenuRequest;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.po.SysUserEntity;
 import com.gis.service.MenuService;
 import com.gis.service.util.MenuTree;
 import com.gis.service.util.MenuTreeUtil;
@@ -48,10 +49,13 @@ public class MenuController extends BaseController {
     @PostMapping("save")
     public Result save(@Valid @RequestBody MenuRequest param) {
 
+        SysUserEntity userEntity = sysUserService.findByUserName(getTokenUserName());
+
         MenuEntity entity = null;
         if (param.getId() == null) {
             entity = new MenuEntity();
             BeanUtils.copyProperties(param, entity);
+            entity.setEditName(userEntity.getNickName());
             menuService.save(entity);
         } else {
             entity = menuService.findById(param.getId());
@@ -60,6 +64,7 @@ public class MenuController extends BaseController {
             }
 
             BeanUtils.copyProperties(param, entity);
+            entity.setEditName(userEntity.getNickName());
             entity.setUpdateTime(new Date());
             menuService.update(entity);
 

+ 10 - 4
gis_web/src/main/java/com/gis/web/controller/NewsController.java

@@ -45,11 +45,17 @@ public class NewsController extends BaseController {
         SysUserEntity sysUser = getSysUser();
         startPage(param);
         List<NewsVo> search;
-        if ("sys_normal".equals(sysUser.getRole())) {
-            // 查询个人
-            search = newsService.search(param, sysUser.getId());
-        } else {
+
+        // 已审核
+        if (param.getStatus() == 4) {
             search = newsService.search(param, null);
+        // 待审核
+        } else {
+            if ("sys_normal".equals(sysUser.getRole())) {
+                search = newsService.search(param, sysUser.getId());
+            } else {
+                search = newsService.search(param, null);
+            }
         }
 
         PageInfo<NewsVo> page = new PageInfo<>(search);

+ 23 - 0
gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -15,8 +15,10 @@ import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.SceneDataDto;
 import com.gis.domain.po.SceneEntity;
+import com.gis.domain.po.SysUserEntity;
 import com.gis.mapper.SceneMapper;
 import com.gis.service.SceneService;
+import com.gis.service.SysUserService;
 import com.gis.web.aop.WebControllerLog;
 import com.github.pagehelper.PageInfo;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
@@ -55,6 +57,9 @@ public class SceneController extends BaseController {
     @Autowired
     private SceneMapper sceneMapper;
 
+    @Autowired
+    private SysUserService sysUserService;
+
 
 
     @ApiOperation("场景列表")
@@ -345,6 +350,15 @@ public class SceneController extends BaseController {
     @PostMapping("uploads")
     public Result uploads(@RequestParam Map<String, MultipartFile> param, String sceneTitle, String sceneCode, HttpServletRequest request) throws Exception {
 
+        if (StringUtils.isBlank(sceneCode)){
+            log.error("场景码不能为空");
+            return Result.failure("场景码不能为空");
+        }
+
+        if (StringUtils.isBlank(sceneTitle)){
+            log.error("场景标题不能为空");
+            return Result.failure("场景标题不能为空");
+        }
 
         SceneEntity entity = sceneService.findBySceneCode(sceneCode);
         if (entity != null) {
@@ -353,6 +367,9 @@ public class SceneController extends BaseController {
         }
 
 
+
+
+
         param.forEach((path, file)->{
 
             if (StringUtils.isBlank(path)) {
@@ -387,6 +404,12 @@ public class SceneController extends BaseController {
         entity.setSceneCode(sceneCode);
         entity.setPath(FILE_PATH + sceneCode);
         entity.setSceneTitle(sceneTitle);
+
+        Long userId = getTokenUserId();
+        SysUserEntity userEntity = sysUserService.findById(userId);
+
+        entity.setSubmitId(userId);
+        entity.setSubmitName(userEntity.getRealName());
         entity.setUpdateTime(new Date());
 
 

+ 19 - 5
gis_web/src/main/java/com/gis/web/controller/SlideshowController.java

@@ -28,7 +28,7 @@ import java.util.List;
 /**
  * Created by owen on 2020/5/8 0008 9:54
  */
-@RequiresRoles(value = {"sys_admin", "sys_high", "sys_normal"}, logical = Logical.OR)
+//@RequiresRoles(value = {"sys_admin", "sys_high", "sys_normal"}, logical = Logical.OR)
 @Log4j2
 @Api(tags = "轮播图管理")
 @RestController
@@ -48,12 +48,26 @@ public class SlideshowController extends BaseController {
         SysUserEntity sysUser = getSysUser();
         startPage(param);
         List<SlideshowVo> search;
-        if ("sys_normal".equals(sysUser.getRole())) {
-            // 查询个人
-            search = slideshowService.search(param, sysUser.getId());
-        } else {
+
+        // 已审核
+        if (param.getStatus() == 4) {
             search = slideshowService.search(param, null);
+            // 待审核
+        } else {
+            if ("sys_normal".equals(sysUser.getRole())) {
+                search = slideshowService.search(param, sysUser.getId());
+            } else {
+                search = slideshowService.search(param, null);
+            }
         }
+
+
+//        if ("sys_normal".equals(sysUser.getRole())) {
+//            // 查询个人
+//            search = slideshowService.search(param, sysUser.getId());
+//        } else {
+//            search = slideshowService.search(param, null);
+//        }
         PageInfo<SlideshowVo> page = new PageInfo<>(search);
         return Result.success(page);
     }

+ 18 - 4
gis_web/src/main/java/com/gis/web/controller/SpiritController.java

@@ -47,12 +47,26 @@ public class SpiritController extends BaseController {
         SysUserEntity sysUser = getSysUser();
         startPage(param);
         List<SpiritVo> search;
-        if ("sys_normal".equals(sysUser.getRole())) {
-            // 查询个人
-            search = spiritService.search(param, sysUser.getId());
-        } else {
+
+        // 已审核
+        if (param.getStatus() == 4) {
             search = spiritService.search(param, null);
+            // 待审核
+        } else {
+            if ("sys_normal".equals(sysUser.getRole())) {
+                search = spiritService.search(param, sysUser.getId());
+            } else {
+                search = spiritService.search(param, null);
+            }
         }
+
+
+//        if ("sys_normal".equals(sysUser.getRole())) {
+//            // 查询个人
+//            search = spiritService.search(param, sysUser.getId());
+//        } else {
+//            search = spiritService.search(param, null);
+//        }
         PageInfo<SpiritVo> page = new PageInfo<>(search);
         return Result.success(page);
     }

+ 1 - 1
gis_web/src/main/java/com/gis/web/controller/SysUserController.java

@@ -63,7 +63,7 @@ public class SysUserController extends BaseController {
         if (param.getId() == null) {
             entity = userService.findByUserName(param.getUserName());
             if (entity != null) {
-                return Result.failure("用户名已存在");
+                return Result.failure("身份证号已存在");
             }
             entity = new SysUserEntity();
             BeanUtils.copyProperties(param, entity);

+ 3 - 3
gis_web/src/main/java/com/gis/web/controller/WebController.java

@@ -180,8 +180,8 @@ public class WebController extends BaseController {
 
         List<WebGoodsVo> result = new ArrayList<>();
 
-        List<GoodsVo> searchs = goodsService.search(param);
-        for (GoodsVo entity : searchs) {
+        List<GoodsVo> search = goodsService.search(param, null);
+        for (GoodsVo entity : search) {
             String modelType = null;
             if (entity.getType() == 1) {
                 modelType = TypeCode.MODEL_GOODS_IMG;
@@ -303,7 +303,7 @@ public class WebController extends BaseController {
 
         entity.setPassword(PasswordUtils.encrypt(param.getUserName(), "123456", PasswordUtils.getStaticSalt()));
         entity.setUpdateTime(new Date());
-        sysUserService.save(entity);
+        sysUserService.update(entity);
 
         // 保存操作日志
         saveLog(new LogEntity(entity.getId(),"用户管理","找回密码"));

+ 8 - 6
gis_web/src/main/java/com/gis/web/shiro/MyRealm.java

@@ -1,5 +1,6 @@
 package com.gis.web.shiro;
 
+import com.gis.common.constant.TypeCode;
 import com.gis.common.exception.JwtAuthenticationException;
 import com.gis.domain.po.SysRoleEntity;
 import com.gis.domain.po.SysUserEntity;
@@ -103,12 +104,13 @@ public class MyRealm extends AuthorizingRealm {
         }
 
         // 校验请求token是否跟redis token一致
-//        String redisToken = redisTemplate.opsForValue().get(TypeCode.REDIS_TOKEN + token);
-//        if (!token.equals(redisToken)) {
-//            log.error("redis token is null");
-//            throw new JwtAuthenticationException(5001, "redis token is null");
-//
-//        }
+        String redisToken = redisTemplate.opsForValue().get(TypeCode.REDIS_LOGIN_TOKEN + token);
+
+        if (!token.equals(redisToken)) {
+            log.error("redis token is null");
+            throw new JwtAuthenticationException(5001, "redis token is null");
+
+        }
 
 
         if (! JwtUtil.isVerify(token, username)) {

+ 8 - 0
help.md

@@ -48,4 +48,12 @@
      
 2020-7-16
     展示页:
+    
+    
+redis 模糊查询key
+后来测试发现模糊查询是可以用的, 找了下资料, 改成
+
+Set<String> keys = redisTemplate.keys("noteUserListenedPoi:" + "*");
+redisTemplate.delete(keys);
+