SceneProServiceImpl.java 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. package com.fdkankan.manage.service.impl;
  2. import cn.dev33.satoken.stp.StpUtil;
  3. import cn.hutool.core.bean.BeanUtil;
  4. import cn.hutool.core.io.FileUtil;
  5. import cn.hutool.core.io.file.FileReader;
  6. import cn.hutool.core.util.NumberUtil;
  7. import cn.hutool.core.util.ObjectUtil;
  8. import cn.hutool.json.JSONUtil;
  9. import com.alibaba.fastjson.JSONArray;
  10. import com.alibaba.fastjson.JSONObject;
  11. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  12. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  13. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  14. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  15. import com.fdkankan.common.constant.SceneConstant;
  16. import com.fdkankan.fyun.face.FYunFileServiceInterface;
  17. import com.fdkankan.manage.common.*;
  18. import com.fdkankan.manage.exception.BusinessException;
  19. import com.fdkankan.common.util.*;
  20. import com.fdkankan.manage.httpClient.client.FdKKClient;
  21. import com.fdkankan.manage.httpClient.client.OverallClient;
  22. import com.fdkankan.manage.httpClient.service.LaserService;
  23. import com.fdkankan.manage.entity.*;
  24. import com.fdkankan.manage.httpClient.service.OverallService;
  25. import com.fdkankan.manage.httpClient.vo.OverallVo;
  26. import com.fdkankan.manage.mapper.ISceneProMapper;
  27. import com.fdkankan.manage.mq.common.MqQueueUtil;
  28. import com.fdkankan.manage.mq.param.ScenePayStatusVo;
  29. import com.fdkankan.manage.mq.param.SceneRestStoreVo;
  30. import com.fdkankan.manage.service.*;
  31. import com.fdkankan.manage.util.CameraUtils;
  32. import com.fdkankan.manage.util.DateUtils;
  33. import com.fdkankan.manage.util.SceneStatusUtil;
  34. import com.fdkankan.manage.vo.request.SceneParam;
  35. import com.fdkankan.manage.vo.response.*;
  36. import com.fdkankan.rabbitmq.util.RabbitMqProducer;
  37. import com.fdkankan.redis.util.RedisUtil;
  38. import lombok.extern.slf4j.Slf4j;
  39. import org.apache.commons.lang3.StringUtils;
  40. import org.springframework.beans.factory.annotation.Autowired;
  41. import org.springframework.stereotype.Service;
  42. import java.io.File;
  43. import java.util.*;
  44. import java.util.stream.Collectors;
  45. /**
  46. * <p>
  47. * pro场景表 服务实现类
  48. * </p>
  49. *
  50. * @author
  51. * @since 2022-06-16
  52. */
  53. @Service
  54. @Slf4j
  55. public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro> implements ISceneProService {
  56. @Autowired
  57. private ICameraService cameraService;
  58. @Autowired
  59. ICameraDetailService cameraDetailService;
  60. @Autowired
  61. ISceneService sceneService;
  62. @Autowired
  63. ISceneCopyLogService copyLogService;
  64. @Autowired
  65. IUserIncrementService userIncrementService;
  66. @Autowired
  67. IIncrementTypeService incrementTypeService;
  68. @Autowired
  69. ISceneProEditService sceneProEditService;
  70. @Autowired
  71. FYunFileServiceInterface fYunFileServiceInterface;
  72. @Autowired
  73. IScenePlusService scenePlusService;
  74. @Autowired
  75. IScene3dNumService scene3dNumService;
  76. @Autowired
  77. ISceneCopyLogService sceneCopyLogService;
  78. @Autowired
  79. IScenePlusExtService scenePlusExtService;
  80. @Autowired
  81. LaserService laserService;
  82. @Autowired
  83. FdKKClient fdKKClient;
  84. @Autowired
  85. IFolderSceneService folderSceneService;
  86. @Autowired
  87. ISceneBuildProcessLogService sceneBuildProcessLogService;
  88. @Autowired
  89. ISceneMoveLogService sceneMoveLogService;
  90. @Autowired
  91. ISceneResourceCameraService sceneResourceCameraService;
  92. @Autowired
  93. ISceneDelLogService sceneDelLogService;
  94. @Autowired
  95. RabbitMqProducer rabbitMqProducer;
  96. @Autowired
  97. RedisUtil redisUtil;
  98. @Autowired
  99. ISceneColdStorageService sceneColdStorageService;
  100. @Autowired
  101. ICommonService commonService;
  102. @Autowired
  103. IUserService userService;
  104. @Autowired
  105. IMqSendLogService mqSendLogService;
  106. @Autowired
  107. OverallService overallService;
  108. @Autowired
  109. private ISceneProService sceneProService;
  110. @Override
  111. public ScenePro getByNum(String num) {
  112. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  113. wrapper.eq(ScenePro::getNum,num);
  114. wrapper.eq(ScenePro::getIsUpgrade,0);
  115. List<ScenePro> list = this.list(wrapper);
  116. if(list == null || list.size() <=0){
  117. return null;
  118. }
  119. return list.get(0);
  120. }
  121. @Override
  122. public HashMap<Long, Long> getCountGroupByUserId(List<Long> userIdList,Integer isObj) {
  123. HashMap<Long,Long> map = new HashMap<>();
  124. List<GroupByCount> result = this.getBaseMapper().getCountGroupByUserId(userIdList,isObj);
  125. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  126. return map;
  127. }
  128. @Override
  129. public HashMap<Long, Long> getCountGroupByCameraId(List<Long> cameraIds) {
  130. HashMap<Long,Long> map = new HashMap<>();
  131. List<GroupByCount> result = this.getBaseMapper().getCountGroupByCameraId(cameraIds);
  132. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  133. return map;
  134. }
  135. @Override
  136. public void unbindCamera(Long cameraId) {
  137. LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
  138. wrapper.set(ScenePro::getUserId,null)
  139. .eq(ScenePro::getCameraId,cameraId);
  140. wrapper.eq(ScenePro::getIsUpgrade,0);
  141. this.update(wrapper);
  142. }
  143. @Override
  144. public List<ScenePro> getListByCameraId(Long cameraId) {
  145. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  146. wrapper.eq(ScenePro::getCameraId,cameraId);
  147. wrapper.eq(ScenePro::getIsUpgrade,0);
  148. return this.list(wrapper);
  149. }
  150. /**
  151. * @param payStatus -2 封存,为 1 解封
  152. */
  153. @Override
  154. public void lockOrUnLockBySpace(CameraDetail cameraDetail) {
  155. if(cameraDetail == null ){
  156. return;
  157. }
  158. if(!"aws".equals(CacheUtil.uploadType) && ( cameraDetail.getType() ==10 || cameraDetail.getType() == 11)){
  159. return;
  160. }
  161. ScenePayStatusVo scenePayStatusVo = new ScenePayStatusVo(cameraDetail.getCameraId());
  162. Map<String, Object> map = BeanUtil.beanToMap(scenePayStatusVo);
  163. rabbitMqProducer.sendByWorkQueue(MqQueueUtil.ucenterScenePayStatusQueue, map);
  164. }
  165. @Override
  166. public void lockOrUnLockBySpace(Long cameraId) {
  167. CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
  168. this.lockOrUnLockBySpace(cameraDetail);
  169. }
  170. /**
  171. * 从oss中获取文件,并重写,上传替换
  172. */
  173. private void updateOssStatus(String path,Integer payStatus,String updateStatus) {
  174. String localPath = String.format(OssPath.localStatusPath, path);
  175. try {
  176. if(!fYunFileServiceInterface.fileExist(path)){
  177. return;
  178. }
  179. String data = fYunFileServiceInterface.getFileContent(path);
  180. if(StringUtils.isBlank(data)){
  181. return;
  182. }
  183. JSONObject jsonObject = JSONObject.parseObject(data);
  184. jsonObject.put(updateStatus,payStatus);
  185. String json = JSONUtil.toJsonStr(jsonObject);
  186. FileUtils.writeFile(localPath,json);
  187. log.info("updateOssStatus--localPath:{},ossPath:{}",localPath,path);
  188. fYunFileServiceInterface.uploadFile(localPath,path);
  189. }catch (Exception e){
  190. e.printStackTrace();
  191. }finally {
  192. FileUtil.del(localPath);
  193. }
  194. }
  195. @Override
  196. public PageInfo pageList(SceneParam param) {
  197. if(param.getType() == 3){ //双目lite
  198. return sceneService.pageList(param);
  199. }
  200. //优化查询,去掉left join
  201. //snCode 查询,userName 查询,companyId查询
  202. //snCode回显,userName回显
  203. if(StringUtils.isNotBlank(param.getSnCode())){
  204. List<Camera> cameraList = cameraService.getLikeBySnCode(param.getSnCode());
  205. List<Long> cameraIds = cameraList.stream().map(Camera::getId).collect(Collectors.toList());
  206. param.setCameraIds(cameraIds);
  207. }
  208. if(StringUtils.isNotBlank(param.getUserName())){
  209. List<User> userList = userService.getLikeByUserName(param.getUserName());
  210. List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
  211. param.setUserIds(userIds);
  212. }
  213. if(param.getCompanyId() != null){
  214. List<CameraDetail> details = cameraDetailService.getListByCompanyId(param.getCompanyId());
  215. List<Long> cameraIds = details.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
  216. if(param.getCameraIds() == null || param.getCameraIds().isEmpty()){
  217. param.setCameraIds(cameraIds);
  218. }else {
  219. List<Long> intersection = cameraIds.stream().filter(param.getCameraIds()::contains).collect(Collectors.toList());
  220. param.setCameraIds(intersection);
  221. }
  222. }
  223. if((param.getCameraIds() != null && param.getCameraIds().size()<=0) || (param.getUserIds() != null && param.getUserIds().size()<=0)){
  224. param.setNum("empty");
  225. }
  226. Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
  227. List<SceneVo> records = page.getRecords();
  228. HashMap<String,SceneCopyLog> map = null;
  229. HashMap<String,SceneColdStorage> coldStorageMap = null;
  230. HashMap<Long, User> userMap = null;
  231. HashMap<Long, Camera> cameraMap = null;
  232. HashMap<String,JSONObject> ssSceneMap = null;
  233. HashMap<String,MqSendLog> mqSendLogMap = null;
  234. List<String> sceneNumList = page.getRecords().stream().map(SceneVo::getNum).collect(Collectors.toList());
  235. if(!records.isEmpty()){
  236. map = copyLogService.getByNewNumList(sceneNumList);
  237. coldStorageMap = sceneColdStorageService.getByNumList(sceneNumList);
  238. List<Long> userIds = records.parallelStream().map(SceneVo::getUserId).collect(Collectors.toList());
  239. userMap = userService.getByIds(userIds);
  240. List<Long> cameraIds = records.parallelStream().map(SceneVo::getCameraId).collect(Collectors.toList());
  241. cameraMap = cameraService.getByIds(cameraIds);
  242. if(param.getType() == 2 ){
  243. ssSceneMap = laserService.list(sceneNumList,4);
  244. }
  245. if(param.getType() == 6){
  246. ssSceneMap = laserService.list(sceneNumList,5);
  247. }
  248. List<String> modelingNumList = page.getRecords().stream().filter(e -> e.getStatus() == 0).map(SceneVo::getNum).collect(Collectors.toList());
  249. if(!modelingNumList.isEmpty()){
  250. mqSendLogMap = mqSendLogService.getByNumList(modelingNumList);
  251. }
  252. }
  253. for (SceneVo record : page.getRecords()) {
  254. if(param.getType() == 2 || param.getType() == 6){
  255. JSONObject ssObj = ssSceneMap.get(record.getNum());
  256. if(ssObj!=null){
  257. record.setSceneName(ssObj.getString("title"));
  258. record.setThumb(ssObj.getString("thumb"));
  259. record.setWebSite(ssObj.getString("webSite"));
  260. record.setIsObj(ssObj.getInteger("buildObjStatus"));
  261. record.setViewCount(ssObj.getInteger("viewCount"));
  262. record.setStatus(toFdStatus(ssObj.getInteger("status")));
  263. record.setAlgorithmTime(ssObj.getString("algorithmTime"));
  264. }else{
  265. record.setStatus(-1);
  266. record.setWebSite(null);
  267. }
  268. }
  269. record.setStatusString(SceneStatusUtil.getStatusString(record));
  270. if(userMap != null){
  271. User user = userMap.get(record.getUserId());
  272. if(user != null){
  273. record.setUserName(user.getUserName());
  274. }
  275. }
  276. if(cameraMap != null){
  277. Camera camera = cameraMap.get(record.getCameraId());
  278. if(camera != null){
  279. record.setSnCode(camera.getSnCode());
  280. }
  281. }
  282. if(map !=null ){
  283. SceneCopyLog sceneCopyLog = map.get(record.getNum());
  284. if(sceneCopyLog != null){
  285. record.setCopyTime(sceneCopyLog.getCreateTime());
  286. record.setIsCopy(true);
  287. }
  288. }
  289. if(coldStorageMap != null){
  290. SceneColdStorage sceneColdStorage = coldStorageMap.get(record.getNum());
  291. if(sceneColdStorage != null){
  292. record.setIsColdStorage(true);
  293. }
  294. }
  295. if(record.getStatus() == -1){ //计算失败
  296. SceneBuildProcessLog sceneBuildProcessLog = sceneBuildProcessLogService.getByNum(record.getNum());
  297. String process = null;
  298. if(sceneBuildProcessLog !=null){
  299. process = sceneBuildProcessLog.getProcess();
  300. }
  301. record.setBuildErrorReason(SceneBuildProcessLogEnum.getReason(process));
  302. }
  303. //{"latitude":22.3672085,"longitude":113.595673,"altitude":9.275519,"horizontalAccuracy":65.0,"verticalAccuracy":10.0,"timestamp":1564381147.2775609}
  304. record.setAddressComponent(commonService.getAddressComponent(record.getGps()));
  305. if(mqSendLogMap!=null){
  306. MqSendLog mqSendLog = mqSendLogMap.get(record.getNum());
  307. if(mqSendLog != null){
  308. record.setStatusString("排队中");
  309. record.setStatus(-4);
  310. }
  311. }
  312. }
  313. return PageInfo.PageInfo(page);
  314. }
  315. private Integer toFdStatus(Integer status) {
  316. //深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
  317. switch (status) {
  318. case 0:
  319. case 4:
  320. return 0;
  321. case 2:
  322. return -2;
  323. case 3:
  324. return -3;
  325. default:
  326. return -1;
  327. }
  328. }
  329. @Override
  330. public synchronized Integer move(SceneParam param) {
  331. Camera camera = cameraService.getBySnCode(param.getSnCode());
  332. if(camera == null){
  333. throw new BusinessException(ResultCode.CAMERA_SN_NOT_EXIST);
  334. }
  335. CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
  336. if(cameraDetail == null){
  337. throw new BusinessException(ResultCode.CAMERA_SN_NOT_EXIST);
  338. }
  339. if(StringUtils.isNotBlank(param.getNum())){
  340. moveScene(param.getNum(),camera,cameraDetail);
  341. return 1;
  342. }
  343. Integer successNum = param.getNumList().size();
  344. for (String num : param.getNumList()) {
  345. try {
  346. moveScene(num,camera,cameraDetail);
  347. }catch (Exception e){
  348. successNum --;
  349. log.info("move-scene-error:num:{},errorNum:{},error:{}",num,successNum,e.getMessage());
  350. }
  351. }
  352. return successNum;
  353. }
  354. private void moveScene(String num,Camera camera,CameraDetail cameraDetail){
  355. ScenePro scenePro = this.getByNum(num);
  356. ScenePlus scenePlus = scenePlusService.getByNum(num);
  357. if((scenePro == null || scenePro.getCameraId() == null ) && (scenePlus== null || scenePlus.getCameraId() == null)){
  358. throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  359. }
  360. Integer status = scenePro == null ? scenePlus.getSceneStatus() : scenePro.getStatus();
  361. if(status != -2){
  362. throw new BusinessException(SceneConstant.FAILURE_CODE_5037, SceneConstant.FAILURE_MSG_5037);
  363. }
  364. Long sceneCameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
  365. Long space = scenePro == null ? 0 :scenePro.getSpace();
  366. String dataSource = scenePro == null ? null :scenePro.getDataSource();
  367. if(scenePlus !=null){
  368. ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
  369. space = scenePlusExt.getSpace();
  370. dataSource = scenePlusExt.getDataSource();
  371. }
  372. space = space == null ? 0 :space;
  373. Boolean checkSpace = cameraDetailService.checkSpace(cameraDetail, space);
  374. //深时场景无限容量
  375. if( !checkSpace){
  376. throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
  377. }
  378. Camera oldCamera = cameraService.getById(sceneCameraId);
  379. if(oldCamera == null){
  380. throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
  381. }
  382. CameraDetail oldCameraDetail = cameraDetailService.getByCameraId(oldCamera.getId());
  383. if(oldCameraDetail == null){
  384. throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
  385. }
  386. if(oldCameraDetail.getCameraId().equals(cameraDetail.getCameraId())){
  387. throw new BusinessException(ResultCode.CAMERA_NOT_MOVE);
  388. }
  389. if(!oldCameraDetail.getType().equals(cameraDetail.getType())){
  390. throw new BusinessException(ResultCode.CAMERA_TYPE_NOT_ERROR);
  391. }
  392. Long oldUseSpace = oldCameraDetail.getUsedSpace() - space < 0 ? 0 : oldCameraDetail.getUsedSpace() - space;
  393. if("GB".equals(oldCameraDetail.getUnit())){
  394. oldUseSpace = 1L;
  395. }
  396. Long subSpace = oldCameraDetail.getTotalSpace() - oldUseSpace;
  397. if(scenePro!=null){
  398. LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
  399. wrapper.eq(ScenePro::getId,scenePro.getId());
  400. wrapper.set(ScenePro::getCameraId,camera.getId());
  401. wrapper.set(ScenePro::getUserId,cameraDetail.getUserId());
  402. // wrapper.set(ScenePro::getStatus,0);
  403. // this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),0,"status");
  404. this.update(wrapper);
  405. //场景迁移到另外的相机清除本身在的文件夹
  406. folderSceneService.delBySceneId(scenePro.getId());
  407. }
  408. if(scenePlus!=null){
  409. LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
  410. wrapper.eq(ScenePlus::getId,scenePlus.getId());
  411. wrapper.set(ScenePlus::getCameraId,camera.getId());
  412. wrapper.set(ScenePlus::getUserId,cameraDetail.getUserId());
  413. //wrapper.set(ScenePlus::getSceneStatus,0);
  414. //this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),0,"status");
  415. scenePlusService.update(wrapper);
  416. folderSceneService.delBySceneId(scenePlus.getId());
  417. }
  418. //协作相机
  419. sceneResourceCameraService.setCooperationUser(cameraDetail,num);
  420. //String newDataSource = updateFdageNewDataSource(scenePro, scenePlus, oldCamera.getSnCode(), param.getSnCode(), dataSource);
  421. if(cameraDetail.getType() == 10 || cameraDetail.getType() == 11){ //深时场景
  422. //迁移深时 dataSource
  423. //FileUtil.move(new File(dataSource +"_laserData"),new File(newDataSource+"_laserData"),true);
  424. laserService.move(num,oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId(),dataSource);
  425. }
  426. cameraDetailService.updateUseSpace(oldCameraDetail.getCameraId(),oldCameraDetail.getUnit().equals("SP")?-1L: -space);
  427. cameraDetailService.updateUseSpace(cameraDetail.getCameraId(),cameraDetail.getUnit().equals("SP")?+1L: +space);
  428. if(!"aws".equals(CacheUtil.uploadType) && oldCameraDetail.getType() != 11 && oldCameraDetail.getType() != 10 && subSpace >0){ //有剩余容量解封容量内场景
  429. this.lockOrUnLockBySpace(oldCameraDetail.getCameraId());
  430. }
  431. if(!"aws".equals(CacheUtil.uploadType) && cameraDetail.getType() != 11 && cameraDetail.getType() != 10){ //有剩余容量解封容量内场景
  432. this.lockOrUnLockBySpace(cameraDetail.getCameraId());
  433. }
  434. if("aws".equals(CacheUtil.uploadType) && subSpace >0){ //有剩余容量解封容量内场景
  435. this.lockOrUnLockBySpace(oldCameraDetail.getCameraId());
  436. }
  437. if("aws".equals(CacheUtil.uploadType)){ //有剩余容量解封容量内场景
  438. this.lockOrUnLockBySpace(cameraDetail.getCameraId());
  439. }
  440. sceneMoveLogService.saveLog(scenePro,scenePlus,camera.getSnCode(),oldCamera.getSnCode(),dataSource,dataSource, null);
  441. laserService.moveWenBao(num,oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId(),dataSource);
  442. }
  443. private JSONObject updateFdageJson(JSONObject jsonObject,String newSnCode){
  444. JSONObject cam = jsonObject.getJSONObject("cam");
  445. if(cam != null){
  446. cam.put("uuid",newSnCode.toLowerCase()); //替换相机sn uuid
  447. }
  448. JSONArray points = jsonObject.getJSONArray("points"); //修改点位中的相机sn
  449. if(points !=null){
  450. for (Object point : points) {
  451. JSONObject jobj = (JSONObject) point;
  452. jobj.put("camera",newSnCode.toLowerCase());
  453. }
  454. }
  455. jsonObject.put("creator",newSnCode.toLowerCase()); //替换相机拍摄sn
  456. return jsonObject;
  457. }
  458. /**
  459. * 兼容,之前迁移,不使用旧snCode 替换新snCode。重写文件
  460. */
  461. public String updateFdageNewDataSource(ScenePro scenePro,ScenePlus scenePlus,String oldSnCode,String newSnCode,String dataSource) {
  462. String localPathFdage = null;
  463. try {
  464. newSnCode = newSnCode.toLowerCase();
  465. String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
  466. if(!fYunFileServiceInterface.fileExist(fdagePaht)){
  467. return dataSource;
  468. }
  469. localPathFdage = String.format(OssPath.localFdagePath,fdagePaht);
  470. String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
  471. JSONObject jsonObject = updateFdageJson(JSONObject.parseObject(fileContent), newSnCode);
  472. FileUtils.writeFile(localPathFdage ,JSONObject.toJSONString(jsonObject));
  473. String oldFdagePaht = dataSource.replace("/mnt/data","home") ;
  474. String[] split = oldFdagePaht.split("/");
  475. String newFdagePath = split[0] +"/"+ newSnCode +"/"+ split[2] +"/"+ newSnCode +"_" + split[3].split("_")[1];
  476. String delPath = null;
  477. if(!oldFdagePaht.equals(newFdagePath)){
  478. log.info("updateFdageCopy--复制oss资源--oldFdagePaht:{},newFdagePath:{}",oldFdagePaht,newFdagePath);
  479. fYunFileServiceInterface.copyFileInBucket(oldFdagePaht,newFdagePath);
  480. delPath = oldFdagePaht;
  481. }
  482. fYunFileServiceInterface.uploadFile(localPathFdage,newFdagePath+"/data.fdage");
  483. log.info("updateFdage--localPathFdage:{},newFdagePath:{}",localPathFdage,newFdagePath);
  484. String newDataSource = newFdagePath.replace("home","/mnt/data");
  485. this.updateDataSource(scenePro,scenePlus,newDataSource);
  486. if(delPath != null){
  487. fYunFileServiceInterface.deleteFolder(oldFdagePaht);
  488. }
  489. sceneMoveLogService.saveLog(scenePro,scenePlus,oldSnCode,newSnCode,dataSource,newDataSource, fileContent);
  490. return newDataSource;
  491. }catch (Exception e){
  492. log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
  493. log.error("updateFdage-error:",e);
  494. throw new BusinessException(ResultCode.MOVE_SCENE_ERROR);
  495. }finally {
  496. if(localPathFdage != null){
  497. FileUtil.del(localPathFdage);
  498. }
  499. if(scenePro!=null){
  500. LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
  501. wrapper.eq(ScenePro::getId,scenePro.getId());
  502. wrapper.set(ScenePro::getStatus,-2);
  503. this.update(wrapper);
  504. this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),-2,"status");
  505. }
  506. if(scenePlus!=null){
  507. LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
  508. wrapper.eq(ScenePlus::getId,scenePlus.getId());
  509. wrapper.set(ScenePlus::getSceneStatus,-2);
  510. scenePlusService.update(wrapper);
  511. this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),-2,"status");
  512. }
  513. }
  514. }
  515. private void updateDataSource(ScenePro scenePro,ScenePlus scenePlus, String newDataSource) {
  516. if(scenePro !=null){
  517. LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
  518. wrapper.eq(ScenePro::getId,scenePro.getId());
  519. wrapper.eq(ScenePro::getIsUpgrade,0);
  520. wrapper.set(ScenePro::getDataSource,newDataSource);
  521. this.update(wrapper);
  522. }
  523. if(scenePlus !=null){
  524. LambdaUpdateWrapper<ScenePlusExt> wrapperPlus = new LambdaUpdateWrapper<>();
  525. wrapperPlus.eq(ScenePlusExt::getPlusId,scenePlus.getId());
  526. wrapperPlus.set(ScenePlusExt::getDataSource,newDataSource);
  527. scenePlusExtService.update(wrapperPlus);
  528. }
  529. }
  530. @Override
  531. public void copy(String sceneNum) {
  532. ScenePro scenePro = this.getByNum(sceneNum);
  533. ScenePlus scenePlus = scenePlusService.getByNum(sceneNum);
  534. if((scenePro == null ) && (scenePlus== null )){
  535. throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  536. }
  537. Integer sceneStatus = scenePro == null ? scenePlus.getSceneStatus() : scenePro.getStatus();
  538. if(sceneStatus != -2){
  539. throw new BusinessException(ResultCode.SCENE_IS_BUILDING);
  540. }
  541. HashMap<String, Object> param = new HashMap<>();
  542. param.put("num",sceneNum);
  543. JSONObject jsonObject = fdKKClient.copyScene(param, "m_a_n_a_g_e");
  544. Integer code = jsonObject.getInteger("code");
  545. if(code != 0){
  546. throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
  547. }
  548. }
  549. @Override
  550. public void deleteByNum(String num) {
  551. Integer sceneSource = null;
  552. Long cameraId = null;
  553. ScenePro scenePro = this.getByNum(num);
  554. Scene scene = sceneService.getByNum(num);
  555. ScenePlus scenePlus = scenePlusService.getByNum(num);
  556. Integer status = null;
  557. if(scenePro!=null){
  558. cameraId = scenePro.getCameraId();
  559. sceneSource = scenePro.getSceneSource();
  560. status = scenePro.getStatus();
  561. }
  562. if(scene!=null){
  563. cameraId = scene.getCameraId();
  564. status = scene.getStatus();
  565. }
  566. if(scenePlus!=null){
  567. cameraId = scenePlus.getCameraId();
  568. sceneSource = scenePlus.getSceneSource();
  569. status = scenePlus.getSceneStatus();
  570. }
  571. HashMap<String, MqSendLog> mqSendLogHashMap = mqSendLogService.getByNumList(Arrays.asList(num));
  572. String redisKey = "mq-wait:queue:num:"+num;
  573. if(!mqSendLogHashMap.isEmpty()){
  574. for (String key : mqSendLogHashMap.keySet()) {
  575. if(!redisUtil.hasKey(redisKey)){
  576. mqSendLogService.removeById(mqSendLogHashMap.get(key).getId());
  577. status = -1;
  578. }
  579. }
  580. }
  581. if(status != null && status == 0){
  582. throw new BusinessException(ResultCode.CAN_NOT_DEL_MODELING_SCENE);
  583. }
  584. if(scenePro!=null){
  585. this.removeById(scenePro.getId());
  586. }
  587. if(scene!=null){
  588. sceneService.removeById(scene.getId());
  589. }
  590. if(scenePlus!=null){
  591. ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
  592. if(plusExt != null){
  593. scenePlusExtService.delByPlus(scenePlus.getId());
  594. }
  595. scenePlusService.removeById(scenePlus.getId());
  596. }
  597. if(sceneSource != null && (sceneSource == 4 || sceneSource == 5)){
  598. laserService.delete(num);
  599. }
  600. overallService.delete(num);
  601. if(cameraId != null){
  602. cameraDetailService.initSpace(cameraId);
  603. this.lockOrUnLockBySpace(cameraId);
  604. }
  605. sceneDelLogService.saveLog(num, StpUtil.getLoginId());
  606. }
  607. @Override
  608. public Long getKkCount(List<String> asList, String startTime) {
  609. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  610. wrapper.in(ScenePro::getSceneSource,asList);
  611. wrapper.eq(ScenePro::getIsUpgrade,0);
  612. wrapper.lt(ScenePro::getCreateTime,startTime);
  613. long count = this.count(wrapper);
  614. LambdaQueryWrapper<ScenePlus> wrapper2 = new LambdaQueryWrapper<>();
  615. wrapper2.in(ScenePlus::getSceneSource,asList);
  616. wrapper2.lt(ScenePlus::getCreateTime,startTime);
  617. long count1 = scenePlusService.count(wrapper2);
  618. return count + count1;
  619. }
  620. @Override
  621. public Long getSsCount(List<String> asList, String startTime) {
  622. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  623. wrapper.in(ScenePro::getSceneSource,asList);
  624. wrapper.eq(ScenePro::getIsUpgrade,0);
  625. wrapper.lt(ScenePro::getCreateTime,startTime);
  626. LambdaQueryWrapper<ScenePlus> wrapper2 = new LambdaQueryWrapper<>();
  627. wrapper2.in(ScenePlus::getSceneSource,asList);
  628. wrapper2.lt(ScenePlus::getCreateTime,startTime);
  629. long count = scenePlusService.count(wrapper2);
  630. return this.count(wrapper) + count;
  631. }
  632. @Override
  633. public Long getSsObjCount(List<String> asList, String startTime) {
  634. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  635. wrapper.in(ScenePro::getSceneSource,asList);
  636. wrapper.eq(ScenePro::getIsUpgrade,0);
  637. if(StringUtils.isNotBlank(startTime)){
  638. wrapper.lt(ScenePro::getCreateTime,startTime);
  639. }
  640. wrapper.eq(ScenePro::getIsObj,1);
  641. LambdaQueryWrapper<ScenePlus> wrapper2 = new LambdaQueryWrapper<>();
  642. wrapper2.in(ScenePlus::getSceneSource,asList);
  643. if(StringUtils.isNotBlank(startTime)){
  644. wrapper2.lt(ScenePlus::getCreateTime,startTime);
  645. }
  646. List<ScenePlus> list = scenePlusService.list(wrapper2);
  647. List<Long> plusIds = list.stream().map(ScenePlus::getId).collect(Collectors.toList());
  648. long count = 0L;
  649. if(plusIds.size() >0){
  650. LambdaQueryWrapper<ScenePlusExt> wrapper3 = new LambdaQueryWrapper<>();
  651. wrapper3.in(ScenePlusExt::getPlusId,plusIds);
  652. wrapper3.eq(ScenePlusExt::getIsObj,1);
  653. count = scenePlusExtService.count(wrapper3);
  654. }
  655. return this.count(wrapper) + count;
  656. }
  657. @Override
  658. public HashMap<String, String> getSnCodeByNumList(Set<String> numList) {
  659. HashMap<String, Long> sceneMap = new HashMap<>();
  660. HashMap<Long, String> cameraMap = new HashMap<>();
  661. HashMap<String, String> snCodeMap = new HashMap<>();
  662. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  663. wrapper.eq(ScenePro::getIsUpgrade,0);
  664. wrapper.in(ScenePro::getNum,numList);
  665. List<ScenePro> list = this.list(wrapper);
  666. if(list.size() >0){
  667. list.forEach(entity -> sceneMap.put(entity.getNum(),entity.getCameraId()));
  668. }
  669. LambdaQueryWrapper<ScenePlus> wrapper2 = new LambdaQueryWrapper<>();
  670. wrapper2.in(ScenePlus::getNum,numList);
  671. List<ScenePlus> list2 = scenePlusService.list(wrapper2);
  672. if(list2.size() >0){
  673. list2.forEach(entity -> sceneMap.put(entity.getNum(),entity.getCameraId()));
  674. }
  675. if(sceneMap.size() <=0){
  676. return snCodeMap;
  677. }
  678. Set<Long> cameraIds = list.stream().map(ScenePro::getCameraId).collect(Collectors.toSet());
  679. Set<Long> cameraIds2 = list2.stream().map(ScenePlus::getCameraId).collect(Collectors.toSet());
  680. cameraIds.addAll(cameraIds2);
  681. if(cameraIds.size() >0){
  682. List<Camera> cameraList = cameraService.listByIds(cameraIds);
  683. cameraList.forEach(entity -> cameraMap.put(entity.getId(),entity.getSnCode()));
  684. for (String num : numList) {
  685. Long cameraId = sceneMap.get(num);
  686. if(cameraId != null){
  687. snCodeMap.put(num,cameraMap.get(cameraId));
  688. }
  689. }
  690. List<CameraDetail> cameraIds1 = cameraDetailService.getByCameraIds(cameraList.stream().map(Camera::getId).collect(Collectors.toList()));
  691. for (CameraDetail cameraDetail : cameraIds1) {
  692. snCodeMap.put(cameraMap.get(cameraDetail.getCameraId()), CameraUtils.getCameraTypeStr(cameraDetail.getType()));
  693. }
  694. }
  695. return snCodeMap;
  696. }
  697. @Override
  698. public HashMap<Long,Long > getSpaceGroupByCameraId() {
  699. List<GroupByCount> proSum = this.getBaseMapper().getProSpaceGroupByCameraId();
  700. HashMap<Long,Long > map = new HashMap<>();
  701. for (GroupByCount groupByCount : proSum) {
  702. map.merge(groupByCount.getId(), groupByCount.getCount()==null?0:groupByCount.getCount(), Long::sum);
  703. }
  704. List<GroupByCount > plusSum = this.getBaseMapper().getPlusSpaceGroupByCameraId();
  705. for (GroupByCount groupByCount : plusSum) {
  706. map.merge(groupByCount.getId(), groupByCount.getCount()==null?0:groupByCount.getCount(), Long::sum);
  707. }
  708. return map;
  709. }
  710. @Override
  711. public void rebuildScene(String num,String from) {
  712. String redisKey2 = String.format(RedisKeyUtil.numShootKey, num);
  713. redisUtil.del(redisKey2);
  714. String dataSource = null;
  715. ScenePro scenePro = this.getByNum(num);
  716. if(scenePro!=null && scenePro.getSceneSource() != 4){
  717. throw new BusinessException(ResultCode.V3_SCENE_REBUILD);
  718. }
  719. ScenePlus scenePlus = scenePlusService.getByNum(num);
  720. if(scenePlus == null && scenePro == null){
  721. throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
  722. }
  723. if(scenePro != null){
  724. dataSource = scenePro.getDataSource();
  725. }
  726. if(scenePlus != null){
  727. ScenePlusExt scenePlusExt= scenePlusExtService.getByPlusId(scenePlus.getId());
  728. if(scenePlusExt!= null){
  729. dataSource = scenePlusExt.getDataSource();
  730. }
  731. }
  732. if(StringUtils.isBlank(dataSource)){
  733. throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR);
  734. }
  735. Long countByNewNum = sceneCopyLogService.getCountByNewNum(num);
  736. if(countByNewNum >0){
  737. throw new BusinessException(ResultCode.COPY_NUM_NOTREBUILD);
  738. }
  739. SceneColdStorage coldStorage = sceneColdStorageService.getByNum(num);
  740. if(coldStorage != null){
  741. throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR2);
  742. }
  743. if(!fYunFileServiceInterface.fileExist(dataSource.replace("/mnt/data","home")+"/data.fdage")){
  744. throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR);
  745. }
  746. HashMap<String,Object> paramMap = new HashMap<>();
  747. paramMap.put("num",num);
  748. paramMap.put("from",from == null ? "manage":from);
  749. try {
  750. JSONObject jsonObject = fdKKClient.rebuildScene(paramMap);
  751. Integer code = jsonObject.getInteger("code");
  752. if(code != 0){
  753. log.error("场景重算失败:{},{}",num,jsonObject);
  754. throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR.code(), jsonObject.getString("msg"));
  755. }
  756. }catch (Exception e){
  757. throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR);
  758. }
  759. }
  760. @Override
  761. public void restStore(String num) {
  762. if(StringUtils.isBlank(num)){
  763. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  764. }
  765. String redisKey = String.format(RedisKeyUtil.restStoreKey, num);
  766. if(redisUtil.hasKey(redisKey)){
  767. throw new BusinessException(ResultCode.SCENE_STORE_ING);
  768. }
  769. SceneColdStorage sceneColdStorage = sceneColdStorageService.getByNum(num);
  770. if(sceneColdStorage == null){
  771. throw new BusinessException(ResultCode.SCENE_NOT_STORE);
  772. }
  773. String dataSource = scenePlusService.getDataSourceByNum(num);
  774. if(StringUtils.isBlank(dataSource)){
  775. throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
  776. }
  777. String homePath = dataSource.replace("/mnt/data","home");
  778. SceneRestStoreVo sceneRestStoreVo = new SceneRestStoreVo(num,sceneColdStorage.getColdBucket(),sceneColdStorage.getBucket(),homePath);
  779. Map<String, Object> map = BeanUtil.beanToMap(sceneRestStoreVo);
  780. redisUtil.set(redisKey,homePath);
  781. rabbitMqProducer.sendByWorkQueue(MqQueueUtil.sceneRestoreQueue,map);
  782. //threadService.checkRestore(num,sceneColdStorage.getColdBucket(),sceneColdStorage.getBucket(),homePath);
  783. }
  784. @Override
  785. public void restStoreSuccess(String num) {
  786. Integer sceneResource = null;
  787. ScenePro scenePro = this.getByNum(num);
  788. Date time = DateUtils.dateAddOneMonth(new Date(),-11);
  789. String date = DateUtils.getDate(time);
  790. if(scenePro!=null ){
  791. sceneResource = scenePro.getSceneSource();
  792. LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
  793. wrapper.eq(ScenePro::getId,scenePro.getId());
  794. wrapper.set(ScenePro::getCreateTime,date);
  795. this.update(wrapper);
  796. }
  797. ScenePlus scenePlus = scenePlusService.getByNum(num);
  798. if(scenePlus != null ){
  799. sceneResource = scenePlus.getSceneSource();
  800. ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
  801. if(scenePlusExt != null){
  802. LambdaUpdateWrapper<ScenePlusExt> wrapper = new LambdaUpdateWrapper<>();
  803. wrapper.eq(ScenePlusExt::getId,scenePlusExt.getId());
  804. wrapper.set(ScenePlusExt::getAlgorithmTime,date);
  805. scenePlusExtService.update(wrapper);
  806. }
  807. }
  808. //深时场景通知修改计算完成时间
  809. if(sceneResource != null && (sceneResource == 4 || sceneResource == 5)){
  810. HashMap<String,String> map = new HashMap<>();
  811. map.put("sceneCode",num);
  812. map.put("algorithmTime",date);
  813. rabbitMqProducer.sendByWorkQueue(MqQueueUtil.laserUnfreezeScene,map);
  814. }
  815. }
  816. @Override
  817. public Object getRestStoreProcess(String num) {
  818. if(StringUtils.isBlank(num)){
  819. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  820. }
  821. SceneColdStorage sceneColdStorage = sceneColdStorageService.getByNum(num);
  822. if(sceneColdStorage == null){
  823. throw new BusinessException(ResultCode.SCENE_NOT_STORE);
  824. }
  825. String dataSource = scenePlusService.getDataSourceByNum(num);
  826. if(StringUtils.isBlank(dataSource)){
  827. throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
  828. }
  829. String homePath = dataSource.replace("/mnt/data","home");
  830. return fYunFileServiceInterface.getRestoreFolderProcess(sceneColdStorage.getColdBucket(),homePath);
  831. }
  832. @Override
  833. public Long getSpaceSumByCameraId(Long cameraId) {
  834. return this.getBaseMapper().getSpaceSumByCameraId(cameraId);
  835. }
  836. @Override
  837. public Long getCountByCameraId(Long cameraId) {
  838. LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
  839. wrapper.eq(ScenePro::getIsUpgrade,0);
  840. wrapper.eq(ScenePro::getCameraId,cameraId);
  841. wrapper.in(ScenePro::getStatus,0,-2);
  842. return this.count(wrapper);
  843. }
  844. @Override
  845. public BuildSceneVO getSceneProgress(String num) {
  846. //V3
  847. ScenePro scenePro = sceneProService.getByNum(num);
  848. //V4
  849. ScenePlus plus = scenePlusService.getByNum(num);
  850. if(scenePro == null && plus == null){
  851. throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
  852. }
  853. String dataSource ="";
  854. Integer sceneStatus =null;
  855. if (ObjectUtil.isNotNull(plus)){
  856. ScenePlus scenePlus = scenePlusService.getByNum(num);
  857. sceneStatus = scenePlus.getSceneStatus();
  858. //=-2 =0计算中 -1=失败
  859. ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
  860. if (ObjectUtil.isNotNull(scenePlus)){
  861. dataSource=scenePlusExt.getDataSource();
  862. }
  863. }else {
  864. dataSource = scenePro.getDataSource();
  865. sceneStatus = scenePro.getStatus();
  866. }
  867. BuildSceneVO buildSceneVO = new BuildSceneVO();
  868. //=-2 =0计算中 -1=失败
  869. if (sceneStatus == 0){
  870. //去目录检查project.json
  871. File projectJson = FileUtil.file(dataSource + File.separator + "project.json");
  872. if(isObj(num)){
  873. projectJson = FileUtil.file(dataSource+"_laser_obj" + File.separator + "project.json");
  874. }
  875. if (FileUtil.exist(projectJson)) {
  876. FileReader reader = new FileReader(projectJson);
  877. String data = reader.readString();
  878. JSONObject data_project = JSONObject.parseObject(data);
  879. if (data_project.containsKey("state")) {
  880. JSONObject state = data_project.getJSONObject("state");
  881. Double progress = state.getDouble("progress");
  882. if (ObjectUtil.isNotNull(progress)) {
  883. if (progress == 1){
  884. buildSceneVO.setProgress(90);
  885. }else {
  886. progress = NumberUtil.mul(progress, new Double(100.00));
  887. buildSceneVO.setProgress(progress.intValue());
  888. }
  889. }
  890. }else {
  891. buildSceneVO.setProgress(0);
  892. }
  893. }
  894. }else if (sceneStatus == -2){
  895. buildSceneVO.setProgress(100);
  896. delRedisKey(num);
  897. }else if (sceneStatus == -1){
  898. buildSceneVO.setProgress(0);
  899. }
  900. buildSceneVO.setStatus(sceneStatus);
  901. buildSceneVO.setNum(num);
  902. return buildSceneVO;
  903. }
  904. static String redisKey = "ucenter:generatePlusObjFile:%s";
  905. private void delRedisKey(String num) {
  906. redisUtil.del(String.format(redisKey,num));
  907. }
  908. private boolean isObj(String num) {
  909. return redisUtil.hasKey(String.format(redisKey,num));
  910. }
  911. }