public OperationResult Post3rdPointsBySiteLocation(Boolean isPost3rdPointsBySiteLocation, thirdparty param) { var result = new OperationResult(); var ip = HostIP.GetHostAddress(); //CommomMethods.visitLog(2, param.bankID, userID); try { using (var db = new HeatMapEntities()) { var data = db.Pro_GetAnywhere3rdData(param.lat, param.lng, param.radius, (int)PointType.Work).ToList().Select(x => new { lng = x.Longitude, lat = x.Latitude, thirdParty = Convert.ToInt32(x.UserCount), CMBAPPCount = x.CMBAPPCount }); result.ReturnData = data; result.ReturnCode = 1; } } catch (Exception ex) { result.Message = ex.Message; result.ReturnCode = 0; Logger.Log.Error(ex.StackTrace); } return(result); }
/// <summary> /// 获取网点相关数据 /// </summary> /// <param name="isGetPointsBySite"></param> /// <param name="userID"></param> /// <param name="param"></param> /// <returns></returns> public OperationResult PostPointsBySite(Boolean isGetPointsBySite, string userID, siteParams param) { var result = new OperationResult(); List <HeatmapPoint> CMBData = new List <HeatmapPoint>(); List <_3rdPartyPoints> _3rdPartyData = new List <_3rdPartyPoints>(); var ip = HostIP.GetHostAddress(); int aum11 = 0, aum12 = 0, aum13 = 0, aum14 = 0, aum15 = 0, aum16 = 0, ump21 = 0, ump22 = 0, ump23 = 0, tCount = 0; var AumStatisticList = new List <Pro_GetAnywhereAUMStatisticsData_Result>(); var UmpStatisticList = new List <Pro_GetAnywhereUMPStatisticsData_Result>(); CommomMethods.visitLog(2, param.bankID, userID); try { using (var db = new HeatMapEntities()) { CMBData = db.Pro_GetBankData(param.bankID, param.type, param.isAum, param.AUMLevel, param.UMPLlevel, param.isNoDF, param.isCheck, param.distance).Select(x => new HeatmapPoint { lng = x.Longitude, lat = x.Latitude, userCount = x.UserCount, aumCount = x.AUMMoney, deposit = x.DepositMoney, Distance = x.Distance, AUM_level = x.AUM_level, UMP_level = x.UMP_level }).ToList(); var statisticData = db.Pro_GetBankStatistics(param.bankID, param.isAum, param.AUMLevel, param.UMPLlevel, param.isNoDF).ToList(); if (param.type == 1 || param.type == 2) { tCount = (int)db.Pro_GetTwoBranchUserCount(param.bankID).FirstOrDefault().UserCount; foreach (var point in statisticData) { //AUM统计 switch (point.AUM_level) { case 11: aum11 += (int)point.UserCount; break; case 12: aum12 += (int)point.UserCount; break; case 13: aum13 += (int)point.UserCount; break; case 14: aum14 += (int)point.UserCount; break; case 15: aum15 += (int)point.UserCount; break; case 16: aum16 += (int)point.UserCount; break; default: break; } //UMP统计 switch (point.UMP_level) { case 21: ump21 += (int)point.UserCount; break; case 22: ump22 += (int)point.UserCount; break; case 23: ump23 += (int)point.UserCount; break; default: break; } } } else if (param.type == 3 || param.type == 4) { tCount = (int)CMBData.Sum(x => x.userCount); foreach (var point in CMBData) { //AUM统计 switch (point.AUM_level) { case 11: aum11 += (int)point.userCount; break; case 12: aum12 += (int)point.userCount; break; case 13: aum13 += (int)point.userCount; break; case 14: aum14 += (int)point.userCount; break; case 15: aum15 += (int)point.userCount; break; case 16: aum16 += (int)point.userCount; break; default: break; } //UMP统计 switch (point.UMP_level) { case 21: ump21 += (int)point.userCount; break; case 22: ump22 += (int)point.userCount; break; case 23: ump23 += (int)point.userCount; break; default: break; } } } AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 11, AUM_Name = "零资产", UserCount = aum11, Total = tCount, Percent = aum11 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 12, AUM_Name = "非零不达标基客", UserCount = aum12, Total = tCount, Percent = aum12 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 13, AUM_Name = "达标基客", UserCount = aum13, Total = tCount, Percent = aum13 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 14, AUM_Name = "金卡", UserCount = aum14, Total = tCount, Percent = aum14 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 15, AUM_Name = "金葵花", UserCount = aum15, Total = tCount, Percent = aum15 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 16, AUM_Name = "私钻", UserCount = aum16, Total = tCount, Percent = aum16 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 21, UMP_Name = "潜力金卡", UserCount = ump21, Total = tCount, Percent = ump21 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 22, UMP_Name = "潜力金葵花", UserCount = ump22, Total = tCount, Percent = ump22 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 23, UMP_Name = "潜力私钻", UserCount = ump23, Total = tCount, Percent = ump23 * 100 / (decimal)tCount }); var PoiStatisticData = CommomMethods.GetSitePoiStatisticData(param.bankID); if (param.type == 3 || param.type == 4) { _3rdPartyData = db.Pro_GetAnywhere3rdData(param.lat, param.lng, param.distance, (int)PointType.Work).Select(x => new _3rdPartyPoints { lng = x.Longitude, lat = x.Latitude, thirdParty = Convert.ToInt32(x.UserCount), Distance = x.Distance }).ToList(); var sitePonetranceList = CommomMethods.CalSiteRelPonetrance(CMBData, _3rdPartyData); result.ReturnData = new { CMBData = CMBData, _3rdPartyData = _3rdPartyData, PoiStatisticData = PoiStatisticData, sitePonetranceData = sitePonetranceList, AumStatisticList = AumStatisticList, UmpStatisticList = UmpStatisticList }; } else { result.ReturnData = new { CMBData = CMBData, PoiStatisticData = PoiStatisticData, AumStatisticList = AumStatisticList, UmpStatisticList = UmpStatisticList }; } result.ReturnCode = 1; } } catch (Exception ex) { result.Message = ex.Message; result.ReturnCode = 0; Logger.Log.Error(ex.StackTrace); } return(result); }
public OperationResult GetPointsByCircleCenter(decimal radius, decimal lat, decimal lng, string userID) { var result = new OperationResult(); CommomMethods.visitLog(3, 0, userID); try { using (var db = new HeatMapEntities()) { int aum11 = 0, aum12 = 0, aum13 = 0, aum14 = 0, aum15 = 0, aum16 = 0, ump21 = 0, ump22 = 0, ump23 = 0, tCount = 0; var cmbDataList = new List <HeatmapPoint>(); var AumStatisticList = new List <Pro_GetAnywhereAUMStatisticsData_Result>(); var UmpStatisticList = new List <Pro_GetAnywhereUMPStatisticsData_Result>(); var data = db.Pro_GetAnywhereData(lat, lng, radius).ToList(); tCount = data.Count(); foreach (var point in data) { //描点数据 cmbDataList.Add(new HeatmapPoint { lat = point.Latitude, lng = point.Longitude, userCount = point.UserCount, aumCount = point.AUMMoney, deposit = point.DepositMoney }); //AUM统计 switch (point.AUM_level) { case 11: aum11 += (int)point.UserCount; break; case 12: aum12 += (int)point.UserCount; break; case 13: aum13 += (int)point.UserCount; break; case 14: aum14 += (int)point.UserCount; break; case 15: aum15 += (int)point.UserCount; break; case 16: aum16 += (int)point.UserCount; break; default: break; } //ump统计 if (point.AUM_level <= 13) { switch (point.UMP_level) { case 21: ump21 += (int)point.UserCount; break; case 22: ump22 += (int)point.UserCount; break; case 23: ump23 += (int)point.UserCount; break; default: break; } } } AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 11, AUM_Name = "零资产", UserCount = aum11, Total = tCount, Percent = aum11 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 12, AUM_Name = "非零不达标基客", UserCount = aum12, Total = tCount, Percent = aum12 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 13, AUM_Name = "达标基客", UserCount = aum13, Total = tCount, Percent = aum13 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 14, AUM_Name = "金卡", UserCount = aum14, Total = tCount, Percent = aum14 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 15, AUM_Name = "金葵花", UserCount = aum15, Total = tCount, Percent = aum15 * 100 / (decimal)tCount }); AumStatisticList.Add(new Pro_GetAnywhereAUMStatisticsData_Result { AUM_level = 16, AUM_Name = "私钻", UserCount = aum16, Total = tCount, Percent = aum16 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 21, UMP_Name = "潜力金卡", UserCount = ump21, Total = tCount, Percent = ump21 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 22, UMP_Name = "潜力金葵花", UserCount = ump22, Total = tCount, Percent = ump22 * 100 / (decimal)tCount }); UmpStatisticList.Add(new Pro_GetAnywhereUMPStatisticsData_Result { UMP_level = 23, UMP_Name = "潜力私钻", UserCount = ump23, Total = tCount, Percent = ump23 * 100 / (decimal)tCount }); //导出统计数据到excel //excel头部 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "name", "类别" }, { "count", "数量" }, { "percent", "百分比" }, }; var statisticDataList = new List <statistic_2>(); foreach (var item in AumStatisticList) { statisticDataList.Add(new statistic_2 { name = item.AUM_Name, count = item.UserCount.ToString(), percent = Math.Round((decimal)item.Percent, 2).ToString() + "%", }); } foreach (var item in UmpStatisticList) { statisticDataList.Add(new statistic_2 { name = item.UMP_Name, count = item.UserCount.ToString(), percent = Math.Round((decimal)item.Percent, 2).ToString() + "%", }); } var _3rdPartyData = db.Pro_GetAnywhere3rdData(lat, lng, radius, (int)PointType.Work).Select(x => new { lng = x.Longitude, lat = x.Latitude, thirdParty = Convert.ToInt32(x.UserCount), CMBAPPCount = x.CMBAPPCount }).ToList(); //计算招行客户数量和第三方客户数量 var cmbUserCount = cmbDataList.Sum(x => x.userCount); var _3rdPartyUserCount = _3rdPartyData.Sum(x => x.thirdParty); if (cmbUserCount >= _3rdPartyUserCount) { _3rdPartyUserCount = (int)cmbUserCount; } statisticDataList.Add(new statistic_2 { name = "招行客户", count = cmbUserCount.ToString(), percent = Math.Round(((decimal)cmbUserCount * 100 / _3rdPartyUserCount), 2).ToString() + "%", }); statisticDataList.Add(new statistic_2 { name = "其它用户", count = (_3rdPartyUserCount - cmbUserCount).ToString(), percent = Math.Round(((decimal)(_3rdPartyUserCount - cmbUserCount) * 100 / _3rdPartyUserCount), 2).ToString() + "%", }); var url = ExcelHelper.EntityListToExcel2003(cellheader, statisticDataList, "统计"); result.ReturnData = new { CMBData = cmbDataList, _3rdPartyData = _3rdPartyData, AUMData = AumStatisticList, UMPData = UmpStatisticList, url = url }; result.ReturnCode = 1; } } catch (Exception ex) { result.Message = ex.Message; result.ReturnCode = 0; Logger.Log.Error(ex.StackTrace); } return(result); }