Energy correction for the BGO calorimeter of DAMPE using an electron beam