Przeglądaj źródła

添加用户角色

wuweihao 5 lat temu
rodzic
commit
ae481ea8b3
32 zmienionych plików z 277 dodań i 168 usunięć
  1. 3 0
      gis_domain/src/main/java/com/gis/domain/dto/GoodsDto.java
  2. 3 3
      gis_domain/src/main/java/com/gis/domain/dto/GoodsPageDateDto.java
  3. 4 1
      gis_domain/src/main/java/com/gis/domain/dto/NewsPageDateRequest.java
  4. 3 0
      gis_domain/src/main/java/com/gis/domain/dto/NewsRequest.java
  5. 5 0
      gis_domain/src/main/java/com/gis/domain/dto/SlideshowDto.java
  6. 7 2
      gis_domain/src/main/java/com/gis/domain/dto/SlideshowPageDateDto.java
  7. 9 2
      gis_domain/src/main/java/com/gis/domain/dto/SpiritPageDateDto.java
  8. 4 0
      gis_domain/src/main/java/com/gis/domain/dto/SpiritRequest.java
  9. 61 0
      gis_domain/src/main/java/com/gis/domain/dto/UserDto.java
  10. 0 37
      gis_domain/src/main/java/com/gis/domain/dto/UserRequest.java
  11. 2 0
      gis_domain/src/main/java/com/gis/domain/dto/VideoDto.java
  12. 3 0
      gis_domain/src/main/java/com/gis/domain/po/SysUserEntity.java
  13. 2 4
      gis_domain/src/main/java/com/gis/domain/vo/GoodsVo.java
  14. 5 4
      gis_domain/src/main/java/com/gis/domain/vo/NewsVo.java
  15. 2 3
      gis_domain/src/main/java/com/gis/domain/vo/SlideshowVo.java
  16. 2 3
      gis_domain/src/main/java/com/gis/domain/vo/SpiritVo.java
  17. 3 3
      gis_domain/src/main/java/com/gis/domain/vo/VideoVo.java
  18. 29 15
      gis_mapper/src/main/java/com/gis/mapper/provider/GoodsProvider.java
  19. 26 8
      gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java
  20. 8 10
      gis_mapper/src/main/java/com/gis/mapper/provider/SlideshowProvider.java
  21. 8 7
      gis_mapper/src/main/java/com/gis/mapper/provider/SpiritProvider.java
  22. 16 16
      gis_web/src/main/java/com/gis/web/aop/WebLogAspect.java
  23. 5 2
      gis_web/src/main/java/com/gis/web/controller/ApiController.java
  24. 13 0
      gis_web/src/main/java/com/gis/web/controller/BaseController.java
  25. 30 19
      gis_web/src/main/java/com/gis/web/controller/CommentController.java
  26. 5 9
      gis_web/src/main/java/com/gis/web/controller/FileController.java
  27. 2 1
      gis_web/src/main/java/com/gis/web/controller/GoodsController.java
  28. 5 10
      gis_web/src/main/java/com/gis/web/controller/IndexController.java
  29. 2 2
      gis_web/src/main/java/com/gis/web/controller/NewsController.java
  30. 2 3
      gis_web/src/main/java/com/gis/web/controller/SysUserController.java
  31. 4 1
      gis_web/src/main/java/com/gis/web/controller/WebController.java
  32. 4 3
      gis_web/src/main/java/com/gis/web/shiro/MyRealm.java

+ 3 - 0
gis_domain/src/main/java/com/gis/domain/dto/GoodsDto.java

@@ -32,4 +32,7 @@ public class GoodsDto {
     @ApiModelProperty(value = "文件id")
     private String fileIds;
 
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
 }

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

@@ -12,11 +12,11 @@ import javax.validation.constraints.NotNull;
 @Data
 public class GoodsPageDateDto extends PageDateDto {
 
-    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过, 5:待审核(列表专用)", required = true)
     private Integer status;
 
-    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
-    private Integer auditStatus;
+//    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
+//    private Integer auditStatus;
 
     @NotNull(message = "类型不能为空")
     @ApiModelProperty(value = "类型:1:图片, 2:视频,3:模型" , required = true)

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

@@ -12,8 +12,11 @@ public class NewsPageDateRequest extends PageDateDto {
     @ApiModelProperty(value = "类型,news:新闻, notice:公告" )
     private String type;
 
-    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过", required = true)
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过, 5:待审核(列表专用)", required = true)
     private Integer status;
 
+//    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
+//    private Integer auditStatus;
+
 
 }

+ 3 - 0
gis_domain/src/main/java/com/gis/domain/dto/NewsRequest.java

@@ -40,4 +40,7 @@ public class NewsRequest {
     @ApiModelProperty(value = "信息正文")
     private String content;
 
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
 }

+ 5 - 0
gis_domain/src/main/java/com/gis/domain/dto/SlideshowDto.java

@@ -8,6 +8,8 @@ import javax.validation.constraints.NotNull;
 
 /**
  * Created by owen on 2020/5/9 0009 12:20
+ *
+ * 轮播图
  */
 @Data
 public class SlideshowDto {
@@ -28,4 +30,7 @@ public class SlideshowDto {
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
 
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
 }

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

@@ -5,12 +5,17 @@ import lombok.Data;
 
 /**
  * Created by owen on 2020/5/9 0009 12:20
+ *
+ * 轮播图
  */
 @Data
 public class SlideshowPageDateDto extends PageDateDto {
 
-    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
-    private Integer auditStatus;
+//    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
+//    private Integer auditStatus;
+
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过, 5:待审核(列表专用)", required = true)
+    private Integer status;
 
 
 }

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

@@ -5,12 +5,19 @@ import lombok.Data;
 
 /**
  * Created by owen on 2020/5/9 0009 12:20
+ *
+ * 特有精神
  */
 @Data
 public class SpiritPageDateDto extends PageDateDto {
 
-    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过", required = true)
-    private Integer status;
+//    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过", required = true)
+//    private Integer status;
+//
+//    @ApiModelProperty(value = "状态,1:审核通过,0:待审核")
+//    private Integer auditStatus;
+@ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过, 5:待审核(列表专用)", required = true)
+private Integer status;
 
 
 }

+ 4 - 0
gis_domain/src/main/java/com/gis/domain/dto/SpiritRequest.java

@@ -35,4 +35,8 @@ public class SpiritRequest {
     @ApiModelProperty(value = "信息正文")
     private String content;
 
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
+
 }

+ 61 - 0
gis_domain/src/main/java/com/gis/domain/dto/UserDto.java

@@ -0,0 +1,61 @@
+package com.gis.domain.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/28 0028 16:36
+ */
+@Data
+public class UserDto {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+
+    @NotBlank(message = "真实姓名不能为空")
+    @ApiModelProperty(value = "真实姓名")
+    private String realName;
+
+
+
+
+    @NotBlank(message = "身份证号(军号)不能为空")
+    @ApiModelProperty(value = "身份证号(军号)", required = true)
+    private String userName;
+
+    @NotBlank(message = "昵称不能为空")
+    @ApiModelProperty(value = "昵称")
+    private String nickName;
+
+    @NotNull(message = "性别不能为空")
+    @ApiModelProperty(value = "性别 0:男  1:女")
+    private Integer sex;
+
+    @ApiModelProperty(value = "电话")
+    private String phone;
+
+    @NotBlank(message = "单位不能为空")
+    @ApiModelProperty(value = "单位")
+    private String unit;
+
+    @NotNull(message = "启用状态不能为空")
+    @ApiModelProperty(value = "状态 1:启用  0:停用 ")
+    private Integer status;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+
+    @NotNull(message = "角色不能为空")
+    @ApiModelProperty(value = "角色,sys_admin:系统管理员,sys_high:高级管理员, sys_normal:普通管理员, sys_visitor:游客" ,required = true)
+    private String role;
+
+}

+ 0 - 37
gis_domain/src/main/java/com/gis/domain/dto/UserRequest.java

@@ -1,37 +0,0 @@
-package com.gis.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * Created by owen on 2020/5/28 0028 16:36
- */
-@Data
-public class UserRequest {
-
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
-
-    @NotBlank(message = "用户名不能为空")
-    @ApiModelProperty(value = "用户名", required = true)
-    private String userName;
-
-    @NotBlank(message = "真实姓名不能为空")
-    @ApiModelProperty(value = "真实姓名")
-    private String realName;
-
-    @NotNull(message = "部门id不能为空")
-    @ApiModelProperty(value = "部门id", required = true)
-    private Long deptId;
-
-    @NotNull(message = "角色id不能为空")
-    @ApiModelProperty(value = "角色id", required = true)
-    private Long roleId;
-
-//    @NotNull(message = "角色id不能为空")
-//    @ApiModelProperty(value = "管理者,0:是, 1:否")
-//    private Integer manager;
-}

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

@@ -33,4 +33,6 @@ public class VideoDto {
     @ApiModelProperty(value = "描述")
     private String description;
 
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
 }

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

@@ -54,6 +54,9 @@ public class SysUserEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
 
+    @ApiModelProperty(value = "角色,sys_admin:系统管理员,sys_high:高级管理员, sys_normal:普通管理员, sys_visitor:游客")
+    private String role;
+
 
 
 }

+ 2 - 4
gis_domain/src/main/java/com/gis/domain/vo/GoodsVo.java

@@ -1,5 +1,6 @@
 package com.gis.domain.vo;
 
+import com.gis.domain.po.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -7,10 +8,7 @@ import lombok.Data;
  * Created by owen on 2020/5/9 0009 12:20
  */
 @Data
-public class GoodsVo {
-
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
+public class GoodsVo extends BaseEntity {
 
     @ApiModelProperty(value = "标题" )
     private String title;

+ 5 - 4
gis_domain/src/main/java/com/gis/domain/vo/NewsVo.java

@@ -1,5 +1,6 @@
 package com.gis.domain.vo;
 
+import com.gis.domain.po.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -7,10 +8,7 @@ import lombok.Data;
  * Created by owen on 2020/5/9 0009 12:20
  */
 @Data
-public class NewsVo {
-
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
+public class NewsVo  extends BaseEntity {
 
     @ApiModelProperty(value = "类型,news:新闻, notice:公告")
     private String type;
@@ -45,4 +43,7 @@ public class NewsVo {
     @ApiModelProperty(value = "原因")
     private String reason;
 
+    @ApiModelProperty(value = "阅读量")
+    private Integer viewCount;
+
 }

+ 2 - 3
gis_domain/src/main/java/com/gis/domain/vo/SlideshowVo.java

@@ -1,5 +1,6 @@
 package com.gis.domain.vo;
 
+import com.gis.domain.po.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -7,10 +8,8 @@ import lombok.Data;
  * Created by owen on 2020/5/9 0009 12:20
  */
 @Data
-public class SlideshowVo {
+public class SlideshowVo  extends BaseEntity {
 
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
 
     @ApiModelProperty(value = "标题" )
     private String title;

+ 2 - 3
gis_domain/src/main/java/com/gis/domain/vo/SpiritVo.java

@@ -1,5 +1,6 @@
 package com.gis.domain.vo;
 
+import com.gis.domain.po.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -7,10 +8,8 @@ import lombok.Data;
  * Created by owen on 2020/5/9 0009 12:20
  */
 @Data
-public class SpiritVo {
+public class SpiritVo  extends BaseEntity {
 
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
 
     @ApiModelProperty(value = "标题" )
     private String title;

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

@@ -1,5 +1,6 @@
 package com.gis.domain.vo;
 
+import com.gis.domain.po.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -7,10 +8,9 @@ import lombok.Data;
  * Created by owen on 2020/5/9 0009 12:20
  */
 @Data
-public class VideoVo {
+public class VideoVo extends BaseEntity {
+
 
-    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
-    private Long id;
 
     @ApiModelProperty(value = "标题" )
     private String title;

+ 29 - 15
gis_mapper/src/main/java/com/gis/mapper/provider/GoodsProvider.java

@@ -33,25 +33,39 @@ public class GoodsProvider {
         }
 
 
-        /**
-         * 待审核,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);
-            }
-        }
+//        /**
+//         * 待审核,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);
+//        }
 
 
+        /**
+         * 列表专用
+         * 待审核,5:草稿中、待审核、审核不通过
+         *
+         */
         Integer status = param.getStatus();
-        if (status != null) {
+        if (status == 5) {
+            sql.append(" and a.status <> ").append(4);
+        } else {
             sql.append(" and a.status = ").append(status);
+
         }
 
         Integer type = param.getType();

+ 26 - 8
gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java

@@ -14,7 +14,7 @@ public class NewsProvider {
 
     public String search(NewsPageDateRequest param){
         StringBuffer sql = new StringBuffer(
-                "select a.id, a.type, a.title, a.description, a.img, a.thumb, a.display, a.view_count, a.status, a.reason," +
+                "select a.id, a.type, a.title, a.description, a.img, a.thumb, a.display, a.view_count, a.status, a.reason, a.create_time, a.update_time," +
                         "a.submit_id, b.real_name as submit_name from tb_news a left join sys_user b on b.id = a.submit_id where a.rec_status = 'A' ");
 
         if(StringUtils.isNotBlank(param.getStartTime()) ){
@@ -33,22 +33,40 @@ public class NewsProvider {
         }
 
         String type = param.getType();
-        if (type != null) {
+        if (StringUtils.isNotBlank(type)) {
             sql.append(" and a.type = '").append(type).append("'");
         }
 
         /**
-         * 待审核:草稿中、待审核、审核不通过
-         * 审核通过:审核通过
+         * 待审核,0:草稿中、待审核、审核不通过
+         * 审核通过,1:审核通过
          */
-        Integer status = param.getStatus();
+//        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);
+//            }
+//        }
 
-        if (status == 4) {
-            sql.append(" and a.status = ").append(status);
-        } else {
+
+        /**
+         * 列表专用
+         * 待审核,5:草稿中、待审核、审核不通过
+         *
+         */
+        Integer status = param.getStatus();
+        if (status == 5) {
             sql.append(" and a.status <> ").append(4);
+        } else {
+            sql.append(" and a.status = ").append(status);
+
         }
 
+
         sql.append(" order by a.create_time desc");
         log.info("sql: {}", sql.toString());
         return sql.toString();

+ 8 - 10
gis_mapper/src/main/java/com/gis/mapper/provider/SlideshowProvider.java

@@ -33,18 +33,16 @@ public class SlideshowProvider {
 
 
         /**
-         * 待审核,0:草稿中、待审核、审核不通过
-         * 审核通过,1:审核通过
+         * 列表专用
+         * 待审核,5:草稿中、待审核、审核不通过
+         *
          */
-        Integer auditStatus = param.getAuditStatus();
+        Integer status = param.getStatus();
+        if (status == 5) {
+            sql.append(" and a.status <> ").append(4);
+        } else {
+            sql.append(" and a.status = ").append(status);
 
-        if (auditStatus != null) {
-
-            if (auditStatus == 0) {
-                sql.append(" and a.status <> ").append(4);
-            } else {
-                sql.append(" and a.status = ").append(4);
-            }
         }
 
 

+ 8 - 7
gis_mapper/src/main/java/com/gis/mapper/provider/SpiritProvider.java

@@ -13,7 +13,7 @@ public class SpiritProvider {
 
     public String search(SpiritPageDateDto param){
         StringBuffer sql = new StringBuffer(
-                "select a.id, a.title, a.unit, a.img, a.thumb, a.display, a.view_count, a.status, a.reason," +
+                "select a.id, a.title, a.unit, a.img, a.thumb, a.display, a.view_count, a.status, a.reason, a.create_time, a.update_time," +
                         "a.submit_id, b.real_name as submit_name from tb_spirit a left join sys_user b on b.id = a.submit_id where a.rec_status = 'A' ");
 
         if(StringUtils.isNotBlank(param.getStartTime()) ){
@@ -33,15 +33,16 @@ public class SpiritProvider {
 
 
         /**
-         * 待审核:草稿中、待审核、审核不通过
-         * 审核通过:审核通过
+         * 列表专用
+         * 待审核,5:草稿中、待审核、审核不通过
+         *
          */
         Integer status = param.getStatus();
-
-        if (status == 4) {
-            sql.append(" and a.status = ").append(status);
-        } else {
+        if (status == 5) {
             sql.append(" and a.status <> ").append(4);
+        } else {
+            sql.append(" and a.status = ").append(status);
+
         }
 
         sql.append(" order by a.create_time desc");

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

@@ -1,7 +1,10 @@
 package com.gis.web.aop;
 
+import com.gis.domain.po.LogEntity;
+import com.gis.service.LogService;
 import com.gis.web.shiro.JwtUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.annotation.AfterReturning;
 import org.aspectj.lang.annotation.Aspect;
@@ -28,8 +31,8 @@ public class WebLogAspect {
     @Autowired
     private HttpServletRequest request;
 
-//    @Autowired
-//    private LogService logService;
+    @Autowired
+    private LogService logService;
 
     @Pointcut("execution(* com.gis.web.controller.*.*(..))")//切入点描述 这个是controller包的切入点
     public void controllerLog(){}//签名,可以理解成这个切入点的一个名称
@@ -39,10 +42,10 @@ public class WebLogAspect {
 
         // 获取token
         String token = request.getHeader("token");
-//        Long userId = null;
-//        if (token != null) {
-//            userId = JwtUtil.getUserId(token);
-//        }
+        Long userId = null;
+        if (token != null) {
+            userId = JwtUtil.getUserId(token);
+        }
 
         // 记录下请求内容
         log.warn("start : {}" , request.getRequestURI());
@@ -50,19 +53,16 @@ public class WebLogAspect {
         log.info("request IP : {}" , request.getRemoteAddr());
         log.info("request Args : {}" , Arrays.toString(joinPoint.getArgs()));
 
-//        Object[] args = joinPoint.getArgs();
-//        if (args.length > 0) {
-//            log.info("request Args : {}" , Arrays.toString(args));
-//        }
+
 
         String description = getControllerLogDescription(joinPoint);
 
-//        if (!StringUtils.isAllBlank(description)) {
-//            log.info("request description : {}", description);
-//            // 保存数据库
-//            List<String> detail = getDetail(description);
-//            logService.save(new LogEntity(userId, detail.get(0), detail.get(1)));
-//        }
+        if (StringUtils.isNotBlank(description)) {
+            log.info("request description : {}", description);
+            // 保存数据库
+            List<String> detail = getDetail(description);
+            logService.save(new LogEntity(userId, detail.get(0), detail.get(1)));
+        }
 
         //下面这个getSignature().getDeclaringTypeName()是获取包+类名的   然后后面的joinPoint.getSignature.getName()获取了方法名
         log.info("request Class_Method : {}" , joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());

+ 5 - 2
gis_web/src/main/java/com/gis/web/controller/ApiController.java

@@ -127,7 +127,8 @@ public class ApiController extends BaseController {
             filePath += fileName;
             log.info("filePath: {}", filePath);
             try {
-                FileUtils.upload(file, filePath);
+//                FileUtils.upload(file, filePath);
+                FileUtil.writeFromStream(file.getInputStream(), filePath);
             } catch (IOException e) {
                 e.printStackTrace();
             }
@@ -179,12 +180,14 @@ public class ApiController extends BaseController {
 
             if (file == null) {
                 log.error("文件不能为空");
+                throw new BaseRuntimeException("文件为空");
             }
 
             path = FILE_PATH + path;
             log.info("savePath: {}", path);
             try {
-                FileUtils.upload(file, path);
+//                FileUtils.upload(file, path);
+                FileUtil.writeFromStream(file.getInputStream(), path);
             } catch (IOException e) {
                 e.printStackTrace();
             }

+ 13 - 0
gis_web/src/main/java/com/gis/web/controller/BaseController.java

@@ -1,7 +1,9 @@
 package com.gis.web.controller;
 
+import com.gis.domain.po.LogEntity;
 import com.gis.domain.po.SysUserEntity;
 import com.gis.service.FileService;
+import com.gis.service.LogService;
 import com.gis.service.SysUserService;
 import com.gis.web.shiro.JwtUtil;
 import com.github.pagehelper.PageHelper;
@@ -27,6 +29,9 @@ public class BaseController {
     @Autowired
     public FileService fileService;
 
+    @Autowired
+    private LogService logService;
+
     /**
      * 服务器保存文件路径前缀
      */
@@ -73,6 +78,14 @@ public class BaseController {
         return request.getHeader("token");
     }
 
+    /**
+     * 保存操作日志
+     */
+    void saveLog(LogEntity param){
+        // 保存数据库
+        logService.save(param);
+    }
+
 
     /**
      * 设置请求分页数据

+ 30 - 19
gis_web/src/main/java/com/gis/web/controller/CommentController.java

@@ -7,9 +7,12 @@ import com.gis.domain.dto.PageDto;
 import com.gis.service.CommentService;
 import com.gis.service.util.CommentTree;
 import com.gis.service.util.CommentTreeUtil;
+import com.gis.web.aop.WebControllerLog;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresRoles;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -44,34 +47,42 @@ public class CommentController extends BaseController {
         return Result.success(page);
     }
 
-    @ApiOperation("新增/修改部信息")
+    @ApiOperation("新增/修改")
     @PostMapping("save")
     public Result save(@Valid @RequestBody CommentRequest param) {
 
 
-        CommentEntity entity = null;
-        if (param.getId() == null) {
-            entity = new CommentEntity();
-            BeanUtils.copyProperties(param, entity);
-            entity.setUserId(getTokenUserId());
-            entity.setRealName(getSysUser().getRealName());
-            commentService.save(entity);
-        } else {
-            entity = commentService.findById(param.getId());
-            if (entity == null) {
-                return Result.failure("对象id不存在");
-            }
-
-            BeanUtils.copyProperties(param, entity);
-            entity.setUpdateTime(new Date());
-            commentService.update(entity);
-
-        }
+//        CommentEntity entity = null;
+//        if (param.getId() == null) {
+//            entity = new CommentEntity();
+//            BeanUtils.copyProperties(param, entity);
+//            entity.setUserId(getTokenUserId());
+//            entity.setRealName(getSysUser().getRealName());
+//            commentService.save(entity);
+//        } else {
+//            entity = commentService.findById(param.getId());
+//            if (entity == null) {
+//                return Result.failure("对象id不存在");
+//            }
+//
+//            BeanUtils.copyProperties(param, entity);
+//            entity.setUpdateTime(new Date());
+//            commentService.update(entity);
+//
+//        }
+
+        CommentEntity entity = new CommentEntity();
+        BeanUtils.copyProperties(param, entity);
+        entity.setUserId(getTokenUserId());
+        entity.setRealName(getSysUser().getRealName());
+        commentService.save(entity);
 
         return Result.success();
     }
 
 
+    @WebControllerLog(description = "留言管理-删除留言")
+    @RequiresRoles(value = {"sys_admin", "sys_high", "sys_normal"}, logical = Logical.OR)
     @ApiOperation("删除")
     @GetMapping("removes/{ids}")
     public Result detail(@PathVariable String ids) {

+ 5 - 9
gis_web/src/main/java/com/gis/web/controller/FileController.java

@@ -42,9 +42,9 @@ public class FileController extends BaseController {
      * @return
      * @throws IOException
      */
-    @ApiOperation(value = "上传", notes = "需要生成缩略图:thumb: true, 不需要:thumb: false")
+    @ApiOperation(value = "上传", notes = "图片自动生成缩略图")
     @PostMapping(value = "upload", consumes = {"multipart/form-data"})
-    public Result upload(MultipartFile file, boolean thumb ) throws IOException {
+    public Result upload(MultipartFile file) throws IOException {
 
         if (file == null) {
             log.error("文件不能为空");
@@ -68,13 +68,10 @@ public class FileController extends BaseController {
         entity.setUrlPath(urlPath);
         log.info("文件生成完成: {}", urlPath);
 
-        // 生成缩略图
-        if (thumb) {
 
-            if (!ifImage(newName)) {
-                log.error("不是图片格式,不能生成缩略图: {}", newName);
-                return Result.failure("不是图片格式,不能生成缩略图");
-            }
+
+        // 图片生成缩略图
+        if (ifImage(newName)) {
 
             String thumbPath = basePath + "thumb_" + newName;
             createThumb(filePath, thumbPath);
@@ -175,7 +172,6 @@ public class FileController extends BaseController {
     }
 
 
-//    @Test
     private boolean ifImage(String fileName){
         String s = StringUtils.substringAfterLast(fileName, ".");
         List<String> strings = Arrays.asList("jpg", "png","jpeg");

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

@@ -36,7 +36,7 @@ public class GoodsController extends BaseController {
 
 
 
-    @ApiOperation(value = "列表", notes = "auditStatus和status不能同时提交")
+    @ApiOperation(value = "列表")
     @PostMapping("list")
     public Result<GoodsVo> list(@RequestBody GoodsPageDateDto param) {
 
@@ -46,6 +46,7 @@ public class GoodsController extends BaseController {
         return Result.success(page);
     }
 
+
     @ApiOperation("新增/修改部信息")
     @PostMapping("save")
     public Result save(@Valid @RequestBody GoodsDto param) {

+ 5 - 10
gis_web/src/main/java/com/gis/web/controller/IndexController.java

@@ -3,6 +3,7 @@ package com.gis.web.controller;
 import com.gis.common.constant.TypeCode;
 import com.gis.common.util.PasswordUtils;
 import com.gis.common.util.Result;
+import com.gis.domain.po.LogEntity;
 import com.gis.domain.po.SysUserEntity;
 import com.gis.domain.dto.LoginRequest;
 import com.gis.service.SysUserService;
@@ -32,13 +33,6 @@ import java.util.concurrent.TimeUnit;
 public class IndexController extends BaseController{
 
 
-    // 目前是24h
-//    private static Integer TOKEN_EXPIRE = 1000 * 60 * 60 * 24;
-
-    // -1 不限时间
-//    private static Integer TOKEN_EXPIRE = -1 ;
-
-
     @Autowired
     private SysUserService userService;
 
@@ -63,7 +57,7 @@ public class IndexController extends BaseController{
         }
 
         // 检查账号是否启用
-        if (entity.getStatus() != 0) {
+        if (entity.getStatus() != 1) {
             log.error("账号已停用: {}", entity.getUserName());
             return Result.failure("账号已停用");
         }
@@ -82,13 +76,14 @@ public class IndexController extends BaseController{
         result.put("user", entity);
         result.put("token", token);
 
+        // 保存操作日志
+        saveLog(new LogEntity(entity.getId(),"登录管理","用户登录"));
+
 
         // 更新到 redis, 有效期24h, 旧token无效, 做单用户登录
         redisTemplate.opsForValue().set(TypeCode.REDIS_LOGIN_TOKEN + token, token, Long.parseLong("23"), TimeUnit.HOURS);
 
 
-
-
         return Result.success(result);
 
     }

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

@@ -36,7 +36,7 @@ public class NewsController extends BaseController {
     @PostMapping("list")
     public Result<NewsVo> list(@RequestBody NewsPageDateRequest param) {
 
-        Long userId = getTokenUserId();
+
 
         startPage(param);
         PageInfo<NewsVo> page = new PageInfo<>(newsService.search(param));
@@ -53,7 +53,7 @@ public class NewsController extends BaseController {
             entity = new NewsEntity();
             BeanUtils.copyProperties(param, entity);
             entity.setSubmitId(getTokenUserId());
-            entity.setStatus(1);
+//            entity.setStatus(1);
             newsService.save(entity);
         } else {
             entity = newsService.findById(param.getId());

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

@@ -6,10 +6,9 @@ import com.gis.common.util.Result;
 import com.gis.domain.po.SysUserEntity;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.PasswordRequest;
-import com.gis.domain.dto.UserRequest;
+import com.gis.domain.dto.UserDto;
 import com.gis.service.SysUserService;
 import com.github.pagehelper.PageInfo;
-import com.github.xiaoymin.knife4j.annotations.ApiSort;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
@@ -55,7 +54,7 @@ public class SysUserController extends BaseController {
     @RequiresRoles(value = {"sys_admin"}, logical = Logical.OR)
     @ApiOperation("新增/修改用户信息")
     @PostMapping("save")
-    public Result save(@Valid @RequestBody UserRequest param) {
+    public Result save(@Valid @RequestBody UserDto param) {
 
         SysUserEntity entity = null;
         if (param.getId() == null) {

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

@@ -109,7 +109,8 @@ public class WebController extends BaseController {
     public Result slideshow() {
 
         SlideshowPageDateDto param = new SlideshowPageDateDto();
-        param.setAuditStatus(1);
+//        param.setAuditStatus(1);
+        param.setStatus(4);
         param.setPageSize(10);
         startPage(param);
         PageInfo<SlideshowVo> page = new PageInfo<>(slideshowService.search(param));
@@ -203,6 +204,8 @@ public class WebController extends BaseController {
     }
 
 
+
+
     public static void main(String[] args) throws IOException {
         String resourceUrl = FileUtils.getResourceUrl("data/smokeing.json");
 

+ 4 - 3
gis_web/src/main/java/com/gis/web/shiro/MyRealm.java

@@ -68,9 +68,10 @@ public class MyRealm extends AuthorizingRealm {
         SysRoleEntity roleEntity = sysRoleService.findUserRoleByUserId(dbUserEntity.getId());
         Assert.notNull(roleEntity, "用户角色不存在");
         // 设置角色、权限
-        if (dbUserEntity.getSysManager() == 1) {
-            simpleAuthorizationInfo.addRole("sys_admin");
-        }
+//        if (dbUserEntity.getSysManager() == 1) {
+//            simpleAuthorizationInfo.addRole("sys_admin");
+//        }
+        simpleAuthorizationInfo.addRole(dbUserEntity.getRole());
         return simpleAuthorizationInfo;
     }