Browse Source

史馆动态基本完成

wuweihao 5 năm trước cách đây
mục cha
commit
c229c79269
33 tập tin đã thay đổi với 1130 bổ sung160 xóa
  1. 2 2
      gis_application/src/main/resources/application-dev.properties
  2. 17 3
      gis_common/src/main/java/com/gis/common/util/FileUtils.java
  3. 36 0
      gis_domain/src/main/java/com/gis/domain/entity/CommentEntity.java
  4. 33 0
      gis_domain/src/main/java/com/gis/domain/entity/FileEntity.java
  5. 42 4
      gis_domain/src/main/java/com/gis/domain/entity/NewsEntity.java
  6. 58 0
      gis_domain/src/main/java/com/gis/domain/entity/SpiritEntity.java
  7. 24 0
      gis_domain/src/main/java/com/gis/domain/request/CommentRequest.java
  8. 22 0
      gis_domain/src/main/java/com/gis/domain/request/NewsPageDateRequest.java
  9. 43 0
      gis_domain/src/main/java/com/gis/domain/request/NewsRequest.java
  10. 0 53
      gis_domain/src/main/java/com/gis/domain/request/OverTimeRequest.java
  11. 38 0
      gis_domain/src/main/java/com/gis/domain/request/SpiritRequest.java
  12. 51 0
      gis_domain/src/main/java/com/gis/domain/response/NewsVo.java
  13. 0 43
      gis_domain/src/main/java/com/gis/domain/response/OverTimeResponse.java
  14. 13 0
      gis_mapper/src/main/java/com/gis/mapper/CommentMapper.java
  15. 14 0
      gis_mapper/src/main/java/com/gis/mapper/FileMapper.java
  16. 20 0
      gis_mapper/src/main/java/com/gis/mapper/NewsMapper.java
  17. 58 0
      gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java
  18. 0 38
      gis_mapper/src/main/java/com/gis/mapper/provider/OverTimeProvider.java
  19. 13 0
      gis_service/src/main/java/com/gis/service/CommentService.java
  20. 13 0
      gis_service/src/main/java/com/gis/service/FileService.java
  21. 18 0
      gis_service/src/main/java/com/gis/service/NewsService.java
  22. 27 0
      gis_service/src/main/java/com/gis/service/impl/CommentServiceImpl.java
  23. 27 0
      gis_service/src/main/java/com/gis/service/impl/FileServiceImpl.java
  24. 34 0
      gis_service/src/main/java/com/gis/service/impl/NewsServiceImpl.java
  25. 32 0
      gis_service/src/main/java/com/gis/service/util/CommentTree.java
  26. 102 0
      gis_service/src/main/java/com/gis/service/util/CommentTreeUtil.java
  27. 38 2
      gis_web/src/main/java/com/gis/web/controller/ApiController.java
  28. 9 0
      gis_web/src/main/java/com/gis/web/controller/BaseController.java
  29. 86 0
      gis_web/src/main/java/com/gis/web/controller/CommentController.java
  30. 146 0
      gis_web/src/main/java/com/gis/web/controller/FileController.java
  31. 110 0
      gis_web/src/main/java/com/gis/web/controller/NewsController.java
  32. 1 15
      gis_web/src/main/java/com/gis/web/controller/WebController.java
  33. 3 0
      help.md

+ 2 - 2
gis_application/src/main/resources/application-dev.properties

@@ -53,6 +53,6 @@ logging.config=classpath:logback-spring.xml
 logging.level.com.fdkanfang=debug
 
 # \u672C\u5730\u4FDD\u5B58\u8DEF\u5F84
-file.path=F:\\test\\army\\images\\
-server.domain =http://192.168.0.135:8101/
+file.path=F:\\test\\ngin\\
+server.domain =http://192.168.0.135/
 

+ 17 - 3
gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -68,13 +68,27 @@ public class FileUtils {
      * @return
      * @throws IOException
      */
-    public static boolean upload(MultipartFile file, String savePath) throws IOException {
+    public static HashMap<String, String> upload(MultipartFile file, String savePath) throws IOException {
         if (file == null) {
             log.error("文件不能为空");
-            return false;
+            return null;
         }
+
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
+
+        String fileName = file.getOriginalFilename();
+        String suffix = StringUtils.substringAfterLast(fileName, ".");
+        String newName = time  + "."  +suffix;
+        savePath = savePath  + newName;
+
         FileUtil.writeFromStream(file.getInputStream(), savePath);
-        return true;
+        HashMap<String, String> fileInfo = new HashMap<>();
+
+        fileInfo.put("path", savePath);
+        fileInfo.put("name", fileName);
+        fileInfo.put("newName", newName);
+
+        return fileInfo;
 
     }
 

+ 36 - 0
gis_domain/src/main/java/com/gis/domain/entity/CommentEntity.java

@@ -0,0 +1,36 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 留言评论
+ */
+@Data
+@Table(name = "tb_comment")
+public class CommentEntity extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = -8093446477843493946L;
+
+    @ApiModelProperty(value = "用户id")
+    private Long userId;
+
+    @ApiModelProperty(value = "真实姓名")
+    private String realName;
+
+    @ApiModelProperty(value = "消息")
+    private String msg;
+
+    @ApiModelProperty(value = "父级id")
+    private Long parentId;
+
+
+
+
+
+
+
+}

+ 33 - 0
gis_domain/src/main/java/com/gis/domain/entity/FileEntity.java

@@ -0,0 +1,33 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 文件表
+ */
+@Data
+@Table(name = "tb_file")
+public class FileEntity extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = -5191917184688236778L;
+
+
+    @ApiModelProperty(value = "文件名")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件保存路径")
+    private String filePath;
+
+    @ApiModelProperty(value = "访问url")
+    private String urlPath;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+
+
+}

+ 42 - 4
gis_domain/src/main/java/com/gis/domain/entity/NewsEntity.java

@@ -7,16 +7,54 @@ import javax.persistence.Table;
 
 /**
  * Created by owen on 2020/6/10 0010 17:39
- * 新闻
+ * 史馆动态
  */
 @Data
-@Table(name = "tb_view")
+@Table(name = "tb_news")
 public class NewsEntity extends BaseEntity {
 
+    @ApiModelProperty(value = "类型,news:新闻, notice:公告" )
+    private String type;
+
     @ApiModelProperty(value = "标题" )
     private String title;
 
-    @ApiModelProperty(value = "请求地址")
-    private String path;
+    @ApiModelProperty(value = "简介")
+    private String description;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @ApiModelProperty(value = "是否显示,1:是, 0:否")
+    private Integer display;
+
+    @ApiModelProperty(value = "信息正文")
+    private String content;
+
+    @ApiModelProperty(value = "阅读量")
+    private Integer viewCount;
+
+    @ApiModelProperty(value = "提交用户Id")
+    private Long submitId;
+
+    @ApiModelProperty(value = "审核者Id")
+    private Long auditId;
+
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
+    @ApiModelProperty(value = "原因")
+    private String reason;
+
+
+
+
+
+
+
+
 
 }

+ 58 - 0
gis_domain/src/main/java/com/gis/domain/entity/SpiritEntity.java

@@ -0,0 +1,58 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+
+/**
+ * Created by owen on 2020/6/10 0010 17:39
+ * 特有精神
+ */
+@Data
+@Table(name = "tb_spirit")
+public class SpiritEntity extends BaseEntity {
+
+
+    @ApiModelProperty(value = "标题" )
+    private String title;
+
+    @ApiModelProperty(value = "归属单位")
+    private String unit;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @ApiModelProperty(value = "是否显示,1:是, 0:否")
+    private Integer display;
+
+    @ApiModelProperty(value = "信息正文")
+    private String content;
+
+    @ApiModelProperty(value = "阅读量")
+    private Integer viewCount;
+
+    @ApiModelProperty(value = "提交用户Id")
+    private Long submitId;
+
+    @ApiModelProperty(value = "审核者Id")
+    private Long auditId;
+
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
+    @ApiModelProperty(value = "原因")
+    private String reason;
+
+
+
+
+
+
+
+
+
+}

+ 24 - 0
gis_domain/src/main/java/com/gis/domain/request/CommentRequest.java

@@ -0,0 +1,24 @@
+package com.gis.domain.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class CommentRequest {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @NotBlank(message = "留言不能为空")
+    @ApiModelProperty(value = "留言", required = true)
+    private String msg;
+
+    @ApiModelProperty(value = "父级id")
+    private Long parentId;
+}

+ 22 - 0
gis_domain/src/main/java/com/gis/domain/request/NewsPageDateRequest.java

@@ -0,0 +1,22 @@
+package com.gis.domain.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class NewsPageDateRequest extends PageDateRequest {
+
+    @ApiModelProperty(value = "类型,news:新闻, notice:公告" )
+    private String type;
+
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过", required = true)
+    private Integer status;
+
+
+}

+ 43 - 0
gis_domain/src/main/java/com/gis/domain/request/NewsRequest.java

@@ -0,0 +1,43 @@
+package com.gis.domain.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class NewsRequest {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+
+    @NotBlank(message = "类型不能为空")
+    @ApiModelProperty(value = "类型,news:新闻, notice:公告", required = true )
+    private String type;
+
+    @NotBlank(message = "标题不能为空")
+    @ApiModelProperty(value = "标题", required = true )
+    private String title;
+
+    @ApiModelProperty(value = "简介")
+    private String description;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @NotNull(message = "显示设置不能为空")
+    @ApiModelProperty(value = "是否显示,1:是, 0:否", required = true)
+    private Integer display;
+
+    @ApiModelProperty(value = "信息正文")
+    private String content;
+
+}

+ 0 - 53
gis_domain/src/main/java/com/gis/domain/request/OverTimeRequest.java

@@ -1,53 +0,0 @@
-package com.gis.domain.request;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * Created by owen on 2020/6/10 0010 17:39
- */
-@Data
-public class OverTimeRequest {
-
-
-    @NotBlank(message = "userId不能为空")
-    @ApiModelProperty(value = "userId" , required = true)
-    private String userId;
-
-    @NotBlank(message = "userId不能为空")
-    @ApiModelProperty(value = "用户名称(真名)", required = true)
-    private String userName;
-
-    @NotBlank(message = "工号不能为空")
-    @ApiModelProperty(value = "工号" , required = true)
-    private String jobNumber;
-
-    @NotBlank(message = "userId不能为空")
-    @ApiModelProperty(value = "部门Id", required = true)
-    private String deptId;
-
-    @NotBlank(message = "userId不能为空")
-    @ApiModelProperty(value = "部门名称", required = true)
-    private String deptName;
-
-    @NotBlank(message = "加班开始时间不能为空")
-    @ApiModelProperty(value = "加班开始时间, 格式yyyy-MM-dd HH:mm:ss", required = true)
-    private String startTime;
-
-    @NotBlank(message = "加班结束时间不能为空")
-    @ApiModelProperty(value = "加班结束时间, 格式yyyy-MM-dd HH:mm:ss", required = true)
-    private String endTime;
-
-
-    @NotBlank(message = "token不能为空")
-    @ApiModelProperty(value = "token", required = true)
-    private String token;
-
-//    @NotBlank(message = "是否周末不能为空")
-////    @ApiModelProperty(value = "是否周末,1:是, 0:否", required = true)
-//    @ApiModelProperty(value = "是否周末,1:是, 0:否")
-//    private Integer weekend;
-
-}

+ 38 - 0
gis_domain/src/main/java/com/gis/domain/request/SpiritRequest.java

@@ -0,0 +1,38 @@
+package com.gis.domain.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class SpiritRequest {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @NotBlank(message = "标题不能为空")
+    @ApiModelProperty(value = "标题", required = true )
+    private String title;
+
+    @ApiModelProperty(value = "简介")
+    private String unit;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @NotNull(message = "显示设置不能为空")
+    @ApiModelProperty(value = "是否显示,1:是, 0:否", required = true)
+    private Integer display;
+
+    @ApiModelProperty(value = "信息正文")
+    private String content;
+
+}

+ 51 - 0
gis_domain/src/main/java/com/gis/domain/response/NewsVo.java

@@ -0,0 +1,51 @@
+package com.gis.domain.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class NewsVo {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "类型,news:新闻, notice:公告")
+    private String type;
+
+    @ApiModelProperty(value = "标题" )
+    private String title;
+
+    @ApiModelProperty(value = "简介")
+    private String description;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @ApiModelProperty(value = "是否显示,1:是, 0:否")
+    private Integer display;
+
+    @ApiModelProperty(value = "信息正文")
+    private String content;
+
+    @ApiModelProperty(value = "提交用户Id")
+    private Long submitId;
+
+    @ApiModelProperty(value = "提交者名称")
+    private String submitName;
+
+    @ApiModelProperty(value = "状态,1:草稿中,2:待审核,3:审核不通过,4:审核通过")
+    private Integer status;
+
+    @ApiModelProperty(value = "原因")
+    private String reason;
+
+}

+ 0 - 43
gis_domain/src/main/java/com/gis/domain/response/OverTimeResponse.java

@@ -1,43 +0,0 @@
-package com.gis.domain.response;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * Created by owen on 2020/6/10 0010 17:39
- */
-@Data
-public class OverTimeResponse {
-
-    @ApiModelProperty(value = "钉钉获取的code值")
-    private String code;
-
-    @ApiModelProperty(value = "userId")
-    private String userId;
-
-    @ApiModelProperty(value = "用户名称(真名)")
-    private String userName;
-
-    @ApiModelProperty(value = "工号")
-    private String jobNumber;
-
-    @ApiModelProperty(value = "部门ID")
-    private String deptId;
-
-    @ApiModelProperty(value = "部门名称")
-    private String deptName;
-
-    @ApiModelProperty(value = "token")
-    private String token;
-
-
-
-
-
-
-
-
-
-}

+ 13 - 0
gis_mapper/src/main/java/com/gis/mapper/CommentMapper.java

@@ -0,0 +1,13 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.CommentEntity;
+import com.gis.domain.entity.MenuEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+@Component
+@Mapper
+public interface CommentMapper extends IBaseMapper<CommentEntity, Long> {
+
+}

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

@@ -0,0 +1,14 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.FileEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Mapper
+public interface FileMapper extends IBaseMapper<FileEntity, Long> {
+
+
+}

+ 20 - 0
gis_mapper/src/main/java/com/gis/mapper/NewsMapper.java

@@ -0,0 +1,20 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.NewsEntity;
+import com.gis.domain.request.NewsPageDateRequest;
+import com.gis.domain.response.NewsVo;
+import com.gis.mapper.provider.NewsProvider;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.SelectProvider;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+@Mapper
+public interface NewsMapper extends IBaseMapper<NewsEntity, Long> {
+
+    @SelectProvider(type = NewsProvider.class, method = "search")
+    List<NewsVo> search(NewsPageDateRequest param);
+}

+ 58 - 0
gis_mapper/src/main/java/com/gis/mapper/provider/NewsProvider.java

@@ -0,0 +1,58 @@
+package com.gis.mapper.provider;
+
+import com.gis.domain.request.NewsPageDateRequest;
+import com.gis.domain.request.PageDateRequest;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by owen on 2020/6/13 0013 10:56
+ */
+@Log4j2
+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.content, a.view_count, a.status, a.reason," +
+                        "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()) ){
+
+            sql.append(" and a.create_time >= ").append("'").append(param.getStartTime()).append("'");
+
+        }
+
+        if (StringUtils.isNotBlank(param.getEndTime())) {
+            sql.append(" and a.create_time <= ").append("'").append(param.getEndTime()).append("'");
+        }
+
+        String searchKey = param.getSearchKey();
+        if(!StringUtils.isAllBlank(searchKey)){
+            sql.append(" and ( a.title like '%").append(searchKey).append("%' )");
+        }
+
+        String type = param.getType();
+        if (type != null) {
+            sql.append(" and a.type = ").append(type);
+        }
+
+        // 待审核:草稿中、待审核、审核不通过
+        // 审核通过:审核通过
+        /**
+         * 待审核:草稿中、待审核、审核不通过
+         * 审核通过:审核通过
+         */
+        Integer status = param.getStatus();
+
+        if (status == 4) {
+            sql.append(" and a.status = ").append(status);
+        } else {
+            sql.append(" and a.status <> ").append(4);
+        }
+
+        sql.append(" order by a.create_time desc");
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
+}

+ 0 - 38
gis_mapper/src/main/java/com/gis/mapper/provider/OverTimeProvider.java

@@ -1,38 +0,0 @@
-package com.gis.mapper.provider;
-
-import com.gis.domain.request.PageDateRequest;
-import lombok.extern.log4j.Log4j2;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * Created by owen on 2020/6/13 0013 10:56
- */
-@Log4j2
-public class OverTimeProvider {
-
-
-    public String findBySearchKey(PageDateRequest param){
-        StringBuffer sql = new StringBuffer(
-                "select * from tb_over_time where rec_status = 'A' ");
-
-        if(StringUtils.isNotBlank(param.getStartTime()) ){
-
-            sql.append(" and create_time >= ").append("'").append(param.getStartTime()).append("'");
-
-        }
-
-        if (StringUtils.isNotBlank(param.getEndTime())) {
-            sql.append(" and create_time <= ").append("'").append(param.getEndTime()).append("'");
-        }
-
-        String searchKey = param.getSearchKey();
-        if(!StringUtils.isAllBlank(searchKey)){
-            sql.append(" and (( dept_name like '%").append(searchKey).append("%' )");
-            sql.append(" or ( user_name like '%").append(searchKey).append("%' ))");
-        }
-
-        sql.append(" order by create_time desc");
-        log.info("sql: {}", sql.toString());
-        return sql.toString();
-    }
-}

+ 13 - 0
gis_service/src/main/java/com/gis/service/CommentService.java

@@ -0,0 +1,13 @@
+package com.gis.service;
+
+
+import com.gis.domain.entity.CommentEntity;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface CommentService extends IBaseService<CommentEntity, Long> {
+
+
+}

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

@@ -0,0 +1,13 @@
+package com.gis.service;
+
+
+import com.gis.domain.entity.FileEntity;
+
+/**
+ * Created by owen on 2020/5/11 0011 16:14
+ */
+public interface FileService extends IBaseService<FileEntity, Long> {
+
+
+
+}

+ 18 - 0
gis_service/src/main/java/com/gis/service/NewsService.java

@@ -0,0 +1,18 @@
+package com.gis.service;
+
+
+import com.gis.domain.entity.NewsEntity;
+import com.gis.domain.request.NewsPageDateRequest;
+import com.gis.domain.response.NewsVo;
+
+import java.util.List;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface NewsService extends IBaseService<NewsEntity, Long> {
+
+
+    List<NewsVo> search(NewsPageDateRequest param);
+}

+ 27 - 0
gis_service/src/main/java/com/gis/service/impl/CommentServiceImpl.java

@@ -0,0 +1,27 @@
+package com.gis.service.impl;
+
+import com.gis.domain.entity.CommentEntity;
+import com.gis.mapper.IBaseMapper;
+import com.gis.mapper.CommentMapper;
+import com.gis.service.CommentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Service
+public class CommentServiceImpl extends IBaseServiceImpl<CommentEntity, Long> implements CommentService {
+
+    @Autowired
+    private CommentMapper entityMapper;
+
+    @Override
+    public IBaseMapper<CommentEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+
+}

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

@@ -0,0 +1,27 @@
+package com.gis.service.impl;
+
+import com.gis.domain.entity.FileEntity;
+import com.gis.mapper.FileMapper;
+import com.gis.mapper.IBaseMapper;
+import com.gis.service.FileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/5/11 0011 16:16
+ */
+@Service
+public class FileServiceImpl extends IBaseServiceImpl<FileEntity, Long> implements FileService {
+
+    @Autowired
+    private FileMapper entityMapper;
+
+    @Override
+    public IBaseMapper<FileEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+
+}

+ 34 - 0
gis_service/src/main/java/com/gis/service/impl/NewsServiceImpl.java

@@ -0,0 +1,34 @@
+package com.gis.service.impl;
+
+import com.gis.domain.entity.NewsEntity;
+import com.gis.domain.request.NewsPageDateRequest;
+import com.gis.domain.response.NewsVo;
+import com.gis.mapper.IBaseMapper;
+import com.gis.mapper.NewsMapper;
+import com.gis.service.NewsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Service
+public class NewsServiceImpl extends IBaseServiceImpl<NewsEntity, Long> implements NewsService {
+
+    @Autowired
+    private NewsMapper entityMapper;
+
+    @Override
+    public IBaseMapper<NewsEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+    @Override
+    public List<NewsVo> search(NewsPageDateRequest param) {
+        return entityMapper.search(param);
+    }
+}

+ 32 - 0
gis_service/src/main/java/com/gis/service/util/CommentTree.java

@@ -0,0 +1,32 @@
+package com.gis.service.util;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class CommentTree {
+
+    private Long id;
+
+    private String realName;
+
+    private Long parentId;
+
+    private String msg;
+
+    private Date createTime;
+
+
+    // 子菜单/或按钮
+    private List<CommentTree> children;
+
+    @JSONField(serialize = false)
+    private int level;
+
+
+
+
+}

+ 102 - 0
gis_service/src/main/java/com/gis/service/util/CommentTreeUtil.java

@@ -0,0 +1,102 @@
+package com.gis.service.util;
+
+import com.gis.domain.entity.CommentEntity;
+import com.gis.domain.entity.SysResourceEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CommentTreeUtil {
+
+    private List<CommentTree> resultNodes = new ArrayList<CommentTree>();//树形结构排序之后list内容
+
+    private List<CommentTree> nodes = new ArrayList<CommentTree>();
+    //传入list参数
+
+    public CommentTreeUtil(List<CommentEntity> nodesList) {//通过构造函数初始化
+        for (CommentEntity n : nodesList) {
+            CommentTree treeGrid = new CommentTree();
+            treeGrid.setId(n.getId());
+            treeGrid.setMsg(n.getMsg());
+            treeGrid.setRealName(n.getRealName());
+            treeGrid.setCreateTime(n.getCreateTime());
+
+            if (n.getParentId() != null) {
+                treeGrid.setParentId(n.getParentId());
+            }
+            nodes.add(treeGrid);
+        }
+    }
+
+    public CommentTreeUtil() {
+    }
+
+    /**
+     * 构建树形结构list
+     *
+     * @return 返回树形结构List列表
+     */
+    public List<CommentTree> buildTree() {
+        for (CommentTree node : nodes) {
+            Long id = node.getParentId();
+            if (id == null) {//通过循环一级节点 就可以通过递归获取二级以下节点
+                resultNodes.add(node);//添加一级节点
+                node.setLevel(1);
+                build(node, node.getLevel());//递归获取二级、三级、。。。节点
+            }
+        }
+        return resultNodes;
+    }
+
+    /**
+     * 递归循环子节点
+     *
+     * @param node 当前节点
+     */
+    private void build(CommentTree node, int level) {
+        List<CommentTree> children = getChildren(node);
+        if (!children.isEmpty()) {//如果存在子节点
+            node.setChildren(children);
+//        	level++;
+            for (CommentTree child : children) {//将子节点遍历加入返回值中
+        		child.setLevel(level);
+                build(child, child.getLevel());
+            }
+        }
+    }
+
+    /**
+     * @param node
+     * @return 返回
+     */
+    private List<CommentTree> getChildren(CommentTree node) {
+        List<CommentTree> children = new ArrayList<CommentTree>();
+        Long id = node.getId();
+        for (CommentTree child : nodes) {
+            if (id.equals(child.getParentId())) {//如果id等于父id
+                children.add(child);//将该节点加入循环列表中
+            }
+        }
+        return children;
+    }
+
+//    public List<CommentTree> buildTree(List<SysResourceEntity> all, List<SysResourceEntity> in) {
+//        for (SysResourceEntity n : all) {
+//            CommentTree treeGrid = new CommentTree();
+//            treeGrid.setId(n.getId());
+//            treeGrid.setMsg(n.getMsg());
+//            treeGrid.setUserName(n.getUserName());
+//            treeGrid.setCreateTime(n.getCreateTime());
+//            for (SysResourceEntity nin : in) {
+//                if (nin.getId().equals(n.getId())) {
+//                }
+//            }
+//            if (n.getParentId() != null) {
+//                treeGrid.setParentId(n.getParentId());
+//            }
+//            nodes.add(treeGrid);
+//        }
+//        return buildTree();
+//    }
+
+}

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

@@ -45,6 +45,24 @@ public class ApiController extends BaseController {
     @Autowired
     private SceneService sceneService;
 
+
+    @ApiOperation("获取场景码")
+    @PostMapping("testJson")
+    public Result testJson(String a) {
+        String sceneCode = RandomUtils.randowString(9);
+        sceneCode = "ar_" +sceneCode;
+
+        // 创建token,过期24h,
+        String token = JwtUtil.createJWT(TOKEN_EXPIRE, TypeCode.TOKEN_API_KEY);
+
+        HashMap<Object, Object> reuslt = new HashMap<>();
+        reuslt.put("sceneCode", sceneCode);
+        reuslt.put("token", token);
+
+        return Result.success(reuslt);
+    }
+
+
     /**
      *  map的key值是json参数,value是文件
      * @param param
@@ -88,10 +106,13 @@ public class ApiController extends BaseController {
 
             String fileName = file.getOriginalFilename();
 
+
+
             JSONObject keyJson = JSONObject.parseObject(key);
 
             // 给相对路径,tomcat配置静态资源让前端读取
-            String boxVideoPath = "/boxVideo/" + fileName;
+            // http://192.168.0.44:8101/data/ar_I4Ef2SS4y/boxVideo/20180201_101827.mp4
+            String boxVideoPath = "/data/" + entity.getSceneCode()+ "/boxVideo/" + fileName;
 //            log.info("boxVideoPath: {}", boxVideoPath);
 
             // 添加视频参数到overlayJaon
@@ -121,7 +142,7 @@ public class ApiController extends BaseController {
         FileUtil.writeUtf8String(dataJson.toJSONString(), saveDataJsonPath);
         log.info("data2.js创建完成");
 
-        return Result.success();
+        return Result.success(entity.getWebSite());
     }
 
 
@@ -406,6 +427,21 @@ public class ApiController extends BaseController {
     }
 
 
+    @Test
+    public void ba64(){
+        String basePath = "F:\\test\\army";
+        FileUtil.writeUtf8String("{}",basePath+"/data2.js");
+    }
+
+
+
+    @Test
+    public void modelDataTxtToDam() throws Exception {
+        String inPath = "C:\\Users\\Administrator\\Desktop\\test\\modeldata.txt";
+        String outPath = "C:\\Users\\Administrator\\Desktop\\test";
+
+        CreateObjUtil.convertTxtToDam(inPath, outPath+"/" + ConstantFileName.modelUUID+"_50k.dam");
+    }
 
 
 

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

@@ -1,5 +1,7 @@
 package com.gis.web.controller;
 
+import com.gis.domain.entity.SysUserEntity;
+import com.gis.service.SysUserService;
 import com.gis.web.shiro.JwtUtil;
 import com.github.pagehelper.PageHelper;
 
@@ -17,6 +19,9 @@ public class BaseController {
     @Autowired
     protected HttpServletRequest request;
 
+    @Autowired
+    public SysUserService sysUserService;
+
     /**
      * 服务器保存文件路径前缀
      */
@@ -48,6 +53,10 @@ public class BaseController {
 //        return JwtUtil.getUserRole(getToken());
 //    }
 
+    SysUserEntity getSysUser(){
+        return sysUserService.findById(getTokenUserId());
+    }
+
     /** 获取用户管理者*/
     Boolean getTokenUserManager(){
         return JwtUtil.getUserManager(getToken());

+ 86 - 0
gis_web/src/main/java/com/gis/web/controller/CommentController.java

@@ -0,0 +1,86 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.CommentEntity;
+import com.gis.domain.request.CommentRequest;
+import com.gis.domain.request.PageRequest;
+import com.gis.service.CommentService;
+import com.gis.service.util.CommentTree;
+import com.gis.service.util.CommentTreeUtil;
+import com.gis.service.util.MenuTree;
+import com.gis.service.util.MenuTreeUtil;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/5/8 0008 9:54
+ */
+@Api(tags = "留言管理")
+@RestController
+@RequestMapping("manage/comment")
+public class CommentController extends BaseController {
+
+    @Autowired
+    private CommentService commentService;
+
+
+
+    @ApiOperation("列表")
+    @PostMapping("list")
+    public Result<CommentTree> list(@RequestBody PageRequest param) {
+        startPage(param);
+
+        List<CommentEntity> all = commentService.findAll();
+        CommentTreeUtil commentTreeUtil = new CommentTreeUtil(all);
+        List<CommentTree> commentTrees = commentTreeUtil.buildTree();
+
+        PageInfo<CommentTree> page = new PageInfo<>(commentTrees);
+        return Result.success(page);
+    }
+
+    @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);
+
+        }
+
+        return Result.success();
+    }
+
+
+    @ApiOperation("删除")
+    @GetMapping("removes/{ids}")
+    public Result detail(@PathVariable String ids) {
+        commentService.deleteByIds(ids);
+
+        return Result.success();
+    }
+
+
+}

+ 146 - 0
gis_web/src/main/java/com/gis/web/controller/FileController.java

@@ -0,0 +1,146 @@
+package com.gis.web.controller;
+
+
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import com.gis.common.util.AliyunOssUtil;
+import com.gis.common.util.FileUtils;
+import com.gis.common.util.Result;
+import com.gis.domain.entity.FileEntity;
+import com.gis.service.FileService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Created by owen on 2020/5/9 0018 12:17
+ */
+@Log4j2
+@Api(tags = "文件服务")
+@RestController
+@RequestMapping("manage/file")
+public class FileController extends BaseController {
+
+    @Autowired
+    private FileService fileService;
+
+    /**
+     * 到时后商量是否全部图片都要生成缩略图
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    @ApiOperation("上传")
+    @PostMapping(value = "upload", consumes = {"multipart/form-data"})
+    public Result upload(MultipartFile file ) throws IOException {
+
+        if (file == null) {
+            log.error("文件不能为空");
+            return Result.failure("文件不能为空");
+        }
+
+        // 写入本地服务器
+        HashMap<String, String> fileInfo = FileUtils.upload(file, FILE_PATH);
+
+
+        // 保存db
+        FileEntity entity = new FileEntity();
+        entity.setFileName(fileInfo.get("name"));
+
+        String filePath = fileInfo.get("path");
+        entity.setFilePath(filePath);
+
+        String newName = fileInfo.get("newName");
+        String urlPath = SERVER_DOMAIN+"data/" + newName;
+        entity.setUrlPath(urlPath);
+
+        // 生成缩略图
+        String thumbPath = FILE_PATH + "thumb_" + newName;
+        createThumb(filePath, thumbPath);
+
+        String thumbUrl = SERVER_DOMAIN+"data/thumb_" + newName;
+        entity.setThumb(thumbUrl);
+
+        fileService.save(entity);
+
+        // 返回前端数据
+        return Result.success(entity);
+
+    }
+
+
+    @ApiIgnore
+    @ApiOperation("上传, 可以接收多个文件")
+    @PostMapping(value = "uploads", consumes = {"multipart/form-data"})
+    public Result uploads(MultipartFile [] file ) throws IOException {
+
+        if (file.length <= 0) {
+            log.error("文件不能为空");
+            return Result.failure("文件不能为空");
+        }
+
+        // 写入本地服务器
+        List<Map<String, String>> uploads = FileUtils.uploads(file, FILE_PATH);
+
+        HashMap<String, String> resultMap = new HashMap<>();
+        String dir = null;
+        for (Map<String, String> map: uploads) {
+            String fileName = map.get("name");
+            String newName = map.get("newName");
+            String path = FILE_PATH+"/" + newName;
+            String filePath = map.get("path");
+            log.info("local {}, ", filePath);
+            // urlPath
+            dir = map.get("dir");
+            String urlPath = SERVER_DOMAIN+"data/"+dir+"/"+newName;
+
+            // 保存db
+            FileEntity entity = new FileEntity();
+            entity.setFileName(fileName);
+//            String ossUrl = OSS_DOMAIN+ossPath;
+            entity.setFilePath(filePath);
+            entity.setUrlPath(urlPath);
+
+            // 创建缩略图
+
+            fileService.save(entity);
+
+            // 返回前端数据
+            resultMap.put(entity.getId().toString(), entity.getUrlPath());
+//            dir = map.get("dir");
+        }
+
+        // 删除本地服务器物理文件,用删除目录的方式
+//        FileUtil.del(OUT_PATH + dir);
+
+        return Result.success(resultMap);
+
+    }
+
+    /**
+     * 创建缩略图
+     * @param filePath
+     * @return
+     */
+    private String createThumb(String filePath, String savePath){
+        ImgUtil.scale(FileUtil.file(filePath), FileUtil.file(savePath), 0.2f);
+
+        return null;
+    }
+
+
+
+
+}

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

@@ -0,0 +1,110 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.NewsEntity;
+import com.gis.domain.request.NewsPageDateRequest;
+import com.gis.domain.request.NewsRequest;
+import com.gis.domain.request.PageRequest;
+import com.gis.domain.response.NewsVo;
+import com.gis.service.NewsService;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+
+/**
+ * Created by owen on 2020/5/8 0008 9:54
+ */
+@Log4j2
+@Api(tags = "史馆动态")
+@RestController
+@RequestMapping("manage/news")
+public class NewsController extends BaseController {
+
+    @Autowired
+    private NewsService newsService;
+
+
+
+    @ApiOperation("列表")
+    @PostMapping("list")
+    public Result<NewsVo> list(@RequestBody NewsPageDateRequest param) {
+
+        Long userId = getTokenUserId();
+
+        startPage(param);
+        PageInfo<NewsVo> page = new PageInfo<>(newsService.search(param));
+        return Result.success(page);
+    }
+
+    @ApiOperation("新增/修改部信息")
+    @PostMapping("save")
+    public Result save(@Valid @RequestBody NewsRequest param) {
+
+        NewsEntity entity = null;
+        if (param.getId() == null) {
+            entity = new NewsEntity();
+            BeanUtils.copyProperties(param, entity);
+            entity.setSubmitId(getTokenUserId());
+            entity.setStatus(1);
+            newsService.save(entity);
+        } else {
+            entity = newsService.findById(param.getId());
+            if (entity == null) {
+                return Result.failure("对象id不存在");
+            }
+
+            BeanUtils.copyProperties(param, entity);
+            entity.setUpdateTime(new Date());
+            newsService.update(entity);
+
+        }
+
+        return Result.success();
+    }
+
+
+    @ApiOperation("删除")
+    @GetMapping("removes/{ids}")
+    public Result detail(@PathVariable String ids) {
+        newsService.deleteByIds(ids);
+        return Result.success();
+    }
+
+
+    @ApiOperation("审核")
+    @GetMapping("audit/{id}/{status}")
+    public Result audit(@PathVariable Long id, @PathVariable Integer status) {
+        NewsEntity entity = newsService.findById(id);
+        if (entity == null) {
+            log.error("对象id不存在 : {}", id);
+            return Result.failure("对象id不存在");
+        }
+
+        entity.setStatus(status);
+        entity.setAuditId(getTokenUserId());
+        newsService.update(entity);
+        return Result.success();
+    }
+
+
+    @ApiOperation("详情")
+    @GetMapping("detail/{id}")
+    public Result detail(@PathVariable Long id) {
+        NewsEntity entity = newsService.findById(id);
+        if (entity == null) {
+            log.error("对象id不存在 : {}", id);
+            return Result.failure("对象id不存在");
+        }
+        return Result.success(entity);
+    }
+
+
+
+}

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

@@ -66,21 +66,7 @@ public class WebController extends BaseController {
         long count = viewService.count();
         return Result.success(count);
     }
-//
-//
-//    /**
-//     * 给算法查询服务器文件位置
-//     * m 是场景码
-//     */
-//    @ApiOperation("查询服务器文件夹")
-//    @GetMapping(value = "getFolder")
-//    @ApiImplicitParam(name = "m", value = "场景码", required = true)
-//    public Result getFolder(String m) {
-//        SceneEntity entity = sceneService.findBySceneCode(m);
-//        assert entity != null;
-//        log.info("filePath: {}", entity.getPath());
-//        return Result.success(entity.getPath());
-//    }
+
 
 
 

+ 3 - 0
help.md

@@ -8,6 +8,9 @@
     访问url:
         http://192.168.0.163:8101/    
         
+        <Context path="" docBase="/root/user/java/tomcat_army_cms_8101/webapps/armycms" debug="0" reloadable="true" crossContext="true"/>
+        <Context path="/data" docBase="/root/user/army_cms_data/" reloadable="true" crossContext="true" />
+        
  #data文件夹
  
         --ar_WTJ1ooJDD 场景码