The present invention discloses an N-sulfonyl benzamide derivative with a heterocyclic substituent, and a preparation method therefor and a pharmaceutical application thereof. More specifically, the invention discloses a compound represented by formula (II) or a pharmaceutically acceptable salt, stereoisomer, solvent compound, or prodrug thereof, and a preparation method therefor and an application thereof. Refer to the specification for definitions of each group in the formula.