The method comprises the following steps: S1, conveying ammonia-nitrogen wastewater to be treated into a magnetizing reactor, adding a phosphorus source, controlling the nitrogen-phosphorus ratio, adding a magnesium source under an alkaline condition pH value to generate a part of precipitate, and dropwise adding the magnesium source under a neutral slightly alkaline pH value until the reaction is complete; S2, adding magnetic seeds, uniformly stirring and mixing, conveying into an electric flocculation device, and carrying out electric flocculation reaction by using pulse current; S3, conveying the wastewater treated in the step S2 into a magnetic separation device, discharging a liquid phase part after magnetic separation, and collecting a solid phase part; and S4, conveying the collected solid-phase part into a magnetic recovery device, recovering the magnetic seeds, and taking the rest part as the struvite crystal precipitate. According to the scheme of the embodiment of the invention, by combining electric flocculation and magnetic flocculation, struvite crystals can keep an intact crystal form structure, and the capacity of slowly releasing nitrogen and phosphorus is high.