using JiShe.CollectBus.IotSystems.Records; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JiShe.CollectBus.EnergySystems.TableViews; using JiShe.CollectBus.FreeSql; using Volo.Abp.Domain.Repositories; using JiShe.CollectBus.IotSystems.PrepayModel; namespace JiShe.CollectBus.EnergySystem { public class CacheAppService : CollectBusAppService, ICacheAppService { //public async Task GetHashByKey(string key) //{ // await FreeRedisProvider.Instance.HGetAsync(key,); //} public async Task SetHashByKey(string key) { var data = await SqlProvider.Instance.Change(DbEnum.EnergyDB).Select().ToListAsync(); var groupData = data.GroupBy(a => $"{a.FocusAreaCode}{a.FocusAddress}").ToList(); foreach (var group in groupData) { var aa = data.ToDictionary(a => a.Address, b => b); await FreeRedisProvider.Instance.HSetAsync(group.Key, aa); } } } }