Structure of virtually semisimple modules over commutative rings