There is two possible failures you could have here": The battery and it’s charging logic, or the CPU is overheating because the fan or the heatsink is failing.
To check the battery & its charging logic you’ll want to install this app: CoconutBattery. Post a snapshot of the main window with the MagSafe connected and a second not. Post the images here for us to see.
To check the thermal issues you’ll need this app: TG Pro. Take a snapshot of the main window (make sure you stretch the bottom so we can see all of the sensors & fans) post one just as after you turned the system on and then again after the system has shutdown so we can see the temp as close in time of the event.
Adding images to an existing question
crwdns2934105:0crwdne2934105:0
crwdns2934113:0crwdne2934113:0
crwdns2915270:0crwdne2915270:0
crwdns2889612:0crwdne2889612:0
0
crwdns2947414:01crwdne2947414:0
Lets run diagnostics here to see what it tells us. Restart your system and hold the D key until diagnostics start up. Did you get any error codes?
crwdns2934271:0crwdnd2934271:0 Dan crwdne2934271:0