A Chinese company with links to Beijing's military and intelligence networks has been collecting personal information on millions of people across the globe.