lixiaojun
2022-11-23 48bf955aa337d70111afcc0ff87e0e0671b510c8
Service/IStation.Service.Product/sim/sim_payment_record/SimPaymentRecord.cs
ÎļþÃû´Ó Service/IStation.Service.Product/iot/iot_payment_record/IotPaymentRecord.cs ÐÞ¸Ä
@@ -10,21 +10,21 @@
    /// <summary>
    /// ç‰©è”卡缴费记录
    /// </summary>
    public partial class IotPaymentRecord
    public partial class SimPaymentRecord
    {
        #region Cache
        //通过 CorpID èŽ·å–ç¼“å­˜
        private List<Model.IotPaymentRecord> GetCorpCache(long CorpID)
        private List<Model.SimPaymentRecord> GetCorpCache(long CorpID)
        {
            return IotPaymentRecordCacheHelper.GetSet(CorpID, () =>
            return SimPaymentRecordCacheHelper.GetSet(CorpID, () =>
            {
                var dal = new DAL.IotPaymentRecord();
                var dal = new DAL.SimPaymentRecord();
                var entity_list = dal.GetByCorpID(CorpID);
                var model_list = Entity2Models(entity_list);
                if (model_list == null)
                {
                    model_list = new List<Model.IotPaymentRecord>();
                    model_list = new List<Model.SimPaymentRecord>();
                }
                return model_list;
            }, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime);
@@ -33,7 +33,7 @@
        //通过 ID æ›´æ–°ç¼“å­˜
        internal void UpdateCorpCache(long CorpID, long ID)
        {
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity_ds = dal.GetByID(CorpID, ID);
            var model_ds = Entity2Model(entity_ds);
            var all = GetCorpCache(CorpID);
@@ -53,7 +53,7 @@
        {
            if (Ids == null || Ids.Count() < 1)
                return;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity_list = dal.GetByIds(CorpID, Ids);
            var model_list = Entity2Models(entity_list);
            var all = GetCorpCache(CorpID);
@@ -78,7 +78,7 @@
        /// <summary>
        /// é€šè¿‡ CorpID èŽ·å–
        /// </summary>
        public List<Model.IotPaymentRecord> GetByCorpID(long CorpID)
        public List<Model.SimPaymentRecord> GetByCorpID(long CorpID)
        {
            var all = GetCorpCache(CorpID);
            return all.OrderBy(x=>x.PaymentTime).ToList();
@@ -87,7 +87,7 @@
        /// <summary>
        ///  é€šè¿‡ ID èŽ·å–
        /// </summary>
        public Model.IotPaymentRecord GetByID(long CorpID, long ID)
        public Model.SimPaymentRecord GetByID(long CorpID, long ID)
        {
            var all = GetByCorpID(CorpID);
            return all.Find(x => x.ID == ID);
@@ -96,7 +96,7 @@
        /// <summary>
        /// é€šè¿‡ Ids获取
        /// </summary>
        public List<Model.IotPaymentRecord> GetByIds(long CorpID, List<long> Ids)
        public List<Model.SimPaymentRecord> GetByIds(long CorpID, List<long> Ids)
        {
            if (Ids == null || Ids.Count() < 1)
                return default;
@@ -105,35 +105,35 @@
        }
        /// <summary>
        /// é€šè¿‡ ProductID èŽ·å–
        /// é€šè¿‡ CardID èŽ·å–
        /// </summary>
        public List<Model.IotPaymentRecord> GetByProductID(long CorpID, long ProductID)
        public List<Model.SimPaymentRecord> GetByCardID(long CorpID, long CardID)
        {
            var all = GetByCorpID(CorpID);
            return all.Where(x => x.ProductID == ProductID).OrderBy(x => x.PaymentTime).ToList();
            return all.Where(x => x.CardID == CardID).OrderBy(x => x.PaymentTime).ToList();
        }
        /// <summary>
        /// é€šè¿‡ ProductIds èŽ·å–
        /// é€šè¿‡ CardIds èŽ·å–
        /// </summary>
        public List<Model.IotPaymentRecord> GetByProductIds(long CorpID, List<long> ProductIds)
        public List<Model.SimPaymentRecord> GetByCardIds(long CorpID, List<long> CardIds)
        {
            if (ProductIds == null || ProductIds.Count < 1)
            if (CardIds == null || CardIds.Count < 1)
                return default;
            var all=GetByCorpID(CorpID);
            return all.Where(x => ProductIds.Contains(x.ProductID)).OrderBy(x => x.PaymentTime).ToList();
            return all.Where(x => CardIds.Contains(x.CardID)).OrderBy(x => x.PaymentTime).ToList();
        }
        /// <summary>
        /// é€šè¿‡ BelongType å’Œ BelongID èŽ·å–
        /// </summary>
        public List<Model.IotPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID)
        public List<Model.SimPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID)
        {
            var productList = new Product().GetByBelongTypeAndBelongID(CorpID,BelongType,BelongID);
            if (productList == null || productList.Count < 1)
                return default;
            var all = GetByCorpID(CorpID);
            var list = (from x in all join y in productList on x.ProductID equals y.ID orderby x.PaymentTime select x).ToList();
            var list = (from x in all join y in productList on x.CardID equals y.ID orderby x.PaymentTime select x).ToList();
            return list;
        }
@@ -144,14 +144,14 @@
        /// <summary>
        /// æ’入一条数据
        /// </summary>
        public long Insert(Model.IotPaymentRecord model)
        public long Insert(Model.SimPaymentRecord model)
        {
            if (model == null)
                return default;
            if (model.CorpID < 1)
                return default;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity = Model2Entity(model);
            var id = dal.Insert(entity);
            if (id > 0)
@@ -164,14 +164,14 @@
        /// <summary>
        /// æ’入多条
        /// </summary>
        public bool Inserts(IEnumerable<Model.IotPaymentRecord> list)
        public bool Inserts(IEnumerable<Model.SimPaymentRecord> list)
        {
            if (list == null || list.Count() < 1)
                return default;
            var corpIds = list.Select(x => x.CorpID).Distinct().ToList();
            if (corpIds.Count != 1 || corpIds[0] < 1)
                return default;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity_list = Model2Entities(list.ToList());
            var ids = dal.InsertsR(entity_list);
            if (ids != null && ids.Count > 0)
@@ -189,7 +189,7 @@
        /// <summary>
        /// æ›´æ–°ä¸€æ¡
        /// </summary>
        public bool Update(Model.IotPaymentRecord model)
        public bool Update(Model.SimPaymentRecord model)
        {
            if (model == null)
                return default;
@@ -197,7 +197,7 @@
                return default;
            if (model.ID < 1)
                return default;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity = Model2Entity(model);
            var bol = dal.Update(entity);
            if (bol)
@@ -210,7 +210,7 @@
        /// <summary>
        /// æ‰¹é‡æ›´æ–°
        /// </summary>
        public bool Updates(List<Model.IotPaymentRecord> list)
        public bool Updates(List<Model.SimPaymentRecord> list)
        {
            if (list == null || list.Count() < 1)
                return default;
@@ -219,7 +219,7 @@
                return default;
            if (list.ToList().Exists(x => x.ID < 1))
                return default;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var entity_list = Model2Entities(list.ToList());
            var bol = dal.Updates(entity_list);
            if (bol)
@@ -240,7 +240,7 @@
        public bool DeleteByID(long CorpID, long ID, out string Msg)
        {
            Msg = string.Empty;
            var dal = new DAL.IotPaymentRecord();
            var dal = new DAL.SimPaymentRecord();
            var bol = dal.DeleteByID(CorpID, ID);
            if (bol)
            {