SceneController.java 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873
  1. package com.fdkankan.scene.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.fdkankan.common.constant.ErrorCode;
  6. import com.fdkankan.common.constant.PayStatus;
  7. import com.fdkankan.common.constant.SceneInfoReqType;
  8. import com.fdkankan.common.constant.ServerCode;
  9. import com.fdkankan.common.exception.BusinessException;
  10. import com.fdkankan.common.response.ResultData;
  11. import com.fdkankan.redis.util.RedisUtil;
  12. import com.fdkankan.scene.entity.SceneDataDownload;
  13. import com.fdkankan.scene.entity.SceneEditInfo;
  14. import com.fdkankan.scene.entity.ScenePro;
  15. import com.fdkankan.scene.service.*;
  16. import com.fdkankan.scene.vo.*;
  17. import java.util.Objects;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.validation.annotation.Validated;
  20. import org.springframework.web.bind.annotation.*;
  21. /**
  22. * <p>
  23. * 场景表 前端控制器
  24. * </p>
  25. *
  26. * @author dengsixing
  27. * @since 2021-12-23
  28. */
  29. @RestController
  30. @RequestMapping("/api/scene")
  31. public class SceneController {
  32. @Autowired
  33. ISceneProService sceneProService;
  34. @Autowired
  35. ISceneService sceneService;
  36. @Autowired
  37. ISceneFileBuildService sceneFileBuildService;
  38. @Autowired
  39. IVideoSceneProgressService videoSceneProgressService;
  40. @Autowired
  41. IPicSceneProgressService picSceneProgressService;
  42. @Autowired
  43. ISceneEditInfoService sceneEditInfoService;
  44. // /**
  45. // * 获取场景详情
  46. // */
  47. // @PostMapping(value = "/getInfo")
  48. // public SceneVO getInfo(@RequestBody SceneParamVO param){
  49. // return sceneProService.getInfo(param.getNum());
  50. // }
  51. /**
  52. * 获取场景详情
  53. */
  54. @GetMapping(value = "/getInfo")
  55. public SceneInfoVO getInfo(@Validated SceneInfoParamVO param) throws Exception{
  56. param.setReqType(SceneInfoReqType.VIEW.code());
  57. return sceneEditInfoService.getSceneInfo(param);
  58. }
  59. /**
  60. * 场景浏览
  61. * @param param
  62. * @return
  63. */
  64. @PostMapping(value = "/search")
  65. public IPage<SceneVO> search(@RequestBody SceneParamVO param) {
  66. return sceneService.search(param);
  67. }
  68. /**
  69. * 场景浏览
  70. * @param param
  71. * @return
  72. */
  73. @PostMapping(value = "/loadScene")
  74. public Page loadScene(@RequestBody SceneParamVO param) {
  75. return sceneService.loadScene(param);
  76. }
  77. /**
  78. * 场景浏览
  79. * @param param
  80. * @return
  81. */
  82. @PostMapping(value = "/loadAllScene")
  83. public Page loadAllScene(@RequestBody SceneParamVO param){
  84. return sceneService.loadAllScene2(param);
  85. }
  86. /**
  87. * 更新浏览次数
  88. */
  89. @PostMapping(value = "/updateViewCount")
  90. public ResultData updateViewCount(@RequestBody SceneParamVO param){
  91. return sceneService.updateViewCount(param.getNum());
  92. }
  93. /**
  94. * 手动更新浏览数据到数据库
  95. */
  96. @PostMapping(value = "/updatePv")
  97. public ResultData updatePv() throws Exception {
  98. sceneService.updatePv();
  99. return ResultData.ok();
  100. }
  101. /**
  102. * 场景模型重新计算
  103. */
  104. @PostMapping(value = "/rebuildScene")
  105. public ResultData rebuildScene(@RequestParam("num") String num) throws Exception {
  106. return sceneFileBuildService.rebuildScene(num);
  107. }
  108. /**
  109. * 场景模型重新计算
  110. */
  111. @PostMapping(value = "/rebuildVideoScene")
  112. public ResultData rebuildVideoScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
  113. return sceneFileBuildService.rebuildVideoScene(param);
  114. }
  115. /**
  116. * 场景模型重新计算
  117. */
  118. @PostMapping(value = "/rebuildPicScene")
  119. public ResultData rebuildPicScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
  120. return sceneFileBuildService.rebuildPicScene(param);
  121. }
  122. /**
  123. * 场景视频重新计算进度
  124. */
  125. @PostMapping(value = "/rebuildVideoSceneProgress")
  126. public ResultData rebuildVideoSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
  127. return videoSceneProgressService.rebuildVideoSceneProgress(param);
  128. }
  129. /**
  130. * 场景视频重新计算进度
  131. */
  132. @PostMapping(value = "/rebuildPicSceneProgress")
  133. public ResultData rebuildPicSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
  134. return picSceneProgressService.rebuildPicSceneProgress(param);
  135. }
  136. /**
  137. * 查看场景对应的数据,给刘强用的
  138. */
  139. @PostMapping(value = "/querySceneDataSource")
  140. public ResultData querySceneDataSource(@RequestBody SceneParamVO param){
  141. return sceneService.querySceneDataSource(param);
  142. }
  143. /**
  144. * 查看场景对应的场景码,给刘强用的
  145. */
  146. @PostMapping(value = "/querySceneNum")
  147. public ResultData querySceneNum(@RequestBody SceneParamVO param){
  148. return sceneService.querySceneNum(param);
  149. }
  150. /**
  151. * 查看场景对应的数据,给刘强用的
  152. */
  153. @PostMapping(value = "/downloadCapture")
  154. public ResultData downloadCapture(@RequestBody SceneParamVO param) throws Exception {
  155. return sceneProService.downloadCapture(param);
  156. }
  157. /**
  158. * 上传results数据
  159. * @param param
  160. */
  161. @PostMapping(value = "/uploadResultsData")
  162. public ResultData uploadResultsData(@RequestBody SceneParamVO param) throws Exception{
  163. return sceneProService.uploadResultsData(param);
  164. }
  165. /**
  166. * 一键换装完成修改场景状态
  167. * @param param
  168. */
  169. @PostMapping(value = "/updateStatusByScene")
  170. public ResultData updateStatusByScene(@RequestBody SceneParamVO param) throws Exception{
  171. return sceneProService.updateStatusByScene(param);
  172. }
  173. /**
  174. * 获取一键换装场景状态
  175. */
  176. @PostMapping(value = "/getStatusByScene")
  177. public ResultData getStatusByScene(SceneParamVO param) throws Exception{
  178. return sceneProService.getStatusByScene(param);
  179. }
  180. // /**
  181. // * 获取场景详情
  182. // */
  183. // @ApiOperation("获取场景详情")
  184. // @PostMapping(value = "/getSceneAndCameras")
  185. // public ResultData getSceneAndCameras(@RequestBody Map<String,Object> params) throws Exception {
  186. // String userName = params.get("userName").toString();
  187. // List excludeNums = (List)params.get("excludeNums");
  188. // UserEntity user = userService.findUserByUserName(userName);
  189. // if(ObjectUtils.isEmpty(user)){
  190. // throw new BaseRuntimeException("用户不存在");
  191. // }
  192. // return sceneProService.getSceneAndCameras(user.getId(),excludeNums);
  193. // }
  194. //
  195. // /**
  196. // * 获取场景详情
  197. // */
  198. // @ApiOperation("获取场景详情")
  199. // @PostMapping(value = "/findSceneEcs")
  200. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
  201. // public ResultData findSceneEcs(HttpServletRequest request) throws Exception{
  202. // String sceneNum = request.getParameter("num");
  203. // if(StringUtils.isEmpty(sceneNum)){
  204. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  205. // }
  206. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  207. // if(sceneProEntity == null){
  208. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  209. // }
  210. // return Result.success((Object) sceneProEntity.getEcs());
  211. // }
  212. //
  213. /**
  214. * 根据场景密码打开场景
  215. */
  216. @PostMapping(value = "/check/key")
  217. public ResultData checkKey(@RequestBody @Validated SceneCheckKeyParamVO param) throws Exception {
  218. return sceneEditInfoService.checkKey(param);
  219. }
  220. // /**
  221. // * 是否已登录
  222. // * @return
  223. // */
  224. // @ApiOperation("是否已登录")
  225. // @PostMapping(value = "/isLogin")
  226. // @ApiImplicitParams({
  227. // @ApiImplicitParam(name = "token", value = "用户token", dataType = "String"),
  228. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
  229. // public ResultData isLogin(HttpServletRequest request) throws Exception{
  230. // String num = request.getParameter("num");
  231. // String token = request.getHeader("token");
  232. // if(StringUtil.isEmpty(num) ){
  233. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  234. // }
  235. //
  236. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  237. // if (ssoUser == null){
  238. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
  239. // }
  240. //
  241. // // 解密获得username,用于和数据库进行对比
  242. // String username = JwtUtil.getUsername(token);
  243. //
  244. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
  245. // if(sceneProEntity == null){
  246. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  247. // }
  248. // if(sceneProEntity.getPayStatus() != 1){
  249. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  250. // }
  251. // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){
  252. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  253. // }
  254. //
  255. // JSONObject jsonObject = new JSONObject();
  256. //
  257. // List<SceneResourceEntity> exclude = new ArrayList<>();
  258. // SceneResourceEntity excludeEntity = new SceneResourceEntity();
  259. // excludeEntity.setKeyWord("data");
  260. // exclude.add(excludeEntity);
  261. //
  262. // CameraEntity cameraEntity = goodsService.findByChildName(username);
  263. // jsonObject.put("exclude", exclude);
  264. // jsonObject.put("include", new ArrayList<>());
  265. // jsonObject.put("company", null);
  266. // Result result = Result.success(jsonObject);
  267. //
  268. // //判断该场景是否属于增值权益
  269. // boolean isIncrement = false;
  270. // //获取该相机是否有权益
  271. // boolean isExpired = false;
  272. // CameraEntity sceneCamera = goodsService.findCameraById(sceneProEntity.getCameraId());
  273. // if(sceneCamera != null){
  274. // UserIncrementEntity userIncrementEntity = userIncrementService.findByCameraId(sceneCamera.getId());
  275. //
  276. // if(userIncrementEntity != null){
  277. // if( userIncrementEntity.getIsExpired().intValue() == 0){
  278. // isIncrement = true;
  279. // }
  280. // if(userIncrementEntity.getIsExpired().intValue() == 1){
  281. // isExpired = true;
  282. // }
  283. // }else{
  284. // try {
  285. // Date date = DateUtil.string2Date("2021-09-09 00:00:00",null);
  286. //
  287. // //非07批次的放开
  288. // String pc = sceneCamera.getSnCode().substring(0,2);
  289. // if(!pc.equals("07") ){
  290. // if(sceneCamera.getCreateTime()!=null && date.after(sceneCamera.getCreateTime())){
  291. //
  292. // isIncrement = true;
  293. // isExpired = false;
  294. // }
  295. // }
  296. // }catch (Exception e){
  297. // e.printStackTrace();
  298. // }
  299. // }
  300. // }
  301. //
  302. // jsonObject.put("isExpired", isExpired );
  303. // jsonObject.put("isIncrement", isIncrement);
  304. //
  305. // //判断过期时间
  306. // Date date = DateUtil.string2Date(expectedTime,null);
  307. //
  308. // jsonObject.put("isTransition",DateUtil.isBeforeNow2(date));
  309. //
  310. //
  311. // if(cameraEntity != null){
  312. // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
  313. // if(cameraDetailEntity.getCompanyId() != null){
  314. // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){
  315. // jsonObject.put("exclude", new ArrayList<>());
  316. // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue());
  317. // }
  318. // }
  319. // return result;
  320. // }
  321. //
  322. // UserEntity userEntity = userService.findUserByUserName(username);
  323. // if("18750226207".equals(username)){
  324. // log.info("18750226207该账号默认超级管理员,可以操作所有场景");
  325. // }
  326. // else if(userEntity == null || sceneProEntity.getUserId() == null || userEntity.getId().longValue() != sceneProEntity.getUserId().longValue()){
  327. // log.info("user:" + userEntity.getId() + ",scene:" + sceneProEntity.getUserId());
  328. //
  329. // Condition condition = new Condition(SceneCooperationEntity.class);
  330. // condition.and().andEqualTo("sceneNum", num);
  331. // List<SceneCooperationEntity> list = sceneCooperationService.findAll(condition);
  332. // if(list != null && list.size() > 0){
  333. // if(list.get(0).getUserId().longValue() != userEntity.getId().longValue()){
  334. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  335. // }
  336. // }else {
  337. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  338. // }
  339. // }
  340. //
  341. // if(sceneProEntity.getCameraId() != null){
  342. // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId());
  343. // if(cameraEntity != null){
  344. // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
  345. // if(cameraDetailEntity.getCompanyId() != null){
  346. // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){
  347. // jsonObject.put("exclude", new ArrayList<>());
  348. // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue());
  349. // }
  350. // }
  351. // }
  352. // }
  353. //
  354. // //权限控制完后判断若是协作账号,获取协作权限
  355. // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(num);
  356. // //若数据为空表示可操作全部资源
  357. // if(sceneCooperationEntity == null || sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){
  358. // return result;
  359. // }
  360. //
  361. // if(sceneProEntity != null && sceneProEntity.getUserId() == sceneCooperationEntity.getUserId().longValue()){
  362. // return result;
  363. // }
  364. //
  365. // jsonObject.put("include", sceneResourceService.findByCooperationId(sceneCooperationEntity.getId()));
  366. //
  367. // return result;
  368. //
  369. // }
  370. //
  371. // //跳转到编辑页面
  372. // @ApiOperation("跳转到编辑页面")
  373. // @PostMapping("goEditScenePage")
  374. // @ApiImplicitParams({
  375. // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
  376. // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
  377. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"),
  378. // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String"),
  379. // @ApiImplicitParam(name = "vlog", value = "vlog", dataType = "String"),
  380. // @ApiImplicitParam(name = "childName", value = "相机编码", dataType = "String")
  381. // })
  382. // public void goEditScenePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
  383. // String phoneNum = request.getParameter("phoneNum");
  384. // String password = request.getParameter("password");
  385. // String sceneNum = request.getParameter("sceneNum");
  386. // String childName = request.getParameter("childName");
  387. // String lang = request.getParameter("lang");
  388. // String vlog = request.getParameter("vlog");
  389. //
  390. // SceneProEntity scene = sceneProService.findBySceneNum(sceneNum);
  391. //
  392. // if(scene == null) {
  393. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  394. // }
  395. //
  396. // if(StringUtil.isNotEmpty(childName)){
  397. // CameraEntity cameraEntity = goodsService.findByChildName(childName);
  398. // if(cameraEntity != null){
  399. //
  400. // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
  401. // if(cameraDetailEntity != null && cameraDetailEntity.getCooperationUser() != null){
  402. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  403. // }
  404. //
  405. // SSOUser dbUser = new SSOUser();
  406. // dbUser.setUserName(childName);
  407. //
  408. // String token = JwtUtil.createJWT(-1, childName);
  409. // SSOLoginHelper.login(token, dbUser);
  410. //
  411. // //登录成功
  412. // if(scene.getWebSite().contains(sceneProUrl)){
  413. // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
  414. // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
  415. // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
  416. // }
  417. //
  418. // if(scene.getWebSite().contains(sceneProNewUrl)){
  419. // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
  420. // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
  421. // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
  422. // }
  423. // return;
  424. // }
  425. // }
  426. //
  427. // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)
  428. // || StringUtils.isEmpty(sceneNum)){
  429. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  430. // }
  431. //
  432. // if(scene.getUserId()==null)
  433. // {
  434. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5013, SceneConstant.FAILURE_MSG_5013);
  435. // }
  436. //
  437. // Result result = userService.findByUserName(phoneNum);
  438. // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
  439. // if(ssoUser == null){
  440. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  441. // }
  442. //
  443. // if(ssoUser.getId().longValue() != scene.getUserId().longValue()) {
  444. // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(sceneNum);
  445. // if(sceneCooperationEntity == null){
  446. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  447. // }
  448. //
  449. // if(sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){
  450. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  451. // }
  452. //
  453. // }
  454. //
  455. // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
  456. // {
  457. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  458. // }
  459. //
  460. // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
  461. // SSOLoginHelper.login(token, ssoUser);
  462. // //登录成功
  463. // if(scene.getWebSite().contains(sceneProUrl)){
  464. // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
  465. // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
  466. // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
  467. // }
  468. //
  469. // if(scene.getWebSite().contains(sceneProNewUrl)) {
  470. // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
  471. // sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" +
  472. // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
  473. // }
  474. // }
  475. //
  476. // //跳转到官网消费页面
  477. // @ApiOperation("跳转到官网消费页面")
  478. // @PostMapping("goConsumptionPage")
  479. // @ApiImplicitParams({
  480. // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
  481. // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
  482. // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")})
  483. // public void goConsumptionPage(HttpServletRequest request, HttpServletResponse response) throws Exception{
  484. // String phoneNum = request.getParameter("phoneNum");
  485. // String password = request.getParameter("password");
  486. // String lang = request.getParameter("lang");
  487. //
  488. // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){
  489. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  490. // }
  491. //
  492. // Result result = userService.findByUserName(phoneNum);
  493. // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
  494. // if(ssoUser == null){
  495. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  496. // }
  497. //
  498. // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
  499. // {
  500. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  501. // }
  502. //
  503. // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
  504. // SSOLoginHelper.login(token, ssoUser);
  505. // //登录成功
  506. // response.sendRedirect(mainUrl + "mobile.html?token="+ token + "&app" + (lang == null ? "" : "&lang=" + lang)+"#/consumption/0" );
  507. // }
  508. //
  509. // //跳转到官网扩容充值页面
  510. // @ApiOperation("跳转到官网扩容充值页面")
  511. // @PostMapping("goRechargePage")
  512. // @ApiImplicitParams({
  513. // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
  514. // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
  515. // @ApiImplicitParam(name = "childName", value = "相机mac地址", dataType = "String"),
  516. // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")})
  517. // public void goRechargePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
  518. // String phoneNum = request.getParameter("phoneNum");
  519. // String password = request.getParameter("password");
  520. // String childName = request.getParameter("childName");
  521. // String lang = request.getParameter("lang");
  522. //
  523. // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){
  524. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  525. // }
  526. //
  527. // Result result = userService.findByUserName(phoneNum);
  528. // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
  529. // if(ssoUser == null){
  530. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  531. // }
  532. //
  533. // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
  534. // {
  535. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
  536. // }
  537. //
  538. // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
  539. // SSOLoginHelper.login(token, ssoUser);
  540. // //登录成功
  541. // response.sendRedirect(mainUrl + "mobile.html#/introduce/" + childName + "?token=" + token + "&app" + (lang == null ? "" : "&lang=" + lang));
  542. // }
  543. //
  544. // /**
  545. // * app录音获取录音文件版本
  546. // */
  547. // @ApiOperation("app录音获取录音文件版本")
  548. // @PostMapping(value = "/getVoiceSound")
  549. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
  550. // public ResultData getVoiceSound(HttpServletRequest request) throws Exception {
  551. // String sceneNum = request.getParameter("num");
  552. // if(StringUtils.isEmpty(sceneNum)){
  553. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  554. // }
  555. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  556. // if(sceneProEntity == null){
  557. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  558. // }
  559. // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  560. //
  561. // //更新访问数量
  562. // return Result.success(editEntity.getScreencapVoiceSoundsync());
  563. // }
  564. //
  565. // /**
  566. // * 下载模型文件
  567. // */
  568. // @ApiOperation("下载模型文件")
  569. // @PostMapping(value = "/downloadTexData")
  570. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
  571. // public ResultData downloadTexData(HttpServletRequest request, HttpServletResponse response) throws Exception {
  572. // String sceneNum = request.getParameter("num");
  573. //
  574. // if(StringUtils.isEmpty(sceneNum)){
  575. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  576. // }
  577. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  578. // if(sceneProEntity == null){
  579. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  580. // }
  581. //
  582. // String dataPath = sceneProEntity.getDataSource() + "/caches/tex";
  583. // if(new File(sceneProEntity.getDataSource() + "_edit/caches/tex").exists()){
  584. // dataPath = sceneProEntity.getDataSource() + "_edit/caches/tex";
  585. // }
  586. // File filePath = new File(dataPath);
  587. // for(String deletePath : filePath.list()){
  588. // if(deletePath.endsWith(".obj") && !deletePath.contains("output.house.obj")){
  589. // FileUtils.deleteFile(filePath.getAbsolutePath() + File.separator + deletePath);
  590. // }
  591. // }
  592. //
  593. // FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/tex.zip", dataPath);
  594. //
  595. // return Result.success(mainUrl + "scene/images/images" + sceneNum + "/tex.zip?t=" +System.currentTimeMillis());
  596. // }
  597. //
  598. // /**
  599. // * 生成英文版二维码
  600. // */
  601. // @ApiOperation("生成英文版二维码")
  602. // @PostMapping(value = "/createEnSceneQRcode")
  603. // public ResultData createEnSceneQRcode(HttpServletRequest request, HttpServletResponse response) throws Exception {
  604. // List<SceneProEntity> proEntityList = sceneProService.findAll();
  605. // for(SceneProEntity proEntity : proEntityList){
  606. // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProUrl + proEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+proEntity.getNum()+"_en.png", null);
  607. // }
  608. //
  609. // List<SceneEntity> entityList = sceneService.findAll();
  610. // for(SceneEntity sceneEntity : entityList){
  611. // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneUrl + sceneEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneEntity.getNum()+"_en.png", null);
  612. // }
  613. // return Result.success("生成完成");
  614. // }
  615. //
  616. // /**
  617. // * 根据sn码查找所有场景连接
  618. // */
  619. // @ApiOperation("根据sn码查找所有场景连接")
  620. // @PostMapping(value = "/findSceneBySnCode")
  621. // @ApiImplicitParam(name = "snCode", value = "snCode", dataType = "String")
  622. // public ResultData findSceneBySnCode(HttpServletRequest request, HttpServletResponse response) throws Exception {
  623. // String snCode = request.getParameter("snCode");
  624. // CameraEntity cameraEntity = goodsService.findBySnCode(snCode);
  625. //
  626. // if(cameraEntity == null){
  627. // return Result.success();
  628. // }
  629. //
  630. // return Result.success(sceneProService.findByCameraId(cameraEntity.getId()));
  631. // }
  632. //
  633. // /**
  634. // * 上传ar场景数据
  635. // * @param file
  636. // * @param params
  637. // * @return
  638. // */
  639. // @ApiOperation("上传ar场景数据")
  640. // @PostMapping("uploadImgAndJson")
  641. // @ApiImplicitParams({
  642. // @ApiImplicitParam(name = "file", value = "文件流", dataType = "MultipartFile"),
  643. // @ApiImplicitParam(name = "params", value = "参数", dataType = "String"),
  644. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
  645. // public ResultData uploadImgAndJson(@RequestParam(value = "file",required = false) MultipartFile file,
  646. // String params, String num) throws Exception {
  647. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
  648. // if(sceneProEntity == null){
  649. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  650. // }
  651. // String path = sceneProEntity.getDataSource() + "_ar";
  652. // String filePath = path + "/extras/";
  653. //
  654. // String fileName = "ar.jpg";
  655. //
  656. // File targetFile = new File(filePath + fileName);
  657. // if(!targetFile.getParentFile().exists()){
  658. // targetFile.getParentFile().mkdirs();
  659. // }
  660. // file.transferTo(targetFile);
  661. //
  662. // JSONObject jsonObject = JSONObject.parseObject(params);
  663. // FileUtils.writeFile(filePath + "ar_in.json", jsonObject.toString());
  664. //
  665. // //创建data.json
  666. // JSONObject dataJson = new JSONObject();
  667. // dataJson.put("ar", true);
  668. // dataJson.put("split_type", "SPLIT_V1");
  669. // dataJson.put("data_describe", "double spherical");
  670. // dataJson.put("skybox_type", "SKYBOX_V5");
  671. // FileUtils.writeFile(path + "/data.json", dataJson.toString());
  672. //
  673. // if(new File(sceneProEntity.getDataSource() + File.separator + "caches").exists()){
  674. // CreateObjUtil.createSoftConnection(sceneProEntity.getDataSource() + File.separator + "caches" , path + File.separator + "caches");
  675. // }
  676. //
  677. // //调用算法
  678. // CreateObjUtil.build3dModel(path, "");
  679. //
  680. // String result = FileUtils.readFile(path + "/results/ar_out.json");
  681. // if(result == null){
  682. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012);
  683. // }
  684. //
  685. // return Result.success(result);
  686. // }
  687. //
  688. // /**
  689. // * 正式环境与测试环境互相复制资源并且重算
  690. // */
  691. // @ApiOperation("正式环境与测试环境互相复制资源并且重算")
  692. // @PostMapping(value = "/copyDataAndBuild")
  693. // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
  694. // public void copyDataAndBuild(HttpServletRequest request, HttpServletResponse response) throws Exception {
  695. // String num = request.getParameter("num");
  696. //
  697. // Map postData = new HashMap();
  698. // postData.put("num", num);
  699. // String dataPath = "";
  700. // if("dev".equals(environment)){
  701. // dataPath = HttpRequestorUtil.doPost("https://www.4dkankan.com/api/scene/querySceneDataSource", postData);
  702. // log.info("正式环境资源路径:" + dataPath);
  703. // }else {
  704. // dataPath = HttpRequestorUtil.doPost("https://test.4dkankan.com/api/scene/querySceneDataSource", postData);
  705. // log.info("测试环境资源路径:" + dataPath);
  706. // }
  707. //
  708. // if(dataPath.contains("/mnt/data/")){
  709. // String newPath = dataPath;
  710. //
  711. // if(!new File(newPath).exists()){
  712. // new File(newPath).mkdirs();
  713. // }
  714. //
  715. // if(!new File(newPath + "/capture").exists()){
  716. // new File(newPath + "/capture").mkdirs();
  717. // }
  718. // if("dev".equals(environment)){
  719. // //远程复制正式环境资源到测试环境;
  720. // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/");
  721. // log.info("数据复制完成");
  722. // }else {
  723. // //远程复制正式环境资源到测试环境;
  724. // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/");
  725. // log.info("数据复制完成");
  726. // }
  727. //
  728. //
  729. // String data = FileUtils.readFile(newPath + "/capture/data.fdage");
  730. // JSONObject jsonObject = JSONObject.parseObject(data);
  731. // String sceneNum = "";
  732. // if(jsonObject != null){
  733. // sceneNum = sceneNumService.generateSceneNum();
  734. //
  735. // String cameraName = jsonObject.getJSONObject("cam").getString("uuid");
  736. // String unicode = jsonObject.getString("creator") + "_" + jsonObject.getString("uuidtime");
  737. //
  738. // log.info("查询相机:" + cameraName);
  739. // CameraEntity cameraEntity = goodsService.findByChildName(cameraName);
  740. //
  741. // if(cameraEntity == null){
  742. // log.error("该相机不存在:" + cameraName);
  743. // //偶现data.fdage给的相机码多了或少了4DKKPRO_
  744. // if(cameraName.contains("4DKKPRO_")){
  745. // cameraEntity = goodsService.findByChildName(cameraName.replace("4DKKPRO_", ""));
  746. // }else {
  747. // cameraEntity = goodsService.findByChildName("4DKKPRO_" + cameraName);
  748. // }
  749. // if(cameraEntity == null){
  750. // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
  751. // }
  752. // }
  753. //
  754. // CameraDetailEntity detailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
  755. // if(detailEntity == null){
  756. // log.error("该相机详情不存在:" + cameraName);
  757. // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
  758. // }
  759. //
  760. // String userName = null;
  761. // if(detailEntity.getUserId() != null){
  762. // Result result2 = userService.findById(detailEntity.getUserId());
  763. // SSOUser user = mapper.convertValue(result2.getData(), SSOUser.class);
  764. // if(user != null){
  765. // userName = user.getUserName();
  766. // }
  767. // }
  768. //
  769. // JSONObject firmwareVersion = new JSONObject();
  770. // if(jsonObject.containsKey("camSoftwareVersion") && StringUtil.isNotEmpty(jsonObject.getString("camSoftwareVersion"))){
  771. // firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion"));
  772. // }
  773. //
  774. // if(jsonObject.containsKey("version") && StringUtil.isNotEmpty(jsonObject.getString("version"))){
  775. // firmwareVersion.put("version", jsonObject.getString("version"));
  776. // }
  777. //
  778. //// String sceneUrl = mainUrl + sceneProUrl;
  779. //// String buildType = "V2";
  780. //// //根据videoVersion判断是V2还是V3版本的算法和页面
  781. //// if(jsonObject.containsKey("videoVersion") && StringUtil.isNotEmpty(jsonObject.getString("videoVersion"))){
  782. //// if(jsonObject.getIntValue("videoVersion") >= 4){
  783. //// buildType = "V3";
  784. //// sceneUrl = mainUrl + sceneProNewUrl;
  785. //// }
  786. //// }
  787. // String buildType = "V3";
  788. // String sceneUrl = mainUrl + sceneProNewUrl;
  789. //
  790. // String filePath = newPath + "/capture/";
  791. // String prefix = newPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/";
  792. //
  793. // String fileId = prefix.split("/")[1];
  794. //
  795. // String icon = null;
  796. // if(jsonObject.containsKey("icon") && StringUtil.isNotEmpty(jsonObject.getString("icon"))){
  797. // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + prefix + jsonObject.getString("icon"), filePath);
  798. // uploadToOssUtil.upload(filePath + jsonObject.getString("icon"), "images/images" + sceneNum + "/" + jsonObject.getString("icon"));
  799. // icon = "https://4dkk.4dage.com/images/images" + sceneNum + "/" + jsonObject.getString("icon");
  800. // }
  801. //
  802. // Long cameraType = 11L;
  803. // //判断是否转台相机
  804. // if(detailEntity != null && detailEntity.getType() == 9){
  805. // cameraType = 13L;
  806. // }
  807. //
  808. // if(detailEntity != null && detailEntity.getType() == 10){
  809. // cameraType = 14L;
  810. // }
  811. //
  812. // SceneProEntity scene = ComputerUtil.createScenePro(sceneNum, cameraEntity.getId(), cameraEntity.getChildName(), jsonObject.getString("creator"),
  813. // jsonObject.getString("pwd"), unicode,
  814. // cameraType, String.valueOf(fileId), prefix, "", icon, "0", detailEntity.getUserId(), userName,
  815. // jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
  816. // jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
  817. // jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), sceneProService, sceneProEditService, 0,
  818. // producer, jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, type, ecsType,
  819. // sceneCooperationService, sceneResourceCooperationService, sceneResourceCameraService, detailEntity.getCooperationUser(), rubberSheetingUtil);
  820. //
  821. // producer.sendMsg(scene.getMqMsg());
  822. // }
  823. //// CreateObjUtil.build3dModel(newPath, "");
  824. //
  825. // JSONObject result = new JSONObject();
  826. // result.put("proData", dataPath);
  827. // result.put("testData", newPath);
  828. // result.put("num", sceneNum);
  829. // response.getWriter().print(result);
  830. // }
  831. // }
  832. //
  833. // /**
  834. // * 调用小程序商品列表
  835. // */
  836. // @ApiOperation("调用小程序商品列表")
  837. // @PostMapping(value = "/shopGoods")
  838. // @ApiImplicitParam(name = "keyword", value = "关键词", dataType = "String")
  839. // public void shopGoods(HttpServletRequest request, HttpServletResponse response) throws Exception {
  840. // String keyword = request.getParameter("keyword");
  841. //
  842. // Map postData = new HashMap();
  843. // postData.put("keyword", keyword);
  844. // postData.put("sort", "id");
  845. // postData.put("order", "desc");
  846. // String result = HttpRequestorUtil.doPost("https://shop.4dkankan.com/platform-framework/api/goods/list", postData);
  847. // log.info("获取小程序商品列表");
  848. //
  849. // response.getWriter().print(result);
  850. // }
  851. //
  852. // /**
  853. // * 保存配置文件数据
  854. // */
  855. // @ApiOperation("保存配置文件数据")
  856. // @PostMapping(value = "/saveConfigData")
  857. // @ApiImplicitParams({
  858. // @ApiImplicitParam(name = "fileName", value = "文件名字", dataType = "MultipartFile"),
  859. // @ApiImplicitParam(name = "config", value = "config", dataType = "String")})
  860. // public ResultData saveConfigData(HttpServletRequest request) throws Exception {
  861. // String fileName = request.getParameter("fileName");
  862. // String config = request.getParameter("config");
  863. // FileUtils.writeFile(ConstantFilePath.SCENE_PATH + fileName, config);
  864. // return Result.success();
  865. // }
  866. //
  867. // /**
  868. // * 标定重算
  869. // */
  870. // @ApiOperation("标定重算")
  871. // @PostMapping(value = "/rebuildByPath")
  872. // @ApiImplicitParam(name = "path", value = "资源路径", dataType = "String")
  873. // public ResultData rebuildByPath(HttpServletRequest request) throws Exception{
  874. // String path = request.getParameter("path");
  875. // if(path.contains("color_anlysis")){
  876. // Map<String,String> map = ComputerUtil.computerCalibration(path);
  877. // uploadToOssUtil.uploadMulFiles(map);
  878. // return Result.success("开始标定计算");
  879. // }
  880. //
  881. // producer.sendMsg(path);
  882. // return Result.success("开始标定计算");
  883. // }
  884. //
  885. // /**
  886. // * 获取编辑页面的资源下载路径
  887. // */
  888. // @ApiOperation("获取编辑页面的资源下载路径")
  889. // @PostMapping(value = "/getEditDataUrl")
  890. // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String")
  891. // public ResultData getEditDataUrl(HttpServletRequest request) throws Exception{
  892. // String num = request.getParameter("num");
  893. //
  894. // if(StringUtils.isEmpty(num)){
  895. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  896. // }
  897. //
  898. // List<String> result = new ArrayList<>();
  899. // List<String> urlList = new ArrayList<>();
  900. //
  901. // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "data/data" + num, urlList);
  902. // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "images/images" + num, urlList);
  903. // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "voice/voice" + num, urlList);
  904. //
  905. // if(urlList != null && urlList.size() > 0){
  906. // for(String url : urlList){
  907. // result.add(url.replace(ConstantFilePath.BASE_PATH + "/", ""));
  908. // }
  909. // }
  910. //
  911. // return Result.success(result);
  912. // }
  913. //
  914. // @ApiOperation("根据场景码生成场景")
  915. // @PostMapping("/createScene")
  916. // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String")
  917. // public ResultData createScene(@RequestBody SceneParamVO param) throws Exception{
  918. // if(StringUtils.isEmpty(param.getNum())){
  919. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  920. // }
  921. //
  922. // StringBuffer dataBuf = new StringBuffer()
  923. // .append("data").append(File.separator)
  924. // .append("data").append(param.getNum());
  925. //
  926. // StringBuffer imagesBuf = new StringBuffer()
  927. // .append("images").append(File.separator)
  928. // .append("images").append(param.getNum());
  929. //
  930. // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
  931. // StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
  932. //
  933. // FileUtils.delAllFile(imagesBuffer.toString() + "/results/");
  934. // FileUtils.delAllFile(imagesBuffer.toString() + "/extras/");
  935. // //远程复制oss资源
  936. // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getObjName(), imagesBuffer.toString() + "/extras/");
  937. // //obj文件修改名字
  938. // FileUtils.copyFile(imagesBuffer.toString() + "/extras/" + param.getObjName(), imagesBuffer.toString() + "/extras/mesh.obj", true);
  939. // FileUtils.deleteFile(imagesBuffer.toString() + "/extras/" + param.getObjName());
  940. //
  941. // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getMntName(), imagesBuffer.toString() + "/extras/");
  942. // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1", imagesBuffer.toString() + "/extras/");
  943. // //将文件复制出去
  944. // String[] imgs = new File(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1").list();
  945. // for(String img : imgs){
  946. // FileUtils.copyFile(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + img,
  947. // imagesBuffer.toString() + "/extras/" + img, true);
  948. // }
  949. // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "vision.txt", imagesBuffer.toString());
  950. //
  951. // //创建data.json
  952. // JSONObject dataJson = new JSONObject();
  953. // dataJson.put("obj2txt", true);
  954. // dataJson.put("split_type", "SPLIT_V6");
  955. // dataJson.put("data_describe", "double spherical");
  956. // dataJson.put("skybox_type", "SKYBOX_V5");
  957. // FileUtils.writeFile(imagesBuffer.toString() + "/data.json", dataJson.toString());
  958. //
  959. // //调用objToTxt算法
  960. // CreateObjUtil.objToTxt(imagesBuffer.toString(), "");
  961. //
  962. // String uploadData = FileUtils.readFile(imagesBuffer.toString() + File.separator + "results" +File.separator+"upload.json");
  963. // JSONObject uploadJson = null;
  964. // JSONArray array = null;
  965. // if(uploadData!=null) {
  966. // uploadJson = JSONObject.parseObject(uploadData);
  967. // array = uploadJson.getJSONArray("upload");
  968. // }
  969. // if(array == null){
  970. // log.error("upload.json数据出错");
  971. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012);
  972. // }
  973. //
  974. // Map<String,String> map = new HashMap<String,String>();
  975. // JSONObject fileJson = null;
  976. // String fileName = "";
  977. // for(int i = 0, len = array.size(); i < len; i++) {
  978. // fileJson = array.getJSONObject(i);
  979. // fileName = fileJson.getString("file");
  980. // //文件不存在抛出异常
  981. // if (!new File(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName).exists()) {
  982. // throw new Exception(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName + "文件不存在");
  983. // }
  984. //
  985. // //tex文件夹
  986. // if (fileJson.getIntValue("clazz") == 15) {
  987. // map.put(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName, "images/images" +
  988. // param.getNum() + "/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
  989. // continue;
  990. // }
  991. // }
  992. //
  993. // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
  994. // CreateObjUtil.convertDamToLzma(imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
  995. // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" + File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
  996. // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma");
  997. // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
  998. //
  999. // FileUtils.deleteFile(imagesBuffer.toString() + "/vision.modeldata");
  1000. // CreateObjUtil.convertTxtToVisionmodeldata(imagesBuffer.toString() + "/vision.txt", imagesBuffer.toString() + "/vision.modeldata");
  1001. // map.put(imagesBuffer.toString() + "/vision.modeldata", "images/images"+param.getNum()+"/vision.modeldata");
  1002. //
  1003. // uploadToOssUtil.uploadMulFiles(map);
  1004. //
  1005. // SceneProEntity proEntity = sceneProService.findBySceneNum(param.getNum());
  1006. // if(proEntity == null){
  1007. // proEntity = new SceneProEntity();
  1008. // proEntity.setSceneName("四维看看");
  1009. // proEntity.setSceneDec("<p>四维看看 让空间讲故事</p>");
  1010. // proEntity.setSceneScheme(2);
  1011. // proEntity.setNum(param.getNum());
  1012. // proEntity.setUserId(param.getUserId());
  1013. // proEntity.setWebSite(mainUrl + sceneProNewUrl + param.getNum());
  1014. // proEntity.setStatus(1);
  1015. // proEntity.setPayStatus(1);
  1016. // proEntity.setBuildType("V3");
  1017. //
  1018. // if(param.getSceneSource()!=null){
  1019. // proEntity.setSceneSource(param.getSceneSource());
  1020. // }
  1021. //
  1022. // sceneProService.save(proEntity);
  1023. //
  1024. // SceneProEditEntity proEditEntity = new SceneProEditEntity();
  1025. // proEditEntity.setProId(proEntity.getId());
  1026. // sceneProEditService.save(proEditEntity);
  1027. //
  1028. // JSONObject scenejson = JSONObject.parseObject(JSONObject.toJSONString(proEntity));
  1029. // scenejson.put("visions", 1);
  1030. // FileUtils.writeFile(dataBuffer.toString() + File.separator+"scene.json", scenejson.toString());
  1031. // }
  1032. //
  1033. // return Result.success(mainUrl + sceneProNewUrl + param.getNum());
  1034. // }
  1035. //
  1036. // @ApiOperation("查找八目未使用过的场景吗")
  1037. // @PostMapping("/finSceneNum")
  1038. // public ResultData finSceneNum(){
  1039. // String num = sceneNumService.generateSceneNum();
  1040. // return Result.success(num);
  1041. // }
  1042. //
  1043. // @ApiOperation("查找123看房未使用过的场景吗")
  1044. // @PostMapping("/finSkSceneNum")
  1045. // public ResultData finSkSceneNum(){
  1046. // String num = sceneNumService.generateSceneNum();
  1047. // return Result.success(num);
  1048. // }
  1049. //
  1050. // @ApiOperation("根据一键换装风格码入库场景表")
  1051. // @PostMapping("/createChangeScene")
  1052. // @ApiImplicitParams({
  1053. // @ApiImplicitParam(name = "num", value = "", dataType = "String"),
  1054. // @ApiImplicitParam(name = "oldNum", value = "场景吗", dataType = "String")})
  1055. // public ResultData createChangeScene(HttpServletRequest request) throws Exception{
  1056. // String projectNum = request.getParameter("num");
  1057. // String oldNum = request.getParameter("oldNum");
  1058. // String sceneName = request.getParameter("sceneName");
  1059. // String resolution = request.getParameter("resolution");
  1060. //
  1061. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(projectNum);
  1062. //
  1063. // String floorJson = ConstantFilePath.SCENE_PATH + "data/data" + projectNum + File.separator + "floor.json";
  1064. // String floorPlan = ConstantFilePath.SCENE_PATH + "images/images" + projectNum + File.separator + "floorplan.png";
  1065. //
  1066. // int sceneScheme = 12;
  1067. // if(StringUtil.isNotEmpty(resolution)){
  1068. // if("1024".equals(resolution)){
  1069. // sceneScheme = 12;
  1070. // }
  1071. // if("2048".equals(resolution)){
  1072. // sceneScheme = 11;
  1073. // }
  1074. // if("4096".equals(resolution)){
  1075. // sceneScheme = 10;
  1076. // }
  1077. // }
  1078. //
  1079. // if(sceneProEntity != null){
  1080. // sceneProEntity.setSceneName(sceneName);
  1081. // sceneProEntity.setStatus(0);
  1082. // sceneProEntity.setSceneScheme(sceneScheme);
  1083. // sceneProService.update(sceneProEntity);
  1084. //
  1085. // if(!new File(floorJson).exists()){
  1086. // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(),
  1087. // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum);
  1088. // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json");
  1089. // }
  1090. //
  1091. // if(!new File(floorPlan).exists()){
  1092. // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(),
  1093. // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum);
  1094. // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png");
  1095. // }
  1096. // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json"));
  1097. // scenejson.put("sceneScheme", sceneScheme);
  1098. // scenejson.put("sceneSource", 11);
  1099. // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toJSONString());
  1100. //
  1101. // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1102. // sceneProEditEntity.setSceneKey(null);
  1103. // sceneProEditEntity.setNeedKey(0);
  1104. // sceneProEditService.update(sceneProEditEntity);
  1105. //
  1106. // return Result.success("一键换装场景存在,不重复生成");
  1107. // }
  1108. //
  1109. // //根据旧的场景生成新的vr场景
  1110. // sceneProEntity = sceneProService.findBySceneNum(oldNum);
  1111. // if(sceneProEntity == null){
  1112. // return Result.failure("场景不存在");
  1113. // }
  1114. //
  1115. // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1116. //
  1117. // sceneProEntity.setId(null);
  1118. // sceneProEntity.setSceneType(99);
  1119. // sceneProEntity.setWebSite(sceneProEntity.getWebSite().replace(oldNum, projectNum));
  1120. // sceneProEntity.setNum(projectNum);
  1121. // sceneProEntity.setSceneName(sceneName);
  1122. // sceneProEntity.setStatus(0);
  1123. // sceneProEntity.setPayStatus(1);
  1124. // sceneProEntity.setSceneScheme(sceneScheme);
  1125. // sceneProEntity.setSceneSource(11);
  1126. // sceneProEntity.setSpace(new BigInteger("0"));
  1127. // sceneProEntity.setCreateTime(new Date());
  1128. // sceneProEntity.setVideos(null);
  1129. // sceneProService.save(sceneProEntity);
  1130. //
  1131. // sceneProEditEntity.setId(null);
  1132. // sceneProEditEntity.setProId(sceneProEntity.getId());
  1133. // sceneProEditEntity.setJumpScene(false);
  1134. // sceneProEditEntity.setHotsIds(null);
  1135. // sceneProEditEntity.setSceneKey(null);
  1136. // sceneProEditEntity.setNeedKey(0);
  1137. // sceneProEditEntity.setScreencapVoiceSrc(null);
  1138. // sceneProEditEntity.setScreencapVoiceSound(null);
  1139. // sceneProEditEntity.setScreencapVoiceSoundsync(null);
  1140. // sceneProEditEntity.setScreencapVoiceType(null);
  1141. // sceneProEditEntity.setScreencapThumb(null);
  1142. // sceneProEditEntity.setOverlay(null);
  1143. // sceneProEditEntity.setFloorPlanAngle("0");
  1144. // sceneProEditEntity.setVideosUser(null);
  1145. // sceneProEditService.save(sceneProEditEntity);
  1146. //
  1147. // FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data"+oldNum+File.separator+"scene.json", ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", true);
  1148. //
  1149. // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json"));
  1150. // scenejson.put("jumpScene", false);
  1151. // scenejson.put("hots", 0);
  1152. // scenejson.put("screencapVoiceSrc", null);
  1153. // scenejson.put("screencapVoiceSound", null);
  1154. // scenejson.put("screencapVoiceSoundsync", null);
  1155. // scenejson.put("screencapVoiceType", null);
  1156. // scenejson.put("screencapThumb", null);
  1157. // scenejson.put("overlay", null);
  1158. // scenejson.put("sceneScheme", 12);
  1159. // scenejson.put("sceneSource", 11);
  1160. // scenejson.put("videos", null);
  1161. // scenejson.put("videosUser",null);
  1162. // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toString());
  1163. //
  1164. // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(),
  1165. // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum);
  1166. // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(),
  1167. // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum);
  1168. //// FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data" + oldNum + File.separator+"floor.json",
  1169. //// ConstantFilePath.SCENE_PATH+"data/data" + projectNum + File.separator+"floor.json", true);
  1170. //
  1171. //
  1172. // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png");
  1173. // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json");
  1174. // return Result.success();
  1175. // }
  1176. //
  1177. // @ApiOperation("获取当前mq的队列数")
  1178. // @GetMapping("/getMqNum")
  1179. // public ResultData getMqNum(){
  1180. // return Result.success(producer.getMessageCount());
  1181. // }
  1182. //
  1183. //
  1184. // @ApiOperation("根据模块名称,查询模块视频地址")
  1185. // @PostMapping("/findSceneModuleVideo")
  1186. // @ApiImplicitParams({
  1187. // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String")})
  1188. // public ResultData findSceneModuleVideo(HttpServletRequest request){
  1189. // String moduleName = request.getParameter("moduleName");
  1190. // Condition condition = new Condition(SceneModuleVideoEntity.class);
  1191. // condition.and().andEqualTo("moduleName", moduleName);
  1192. // return Result.success(sceneModuleVideoService.findAll(condition));
  1193. // }
  1194. //
  1195. // /**
  1196. // * 新增或修改场景模块视频地址
  1197. // */
  1198. // @ApiOperation("新增或修改场景模块视频地址")
  1199. // @PostMapping(value = "/saveSceneModuleVideo")
  1200. // @ApiImplicitParams({
  1201. // @ApiImplicitParam(name = "id", value = "有则修改,无则新增", dataType = "String"),
  1202. // @ApiImplicitParam(name = "sceneNum", value = "场景编码", dataType = "String"),
  1203. // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String"),
  1204. // @ApiImplicitParam(name = "videoUrl", value = "视频地址", dataType = "String"),
  1205. // @ApiImplicitParam(name = "images", value = "缩略图", dataType = "String")})
  1206. // private Result saveSceneModuleVideo(HttpServletRequest request) throws Exception{
  1207. // String id = request.getParameter("id");
  1208. // String sceneNum = request.getParameter("sceneNum");
  1209. // String moduleName = request.getParameter("moduleName");
  1210. // String videoUrl = request.getParameter("videoUrl");
  1211. // String images = request.getParameter("images");
  1212. //
  1213. // if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(moduleName) || StringUtils.isEmpty(videoUrl)){
  1214. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1215. // }
  1216. //
  1217. // SceneModuleVideoEntity entity = new SceneModuleVideoEntity();
  1218. // entity.setSceneNum(sceneNum);
  1219. // entity.setImages(images);
  1220. // entity.setModuleName(moduleName);
  1221. // entity.setVideoUrl(videoUrl);
  1222. //
  1223. // if(StringUtils.isEmpty(id)){
  1224. // sceneModuleVideoService.save(entity);
  1225. // }else {
  1226. // entity.setId(Long.valueOf(id));
  1227. // sceneModuleVideoService.update(entity);
  1228. // }
  1229. //
  1230. // return Result.success();
  1231. //
  1232. // }
  1233. //
  1234. // /**
  1235. // * 删除场景模块视频地址
  1236. // */
  1237. // @ApiOperation("删除场景模块视频地址")
  1238. // @PostMapping(value = "/deleteSceneModuleVideo")
  1239. // @ApiImplicitParams({
  1240. // @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
  1241. // private Result deleteSceneModuleVideo(HttpServletRequest request) throws Exception{
  1242. // String id = request.getParameter("id");
  1243. //
  1244. // if(org.springframework.util.StringUtils.isEmpty(id)){
  1245. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1246. // }
  1247. //
  1248. // sceneModuleVideoService.deleteById(Long.valueOf(id));
  1249. // return Result.success();
  1250. // }
  1251. //
  1252. // /**
  1253. // * 下载思为的html页面
  1254. // */
  1255. // @ApiOperation("下载思为的html页面")
  1256. // @PostMapping(value = "/downloadSiWeiHtml")
  1257. // @ApiImplicitParams({
  1258. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
  1259. // public ResultData downloadSiWeiHtml(HttpServletRequest request) throws Exception{
  1260. // String token = getToken();
  1261. // if(StringUtils.isEmpty(token)){
  1262. // throw new BaseRuntimeException(3004, "无token参数");
  1263. // }
  1264. //
  1265. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  1266. // if(ssoUser == null){
  1267. // throw new BaseRuntimeException(3004, "token参数不正确");
  1268. // }
  1269. //
  1270. // String sceneNum = request.getParameter("sceneNum");
  1271. //
  1272. // if(StringUtils.isEmpty(sceneNum)){
  1273. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1274. // }
  1275. //
  1276. // //获取getInfo的数据
  1277. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  1278. // if(sceneProEntity == null){
  1279. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1280. // }
  1281. // if(sceneProEntity.getPayStatus() != 1){
  1282. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1283. // }
  1284. // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){
  1285. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1286. // }
  1287. //
  1288. // if(ssoUser == null || ssoUser.getId().longValue() != sceneProEntity.getUserId().longValue()){
  1289. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
  1290. // }
  1291. //
  1292. // if(isDownload.get()){
  1293. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5024, SceneConstant.FAILURE_MSG_5024);
  1294. // }
  1295. //
  1296. // isDownload.compareAndSet(false, true);
  1297. //
  1298. // try{
  1299. // ResponseScene responseScene = new ResponseScene();
  1300. // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1301. //
  1302. // CreateObjUtil.callshell("bash /opt/ossutil/copy.sh " + ConstantFilePath.BASE_PATH +
  1303. // "/local/localHose" + " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
  1304. //
  1305. // //14表示matterPro场景,需要调用命令获取切图,并且修改sceneScheme为13
  1306. // if(sceneProEntity.getSceneSource() == 14){
  1307. // sceneProEntity.setSceneScheme(13);
  1308. // CreateObjUtil.matterproCutImg(sceneProEntity.getNum(), ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
  1309. // }
  1310. //
  1311. // BeanUtils.copyProperties(editEntity, responseScene);
  1312. // BeanUtils.copyProperties(sceneProEntity, responseScene);
  1313. // if(StringUtil.isNotEmpty(editEntity.getEntry())){
  1314. // responseScene.setEntry(JSONObject.parseObject(editEntity.getEntry()).toJSONString());
  1315. // }
  1316. //
  1317. // if(StringUtil.isNotEmpty(sceneProEntity.getGps())){
  1318. // responseScene.setGps(JSONObject.parseObject(sceneProEntity.getGps()).toJSONString());
  1319. // }
  1320. //
  1321. // responseScene.setCreateTime(new DateTime(sceneProEntity.getCreateTime()).toString("yyyy-MM-dd"));
  1322. // responseScene.setCreateDate(sceneProEntity.getCreateTime().getTime());
  1323. // if(StringUtil.isEmpty(editEntity.getSceneKey())){
  1324. // responseScene.setIsPublic(0);
  1325. // }else {
  1326. // responseScene.setIsPublic(1);
  1327. // }
  1328. //
  1329. // //不返回场景访问密码
  1330. // responseScene.setSceneKey("");
  1331. //
  1332. // //替换index.html里面的场景码
  1333. // String indexPath = ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + File.separator + "embed.html";
  1334. // String index = FileUtils.readFile(indexPath);
  1335. // FileUtils.deleteFile(indexPath);
  1336. // FileUtils.writeFile(indexPath, index.replace("__ProjectNum__", sceneNum));
  1337. //
  1338. // //下载oss资源
  1339. // CreateObjUtil.ossUtilCp("data/data" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data");
  1340. // CreateObjUtil.ossUtilCp("images/images" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/images");
  1341. // CreateObjUtil.ossUtilCp("video/video" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/video");
  1342. // CreateObjUtil.ossUtilCp("voice/voice" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/voice");
  1343. //
  1344. // FileUtils.writeFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data/data" + sceneNum + "/getInfo.json",
  1345. // JSONObject.toJSONString(responseScene));
  1346. //
  1347. // CreateObjUtil.callshell("bash /opt/ossutil/gzip.sh " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum +
  1348. // " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
  1349. //
  1350. // FileUtils.deleteDirectory(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
  1351. //// FileUtils.deleteFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + ".zip");
  1352. //
  1353. // isDownload.compareAndSet(true, false);
  1354. // return Result.success((Object)"local/localHose" + sceneNum + ".zip");
  1355. // }catch (Exception e){
  1356. // e.printStackTrace();
  1357. // isDownload.compareAndSet(true, false);
  1358. // return Result.failure(LoginConstant.ERROR_MSG);
  1359. // }finally {
  1360. // isDownload.compareAndSet(true, false);
  1361. // }
  1362. //
  1363. // }
  1364. //
  1365. // /**
  1366. // * 思为获取场景列表
  1367. // */
  1368. // @ApiOperation("思为获取场景列表")
  1369. // @PostMapping(value = "/siweiSceneList")
  1370. // @ApiImplicitParams({
  1371. // @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
  1372. // @ApiImplicitParam(name = "pageSize", value = "页数", dataType = "String"),
  1373. // @ApiImplicitParam(name = "snCode", value = "相机sn", dataType = "String"),
  1374. // @ApiImplicitParam(name = "sceneName", value = "场景名称", dataType = "String"),
  1375. // @ApiImplicitParam(name = "startDate", value = "开始时间", dataType = "String"),
  1376. // @ApiImplicitParam(name = "endDate", value = "结束时间", dataType = "String")})
  1377. // public Result<Page<ResponseScene>> siweiSceneList(HttpServletRequest request) throws Exception{
  1378. // String token = getToken();
  1379. // if(StringUtils.isEmpty(token)){
  1380. // throw new BaseRuntimeException(3004, "无token参数");
  1381. // }
  1382. //
  1383. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  1384. // if(ssoUser == null){
  1385. // throw new BaseRuntimeException(3004, "token参数不正确");
  1386. // }
  1387. //
  1388. // String pageNumStr = request.getParameter("pageNum");
  1389. // String pageSizeStr = request.getParameter("pageSize");
  1390. //
  1391. // String sceneName = request.getParameter("sceneName");
  1392. // String snCode = request.getParameter("snCode");
  1393. // String startDate = request.getParameter("startDate");
  1394. // String endDate = request.getParameter("endDate");
  1395. // String num = request.getParameter("num");
  1396. //
  1397. // String cameraId = null;
  1398. //
  1399. // if(StringUtils.isNotEmpty(snCode)){
  1400. // CameraEntity cameraEntity = goodsService.findBySnCode(snCode);
  1401. // if(cameraEntity == null){
  1402. // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
  1403. // }
  1404. //
  1405. // cameraId = String.valueOf(cameraEntity.getId());
  1406. // }
  1407. //
  1408. // Integer pageNum = 1;
  1409. // Integer pageSize = 10;
  1410. // if(StringUtils.isNotEmpty(pageNumStr)){
  1411. // pageNum = Integer.valueOf(pageNumStr);
  1412. // }
  1413. //
  1414. // if(StringUtils.isNotEmpty(pageSizeStr)){
  1415. // pageSize = Integer.valueOf(pageSizeStr);
  1416. // }
  1417. //
  1418. //// List<Integer> counts = sceneService.findAllSceneCount("create_time desc", null,
  1419. //// null, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num);
  1420. //
  1421. // PageHelper.startPage(pageNum, pageSize);
  1422. // List<SceneProEntity> sceneEntityList = sceneService.findAllScene("create_time desc", null,
  1423. // null, pageNum, pageSize, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num, null, null, null);
  1424. //
  1425. // PageInfo<SceneProEntity> data = new PageInfo<>(sceneEntityList);
  1426. //
  1427. // List<Map<String, Object>> list = new ArrayList<>();
  1428. // Map<String, Object> map = null;
  1429. // SceneProEditEntity sceneProEditEntity = null;
  1430. // CameraEntity cameraEntity = null;
  1431. // for (SceneProEntity sceneProEntity : data.getList()) {
  1432. // map = new HashMap<>();
  1433. // map.put("num", sceneProEntity.getNum());
  1434. // map.put("sceneName", sceneProEntity.getSceneName());
  1435. //
  1436. // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId());
  1437. // if(cameraEntity != null){
  1438. // map.put("snCode", cameraEntity.getSnCode());
  1439. // }
  1440. //
  1441. // map.put("webSite", sceneProEntity.getWebSite());
  1442. // map.put("createDate", sceneProEntity.getCreateTime().getTime());
  1443. // map.put("createTime", new DateTime(sceneProEntity.getCreateTime()).toString(DateUtil.DEFAULT_DATE_FORMAT));
  1444. // map.put("thumb", sceneProEntity.getThumb());
  1445. // map.put("shootCount", sceneProEntity.getShootCount());
  1446. //
  1447. // sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1448. // map.put("version", sceneProEditEntity.getVersion());
  1449. // list.add(map);
  1450. // }
  1451. //
  1452. //// int count = 0;
  1453. //// for(Integer number : counts){
  1454. //// count += number;
  1455. //// }
  1456. ////
  1457. // Page<Map<String, Object>> a = new Page<Map<String, Object>>(pageNum, pageSize);
  1458. // a.setTotal(data.getTotal());
  1459. // PageInfo<Map<String, Object>> result = a.toPageInfo();
  1460. // result.setList(list);
  1461. //// PageInfo<Map<String, Object>> result = new PageInfo<>(list);
  1462. // return Result.success(result);
  1463. // }
  1464. //
  1465. // /**
  1466. // * 将floor.json转换成酷家乐数据
  1467. // */
  1468. // @ApiOperation("将floor.json转换成酷家乐数据")
  1469. // @PostMapping(value = "/convertCadKjl")
  1470. // @ApiImplicitParams({
  1471. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
  1472. // public String convertCadKjl(HttpServletRequest request) throws Exception{
  1473. // String sceneNum = request.getParameter("sceneNum");
  1474. //
  1475. // if(StringUtils.isEmpty(sceneNum)){
  1476. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1477. // }
  1478. //
  1479. // StringBuffer dataBuf = new StringBuffer()
  1480. // .append("data").append(File.separator)
  1481. // .append("data").append(sceneNum)
  1482. // .append(File.separator);
  1483. //
  1484. // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
  1485. //
  1486. // String floorPath = dataBuffer.toString() + "floor.json";
  1487. // CreateObjUtil.ossUtilCp(dataBuf.toString() + "floor.json", dataBuffer.toString());
  1488. //
  1489. // ConvertCadKjl cad = new ConvertCadKjl();
  1490. // cad.init("指房宝", "指房宝装修房", "", "2", floorPath);
  1491. // cad.input = cad.preHandle(cad.input);
  1492. // JSONArray beams = cad.getBeams();
  1493. // JSONArray walls = cad.getWalls();
  1494. // walls = ConvertCadKjl.removeRepeat(walls);
  1495. // JSONArray rooms = cad.getRooms();
  1496. // JSONArray flues = cad.getFlues();
  1497. // JSONArray holes = cad.getHoles();
  1498. //
  1499. // cad.output.put("holes", holes);
  1500. // cad.output.put("flues", flues);
  1501. // cad.output.put("beams", beams);
  1502. // cad.output.put("rooms", rooms);
  1503. // cad.output.put("walls", walls);
  1504. // cad.output.put("needTranslate", false);
  1505. //
  1506. // return cad.output.toJSONString();
  1507. // }
  1508. //
  1509. //
  1510. // /**
  1511. // * 创建sketch场景分享二维码的logo
  1512. // */
  1513. // @ApiOperation("创建sketch场景分享二维码的logo")
  1514. // @PostMapping(value = "/createSketchQrLogo")
  1515. // @ApiImplicitParams({
  1516. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
  1517. // public ResultData createSketchQrLogo(HttpServletRequest request) throws Exception{
  1518. // String sceneNum = request.getParameter("sceneNum");
  1519. //
  1520. // if(StringUtils.isEmpty(sceneNum)){
  1521. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1522. // }
  1523. //
  1524. // //生成二维码
  1525. // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum, ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+".png", null);
  1526. // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+"_en.png", null);
  1527. // return Result.success();
  1528. // }
  1529. //
  1530. // /**
  1531. // * 恢复scene.json中文乱码问题
  1532. // */
  1533. // @ApiOperation("恢复scene.json中文乱码问题")
  1534. // @PostMapping(value = "/updateSceneJsonCode")
  1535. // @ApiImplicitParams({
  1536. // @ApiImplicitParam(name = "createTime", value = "该时间点之后的场景", dataType = "String")})
  1537. // public ResultData updateSceneJsonCode(HttpServletRequest request) throws Exception{
  1538. // String createTime = request.getParameter("createTime");
  1539. //
  1540. // Condition condition = new Condition(SceneProEntity.class);
  1541. // condition.and().andGreaterThanOrEqualTo("createTime", createTime);
  1542. // List<SceneProEntity> list = sceneProService.findAll(condition);
  1543. // Map<String, Object> map = new HashMap<>();
  1544. // for (SceneProEntity sceneProEntity : list) {
  1545. // map = new HashMap<>();
  1546. // map.put("sceneName", sceneProEntity.getSceneName());
  1547. // map.put("sceneDec", sceneProEntity.getSceneDec());
  1548. // FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneProEntity.getNum() + "/scene.json", map);
  1549. // }
  1550. // return Result.success("修改了:" + list.size());
  1551. // }
  1552. //
  1553. /**
  1554. * 获取数据对接下载信息
  1555. */
  1556. @PostMapping(value = "/downLoadZSData")
  1557. public ResultData downLoadZSData(@Validated BaseSceneParamVO param) throws Exception{
  1558. return sceneService.downLoadZSData(param);
  1559. }
  1560. //
  1561. // /**
  1562. // * 增加场景下载次数
  1563. // */
  1564. // @ApiOperation("增加场景下载次数")
  1565. // @PostMapping(value = "/addDownloadNum")
  1566. // @ApiImplicitParams({
  1567. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
  1568. // public ResultData addDownloadNum(HttpServletRequest request) throws Exception{
  1569. // String sceneNum = request.getParameter("sceneNum");
  1570. // if(StringUtil.isEmpty(sceneNum)){
  1571. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1572. // }
  1573. //
  1574. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  1575. // if(sceneProEntity == null){
  1576. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1577. // }
  1578. //
  1579. // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1580. // if(sceneProEditEntity.getDownloadNum() == null){
  1581. // sceneProEditEntity.setDownloadNum(1);
  1582. // }else{
  1583. // sceneProEditEntity.setDownloadNum(sceneProEditEntity.getDownloadNum() + 1);
  1584. // }
  1585. //
  1586. // sceneProEditService.update(sceneProEditEntity);
  1587. //
  1588. // //操作记录log
  1589. //// TmIncrementLogEntity tmIncrementLogEntity = new TmIncrementLogEntity();
  1590. //// tmIncrementLogEntity.setSceneNum(sceneProEntity.getNum());
  1591. //// tmIncrementLogEntity.setType("1");
  1592. //// iIncrementDownloadLogService.save(tmIncrementLogEntity);
  1593. //
  1594. // return Result.success();
  1595. // }
  1596. //
  1597. // /**
  1598. // * 查询总下载次数
  1599. // */
  1600. // @ApiOperation("查询总下载次数")
  1601. // @PostMapping(value = "/findDownloadNum")
  1602. // public ResultData findDownloadNum(HttpServletRequest request) throws Exception{
  1603. //
  1604. // return Result.success(sceneProEditService.findDownloadNum());
  1605. // }
  1606. //
  1607. // /**
  1608. // * 增加imagesVersion
  1609. // */
  1610. // @ApiOperation("查询总下载次数")
  1611. // @PostMapping(value = "/addImagesVersion")
  1612. // public ResultData addImagesVersion(HttpServletRequest request) throws Exception{
  1613. // String num = request.getParameter("num");
  1614. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
  1615. // if(sceneProEntity == null){
  1616. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1617. // }
  1618. //
  1619. // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
  1620. // sceneProEditEntity.setImagesVersion(sceneProEditEntity.getImagesVersion() + 1);
  1621. // sceneProEditService.update(sceneProEditEntity);
  1622. //
  1623. // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json"));
  1624. // scenejson.put("imagesVersion", sceneProEditEntity.getImagesVersion());
  1625. // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json", scenejson.toJSONString());
  1626. //
  1627. // return Result.success();
  1628. // }
  1629. //
  1630. // /**
  1631. // * 删除4k图
  1632. // */
  1633. // @ApiOperation("删除4k图")
  1634. // @PostMapping(value = "/remove4KImg")
  1635. // public ResultData remove4KImg() throws Exception{
  1636. //
  1637. // List<SceneProEntity> list = sceneProService.findAll();
  1638. // CameraDetailEntity cameraDetailEntity = new CameraDetailEntity();
  1639. // String path = "";
  1640. //
  1641. // for(SceneProEntity sceneProEntity : list){
  1642. // if(sceneProEntity.getPayStatus() != 1 || sceneProEntity.getId() < 10685){
  1643. // continue;
  1644. // }
  1645. // path = sceneProEntity.getDataSource();
  1646. // log.info("场景:" + sceneProEntity.getNum());
  1647. //
  1648. // String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
  1649. // JSONObject uploadJson = null;
  1650. // JSONArray array = null;
  1651. // if(uploadData!=null) {
  1652. // uploadJson = JSONObject.parseObject(uploadData);
  1653. // array = uploadJson.getJSONArray("upload");
  1654. // }
  1655. // if(array == null){
  1656. // log.info("场景计算失败:" + sceneProEntity.getNum());
  1657. // continue;
  1658. // }
  1659. // JSONObject fileJson = null;
  1660. // String fileName = "";
  1661. // Map<String, String> map = new HashMap<>();
  1662. // for(int i = 0, len = array.size(); i < len; i++){
  1663. // fileJson = array.getJSONObject(i);
  1664. // fileName = fileJson.getString("file");
  1665. // //文件不存在抛出异常
  1666. // if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
  1667. // throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
  1668. // }
  1669. //
  1670. //
  1671. // //tiles文件夹,亚马逊瓦片图
  1672. // if(fileJson.getIntValue("clazz") == 7 ){
  1673. // if(fileName.contains("/4k_")){
  1674. // map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
  1675. // sceneProEntity.getNum()+ File.separator + fileName);
  1676. // }
  1677. // }
  1678. //
  1679. // }
  1680. //
  1681. // Long space = 0L;
  1682. // File spaceFile = null;
  1683. // for (String key : map.keySet()) {
  1684. // spaceFile = new File(key);
  1685. // if(spaceFile.exists()){
  1686. // space += spaceFile.length();
  1687. // }
  1688. // }
  1689. // if(space > 0){
  1690. // if(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())).compareTo(new BigInteger("0")) < 0){
  1691. // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量小于0不处理");
  1692. // continue;
  1693. // }
  1694. // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量");
  1695. // sceneProEntity.setSpace(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())) );
  1696. // sceneProService.update(sceneProEntity);
  1697. //
  1698. // cameraDetailEntity = cameraDetailService.findByCameraId(sceneProEntity.getCameraId());
  1699. // cameraDetailEntity.setUsedSpace(sceneProService.findTotalSpaceByCameraId(sceneProEntity.getCameraId()));
  1700. // cameraDetailService.update(cameraDetailEntity);
  1701. // }
  1702. // }
  1703. //
  1704. //
  1705. // return Result.success();
  1706. // }
  1707. //
  1708. // /**
  1709. // *
  1710. // * 获取场景描述等信息
  1711. // */
  1712. // @ApiOperation("获取场景描述等信息")
  1713. // @PostMapping(value = "/getSceneDetail")
  1714. // @CheckCurrentUser(description = "获取场景描述等信息")
  1715. // @ApiImplicitParams({
  1716. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
  1717. // public ResultData getSceneDetail(String sceneNum) throws Exception{
  1718. // String token = getToken();
  1719. // if(StringUtils.isEmpty(token)){
  1720. // throw new BaseRuntimeException(3004, "无token参数");
  1721. // }
  1722. //
  1723. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  1724. // if(ssoUser == null){
  1725. // throw new BaseRuntimeException(3004, "token参数不正确");
  1726. // }
  1727. //
  1728. // if(StringUtil.isEmpty(sceneNum)){
  1729. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1730. // }
  1731. //
  1732. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  1733. // if(sceneProEntity == null){
  1734. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1735. // }
  1736. // String snCode = null;
  1737. // if(!ObjectUtils.isEmpty(sceneProEntity.getCameraId())){
  1738. // CameraEntity cameraEntity = cameraService.findById(sceneProEntity.getCameraId());
  1739. // if(ObjectUtils.isEmpty(cameraEntity)){
  1740. // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029);
  1741. // }
  1742. // snCode = cameraEntity.getSnCode();
  1743. // }
  1744. // Map<String, Object> map = new HashMap<>();
  1745. // map.put("webSite", sceneProEntity.getWebSite());
  1746. // map.put("thumb", sceneProEntity.getThumb());
  1747. // map.put("num", sceneProEntity.getNum());
  1748. // map.put("sceneName", sceneProEntity.getSceneName());
  1749. // map.put("sceneDec", sceneProEntity.getSceneDec());
  1750. // map.put("snCode", snCode);
  1751. // map.put("createDate", sceneProEntity.getCreateTime().getTime());
  1752. // map.put("createTime", DateUtil.date2String(sceneProEntity.getCreateTime(), DateUtil.YYYY_MM_DD_DATE_FORMAT));
  1753. //
  1754. // return Result.success(map);
  1755. // }
  1756. //
  1757. //
  1758. // /**
  1759. // *
  1760. // * 随心装场景码同步
  1761. // */
  1762. // @ApiOperation("随心装场景码同步")
  1763. // @PostMapping(value = "/synsencecode")
  1764. // @CheckCurrentUser(description = "随心装场景码同步")
  1765. // @ApiImplicitParams({
  1766. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"),
  1767. // @ApiImplicitParam(name = "vrsceneNum", value = "随心装场景码", dataType = "String")})
  1768. // public ResultData synsencecode(String sceneNum,String vrsceneNum) throws Exception{
  1769. // String token = getToken();
  1770. // if(StringUtils.isEmpty(token)){
  1771. // throw new BaseRuntimeException(3004, "无token参数");
  1772. // }
  1773. //
  1774. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  1775. // if(ssoUser == null){
  1776. // throw new BaseRuntimeException(3004, "token参数不正确");
  1777. // }
  1778. //
  1779. // if(StringUtil.isEmpty(sceneNum)){
  1780. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1781. // }
  1782. //
  1783. // if(StringUtil.isEmpty(vrsceneNum)){
  1784. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1785. // }
  1786. //
  1787. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  1788. //
  1789. //
  1790. // if(sceneProEntity == null){
  1791. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1792. // }
  1793. //
  1794. // //dsx 这里使用com.fdkankan.scene.service.impl.SceneProEditExtServiceImpl#findEdit
  1795. // SceneProEditEntity editEntity = sceneProService.findEdit(sceneProEntity);
  1796. //
  1797. // if(editEntity == null){
  1798. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1799. // }
  1800. // editEntity.setVrNum(vrsceneNum);
  1801. // sceneProService.updateEdit(editEntity);
  1802. //
  1803. // return Result.success();
  1804. // }
  1805. //
  1806. // /**
  1807. // *
  1808. // * 三维家 拉取场景数据,压缩zip包
  1809. // */
  1810. // @ApiOperation("三维家 拉取场景数据,压缩zip包")
  1811. // @PostMapping(value = "/scenecpzip")
  1812. // @CheckCurrentUser(description = "随心装场景码同步")
  1813. // @ApiImplicitParams({
  1814. // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")
  1815. // })
  1816. // public ResultData scenecpzip(String sceneNum) throws Exception{
  1817. // String token = getToken();
  1818. // if(StringUtils.isEmpty(token)){
  1819. // throw new BaseRuntimeException(3004, "无token参数");
  1820. // }
  1821. //
  1822. // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
  1823. // if(ssoUser == null){
  1824. // throw new BaseRuntimeException(3004, "token参数不正确");
  1825. // }
  1826. //
  1827. // if(StringUtil.isEmpty(sceneNum)){
  1828. // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
  1829. // }
  1830. //
  1831. //
  1832. // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
  1833. //
  1834. //
  1835. // if(sceneProEntity == null){
  1836. // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  1837. // }
  1838. //
  1839. //
  1840. // return Result.success();
  1841. // }
  1842. }