|
@@ -1,217 +0,0 @@
|
|
|
-package com.gis.web.controller;
|
|
|
-
|
|
|
-
|
|
|
-import com.gis.common.constant.MsgCode;
|
|
|
-import com.gis.common.util.Result;
|
|
|
-import com.gis.domain.dto.*;
|
|
|
-import com.gis.domain.entity.SceneEntity;
|
|
|
-import com.gis.domain.entity.WorkEntity;
|
|
|
-import com.gis.service.FodderService;
|
|
|
-import com.gis.service.SceneService;
|
|
|
-import com.gis.service.WorkService;
|
|
|
-import com.gis.web.aop.WebControllerLog;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import lombok.extern.log4j.Log4j2;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import javax.validation.Valid;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * Created by owen on 2020/2/18 0018 12:17
|
|
|
- *
|
|
|
- * 全景图在素材上传时已经切好
|
|
|
- * 这里只是把关系添加进来
|
|
|
- *
|
|
|
- * 一个场景可以被多个作品绑定
|
|
|
- */
|
|
|
-@Log4j2
|
|
|
-@Api(tags = "场景管理")
|
|
|
-//@RestController
|
|
|
-@RequestMapping("manage/scene")
|
|
|
-//@RequestMapping("aa/scene")
|
|
|
-public class SceneController extends BaseController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SceneService sceneService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- FodderService fodderService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- WorkService workService;
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "保存关联场景热点", position = 1, notes = "sceneCodes:场景关联的场景码")
|
|
|
- @PostMapping("save/useHots")
|
|
|
- public Result saveUseHots(@Valid @RequestBody UseHotsDto param) {
|
|
|
- return sceneService.saveUseHots(param);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "选择三维场景", position = 1)
|
|
|
- @PostMapping("select/4dkk/{workId}")
|
|
|
- public Result select4dkk(@RequestBody PageDto param, @PathVariable Long workId) {
|
|
|
- return sceneService.select4dkk(param, workId);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("场景详情")
|
|
|
- @GetMapping("detail/{id}")
|
|
|
- public Result detail(@PathVariable Long id) {
|
|
|
- SceneEntity entity = sceneService.findById(id);
|
|
|
- if (entity == null) {
|
|
|
- log.error("对象不存在, 场景ID:{}", id);
|
|
|
- return Result.failure("对象不存在");
|
|
|
- }
|
|
|
- return Result.success(entity);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "批量场景新增/修改", position = 1, notes = "注意创建目录层次问题, 有parentId表示有父级,有catalogId则更新,否则新建分组 ")
|
|
|
- @PostMapping("saves")
|
|
|
- public Result saves(@RequestBody CatalogSceneDto param) {
|
|
|
- return sceneService.saves(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "重命名场景名称", position = 1)
|
|
|
- @PostMapping("edit")
|
|
|
- public Result edit(@Valid @RequestBody BaseDto param) {
|
|
|
- return sceneService.editEntity(param);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查询该作品是否存在场景")
|
|
|
- @GetMapping("findByWork/{workId}")
|
|
|
- public Result findByWorkId(@PathVariable Long workId) {
|
|
|
- List<SceneEntity> list = sceneService.findByWorkId(workId);
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "上传-图标", position = 2)
|
|
|
- @PostMapping(value = "upload")
|
|
|
- public Result upload(@RequestParam("file") MultipartFile file) {
|
|
|
- log.info("上传图片");
|
|
|
- return sceneService.upload(file);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @WebControllerLog(description = "场景管理-场景排序")
|
|
|
- @ApiOperation(value = "场景排序")
|
|
|
- @PostMapping(value = "setSort")
|
|
|
- public Result setSort(@RequestBody Map<String, String> param) {
|
|
|
- log.info("场景排序");
|
|
|
- return sceneService.setSort(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @WebControllerLog(description = "场景管理-编辑场景")
|
|
|
- @ApiOperation(value = "编辑someData,(重命名)", position = 3)
|
|
|
- @PostMapping("editSomeData")
|
|
|
- public Result editSomeData(@Valid @RequestBody EditSomeDataDto param) {
|
|
|
- return sceneService.editSomeData(param);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "初始场景-设置", position = 3)
|
|
|
- @PostMapping("setIndex/{id}/{workId}")
|
|
|
- public Result setIndex(@PathVariable String id, @PathVariable Long workId) {
|
|
|
- return sceneService.setIndex(id, workId);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "初始场景-获取", position = 3)
|
|
|
- @GetMapping("getIndex/{workId}")
|
|
|
- public Result getIndex(@PathVariable Long workId) {
|
|
|
- return sceneService.getIndex(workId);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "初始场景-删除", position = 3)
|
|
|
- @GetMapping("removeIndex/{workId}")
|
|
|
- public Result removeIndex(@PathVariable Long workId) {
|
|
|
- WorkEntity entity = workService.findById(workId);
|
|
|
- entity.setSceneIndex("");
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- workService.update(entity);
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @WebControllerLog(description = "场景管理-保存初始画面")
|
|
|
- @ApiOperation("保存初始画面")
|
|
|
- @PostMapping("saveIndex")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "id", value = "场景id", dataType = "String", required = true),
|
|
|
- @ApiImplicitParam(name = "icon", value = "iconURL", dataType = "String", required = true)
|
|
|
- })
|
|
|
- public Result saveIndex(@RequestParam Long id, @RequestParam String icon) {
|
|
|
- log.info("保存初始画面");
|
|
|
- SceneEntity entity = sceneService.findByIdForUpdate(id);
|
|
|
- if (entity == null) {
|
|
|
- log.error("对象不存在: {}", id);
|
|
|
- return Result.failure("对象不存在");
|
|
|
- }
|
|
|
-
|
|
|
- entity.setIcon(icon);
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- sceneService.update(entity);
|
|
|
- log.info("更新初始画面成功");
|
|
|
-
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("保存初始角度")
|
|
|
- @PostMapping("editXml")
|
|
|
- public Result editXml(@Valid @RequestBody XmlDataDto param) {
|
|
|
- return sceneService.editXml(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @WebControllerLog(description = "场景管理-场景删除")
|
|
|
- @ApiOperation("场景删除")
|
|
|
- @GetMapping("remove/{id}")
|
|
|
- public Result remove(@PathVariable Long id) {
|
|
|
- log.info("场景删除");
|
|
|
-
|
|
|
- // 最后一个场景不能删除
|
|
|
- SceneEntity entity = sceneService.findById(id);
|
|
|
- List<SceneEntity> list = sceneService.findByWorkId(entity.getWorkId());
|
|
|
- if (list.size() == 1) {
|
|
|
- return Result.failure(MsgCode.e3002,"请至少保留一个场景");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- Long workId = entity.getWorkId();
|
|
|
- entity.setIsDelete(1);
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- sceneService.update(entity);
|
|
|
-
|
|
|
- // 检查此场景id是否为初始场景,如是:设置为null;
|
|
|
- WorkEntity workEntity = workService.findById(workId);
|
|
|
-
|
|
|
- if (workEntity != null || workEntity.getSceneIndex().equals(id) ) {
|
|
|
- workEntity.setSceneIndex("");
|
|
|
- workEntity.setUpdateTime(new Date());
|
|
|
- workService.update(workEntity);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|