you don't need to beat up your dogs. A sharp voice, they will know.
dogs must know who is the boss.
i know how people spoil their dogs. For example, when I visited a lady, her dog would harass me all the time. We had to shut him out of the room where we talked. then he would scratch the dog and barks,
the lady said he would like to do this whenever a visitor comes. he is so jealous.