AnnouncementProtoAdapter.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Remoting.Messaging;
  5. using System.Text;
  6. using tas;
  7. using Muchinfo.MTPClient.Adapter.Abstract;
  8. using Muchinfo.MTPClient.Adapter.Utilities;
  9. using Muchinfo.MTPClient.Data;
  10. using Muchinfo.MTPClient.Data.Enums;
  11. using Muchinfo.MTPClient.Data.Model;
  12. using Muchinfo.MTPClient.Data.Model.Account;
  13. namespace Muchinfo.MTPClient.Adapter.ProtoBuf
  14. {
  15. public class AnnouncementProtoAdapter : AnnouncementAdapter
  16. {
  17. public override Data.ResponeEntity<List<Data.Model.Announcement>> ToLocalQueryClientBM(object obj)
  18. {
  19. return null;
  20. //var buffer = obj as byte[];
  21. //if (buffer == null)
  22. //{
  23. // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
  24. //}
  25. //var rspData = ProtoBufHelper.EntityDeSerialize<QueryClientBMRsp>(buffer);
  26. //var resultEntity = new ResponeEntity<List<Announcement>>()
  27. //{
  28. // RetCode = rspData.RetCode,
  29. // RetMessage = rspData.RetDesc,
  30. // Entity = new List<Announcement>(),
  31. //};
  32. //if (rspData.Rsps == null || !rspData.Rsps.Any())
  33. //{
  34. // //todo:查询内容空
  35. // return resultEntity;
  36. //}
  37. //foreach (var item in rspData.Rsps)
  38. //{
  39. // var announcement = new Announcement()
  40. // {
  41. // MsgID = item.MsgID,
  42. // MsgType = (Muchinfo.MTPClient.Data.Enums.MsgTypeEnum)item.MsgType,
  43. // PublishDate =ToDateTime(item.PublishDate),
  44. // Title = Encoding.UTF8.GetString(item.Title),
  45. // Content = Encoding.UTF8.GetString(item.Content),
  46. // PubAccountCode = item.PubAccountCode,
  47. // ValidDate = ToDateTime(item.ValidDate),
  48. // RecvAccountType = (eAccountType)item.RecvAccountType,
  49. // PubExchName = item.PubExchName,
  50. // PubAccountType = (eAccountType)item.PubAccountType,
  51. // ReadStatus = item.ReadStatus,
  52. // RiskLevel = item.RiskLevel,
  53. // };
  54. // resultEntity.Entity.Add(announcement);
  55. //}
  56. //return resultEntity;
  57. }
  58. public override byte[] ToRequestQueryClientBM(QueryClientBMParam clientBMPar)
  59. {
  60. return null;
  61. //if (clientBMPar.TradeAccount == null) return null;
  62. //Data.Enums.ClientRiskNtfType riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType;
  63. //switch (clientBMPar.TradeAccount.AccountType)
  64. //{
  65. // case eUserType.USERTYPE_INVESTOR:
  66. // riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType;
  67. // break;
  68. // default:
  69. // riskNtfType = Data.Enums.ClientRiskNtfType.MemberRiskNtfType;
  70. // break;
  71. //}
  72. //var queryClientBM = new QueryClientBMReq()
  73. //{
  74. // StartDate =new DateTime(clientBMPar.StartDate.Year, clientBMPar.StartDate.Month, clientBMPar.StartDate.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss"),
  75. // EndDate = new DateTime(clientBMPar.EndDate.Year, clientBMPar.EndDate.Month, clientBMPar.EndDate.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss"),
  76. // MsgType = (int)clientBMPar.MsgTypeEnum,
  77. // AccountType =(int)clientBMPar.TradeAccount.AccountType,
  78. // RiskNtfType = (int)riskNtfType,
  79. // AccountCode = clientBMPar.TradeAccount.AccountCode,
  80. // AreaCode = clientBMPar.TradeAccount.AreaCode,
  81. // MemberCode = clientBMPar.TradeAccount.MemberCode,
  82. // Title = clientBMPar.Title,
  83. // IsValid = (int)IsValidType.Valid,
  84. // PageInfo = new tas.QueryReqPageInfo()
  85. // {
  86. // NeedTotalCount = 20,
  87. // PageNumber=0,
  88. // },
  89. // Header=new MessageHead()
  90. // {
  91. // AccountID = clientBMPar.TradeAccount.AccountId
  92. // }
  93. //};
  94. //return ProtoBufHelper.EntitySerialize(queryClientBM);
  95. }
  96. public static DateTime ToDateTime(string dateTime)
  97. {
  98. DateTime date = DateTime.MinValue;
  99. DateTime.TryParse(dateTime, out date);
  100. return date;
  101. }
  102. public override ResponeEntity<int> ToLocalModifyBulletinNotifyStatus(object obj)
  103. {
  104. return null;
  105. //var byteArr = obj as byte[];
  106. //if (byteArr == null)
  107. //{
  108. // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
  109. //}
  110. //var modifyBulletin = ProtoBufHelper.EntityDeSerialize<ModifyBulletinNotifyStatusRsp>(byteArr);
  111. //var responeEntity = new ResponeEntity<int>()
  112. //{
  113. // RetCode = modifyBulletin.RetCode,
  114. // RetMessage = modifyBulletin.RetDesc,
  115. //};
  116. //return responeEntity;
  117. }
  118. public override byte[] ToReqeustModifyBulletinNotifyStatus(ulong accountID, long msgId, int msgType)
  119. {
  120. return null;
  121. //var updMsgReads = new UpdMsgReadStatus();
  122. //updMsgReads.AccountId = (long)accountID;
  123. //updMsgReads.MsgId = msgId;
  124. //updMsgReads.MsgType = msgType;
  125. //return ProtoBufHelper.EntitySerialize(updMsgReads);
  126. }
  127. }
  128. }