Purification and treatment of electroplating baths and plating wastes