The dynamic behavior and energy transformation mechanism of the multi-period evolution of bubbles collapsing near a wall have been essential considerations in bubble dynamics research. In this study, a compressible two-phase solver considering thermodynamics and phase transitions is developed on OpenFOAM (version v2112). This model is validated via comparison with analytical solutions and experimental results. The dynamics of the multi-period evolution of bubbles collapse process at different dimensionless stand-off distances (γ) were accurately reproduced. The results indicate that the shock wave emitted by the collapse of cavitation bubbles impacts the wall, causing the fluid temperature along the wall to increase. Moreover, the liquid jet has a dual effect on the wall temperature increase, depending on the initial stand-off distance between the bubble and the wall. When γ is small, the jet carries the low-temperature fluid to occupy the high-temperature region, and when γ is large, the jet carries the high-temperature fluid to occupy the low-temperature region. Compared with the mechanisms above of wall temperature increase, the collapse process of cavitation, when directly attached to the wall, increases the fluid temperature along the wall more significantly. Additionally, an energy transformation mechanism is proposed considering the internal bubble energy based on the analysis of the internal bubble energy and acoustic radiation energy with different γ values. Both the internal and acoustic radiation energy initially decreased and subsequently increased with increasing γ values. These findings provide deeper insights into the near-wall collapsing cavitation process mechanism.