It is not possible for everyone to have solar panels on their roof top during war times. It is all about alternatives and redundancy in the electricity power grid and gasoline supply chain. That is why BYD hybrid EVs are so popular, you can use both gasoline and electricity for powering them.
The majority of new solar panel installations in China aren't utility-scale anymore.
They're distributed installations inside cities now.
---
"In July 2021, China’s National Energy Bureau required solar installation on 50 percent of rooftop space on party and government buildings, 40 percent of public buildings such as schools and hospitals, 30 percent of industrial and commercial spaces, and 20 percent of rural households. It also mandated that these measures conclude by the end of 2023. Consequently, about 54 percent of all Chinese solar installations year-to-date have been for distributed generation"
atlanticcouncil.org/blogs/new-atlanticist/theres-something-odd-about-where-china-is-building-solar-power/