From c19e0d4d1ab47905f7e7f7a334691704f7fed422 Mon Sep 17 00:00:00 2001
From: aix <vip_xiaobin810@163.com>
Date: Thu, 08 Aug 2024 16:22:02 +0800
Subject: [PATCH] 国土调查云获取token接口
---
src/main/java/com/dji/sample/territory/controller/TbFjController.java | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/dji/sample/territory/controller/TbFjController.java b/src/main/java/com/dji/sample/territory/controller/TbFjController.java
index ee3a4c2..660aafd 100644
--- a/src/main/java/com/dji/sample/territory/controller/TbFjController.java
+++ b/src/main/java/com/dji/sample/territory/controller/TbFjController.java
@@ -1,4 +1,5 @@
package com.dji.sample.territory.controller;
+
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.media.model.MediaFileEntity;
import com.dji.sample.patches.model.entity.LotInfo;
@@ -10,6 +11,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+
import java.io.IOException;
import java.util.List;
@@ -21,19 +23,29 @@
@Autowired
private ITbFJService tbFJService;
@Autowired
- private GetPatchesService getPatches;
+ private GetPatchesService getPatchesService;
+ /**
+ * 将地块所保留的照片、视频信息保存到sqlite
+ *
+ * @param dkbh
+ * @param workspaceId
+ * @return
+ * @throws IOException
+ */
@PostMapping("/insertDb")
- public ResponseResult insertDb(String dkbh, String workspaceId) throws IOException {
- List<MediaFileEntity> list = getPatches.listPohto(dkbh, workspaceId);
- if(list.size()==0){
- return ResponseResult.error("未找到该照片、视频信息");}
- LotInfo lotInfo = getPatches.getLotinfo(dkbh, workspaceId);
- if(lotInfo==null){
- return ResponseResult.error("未找到该图斑信息");}
- TbFjEntity entity=tbFJService.insertData(list, lotInfo);
- if (entity!=null){
- return ResponseResult.success("上传成功");
+ public ResponseResult insertDb(String dkbh, String workspaceId) throws Exception {
+ List<MediaFileEntity> list = getPatchesService.listPohto(dkbh, workspaceId);
+ if (list.size() == 0) {
+ return ResponseResult.error("未找到该照片、视频信息");
+ }
+ LotInfo lotInfo = getPatchesService.getLotinfo(dkbh, workspaceId);
+ if (lotInfo == null) {
+ return ResponseResult.error("未找到该图斑信息");
+ }
+ int num = tbFJService.insertData(list, lotInfo);
+ if (num != 0) {
+ return ResponseResult.success("上传成功,上传了" + num + "个文件");
}
return ResponseResult.error("上传失败");
}
--
Gitblit v1.9.3