once please cheak charging cable and device charging port also .....it's basically happened for either software or for damage of charger as well as charging port ....better once factory reset your device once then check its because software glitches can do that maximum times
ok carefully take backup then try......see if you suppse to visit service center then also they will do the same as they will flash firmware first ...so better take backup then reset your device properly......not only from backup and reset section,,just after that from factory mode also you have to reset..i think problem will be solved....it's software glitch may be