package com.fdkankan.scene.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fdkankan.common.constant.ErrorCode; import com.fdkankan.common.constant.PayStatus; import com.fdkankan.common.constant.SceneInfoReqType; import com.fdkankan.common.constant.ServerCode; import com.fdkankan.common.exception.BusinessException; import com.fdkankan.common.response.ResultData; import com.fdkankan.redis.util.RedisUtil; import com.fdkankan.scene.entity.SceneDataDownload; import com.fdkankan.scene.entity.SceneEditInfo; import com.fdkankan.scene.entity.ScenePro; import com.fdkankan.scene.service.*; import com.fdkankan.scene.vo.*; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** *

* 场景表 前端控制器 *

* * @author dengsixing * @since 2021-12-23 */ @RestController @RequestMapping("/service/scene") public class SceneController { @Autowired ISceneProService sceneProService; @Autowired ISceneService sceneService; @Autowired ISceneFileBuildService sceneFileBuildService; @Autowired IVideoSceneProgressService videoSceneProgressService; @Autowired IPicSceneProgressService picSceneProgressService; @Autowired ISceneEditInfoService sceneEditInfoService; @Autowired IScenePlusService scenePlusService; // /** // * 获取场景详情 // */ // @PostMapping(value = "/getInfo") // public SceneVO getInfo(@RequestBody SceneParamVO param){ // return sceneProService.getInfo(param.getNum()); // } /** * 获取场景详情 */ @GetMapping(value = "/getInfo") public SceneInfoVO getInfo(@Validated SceneInfoParamVO param) throws Exception{ param.setReqType(SceneInfoReqType.VIEW.code()); return sceneEditInfoService.getSceneInfo(param); } /** * 场景浏览 * @param param * @return */ @PostMapping(value = "/search") public IPage search(@RequestBody SceneParamVO param) { return sceneService.search(param); } /** * 场景浏览 * @param param * @return */ @PostMapping(value = "/loadScene") public Page loadScene(@RequestBody SceneParamVO param) { return sceneService.loadScene(param); } /** * 场景浏览 * @param param * @return */ @PostMapping(value = "/loadAllScene") public Page loadAllScene(@RequestBody SceneParamVO param){ return sceneService.loadAllScene2(param); } /** * 更新浏览次数 */ @PostMapping(value = "/updateViewCount") public ResultData updateViewCount(@RequestBody SceneParamVO param){ return sceneService.updateViewCount(param.getNum()); } /** * 手动更新浏览数据到数据库 */ @PostMapping(value = "/updatePv") public ResultData updatePv() throws Exception { sceneService.updatePv(); return ResultData.ok(); } /** * 场景模型重新计算 */ @PostMapping(value = "/rebuildScene") public ResultData rebuildScene(@RequestParam("num") String num) throws Exception { return sceneFileBuildService.rebuildScene(num); } /** * 场景模型重新计算 */ @PostMapping(value = "/rebuildVideoScene") public ResultData rebuildVideoScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception { return sceneFileBuildService.rebuildVideoScene(param); } /** * 场景模型重新计算 */ @PostMapping(value = "/rebuildPicScene") public ResultData rebuildPicScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception { return sceneFileBuildService.rebuildPicScene(param); } /** * 场景视频重新计算进度 */ @PostMapping(value = "/rebuildVideoSceneProgress") public ResultData rebuildVideoSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception { return videoSceneProgressService.rebuildVideoSceneProgress(param); } /** * 场景视频重新计算进度 */ @PostMapping(value = "/rebuildPicSceneProgress") public ResultData rebuildPicSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception { return picSceneProgressService.rebuildPicSceneProgress(param); } /** * 查看场景对应的数据,给刘强用的 */ @PostMapping(value = "/querySceneDataSource") public ResultData querySceneDataSource(@RequestBody SceneParamVO param){ return sceneService.querySceneDataSource(param); } /** * 查看场景对应的场景码,给刘强用的 */ @PostMapping(value = "/querySceneNum") public ResultData querySceneNum(@RequestBody SceneParamVO param){ return sceneService.querySceneNum(param); } /** * 查看场景对应的数据,给刘强用的 */ @PostMapping(value = "/downloadCapture") public ResultData downloadCapture(@RequestBody SceneParamVO param) throws Exception { return sceneProService.downloadCapture(param); } /** * 上传results数据 * @param param */ @PostMapping(value = "/uploadResultsData") public ResultData uploadResultsData(@RequestBody SceneParamVO param) throws Exception{ return sceneProService.uploadResultsData(param); } /** * 一键换装完成修改场景状态 * @param param */ @PostMapping(value = "/updateStatusByScene") public ResultData updateStatusByScene(@RequestBody SceneParamVO param) throws Exception{ return sceneProService.updateStatusByScene(param); } /** * 获取一键换装场景状态 */ @PostMapping(value = "/getStatusByScene") public ResultData getStatusByScene(SceneParamVO param) throws Exception{ return sceneProService.getStatusByScene(param); } // /** // * 获取场景详情 // */ // @ApiOperation("获取场景详情") // @PostMapping(value = "/getSceneAndCameras") // public ResultData getSceneAndCameras(@RequestBody Map params) throws Exception { // String userName = params.get("userName").toString(); // List excludeNums = (List)params.get("excludeNums"); // UserEntity user = userService.findUserByUserName(userName); // if(ObjectUtils.isEmpty(user)){ // throw new BaseRuntimeException("用户不存在"); // } // return sceneProService.getSceneAndCameras(user.getId(),excludeNums); // } // // /** // * 获取场景详情 // */ // @ApiOperation("获取场景详情") // @PostMapping(value = "/findSceneEcs") // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String") // public ResultData findSceneEcs(HttpServletRequest request) throws Exception{ // String sceneNum = request.getParameter("num"); // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // return Result.success((Object) sceneProEntity.getEcs()); // } // /** * 根据场景密码打开场景 */ @PostMapping(value = "/check/key") public ResultData checkKey(@RequestBody @Validated SceneCheckKeyParamVO param) throws Exception { return sceneEditInfoService.checkKey(param); } // /** // * 是否已登录 // * @return // */ // @ApiOperation("是否已登录") // @PostMapping(value = "/isLogin") // @ApiImplicitParams({ // @ApiImplicitParam(name = "token", value = "用户token", dataType = "String"), // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")}) // public ResultData isLogin(HttpServletRequest request) throws Exception{ // String num = request.getParameter("num"); // String token = request.getHeader("token"); // if(StringUtil.isEmpty(num) ){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if (ssoUser == null){ // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004); // } // // // 解密获得username,用于和数据库进行对比 // String username = JwtUtil.getUsername(token); // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // if(sceneProEntity.getPayStatus() != 1){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // JSONObject jsonObject = new JSONObject(); // // List exclude = new ArrayList<>(); // SceneResourceEntity excludeEntity = new SceneResourceEntity(); // excludeEntity.setKeyWord("data"); // exclude.add(excludeEntity); // // CameraEntity cameraEntity = goodsService.findByChildName(username); // jsonObject.put("exclude", exclude); // jsonObject.put("include", new ArrayList<>()); // jsonObject.put("company", null); // Result result = Result.success(jsonObject); // // //判断该场景是否属于增值权益 // boolean isIncrement = false; // //获取该相机是否有权益 // boolean isExpired = false; // CameraEntity sceneCamera = goodsService.findCameraById(sceneProEntity.getCameraId()); // if(sceneCamera != null){ // UserIncrementEntity userIncrementEntity = userIncrementService.findByCameraId(sceneCamera.getId()); // // if(userIncrementEntity != null){ // if( userIncrementEntity.getIsExpired().intValue() == 0){ // isIncrement = true; // } // if(userIncrementEntity.getIsExpired().intValue() == 1){ // isExpired = true; // } // }else{ // try { // Date date = DateUtil.string2Date("2021-09-09 00:00:00",null); // // //非07批次的放开 // String pc = sceneCamera.getSnCode().substring(0,2); // if(!pc.equals("07") ){ // if(sceneCamera.getCreateTime()!=null && date.after(sceneCamera.getCreateTime())){ // // isIncrement = true; // isExpired = false; // } // } // }catch (Exception e){ // e.printStackTrace(); // } // } // } // // jsonObject.put("isExpired", isExpired ); // jsonObject.put("isIncrement", isIncrement); // // //判断过期时间 // Date date = DateUtil.string2Date(expectedTime,null); // // jsonObject.put("isTransition",DateUtil.isBeforeNow2(date)); // // // if(cameraEntity != null){ // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId()); // if(cameraDetailEntity.getCompanyId() != null){ // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){ // jsonObject.put("exclude", new ArrayList<>()); // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue()); // } // } // return result; // } // // UserEntity userEntity = userService.findUserByUserName(username); // if("18750226207".equals(username)){ // log.info("18750226207该账号默认超级管理员,可以操作所有场景"); // } // else if(userEntity == null || sceneProEntity.getUserId() == null || userEntity.getId().longValue() != sceneProEntity.getUserId().longValue()){ // log.info("user:" + userEntity.getId() + ",scene:" + sceneProEntity.getUserId()); // // Condition condition = new Condition(SceneCooperationEntity.class); // condition.and().andEqualTo("sceneNum", num); // List list = sceneCooperationService.findAll(condition); // if(list != null && list.size() > 0){ // if(list.get(0).getUserId().longValue() != userEntity.getId().longValue()){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // }else { // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // } // // if(sceneProEntity.getCameraId() != null){ // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId()); // if(cameraEntity != null){ // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId()); // if(cameraDetailEntity.getCompanyId() != null){ // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){ // jsonObject.put("exclude", new ArrayList<>()); // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue()); // } // } // } // } // // //权限控制完后判断若是协作账号,获取协作权限 // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(num); // //若数据为空表示可操作全部资源 // if(sceneCooperationEntity == null || sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){ // return result; // } // // if(sceneProEntity != null && sceneProEntity.getUserId() == sceneCooperationEntity.getUserId().longValue()){ // return result; // } // // jsonObject.put("include", sceneResourceService.findByCooperationId(sceneCooperationEntity.getId())); // // return result; // // } // // //跳转到编辑页面 // @ApiOperation("跳转到编辑页面") // @PostMapping("goEditScenePage") // @ApiImplicitParams({ // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"), // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"), // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String"), // @ApiImplicitParam(name = "vlog", value = "vlog", dataType = "String"), // @ApiImplicitParam(name = "childName", value = "相机编码", dataType = "String") // }) // public void goEditScenePage(HttpServletRequest request, HttpServletResponse response) throws Exception{ // String phoneNum = request.getParameter("phoneNum"); // String password = request.getParameter("password"); // String sceneNum = request.getParameter("sceneNum"); // String childName = request.getParameter("childName"); // String lang = request.getParameter("lang"); // String vlog = request.getParameter("vlog"); // // SceneProEntity scene = sceneProService.findBySceneNum(sceneNum); // // if(scene == null) { // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // if(StringUtil.isNotEmpty(childName)){ // CameraEntity cameraEntity = goodsService.findByChildName(childName); // if(cameraEntity != null){ // // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId()); // if(cameraDetailEntity != null && cameraDetailEntity.getCooperationUser() != null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // // SSOUser dbUser = new SSOUser(); // dbUser.setUserName(childName); // // String token = JwtUtil.createJWT(-1, childName); // SSOLoginHelper.login(token, dbUser); // // //登录成功 // if(scene.getWebSite().contains(sceneProUrl)){ // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") + // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" + // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog)); // } // // if(scene.getWebSite().contains(sceneProNewUrl)){ // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") + // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" + // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog)); // } // return; // } // } // // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password) // || StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // if(scene.getUserId()==null) // { // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5013, SceneConstant.FAILURE_MSG_5013); // } // // Result result = userService.findByUserName(phoneNum); // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class); // if(ssoUser == null){ // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // if(ssoUser.getId().longValue() != scene.getUserId().longValue()) { // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(sceneNum); // if(sceneCooperationEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // // if(sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // // } // // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword())) // { // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // String token = JwtUtil.createJWT(-1, ssoUser.getUserName()); // SSOLoginHelper.login(token, ssoUser); // //登录成功 // if(scene.getWebSite().contains(sceneProUrl)){ // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") + // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" + // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog)); // } // // if(scene.getWebSite().contains(sceneProNewUrl)) { // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") + // sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" + // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog)); // } // } // // //跳转到官网消费页面 // @ApiOperation("跳转到官网消费页面") // @PostMapping("goConsumptionPage") // @ApiImplicitParams({ // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"), // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")}) // public void goConsumptionPage(HttpServletRequest request, HttpServletResponse response) throws Exception{ // String phoneNum = request.getParameter("phoneNum"); // String password = request.getParameter("password"); // String lang = request.getParameter("lang"); // // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // Result result = userService.findByUserName(phoneNum); // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class); // if(ssoUser == null){ // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword())) // { // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // String token = JwtUtil.createJWT(-1, ssoUser.getUserName()); // SSOLoginHelper.login(token, ssoUser); // //登录成功 // response.sendRedirect(mainUrl + "mobile.html?token="+ token + "&app" + (lang == null ? "" : "&lang=" + lang)+"#/consumption/0" ); // } // // //跳转到官网扩容充值页面 // @ApiOperation("跳转到官网扩容充值页面") // @PostMapping("goRechargePage") // @ApiImplicitParams({ // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"), // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), // @ApiImplicitParam(name = "childName", value = "相机mac地址", dataType = "String"), // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")}) // public void goRechargePage(HttpServletRequest request, HttpServletResponse response) throws Exception{ // String phoneNum = request.getParameter("phoneNum"); // String password = request.getParameter("password"); // String childName = request.getParameter("childName"); // String lang = request.getParameter("lang"); // // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // Result result = userService.findByUserName(phoneNum); // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class); // if(ssoUser == null){ // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword())) // { // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015); // } // // String token = JwtUtil.createJWT(-1, ssoUser.getUserName()); // SSOLoginHelper.login(token, ssoUser); // //登录成功 // response.sendRedirect(mainUrl + "mobile.html#/introduce/" + childName + "?token=" + token + "&app" + (lang == null ? "" : "&lang=" + lang)); // } // // /** // * app录音获取录音文件版本 // */ // @ApiOperation("app录音获取录音文件版本") // @PostMapping(value = "/getVoiceSound") // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String") // public ResultData getVoiceSound(HttpServletRequest request) throws Exception { // String sceneNum = request.getParameter("num"); // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // // //更新访问数量 // return Result.success(editEntity.getScreencapVoiceSoundsync()); // } // // /** // * 下载模型文件 // */ // @ApiOperation("下载模型文件") // @PostMapping(value = "/downloadTexData") // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String") // public ResultData downloadTexData(HttpServletRequest request, HttpServletResponse response) throws Exception { // String sceneNum = request.getParameter("num"); // // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // String dataPath = sceneProEntity.getDataSource() + "/caches/tex"; // if(new File(sceneProEntity.getDataSource() + "_edit/caches/tex").exists()){ // dataPath = sceneProEntity.getDataSource() + "_edit/caches/tex"; // } // File filePath = new File(dataPath); // for(String deletePath : filePath.list()){ // if(deletePath.endsWith(".obj") && !deletePath.contains("output.house.obj")){ // FileUtils.deleteFile(filePath.getAbsolutePath() + File.separator + deletePath); // } // } // // FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/tex.zip", dataPath); // // return Result.success(mainUrl + "scene/images/images" + sceneNum + "/tex.zip?t=" +System.currentTimeMillis()); // } // // /** // * 生成英文版二维码 // */ // @ApiOperation("生成英文版二维码") // @PostMapping(value = "/createEnSceneQRcode") // public ResultData createEnSceneQRcode(HttpServletRequest request, HttpServletResponse response) throws Exception { // List proEntityList = sceneProService.findAll(); // for(SceneProEntity proEntity : proEntityList){ // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProUrl + proEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+proEntity.getNum()+"_en.png", null); // } // // List entityList = sceneService.findAll(); // for(SceneEntity sceneEntity : entityList){ // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneUrl + sceneEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneEntity.getNum()+"_en.png", null); // } // return Result.success("生成完成"); // } // // /** // * 根据sn码查找所有场景连接 // */ // @ApiOperation("根据sn码查找所有场景连接") // @PostMapping(value = "/findSceneBySnCode") // @ApiImplicitParam(name = "snCode", value = "snCode", dataType = "String") // public ResultData findSceneBySnCode(HttpServletRequest request, HttpServletResponse response) throws Exception { // String snCode = request.getParameter("snCode"); // CameraEntity cameraEntity = goodsService.findBySnCode(snCode); // // if(cameraEntity == null){ // return Result.success(); // } // // return Result.success(sceneProService.findByCameraId(cameraEntity.getId())); // } // // /** // * 上传ar场景数据 // * @param file // * @param params // * @return // */ // @ApiOperation("上传ar场景数据") // @PostMapping("uploadImgAndJson") // @ApiImplicitParams({ // @ApiImplicitParam(name = "file", value = "文件流", dataType = "MultipartFile"), // @ApiImplicitParam(name = "params", value = "参数", dataType = "String"), // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")}) // public ResultData uploadImgAndJson(@RequestParam(value = "file",required = false) MultipartFile file, // String params, String num) throws Exception { // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // String path = sceneProEntity.getDataSource() + "_ar"; // String filePath = path + "/extras/"; // // String fileName = "ar.jpg"; // // File targetFile = new File(filePath + fileName); // if(!targetFile.getParentFile().exists()){ // targetFile.getParentFile().mkdirs(); // } // file.transferTo(targetFile); // // JSONObject jsonObject = JSONObject.parseObject(params); // FileUtils.writeFile(filePath + "ar_in.json", jsonObject.toString()); // // //创建data.json // JSONObject dataJson = new JSONObject(); // dataJson.put("ar", true); // dataJson.put("split_type", "SPLIT_V1"); // dataJson.put("data_describe", "double spherical"); // dataJson.put("skybox_type", "SKYBOX_V5"); // FileUtils.writeFile(path + "/data.json", dataJson.toString()); // // if(new File(sceneProEntity.getDataSource() + File.separator + "caches").exists()){ // CreateObjUtil.createSoftConnection(sceneProEntity.getDataSource() + File.separator + "caches" , path + File.separator + "caches"); // } // // //调用算法 // CreateObjUtil.build3dModel(path, ""); // // String result = FileUtils.readFile(path + "/results/ar_out.json"); // if(result == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012); // } // // return Result.success(result); // } // // /** // * 正式环境与测试环境互相复制资源并且重算 // */ // @ApiOperation("正式环境与测试环境互相复制资源并且重算") // @PostMapping(value = "/copyDataAndBuild") // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String") // public void copyDataAndBuild(HttpServletRequest request, HttpServletResponse response) throws Exception { // String num = request.getParameter("num"); // // Map postData = new HashMap(); // postData.put("num", num); // String dataPath = ""; // if("dev".equals(environment)){ // dataPath = HttpRequestorUtil.doPost("https://www.4dkankan.com/service/scene/querySceneDataSource", postData); // log.info("正式环境资源路径:" + dataPath); // }else { // dataPath = HttpRequestorUtil.doPost("https://test.4dkankan.com/service/scene/querySceneDataSource", postData); // log.info("测试环境资源路径:" + dataPath); // } // // if(dataPath.contains("/mnt/data/")){ // String newPath = dataPath; // // if(!new File(newPath).exists()){ // new File(newPath).mkdirs(); // } // // if(!new File(newPath + "/capture").exists()){ // new File(newPath + "/capture").mkdirs(); // } // if("dev".equals(environment)){ // //远程复制正式环境资源到测试环境; // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/"); // log.info("数据复制完成"); // }else { // //远程复制正式环境资源到测试环境; // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/"); // log.info("数据复制完成"); // } // // // String data = FileUtils.readFile(newPath + "/capture/data.fdage"); // JSONObject jsonObject = JSONObject.parseObject(data); // String sceneNum = ""; // if(jsonObject != null){ // sceneNum = sceneNumService.generateSceneNum(); // // String cameraName = jsonObject.getJSONObject("cam").getString("uuid"); // String unicode = jsonObject.getString("creator") + "_" + jsonObject.getString("uuidtime"); // // log.info("查询相机:" + cameraName); // CameraEntity cameraEntity = goodsService.findByChildName(cameraName); // // if(cameraEntity == null){ // log.error("该相机不存在:" + cameraName); // //偶现data.fdage给的相机码多了或少了4DKKPRO_ // if(cameraName.contains("4DKKPRO_")){ // cameraEntity = goodsService.findByChildName(cameraName.replace("4DKKPRO_", "")); // }else { // cameraEntity = goodsService.findByChildName("4DKKPRO_" + cameraName); // } // if(cameraEntity == null){ // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003); // } // } // // CameraDetailEntity detailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId()); // if(detailEntity == null){ // log.error("该相机详情不存在:" + cameraName); // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003); // } // // String userName = null; // if(detailEntity.getUserId() != null){ // Result result2 = userService.findById(detailEntity.getUserId()); // SSOUser user = mapper.convertValue(result2.getData(), SSOUser.class); // if(user != null){ // userName = user.getUserName(); // } // } // // JSONObject firmwareVersion = new JSONObject(); // if(jsonObject.containsKey("camSoftwareVersion") && StringUtil.isNotEmpty(jsonObject.getString("camSoftwareVersion"))){ // firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion")); // } // // if(jsonObject.containsKey("version") && StringUtil.isNotEmpty(jsonObject.getString("version"))){ // firmwareVersion.put("version", jsonObject.getString("version")); // } // //// String sceneUrl = mainUrl + sceneProUrl; //// String buildType = "V2"; //// //根据videoVersion判断是V2还是V3版本的算法和页面 //// if(jsonObject.containsKey("videoVersion") && StringUtil.isNotEmpty(jsonObject.getString("videoVersion"))){ //// if(jsonObject.getIntValue("videoVersion") >= 4){ //// buildType = "V3"; //// sceneUrl = mainUrl + sceneProNewUrl; //// } //// } // String buildType = "V3"; // String sceneUrl = mainUrl + sceneProNewUrl; // // String filePath = newPath + "/capture/"; // String prefix = newPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/"; // // String fileId = prefix.split("/")[1]; // // String icon = null; // if(jsonObject.containsKey("icon") && StringUtil.isNotEmpty(jsonObject.getString("icon"))){ // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + prefix + jsonObject.getString("icon"), filePath); // uploadToOssUtil.upload(filePath + jsonObject.getString("icon"), "images/images" + sceneNum + "/" + jsonObject.getString("icon")); // icon = "https://4dkk.4dage.com/images/images" + sceneNum + "/" + jsonObject.getString("icon"); // } // // Long cameraType = 11L; // //判断是否转台相机 // if(detailEntity != null && detailEntity.getType() == 9){ // cameraType = 13L; // } // // if(detailEntity != null && detailEntity.getType() == 10){ // cameraType = 14L; // } // // SceneProEntity scene = ComputerUtil.createScenePro(sceneNum, cameraEntity.getId(), cameraEntity.getChildName(), jsonObject.getString("creator"), // jsonObject.getString("pwd"), unicode, // cameraType, String.valueOf(fileId), prefix, "", icon, "0", detailEntity.getUserId(), userName, // jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam", // jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"), // jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), sceneProService, sceneProEditService, 0, // producer, jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, type, ecsType, // sceneCooperationService, sceneResourceCooperationService, sceneResourceCameraService, detailEntity.getCooperationUser(), rubberSheetingUtil); // // producer.sendMsg(scene.getMqMsg()); // } //// CreateObjUtil.build3dModel(newPath, ""); // // JSONObject result = new JSONObject(); // result.put("proData", dataPath); // result.put("testData", newPath); // result.put("num", sceneNum); // response.getWriter().print(result); // } // } // // /** // * 调用小程序商品列表 // */ // @ApiOperation("调用小程序商品列表") // @PostMapping(value = "/shopGoods") // @ApiImplicitParam(name = "keyword", value = "关键词", dataType = "String") // public void shopGoods(HttpServletRequest request, HttpServletResponse response) throws Exception { // String keyword = request.getParameter("keyword"); // // Map postData = new HashMap(); // postData.put("keyword", keyword); // postData.put("sort", "id"); // postData.put("order", "desc"); // String result = HttpRequestorUtil.doPost("https://shop.4dkankan.com/platform-framework/api/goods/list", postData); // log.info("获取小程序商品列表"); // // response.getWriter().print(result); // } // // /** // * 保存配置文件数据 // */ // @ApiOperation("保存配置文件数据") // @PostMapping(value = "/saveConfigData") // @ApiImplicitParams({ // @ApiImplicitParam(name = "fileName", value = "文件名字", dataType = "MultipartFile"), // @ApiImplicitParam(name = "config", value = "config", dataType = "String")}) // public ResultData saveConfigData(HttpServletRequest request) throws Exception { // String fileName = request.getParameter("fileName"); // String config = request.getParameter("config"); // FileUtils.writeFile(ConstantFilePath.SCENE_PATH + fileName, config); // return Result.success(); // } // // /** // * 标定重算 // */ // @ApiOperation("标定重算") // @PostMapping(value = "/rebuildByPath") // @ApiImplicitParam(name = "path", value = "资源路径", dataType = "String") // public ResultData rebuildByPath(HttpServletRequest request) throws Exception{ // String path = request.getParameter("path"); // if(path.contains("color_anlysis")){ // Map map = ComputerUtil.computerCalibration(path); // uploadToOssUtil.uploadMulFiles(map); // return Result.success("开始标定计算"); // } // // producer.sendMsg(path); // return Result.success("开始标定计算"); // } // // /** // * 获取编辑页面的资源下载路径 // */ // @ApiOperation("获取编辑页面的资源下载路径") // @PostMapping(value = "/getEditDataUrl") // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String") // public ResultData getEditDataUrl(HttpServletRequest request) throws Exception{ // String num = request.getParameter("num"); // // if(StringUtils.isEmpty(num)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // List result = new ArrayList<>(); // List urlList = new ArrayList<>(); // // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "data/data" + num, urlList); // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "images/images" + num, urlList); // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "voice/voice" + num, urlList); // // if(urlList != null && urlList.size() > 0){ // for(String url : urlList){ // result.add(url.replace(ConstantFilePath.BASE_PATH + "/", "")); // } // } // // return Result.success(result); // } // // @ApiOperation("根据场景码生成场景") // @PostMapping("/createScene") // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String") // public ResultData createScene(@RequestBody SceneParamVO param) throws Exception{ // if(StringUtils.isEmpty(param.getNum())){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // StringBuffer dataBuf = new StringBuffer() // .append("data").append(File.separator) // .append("data").append(param.getNum()); // // StringBuffer imagesBuf = new StringBuffer() // .append("images").append(File.separator) // .append("images").append(param.getNum()); // // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString()); // StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString()); // // FileUtils.delAllFile(imagesBuffer.toString() + "/results/"); // FileUtils.delAllFile(imagesBuffer.toString() + "/extras/"); // //远程复制oss资源 // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getObjName(), imagesBuffer.toString() + "/extras/"); // //obj文件修改名字 // FileUtils.copyFile(imagesBuffer.toString() + "/extras/" + param.getObjName(), imagesBuffer.toString() + "/extras/mesh.obj", true); // FileUtils.deleteFile(imagesBuffer.toString() + "/extras/" + param.getObjName()); // // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getMntName(), imagesBuffer.toString() + "/extras/"); // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1", imagesBuffer.toString() + "/extras/"); // //将文件复制出去 // String[] imgs = new File(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1").list(); // for(String img : imgs){ // FileUtils.copyFile(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + img, // imagesBuffer.toString() + "/extras/" + img, true); // } // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "vision.txt", imagesBuffer.toString()); // // //创建data.json // JSONObject dataJson = new JSONObject(); // dataJson.put("obj2txt", true); // dataJson.put("split_type", "SPLIT_V6"); // dataJson.put("data_describe", "double spherical"); // dataJson.put("skybox_type", "SKYBOX_V5"); // FileUtils.writeFile(imagesBuffer.toString() + "/data.json", dataJson.toString()); // // //调用objToTxt算法 // CreateObjUtil.objToTxt(imagesBuffer.toString(), ""); // // String uploadData = FileUtils.readFile(imagesBuffer.toString() + File.separator + "results" +File.separator+"upload.json"); // JSONObject uploadJson = null; // JSONArray array = null; // if(uploadData!=null) { // uploadJson = JSONObject.parseObject(uploadData); // array = uploadJson.getJSONArray("upload"); // } // if(array == null){ // log.error("upload.json数据出错"); // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012); // } // // Map map = new HashMap(); // JSONObject fileJson = null; // String fileName = ""; // for(int i = 0, len = array.size(); i < len; i++) { // fileJson = array.getJSONObject(i); // fileName = fileJson.getString("file"); // //文件不存在抛出异常 // if (!new File(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName).exists()) { // throw new Exception(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName + "文件不存在"); // } // // //tex文件夹 // if (fileJson.getIntValue("clazz") == 15) { // map.put(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName, "images/images" + // param.getNum() + "/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + fileName.replace("tex/", "")); // continue; // } // } // // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam"); // CreateObjUtil.convertDamToLzma(imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam"); // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" + File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam"); // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma"); // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam"); // // FileUtils.deleteFile(imagesBuffer.toString() + "/vision.modeldata"); // CreateObjUtil.convertTxtToVisionmodeldata(imagesBuffer.toString() + "/vision.txt", imagesBuffer.toString() + "/vision.modeldata"); // map.put(imagesBuffer.toString() + "/vision.modeldata", "images/images"+param.getNum()+"/vision.modeldata"); // // uploadToOssUtil.uploadMulFiles(map); // // SceneProEntity proEntity = sceneProService.findBySceneNum(param.getNum()); // if(proEntity == null){ // proEntity = new SceneProEntity(); // proEntity.setSceneName("四维看看"); // proEntity.setSceneDec("

四维看看 让空间讲故事

"); // proEntity.setSceneScheme(2); // proEntity.setNum(param.getNum()); // proEntity.setUserId(param.getUserId()); // proEntity.setWebSite(mainUrl + sceneProNewUrl + param.getNum()); // proEntity.setStatus(1); // proEntity.setPayStatus(1); // proEntity.setBuildType("V3"); // // if(param.getSceneSource()!=null){ // proEntity.setSceneSource(param.getSceneSource()); // } // // sceneProService.save(proEntity); // // SceneProEditEntity proEditEntity = new SceneProEditEntity(); // proEditEntity.setProId(proEntity.getId()); // sceneProEditService.save(proEditEntity); // // JSONObject scenejson = JSONObject.parseObject(JSONObject.toJSONString(proEntity)); // scenejson.put("visions", 1); // FileUtils.writeFile(dataBuffer.toString() + File.separator+"scene.json", scenejson.toString()); // } // // return Result.success(mainUrl + sceneProNewUrl + param.getNum()); // } // // @ApiOperation("查找八目未使用过的场景吗") // @PostMapping("/finSceneNum") // public ResultData finSceneNum(){ // String num = sceneNumService.generateSceneNum(); // return Result.success(num); // } // // @ApiOperation("查找123看房未使用过的场景吗") // @PostMapping("/finSkSceneNum") // public ResultData finSkSceneNum(){ // String num = sceneNumService.generateSceneNum(); // return Result.success(num); // } // // @ApiOperation("根据一键换装风格码入库场景表") // @PostMapping("/createChangeScene") // @ApiImplicitParams({ // @ApiImplicitParam(name = "num", value = "", dataType = "String"), // @ApiImplicitParam(name = "oldNum", value = "场景吗", dataType = "String")}) // public ResultData createChangeScene(HttpServletRequest request) throws Exception{ // String projectNum = request.getParameter("num"); // String oldNum = request.getParameter("oldNum"); // String sceneName = request.getParameter("sceneName"); // String resolution = request.getParameter("resolution"); // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(projectNum); // // String floorJson = ConstantFilePath.SCENE_PATH + "data/data" + projectNum + File.separator + "floor.json"; // String floorPlan = ConstantFilePath.SCENE_PATH + "images/images" + projectNum + File.separator + "floorplan.png"; // // int sceneScheme = 12; // if(StringUtil.isNotEmpty(resolution)){ // if("1024".equals(resolution)){ // sceneScheme = 12; // } // if("2048".equals(resolution)){ // sceneScheme = 11; // } // if("4096".equals(resolution)){ // sceneScheme = 10; // } // } // // if(sceneProEntity != null){ // sceneProEntity.setSceneName(sceneName); // sceneProEntity.setStatus(0); // sceneProEntity.setSceneScheme(sceneScheme); // sceneProService.update(sceneProEntity); // // if(!new File(floorJson).exists()){ // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(), // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum); // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json"); // } // // if(!new File(floorPlan).exists()){ // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(), // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum); // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png"); // } // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json")); // scenejson.put("sceneScheme", sceneScheme); // scenejson.put("sceneSource", 11); // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toJSONString()); // // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // sceneProEditEntity.setSceneKey(null); // sceneProEditEntity.setNeedKey(0); // sceneProEditService.update(sceneProEditEntity); // // return Result.success("一键换装场景存在,不重复生成"); // } // // //根据旧的场景生成新的vr场景 // sceneProEntity = sceneProService.findBySceneNum(oldNum); // if(sceneProEntity == null){ // return Result.failure("场景不存在"); // } // // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // // sceneProEntity.setId(null); // sceneProEntity.setSceneType(99); // sceneProEntity.setWebSite(sceneProEntity.getWebSite().replace(oldNum, projectNum)); // sceneProEntity.setNum(projectNum); // sceneProEntity.setSceneName(sceneName); // sceneProEntity.setStatus(0); // sceneProEntity.setPayStatus(1); // sceneProEntity.setSceneScheme(sceneScheme); // sceneProEntity.setSceneSource(11); // sceneProEntity.setSpace(new BigInteger("0")); // sceneProEntity.setCreateTime(new Date()); // sceneProEntity.setVideos(null); // sceneProService.save(sceneProEntity); // // sceneProEditEntity.setId(null); // sceneProEditEntity.setProId(sceneProEntity.getId()); // sceneProEditEntity.setJumpScene(false); // sceneProEditEntity.setHotsIds(null); // sceneProEditEntity.setSceneKey(null); // sceneProEditEntity.setNeedKey(0); // sceneProEditEntity.setScreencapVoiceSrc(null); // sceneProEditEntity.setScreencapVoiceSound(null); // sceneProEditEntity.setScreencapVoiceSoundsync(null); // sceneProEditEntity.setScreencapVoiceType(null); // sceneProEditEntity.setScreencapThumb(null); // sceneProEditEntity.setOverlay(null); // sceneProEditEntity.setFloorPlanAngle("0"); // sceneProEditEntity.setVideosUser(null); // sceneProEditService.save(sceneProEditEntity); // // FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data"+oldNum+File.separator+"scene.json", ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", true); // // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json")); // scenejson.put("jumpScene", false); // scenejson.put("hots", 0); // scenejson.put("screencapVoiceSrc", null); // scenejson.put("screencapVoiceSound", null); // scenejson.put("screencapVoiceSoundsync", null); // scenejson.put("screencapVoiceType", null); // scenejson.put("screencapThumb", null); // scenejson.put("overlay", null); // scenejson.put("sceneScheme", 12); // scenejson.put("sceneSource", 11); // scenejson.put("videos", null); // scenejson.put("videosUser",null); // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toString()); // // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(), // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum); // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(), // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum); //// FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data" + oldNum + File.separator+"floor.json", //// ConstantFilePath.SCENE_PATH+"data/data" + projectNum + File.separator+"floor.json", true); // // // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png"); // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json"); // return Result.success(); // } // // @ApiOperation("获取当前mq的队列数") // @GetMapping("/getMqNum") // public ResultData getMqNum(){ // return Result.success(producer.getMessageCount()); // } // // // @ApiOperation("根据模块名称,查询模块视频地址") // @PostMapping("/findSceneModuleVideo") // @ApiImplicitParams({ // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String")}) // public ResultData findSceneModuleVideo(HttpServletRequest request){ // String moduleName = request.getParameter("moduleName"); // Condition condition = new Condition(SceneModuleVideoEntity.class); // condition.and().andEqualTo("moduleName", moduleName); // return Result.success(sceneModuleVideoService.findAll(condition)); // } // // /** // * 新增或修改场景模块视频地址 // */ // @ApiOperation("新增或修改场景模块视频地址") // @PostMapping(value = "/saveSceneModuleVideo") // @ApiImplicitParams({ // @ApiImplicitParam(name = "id", value = "有则修改,无则新增", dataType = "String"), // @ApiImplicitParam(name = "sceneNum", value = "场景编码", dataType = "String"), // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String"), // @ApiImplicitParam(name = "videoUrl", value = "视频地址", dataType = "String"), // @ApiImplicitParam(name = "images", value = "缩略图", dataType = "String")}) // private Result saveSceneModuleVideo(HttpServletRequest request) throws Exception{ // String id = request.getParameter("id"); // String sceneNum = request.getParameter("sceneNum"); // String moduleName = request.getParameter("moduleName"); // String videoUrl = request.getParameter("videoUrl"); // String images = request.getParameter("images"); // // if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(moduleName) || StringUtils.isEmpty(videoUrl)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // SceneModuleVideoEntity entity = new SceneModuleVideoEntity(); // entity.setSceneNum(sceneNum); // entity.setImages(images); // entity.setModuleName(moduleName); // entity.setVideoUrl(videoUrl); // // if(StringUtils.isEmpty(id)){ // sceneModuleVideoService.save(entity); // }else { // entity.setId(Long.valueOf(id)); // sceneModuleVideoService.update(entity); // } // // return Result.success(); // // } // // /** // * 删除场景模块视频地址 // */ // @ApiOperation("删除场景模块视频地址") // @PostMapping(value = "/deleteSceneModuleVideo") // @ApiImplicitParams({ // @ApiImplicitParam(name = "id", value = "id", dataType = "String")}) // private Result deleteSceneModuleVideo(HttpServletRequest request) throws Exception{ // String id = request.getParameter("id"); // // if(org.springframework.util.StringUtils.isEmpty(id)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // sceneModuleVideoService.deleteById(Long.valueOf(id)); // return Result.success(); // } // // /** // * 下载思为的html页面 // */ // @ApiOperation("下载思为的html页面") // @PostMapping(value = "/downloadSiWeiHtml") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")}) // public ResultData downloadSiWeiHtml(HttpServletRequest request) throws Exception{ // String token = getToken(); // if(StringUtils.isEmpty(token)){ // throw new BaseRuntimeException(3004, "无token参数"); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if(ssoUser == null){ // throw new BaseRuntimeException(3004, "token参数不正确"); // } // // String sceneNum = request.getParameter("sceneNum"); // // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // //获取getInfo的数据 // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // if(sceneProEntity.getPayStatus() != 1){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // if(ssoUser == null || ssoUser.getId().longValue() != sceneProEntity.getUserId().longValue()){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014); // } // // if(isDownload.get()){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5024, SceneConstant.FAILURE_MSG_5024); // } // // isDownload.compareAndSet(false, true); // // try{ // ResponseScene responseScene = new ResponseScene(); // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // // CreateObjUtil.callshell("bash /opt/ossutil/copy.sh " + ConstantFilePath.BASE_PATH + // "/local/localHose" + " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum); // // //14表示matterPro场景,需要调用命令获取切图,并且修改sceneScheme为13 // if(sceneProEntity.getSceneSource() == 14){ // sceneProEntity.setSceneScheme(13); // CreateObjUtil.matterproCutImg(sceneProEntity.getNum(), ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum); // } // // BeanUtils.copyProperties(editEntity, responseScene); // BeanUtils.copyProperties(sceneProEntity, responseScene); // if(StringUtil.isNotEmpty(editEntity.getEntry())){ // responseScene.setEntry(JSONObject.parseObject(editEntity.getEntry()).toJSONString()); // } // // if(StringUtil.isNotEmpty(sceneProEntity.getGps())){ // responseScene.setGps(JSONObject.parseObject(sceneProEntity.getGps()).toJSONString()); // } // // responseScene.setCreateTime(new DateTime(sceneProEntity.getCreateTime()).toString("yyyy-MM-dd")); // responseScene.setCreateDate(sceneProEntity.getCreateTime().getTime()); // if(StringUtil.isEmpty(editEntity.getSceneKey())){ // responseScene.setIsPublic(0); // }else { // responseScene.setIsPublic(1); // } // // //不返回场景访问密码 // responseScene.setSceneKey(""); // // //替换index.html里面的场景码 // String indexPath = ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + File.separator + "embed.html"; // String index = FileUtils.readFile(indexPath); // FileUtils.deleteFile(indexPath); // FileUtils.writeFile(indexPath, index.replace("__ProjectNum__", sceneNum)); // // //下载oss资源 // CreateObjUtil.ossUtilCp("data/data" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data"); // CreateObjUtil.ossUtilCp("images/images" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/images"); // CreateObjUtil.ossUtilCp("video/video" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/video"); // CreateObjUtil.ossUtilCp("voice/voice" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/voice"); // // FileUtils.writeFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data/data" + sceneNum + "/getInfo.json", // JSONObject.toJSONString(responseScene)); // // CreateObjUtil.callshell("bash /opt/ossutil/gzip.sh " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + // " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum); // // FileUtils.deleteDirectory(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum); //// FileUtils.deleteFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + ".zip"); // // isDownload.compareAndSet(true, false); // return Result.success((Object)"local/localHose" + sceneNum + ".zip"); // }catch (Exception e){ // e.printStackTrace(); // isDownload.compareAndSet(true, false); // return Result.failure(LoginConstant.ERROR_MSG); // }finally { // isDownload.compareAndSet(true, false); // } // // } // // /** // * 思为获取场景列表 // */ // @ApiOperation("思为获取场景列表") // @PostMapping(value = "/siweiSceneList") // @ApiImplicitParams({ // @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"), // @ApiImplicitParam(name = "pageSize", value = "页数", dataType = "String"), // @ApiImplicitParam(name = "snCode", value = "相机sn", dataType = "String"), // @ApiImplicitParam(name = "sceneName", value = "场景名称", dataType = "String"), // @ApiImplicitParam(name = "startDate", value = "开始时间", dataType = "String"), // @ApiImplicitParam(name = "endDate", value = "结束时间", dataType = "String")}) // public Result> siweiSceneList(HttpServletRequest request) throws Exception{ // String token = getToken(); // if(StringUtils.isEmpty(token)){ // throw new BaseRuntimeException(3004, "无token参数"); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if(ssoUser == null){ // throw new BaseRuntimeException(3004, "token参数不正确"); // } // // String pageNumStr = request.getParameter("pageNum"); // String pageSizeStr = request.getParameter("pageSize"); // // String sceneName = request.getParameter("sceneName"); // String snCode = request.getParameter("snCode"); // String startDate = request.getParameter("startDate"); // String endDate = request.getParameter("endDate"); // String num = request.getParameter("num"); // // String cameraId = null; // // if(StringUtils.isNotEmpty(snCode)){ // CameraEntity cameraEntity = goodsService.findBySnCode(snCode); // if(cameraEntity == null){ // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003); // } // // cameraId = String.valueOf(cameraEntity.getId()); // } // // Integer pageNum = 1; // Integer pageSize = 10; // if(StringUtils.isNotEmpty(pageNumStr)){ // pageNum = Integer.valueOf(pageNumStr); // } // // if(StringUtils.isNotEmpty(pageSizeStr)){ // pageSize = Integer.valueOf(pageSizeStr); // } // //// List counts = sceneService.findAllSceneCount("create_time desc", null, //// null, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num); // // PageHelper.startPage(pageNum, pageSize); // List sceneEntityList = sceneService.findAllScene("create_time desc", null, // null, pageNum, pageSize, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num, null, null, null); // // PageInfo data = new PageInfo<>(sceneEntityList); // // List> list = new ArrayList<>(); // Map map = null; // SceneProEditEntity sceneProEditEntity = null; // CameraEntity cameraEntity = null; // for (SceneProEntity sceneProEntity : data.getList()) { // map = new HashMap<>(); // map.put("num", sceneProEntity.getNum()); // map.put("sceneName", sceneProEntity.getSceneName()); // // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId()); // if(cameraEntity != null){ // map.put("snCode", cameraEntity.getSnCode()); // } // // map.put("webSite", sceneProEntity.getWebSite()); // map.put("createDate", sceneProEntity.getCreateTime().getTime()); // map.put("createTime", new DateTime(sceneProEntity.getCreateTime()).toString(DateUtil.DEFAULT_DATE_FORMAT)); // map.put("thumb", sceneProEntity.getThumb()); // map.put("shootCount", sceneProEntity.getShootCount()); // // sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // map.put("version", sceneProEditEntity.getVersion()); // list.add(map); // } // //// int count = 0; //// for(Integer number : counts){ //// count += number; //// } //// // Page> a = new Page>(pageNum, pageSize); // a.setTotal(data.getTotal()); // PageInfo> result = a.toPageInfo(); // result.setList(list); //// PageInfo> result = new PageInfo<>(list); // return Result.success(result); // } // // /** // * 将floor.json转换成酷家乐数据 // */ // @ApiOperation("将floor.json转换成酷家乐数据") // @PostMapping(value = "/convertCadKjl") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")}) // public String convertCadKjl(HttpServletRequest request) throws Exception{ // String sceneNum = request.getParameter("sceneNum"); // // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // StringBuffer dataBuf = new StringBuffer() // .append("data").append(File.separator) // .append("data").append(sceneNum) // .append(File.separator); // // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString()); // // String floorPath = dataBuffer.toString() + "floor.json"; // CreateObjUtil.ossUtilCp(dataBuf.toString() + "floor.json", dataBuffer.toString()); // // ConvertCadKjl cad = new ConvertCadKjl(); // cad.init("指房宝", "指房宝装修房", "", "2", floorPath); // cad.input = cad.preHandle(cad.input); // JSONArray beams = cad.getBeams(); // JSONArray walls = cad.getWalls(); // walls = ConvertCadKjl.removeRepeat(walls); // JSONArray rooms = cad.getRooms(); // JSONArray flues = cad.getFlues(); // JSONArray holes = cad.getHoles(); // // cad.output.put("holes", holes); // cad.output.put("flues", flues); // cad.output.put("beams", beams); // cad.output.put("rooms", rooms); // cad.output.put("walls", walls); // cad.output.put("needTranslate", false); // // return cad.output.toJSONString(); // } // // // /** // * 创建sketch场景分享二维码的logo // */ // @ApiOperation("创建sketch场景分享二维码的logo") // @PostMapping(value = "/createSketchQrLogo") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")}) // public ResultData createSketchQrLogo(HttpServletRequest request) throws Exception{ // String sceneNum = request.getParameter("sceneNum"); // // if(StringUtils.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // //生成二维码 // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum, ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+".png", null); // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+"_en.png", null); // return Result.success(); // } // // /** // * 恢复scene.json中文乱码问题 // */ // @ApiOperation("恢复scene.json中文乱码问题") // @PostMapping(value = "/updateSceneJsonCode") // @ApiImplicitParams({ // @ApiImplicitParam(name = "createTime", value = "该时间点之后的场景", dataType = "String")}) // public ResultData updateSceneJsonCode(HttpServletRequest request) throws Exception{ // String createTime = request.getParameter("createTime"); // // Condition condition = new Condition(SceneProEntity.class); // condition.and().andGreaterThanOrEqualTo("createTime", createTime); // List list = sceneProService.findAll(condition); // Map map = new HashMap<>(); // for (SceneProEntity sceneProEntity : list) { // map = new HashMap<>(); // map.put("sceneName", sceneProEntity.getSceneName()); // map.put("sceneDec", sceneProEntity.getSceneDec()); // FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneProEntity.getNum() + "/scene.json", map); // } // return Result.success("修改了:" + list.size()); // } // /** * 获取数据对接下载信息 */ @PostMapping(value = "/downLoadZSData") public ResultData downLoadZSData(@Validated BaseSceneParamVO param) throws Exception{ return sceneService.downLoadZSData(param); } // // /** // * 增加场景下载次数 // */ // @ApiOperation("增加场景下载次数") // @PostMapping(value = "/addDownloadNum") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")}) // public ResultData addDownloadNum(HttpServletRequest request) throws Exception{ // String sceneNum = request.getParameter("sceneNum"); // if(StringUtil.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // if(sceneProEditEntity.getDownloadNum() == null){ // sceneProEditEntity.setDownloadNum(1); // }else{ // sceneProEditEntity.setDownloadNum(sceneProEditEntity.getDownloadNum() + 1); // } // // sceneProEditService.update(sceneProEditEntity); // // //操作记录log //// TmIncrementLogEntity tmIncrementLogEntity = new TmIncrementLogEntity(); //// tmIncrementLogEntity.setSceneNum(sceneProEntity.getNum()); //// tmIncrementLogEntity.setType("1"); //// iIncrementDownloadLogService.save(tmIncrementLogEntity); // // return Result.success(); // } // // /** // * 查询总下载次数 // */ // @ApiOperation("查询总下载次数") // @PostMapping(value = "/findDownloadNum") // public ResultData findDownloadNum(HttpServletRequest request) throws Exception{ // // return Result.success(sceneProEditService.findDownloadNum()); // } // // /** // * 增加imagesVersion // */ // @ApiOperation("查询总下载次数") // @PostMapping(value = "/addImagesVersion") // public ResultData addImagesVersion(HttpServletRequest request) throws Exception{ // String num = request.getParameter("num"); // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId()); // sceneProEditEntity.setImagesVersion(sceneProEditEntity.getImagesVersion() + 1); // sceneProEditService.update(sceneProEditEntity); // // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json")); // scenejson.put("imagesVersion", sceneProEditEntity.getImagesVersion()); // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json", scenejson.toJSONString()); // // return Result.success(); // } // // /** // * 删除4k图 // */ // @ApiOperation("删除4k图") // @PostMapping(value = "/remove4KImg") // public ResultData remove4KImg() throws Exception{ // // List list = sceneProService.findAll(); // CameraDetailEntity cameraDetailEntity = new CameraDetailEntity(); // String path = ""; // // for(SceneProEntity sceneProEntity : list){ // if(sceneProEntity.getPayStatus() != 1 || sceneProEntity.getId() < 10685){ // continue; // } // path = sceneProEntity.getDataSource(); // log.info("场景:" + sceneProEntity.getNum()); // // String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json"); // JSONObject uploadJson = null; // JSONArray array = null; // if(uploadData!=null) { // uploadJson = JSONObject.parseObject(uploadData); // array = uploadJson.getJSONArray("upload"); // } // if(array == null){ // log.info("场景计算失败:" + sceneProEntity.getNum()); // continue; // } // JSONObject fileJson = null; // String fileName = ""; // Map map = new HashMap<>(); // for(int i = 0, len = array.size(); i < len; i++){ // fileJson = array.getJSONObject(i); // fileName = fileJson.getString("file"); // //文件不存在抛出异常 // if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){ // throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在"); // } // // // //tiles文件夹,亚马逊瓦片图 // if(fileJson.getIntValue("clazz") == 7 ){ // if(fileName.contains("/4k_")){ // map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+ // sceneProEntity.getNum()+ File.separator + fileName); // } // } // // } // // Long space = 0L; // File spaceFile = null; // for (String key : map.keySet()) { // spaceFile = new File(key); // if(spaceFile.exists()){ // space += spaceFile.length(); // } // } // if(space > 0){ // if(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())).compareTo(new BigInteger("0")) < 0){ // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量小于0不处理"); // continue; // } // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量"); // sceneProEntity.setSpace(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())) ); // sceneProService.update(sceneProEntity); // // cameraDetailEntity = cameraDetailService.findByCameraId(sceneProEntity.getCameraId()); // cameraDetailEntity.setUsedSpace(sceneProService.findTotalSpaceByCameraId(sceneProEntity.getCameraId())); // cameraDetailService.update(cameraDetailEntity); // } // } // // // return Result.success(); // } // // /** // * // * 获取场景描述等信息 // */ // @ApiOperation("获取场景描述等信息") // @PostMapping(value = "/getSceneDetail") // @CheckCurrentUser(description = "获取场景描述等信息") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")}) // public ResultData getSceneDetail(String sceneNum) throws Exception{ // String token = getToken(); // if(StringUtils.isEmpty(token)){ // throw new BaseRuntimeException(3004, "无token参数"); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if(ssoUser == null){ // throw new BaseRuntimeException(3004, "token参数不正确"); // } // // if(StringUtil.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // String snCode = null; // if(!ObjectUtils.isEmpty(sceneProEntity.getCameraId())){ // CameraEntity cameraEntity = cameraService.findById(sceneProEntity.getCameraId()); // if(ObjectUtils.isEmpty(cameraEntity)){ // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029); // } // snCode = cameraEntity.getSnCode(); // } // Map map = new HashMap<>(); // map.put("webSite", sceneProEntity.getWebSite()); // map.put("thumb", sceneProEntity.getThumb()); // map.put("num", sceneProEntity.getNum()); // map.put("sceneName", sceneProEntity.getSceneName()); // map.put("sceneDec", sceneProEntity.getSceneDec()); // map.put("snCode", snCode); // map.put("createDate", sceneProEntity.getCreateTime().getTime()); // map.put("createTime", DateUtil.date2String(sceneProEntity.getCreateTime(), DateUtil.YYYY_MM_DD_DATE_FORMAT)); // // return Result.success(map); // } // // // /** // * // * 随心装场景码同步 // */ // @ApiOperation("随心装场景码同步") // @PostMapping(value = "/synsencecode") // @CheckCurrentUser(description = "随心装场景码同步") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"), // @ApiImplicitParam(name = "vrsceneNum", value = "随心装场景码", dataType = "String")}) // public ResultData synsencecode(String sceneNum,String vrsceneNum) throws Exception{ // String token = getToken(); // if(StringUtils.isEmpty(token)){ // throw new BaseRuntimeException(3004, "无token参数"); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if(ssoUser == null){ // throw new BaseRuntimeException(3004, "token参数不正确"); // } // // if(StringUtil.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // if(StringUtil.isEmpty(vrsceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // // // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // //dsx 这里使用com.fdkankan.scene.service.impl.SceneProEditExtServiceImpl#findEdit // SceneProEditEntity editEntity = sceneProService.findEdit(sceneProEntity); // // if(editEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // editEntity.setVrNum(vrsceneNum); // sceneProService.updateEdit(editEntity); // // return Result.success(); // } // // /** // * // * 三维家 拉取场景数据,压缩zip包 // */ // @ApiOperation("三维家 拉取场景数据,压缩zip包") // @PostMapping(value = "/scenecpzip") // @CheckCurrentUser(description = "随心装场景码同步") // @ApiImplicitParams({ // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String") // }) // public ResultData scenecpzip(String sceneNum) throws Exception{ // String token = getToken(); // if(StringUtils.isEmpty(token)){ // throw new BaseRuntimeException(3004, "无token参数"); // } // // SSOUser ssoUser = SSOLoginHelper.loginCheck(token); // if(ssoUser == null){ // throw new BaseRuntimeException(3004, "token参数不正确"); // } // // if(StringUtil.isEmpty(sceneNum)){ // throw new BaseRuntimeException(LoginConstant.PARAM_REQUIRED, LoginConstant.FAILURE_MSG_3001); // } // // // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum); // // // if(sceneProEntity == null){ // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005); // } // // // return Result.success(); // } }