示例#1
0
 public ServiceResult <List <GetMerchantInfoOM> > GetMerchantInfoListByMap(GetMerchantInfoListByMapIM im)
 {
     return(new ServiceResult <List <GetMerchantInfoOM> >
     {
         Data = new MerchantComponent().GetMerchantInfoList(im)
     });
 }
示例#2
0
        public List <GetMerchantInfoOM> GetMerchantInfoList(GetMerchantInfoListByMapIM im)
        {
            var list = new MerchantInformationDAC().QueryNearbyMerchantList(im.LeftTop.Longitude, im.LeftTop.Latitude, im.RightDown.Longitude, im.RightDown.Latitude);

            var mwDAC      = new MerchantWalletDAC();
            var mscDAC     = new MerchantSupportCryptoDAC();
            var cryptoList = new CryptoComponent().GetList();

            return(list.Select(item =>
            {
                List <int> supportCryptoIdList = new List <int>();
                if (item.AccountType == (byte)AccountType.Merchant)
                {
                    supportCryptoIdList = mwDAC.SupportReceiptList(item.MerchantAccountId).Select(t => t.CryptoId).ToList();
                }
                else
                {
                    supportCryptoIdList = mscDAC.GetList(item.Id).Select(t => t.CryptoId).ToList();
                }

                return new GetMerchantInfoOM()
                {
                    Address = item.Address,
                    IsAllowExpense = item.IsAllowExpense,
                    AvailableCryptoIconList = cryptoList.Where(c => supportCryptoIdList.Contains(c.Id)).Select(t => t.IconURL.ToString()).ToList(),
                    Distance = item.Distance.ToSpecificDecimal(2).ToString(CultureInfo.InvariantCulture),
                    OriginIconId = item.FileId,
                    CompressIconId = item.ThumbnailId ?? Guid.Empty,
                    Id = item.MerchantInformationId,
                    Location = new Location()
                    {
                        Longitude = item.Lng, Latitude = item.Lat
                    },
                    Tags = item.Tags.Split(',').ToList(),
                    Title = item.MerchantName
                };
            }).ToList());
        }