| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Remoting.Messaging;
- using System.Text;
- using tas;
- using Muchinfo.MTPClient.Adapter.Abstract;
- using Muchinfo.MTPClient.Adapter.Utilities;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Data.Model.Account;
- namespace Muchinfo.MTPClient.Adapter.ProtoBuf
- {
- public class AnnouncementProtoAdapter : AnnouncementAdapter
- {
- public override Data.ResponeEntity<List<Data.Model.Announcement>> ToLocalQueryClientBM(object obj)
- {
- return null;
- //var buffer = obj as byte[];
- //if (buffer == null)
- //{
- // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
- //}
- //var rspData = ProtoBufHelper.EntityDeSerialize<QueryClientBMRsp>(buffer);
- //var resultEntity = new ResponeEntity<List<Announcement>>()
- //{
- // RetCode = rspData.RetCode,
- // RetMessage = rspData.RetDesc,
- // Entity = new List<Announcement>(),
- //};
- //if (rspData.Rsps == null || !rspData.Rsps.Any())
- //{
- // //todo:查询内容空
- // return resultEntity;
- //}
- //foreach (var item in rspData.Rsps)
- //{
- // var announcement = new Announcement()
- // {
- // MsgID = item.MsgID,
- // MsgType = (Muchinfo.MTPClient.Data.Enums.MsgTypeEnum)item.MsgType,
- // PublishDate =ToDateTime(item.PublishDate),
- // Title = Encoding.UTF8.GetString(item.Title),
- // Content = Encoding.UTF8.GetString(item.Content),
- // PubAccountCode = item.PubAccountCode,
- // ValidDate = ToDateTime(item.ValidDate),
- // RecvAccountType = (eAccountType)item.RecvAccountType,
- // PubExchName = item.PubExchName,
- // PubAccountType = (eAccountType)item.PubAccountType,
- // ReadStatus = item.ReadStatus,
- // RiskLevel = item.RiskLevel,
- // };
- // resultEntity.Entity.Add(announcement);
- //}
- //return resultEntity;
- }
- public override byte[] ToRequestQueryClientBM(QueryClientBMParam clientBMPar)
- {
- return null;
- //if (clientBMPar.TradeAccount == null) return null;
- //Data.Enums.ClientRiskNtfType riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType;
- //switch (clientBMPar.TradeAccount.AccountType)
- //{
- // case eUserType.USERTYPE_INVESTOR:
- // riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType;
- // break;
- // default:
- // riskNtfType = Data.Enums.ClientRiskNtfType.MemberRiskNtfType;
- // break;
- //}
- //var queryClientBM = new QueryClientBMReq()
- //{
- // StartDate =new DateTime(clientBMPar.StartDate.Year, clientBMPar.StartDate.Month, clientBMPar.StartDate.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss"),
- // EndDate = new DateTime(clientBMPar.EndDate.Year, clientBMPar.EndDate.Month, clientBMPar.EndDate.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss"),
- // MsgType = (int)clientBMPar.MsgTypeEnum,
- // AccountType =(int)clientBMPar.TradeAccount.AccountType,
- // RiskNtfType = (int)riskNtfType,
- // AccountCode = clientBMPar.TradeAccount.AccountCode,
- // AreaCode = clientBMPar.TradeAccount.AreaCode,
- // MemberCode = clientBMPar.TradeAccount.MemberCode,
- // Title = clientBMPar.Title,
- // IsValid = (int)IsValidType.Valid,
- // PageInfo = new tas.QueryReqPageInfo()
- // {
- // NeedTotalCount = 20,
- // PageNumber=0,
- // },
- // Header=new MessageHead()
- // {
- // AccountID = clientBMPar.TradeAccount.AccountId
- // }
- //};
-
- //return ProtoBufHelper.EntitySerialize(queryClientBM);
- }
- public static DateTime ToDateTime(string dateTime)
- {
- DateTime date = DateTime.MinValue;
- DateTime.TryParse(dateTime, out date);
- return date;
- }
- public override ResponeEntity<int> ToLocalModifyBulletinNotifyStatus(object obj)
- {
- return null;
- //var byteArr = obj as byte[];
- //if (byteArr == null)
- //{
- // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
- //}
- //var modifyBulletin = ProtoBufHelper.EntityDeSerialize<ModifyBulletinNotifyStatusRsp>(byteArr);
- //var responeEntity = new ResponeEntity<int>()
- //{
- // RetCode = modifyBulletin.RetCode,
- // RetMessage = modifyBulletin.RetDesc,
- //};
- //return responeEntity;
- }
- public override byte[] ToReqeustModifyBulletinNotifyStatus(ulong accountID, long msgId, int msgType)
- {
- return null;
- //var updMsgReads = new UpdMsgReadStatus();
- //updMsgReads.AccountId = (long)accountID;
- //updMsgReads.MsgId = msgId;
- //updMsgReads.MsgType = msgType;
- //return ProtoBufHelper.EntitySerialize(updMsgReads);
- }
- }
- }
|