houweiyu 4 rokov pred
rodič
commit
985228cc8d

+ 23 - 1
src/main/java/fcb/project/manager/core/controller/HouseManagerController.java

@@ -171,7 +171,7 @@ public class HouseManagerController extends BaseController{
         String totalVrUrl = newOuterSceneVrHost + path;
         log.info("将要生成二维码的链接为:{}" , totalVrUrl);
         String totalOssQueryPath = "";
-        if(StringUtils.isBlank(tmHouse.getQrCode())){
+       /* if(StringUtils.isBlank(tmHouse.getQrCode())){
             String localPath = imageLocalPath + "logo.png";
             String outPutImageName = System.currentTimeMillis() + ".jpg";
             String outPutImageResultPath = imageLocalPath + outPutImageName;
@@ -195,7 +195,29 @@ public class HouseManagerController extends BaseController{
             tmHouseService.updateHouse(tmHouse);
         }else{
             totalOssQueryPath = tmHouse.getQrCode();
+        }*/
+
+        String localPath = imageLocalPath + "logo.png";
+        String outPutImageName = System.currentTimeMillis() + ".jpg";
+        String outPutImageResultPath = imageLocalPath + outPutImageName;
+        File localPathFile = new File(localPath);
+        try {
+            if(!DataUtils.createQRCode(totalVrUrl ,  outPutImageResultPath , localPathFile)){
+                log.info("生成分享二维码失败");
+                return Result.failure("生成分享二维码失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.info("生成分享二维码出现异常");
+            return Result.failure("生成分享二维码出现异常");
         }
+        String resultOssPath = ossPath + outPutImageName;
+        alibabaOssHelper.doUploadThenDelete(outPutImageResultPath , resultOssPath);
+        totalOssQueryPath = ossQueryUrl + resultOssPath;
+
+        tmHouse.setQrCode(totalOssQueryPath);
+        tmHouse.setUpdateTime(LocalDateTime.now());
+        tmHouseService.updateHouse(tmHouse);
 
         Map<String , Object> resultMap = new HashMap<>();
         resultMap.put("QrCode" , totalOssQueryPath);