It seems from your example that the key parts of the URL structure are staying the same.
2016/5/document.pdf
That means you could use a plugin like ‘Better Search Replace’ (https://en-gb.wordpress.org/plugins/better-search-replace/).
Simply choose to replace:
www.example.com/files/
with www.example.com/wp-content/uploads/sites/#/