You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ResolverFactory.cs 1.4KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using HealthMonitor.Service.Resolver.Interface;
  2. using HealthMonitor.Service.Sub;
  3. using HealthMonitor.Service.Sub.Topic.Model;
  4. using Microsoft.Extensions.Logging;
  5. using Newtonsoft.Json;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using TDengineTMQ;
  12. using TelpoDataService.Util.Entities.GpsLocationHistory;
  13. namespace HealthMonitor.Service.Resolver.Factory
  14. {
  15. public class ResolverFactory : IResolverFactory
  16. {
  17. private readonly ILogger<ResolverFactory> _logger;
  18. public ResolverFactory(ILogger<ResolverFactory> logger)
  19. {
  20. _logger = logger;
  21. }
  22. public PackageMsgModel? ParseAndWrap(ReceiveMessageModel msg)
  23. {
  24. var topic=msg.Topic;
  25. switch (topic)
  26. {
  27. case "topic_hm_bp_stats":
  28. //TopicHmBloodPress bloodPress = JsonConvert.DeserializeObject<TopicHmBloodPress>(msg.Body)!;
  29. return new PackageMsgModel()
  30. {
  31. DB= msg.DB,
  32. MessageId=msg.MessageId,
  33. Topic= topic,
  34. DetailData= msg.Body,
  35. };
  36. // return bloodPress!;
  37. default:
  38. break;
  39. }
  40. return null;
  41. }
  42. }
  43. }