Forráskód Böngészése

修复2k照片生成模型的场景打不开的问题

houweiyu 4 éve
szülő
commit
71a039f505

+ 11 - 2
fdkanfang-web/src/main/java/com/fdkanfang/web/backend/HouseController.java

@@ -211,6 +211,7 @@ public class HouseController extends BaseController {
             HashMap<String, String> ossVerticalImageLowMap = new HashMap<>();
             String imageHighPath = null;
             String imageLowPath = null;
+            ImageResolutionRate maxTotalResolutionRate =  null;
             for (String filename : fileNames) {
                 JSONObject jsonObject = JSON.parseObject(filename);
                 if(null == jsonObject){
@@ -276,7 +277,13 @@ public class HouseController extends BaseController {
                 }
                 ImageResolutionRate maxResolutionRate = ImageResolutionRate.getResolutionRateByRate(totalResolutinRate);
                 log.info("照片{}的像素为:{}" , newFilePath , totalResolutinRate);
-
+                if(null == maxTotalResolutionRate){
+                    maxTotalResolutionRate = maxResolutionRate;
+                }else{
+                    if(null != maxResolutionRate && maxResolutionRate.getRate() > maxTotalResolutionRate.getRate()){
+                        maxTotalResolutionRate = maxResolutionRate;
+                    }
+                }
                 addNewImage(param.getId() , newFileName , newFilePath , ossVerticalLowPath, maxResolutionRate);
                 // 封装垂直校验后的图片到信息到oss,key为照片在本地的路径,value为照片在oss中的目录路径
                 //给四维看看的前端加载使用
@@ -285,7 +292,9 @@ public class HouseController extends BaseController {
                 ossVerticalImageLowMap.put(imageLowPath, ossVerticalLowPath);   //sketch用的,文件适中
                 needSendMqMsg = true;
             }
-            insertScene(param.getImageMaxRate() , house);
+            String imageRateStr = null != maxTotalResolutionRate ? maxTotalResolutionRate.name() : "";
+            log.info("计算得到的照片最大分辨率为:{}" , imageRateStr);
+            insertScene(imageRateStr , house);
             if (needSendMqMsg) {
                 HashMap<Object, Object> mqMap = new HashMap<>();
                 mqMap.put("ossImageHigh", ossVerticalImageHighMap);