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.

62 lines
1.7KB

  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. // case "topichmbloodpress":
  29. // //TopicHmBloodPress bloodPress = JsonConvert.DeserializeObject<TopicHmBloodPress>(msg.Body)!;
  30. // return new PackageMsgModel()
  31. // {
  32. // DB= msg.DB,
  33. // MessageId=msg.MessageId,
  34. // Topic= topic,
  35. // DetailData= msg.Body,
  36. // };
  37. // // return bloodPress!;
  38. // default:
  39. // break;
  40. //}
  41. //return null;
  42. return new PackageMsgModel()
  43. {
  44. DB = msg.DB,
  45. MessageId = msg.MessageId,
  46. Topic = msg.Topic,
  47. DetailData = msg.Body,
  48. };
  49. }
  50. }
  51. }