Welcome to the Apple Support Communities!
I understand you are having issues with the camera on your iPhone 7. The resource below will provide some basic troubleshooting steps to try first. The section "You see a closed lens or black screen" may be a good place to start. There are links to reach out to an Apple Store Genius or an Apple Authorized Service Provider if a hardware repair is needed.
Get help with the camera on your iPhone, iPad, or iPod touch