This command ignores the broken seed data and forces the engine to re-run the ore generation algorithm for all unloaded chunks. It will not touch your buildings. If your flat world is underwater, use the Global Heightmap Adjuster :
Warning: This kills your moat. Use wisely. If vanilla commands are not enough, the modding community has solved this entirely. The "Colony Survival Flat World Seed Fix" is a specific mod found on the official forums called "Genesis: Flat Earth."
Did this fix work for you? If your specific flat seed broke differently, describe the error in the comments below. We will reverse-engineer the fix for you.