Positioning service is a critical technology that bridges the physical world with digital information, significantly enhancing efficiency and convenience in life and work. The evolution of 5G technology has proven that positioning services are integral components of current and future cellular networks. However, positioning accuracy is hindered by non-line-of-sight (NLoS) propagation, which severely affects the measurements of angles and delays. In this study, we introduced a deep autoencoding channel transform-generative adversarial network model that utilizes line-of-sight (LoS) samples as a singular category training set to fully extract the latent features of LoS, ultimately employing a discriminator as an NLoS identifier. We validated the proposed model in 5G indoor and indoor factory (dense clutter, low base station) scenarios by assessing its generalization capability across different scenarios. The results indicate that, compared to the state-of-the-art method, the proposed model markedly diminished the utilization of device resources and achieved a 2.15% higher area under the curve while reducing computing time by 12.6%. This approach holds promise for deployment in future positioning terminals to achieve superior localization precision, catering to commercial and industrial Internet of Things applications.