Direct Numerical Simulations of Cosmic-ray Acceleration at Dense Circumstellar Medium: Magnetic-field Amplification and Maximum Energy