|
@@ -57,6 +57,12 @@ public class SceneController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 先获取场景码,再上传
|
|
|
+ * @param sceneCode
|
|
|
+ * @return
|
|
|
+ * @throws QiniuException
|
|
|
+ */
|
|
|
@ApiOperation("创建场景码")
|
|
|
@GetMapping("createSceneCode/{sceneCode}")
|
|
|
public Result createSceneCode(@PathVariable String sceneCode) throws QiniuException {
|
|
@@ -65,8 +71,6 @@ public class SceneController extends BaseController {
|
|
|
return Result.failure("场景码不能为空");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 场景url
|
|
|
String webSite = SERVER_DOMAIN + "SuperTwo/index.html?m=" + sceneCode;
|
|
|
log.info("webSite: {}", webSite);
|
|
@@ -93,6 +97,7 @@ public class SceneController extends BaseController {
|
|
|
SceneEntity entity = sceneService.findBySceneCode(sceneCode);
|
|
|
if (entity == null) {
|
|
|
entity = new SceneEntity();
|
|
|
+ // 场景码数据库设置唯一
|
|
|
entity.setSceneCode(sceneCode);
|
|
|
entity.setWebSite(webSite);
|
|
|
entity.setPath(serverPath);
|
|
@@ -101,11 +106,25 @@ public class SceneController extends BaseController {
|
|
|
sceneService.save(entity);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return Result.success(entity);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "场景上传过程中删除",notes = "上传过程中取消时删除文件记录")
|
|
|
+ @GetMapping("delete/{id}")
|
|
|
+ public Result delete(@PathVariable Long id) {
|
|
|
+ SceneEntity entity = sceneService.findById(id);
|
|
|
+ if (entity == null) {
|
|
|
+ log.error("对象不存在 : {}", id);
|
|
|
+ Result.failure("对象不存在");
|
|
|
+ }
|
|
|
+ FileUtil.del(entity.getPath());
|
|
|
+
|
|
|
+ // 七牛的文件会覆盖安装,这里不做处理
|
|
|
+ sceneService.delete(entity);
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -413,10 +432,8 @@ public class SceneController extends BaseController {
|
|
|
val = a;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
subJson.put(s, val);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 删除infoAttribute
|