Преглед на файлове

Merge branch 'pano-pay-status'

lyhzzz преди 1 година
родител
ревизия
416cd41073

+ 1 - 1
src/main/java/com/fdkankan/ucenter/common/OssPath.java

@@ -7,5 +7,5 @@ public class OssPath {
     public final static String v3_scenePath = "data/data%s/scene.json";
     public final static String v4_statusPath = "scene_view_data/%s/data/status.json";
     public final static String v4_scenePath = "scene_view_data/%s/data/scene.json";
-    public final static String localStatusPath = System.getProperty("java.io.tmpdir") +"status.json";   //获取临时文件目录
+    public final static String localStatusPath = System.getProperty("java.io.tmpdir") +"/%s/status.json";   //获取临时文件目录
 }

+ 7 - 0
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -355,6 +355,13 @@ public class LaserService {
         rabbitMqProducer.sendByWorkQueue("update-laser-scene-status" ,params);
         //return laserClient.updateStatus( params);
     }
+    public void updatePanoStatus(List<String> numList, Integer payStatus) {
+        Map<String,Object> params = new HashMap<>();
+        params.put("sceneCodes", numList);
+        params.put("payStatus", payStatus);
+        rabbitMqProducer.sendByWorkQueue("pano-paystatus-scene-queue" ,params);
+        //return laserClient.updateStatus( params);
+    }
 
 
     public HashMap<String, JSONObject> list(List<String> sceneNumList,Integer sceneSource) {

+ 1 - 2
src/main/java/com/fdkankan/ucenter/service/ISceneProService.java

@@ -33,7 +33,7 @@ public interface ISceneProService extends IService<ScenePro> {
 
 
     void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId);
-    public void lockOrUnLockScenes( List<String> v3NumList,List<String> v4NumList,Integer payStatus,Integer isLaser);
+    public void lockOrUnLockScenes( List<String> v3NumList,List<String> v4NumList,Integer payStatus,Integer isLaser,List<String> panoNumList);
 
     void lockOrUnLockBySpace(Long cameraId);
 
@@ -85,7 +85,6 @@ public interface ISceneProService extends IService<ScenePro> {
 
     Object getScenes(String username, RequestScene param);
 
-    void updateOssStatus(String path,Integer payStatus) ;
 
     Integer getSceneSourceByNum(String sceneNum);
 

+ 0 - 29
src/main/java/com/fdkankan/ucenter/service/impl/ExceedSpaceSceneServiceImpl.java

@@ -105,33 +105,4 @@ public class ExceedSpaceSceneServiceImpl extends ServiceImpl<IExceedSpaceSceneMa
     }
 
 
-
-    private void updateOssStatus(String num) {
-        String v3StatusJson = String.format(OssPath.v3_statusPath, num);
-        String v4StatusJson = String.format(OssPath.v4_statusPath, num);
-        String statusJson = null;
-        String path = null;
-        if(fYunFileServiceInterface.fileExist(v3StatusJson)){
-            statusJson = fYunFileServiceInterface.getFileContent(v3StatusJson);
-            path = v3StatusJson;
-        }
-        if(fYunFileServiceInterface.fileExist(v4StatusJson)){
-            statusJson = fYunFileServiceInterface.getFileContent(v4StatusJson);
-            path = v4StatusJson;
-        }
-        try {
-            JSONObject jsonObject = JSONObject.parseObject(statusJson);
-            jsonObject.put("status",0);
-            String json = JSONUtil.toJsonStr(jsonObject);
-            FileUtils.writeFile(OssPath.localStatusPath ,json);
-            log.info("updateOssStatus--localPath:{},ossPath:{},status:{}",OssPath.localStatusPath,path,0);
-            fYunFileServiceInterface.uploadFile(OssPath.localStatusPath,path);
-        }catch (Exception e){
-            log.error("updateOssStatus--localPath:{},ossPath:{},status:{},error:{}",OssPath.localStatusPath,path,0,e);
-        }finally {
-            FileUtil.delFile(OssPath.localStatusPath);
-        }
-
-    }
-
 }

+ 5 - 1
src/main/java/com/fdkankan/ucenter/service/impl/ScenePlusServiceImpl.java

@@ -296,7 +296,11 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
                 redisUtil.set(redisSceneLock,"1",60*60);
                 Boolean checkSpace = cameraDetailService.checkSpace(cameraDetail.getCameraId(),cameraType);
                 if(!checkSpace){
-                    sceneProService.lockOrUnLockScenes(new ArrayList<>(),Arrays.asList(scenePlus.getNum()),-2,cameraType.getIsLaser());
+                    List<String> panoNumList = new ArrayList<>();
+                    if(plusExt.getLocation() == 7){
+                        panoNumList.add(scenePlus.getNum());
+                    }
+                    sceneProService.lockOrUnLockScenes(new ArrayList<>(),Arrays.asList(scenePlus.getNum()),-2,cameraType.getIsLaser(),panoNumList);
                 }
                 cameraDetailService.addUsedSpace(cameraDetail,plusExt.getSpace());
                 redisUtil.del(redisSceneLock);

+ 24 - 15
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -295,7 +295,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     private void lockOrUnLockScenes(List<SimpleSceneVo> sceneVos, Integer payStatus,CameraType cameraType){
         List<String> v3NumList = sceneVos.stream().filter(e ->"v3".equals(e.getVersion())).map(SimpleSceneVo::getNum).collect(Collectors.toList());
         List<String> v4NumList = sceneVos.stream().filter(e ->"v4".equals(e.getVersion())).map(SimpleSceneVo::getNum).collect(Collectors.toList());
-        lockOrUnLockScenes(v3NumList,v4NumList,payStatus,cameraType.getIsLaser());
+        List<String> panoNumList = sceneVos.stream().filter(e ->"v4".equals(e.getVersion()) && e.getLocation() != null && e.getLocation() == 7).map(SimpleSceneVo::getNum).collect(Collectors.toList());
+
+        lockOrUnLockScenes(v3NumList,v4NumList,payStatus,cameraType.getIsLaser(),panoNumList);
     }
 
     private Long getSceneUnLockedIds(List<SimpleSceneVo> lockedIds ,List<SimpleSceneVo> list,Long beyondSpace,String unit){
@@ -337,7 +339,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
     // payStatus 为 -2 封存,为 1 解封
     @Override
-    public void lockOrUnLockScenes( List<String> v3NumList,List<String> v4NumList,Integer payStatus,Integer isLaser) {
+    public void lockOrUnLockScenes( List<String> v3NumList,List<String> v4NumList,Integer payStatus,Integer isLaser,List<String> panoNumList) {
 
         if(!v3NumList.isEmpty()){
             LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<>();
@@ -355,16 +357,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
         this.updateOssStatus(v3NumList,v4NumList,payStatus);
 
+        List<String> numList = new ArrayList<>();
+        numList.addAll(v3NumList);
+        numList.addAll(v4NumList);
         if(isLaser == 1){
             //激光系统相机
             //1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4重算中'
-            List<String> numList = new ArrayList<>();
-            numList.addAll(v3NumList);
-            numList.addAll(v4NumList);
             if(!numList.isEmpty()){
                 laserService.updateStatus(numList,payStatus);
             }
         }
+        if(panoNumList != null && !panoNumList.isEmpty()){
+            laserService.updatePanoStatus(numList,payStatus);
+        }
     }
 
     /**
@@ -372,18 +377,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
      */
     private void updateOssStatus(List<String> v3NumList ,List<String> v4NumList , Integer payStatus) {
         if(!v3NumList.isEmpty()){
-            v3NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v3_statusPath,e),payStatus));
+            v3NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v3_statusPath,e),payStatus,e));
         }
         if(!v4NumList.isEmpty()){
-            v4NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v4_statusPath,e),payStatus));
+            v4NumList.forEach(e ->this.updateOssStatus(String.format(OssPath.v4_statusPath,e),payStatus,e));
         }
     }
 
     /**
      * 从oss中获取文件,并重写,上传替换
      */
-    @Override
-    public void updateOssStatus(String path,Integer payStatus) {
+    public void updateOssStatus(String path,Integer payStatus,String num) {
+        String localStatusPath = String.format(OssPath.localStatusPath,num);
         try {
             if(!fYunFileService.fileExist(path)){
                 return;
@@ -395,13 +400,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             JSONObject jsonObject = JSONObject.parseObject(data);
             jsonObject.put("payStatus",payStatus);
             String json = JSONUtil.toJsonStr(jsonObject);
-            FileUtils.writeFile(OssPath.localStatusPath ,json);
-            log.info("updateOssStatus--localPath:{},ossPath:{},payStatus:{}",OssPath.localStatusPath,path,payStatus);
-            fYunFileService.uploadFile(OssPath.localStatusPath,path);
+            FileUtils.writeFile(localStatusPath ,json);
+            log.info("updateOssStatus--localPath:{},ossPath:{},payStatus:{}",localStatusPath,path,payStatus);
+            fYunFileService.uploadFile(localStatusPath,path);
         }catch (Exception e){
-            e.printStackTrace();
+            log.info("updateOssStatus--localPath:{},ossPath:{},payStatus:{}",localStatusPath,path,payStatus,e);
         }finally {
-            FileUtil.del(OssPath.localStatusPath);
+            if(new File(localStatusPath).getParentFile().exists()){
+                FileUtil.del( new File(localStatusPath).getParentFile());
+            }
         }
     }
 
@@ -859,7 +866,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 sceneCopyLogService.saveByNum(oldNum,newNum,scenePro.getUserId());
                 Boolean checkSpace = cameraDetailService.checkSpace(cameraDetail.getCameraId(),cameraType);
                 if(!checkSpace){
-                    this.lockOrUnLockScenes(Arrays.asList(scenePro.getNum()),new ArrayList<>(),-2,cameraType.getIsLaser());
+                    this.lockOrUnLockScenes(Arrays.asList(scenePro.getNum()),new ArrayList<>(),-2,cameraType.getIsLaser(),null);
                 }
                 cameraDetailService.addUsedSpace(cameraDetail,scenePro.getSpace());
 
@@ -1140,6 +1147,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             sceneVo.setCreateTime(DateUserUtil.getDate(time).getTime());
             sceneVo.setSpace(ext.getSpace());
             sceneVo.setVersion("v4");
+            sceneVo.setLocation(ext.getLocation());
+
             voList.add(sceneVo);
         }
         return voList;

+ 1 - 0
src/main/java/com/fdkankan/ucenter/vo/response/SimpleSceneVo.java

@@ -18,4 +18,5 @@ public class SimpleSceneVo {
     private Long createTime;
     private Long space = 0L;
     private String version;
+    private Integer location;
 }