A generalization of Bombieri-Vinogradov theorem and its application