|
@@ -13,15 +13,21 @@ import fcb.project.manager.base.utils.DataUtils;
|
|
|
import fdage.back.sdk.base.entity.Result;
|
|
|
import fdage.back.sdk.base.enums.ResultCodeEnum;
|
|
|
import fdage.back.sdk.base.exception.CommonBaseException;
|
|
|
+import fdage.back.sdk.core.alibabaUtils.AlibabaOssHelper;
|
|
|
+import fdage.back.sdk.utils.FileUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.shiro.authz.annotation.Logical;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
@@ -47,6 +53,24 @@ public class HouseManagerController {
|
|
|
@Autowired
|
|
|
private TmEstateServiceImpl tmEstateService;
|
|
|
|
|
|
+ @Value("${image.local.path}")
|
|
|
+ private String imageLocalPath;
|
|
|
+
|
|
|
+ @Value("${vr.scene.host}")
|
|
|
+ private String sceneVrHost;
|
|
|
+
|
|
|
+ @Value("${vr.scene.link}")
|
|
|
+ private String sceneVrLink;
|
|
|
+
|
|
|
+ @Value("${share.logo.oss.path}")
|
|
|
+ private String ossPath;
|
|
|
+
|
|
|
+ @Value("${oss.query.url}")
|
|
|
+ private String ossQueryUrl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AlibabaOssHelper alibabaOssHelper;
|
|
|
+
|
|
|
@GetMapping("/queryOrSearchList")
|
|
|
@ApiOperation(value = "根据条件拉取所有楼盘")
|
|
|
@ApiImplicitParams({
|
|
@@ -73,6 +97,85 @@ public class HouseManagerController {
|
|
|
resultPage.getCurrent(), resultPage.getRecords()));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/getQrImage")
|
|
|
+ @ApiOperation(value = "根据房源ID获取房源分享二维码")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "houseId", value = "房源ID", paramType = "query", required = true, dataType = "String"),
|
|
|
+ })
|
|
|
+ public Result<Object> getQrImage(@RequestParam(required = true) String houseId){
|
|
|
+ if(StringUtils.isBlank(houseId)){
|
|
|
+ return Result.failure("房源ID不能为空");
|
|
|
+ }
|
|
|
+ TmHouse tmHouse = tmHouseService.getById(houseId);
|
|
|
+ if(null == tmHouse || tmHouse.getIsDelete().compareTo(1) == 0){
|
|
|
+ return Result.failure("房源不存在");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(tmHouse.getSceneNum())){
|
|
|
+ return Result.failure("改房源未生成场景码");
|
|
|
+ }
|
|
|
+ String totalVrUrl = sceneVrHost + sceneVrLink + tmHouse.getId() + "&s=" + tmHouse.getSceneNum();
|
|
|
+ String localPath = imageLocalPath + "logo.png";
|
|
|
+ String outPutImageName = System.currentTimeMillis() + ".jpg";
|
|
|
+ String outPutImageResultPath = imageLocalPath + outPutImageName;
|
|
|
+ try {
|
|
|
+ DataUtils.createQRCode(totalVrUrl , outPutImageResultPath , localPath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.info("生成分享二维码出现异常");
|
|
|
+ return Result.failure("生成分享二维码出现异常");
|
|
|
+ }
|
|
|
+ String resultOssPath = ossPath + outPutImageName;
|
|
|
+ alibabaOssHelper.doUploadThenDelete(outPutImageResultPath , resultOssPath);
|
|
|
+ String totalOssQueryPath = ossQueryUrl + resultOssPath;
|
|
|
+
|
|
|
+ Map<String , Object> resultMap = new HashMap<>();
|
|
|
+ resultMap.put("QrCode" , totalOssQueryPath);
|
|
|
+ resultMap.put("vrLink" , totalVrUrl);
|
|
|
+ return Result.success(resultMap);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "上传照片并生成分享二维码")
|
|
|
+ @PostMapping("/uploadImage")
|
|
|
+ public Result uploadIntroduceVideo(@RequestParam("file") MultipartFile file , @RequestParam(required = true) String houseId) {
|
|
|
+ if (null == file) {
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "文件缺失");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(houseId)){
|
|
|
+ return Result.failure("房源ID不能为空");
|
|
|
+ }
|
|
|
+ TmHouse tmHouse = tmHouseService.getById(houseId);
|
|
|
+ if(null == tmHouse || tmHouse.getIsDelete().compareTo(1) == 0){
|
|
|
+ return Result.failure("房源不存在");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(tmHouse.getSceneNum())){
|
|
|
+ return Result.failure("改房源未生成场景码");
|
|
|
+ }
|
|
|
+
|
|
|
+ String localPath = imageLocalPath + file.getOriginalFilename();
|
|
|
+ String downLoanVideoPath = FileUtils.parseFile(file, localPath);
|
|
|
+ log.info("照片文件已经下载到本地:{}", downLoanVideoPath);
|
|
|
+
|
|
|
+ String totalVrUrl = sceneVrHost + sceneVrLink + tmHouse.getId() + "&s=" + tmHouse.getSceneNum();
|
|
|
+ String outPutImageName = System.currentTimeMillis() + ".jpg";
|
|
|
+ String outPutImageResultPath = imageLocalPath + outPutImageName;
|
|
|
+ try {
|
|
|
+ DataUtils.createQRCode(totalVrUrl , outPutImageResultPath , localPath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.info("生成分享二维码出现异常");
|
|
|
+ return Result.failure("生成分享二维码出现异常");
|
|
|
+ }
|
|
|
+ String resultOssPath = ossPath + outPutImageName;
|
|
|
+ alibabaOssHelper.doUploadThenDelete(outPutImageResultPath , resultOssPath);
|
|
|
+ String totalOssQueryPath = ossQueryUrl + resultOssPath;
|
|
|
+
|
|
|
+ Map<String , Object> resultMap = new HashMap<>();
|
|
|
+ resultMap.put("QrCode" , totalOssQueryPath);
|
|
|
+ resultMap.put("vrLink" , totalVrUrl);
|
|
|
+ return Result.success(resultMap);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/getHouseDetail")
|
|
|
@ApiOperation(value = "根据房源ID获取房源详情")
|
|
|
@ApiImplicitParams({
|