Recently, AMS-02 reported their results of cosmic ray (CR) observations. In addition to the AMS-02 data, we add HESS data to estimate the spectra of CR electrons and the diffuse gamma rays above TeV. In the conventional diffusion model, a global analysis is performed on the spectral features of CR electrons and the diffuse gamma rays by the GALRPOP package. The results show that the spectrum structure of the primary component of CR electrons cannot be fully reproduced by a simple power law and that the relevant break is around 100 GeV. At the 99% confidence level (C.L.) the injection indices above the break decrease from 2.54 to 2.35, but the ones below the break are only in the range of 2.746-2.751. The spectrum of CR electrons does not need to add TeV cutoff to also match the features of the HESS data. Based on the difference between the fluxes of CR electrons and their primary components, the predicted excess of CR positrons is consistent with the interpretation that these positrons originate from a pulsar or dark matter. In the analysis of the Galactic diffuse gamma rays with the indirect constraint of AMS-02 and HESS data, it is found that the fluxes of Galactic diffuse gamma rays are consistent with the GeV data of the Fermi-Large Area Telescope (LAT) in the high-latitude regions. The results indicate that inverse Compton scattering is the dominant component in the range of hundreds of GeV to tens of TeV, respectively from the high-latitude regions to the low ones, and in all of the regions of the Galaxy the flux of diffuse gamma rays is less than that of CR electrons at the energy scale of 20 TeV.