Browse Source

fix:保存场景增加异常处理

liaoyitao 2 weeks ago
parent
commit
002361273a

+ 5 - 2
src/main/java/com/lqkj/link/module/zone/controller/GeomInfoController.java

@@ -69,8 +69,11 @@ public class GeomInfoController {
69
     )
69
     )
70
     @PostMapping("" + VERSION_V1 + "/saveGeom")
70
     @PostMapping("" + VERSION_V1 + "/saveGeom")
71
     public MessageBean saveGeom(@RequestBody OneZoneGeomInfos geomInfos) {
71
     public MessageBean saveGeom(@RequestBody OneZoneGeomInfos geomInfos) {
72
-        geomInfoService.saveLayerByZone(geomInfos);
73
-        geomInfoService.saveGeomByZone(geomInfos);
72
+        try {
73
+            geomInfoService.saveGeom(geomInfos);
74
+        } catch (Exception e) {
75
+            throw new RuntimeException(e);
76
+        }
74
         return MessageBean.ok(null,"保存场景信息");
77
         return MessageBean.ok(null,"保存场景信息");
75
     }
78
     }
76
 
79
 

+ 2 - 1
src/main/java/com/lqkj/link/module/zone/service/GeomInfoService.java

@@ -64,7 +64,7 @@ public class GeomInfoService {
64
     }
64
     }
65
 
65
 
66
     @Transactional
66
     @Transactional
67
-    public void saveLayerByZone(OneZoneGeomInfos infos) {
67
+    public void saveGeom(OneZoneGeomInfos infos) {
68
         // 保存图层
68
         // 保存图层
69
         if (infos.getModifyLayerList() != null && infos.getModifyLayerList().size() > 0) {
69
         if (infos.getModifyLayerList() != null && infos.getModifyLayerList().size() > 0) {
70
             for (LayerInfo layerInfo : infos.getModifyLayerList()) {
70
             for (LayerInfo layerInfo : infos.getModifyLayerList()) {
@@ -76,5 +76,6 @@ public class GeomInfoService {
76
         // 删除图层
76
         // 删除图层
77
         if (infos.getDeleteLayerList() != null && infos.getDeleteLayerList().size() > 0)
77
         if (infos.getDeleteLayerList() != null && infos.getDeleteLayerList().size() > 0)
78
             layerInfoRepository.deleteAllByIdInBatch(infos.getDeleteLayerList());
78
             layerInfoRepository.deleteAllByIdInBatch(infos.getDeleteLayerList());
79
+        saveGeomByZone(infos);
79
     }
80
     }
80
 }
81
 }