Once you reach the cap, anything you gain over that amount is wasted/discarded/ignored. Negative affection will immediately drop it down by the amount of the negative affection change. But you can always bring it back up again later.
A few hundred lost here or there isn't going to change the effects too much (the companion mission speed, etc.) though. So I wouldn't worry about it too much.
The related achievement for gaining 10000 reputation for that specific companion however will stay. Once it is earned, it never goes away even if the affection level later drops below that amount. The same applies for any legacy bonuses sticking around; the ones for having all companion missions completed (which is indirectly related to companion affection).
I'm not sure about the last paragraph in the question; but if you're asking if you have a single mission that awards various points of affection throughout the mission, it totals up all the gains/losses and comes up with a final number, regardless of any cap. Then, when that mission is completed, the final affection value is applied. If it was positive, and it goes over the cap, then it is wasted.
For example, you could already be at the cap, start a mission and gain 20 affection, then later in the same conversation/mission, lose -2. The final result would be 18, at mission completion, which would then be applied and those 18 would be wasted. (In other words, it does not waste the first 20 on the cap, then leave you with -2 that will get removed. It only applies the cap to the final amount for the mission.)