From 0abe157e660dea46eb50cfb6e8064ec583cba75f Mon Sep 17 00:00:00 2001
From: ke <893754509@qq.com>
Date: Sun, 19 May 2024 15:43:37 +0800
Subject: [PATCH] 全景图更新切图功能kl  5-19 15

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java
index 8733293..7e5c00d 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java
@@ -45,6 +45,8 @@
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import cn.gistack.sm.skPanorama.entity.SkPanoramaEntity;
@@ -85,6 +87,7 @@
 	/**
 	 * 对象存储构建类
 	 */
+	@Autowired
 	private final IOssClient iOssClient;
 
 
@@ -274,7 +277,7 @@
 	public R cutPicture2(SkPanoramaEntity skPanorama)
 		throws IOException, InterruptedException, IM4JavaException, IllegalAccessException {
 
-		SkPanoramaEntity entity = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
+		SkPanoramaEntity entity = skPanoramaService.getById(skPanorama.getId());
 		String picUrl = entity.getPicUrl();
 		String picName = entity.getPicName();
 		String resGuid = entity.getResGuid();
@@ -283,7 +286,7 @@
 		String dirPath = linShiBaseUrl + resGuid + "/"; //临时文件夹路径
 		String lingshiPic = linShiBaseUrl + resGuid + "/" + picName; //临时文件
 
-		File lingshiqjfile = getquanjingFile(dirPath,lingshiPic,entity);
+		File lingshiqjfile = getquanjingFile(dirPath,lingshiPic,entity.getId());
 
 		/**
 		 * 这里开始切图
@@ -359,8 +362,10 @@
 		return R.status(true);
 	}
 
-	private File getquanjingFile (String dirPath ,String linshiUrl , SkPanoramaEntity skPanorama) throws IOException {
-		SkPanoramaEntity entity = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
+	private File getquanjingFile (String dirPath ,String linshiUrl , Long id) throws IOException {
+
+//		SkPanoramaEntity entity = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
+		SkPanoramaEntity entity = skPanoramaService.getById(id);
 		String picUrl = entity.getPicUrl();
 		String picName = entity.getPicName();
 		String resGuid = entity.getResGuid();
@@ -406,9 +411,10 @@
 			for (Long id : idlist ) {
 				FormateTuEntity formateTuEntity = new FormateTuEntity();
 
-				SkPanoramaEntity skPanorama = new SkPanoramaEntity();
-				skPanorama.setId(id);
-				SkPanoramaEntity entity = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
+//				SkPanoramaEntity skPanorama = new SkPanoramaEntity();
+//				skPanorama.setId(id);
+//				SkPanoramaEntity entity = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
+				SkPanoramaEntity entity = skPanoramaService.getById(id);
 				String picUrl = entity.getPicUrl();
 				String picName = entity.getPicName();
 				String resGuid = entity.getResGuid();
@@ -420,7 +426,7 @@
 				String lingshigeshibilipath = linShiformateBaseUrl + resGuid + "/geshibili/" ;
 				String lingshigeshibiliPic = lingshigeshibilipath + picName; //格式化后的临时文件
 
-				File lingshiqjfile = getquanjingFile(dirPath,lingshiPic,entity);
+				File lingshiqjfile = getquanjingFile(dirPath,lingshiPic,id);
 
 				// 创建文件夹
 				File lingshigeshibilidir = new File(lingshigeshibilipath);
@@ -438,7 +444,9 @@
 				Integer height = imgInfoRT.get("height");
 				if (width == height * 2) {
 					// 已经符合格式化标准
-
+					entity.setStatus(PanoramaUtilDict.panorama_status_2);
+					boolean b = skPanoramaService.updateBatchById(panoramalist);
+					return R.status( b);
 				} else {
 					Integer newWidth = height * 2;
 					// 图片格式化
@@ -493,7 +501,7 @@
 
 		boolean b = skPanoramaService.updateBatchById(panoramalist);
 
-		return R.status(true);
+		return R.status( b);
 	}
 
 

--
Gitblit v1.9.3