This site might help in clearing up the concepts, which are not simple. In the link, click "heat and thermodynamics" and then " radiation" and then "black body" on the right column to get the options shown in the image. Unfortunately the site does not link back to individual pages. :(.
Clicking on the main line,
Blackbody radiation" or "cavity radiation" refers to an object or system which absorbs all radiation incident upon it and re-radiates energy which is characteristic of this radiating system only, not dependent upon the type of radiation which is incident upon it. The radiated energy can be considered to be produced by standing wave or resonant modes of the cavity which is radiating.
Note that this is a classical thermodynamic model of how one could address radiation mathematically, without entering into the quantum mechanical details of real life . When experiments were carried out it was found that the distribution predicted by classical electrodynamics had to be modified to avoid the ultraviolet catastrophy.:
But the predicted continual increase in radiated energy with frequency (dubbed the "ultraviolet catastrophe") did not happen. Nature knew better.
Radiation is a wave in classical electrodynamics, its energy computable etc. The Planck black body formula addresses the dual nature of photons and waves of electromagnetism. Actually it is one of the basic early proofs that quantum mechanics was necessary to understand nature. The formula is fine and works fine with the rest of classical thermodynamics.
When it comes to solids, thermodynamics ignores the quantum discreteness of solids. It uses the black body radiation formula and it was found that introducing the concept of "emissivity" the energy output of a hot body was like the cavity radiation: A hot solid is modeled to the a cavity model by taking the Stephan Boltzamn law and multiplying it by the emissivity to take care of the existence of the solid. This works fine for thermodynamic calculations.
When one wants to go to the real workings of the quantum mechanical energy balances within a solid life becomes complicated, so much so that the quote
The great complexity of dealing with all the quantum mechanisms and processes in a solid is the kind of thing that might have led Einstein to his purported preference for approaching problems from a thermodynamic perspective whenever possible.
To get to this concluding quote go to the stefan boltzman law , at the second paragraph there is a link "Why is a good absorber of radiation also a good emitter?" . It has an attempt at analyzing the solid state status quantum mechanically for this and you can get an idea of the complexity.