SceneController.java 87 KB

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