SceneController.java 88 KB

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