Optimized lattice rule and adaptive approach for multidimensional integrals with applications