|  |  | 
 |  |  |      * 根据指定条件获取片区,2024-08-14新增,替换原来的片区分页查询 | 
 |  |  |      * | 
 |  |  |      * @param qo | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @param | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/some") | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<QueryResultVo<List<VoBlock>>> getBlocks(@Valid QueryVo qo, BindingResult bindingResult) { | 
 |  |  |         if (bindingResult != null && bindingResult.hasErrors()) { | 
 |  |  |             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
 |  |  |         } | 
 |  |  |     public BaseResponse<QueryResultVo<List<VoBlock>>> getBlocks(QueryVo qo) { | 
 |  |  |         try { | 
 |  |  |             return BaseResponseUtils.buildSuccess(this.sv.getBlocks(qo)); | 
 |  |  |         } catch (Exception e) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         JSONArray graphs = po.getGraphs(); | 
 |  |  |         for (int i = 0; i < graphs.size(); i++) { | 
 |  |  |             JSONObject graph = graphs.getJSONObject(i); | 
 |  |  |         if(graphs != null && graphs.size() > 0){ | 
 |  |  |             for (int i = 0; i < graphs.size(); i++) { | 
 |  |  |                 JSONObject graph = graphs.getJSONObject(i); | 
 |  |  |  | 
 |  |  |             // 添加地图图形记录 | 
 |  |  |             BaMapGraph baMapGraph = new BaMapGraph(); | 
 |  |  |             baMapGraph.setBlockId(blockId); | 
 |  |  |             switch (graph.getString("type")) { | 
 |  |  |                 case "CircleMarker": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); | 
 |  |  |                     break; | 
 |  |  |                 case "Polygon": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); | 
 |  |  |                     break; | 
 |  |  |                 case "Polyline": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); | 
 |  |  |                     break; | 
 |  |  |             } | 
 |  |  |             Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); | 
 |  |  |             if (graphId.equals(0)) { | 
 |  |  |                 return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |             } | 
 |  |  |                 // 添加地图图形记录 | 
 |  |  |                 BaMapGraph baMapGraph = new BaMapGraph(); | 
 |  |  |                 baMapGraph.setBlockId(blockId); | 
 |  |  |                 switch (graph.getString("type")) { | 
 |  |  |                     case "CircleMarker": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); | 
 |  |  |                         break; | 
 |  |  |                     case "Polygon": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); | 
 |  |  |                         break; | 
 |  |  |                     case "Polyline": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); | 
 |  |  |                         break; | 
 |  |  |                 } | 
 |  |  |                 Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); | 
 |  |  |                 if (graphId.equals(0)) { | 
 |  |  |                     return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             // 添加地图图形坐标记录 | 
 |  |  |             JSONArray coordinates = graph.getJSONArray("coordinates"); | 
 |  |  |             for (int j = 0; j < coordinates.size(); j++) { | 
 |  |  |                 JSONArray coordinate = coordinates.getJSONArray(j); | 
 |  |  |                 for (int k = 0; k < coordinate.size(); k++) { | 
 |  |  |                     JSONObject point = coordinate.getJSONObject(k); | 
 |  |  |                 // 添加地图图形坐标记录 | 
 |  |  |                 JSONArray coordinates = graph.getJSONArray("coordinates"); | 
 |  |  |                 for (int j = 0; j < coordinates.size(); j++) { | 
 |  |  |                     JSONArray coordinate = coordinates.getJSONArray(j); | 
 |  |  |                     for (int k = 0; k < coordinate.size(); k++) { | 
 |  |  |                         JSONObject point = coordinate.getJSONObject(k); | 
 |  |  |  | 
 |  |  |                     BaMapCoordinates mapCoordinates = new BaMapCoordinates(); | 
 |  |  |                     mapCoordinates.setGraphId(graphId); | 
 |  |  |                     mapCoordinates.setLat(point.getBigDecimal("lat")); | 
 |  |  |                     mapCoordinates.setLng(point.getBigDecimal("lng")); | 
 |  |  |                     Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); | 
 |  |  |                     if (coordinateId.equals(0)) { | 
 |  |  |                         return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                         BaMapCoordinates mapCoordinates = new BaMapCoordinates(); | 
 |  |  |                         mapCoordinates.setGraphId(graphId); | 
 |  |  |                         mapCoordinates.setLat(point.getBigDecimal("lat")); | 
 |  |  |                         mapCoordinates.setLng(point.getBigDecimal("lng")); | 
 |  |  |                         Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); | 
 |  |  |                         if (coordinateId.equals(0)) { | 
 |  |  |                             return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  | 
 |  |  |         this.sv.deleteMapGraph(blockId); | 
 |  |  |  | 
 |  |  |         JSONArray graphs = po.getGraphs(); | 
 |  |  |         for (int i = 0; i < graphs.size(); i++) { | 
 |  |  |             JSONObject graph = graphs.getJSONObject(i); | 
 |  |  |         if(graphs != null && graphs.size() > 0){ | 
 |  |  |             for (int i = 0; i < graphs.size(); i++) { | 
 |  |  |                 JSONObject graph = graphs.getJSONObject(i); | 
 |  |  |  | 
 |  |  |             // 添加地图图形记录 | 
 |  |  |             BaMapGraph baMapGraph = new BaMapGraph(); | 
 |  |  |             baMapGraph.setBlockId(blockId); | 
 |  |  |             switch (graph.getString("type")) { | 
 |  |  |                 case "CircleMarker": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); | 
 |  |  |                     break; | 
 |  |  |                 case "Polygon": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); | 
 |  |  |                     break; | 
 |  |  |                 case "Polyline": | 
 |  |  |                     baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); | 
 |  |  |                     break; | 
 |  |  |             } | 
 |  |  |             Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); | 
 |  |  |             if (graphId.equals(0)) { | 
 |  |  |                 return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |             } | 
 |  |  |                 // 添加地图图形记录 | 
 |  |  |                 BaMapGraph baMapGraph = new BaMapGraph(); | 
 |  |  |                 baMapGraph.setBlockId(blockId); | 
 |  |  |                 switch (graph.getString("type")) { | 
 |  |  |                     case "CircleMarker": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); | 
 |  |  |                         break; | 
 |  |  |                     case "Polygon": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); | 
 |  |  |                         break; | 
 |  |  |                     case "Polyline": | 
 |  |  |                         baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); | 
 |  |  |                         break; | 
 |  |  |                 } | 
 |  |  |                 Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); | 
 |  |  |                 if (graphId.equals(0)) { | 
 |  |  |                     return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             // 添加地图图形坐标记录 | 
 |  |  |             JSONArray coordinates = graph.getJSONArray("coordinates"); | 
 |  |  |             for (int j = 0; j < coordinates.size(); j++) { | 
 |  |  |                 JSONArray coordinate = coordinates.getJSONArray(j); | 
 |  |  |                 for (int k = 0; k < coordinate.size(); k++) { | 
 |  |  |                     JSONObject point = coordinate.getJSONObject(k); | 
 |  |  |                 // 添加地图图形坐标记录 | 
 |  |  |                 JSONArray coordinates = graph.getJSONArray("coordinates"); | 
 |  |  |                 for (int j = 0; j < coordinates.size(); j++) { | 
 |  |  |                     JSONArray coordinate = coordinates.getJSONArray(j); | 
 |  |  |                     for (int k = 0; k < coordinate.size(); k++) { | 
 |  |  |                         JSONObject point = coordinate.getJSONObject(k); | 
 |  |  |  | 
 |  |  |                     BaMapCoordinates mapCoordinates = new BaMapCoordinates(); | 
 |  |  |                     mapCoordinates.setGraphId(graphId); | 
 |  |  |                     mapCoordinates.setLat(point.getBigDecimal("lat")); | 
 |  |  |                     mapCoordinates.setLng(point.getBigDecimal("lng")); | 
 |  |  |                     Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); | 
 |  |  |                     if (coordinateId.equals(0)) { | 
 |  |  |                         return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                         BaMapCoordinates mapCoordinates = new BaMapCoordinates(); | 
 |  |  |                         mapCoordinates.setGraphId(graphId); | 
 |  |  |                         mapCoordinates.setLat(point.getBigDecimal("lat")); | 
 |  |  |                         mapCoordinates.setLng(point.getBigDecimal("lng")); | 
 |  |  |                         Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); | 
 |  |  |                         if (coordinateId.equals(0)) { | 
 |  |  |                             return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return BaseResponseUtils.buildSuccess(true); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |         return BaseResponseUtils.buildSuccess(true); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取片区、分水房联动视图,添加农户时使用 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/block_divides") | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<JSONArray> getBlockDivides() { | 
 |  |  |         try { | 
 |  |  |             return BaseResponseUtils.buildSuccess(this.sv.getBlockDivides()); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("获取开卡记录异常", e); | 
 |  |  |             return BaseResponseUtils.buildException(e.getMessage()); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |