Esempio n. 1
0
        public Dictionary <Guid, AppIdNameIconDTO> GetAppDictByIds(List <Guid> appIds, ContextDTO contextDTO = null)
        {
            Dictionary <Guid, AppIdNameIconDTO> result = new Dictionary <Guid, AppIdNameIconDTO>();

            if (appIds == null || !appIds.Any())
            {
                return(result);
            }
            appIds = appIds.Distinct().ToList();
            try
            {
                List <Guid> redisNotExistappIdsList = new List <Guid>();
                var         dict = RedisHelper.GetHashInfoList <AppIdNameIconDTO>(RedisKeyConst.AppNameIcon, appIds.Select(c => c.ToString()).ToList());
                foreach (Guid appId in appIds)
                {
                    if (dict.ContainsKey(appId.ToString()) && dict[appId.ToString()] != null)
                    {
                        result.Add(appId, dict[appId.ToString()]);
                    }
                    else
                    {
                        redisNotExistappIdsList.Add(appId);
                    }
                }
                if (redisNotExistappIdsList.Any())
                {
                    LogHelper.Info("GetAppDictByIds中调用接口GetAppListByIds方法的AppId为:" + string.Join(",", redisNotExistappIdsList));
                    List <KeyValuePair <string, AppIdNameIconDTO> > keyValuePairs = new List <KeyValuePair <string, AppIdNameIconDTO> >();
                    App.ISV.Facade.AppManagerFacade appMFacade = new App.ISV.Facade.AppManagerFacade();
                    appMFacade.ContextDTO = AuthorizeHelper.CoinInitAuthorizeInfo();
                    List <AppIdNameIconDTO> appExistAppNamelist = appMFacade.GetOldAppListByIds(redisNotExistappIdsList);
                    if (appExistAppNamelist.Any())
                    {
                        foreach (AppIdNameIconDTO appIdNameIconDTO in appExistAppNamelist)
                        {
                            KeyValuePair <string, AppIdNameIconDTO> keyValuePair = new KeyValuePair <string, AppIdNameIconDTO>(appIdNameIconDTO.AppId.ToString(), appIdNameIconDTO);
                            result.Add(appIdNameIconDTO.AppId, appIdNameIconDTO);
                            keyValuePairs.Add(keyValuePair);
                        }
                        RedisHelper.SetRangeInHash(RedisKeyConst.AppNameIcon, keyValuePairs);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("APPSV.GetAppDictByIds服务异常:获取应用信息异常。 appIds:{0}", appIds), ex);
            }
            return(result);
        }
Esempio n. 2
0
        public List <AppIdNameIconDTO> GetAppListByIdsInfo(List <Guid> appIds)
        {
            List <AppIdNameIconDTO> applicationDTO = null;

            try
            {
                Jinher.AMP.App.ISV.Facade.AppManagerFacade appManagerFacade = new App.ISV.Facade.AppManagerFacade();
                appManagerFacade.ContextDTO = AuthorizeHelper.CoinInitAuthorizeInfo();
                applicationDTO = appManagerFacade.GetOldAppListByIds(appIds);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("APPSV.GetAppListByIdsInfo服务异常:获取应用信息异常。 appIds:{0}", appIds), ex);
            }
            return(applicationDTO);
        }