|
@@ -1,10 +1,12 @@
|
|
package com.gis.web.controller;
|
|
package com.gis.web.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.gis.common.constant.MsgCode;
|
|
import com.gis.common.util.Result;
|
|
import com.gis.common.util.Result;
|
|
import com.gis.domain.dto.*;
|
|
import com.gis.domain.dto.*;
|
|
import com.gis.domain.entity.CatalogEntity;
|
|
import com.gis.domain.entity.CatalogEntity;
|
|
import com.gis.domain.entity.FodderEntity;
|
|
import com.gis.domain.entity.FodderEntity;
|
|
|
|
+import com.gis.domain.entity.SceneEntity;
|
|
import com.gis.domain.entity.WorkEntity;
|
|
import com.gis.domain.entity.WorkEntity;
|
|
import com.gis.service.FodderService;
|
|
import com.gis.service.FodderService;
|
|
import com.gis.service.SceneService;
|
|
import com.gis.service.SceneService;
|
|
@@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -29,12 +32,14 @@ import java.util.Date;
|
|
@Api(tags = "我的素材")
|
|
@Api(tags = "我的素材")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("manage/fodder")
|
|
@RequestMapping("manage/fodder")
|
|
-//@RequestMapping("aa/fodder")
|
|
|
|
public class FodderController extends BaseController {
|
|
public class FodderController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private FodderService fodderService;
|
|
private FodderService fodderService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ SceneService sceneService;
|
|
|
|
+
|
|
@ApiOperation(value = "上传素材", notes = "type:类型, 全景图:pano, 图片:image, 音频:audio, 视频:video")
|
|
@ApiOperation(value = "上传素材", notes = "type:类型, 全景图:pano, 图片:image, 音频:audio, 视频:video")
|
|
@PostMapping("upload/{type}")
|
|
@PostMapping("upload/{type}")
|
|
public Result upload(MultipartFile file, @PathVariable String type) {
|
|
public Result upload(MultipartFile file, @PathVariable String type) {
|
|
@@ -68,8 +73,18 @@ public class FodderController extends BaseController {
|
|
public Result remove( @PathVariable Long id) {
|
|
public Result remove( @PathVariable Long id) {
|
|
FodderEntity entity = fodderService.findById(id);
|
|
FodderEntity entity = fodderService.findById(id);
|
|
if (entity == null) {
|
|
if (entity == null) {
|
|
- return Result.success();
|
|
|
|
|
|
+ return Result.failure("对象不存在, id: " + id);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 检查全景图是否被引用
|
|
|
|
+ if ("pano".equals(entity.getType())) {
|
|
|
|
+ List<SceneEntity> list = sceneService.findBySceneCode(entity.getSceneCode());
|
|
|
|
+ if (list.size() > 0) {
|
|
|
|
+ log.error("场景已使用,不能删除");
|
|
|
|
+ return Result.failure(MsgCode.e3001, MsgCode.m3001);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
entity.setIsDelete(1);
|
|
entity.setIsDelete(1);
|
|
entity.setUpdateTime(new Date());
|
|
entity.setUpdateTime(new Date());
|
|
fodderService.update(entity);
|
|
fodderService.update(entity);
|