Non-thermal collisional excitation and ionization by electron beams: Effect on the atmospheric energy balance and white-light emission in solar flares