P124.4.8.2019.2.8  Let $\mathbb Z$ be the set of all integers. Find all functions $f:\mathbb Z\to\mathbb Z$ satisfying the following conditions:
1. $f(f(x))=xf(x)-x^2+2$ for all $x\in\mathbb Z$;
2. $f$ takes all integer values.