Kaynağa Gözat

大场景-视频完成

wuweihao 5 yıl önce
ebeveyn
işleme
2c16539be8

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

@@ -0,0 +1,36 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class VideoDto {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @NotBlank(message = "标题不能为空")
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @NotBlank(message = "高清图url不能为空")
+    @ApiModelProperty(value = "高清图url", required = true)
+    private String img;
+
+    @NotBlank(message = "缩略图url不能为空")
+    @ApiModelProperty(value = "缩略图url", required = true)
+    private String thumb;
+
+    @NotBlank(message = "视频url不能为空")
+    @ApiModelProperty(value = "视频url", required = true)
+    private String video;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+}

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

@@ -0,0 +1,38 @@
+package com.gis.domain.po;
+
+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_video")
+public class VideoEntity extends BaseEntity {
+
+    @ApiModelProperty(value = "标题" )
+    private String title;
+
+    @ApiModelProperty(value = "视频url")
+    private String video;
+
+    @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 = "提交用户Id")
+    private Long submitId;
+
+
+}

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

@@ -0,0 +1,37 @@
+package com.gis.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by owen on 2020/5/9 0009 12:20
+ */
+@Data
+public class VideoVo {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "标题" )
+    private String title;
+
+    @ApiModelProperty(value = "高清图url")
+    private String img;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String thumb;
+
+    @ApiModelProperty(value = "缩略图url")
+    private String video;
+
+    @ApiModelProperty(value = "是否显示,1:是, 0:否")
+    private Integer display;
+
+    @ApiModelProperty(value = "提交用户Id")
+    private Long submitId;
+
+    @ApiModelProperty(value = "提交者名称")
+    private String submitName;
+
+
+}

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

@@ -1,6 +1,7 @@
 package com.gis.mapper;
 
 
+import com.gis.domain.dto.PageDto;
 import com.gis.domain.po.NewsEntity;
 import com.gis.domain.dto.NewsPageDateRequest;
 import com.gis.domain.vo.NewsVo;
@@ -17,4 +18,7 @@ public interface NewsMapper extends IBaseMapper<NewsEntity, Long> {
 
     @SelectProvider(type = NewsProvider.class, method = "search")
     List<NewsVo> search(NewsPageDateRequest param);
+
+    @SelectProvider(type = NewsProvider.class, method = "webSearch")
+    List<NewsVo> webSearch(PageDto webPageDto);
 }

+ 7 - 0
gis_mapper/src/main/java/com/gis/mapper/SceneMapper.java

@@ -8,6 +8,7 @@ import com.gis.mapper.provider.SpiritProvider;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.SelectProvider;
+import org.apache.ibatis.annotations.Update;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -21,4 +22,10 @@ public interface SceneMapper extends IBaseMapper<SceneEntity, Long> {
 
     @SelectProvider(type = SceneProvider.class, method = "search")
     List<SceneEntity> search(PageDto param);
+
+    @Update("update tb_scene set display = 0 where display = 1 ")
+    void setDisable();
+
+    @Update("update tb_scene set display = 1 where id = #{id} ")
+    void setDisplay(Long id);
 }

+ 30 - 0
gis_mapper/src/main/java/com/gis/mapper/VideoMapper.java

@@ -0,0 +1,30 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.po.FodderEntity;
+import com.gis.domain.po.VideoEntity;
+import com.gis.domain.vo.VideoVo;
+import com.gis.mapper.provider.VideoProvider;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.SelectProvider;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+@Mapper
+public interface VideoMapper extends IBaseMapper<VideoEntity, Long> {
+
+    @SelectProvider(type = VideoProvider.class, method = "search")
+    List<VideoVo> search(PageDto param);
+
+//    @Select("select * from tb_scene where scene_code = #{m}")
+    @Update("update tb_video set display = 0 where display = 1 ")
+    void setDisable();
+
+    @Update("update tb_video set display = 1 where id = #{id} ")
+    void setDisplay(Long id);
+}

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

@@ -1,6 +1,7 @@
 package com.gis.mapper.provider;
 
 import com.gis.domain.dto.NewsPageDateRequest;
+import com.gis.domain.dto.PageDto;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
 
@@ -52,4 +53,31 @@ public class NewsProvider {
         log.info("sql: {}", sql.toString());
         return sql.toString();
     }
+
+
+    public String webSearch(PageDto 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.content where tb_news as a " +
+//                        "where a.rec_status = 'A' and a.status = 4 and a.display = 1 ");
+
+        "select id, type, title, description, img, thumb, display, view_count, status, content from tb_news " +
+                "where rec_status = 'A' and status = 4 and display = 1 ");
+
+        String searchKey = param.getSearchKey();
+        if(!StringUtils.isAllBlank(searchKey)){
+
+            sql.append(" and (");
+            sql.append(" ( title like '%").append(searchKey).append("%' )");
+            sql.append(" or ( content like '%").append(searchKey).append("%' )");
+            sql.append(" )");
+        }
+
+
+
+        sql.append(" order by create_time desc");
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
+
+
 }

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

@@ -20,7 +20,7 @@ public class SceneProvider {
             sql.append(" and ( scene_title like '%").append(searchKey).append("%' )");
         }
 
-        sql.append(" order by create_time desc");
+        sql.append(" order by display desc, create_time desc");
         log.info("sql: {}", sql.toString());
         return sql.toString();
     }

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

@@ -0,0 +1,35 @@
+package com.gis.mapper.provider;
+
+import com.gis.domain.dto.PageDto;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by owen on 2020/6/13 0013 10:56
+ */
+@Log4j2
+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.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' ");
+
+
+
+        String searchKey = param.getSearchKey();
+        if(!StringUtils.isAllBlank(searchKey)){
+
+            sql.append(" and (");
+            sql.append(" ( a.title like '%").append(searchKey).append("%' )");
+            sql.append(" )");
+        }
+
+
+
+        sql.append(" order by  a.display desc , a.create_time desc");
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
+}

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

@@ -1,6 +1,7 @@
 package com.gis.service;
 
 
+import com.gis.domain.dto.PageDto;
 import com.gis.domain.po.NewsEntity;
 import com.gis.domain.dto.NewsPageDateRequest;
 import com.gis.domain.vo.NewsVo;
@@ -15,4 +16,6 @@ public interface NewsService extends IBaseService<NewsEntity, Long> {
 
 
     List<NewsVo> search(NewsPageDateRequest param);
+
+    List<NewsVo>  webSearch(PageDto webPageDto);
 }

+ 19 - 0
gis_service/src/main/java/com/gis/service/VideoService.java

@@ -0,0 +1,19 @@
+package com.gis.service;
+
+
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.po.VideoEntity;
+import com.gis.domain.vo.VideoVo;
+
+import java.util.List;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface VideoService extends IBaseService<VideoEntity, Long> {
+
+    List<VideoVo> search(PageDto param);
+
+
+}

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

@@ -1,5 +1,6 @@
 package com.gis.service.impl;
 
+import com.gis.domain.dto.PageDto;
 import com.gis.domain.po.NewsEntity;
 import com.gis.domain.dto.NewsPageDateRequest;
 import com.gis.domain.vo.NewsVo;
@@ -31,4 +32,9 @@ public class NewsServiceImpl extends IBaseServiceImpl<NewsEntity, Long> implemen
     public List<NewsVo> search(NewsPageDateRequest param) {
         return entityMapper.search(param);
     }
+
+    @Override
+    public List<NewsVo> webSearch(PageDto webPageDto) {
+        return entityMapper.webSearch(webPageDto);
+    }
 }

+ 33 - 0
gis_service/src/main/java/com/gis/service/impl/VideoServiceImpl.java

@@ -0,0 +1,33 @@
+package com.gis.service.impl;
+
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.po.VideoEntity;
+import com.gis.domain.vo.VideoVo;
+import com.gis.mapper.VideoMapper;
+import com.gis.mapper.IBaseMapper;
+import com.gis.service.VideoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Created by owen on 2020/7/15 0015 16:46
+ */
+@Service
+public  class VideoServiceImpl extends IBaseServiceImpl<VideoEntity, Long> implements VideoService {
+
+    @Autowired
+    private VideoMapper entityMapper;
+
+    @Override
+    public IBaseMapper<VideoEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+    @Override
+    public List<VideoVo> search(PageDto param) {
+        return entityMapper.search(param);
+    }
+}

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

@@ -12,6 +12,8 @@ import com.gis.common.proto.util.CreateObjUtil;
 import com.gis.common.util.FileUtils;
 import com.gis.common.util.RandomUtils;
 import com.gis.common.util.Result;
+import com.gis.domain.dto.SceneDataDto;
+import com.gis.domain.po.FileEntity;
 import com.gis.domain.po.SceneEntity;
 import com.gis.service.SceneService;
 import com.gis.web.shiro.JwtUtil;
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
 import java.io.IOException;
 import java.util.Date;
 import java.util.HashMap;
@@ -147,7 +150,7 @@ public class ApiController extends BaseController {
 
 
 
-    @ApiOperation("Map表单上传多文件,指定保存路径,需要用postman测试")
+    @ApiOperation(value = "Map表单上传多文件,指定保存路径,需要用postman测试", notes = "自定义上传位置")
     @PostMapping("uploads")
     public Result uploads(@RequestParam Map<String, MultipartFile> param, String sceneTitle, String sceneCode, HttpServletRequest request) throws Exception {
         String token = request.getHeader("token");
@@ -442,9 +445,155 @@ public class ApiController extends BaseController {
     }
 
 
+    @ApiOperation("编辑场景")
+    @PostMapping("edit")
+    public Result edit(@Valid @RequestBody SceneDataDto param) {
 
+        SceneEntity entity = sceneService.findBySceneCode(param.getSceneCode());
+        if (entity == null) {
+            log.error("场景不存在 : {}", param.getSceneCode());
+            return Result.failure("场景不存在");
+        }
+
+
+
+        // 处理someData.json
+        String someDataPath = entity.getPath() + "/someData.json";
+        if (!FileUtil.isFile(someDataPath)) {
+            log.error("someData.json文件不存在");
+            return Result.failure("someData.json文件不存在");
+        }
+
+        // 读取someDataJson
+        String someData = FileUtil.readUtf8String(someDataPath);
+        JSONObject someDataJson = JSONObject.parseObject(someData);
+
+
+
+        String info = param.getInfo();
+        String guides = param.getGuides();
+        JSONArray guidesArray = new JSONArray();
+        if (guides != null) {
+            guidesArray = JSONObject.parseArray(guides);
+
+        }
+
+
+        if (info != null) {
+            JSONObject infoJson = JSONObject.parseObject(info);
 
+            // 处理model
+            JSONObject model = someDataJson.getJSONObject("model");
+            if (model != null) {
+                model.put("name", infoJson.get("name"));
+                model.put("summary", infoJson.get("summary"));
+                model.put("camera_start", infoJson.getJSONObject("camera_start"));
+//                model.put("camera_start", infoJson.get("camera_start"));
 
+                if (guidesArray != null) {
+                    model.put("images", guidesArray);
+                }
+
+
+            }
+
+            // 更新someDataJson
+            someDataJson.put("model", model);
+            someDataJson.put("loadlogo", infoJson.get("loadlogo"));
+
+            // 删除旧someDataJson
+            FileUtil.del(someDataPath);
+            // 写入新someDataJson
+            FileUtil.writeUtf8String(someDataJson.toJSONString(), someDataPath);
+            log.info("someData.json写入完成");
+        }
+
+        // 处理data2.js
+        String data2Path = entity.getPath() + "/data2.js";
+        boolean file = FileUtil.isFile(data2Path);
+        if (!file) {
+            log.error("data2.js文件不存在");
+            return Result.failure("data2.js文件不存在");
+        }
+
+        String data2 = FileUtil.readUtf8String(data2Path);
+        JSONObject data2Json = JSONObject.parseObject(data2);
+
+        String tourAudio = param.getTourAudio();
+        if (tourAudio != null) {
+            data2Json.put("tourAudio", JSONObject.parseObject(tourAudio));
+//            data2Json.put("tourAudio", tourAudio);
+        }
+
+        String overlays = param.getOverlays();
+        if (overlays != null) {
+            data2Json.put("overlays", JSONObject.parseObject(overlays));
+//            data2Json.put("overlays", overlays);
+        }
+
+        String hots = param.getHots();
+        if (hots != null) {
+            data2Json.put("hots", JSONObject.parseObject(hots));
+//            data2Json.put("hots", hots);
+        }
+
+        // 处理guidesArray,将scan_id的值作为key, value:  time":40000
+        JSONObject audioJson = new JSONObject();
+        JSONObject timeJson = new JSONObject();
+        timeJson.put("time", 40000);
+        if (guidesArray != null) {
+
+            for (int i = 0; i < guidesArray.size() ; i++) {
+                JSONObject metadata = guidesArray.getJSONObject(i).getJSONObject("metadata");
+                if (metadata != null) {
+                    String scanId = metadata.getString("scan_id");
+                    audioJson.put(scanId, timeJson);
+                }
+            }
+
+            data2Json.put("audio", audioJson);
+        }
+
+
+        // 删除旧data2.js
+        FileUtil.del(data2Path);
+        // 写入新data2.js
+        FileUtil.writeUtf8String(data2Json.toJSONString(), data2Path);
+        log.info("新data2.js写入完成");
+
+
+
+        return Result.success();
+    }
+
+
+
+    @ApiOperation(value = "上传", notes = "编辑场景使用,根据场景码位置上传")
+    @PostMapping(value = "upload/{sceneCode}", consumes = {"multipart/form-data"})
+    public Result upload(MultipartFile file , @PathVariable String sceneCode) throws IOException {
+
+        if (file == null) {
+            log.error("文件不能为空");
+            return Result.failure("文件不能为空");
+        }
+
+        SceneEntity entity = sceneService.findBySceneCode(sceneCode);
+        if (entity == null) {
+            log.error("场景不存在: {}", sceneCode);
+            return Result.failure("场景不存在");
+        }
+
+        String fileName = file.getOriginalFilename();
+        String savePath = entity.getPath() + "/edit/" + fileName;
+        FileUtil.writeFromStream(file.getInputStream(), savePath);
+
+        Object urlPath = SERVER_DOMAIN + "data/" + sceneCode + "/edit/" + fileName;
+        log.info("文件写入成功: {}", urlPath);
+
+        // 返回前端数据
+        return Result.success(urlPath);
+
+    }
 
 
 }

+ 28 - 8
gis_web/src/main/java/com/gis/web/controller/FileController.java

@@ -10,12 +10,15 @@ import com.gis.service.FileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import springfox.documentation.annotations.ApiIgnore;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,9 +42,9 @@ public class FileController extends BaseController {
      * @return
      * @throws IOException
      */
-    @ApiOperation("上传")
+    @ApiOperation(value = "上传", notes = "需要生成缩略图:thumb: true, 不需要:thumb: false")
     @PostMapping(value = "upload", consumes = {"multipart/form-data"})
-    public Result upload(MultipartFile file ) throws IOException {
+    public Result upload(MultipartFile file, boolean thumb ) throws IOException {
 
         if (file == null) {
             log.error("文件不能为空");
@@ -49,7 +52,8 @@ public class FileController extends BaseController {
         }
 
         // 写入本地服务器
-        HashMap<String, String> fileInfo = FileUtils.upload(file, FILE_PATH);
+        String basePath = FILE_PATH + "media/";
+        HashMap<String, String> fileInfo = FileUtils.upload(file, basePath);
 
 
         // 保存db
@@ -60,15 +64,25 @@ public class FileController extends BaseController {
         entity.setFilePath(filePath);
 
         String newName = fileInfo.get("newName");
-        String urlPath = SERVER_DOMAIN+"data/" + newName;
+        String urlPath = SERVER_DOMAIN+"data/media/" + newName;
         entity.setUrlPath(urlPath);
+        log.info("文件生成完成: {}", urlPath);
 
         // 生成缩略图
-        String thumbPath = FILE_PATH + "thumb_" + newName;
-        createThumb(filePath, thumbPath);
+        if (thumb) {
+
+            if (!ifImage(newName)) {
+                log.error("不是图片格式,不能生成缩略图: {}", newName);
+                return Result.failure("不是图片格式,不能生成缩略图");
+            }
+
+            String thumbPath = basePath + "thumb_" + newName;
+            createThumb(filePath, thumbPath);
+
+            String thumbUrl = SERVER_DOMAIN+"data/media/thumb_" + newName;
+            entity.setThumb(thumbUrl);
+        }
 
-        String thumbUrl = SERVER_DOMAIN+"data/thumb_" + newName;
-        entity.setThumb(thumbUrl);
 
         fileService.save(entity);
 
@@ -161,5 +175,11 @@ public class FileController extends BaseController {
     }
 
 
+//    @Test
+    private boolean ifImage(String fileName){
+        String s = StringUtils.substringAfterLast(fileName, ".");
+        List<String> strings = Arrays.asList("jpg", "png","jpeg");
+        return strings.contains(s);
+    }
 
 }

+ 46 - 11
gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -7,6 +7,7 @@ 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.mapper.SceneMapper;
 import com.gis.service.SceneService;
 import com.github.pagehelper.PageInfo;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
@@ -17,13 +18,15 @@ 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
  */
 @Log4j2
-@Api(tags = "场景管理")
+@Api(tags = "场景")
 @ApiSort(value = 2)
 @RestController
 @RequestMapping("manage/scene")
@@ -32,9 +35,12 @@ public class SceneController extends BaseController {
     @Autowired
     private SceneService sceneService;
 
+    @Autowired
+    private SceneMapper sceneMapper;
+
 
 
-    @ApiOperation("列表")
+    @ApiOperation("场景列表")
     @PostMapping("list")
     public Result<SceneEntity> list(@RequestBody PageDto param) {
 
@@ -43,15 +49,15 @@ public class SceneController extends BaseController {
         return Result.success(page);
     }
 
-    @ApiOperation("编辑场景")
+    @ApiOperation("场景编辑")
     @PostMapping("edit")
     public Result edit(@Valid @RequestBody SceneDataDto param) {
 
         SceneEntity entity = sceneService.findBySceneCode(param.getSceneCode());
         if (entity == null) {
             log.error("场景不存在 : {}", param.getSceneCode());
-                return Result.failure("场景不存在");
-            }
+            return Result.failure("场景不存在");
+        }
 
 
 
@@ -83,9 +89,10 @@ public class SceneController extends BaseController {
             // 处理model
             JSONObject model = someDataJson.getJSONObject("model");
             if (model != null) {
-                model.put("name", infoJson.getJSONObject("name"));
-                model.put("summary", infoJson.getJSONObject("summary"));
+                model.put("name", infoJson.get("name"));
+                model.put("summary", infoJson.get("summary"));
                 model.put("camera_start", infoJson.getJSONObject("camera_start"));
+//                model.put("camera_start", infoJson.get("camera_start"));
 
                 if (guidesArray != null) {
                     model.put("images", guidesArray);
@@ -96,7 +103,7 @@ public class SceneController extends BaseController {
 
             // 更新someDataJson
             someDataJson.put("model", model);
-            someDataJson.put("loadlogo", infoJson.getJSONObject("loadlogo"));
+            someDataJson.put("loadlogo", infoJson.get("loadlogo"));
 
             // 删除旧someDataJson
             FileUtil.del(someDataPath);
@@ -119,16 +126,19 @@ public class SceneController extends BaseController {
         String tourAudio = param.getTourAudio();
         if (tourAudio != null) {
             data2Json.put("tourAudio", JSONObject.parseObject(tourAudio));
+//            data2Json.put("tourAudio", tourAudio);
         }
 
         String overlays = param.getOverlays();
         if (overlays != null) {
             data2Json.put("overlays", JSONObject.parseObject(overlays));
+//            data2Json.put("overlays", overlays);
         }
 
         String hots = param.getHots();
         if (hots != null) {
             data2Json.put("hots", JSONObject.parseObject(hots));
+//            data2Json.put("hots", hots);
         }
 
         // 处理guidesArray,将scan_id的值作为key, value:  time":40000
@@ -161,17 +171,22 @@ public class SceneController extends BaseController {
     /**
      * 素材文件,真删除
      */
-    @ApiOperation("删除")
+    @ApiOperation("场景删除")
     @GetMapping("removes/{ids}")
     public Result detail(@PathVariable String ids) {
-
+        List<SceneEntity> entities = sceneService.findByIds(ids);
+        for (SceneEntity entity: entities) {
+            entity.setRecStatus("I");
+            entity.setUpdateTime(new Date());
+            sceneService.update(entity);
+        }
 
         return Result.success();
     }
 
 
 
-    @ApiOperation("详情")
+    @ApiOperation("场景详情")
     @GetMapping("detail/{id}")
     public Result detail(@PathVariable Long id) {
         SceneEntity entity = sceneService.findById(id);
@@ -183,5 +198,25 @@ public class SceneController extends BaseController {
     }
 
 
+    /**
+     * 只有一个场景是显示状态
+     */
+    @ApiOperation("场景显示")
+    @GetMapping("display/{id}")
+    public Result display(@PathVariable Long id) {
+        SceneEntity entity = sceneService.findById(id);
+        if (entity == null) {
+            log.error("对象id不存在 : {}", id);
+            return Result.failure("对象id不存在");
+        }
+
+        // 把所有禁止
+        sceneMapper.setDisable();
+        // 开启对应id
+        sceneMapper.setDisplay(id);
+
+        return Result.success();
+    }
+
 
 }

+ 123 - 0
gis_web/src/main/java/com/gis/web/controller/VideoController.java

@@ -0,0 +1,123 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.VideoDto;
+import com.gis.domain.po.NewsEntity;
+import com.gis.domain.po.VideoEntity;
+import com.gis.domain.vo.VideoVo;
+import com.gis.mapper.VideoMapper;
+import com.gis.service.VideoService;
+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 tk.mybatis.mapper.entity.Condition;
+
+import javax.validation.Valid;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/5/8 0008 9:54
+ */
+@Log4j2
+@Api(tags = "大场景")
+@RestController
+@RequestMapping("manage/video")
+public class VideoController extends BaseController {
+
+    @Autowired
+    private VideoService videoService;
+
+    @Autowired
+    private VideoMapper videoMapper;
+
+
+
+    @ApiOperation("视频列表")
+    @PostMapping("list")
+    public Result<VideoVo> list(@RequestBody PageDto param) {
+
+        startPage(param);
+        PageInfo<VideoVo> page = new PageInfo<>(videoService.search(param));
+        return Result.success(page);
+    }
+
+    @ApiOperation("视频新增/修改")
+    @PostMapping("save")
+    public Result save(@Valid @RequestBody VideoDto param) {
+
+        VideoEntity entity = null;
+        if (param.getId() == null) {
+            entity = new VideoEntity();
+            BeanUtils.copyProperties(param, entity);
+            entity.setSubmitId(getTokenUserId());
+            videoService.save(entity);
+        } else {
+            entity = videoService.findById(param.getId());
+            if (entity == null) {
+                return Result.failure("对象id不存在");
+            }
+
+            BeanUtils.copyProperties(param, entity);
+            entity.setUpdateTime(new Date());
+            videoService.update(entity);
+        }
+
+        return Result.success();
+    }
+
+
+
+    @ApiOperation("视频删除")
+    @GetMapping("removes/{ids}")
+    public Result detail(@PathVariable String ids) {
+        List<VideoEntity> entities = videoService.findByIds(ids);
+        for (VideoEntity entity: entities) {
+            entity.setRecStatus("I");
+            entity.setUpdateTime(new Date());
+            videoService.update(entity);
+        }
+        return Result.success();
+    }
+
+
+
+    @ApiOperation("视频详情")
+    @GetMapping("detail/{id}")
+    public Result detail(@PathVariable Long id) {
+        VideoEntity entity = videoService.findById(id);
+        if (entity == null) {
+            log.error("对象id不存在 : {}", id);
+            return Result.failure("对象id不存在");
+        }
+        return Result.success(entity);
+    }
+
+
+    /**
+     * 只有一个视频是显示状态
+     */
+    @ApiOperation("视频显示")
+    @GetMapping("display/{id}")
+    public Result display(@PathVariable Long id) {
+        VideoEntity entity = videoService.findById(id);
+        if (entity == null) {
+            log.error("对象id不存在 : {}", id);
+            return Result.failure("对象id不存在");
+        }
+
+        // 把所有禁止
+        videoMapper.setDisable();
+        // 开启对应id
+        videoMapper.setDisplay(id);
+
+        return Result.success();
+    }
+
+
+}

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

@@ -1,12 +1,14 @@
 package com.gis.web.controller;
 
 
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.gis.common.util.FileUtils;
 import com.gis.common.util.Result;
-import com.gis.domain.dto.GoodsPageDateDto;
-import com.gis.domain.dto.NewsPageDateRequest;
-import com.gis.domain.dto.SlideshowPageDateDto;
-import com.gis.domain.dto.SpiritPageDateDto;
+import com.gis.domain.dto.*;
 import com.gis.domain.po.MenuEntity;
+import com.gis.domain.po.SceneEntity;
+import com.gis.domain.po.VideoEntity;
 import com.gis.domain.po.ViewEntity;
 import com.gis.domain.vo.GoodsVo;
 import com.gis.domain.vo.NewsVo;
@@ -19,10 +21,13 @@ 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 tk.mybatis.mapper.entity.Condition;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -49,6 +54,12 @@ public class WebController extends BaseController {
     @Autowired
     private MenuService menuService;
 
+    @Autowired
+    private SceneService sceneService;
+
+    @Autowired
+    private VideoService videoService;
+
 
     @Autowired
     private SlideshowService slideshowService;
@@ -63,6 +74,14 @@ public class WebController extends BaseController {
         return Result.success(tree);
     }
 
+    @ApiOperation("搜索")
+    @PostMapping("search")
+    public Result<NewsVo> search(@RequestBody PageDto param) {
+        startPage(param);
+        PageInfo<NewsVo> page = new PageInfo<>(newsService.webSearch(param));
+        return Result.success(page);
+    }
+
 
 
     @ApiOperation("保存访问")
@@ -162,18 +181,42 @@ public class WebController extends BaseController {
     }
 
 
-    @ApiOperation(value = "数字史馆")
+    @ApiOperation(value = "数字史馆-场景")
     @GetMapping("scene")
-    public Result<GoodsVo> scene(@PathVariable Integer type) {
-
-        return Result.success();
+    public Result scene() {
+        Condition condition = new Condition(SceneEntity.class);
+        condition.and().andEqualTo("display", 1);
+        List<SceneEntity> all = sceneService.findAll(condition);
+        return Result.success(all);
     }
 
 
+    @ApiOperation(value = "数字史馆-视频")
+    @GetMapping("video")
+    public Result video() {
 
+        Condition condition = new Condition(VideoEntity.class);
+        condition.and().andEqualTo("display", 1);
+        List<VideoEntity> all = videoService.findAll(condition);
+
+        return Result.success(all);
+    }
 
 
+    public static void main(String[] args) throws IOException {
+        String resourceUrl = FileUtils.getResourceUrl("data/smokeing.json");
 
+        String data = FileUtil.readUtf8String(resourceUrl);
+
+        JSONObject jsonObject = JSONObject.parseObject(data);
+
+        JSONObject reportedJaon = jsonObject.getJSONObject("reported");
+        String batteryPower = reportedJaon.getString("batteryPower");
+        log.info("batteryPower:{}", batteryPower);
+        String replace = batteryPower.replace("%", "");
+        Integer power = Integer.valueOf(replace);
+        System.out.println(power);
+    }
 
 
 

+ 9 - 0
help.md

@@ -11,6 +11,15 @@
         <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" />
         
+        
+     编辑场景url:
+     http://192.168.0.44:8101/edit-backstage/edit.html?m=ar_jvWeBmEgQ
+     
+     
+     场景展现url:
+     http://192.168.0.44:8101/SuperTwo/index.html?m=ar_jvWeBmEgQ
+        
+        
  #data文件夹
  
         --ar_WTJ1ooJDD 场景码