123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911 |
- package com.fdkankan.scene.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.fdkankan.common.response.ResultData;
- import com.fdkankan.scene.service.*;
- import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
- import com.fdkankan.scene.vo.SceneParamVO;
- import com.fdkankan.scene.vo.SceneVO;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * <p>
- * 场景表 前端控制器
- * </p>
- *
- * @author dengsixing
- * @since 2021-12-23
- */
- @RestController
- @RequestMapping("/api/scene")
- public class SceneController {
- @Autowired
- ISceneProService sceneProService;
- @Autowired
- ISceneService sceneService;
- @Autowired
- ISceneFileBuildService sceneFileBuildService;
- @Autowired
- IVideoSceneProgressService videoSceneProgressService;
- @Autowired
- IPicSceneProgressService picSceneProgressService;
- /**
- * 获取场景详情
- */
- @PostMapping(value = "/getInfo")
- public SceneVO getInfo(@RequestBody SceneParamVO param){
- return sceneProService.getInfo(param.getSceneNum());
- }
- /**
- * 场景浏览
- * @param param
- * @return
- */
- @PostMapping(value = "/search")
- public IPage<SceneVO> search(@RequestBody SceneParamVO param) {
- return sceneService.search(param);
- }
- /**
- * 场景浏览
- * @param param
- * @return
- */
- @PostMapping(value = "/loadScene")
- public Page loadScene(@RequestBody SceneParamVO param) {
- return sceneService.loadScene(param);
- }
- /**
- * 场景浏览
- * @param param
- * @return
- */
- @PostMapping(value = "/loadAllScene")
- public Page loadAllScene(@RequestBody SceneParamVO param){
- return sceneService.loadAllScene2(param);
- }
- /**
- * 更新浏览次数
- */
- @PostMapping(value = "/updateViewCount")
- public ResultData updateViewCount(@RequestBody SceneParamVO param){
- return sceneService.updateViewCount(param.getSceneNum());
- }
- /**
- * 手动更新浏览数据到数据库
- */
- @PostMapping(value = "/updatePv")
- public ResultData updatePv() throws Exception {
- sceneService.updatePv();
- return ResultData.ok();
- }
- /**
- * 场景模型重新计算
- */
- @PostMapping(value = "/rebuildScene")
- public ResultData rebuildScene(@RequestBody SceneParamVO param) throws Exception {
- return sceneFileBuildService.rebuildScene(param.getSceneNum());
- }
- /**
- * 场景模型重新计算
- */
- @PostMapping(value = "/rebuildVideoScene")
- public ResultData rebuildVideoScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
- return sceneFileBuildService.rebuildVideoScene(param);
- }
- /**
- * 场景模型重新计算
- */
- @PostMapping(value = "/rebuildPicScene")
- public ResultData rebuildPicScene(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
- return sceneFileBuildService.rebuildPicScene(param);
- }
- /**
- * 场景视频重新计算进度
- */
- @PostMapping(value = "/rebuildVideoSceneProgress")
- public ResultData rebuildVideoSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
- return videoSceneProgressService.rebuildVideoSceneProgress(param);
- }
- /**
- * 场景视频重新计算进度
- */
- @PostMapping(value = "/rebuildPicSceneProgress")
- public ResultData rebuildPicSceneProgress(@RequestBody RebuildVedioSceneParamVO param) throws Exception {
- return picSceneProgressService.rebuildPicSceneProgress(param);
- }
- /**
- * 查看场景对应的数据,给刘强用的
- */
- @PostMapping(value = "/querySceneDataSource")
- public ResultData querySceneDataSource(@RequestBody SceneParamVO param){
- return sceneService.querySceneDataSource(param);
- }
- /**
- * 查看场景对应的场景码,给刘强用的
- */
- @PostMapping(value = "/querySceneNum")
- public ResultData querySceneNum(@RequestBody SceneParamVO param){
- return sceneService.querySceneNum(param);
- }
- /**
- * 查看场景对应的数据,给刘强用的
- */
- @PostMapping(value = "/downloadCapture")
- public ResultData downloadCapture(@RequestBody SceneParamVO param) throws Exception {
- return sceneProService.downloadCapture(param);
- }
- /**
- * 上传results数据
- * @param param
- */
- @PostMapping(value = "/uploadResultsData")
- public ResultData uploadResultsData(@RequestBody SceneParamVO param) throws Exception{
- return sceneProService.uploadResultsData(param);
- }
- /**
- * 一键换装完成修改场景状态
- * @param param
- */
- @PostMapping(value = "/updateStatusByScene")
- public ResultData updateStatusByScene(@RequestBody SceneParamVO param) throws Exception{
- return sceneProService.updateStatusByScene(param);
- }
- /**
- * 获取一键换装场景状态
- */
- @PostMapping(value = "/getStatusByScene")
- public ResultData getStatusByScene(SceneParamVO param) throws Exception{
- return sceneProService.getStatusByScene(param);
- }
- // /**
- // * 获取场景详情
- // */
- // @ApiOperation("获取场景详情")
- // @PostMapping(value = "/getSceneAndCameras")
- // public ResultData getSceneAndCameras(@RequestBody Map<String,Object> params) throws Exception {
- // String userName = params.get("userName").toString();
- // List excludeNums = (List)params.get("excludeNums");
- // UserEntity user = userService.findUserByUserName(userName);
- // if(ObjectUtils.isEmpty(user)){
- // throw new BaseRuntimeException("用户不存在");
- // }
- // return sceneProService.getSceneAndCameras(user.getId(),excludeNums);
- // }
- //
- // /**
- // * 获取场景详情
- // */
- // @ApiOperation("获取场景详情")
- // @PostMapping(value = "/findSceneEcs")
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
- // public ResultData findSceneEcs(HttpServletRequest request) throws Exception{
- // String sceneNum = request.getParameter("num");
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // return Result.success((Object) sceneProEntity.getEcs());
- // }
- //
- // /**
- // * 根据场景密码打开场景
- // */
- // @ApiOperation("根据场景密码打开场景")
- // @PostMapping(value = "/openSceneBykey")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneKey", value = "场景秘钥", dataType = "String"),
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
- // public ResultData openSceneBykey(HttpServletRequest request) throws Exception {
- // String sceneNum = request.getParameter("num");
- // String sceneKey = request.getParameter("sceneKey");
- // if (StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(sceneKey)) {
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if (sceneProEntity == null) {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // if (sceneProEntity.getPayStatus() != 1) {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- // if (editEntity == null) {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // if(!sceneKey.equals(editEntity.getSceneKey())){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5021, SceneConstant.FAILURE_MSG_5021);
- // }
- //
- // return Result.success();
- // }
- //
- // /**
- // * 是否已登录
- // * @return
- // */
- // @ApiOperation("是否已登录")
- // @PostMapping(value = "/isLogin")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "token", value = "用户token", dataType = "String"),
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
- // public ResultData isLogin(HttpServletRequest request) throws Exception{
- // String num = request.getParameter("num");
- // String token = request.getHeader("token");
- // if(StringUtil.isEmpty(num) ){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if (ssoUser == null){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
- // }
- //
- // // 解密获得username,用于和数据库进行对比
- // String username = JwtUtil.getUsername(token);
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // if(sceneProEntity.getPayStatus() != 1){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // JSONObject jsonObject = new JSONObject();
- //
- // List<SceneResourceEntity> exclude = new ArrayList<>();
- // SceneResourceEntity excludeEntity = new SceneResourceEntity();
- // excludeEntity.setKeyWord("data");
- // exclude.add(excludeEntity);
- //
- // CameraEntity cameraEntity = goodsService.findByChildName(username);
- // jsonObject.put("exclude", exclude);
- // jsonObject.put("include", new ArrayList<>());
- // jsonObject.put("company", null);
- // Result result = Result.success(jsonObject);
- //
- // //判断该场景是否属于增值权益
- // boolean isIncrement = false;
- // //获取该相机是否有权益
- // boolean isExpired = false;
- // CameraEntity sceneCamera = goodsService.findCameraById(sceneProEntity.getCameraId());
- // if(sceneCamera != null){
- // UserIncrementEntity userIncrementEntity = userIncrementService.findByCameraId(sceneCamera.getId());
- //
- // if(userIncrementEntity != null){
- // if( userIncrementEntity.getIsExpired().intValue() == 0){
- // isIncrement = true;
- // }
- // if(userIncrementEntity.getIsExpired().intValue() == 1){
- // isExpired = true;
- // }
- // }else{
- // try {
- // Date date = DateUtil.string2Date("2021-09-09 00:00:00",null);
- //
- // //非07批次的放开
- // String pc = sceneCamera.getSnCode().substring(0,2);
- // if(!pc.equals("07") ){
- // if(sceneCamera.getCreateTime()!=null && date.after(sceneCamera.getCreateTime())){
- //
- // isIncrement = true;
- // isExpired = false;
- // }
- // }
- // }catch (Exception e){
- // e.printStackTrace();
- // }
- // }
- // }
- //
- // jsonObject.put("isExpired", isExpired );
- // jsonObject.put("isIncrement", isIncrement);
- //
- // //判断过期时间
- // Date date = DateUtil.string2Date(expectedTime,null);
- //
- // jsonObject.put("isTransition",DateUtil.isBeforeNow2(date));
- //
- //
- // if(cameraEntity != null){
- // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
- // if(cameraDetailEntity.getCompanyId() != null){
- // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){
- // jsonObject.put("exclude", new ArrayList<>());
- // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue());
- // }
- // }
- // return result;
- // }
- //
- // UserEntity userEntity = userService.findUserByUserName(username);
- // if("18750226207".equals(username)){
- // log.info("18750226207该账号默认超级管理员,可以操作所有场景");
- // }
- // else if(userEntity == null || sceneProEntity.getUserId() == null || userEntity.getId().longValue() != sceneProEntity.getUserId().longValue()){
- // log.info("user:" + userEntity.getId() + ",scene:" + sceneProEntity.getUserId());
- //
- // Condition condition = new Condition(SceneCooperationEntity.class);
- // condition.and().andEqualTo("sceneNum", num);
- // List<SceneCooperationEntity> list = sceneCooperationService.findAll(condition);
- // if(list != null && list.size() > 0){
- // if(list.get(0).getUserId().longValue() != userEntity.getId().longValue()){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- // }else {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- // }
- //
- // if(sceneProEntity.getCameraId() != null){
- // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId());
- // if(cameraEntity != null){
- // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
- // if(cameraDetailEntity.getCompanyId() != null){
- // if(cameraDetailEntity.getCompanyId().longValue() == 1 || cameraDetailEntity.getCompanyId().longValue() == 14){
- // jsonObject.put("exclude", new ArrayList<>());
- // jsonObject.put("company", cameraDetailEntity.getCompanyId().longValue());
- // }
- // }
- // }
- // }
- //
- // //权限控制完后判断若是协作账号,获取协作权限
- // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(num);
- // //若数据为空表示可操作全部资源
- // if(sceneCooperationEntity == null || sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){
- // return result;
- // }
- //
- // if(sceneProEntity != null && sceneProEntity.getUserId() == sceneCooperationEntity.getUserId().longValue()){
- // return result;
- // }
- //
- // jsonObject.put("include", sceneResourceService.findByCooperationId(sceneCooperationEntity.getId()));
- //
- // return result;
- //
- // }
- //
- // //跳转到编辑页面
- // @ApiOperation("跳转到编辑页面")
- // @PostMapping("goEditScenePage")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
- // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"),
- // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String"),
- // @ApiImplicitParam(name = "vlog", value = "vlog", dataType = "String"),
- // @ApiImplicitParam(name = "childName", value = "相机编码", dataType = "String")
- // })
- // public void goEditScenePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
- // String phoneNum = request.getParameter("phoneNum");
- // String password = request.getParameter("password");
- // String sceneNum = request.getParameter("sceneNum");
- // String childName = request.getParameter("childName");
- // String lang = request.getParameter("lang");
- // String vlog = request.getParameter("vlog");
- //
- // SceneProEntity scene = sceneProService.findBySceneNum(sceneNum);
- //
- // if(scene == null) {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // if(StringUtil.isNotEmpty(childName)){
- // CameraEntity cameraEntity = goodsService.findByChildName(childName);
- // if(cameraEntity != null){
- //
- // CameraDetailEntity cameraDetailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
- // if(cameraDetailEntity != null && cameraDetailEntity.getCooperationUser() != null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- //
- // SSOUser dbUser = new SSOUser();
- // dbUser.setUserName(childName);
- //
- // String token = JwtUtil.createJWT(-1, childName);
- // SSOLoginHelper.login(token, dbUser);
- //
- // //登录成功
- // if(scene.getWebSite().contains(sceneProUrl)){
- // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
- // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
- // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
- // }
- //
- // if(scene.getWebSite().contains(sceneProNewUrl)){
- // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
- // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
- // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
- // }
- // return;
- // }
- // }
- //
- // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)
- // || StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // if(scene.getUserId()==null)
- // {
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5013, SceneConstant.FAILURE_MSG_5013);
- // }
- //
- // Result result = userService.findByUserName(phoneNum);
- // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // if(ssoUser.getId().longValue() != scene.getUserId().longValue()) {
- // SceneCooperationEntity sceneCooperationEntity = sceneCooperationService.findBySceneNum(sceneNum);
- // if(sceneCooperationEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- //
- // if(sceneCooperationEntity.getUserId().longValue() != ssoUser.getId().longValue()){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- //
- // }
- //
- // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
- // {
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
- // SSOLoginHelper.login(token, ssoUser);
- // //登录成功
- // if(scene.getWebSite().contains(sceneProUrl)){
- // response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
- // sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
- // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
- // }
- //
- // if(scene.getWebSite().contains(sceneProNewUrl)) {
- // response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
- // sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" +
- // (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
- // }
- // }
- //
- // //跳转到官网消费页面
- // @ApiOperation("跳转到官网消费页面")
- // @PostMapping("goConsumptionPage")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
- // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
- // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")})
- // public void goConsumptionPage(HttpServletRequest request, HttpServletResponse response) throws Exception{
- // String phoneNum = request.getParameter("phoneNum");
- // String password = request.getParameter("password");
- // String lang = request.getParameter("lang");
- //
- // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // Result result = userService.findByUserName(phoneNum);
- // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
- // {
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
- // SSOLoginHelper.login(token, ssoUser);
- // //登录成功
- // response.sendRedirect(mainUrl + "mobile.html?token="+ token + "&app" + (lang == null ? "" : "&lang=" + lang)+"#/consumption/0" );
- // }
- //
- // //跳转到官网扩容充值页面
- // @ApiOperation("跳转到官网扩容充值页面")
- // @PostMapping("goRechargePage")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "phoneNum", value = "用户名(手机号)", dataType = "String"),
- // @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
- // @ApiImplicitParam(name = "childName", value = "相机mac地址", dataType = "String"),
- // @ApiImplicitParam(name = "lang", value = "语言", dataType = "String")})
- // public void goRechargePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
- // String phoneNum = request.getParameter("phoneNum");
- // String password = request.getParameter("password");
- // String childName = request.getParameter("childName");
- // String lang = request.getParameter("lang");
- //
- // if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // Result result = userService.findByUserName(phoneNum);
- // SSOUser ssoUser = mapper.convertValue(result.getData(), SSOUser.class);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
- // {
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
- // }
- //
- // String token = JwtUtil.createJWT(-1, ssoUser.getUserName());
- // SSOLoginHelper.login(token, ssoUser);
- // //登录成功
- // response.sendRedirect(mainUrl + "mobile.html#/introduce/" + childName + "?token=" + token + "&app" + (lang == null ? "" : "&lang=" + lang));
- // }
- //
- // /**
- // * app录音获取录音文件版本
- // */
- // @ApiOperation("app录音获取录音文件版本")
- // @PostMapping(value = "/getVoiceSound")
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
- // public ResultData getVoiceSound(HttpServletRequest request) throws Exception {
- // String sceneNum = request.getParameter("num");
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- //
- // //更新访问数量
- // return Result.success(editEntity.getScreencapVoiceSoundsync());
- // }
- //
- // /**
- // * 下载模型文件
- // */
- // @ApiOperation("下载模型文件")
- // @PostMapping(value = "/downloadTexData")
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
- // public ResultData downloadTexData(HttpServletRequest request, HttpServletResponse response) throws Exception {
- // String sceneNum = request.getParameter("num");
- //
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // String dataPath = sceneProEntity.getDataSource() + "/caches/tex";
- // if(new File(sceneProEntity.getDataSource() + "_edit/caches/tex").exists()){
- // dataPath = sceneProEntity.getDataSource() + "_edit/caches/tex";
- // }
- // File filePath = new File(dataPath);
- // for(String deletePath : filePath.list()){
- // if(deletePath.endsWith(".obj") && !deletePath.contains("output.house.obj")){
- // FileUtils.deleteFile(filePath.getAbsolutePath() + File.separator + deletePath);
- // }
- // }
- //
- // FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/tex.zip", dataPath);
- //
- // return Result.success(mainUrl + "scene/images/images" + sceneNum + "/tex.zip?t=" +System.currentTimeMillis());
- // }
- //
- // /**
- // * 生成英文版二维码
- // */
- // @ApiOperation("生成英文版二维码")
- // @PostMapping(value = "/createEnSceneQRcode")
- // public ResultData createEnSceneQRcode(HttpServletRequest request, HttpServletResponse response) throws Exception {
- // List<SceneProEntity> proEntityList = sceneProService.findAll();
- // for(SceneProEntity proEntity : proEntityList){
- // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProUrl + proEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+proEntity.getNum()+"_en.png", null);
- // }
- //
- // List<SceneEntity> entityList = sceneService.findAll();
- // for(SceneEntity sceneEntity : entityList){
- // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneUrl + sceneEntity.getNum() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneEntity.getNum()+"_en.png", null);
- // }
- // return Result.success("生成完成");
- // }
- //
- // /**
- // * 根据sn码查找所有场景连接
- // */
- // @ApiOperation("根据sn码查找所有场景连接")
- // @PostMapping(value = "/findSceneBySnCode")
- // @ApiImplicitParam(name = "snCode", value = "snCode", dataType = "String")
- // public ResultData findSceneBySnCode(HttpServletRequest request, HttpServletResponse response) throws Exception {
- // String snCode = request.getParameter("snCode");
- // CameraEntity cameraEntity = goodsService.findBySnCode(snCode);
- //
- // if(cameraEntity == null){
- // return Result.success();
- // }
- //
- // return Result.success(sceneProService.findByCameraId(cameraEntity.getId()));
- // }
- //
- // /**
- // * 上传ar场景数据
- // * @param file
- // * @param params
- // * @return
- // */
- // @ApiOperation("上传ar场景数据")
- // @PostMapping("uploadImgAndJson")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "file", value = "文件流", dataType = "MultipartFile"),
- // @ApiImplicitParam(name = "params", value = "参数", dataType = "String"),
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
- // public ResultData uploadImgAndJson(@RequestParam(value = "file",required = false) MultipartFile file,
- // String params, String num) throws Exception {
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // String path = sceneProEntity.getDataSource() + "_ar";
- // String filePath = path + "/extras/";
- //
- // String fileName = "ar.jpg";
- //
- // File targetFile = new File(filePath + fileName);
- // if(!targetFile.getParentFile().exists()){
- // targetFile.getParentFile().mkdirs();
- // }
- // file.transferTo(targetFile);
- //
- // JSONObject jsonObject = JSONObject.parseObject(params);
- // FileUtils.writeFile(filePath + "ar_in.json", jsonObject.toString());
- //
- // //创建data.json
- // JSONObject dataJson = new JSONObject();
- // dataJson.put("ar", true);
- // dataJson.put("split_type", "SPLIT_V1");
- // dataJson.put("data_describe", "double spherical");
- // dataJson.put("skybox_type", "SKYBOX_V5");
- // FileUtils.writeFile(path + "/data.json", dataJson.toString());
- //
- // if(new File(sceneProEntity.getDataSource() + File.separator + "caches").exists()){
- // CreateObjUtil.createSoftConnection(sceneProEntity.getDataSource() + File.separator + "caches" , path + File.separator + "caches");
- // }
- //
- // //调用算法
- // CreateObjUtil.build3dModel(path, "");
- //
- // String result = FileUtils.readFile(path + "/results/ar_out.json");
- // if(result == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012);
- // }
- //
- // return Result.success(result);
- // }
- //
- // /**
- // * 正式环境与测试环境互相复制资源并且重算
- // */
- // @ApiOperation("正式环境与测试环境互相复制资源并且重算")
- // @PostMapping(value = "/copyDataAndBuild")
- // @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")
- // public void copyDataAndBuild(HttpServletRequest request, HttpServletResponse response) throws Exception {
- // String num = request.getParameter("num");
- //
- // Map postData = new HashMap();
- // postData.put("num", num);
- // String dataPath = "";
- // if("dev".equals(environment)){
- // dataPath = HttpRequestorUtil.doPost("https://www.4dkankan.com/api/scene/querySceneDataSource", postData);
- // log.info("正式环境资源路径:" + dataPath);
- // }else {
- // dataPath = HttpRequestorUtil.doPost("https://test.4dkankan.com/api/scene/querySceneDataSource", postData);
- // log.info("测试环境资源路径:" + dataPath);
- // }
- //
- // if(dataPath.contains("/mnt/data/")){
- // String newPath = dataPath;
- //
- // if(!new File(newPath).exists()){
- // new File(newPath).mkdirs();
- // }
- //
- // if(!new File(newPath + "/capture").exists()){
- // new File(newPath + "/capture").mkdirs();
- // }
- // if("dev".equals(environment)){
- // //远程复制正式环境资源到测试环境;
- // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/");
- // log.info("数据复制完成");
- // }else {
- // //远程复制正式环境资源到测试环境;
- // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + dataPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", dataPath + "/capture/");
- // log.info("数据复制完成");
- // }
- //
- //
- // String data = FileUtils.readFile(newPath + "/capture/data.fdage");
- // JSONObject jsonObject = JSONObject.parseObject(data);
- // String sceneNum = "";
- // if(jsonObject != null){
- // sceneNum = sceneNumService.generateSceneNum();
- //
- // String cameraName = jsonObject.getJSONObject("cam").getString("uuid");
- // String unicode = jsonObject.getString("creator") + "_" + jsonObject.getString("uuidtime");
- //
- // log.info("查询相机:" + cameraName);
- // CameraEntity cameraEntity = goodsService.findByChildName(cameraName);
- //
- // if(cameraEntity == null){
- // log.error("该相机不存在:" + cameraName);
- // //偶现data.fdage给的相机码多了或少了4DKKPRO_
- // if(cameraName.contains("4DKKPRO_")){
- // cameraEntity = goodsService.findByChildName(cameraName.replace("4DKKPRO_", ""));
- // }else {
- // cameraEntity = goodsService.findByChildName("4DKKPRO_" + cameraName);
- // }
- // if(cameraEntity == null){
- // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
- // }
- // }
- //
- // CameraDetailEntity detailEntity = goodsService.findCameraDetailByCameraId(cameraEntity.getId());
- // if(detailEntity == null){
- // log.error("该相机详情不存在:" + cameraName);
- // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
- // }
- //
- // String userName = null;
- // if(detailEntity.getUserId() != null){
- // Result result2 = userService.findById(detailEntity.getUserId());
- // SSOUser user = mapper.convertValue(result2.getData(), SSOUser.class);
- // if(user != null){
- // userName = user.getUserName();
- // }
- // }
- //
- // JSONObject firmwareVersion = new JSONObject();
- // if(jsonObject.containsKey("camSoftwareVersion") && StringUtil.isNotEmpty(jsonObject.getString("camSoftwareVersion"))){
- // firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion"));
- // }
- //
- // if(jsonObject.containsKey("version") && StringUtil.isNotEmpty(jsonObject.getString("version"))){
- // firmwareVersion.put("version", jsonObject.getString("version"));
- // }
- //
- //// String sceneUrl = mainUrl + sceneProUrl;
- //// String buildType = "V2";
- //// //根据videoVersion判断是V2还是V3版本的算法和页面
- //// if(jsonObject.containsKey("videoVersion") && StringUtil.isNotEmpty(jsonObject.getString("videoVersion"))){
- //// if(jsonObject.getIntValue("videoVersion") >= 4){
- //// buildType = "V3";
- //// sceneUrl = mainUrl + sceneProNewUrl;
- //// }
- //// }
- // String buildType = "V3";
- // String sceneUrl = mainUrl + sceneProNewUrl;
- //
- // String filePath = newPath + "/capture/";
- // String prefix = newPath.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/";
- //
- // String fileId = prefix.split("/")[1];
- //
- // String icon = null;
- // if(jsonObject.containsKey("icon") && StringUtil.isNotEmpty(jsonObject.getString("icon"))){
- // CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + prefix + jsonObject.getString("icon"), filePath);
- // uploadToOssUtil.upload(filePath + jsonObject.getString("icon"), "images/images" + sceneNum + "/" + jsonObject.getString("icon"));
- // icon = "https://4dkk.4dage.com/images/images" + sceneNum + "/" + jsonObject.getString("icon");
- // }
- //
- // Long cameraType = 11L;
- // //判断是否转台相机
- // if(detailEntity != null && detailEntity.getType() == 9){
- // cameraType = 13L;
- // }
- //
- // if(detailEntity != null && detailEntity.getType() == 10){
- // cameraType = 14L;
- // }
- //
- // SceneProEntity scene = ComputerUtil.createScenePro(sceneNum, cameraEntity.getId(), cameraEntity.getChildName(), jsonObject.getString("creator"),
- // jsonObject.getString("pwd"), unicode,
- // cameraType, String.valueOf(fileId), prefix, "", icon, "0", detailEntity.getUserId(), userName,
- // jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
- // jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
- // jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), sceneProService, sceneProEditService, 0,
- // producer, jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, type, ecsType,
- // sceneCooperationService, sceneResourceCooperationService, sceneResourceCameraService, detailEntity.getCooperationUser(), rubberSheetingUtil);
- //
- // producer.sendMsg(scene.getMqMsg());
- // }
- //// CreateObjUtil.build3dModel(newPath, "");
- //
- // JSONObject result = new JSONObject();
- // result.put("proData", dataPath);
- // result.put("testData", newPath);
- // result.put("num", sceneNum);
- // response.getWriter().print(result);
- // }
- // }
- //
- // /**
- // * 调用小程序商品列表
- // */
- // @ApiOperation("调用小程序商品列表")
- // @PostMapping(value = "/shopGoods")
- // @ApiImplicitParam(name = "keyword", value = "关键词", dataType = "String")
- // public void shopGoods(HttpServletRequest request, HttpServletResponse response) throws Exception {
- // String keyword = request.getParameter("keyword");
- //
- // Map postData = new HashMap();
- // postData.put("keyword", keyword);
- // postData.put("sort", "id");
- // postData.put("order", "desc");
- // String result = HttpRequestorUtil.doPost("https://shop.4dkankan.com/platform-framework/api/goods/list", postData);
- // log.info("获取小程序商品列表");
- //
- // response.getWriter().print(result);
- // }
- //
- // /**
- // * 保存配置文件数据
- // */
- // @ApiOperation("保存配置文件数据")
- // @PostMapping(value = "/saveConfigData")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "fileName", value = "文件名字", dataType = "MultipartFile"),
- // @ApiImplicitParam(name = "config", value = "config", dataType = "String")})
- // public ResultData saveConfigData(HttpServletRequest request) throws Exception {
- // String fileName = request.getParameter("fileName");
- // String config = request.getParameter("config");
- // FileUtils.writeFile(ConstantFilePath.SCENE_PATH + fileName, config);
- // return Result.success();
- // }
- //
- // /**
- // * 标定重算
- // */
- // @ApiOperation("标定重算")
- // @PostMapping(value = "/rebuildByPath")
- // @ApiImplicitParam(name = "path", value = "资源路径", dataType = "String")
- // public ResultData rebuildByPath(HttpServletRequest request) throws Exception{
- // String path = request.getParameter("path");
- // if(path.contains("color_anlysis")){
- // Map<String,String> map = ComputerUtil.computerCalibration(path);
- // uploadToOssUtil.uploadMulFiles(map);
- // return Result.success("开始标定计算");
- // }
- //
- // producer.sendMsg(path);
- // return Result.success("开始标定计算");
- // }
- //
- // /**
- // * 获取编辑页面的资源下载路径
- // */
- // @ApiOperation("获取编辑页面的资源下载路径")
- // @PostMapping(value = "/getEditDataUrl")
- // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String")
- // public ResultData getEditDataUrl(HttpServletRequest request) throws Exception{
- // String num = request.getParameter("num");
- //
- // if(StringUtils.isEmpty(num)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // List<String> result = new ArrayList<>();
- // List<String> urlList = new ArrayList<>();
- //
- // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "data/data" + num, urlList);
- // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "images/images" + num, urlList);
- // urlList = FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "voice/voice" + num, urlList);
- //
- // if(urlList != null && urlList.size() > 0){
- // for(String url : urlList){
- // result.add(url.replace(ConstantFilePath.BASE_PATH + "/", ""));
- // }
- // }
- //
- // return Result.success(result);
- // }
- //
- // @ApiOperation("根据场景码生成场景")
- // @PostMapping("/createScene")
- // @ApiImplicitParam(name = "num", value = "场景吗", dataType = "String")
- // public ResultData createScene(@RequestBody SceneParamVO param) throws Exception{
- // if(StringUtils.isEmpty(param.getNum())){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // StringBuffer dataBuf = new StringBuffer()
- // .append("data").append(File.separator)
- // .append("data").append(param.getNum());
- //
- // StringBuffer imagesBuf = new StringBuffer()
- // .append("images").append(File.separator)
- // .append("images").append(param.getNum());
- //
- // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
- // StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
- //
- // FileUtils.delAllFile(imagesBuffer.toString() + "/results/");
- // FileUtils.delAllFile(imagesBuffer.toString() + "/extras/");
- // //远程复制oss资源
- // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getObjName(), imagesBuffer.toString() + "/extras/");
- // //obj文件修改名字
- // FileUtils.copyFile(imagesBuffer.toString() + "/extras/" + param.getObjName(), imagesBuffer.toString() + "/extras/mesh.obj", true);
- // FileUtils.deleteFile(imagesBuffer.toString() + "/extras/" + param.getObjName());
- //
- // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + param.getMntName(), imagesBuffer.toString() + "/extras/");
- // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1", imagesBuffer.toString() + "/extras/");
- // //将文件复制出去
- // String[] imgs = new File(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1").list();
- // for(String img : imgs){
- // FileUtils.copyFile(imagesBuffer.toString() + "/extras/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + img,
- // imagesBuffer.toString() + "/extras/" + img, true);
- // }
- // CreateObjUtil.ossUtilCp(imagesBuf.toString() + File.separator + "vision.txt", imagesBuffer.toString());
- //
- // //创建data.json
- // JSONObject dataJson = new JSONObject();
- // dataJson.put("obj2txt", true);
- // dataJson.put("split_type", "SPLIT_V6");
- // dataJson.put("data_describe", "double spherical");
- // dataJson.put("skybox_type", "SKYBOX_V5");
- // FileUtils.writeFile(imagesBuffer.toString() + "/data.json", dataJson.toString());
- //
- // //调用objToTxt算法
- // CreateObjUtil.objToTxt(imagesBuffer.toString(), "");
- //
- // String uploadData = FileUtils.readFile(imagesBuffer.toString() + File.separator + "results" +File.separator+"upload.json");
- // JSONObject uploadJson = null;
- // JSONArray array = null;
- // if(uploadData!=null) {
- // uploadJson = JSONObject.parseObject(uploadData);
- // array = uploadJson.getJSONArray("upload");
- // }
- // if(array == null){
- // log.error("upload.json数据出错");
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012);
- // }
- //
- // Map<String,String> map = new HashMap<String,String>();
- // JSONObject fileJson = null;
- // String fileName = "";
- // for(int i = 0, len = array.size(); i < len; i++) {
- // fileJson = array.getJSONObject(i);
- // fileName = fileJson.getString("file");
- // //文件不存在抛出异常
- // if (!new File(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName).exists()) {
- // throw new Exception(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName + "文件不存在");
- // }
- //
- // //tex文件夹
- // if (fileJson.getIntValue("clazz") == 15) {
- // map.put(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName, "images/images" +
- // param.getNum() + "/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
- // continue;
- // }
- // }
- //
- // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
- // CreateObjUtil.convertDamToLzma(imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
- // CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" + File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
- // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam.lzma");
- // map.put(imagesBuffer.toString() + File.separator + "results" +File.separator+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam", "images/images"+param.getNum()+"/"+"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
- //
- // FileUtils.deleteFile(imagesBuffer.toString() + "/vision.modeldata");
- // CreateObjUtil.convertTxtToVisionmodeldata(imagesBuffer.toString() + "/vision.txt", imagesBuffer.toString() + "/vision.modeldata");
- // map.put(imagesBuffer.toString() + "/vision.modeldata", "images/images"+param.getNum()+"/vision.modeldata");
- //
- // uploadToOssUtil.uploadMulFiles(map);
- //
- // SceneProEntity proEntity = sceneProService.findBySceneNum(param.getNum());
- // if(proEntity == null){
- // proEntity = new SceneProEntity();
- // proEntity.setSceneName("四维看看");
- // proEntity.setSceneDec("<p>四维看看 让空间讲故事</p>");
- // proEntity.setSceneScheme(2);
- // proEntity.setNum(param.getNum());
- // proEntity.setUserId(param.getUserId());
- // proEntity.setWebSite(mainUrl + sceneProNewUrl + param.getNum());
- // proEntity.setStatus(1);
- // proEntity.setPayStatus(1);
- // proEntity.setBuildType("V3");
- //
- // if(param.getSceneSource()!=null){
- // proEntity.setSceneSource(param.getSceneSource());
- // }
- //
- // sceneProService.save(proEntity);
- //
- // SceneProEditEntity proEditEntity = new SceneProEditEntity();
- // proEditEntity.setProId(proEntity.getId());
- // sceneProEditService.save(proEditEntity);
- //
- // JSONObject scenejson = JSONObject.parseObject(JSONObject.toJSONString(proEntity));
- // scenejson.put("visions", 1);
- // FileUtils.writeFile(dataBuffer.toString() + File.separator+"scene.json", scenejson.toString());
- // }
- //
- // return Result.success(mainUrl + sceneProNewUrl + param.getNum());
- // }
- //
- // @ApiOperation("查找八目未使用过的场景吗")
- // @PostMapping("/finSceneNum")
- // public ResultData finSceneNum(){
- // String num = sceneNumService.generateSceneNum();
- // return Result.success(num);
- // }
- //
- // @ApiOperation("查找123看房未使用过的场景吗")
- // @PostMapping("/finSkSceneNum")
- // public ResultData finSkSceneNum(){
- // String num = sceneNumService.generateSceneNum();
- // return Result.success(num);
- // }
- //
- // @ApiOperation("根据一键换装风格码入库场景表")
- // @PostMapping("/createChangeScene")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "num", value = "", dataType = "String"),
- // @ApiImplicitParam(name = "oldNum", value = "场景吗", dataType = "String")})
- // public ResultData createChangeScene(HttpServletRequest request) throws Exception{
- // String projectNum = request.getParameter("num");
- // String oldNum = request.getParameter("oldNum");
- // String sceneName = request.getParameter("sceneName");
- // String resolution = request.getParameter("resolution");
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(projectNum);
- //
- // String floorJson = ConstantFilePath.SCENE_PATH + "data/data" + projectNum + File.separator + "floor.json";
- // String floorPlan = ConstantFilePath.SCENE_PATH + "images/images" + projectNum + File.separator + "floorplan.png";
- //
- // int sceneScheme = 12;
- // if(StringUtil.isNotEmpty(resolution)){
- // if("1024".equals(resolution)){
- // sceneScheme = 12;
- // }
- // if("2048".equals(resolution)){
- // sceneScheme = 11;
- // }
- // if("4096".equals(resolution)){
- // sceneScheme = 10;
- // }
- // }
- //
- // if(sceneProEntity != null){
- // sceneProEntity.setSceneName(sceneName);
- // sceneProEntity.setStatus(0);
- // sceneProEntity.setSceneScheme(sceneScheme);
- // sceneProService.update(sceneProEntity);
- //
- // if(!new File(floorJson).exists()){
- // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(),
- // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum);
- // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json");
- // }
- //
- // if(!new File(floorPlan).exists()){
- // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(),
- // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum);
- // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png");
- // }
- // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json"));
- // scenejson.put("sceneScheme", sceneScheme);
- // scenejson.put("sceneSource", 11);
- // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toJSONString());
- //
- // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- // sceneProEditEntity.setSceneKey(null);
- // sceneProEditEntity.setNeedKey(0);
- // sceneProEditService.update(sceneProEditEntity);
- //
- // return Result.success("一键换装场景存在,不重复生成");
- // }
- //
- // //根据旧的场景生成新的vr场景
- // sceneProEntity = sceneProService.findBySceneNum(oldNum);
- // if(sceneProEntity == null){
- // return Result.failure("场景不存在");
- // }
- //
- // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- //
- // sceneProEntity.setId(null);
- // sceneProEntity.setSceneType(99);
- // sceneProEntity.setWebSite(sceneProEntity.getWebSite().replace(oldNum, projectNum));
- // sceneProEntity.setNum(projectNum);
- // sceneProEntity.setSceneName(sceneName);
- // sceneProEntity.setStatus(0);
- // sceneProEntity.setPayStatus(1);
- // sceneProEntity.setSceneScheme(sceneScheme);
- // sceneProEntity.setSceneSource(11);
- // sceneProEntity.setSpace(new BigInteger("0"));
- // sceneProEntity.setCreateTime(new Date());
- // sceneProEntity.setVideos(null);
- // sceneProService.save(sceneProEntity);
- //
- // sceneProEditEntity.setId(null);
- // sceneProEditEntity.setProId(sceneProEntity.getId());
- // sceneProEditEntity.setJumpScene(false);
- // sceneProEditEntity.setHotsIds(null);
- // sceneProEditEntity.setSceneKey(null);
- // sceneProEditEntity.setNeedKey(0);
- // sceneProEditEntity.setScreencapVoiceSrc(null);
- // sceneProEditEntity.setScreencapVoiceSound(null);
- // sceneProEditEntity.setScreencapVoiceSoundsync(null);
- // sceneProEditEntity.setScreencapVoiceType(null);
- // sceneProEditEntity.setScreencapThumb(null);
- // sceneProEditEntity.setOverlay(null);
- // sceneProEditEntity.setFloorPlanAngle("0");
- // sceneProEditEntity.setVideosUser(null);
- // sceneProEditService.save(sceneProEditEntity);
- //
- // FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data"+oldNum+File.separator+"scene.json", ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", true);
- //
- // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json"));
- // scenejson.put("jumpScene", false);
- // scenejson.put("hots", 0);
- // scenejson.put("screencapVoiceSrc", null);
- // scenejson.put("screencapVoiceSound", null);
- // scenejson.put("screencapVoiceSoundsync", null);
- // scenejson.put("screencapVoiceType", null);
- // scenejson.put("screencapThumb", null);
- // scenejson.put("overlay", null);
- // scenejson.put("sceneScheme", 12);
- // scenejson.put("sceneSource", 11);
- // scenejson.put("videos", null);
- // scenejson.put("videosUser",null);
- // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toString());
- //
- // FileUtils.downLoadFromUrl(prefixAli + "data/data" + oldNum + File.separator+"floor.json?t=" + System.currentTimeMillis(),
- // "floor.json", ConstantFilePath.SCENE_PATH+"data/data" + projectNum);
- // FileUtils.downLoadFromUrl(prefixAli + "images/images" + oldNum + File.separator+"floorplan.png?t=" + System.currentTimeMillis(),
- // "floorplan.png", ConstantFilePath.SCENE_PATH+"images/images" + projectNum);
- //// FileUtils.copyFile(ConstantFilePath.SCENE_PATH+"data/data" + oldNum + File.separator+"floor.json",
- //// ConstantFilePath.SCENE_PATH+"data/data" + projectNum + File.separator+"floor.json", true);
- //
- //
- // uploadToOssUtil.upload(floorPlan, "images/images" + projectNum + File.separator + "floorplan.png");
- // uploadToOssUtil.upload(floorJson, "data/data" + projectNum + File.separator + "floor.json");
- // return Result.success();
- // }
- //
- // @ApiOperation("获取当前mq的队列数")
- // @GetMapping("/getMqNum")
- // public ResultData getMqNum(){
- // return Result.success(producer.getMessageCount());
- // }
- //
- //
- // @ApiOperation("根据模块名称,查询模块视频地址")
- // @PostMapping("/findSceneModuleVideo")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String")})
- // public ResultData findSceneModuleVideo(HttpServletRequest request){
- // String moduleName = request.getParameter("moduleName");
- // Condition condition = new Condition(SceneModuleVideoEntity.class);
- // condition.and().andEqualTo("moduleName", moduleName);
- // return Result.success(sceneModuleVideoService.findAll(condition));
- // }
- //
- // /**
- // * 新增或修改场景模块视频地址
- // */
- // @ApiOperation("新增或修改场景模块视频地址")
- // @PostMapping(value = "/saveSceneModuleVideo")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "id", value = "有则修改,无则新增", dataType = "String"),
- // @ApiImplicitParam(name = "sceneNum", value = "场景编码", dataType = "String"),
- // @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String"),
- // @ApiImplicitParam(name = "videoUrl", value = "视频地址", dataType = "String"),
- // @ApiImplicitParam(name = "images", value = "缩略图", dataType = "String")})
- // private Result saveSceneModuleVideo(HttpServletRequest request) throws Exception{
- // String id = request.getParameter("id");
- // String sceneNum = request.getParameter("sceneNum");
- // String moduleName = request.getParameter("moduleName");
- // String videoUrl = request.getParameter("videoUrl");
- // String images = request.getParameter("images");
- //
- // if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(moduleName) || StringUtils.isEmpty(videoUrl)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // SceneModuleVideoEntity entity = new SceneModuleVideoEntity();
- // entity.setSceneNum(sceneNum);
- // entity.setImages(images);
- // entity.setModuleName(moduleName);
- // entity.setVideoUrl(videoUrl);
- //
- // if(StringUtils.isEmpty(id)){
- // sceneModuleVideoService.save(entity);
- // }else {
- // entity.setId(Long.valueOf(id));
- // sceneModuleVideoService.update(entity);
- // }
- //
- // return Result.success();
- //
- // }
- //
- // /**
- // * 删除场景模块视频地址
- // */
- // @ApiOperation("删除场景模块视频地址")
- // @PostMapping(value = "/deleteSceneModuleVideo")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
- // private Result deleteSceneModuleVideo(HttpServletRequest request) throws Exception{
- // String id = request.getParameter("id");
- //
- // if(org.springframework.util.StringUtils.isEmpty(id)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // sceneModuleVideoService.deleteById(Long.valueOf(id));
- // return Result.success();
- // }
- //
- // /**
- // * 下载思为的html页面
- // */
- // @ApiOperation("下载思为的html页面")
- // @PostMapping(value = "/downloadSiWeiHtml")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public ResultData downloadSiWeiHtml(HttpServletRequest request) throws Exception{
- // String token = getToken();
- // if(StringUtils.isEmpty(token)){
- // throw new BaseRuntimeException(3004, "无token参数");
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(3004, "token参数不正确");
- // }
- //
- // String sceneNum = request.getParameter("sceneNum");
- //
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // //获取getInfo的数据
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // if(sceneProEntity.getPayStatus() != 1){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // if(sceneProEntity.getStatus() != 1 && sceneProEntity.getStatus() != -2){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // if(ssoUser == null || ssoUser.getId().longValue() != sceneProEntity.getUserId().longValue()){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
- // }
- //
- // if(isDownload.get()){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5024, SceneConstant.FAILURE_MSG_5024);
- // }
- //
- // isDownload.compareAndSet(false, true);
- //
- // try{
- // ResponseScene responseScene = new ResponseScene();
- // SceneProEditEntity editEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- //
- // CreateObjUtil.callshell("bash /opt/ossutil/copy.sh " + ConstantFilePath.BASE_PATH +
- // "/local/localHose" + " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
- //
- // //14表示matterPro场景,需要调用命令获取切图,并且修改sceneScheme为13
- // if(sceneProEntity.getSceneSource() == 14){
- // sceneProEntity.setSceneScheme(13);
- // CreateObjUtil.matterproCutImg(sceneProEntity.getNum(), ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
- // }
- //
- // BeanUtils.copyProperties(editEntity, responseScene);
- // BeanUtils.copyProperties(sceneProEntity, responseScene);
- // if(StringUtil.isNotEmpty(editEntity.getEntry())){
- // responseScene.setEntry(JSONObject.parseObject(editEntity.getEntry()).toJSONString());
- // }
- //
- // if(StringUtil.isNotEmpty(sceneProEntity.getGps())){
- // responseScene.setGps(JSONObject.parseObject(sceneProEntity.getGps()).toJSONString());
- // }
- //
- // responseScene.setCreateTime(new DateTime(sceneProEntity.getCreateTime()).toString("yyyy-MM-dd"));
- // responseScene.setCreateDate(sceneProEntity.getCreateTime().getTime());
- // if(StringUtil.isEmpty(editEntity.getSceneKey())){
- // responseScene.setIsPublic(0);
- // }else {
- // responseScene.setIsPublic(1);
- // }
- //
- // //不返回场景访问密码
- // responseScene.setSceneKey("");
- //
- // //替换index.html里面的场景码
- // String indexPath = ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + File.separator + "embed.html";
- // String index = FileUtils.readFile(indexPath);
- // FileUtils.deleteFile(indexPath);
- // FileUtils.writeFile(indexPath, index.replace("__ProjectNum__", sceneNum));
- //
- // //下载oss资源
- // CreateObjUtil.ossUtilCp("data/data" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data");
- // CreateObjUtil.ossUtilCp("images/images" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/images");
- // CreateObjUtil.ossUtilCp("video/video" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/video");
- // CreateObjUtil.ossUtilCp("voice/voice" + sceneNum, ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/voice");
- //
- // FileUtils.writeFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + "/data/data" + sceneNum + "/getInfo.json",
- // JSONObject.toJSONString(responseScene));
- //
- // CreateObjUtil.callshell("bash /opt/ossutil/gzip.sh " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum +
- // " " + ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
- //
- // FileUtils.deleteDirectory(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum);
- //// FileUtils.deleteFile(ConstantFilePath.BASE_PATH + "/local/localHose" + sceneNum + ".zip");
- //
- // isDownload.compareAndSet(true, false);
- // return Result.success((Object)"local/localHose" + sceneNum + ".zip");
- // }catch (Exception e){
- // e.printStackTrace();
- // isDownload.compareAndSet(true, false);
- // return Result.failure(LoginConstant.ERROR_MSG);
- // }finally {
- // isDownload.compareAndSet(true, false);
- // }
- //
- // }
- //
- // /**
- // * 思为获取场景列表
- // */
- // @ApiOperation("思为获取场景列表")
- // @PostMapping(value = "/siweiSceneList")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
- // @ApiImplicitParam(name = "pageSize", value = "页数", dataType = "String"),
- // @ApiImplicitParam(name = "snCode", value = "相机sn", dataType = "String"),
- // @ApiImplicitParam(name = "sceneName", value = "场景名称", dataType = "String"),
- // @ApiImplicitParam(name = "startDate", value = "开始时间", dataType = "String"),
- // @ApiImplicitParam(name = "endDate", value = "结束时间", dataType = "String")})
- // public Result<Page<ResponseScene>> siweiSceneList(HttpServletRequest request) throws Exception{
- // String token = getToken();
- // if(StringUtils.isEmpty(token)){
- // throw new BaseRuntimeException(3004, "无token参数");
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(3004, "token参数不正确");
- // }
- //
- // String pageNumStr = request.getParameter("pageNum");
- // String pageSizeStr = request.getParameter("pageSize");
- //
- // String sceneName = request.getParameter("sceneName");
- // String snCode = request.getParameter("snCode");
- // String startDate = request.getParameter("startDate");
- // String endDate = request.getParameter("endDate");
- // String num = request.getParameter("num");
- //
- // String cameraId = null;
- //
- // if(StringUtils.isNotEmpty(snCode)){
- // CameraEntity cameraEntity = goodsService.findBySnCode(snCode);
- // if(cameraEntity == null){
- // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6003, CameraConstant.FAILURE_MSG_6003);
- // }
- //
- // cameraId = String.valueOf(cameraEntity.getId());
- // }
- //
- // Integer pageNum = 1;
- // Integer pageSize = 10;
- // if(StringUtils.isNotEmpty(pageNumStr)){
- // pageNum = Integer.valueOf(pageNumStr);
- // }
- //
- // if(StringUtils.isNotEmpty(pageSizeStr)){
- // pageSize = Integer.valueOf(pageSizeStr);
- // }
- //
- //// List<Integer> counts = sceneService.findAllSceneCount("create_time desc", null,
- //// null, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num);
- //
- // PageHelper.startPage(pageNum, pageSize);
- // List<SceneProEntity> sceneEntityList = sceneService.findAllScene("create_time desc", null,
- // null, pageNum, pageSize, ssoUser.getId(), sceneName, cameraId, startDate, endDate, num, null, null, null);
- //
- // PageInfo<SceneProEntity> data = new PageInfo<>(sceneEntityList);
- //
- // List<Map<String, Object>> list = new ArrayList<>();
- // Map<String, Object> map = null;
- // SceneProEditEntity sceneProEditEntity = null;
- // CameraEntity cameraEntity = null;
- // for (SceneProEntity sceneProEntity : data.getList()) {
- // map = new HashMap<>();
- // map.put("num", sceneProEntity.getNum());
- // map.put("sceneName", sceneProEntity.getSceneName());
- //
- // cameraEntity = goodsService.findCameraById(sceneProEntity.getCameraId());
- // if(cameraEntity != null){
- // map.put("snCode", cameraEntity.getSnCode());
- // }
- //
- // map.put("webSite", sceneProEntity.getWebSite());
- // map.put("createDate", sceneProEntity.getCreateTime().getTime());
- // map.put("createTime", new DateTime(sceneProEntity.getCreateTime()).toString(DateUtil.DEFAULT_DATE_FORMAT));
- // map.put("thumb", sceneProEntity.getThumb());
- // map.put("shootCount", sceneProEntity.getShootCount());
- //
- // sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- // map.put("version", sceneProEditEntity.getVersion());
- // list.add(map);
- // }
- //
- //// int count = 0;
- //// for(Integer number : counts){
- //// count += number;
- //// }
- ////
- // Page<Map<String, Object>> a = new Page<Map<String, Object>>(pageNum, pageSize);
- // a.setTotal(data.getTotal());
- // PageInfo<Map<String, Object>> result = a.toPageInfo();
- // result.setList(list);
- //// PageInfo<Map<String, Object>> result = new PageInfo<>(list);
- // return Result.success(result);
- // }
- //
- // /**
- // * 将floor.json转换成酷家乐数据
- // */
- // @ApiOperation("将floor.json转换成酷家乐数据")
- // @PostMapping(value = "/convertCadKjl")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public String convertCadKjl(HttpServletRequest request) throws Exception{
- // String sceneNum = request.getParameter("sceneNum");
- //
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // StringBuffer dataBuf = new StringBuffer()
- // .append("data").append(File.separator)
- // .append("data").append(sceneNum)
- // .append(File.separator);
- //
- // StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
- //
- // String floorPath = dataBuffer.toString() + "floor.json";
- // CreateObjUtil.ossUtilCp(dataBuf.toString() + "floor.json", dataBuffer.toString());
- //
- // ConvertCadKjl cad = new ConvertCadKjl();
- // cad.init("指房宝", "指房宝装修房", "", "2", floorPath);
- // cad.input = cad.preHandle(cad.input);
- // JSONArray beams = cad.getBeams();
- // JSONArray walls = cad.getWalls();
- // walls = ConvertCadKjl.removeRepeat(walls);
- // JSONArray rooms = cad.getRooms();
- // JSONArray flues = cad.getFlues();
- // JSONArray holes = cad.getHoles();
- //
- // cad.output.put("holes", holes);
- // cad.output.put("flues", flues);
- // cad.output.put("beams", beams);
- // cad.output.put("rooms", rooms);
- // cad.output.put("walls", walls);
- // cad.output.put("needTranslate", false);
- //
- // return cad.output.toJSONString();
- // }
- //
- //
- // /**
- // * 创建sketch场景分享二维码的logo
- // */
- // @ApiOperation("创建sketch场景分享二维码的logo")
- // @PostMapping(value = "/createSketchQrLogo")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public ResultData createSketchQrLogo(HttpServletRequest request) throws Exception{
- // String sceneNum = request.getParameter("sceneNum");
- //
- // if(StringUtils.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // //生成二维码
- // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum, ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+".png", null);
- // MatrixToImageWriterUtil.createQRCode(mainUrl + sceneProNewUrl + sceneNum + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneNum+"_en.png", null);
- // return Result.success();
- // }
- //
- // /**
- // * 恢复scene.json中文乱码问题
- // */
- // @ApiOperation("恢复scene.json中文乱码问题")
- // @PostMapping(value = "/updateSceneJsonCode")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "createTime", value = "该时间点之后的场景", dataType = "String")})
- // public ResultData updateSceneJsonCode(HttpServletRequest request) throws Exception{
- // String createTime = request.getParameter("createTime");
- //
- // Condition condition = new Condition(SceneProEntity.class);
- // condition.and().andGreaterThanOrEqualTo("createTime", createTime);
- // List<SceneProEntity> list = sceneProService.findAll(condition);
- // Map<String, Object> map = new HashMap<>();
- // for (SceneProEntity sceneProEntity : list) {
- // map = new HashMap<>();
- // map.put("sceneName", sceneProEntity.getSceneName());
- // map.put("sceneDec", sceneProEntity.getSceneDec());
- // FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneProEntity.getNum() + "/scene.json", map);
- // }
- // return Result.success("修改了:" + list.size());
- // }
- //
- // /**
- // * 获取数据对接下载信息
- // */
- // @ApiOperation("获取数据对接下载信息")
- // @PostMapping(value = "/downLoadZSData")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public ResultData downLoadZSData(HttpServletRequest request) throws Exception{
- // String sceneNum = request.getParameter("sceneNum");
- // if(StringUtil.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // Result result = new Result();
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // result.setCode(SceneConstant.FAILURE_CODE_5005);
- // result.setMsg(SceneConstant.FAILURE_MSG_5005);
- // result.setData(null);
- // return result;
- // }
- //
- // SceneDataDownloadEntity sceneDataDownloadEntity = sceneDataDownloadService.findBySceneNum(sceneNum);
- // if(sceneDataDownloadEntity == null){
- // result.setCode(SceneConstant.FAILURE_CODE_5025);
- // result.setMsg(SceneConstant.FAILURE_MSG_5025);
- // result.setData(null);
- // return result;
- // }
- //
- // ResponseSceneDataDownload responseSceneDataDownload = new ResponseSceneDataDownload();
- // BeanUtils.copyProperties(sceneDataDownloadEntity, responseSceneDataDownload);
- //// responseSceneDataDownload.setDownloadPath(responseSceneDataDownload.getDownloadPath() +
- //// "?t=" + System.currentTimeMillis());
- // return Result.success(responseSceneDataDownload);
- // }
- //
- // /**
- // * 增加场景下载次数
- // */
- // @ApiOperation("增加场景下载次数")
- // @PostMapping(value = "/addDownloadNum")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public ResultData addDownloadNum(HttpServletRequest request) throws Exception{
- // String sceneNum = request.getParameter("sceneNum");
- // if(StringUtil.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- // if(sceneProEditEntity.getDownloadNum() == null){
- // sceneProEditEntity.setDownloadNum(1);
- // }else{
- // sceneProEditEntity.setDownloadNum(sceneProEditEntity.getDownloadNum() + 1);
- // }
- //
- // sceneProEditService.update(sceneProEditEntity);
- //
- // //操作记录log
- //// TmIncrementLogEntity tmIncrementLogEntity = new TmIncrementLogEntity();
- //// tmIncrementLogEntity.setSceneNum(sceneProEntity.getNum());
- //// tmIncrementLogEntity.setType("1");
- //// iIncrementDownloadLogService.save(tmIncrementLogEntity);
- //
- // return Result.success();
- // }
- //
- // /**
- // * 查询总下载次数
- // */
- // @ApiOperation("查询总下载次数")
- // @PostMapping(value = "/findDownloadNum")
- // public ResultData findDownloadNum(HttpServletRequest request) throws Exception{
- //
- // return Result.success(sceneProEditService.findDownloadNum());
- // }
- //
- // /**
- // * 增加imagesVersion
- // */
- // @ApiOperation("查询总下载次数")
- // @PostMapping(value = "/addImagesVersion")
- // public ResultData addImagesVersion(HttpServletRequest request) throws Exception{
- // String num = request.getParameter("num");
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(num);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // SceneProEditEntity sceneProEditEntity = sceneProEditService.findByProId(sceneProEntity.getId());
- // sceneProEditEntity.setImagesVersion(sceneProEditEntity.getImagesVersion() + 1);
- // sceneProEditService.update(sceneProEditEntity);
- //
- // JSONObject scenejson = JSON.parseObject(FileUtils.readFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json"));
- // scenejson.put("imagesVersion", sceneProEditEntity.getImagesVersion());
- // FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+num+File.separator+"scene.json", scenejson.toJSONString());
- //
- // return Result.success();
- // }
- //
- // /**
- // * 删除4k图
- // */
- // @ApiOperation("删除4k图")
- // @PostMapping(value = "/remove4KImg")
- // public ResultData remove4KImg() throws Exception{
- //
- // List<SceneProEntity> list = sceneProService.findAll();
- // CameraDetailEntity cameraDetailEntity = new CameraDetailEntity();
- // String path = "";
- //
- // for(SceneProEntity sceneProEntity : list){
- // if(sceneProEntity.getPayStatus() != 1 || sceneProEntity.getId() < 10685){
- // continue;
- // }
- // path = sceneProEntity.getDataSource();
- // log.info("场景:" + sceneProEntity.getNum());
- //
- // String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
- // JSONObject uploadJson = null;
- // JSONArray array = null;
- // if(uploadData!=null) {
- // uploadJson = JSONObject.parseObject(uploadData);
- // array = uploadJson.getJSONArray("upload");
- // }
- // if(array == null){
- // log.info("场景计算失败:" + sceneProEntity.getNum());
- // continue;
- // }
- // JSONObject fileJson = null;
- // String fileName = "";
- // Map<String, String> map = new HashMap<>();
- // for(int i = 0, len = array.size(); i < len; i++){
- // fileJson = array.getJSONObject(i);
- // fileName = fileJson.getString("file");
- // //文件不存在抛出异常
- // if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
- // throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
- // }
- //
- //
- // //tiles文件夹,亚马逊瓦片图
- // if(fileJson.getIntValue("clazz") == 7 ){
- // if(fileName.contains("/4k_")){
- // map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
- // sceneProEntity.getNum()+ File.separator + fileName);
- // }
- // }
- //
- // }
- //
- // Long space = 0L;
- // File spaceFile = null;
- // for (String key : map.keySet()) {
- // spaceFile = new File(key);
- // if(spaceFile.exists()){
- // space += spaceFile.length();
- // }
- // }
- // if(space > 0){
- // if(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())).compareTo(new BigInteger("0")) < 0){
- // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量小于0不处理");
- // continue;
- // }
- // log.info("场景:" + sceneProEntity.getNum() + ",减少:" + space + "B的容量");
- // sceneProEntity.setSpace(sceneProEntity.getSpace().subtract(new BigInteger(space.toString())) );
- // sceneProService.update(sceneProEntity);
- //
- // cameraDetailEntity = cameraDetailService.findByCameraId(sceneProEntity.getCameraId());
- // cameraDetailEntity.setUsedSpace(sceneProService.findTotalSpaceByCameraId(sceneProEntity.getCameraId()));
- // cameraDetailService.update(cameraDetailEntity);
- // }
- // }
- //
- //
- // return Result.success();
- // }
- //
- // /**
- // *
- // * 获取场景描述等信息
- // */
- // @ApiOperation("获取场景描述等信息")
- // @PostMapping(value = "/getSceneDetail")
- // @CheckCurrentUser(description = "获取场景描述等信息")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")})
- // public ResultData getSceneDetail(String sceneNum) throws Exception{
- // String token = getToken();
- // if(StringUtils.isEmpty(token)){
- // throw new BaseRuntimeException(3004, "无token参数");
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(3004, "token参数不正确");
- // }
- //
- // if(StringUtil.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // String snCode = null;
- // if(!ObjectUtils.isEmpty(sceneProEntity.getCameraId())){
- // CameraEntity cameraEntity = cameraService.findById(sceneProEntity.getCameraId());
- // if(ObjectUtils.isEmpty(cameraEntity)){
- // throw new BaseRuntimeException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029);
- // }
- // snCode = cameraEntity.getSnCode();
- // }
- // Map<String, Object> map = new HashMap<>();
- // map.put("webSite", sceneProEntity.getWebSite());
- // map.put("thumb", sceneProEntity.getThumb());
- // map.put("num", sceneProEntity.getNum());
- // map.put("sceneName", sceneProEntity.getSceneName());
- // map.put("sceneDec", sceneProEntity.getSceneDec());
- // map.put("snCode", snCode);
- // map.put("createDate", sceneProEntity.getCreateTime().getTime());
- // map.put("createTime", DateUtil.date2String(sceneProEntity.getCreateTime(), DateUtil.YYYY_MM_DD_DATE_FORMAT));
- //
- // return Result.success(map);
- // }
- //
- //
- // /**
- // *
- // * 随心装场景码同步
- // */
- // @ApiOperation("随心装场景码同步")
- // @PostMapping(value = "/synsencecode")
- // @CheckCurrentUser(description = "随心装场景码同步")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String"),
- // @ApiImplicitParam(name = "vrsceneNum", value = "随心装场景码", dataType = "String")})
- // public ResultData synsencecode(String sceneNum,String vrsceneNum) throws Exception{
- // String token = getToken();
- // if(StringUtils.isEmpty(token)){
- // throw new BaseRuntimeException(3004, "无token参数");
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(3004, "token参数不正确");
- // }
- //
- // if(StringUtil.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // if(StringUtil.isEmpty(vrsceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- //
- //
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- // //dsx 这里使用com.fdkankan.scene.service.impl.SceneProEditExtServiceImpl#findEdit
- // SceneProEditEntity editEntity = sceneProService.findEdit(sceneProEntity);
- //
- // if(editEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- // editEntity.setVrNum(vrsceneNum);
- // sceneProService.updateEdit(editEntity);
- //
- // return Result.success();
- // }
- //
- // /**
- // *
- // * 三维家 拉取场景数据,压缩zip包
- // */
- // @ApiOperation("三维家 拉取场景数据,压缩zip包")
- // @PostMapping(value = "/scenecpzip")
- // @CheckCurrentUser(description = "随心装场景码同步")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String")
- // })
- // public ResultData scenecpzip(String sceneNum) throws Exception{
- // String token = getToken();
- // if(StringUtils.isEmpty(token)){
- // throw new BaseRuntimeException(3004, "无token参数");
- // }
- //
- // SSOUser ssoUser = SSOLoginHelper.loginCheck(token);
- // if(ssoUser == null){
- // throw new BaseRuntimeException(3004, "token参数不正确");
- // }
- //
- // if(StringUtil.isEmpty(sceneNum)){
- // throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
- // }
- //
- //
- // SceneProEntity sceneProEntity = sceneProService.findBySceneNum(sceneNum);
- //
- //
- // if(sceneProEntity == null){
- // throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
- // }
- //
- //
- // return Result.success();
- // }
- }
|