|
@@ -1,444 +0,0 @@
|
|
|
-package com.gis.web.controller;
|
|
|
-
|
|
|
-import cn.hutool.core.io.FileUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.gis.common.constant.ConfigConstant;
|
|
|
-import com.gis.common.constant.RabbitConfig;
|
|
|
-import com.gis.common.exception.BaseRuntimeException;
|
|
|
-import com.gis.common.util.FileUtils;
|
|
|
-import com.gis.common.util.Result;
|
|
|
-import com.gis.domain.dto.*;
|
|
|
-import com.gis.domain.entity.SceneEntity;
|
|
|
-import com.gis.feign.HouseFeign;
|
|
|
-import com.gis.feign.UserFeign;
|
|
|
-import com.gis.mapper.SceneMapper;
|
|
|
-import com.gis.service.SceneService;
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.junit.Test;
|
|
|
-import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import javax.validation.Valid;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-
|
|
|
-/**
|
|
|
- * Created by owen on 2021/1/14 0014 19:02
|
|
|
- * 这个类header 不能有token, 否则webLogAspect会报错
|
|
|
- */
|
|
|
-@Slf4j
|
|
|
-@Api(tags = "测试")
|
|
|
-//@RestController
|
|
|
-@RequestMapping("fcb/pano/test")
|
|
|
-public class TestController extends BaseController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RabbitTemplate rabbitTemplate;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- UserFeign userFeign;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ConfigConstant configConstant;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- FileUtils fileUtils;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SceneService sceneService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- HouseFeign houseFeign;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SceneMapper sceneMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RedisTemplate<String, String> redisTemplate;
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("1")
|
|
|
- @ApiOperation(value = "服务是否正常", position = 1)
|
|
|
- public Result test(){
|
|
|
- log.info("dd: " + new Date());
|
|
|
- return Result.success(new Date());
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "VR模模型-根据场景码查询")
|
|
|
- @GetMapping(value = "vr/findBySceneCode/{sceneCode}" )
|
|
|
- public Result vrFindBySceneCode(@PathVariable String sceneCode){
|
|
|
- SceneEntity entity = sceneService.findBySceneCode(sceneCode);
|
|
|
- boolean flag = true;
|
|
|
- if (entity == null) {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- return Result.success(flag);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "测试异常" )
|
|
|
- @PostMapping("ex/{id}")
|
|
|
- public Result ex(@PathVariable String id) {
|
|
|
-
|
|
|
-
|
|
|
- log.info("start task cmdPano");
|
|
|
- SceneEntity entity = sceneService.findById(id);
|
|
|
- if (entity == null) {
|
|
|
- throw new BaseRuntimeException("场景不存在: " + id);
|
|
|
- }
|
|
|
- log.info("task 1");
|
|
|
- try {
|
|
|
- log.info("task 2");
|
|
|
-
|
|
|
- log.info("1111111");
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- entity.setStatus(6);
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- log.info("5555");
|
|
|
- sceneService.update(entity);
|
|
|
- log.info("66666");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "VR项目状态查询" )
|
|
|
- @PostMapping("findHouseStatus/{id}")
|
|
|
- public Result findHouseStatus(@PathVariable String id) {
|
|
|
-
|
|
|
- log.info("status: " + 1111);
|
|
|
- // 检查VR项目状态
|
|
|
- Result status = getHouseStatus(id);
|
|
|
- log.info("777777");
|
|
|
- if (status != null) {
|
|
|
- log.info("8888");
|
|
|
- return status;
|
|
|
- }
|
|
|
- log.info("9999");
|
|
|
-
|
|
|
- return Result.success();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询VR项目状态
|
|
|
- * @param houseId
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Result getHouseStatus(String houseId){
|
|
|
- Result result = null;
|
|
|
- try {
|
|
|
- result = houseFeign.findByHouseId(houseId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-// log.info("result: " + result);
|
|
|
- String status = null;
|
|
|
- if (result.getCode() == 0) {
|
|
|
- Object data = result.getData();
|
|
|
- JSONObject jsonObject = JSON.parseObject(data.toString());
|
|
|
- status = jsonObject.getString("status");
|
|
|
- log.info("house status: " + status);
|
|
|
-
|
|
|
- if (status.equals("2")) {
|
|
|
- log.warn("审核中不能编辑");
|
|
|
- return Result.failure(7005, "审核中不能编辑");
|
|
|
- }
|
|
|
- if (status.equals("3")) {
|
|
|
- log.warn("已审核中不能编辑");
|
|
|
- return Result.failure(7006, "已审核中不能编辑");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (result.getCode() == -1){
|
|
|
- return Result.failure("查询失败");
|
|
|
- }
|
|
|
-
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "场景排序")
|
|
|
- @PostMapping(value = "setSort" )
|
|
|
- public Result setSort(@RequestBody Map<String, String> param){
|
|
|
- return sceneService.setSort(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "获取四维看看场景码" , position = 3)
|
|
|
- @GetMapping("getVrSceneCode/{houseId}/{status}/{type}")
|
|
|
- public Result getVrSceneCode(@PathVariable String houseId, @PathVariable String status, @PathVariable String type) {
|
|
|
- return sceneService.getVrSceneCode(houseId, status, type);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "VR项目删除" , position = 3)
|
|
|
- @GetMapping("house/remove/{houseId}")
|
|
|
- public Result houseRemove(@PathVariable String houseId) {
|
|
|
- return sceneService.houseRemove(houseId);
|
|
|
- }
|
|
|
-
|
|
|
-// @ApiOperation(value = "VR项目审核通过" , position = 3)
|
|
|
-// @GetMapping("house/audit/{houseId}")
|
|
|
-// public Result houseAudit(@PathVariable String houseId) {
|
|
|
-// return sceneService.houseAudit(houseId, status);
|
|
|
-// }
|
|
|
-
|
|
|
- @GetMapping("testSendMq")
|
|
|
- @ApiOperation(value = "rabbitMQ发送", position = 1)
|
|
|
- public Result testSendMq(){
|
|
|
- String param = "owen" + new Date();
|
|
|
- log.info("MQ param: " + param);
|
|
|
- //发消息到mq
|
|
|
- rabbitTemplate.convertAndSend(RabbitConfig.TEST_EXCHANGE, RabbitConfig.TEST_QUEUE_ROUTING, param);
|
|
|
- return Result.success(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("login/{userName}/{password}")
|
|
|
- @ApiOperation(value = "登录(用户微服务),获取token", position = 1, notes = "p:88888888, u:88888888888")
|
|
|
- public Result login(@PathVariable String userName, @PathVariable String password){
|
|
|
- UserDto userDto = new UserDto();
|
|
|
- userDto.setUserName(userName);
|
|
|
- userDto.setPassword(password);
|
|
|
- return Result.success(userFeign.login(userDto));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("setTokenToRedis/{key}")
|
|
|
- @ApiOperation(value = "设置token到redis")
|
|
|
- public Result setTokenToRedis(@PathVariable String key){
|
|
|
- // // 更新到 redis, 有效期24h, 旧token无效, 用来处理退出登录
|
|
|
- String token = "123";
|
|
|
- redisTemplate.opsForValue().set(key, token, Long.parseLong("2300000"), TimeUnit.HOURS);
|
|
|
- return Result.success(key);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "上传-全景图(创建场景)", position = 2)
|
|
|
- @PostMapping("uploadPano/{houseId}/{type}/{hengdaId}")
|
|
|
- public Result uploadPano(MultipartFile file, @PathVariable String houseId, @PathVariable String type, @PathVariable String hengdaId) {
|
|
|
-
|
|
|
- if (file == null) {
|
|
|
- log.error("文件不能为空");
|
|
|
- return Result.failure("文件不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- return sceneService.uploadPanoRabbitMq(file, houseId, type, hengdaId);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("getUserInfo")
|
|
|
- @ApiOperation(value = "获取用户信息")
|
|
|
- public Result getUserInfo(){
|
|
|
- return Result.success(userInfo());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("uploadOss")
|
|
|
- @ApiOperation(value = "文件上传oss")
|
|
|
- public Result uploadOss(MultipartFile file){
|
|
|
- return Result.success(fileUtils.renameUploadOssMap(file, configConstant.filePath, configConstant.ossBasePath, configConstant.ossDomain));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("uploadOssBye")
|
|
|
- @ApiOperation(value = "文件上传oss-字节上传")
|
|
|
- public Result uploadOssBye(MultipartFile file){
|
|
|
- return Result.success(fileUtils.renameUploadOssBye(file, configConstant.ossBasePath, configConstant.ossDomain));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testReadFileToString(){
|
|
|
- String path = "C:\\Users\\Administrator\\Desktop\\test\\tour.xml";
|
|
|
- String string = FileUtil.readUtf8String(path);
|
|
|
- String trim = StringUtils.trim(string);
|
|
|
- System.out.println(trim);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("保存VR模型")
|
|
|
- @PostMapping("saveVrModel")
|
|
|
- public Result saveVrModel(@RequestBody VrModelDto param) {
|
|
|
- return sceneService.saveVrModel(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-//
|
|
|
-// @ApiOperation("房源更新场景码")
|
|
|
-// @PostMapping("updateHouseSceneIndex")
|
|
|
-// public Result updateHouseSceneIndex(@RequestBody HouseSceneIndexDto param) {
|
|
|
-// return houseFeign.updateHouseSceneIndex(param);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-// @ApiOperation("获取Result")
|
|
|
-// @PostMapping("getResult/{houseId}")
|
|
|
-// public Result testResult(@PathVariable String houseId ){
|
|
|
-// Result result = sceneService.getIndex(houseId);
|
|
|
-// if (result.getCode() == 0) {
|
|
|
-// log.info("result:" + result);
|
|
|
-// log.info("正常");
|
|
|
-//// String data = (String)result.getData();
|
|
|
-//
|
|
|
-//
|
|
|
-//// JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
-// } else {
|
|
|
-// log.info("异常");
|
|
|
-// log.info("msg: {}" + result.getMsg());
|
|
|
-// }
|
|
|
-//
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 测试正常
|
|
|
- * @param houseId
|
|
|
- * @return
|
|
|
- */
|
|
|
-// @ApiOperation(value = "房源详情" , position = 3)
|
|
|
-// @GetMapping("house/detail/{houseId}")
|
|
|
-// public Result houseDetail(@PathVariable String houseId) {
|
|
|
-// Result re = houseFeign.findByHouseId(houseId);
|
|
|
-// if (re.getCode() == 0) {
|
|
|
-// log.info("正常");
|
|
|
-// Object data = re.getData();
|
|
|
-// log.info("data: " + data.toString());
|
|
|
-// JSONObject jsonObject = JSON.parseObject(data.toString());
|
|
|
-// String sceneNum = jsonObject.getString("sceneNum");
|
|
|
-// log.info("sceneNum: " + sceneNum);
|
|
|
-// } else {
|
|
|
-// log.info("异常");
|
|
|
-// Result.failure(re.getMsg());
|
|
|
-// }
|
|
|
-// return houseFeign.findByHouseId(houseId);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 测试,传json是可以的
|
|
|
- * @param houseId
|
|
|
- * @return
|
|
|
- */
|
|
|
-// @ApiOperation(value = "Feign Json参数" , position = 3)
|
|
|
-// @GetMapping("houseUpdate/{houseId}/{sceneNum}/{fcbHouseId}")
|
|
|
-// public Result houseUpdate(@PathVariable String houseId, @PathVariable String sceneNum, @PathVariable String fcbHouseId) {
|
|
|
-// JSONObject jsonObject = new JSONObject();
|
|
|
-//
|
|
|
-//
|
|
|
-// jsonObject.put("id", houseId);
|
|
|
-// jsonObject.put("sceneNum", sceneNum);
|
|
|
-// jsonObject.put("fcbHouseId", fcbHouseId);
|
|
|
-//
|
|
|
-// Result result = houseFeign.updateHouseJson(jsonObject);
|
|
|
-// if (result.getCode() == 0) {
|
|
|
-// return Result.success();
|
|
|
-// } else {
|
|
|
-// log.error("异常");
|
|
|
-// return Result.failure(result.getMsg());
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "解析page" , position = 3)
|
|
|
- @GetMapping("page/{houseId}")
|
|
|
- public Result page(@PathVariable String houseId) {
|
|
|
- Result result = sceneService.findByHouseId(houseId);
|
|
|
- // 过滤已添加的数据
|
|
|
- if (result.getCode() == 0) {
|
|
|
-
|
|
|
- log.info("1111");
|
|
|
- Object data = result.getData();
|
|
|
- System.out.println(data.toString());
|
|
|
- PageInfo<Object> page = JSON.parseObject(data.toString(), PageInfo.class);
|
|
|
- log.info("page: " + page.toString());
|
|
|
-
|
|
|
- log.info("2222");
|
|
|
- List<Object> list = page.getList();
|
|
|
- log.info("list size: " + list.size());
|
|
|
-
|
|
|
- ArrayList<Object> newList = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- log.info("list: " + list.get(i));
|
|
|
- JSONObject scenePro = JSON.parseObject(list.get(i).toString());
|
|
|
- log.info("scenePro: " + scenePro);
|
|
|
-
|
|
|
- String isIndex = scenePro.getString("isIndex");
|
|
|
- String use = "0";
|
|
|
- // 过滤掉存在的数据
|
|
|
- if (isIndex.equals("1")) {
|
|
|
- use = "1";
|
|
|
- i ++ ;
|
|
|
- }
|
|
|
- scenePro.put("isUse", use);
|
|
|
- newList.add(scenePro);
|
|
|
- }
|
|
|
- log.info("list update size: " + list.size());
|
|
|
- page.setList(newList);
|
|
|
- log.info("newList size: " + newList.size());
|
|
|
-
|
|
|
- log.info("5555");
|
|
|
- return Result.success(page);
|
|
|
- } else {
|
|
|
- log.error("异常了");
|
|
|
- return Result.failure(result.getMsg());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-// @ApiOperation(value = "VR模型查找", position = 3)
|
|
|
-// @PostMapping("findVrModel")
|
|
|
-// public Result findVrModel(@Valid @RequestBody SceneRroPageDto param) {
|
|
|
-// return sceneService.findVrModel2(param);
|
|
|
-// }
|
|
|
-
|
|
|
- @ApiOperation(value = "房源首页获取", position = 3)
|
|
|
- @PostMapping("findAllHouseId")
|
|
|
- public Result findAllHouseId(@RequestBody HouseIndexPageDto param) {
|
|
|
-
|
|
|
- return sceneService.findAllHouseIdIndex(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void test2(){
|
|
|
- List<Object> objects = new ArrayList<>();
|
|
|
- objects.add("1");
|
|
|
- objects.add("2");
|
|
|
- objects.add("3");
|
|
|
-
|
|
|
- System.out.println(objects);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "上传-图标", position = 2)
|
|
|
- @PostMapping(value = "upload")
|
|
|
- public Result upload(@RequestParam("file") MultipartFile file) {
|
|
|
- return sceneService.upload(file);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|