Self-interaction-free exchange-correlation potentials based on the piecewise linearity conditions of both energy and electron density