Autobrakes4 is right, but DOJ is only relevant within each priority number, so the longest in the company with a 42Y will get on before a more junior 42Y, but not before a more junior 40Y.
Travel companions will only carry the employees priority if travelling with the employee on a 42Y, 47Y or 50Y, or by themselves on a 40Y or 41Y.
Upgrades are a different kettle of fish, and no beneficiary travelling by themselves should get an upgrade before any employee.
The reason is that the upgrade priorities for employees range from 10 to 17, and unaccompanied companions range from 20 to 27.
It's all on the staff travel website, info>policy>travel categories.