SceneController.java 88 KB

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