public CompanyScoreOperationModel(CompanyScoreOperationModel operation)
 {
     this.CompanyId= operation.CompanyId;
     this.LastScore = operation.LastScore;
     this.LastScoreType = operation.LastScoreType;
     this.CurrentScore = operation.CurrentScore;
     this.CurrentScoreType = operation.CurrentScoreType;
     this.OperationScore = operation.OperationScore;
 }
Пример #2
0
        /// <summary>
        /// 获取公司积分操作列表
        /// </summary>
        /// <param name="companyList">1:公司列表-未去重</param>
        /// <returns>List{CompanyScoreOperationModel}.</returns>
        public List<CompanyScoreOperationModel> CreateScoreOperationList(List<CompanyFollowUpModel> companyList)
        {
            // 1:公司列表-去重得到
            IEnumerable<int> dictinctCompanyList = companyList.Select(o => o.CompanyId).Distinct().ToArray();

            // 2:鲜花鸡蛋评价日志列表-由公司列表获得-大集合
            List<RemarkLogInfoModel> remarkLogList = this.GetRemarkList(dictinctCompanyList).FindAll(n => n.IsUsedFlowerRemark());

            // 3:匹配并统计积分:
            List<CompanyScoreOperationModel> companyScoreOperationList = new List<CompanyScoreOperationModel>();
            foreach (var followInfo in companyList)
            {
                CompanyScoreOperationModel operation = new CompanyScoreOperationModel(followInfo.CompanyId, followInfo.OwnerSoufunId, followInfo.FollowId);
                RemarkLogInfoModel matchRemarkLog = remarkLogList.Where(o => o.MatchesWith(followInfo))
                                                                                                         .OrderByDescending(m => m.Id)
                                                                                                         .FirstOrDefault();
                // 没有积分结算记录
                if (matchRemarkLog == null)
                {
                    operation.Calculate(followInfo);
                }
                else
                {
                    operation.Calculate(followInfo, matchRemarkLog);
                }

                if (operation.Enable)
                {
                    companyScoreOperationList.Add(operation);
                }
            }
            return companyScoreOperationList;
        }