While dockless bike-sharing systems are growing in popularity due to their convenience, indiscriminate parking creates disorder in cities. To address this problem, this paper proposes a novel prediction-based approach for planning dynamic electric fences. These fences can adapt to dynamic usage patterns and efficiently guide parking behavior. First, graded clustering and spatial point integration algorithms are used to determine the locations of electric fence candidates. Second, initial parking and scheduling simulations are developed to calculate the inventory of each candidate. Finally, a spatiotemporal graph neural network is utilized to predict inventory and generate real-time deployment plans for electric fences. Case studies are conducted in two regions in Shanghai, China. Compared to a non-electric fence scenario, extensive experiments show that our framework can satisfy 98.6% of the parking demand and reduce spatial entropy by 15% within a reasonable walking distance. The results contribute to improving urban orderliness and promoting the sustainability of bike-sharing systems.