|
@@ -37,6 +37,8 @@ import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -92,6 +94,8 @@ public class HouseManagerController extends BaseController{
|
|
|
@Autowired
|
|
|
private SceneFeign sceneFeign;
|
|
|
|
|
|
+ public static String IMAGE_PATH = ".+(.JPEG|.jpeg|.JPG|.jpg|.GIF|.gif|.BMP|.bmp|.PNG|.png)";
|
|
|
+
|
|
|
|
|
|
|
|
|
@GetMapping("/queryOrSearchList")
|
|
@@ -171,7 +175,8 @@ public class HouseManagerController extends BaseController{
|
|
|
String totalVrUrl = newOuterSceneVrHost + path;
|
|
|
log.info("将要生成二维码的链接为:{}" , totalVrUrl);
|
|
|
String totalOssQueryPath = "";
|
|
|
- /* if(StringUtils.isBlank(tmHouse.getQrCode())){
|
|
|
+ if(!StringUtils.equals(path , tmHouse.getVrPath())){
|
|
|
+ //720返回的vr路径有变动,则需要更新
|
|
|
String localPath = imageLocalPath + "logo.png";
|
|
|
String outPutImageName = System.currentTimeMillis() + ".jpg";
|
|
|
String outPutImageResultPath = imageLocalPath + outPutImageName;
|
|
@@ -192,33 +197,11 @@ public class HouseManagerController extends BaseController{
|
|
|
|
|
|
tmHouse.setQrCode(totalOssQueryPath);
|
|
|
tmHouse.setUpdateTime(LocalDateTime.now());
|
|
|
+ tmHouse.setVrPath(path);
|
|
|
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);
|
|
|
resultMap.put("vrLink" , totalVrUrl);
|
|
@@ -230,7 +213,12 @@ public class HouseManagerController extends BaseController{
|
|
|
@PostMapping("/uploadImage")
|
|
|
public Result uploadIntroduceVideo(@RequestParam("file") MultipartFile file , @RequestParam(required = true) String houseId) {
|
|
|
if (null == file) {
|
|
|
- throw new CommonBaseException(ResultCodeEnum.D101 , "文件缺失");
|
|
|
+ return Result.failure("文件缺失");
|
|
|
+ }
|
|
|
+ Pattern pattern = Pattern.compile(IMAGE_PATH);
|
|
|
+ Matcher matcher = pattern.matcher(file.getOriginalFilename());
|
|
|
+ if(!matcher.find()){
|
|
|
+ return Result.failure("只能上传照片格式的文件");
|
|
|
}
|
|
|
if(StringUtils.isBlank(houseId)){
|
|
|
return Result.failure("房源ID不能为空");
|
|
@@ -291,6 +279,9 @@ public class HouseManagerController extends BaseController{
|
|
|
|
|
|
tmHouse.setQrCode(totalOssQueryPath);
|
|
|
tmHouse.setUpdateTime(LocalDateTime.now());
|
|
|
+ if(!StringUtils.equals(tmHouse.getVrPath() , path)){
|
|
|
+ tmHouse.setVrPath(path);
|
|
|
+ }
|
|
|
tmHouseService.updateHouse(tmHouse);
|
|
|
|
|
|
Map<String , Object> resultMap = new HashMap<>();
|
|
@@ -299,6 +290,8 @@ public class HouseManagerController extends BaseController{
|
|
|
return Result.success(resultMap);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/getHouseDetail")
|
|
|
@ApiOperation(value = "根据房源ID获取房源详情")
|
|
|
@ApiImplicitParams({
|