|
@@ -18,6 +18,8 @@ using Microsoft.VisualBasic;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
using Aspose.Words.Lists;
|
|
|
+using static OASystem.API.OAMethodLib.GeneralMethod;
|
|
|
+using TypeInfo = OASystem.Domain.ViewModels.Statistics.TypeInfo;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -1106,6 +1108,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <summary>
|
|
|
/// 企业利润
|
|
|
/// Details
|
|
|
+ /// 待添加权限验证
|
|
|
/// </summary>
|
|
|
/// <param name="_dto">团组列表请求dto</param>
|
|
|
/// <returns></returns>
|
|
@@ -1117,10 +1120,12 @@ namespace OASystem.API.Controllers
|
|
|
#region 参数验证
|
|
|
if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
|
|
|
if (_dto.PageId < 1) _dto.PageId = 38; //团组报表页面Id
|
|
|
+ if (_dto.Year < 1) return Ok(JsonView(false, "请输入有效的Year参数!"));
|
|
|
if (_dto.StatisticsType > 2 && _dto.StatisticsType < 1) return Ok(JsonView(false, "请输入有效的StatisticsType参数,1 月份 2 季度"));
|
|
|
if (_dto.BusinessType > 3 && _dto.BusinessType < 1) return Ok(JsonView(false, "请输入有效的BusinessType参数,1 所有 2 团组 3 会务"));
|
|
|
|
|
|
PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
|
|
|
+
|
|
|
#region 页面操作权限验证
|
|
|
//pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
|
|
|
|
|
@@ -1130,10 +1135,10 @@ namespace OASystem.API.Controllers
|
|
|
string sqlWhere = string.Empty;
|
|
|
|
|
|
//起止时间
|
|
|
- string beginDt = $"{_dto.Year}-01-01 00:00";
|
|
|
- string endDt = $"{_dto.Year}-12-31 59:59";
|
|
|
+ DateTime beginDt = Convert.ToDateTime( $"{_dto.Year}-01-01 00:00:00");
|
|
|
+ DateTime endDt = Convert.ToDateTime($"{_dto.Year}-12-31 23:59:59");
|
|
|
|
|
|
- sqlWhere = string.Format(@$" Where Isdel = 0 And CreateTime Between {beginDt} And {endDt}");
|
|
|
+ sqlWhere = string.Format(@$" Where Isdel = 0 ");
|
|
|
|
|
|
//业务类型
|
|
|
List<int> groupTypeId = new List<int>();
|
|
@@ -1165,7 +1170,7 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
string sql = string.Format(@$"Select * From Grp_DelegationInfo {sqlWhere}");
|
|
|
|
|
|
- var groupInfos = await _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToListAsync();
|
|
|
+ var groupInfos = await _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).Where(it => it.CreateTime >= beginDt && it.CreateTime <= endDt).ToListAsync();
|
|
|
|
|
|
if (groupInfos.Count < 1) return Ok(JsonView(false, "暂无相关团组!"));
|
|
|
|
|
@@ -1173,9 +1178,34 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
List<CorporateProfit> corporateProfits = await CorporateProfit(diIds);
|
|
|
|
|
|
+ List<MonthInfo> months = new List<MonthInfo>();
|
|
|
+ if (_dto.StatisticsType == 1) //月份
|
|
|
+ {
|
|
|
+ months = GeneralMethod.GetMonthInfos(Convert.ToInt32(_dto.Year));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (_dto.StatisticsType == 1) //季度
|
|
|
+ {
|
|
|
+ months = GeneralMethod.GetQuarter(Convert.ToInt32(_dto.Year));
|
|
|
+ }
|
|
|
|
|
|
+ List<CorporateProfitMonthView> _view = new List<CorporateProfitMonthView>();
|
|
|
+ foreach (var item in months)
|
|
|
+ {
|
|
|
+ DateTime monthBeginDt = Convert.ToDateTime($"{_dto.Year}-{item.Month}-{item.Days.BeginDays} 00:00:00");
|
|
|
+ DateTime monthEndDt = Convert.ToDateTime($"{_dto.Year}-{item.Month}-{item.Days.EndDays} 23:59:59");
|
|
|
+
|
|
|
+ var corporateProfit = corporateProfits.Where(it => it.CreateDt >= monthBeginDt && it.CreateDt <= monthEndDt).ToList();
|
|
|
+
|
|
|
+ _view.Add(new CorporateProfitMonthView()
|
|
|
+ {
|
|
|
+ Month = item.Month,
|
|
|
+ Profit = corporateProfit.Sum(it => it.ReceivedProfit),
|
|
|
+ GroupInfos = corporateProfit.OrderBy(it => it.CreateDt).ToList()
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- return Ok(JsonView(true));
|
|
|
+ return Ok(JsonView(true,"操作成功!",_view));
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
@@ -1545,7 +1575,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
DiId = _diId,
|
|
|
TeamName = groupInfo?.TeamName ?? "Unkwnon",
|
|
|
- CreateDt = groupInfo?.CreateTime.ToString("yyyy-MM-dd") ?? "Unkwnon",
|
|
|
+ CreateDt = Convert.ToDateTime(groupInfo?.CreateTime),
|
|
|
TotalExpenditure = _totalExpenditure,
|
|
|
ExpenditureItem = expenditureInfos,
|
|
|
AmountReceivable = _amountReceivable,
|
|
@@ -1558,18 +1588,379 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
return corporateProfits;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//未来预测-地区接团/出团量
|
|
|
//未来预测-地区酒店预订量
|
|
|
//未来预测-地区机票预订量
|
|
|
//未来预测-地区车辆预订量
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// (国家/城市)地区预订数量(团,酒店,机票,车辆)
|
|
|
+ /// Details
|
|
|
+ /// 待添加权限验证
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto">团组列表请求dto</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("PostRegionalBookingsNumber")]
|
|
|
+ //[JsonConverter(typeof(DecimalConverter), 2)]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostRegionalBookingsNumber(PostRegionalBookingsNumberDto _dto)
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+ if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
|
|
|
+ //if (_dto.PageId < 1) _dto.PageId = 38; //团组报表页面Id
|
|
|
+ if (_dto.Type > 1 && _dto.Type > 5) return Ok(JsonView(false, "请输入有效的Type参数,1 团 2 酒店 3 机票 4 车辆"));
|
|
|
+ if (_dto.Year < 1) return Ok(JsonView(false, "请输入有效的Year参数!"));
|
|
|
+
|
|
|
+ PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
|
|
|
+
|
|
|
+ #region 页面操作权限验证
|
|
|
+ //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
|
|
|
+
|
|
|
+ //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ string sqlWhere = string.Empty;
|
|
|
+
|
|
|
+ //起止时间
|
|
|
+ DateTime beginDt = Convert.ToDateTime($"{_dto.Year}-01-01 00:00:00");
|
|
|
+ DateTime endDt = Convert.ToDateTime($"{_dto.Year}-12-31 23:59:59");
|
|
|
+
|
|
|
+ sqlWhere = string.Format(@$" Where Isdel = 0 ");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ string sql = string.Format(@$"Select * From Grp_DelegationInfo {sqlWhere}");
|
|
|
+
|
|
|
+ var groupInfos = await _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).Where(it => it.CreateTime >= beginDt && it.CreateTime <= endDt).ToListAsync();
|
|
|
+
|
|
|
+ if (groupInfos.Count < 1) return Ok(JsonView(false, "暂无相关团组!"));
|
|
|
+
|
|
|
+ List<GroupTypeNumberInfo> datas = new List<GroupTypeNumberInfo>();
|
|
|
+ foreach (var item in groupInfos)
|
|
|
+ {
|
|
|
+ var data = await GroupBookingsNumber(_dto.Type,item);
|
|
|
+
|
|
|
+ if (data.TypeItem.Count > 0)
|
|
|
+ {
|
|
|
+ datas.Add(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //类型处理
|
|
|
+ if (_dto.Type == 1)//接团
|
|
|
+ {
|
|
|
+ List<GroupBookingNumberView> views = new List<GroupBookingNumberView>();
|
|
|
+ dynamic groupData = null;
|
|
|
+ foreach (var item in datas)
|
|
|
+ {
|
|
|
+ if (item.TypeItem.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item1 in item.TypeItem)
|
|
|
+ {
|
|
|
+ if (item1.RegionItem.Count > 0)
|
|
|
+ {
|
|
|
+ GroupInfo groupInfo = new GroupInfo()
|
|
|
+ {
|
|
|
+ DiId=item.DiId,
|
|
|
+ TeamName = item.GroupName,
|
|
|
+ CreateTime = groupInfos.Find(it => it.Id == item.DiId)?.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") ?? "Unknown",
|
|
|
+ ClientUnit = groupInfos.Find(it => it.Id == item.DiId)?.ClientUnit ?? "Unknown",
|
|
|
+ Principal = groupInfos.Find(it => it.Id == item.DiId)?.ClientName ?? "Unknown",
|
|
|
+ };
|
|
|
+ views.Add(new GroupBookingNumberView() { Name = item1.RegionItem[0].Name, Number = item1.RegionItem[0].Number, GroupItem = new List<GroupInfo>() { groupInfo } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var viewsGroup = views.GroupBy(it => it.Name);
|
|
|
+ List<GroupBookingNumberView> _view = new List<GroupBookingNumberView>();
|
|
|
+ foreach (var item in viewsGroup)
|
|
|
+ {
|
|
|
+ List<GroupInfo> infos = new List<GroupInfo>();
|
|
|
+ foreach (var item1 in item)
|
|
|
+ {
|
|
|
+ infos.AddRange(item1.GroupItem);
|
|
|
+ }
|
|
|
+ infos = infos.OrderByDescending(it => it.CreateTime).ToList(); //
|
|
|
+
|
|
|
+ _view.Add(new GroupBookingNumberView() { Name = item.Key, Number = item.Count(),GroupItem = infos });
|
|
|
+ }
|
|
|
+
|
|
|
+ _view = _view.OrderByDescending(it => it.Number).Take(10).ToList();
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功!", _view, _view.Count));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (_dto.Type == 2)
|
|
|
+ {
|
|
|
+ List<HotelBookingNumberView> views = new List<HotelBookingNumberView>();
|
|
|
+
|
|
|
+ foreach (var item in datas)
|
|
|
+ {
|
|
|
+ if (item.TypeItem.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item1 in item.TypeItem)
|
|
|
+ {
|
|
|
+ if (item1.RegionItem.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item2 in item1.RegionItem)
|
|
|
+ {
|
|
|
+ GroupInfo groupInfo = new GroupInfo()
|
|
|
+ {
|
|
|
+ DiId = item.DiId,
|
|
|
+ TeamName = item.GroupName,
|
|
|
+ CreateTime = groupInfos.Find(it => it.Id == item.DiId)?.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") ?? "Unknown",
|
|
|
+ ClientUnit = groupInfos.Find(it => it.Id == item.DiId)?.ClientUnit ?? "Unknown",
|
|
|
+ Principal = groupInfos.Find(it => it.Id == item.DiId)?.ClientName ?? "Unknown",
|
|
|
+ };
|
|
|
+
|
|
|
+ List<HotelInfo> hotels = new List<HotelInfo>();
|
|
|
+ foreach (var item3 in item2.Data)
|
|
|
+ {
|
|
|
+
|
|
|
+ StatisticsHotelInfo statisticsHotelInfos = JsonConvert.DeserializeObject<StatisticsHotelInfo>(JsonConvert.SerializeObject( item3));
|
|
|
+
|
|
|
+ HotelInfo hotelInfo = new HotelInfo()
|
|
|
+ {
|
|
|
+ HotelName = statisticsHotelInfos.HotelName,
|
|
|
+ SingleRoomNum = statisticsHotelInfos.SingleRoomNum,
|
|
|
+ DoubleRoomNum = statisticsHotelInfos.DoubleRoomNum,
|
|
|
+ SuiteRoomNum = statisticsHotelInfos.SuiteRoomNum,
|
|
|
+ OtherRoomNum = statisticsHotelInfos.OtherRoomNum,
|
|
|
+ GroupInfo = groupInfo
|
|
|
+ };
|
|
|
+ hotels.Add(hotelInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ views.Add(new HotelBookingNumberView() { Name = item1.RegionItem[0].Name, Number = item1.RegionItem[0].Number, HotelItem = hotels });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var viewsGroup = views.GroupBy(it => it.Name);
|
|
|
+ List<HotelBookingNumberView> _view = new List<HotelBookingNumberView>();
|
|
|
+
|
|
|
+ foreach (var item in viewsGroup)
|
|
|
+ {
|
|
|
+ List<HotelInfo> infos = new List<HotelInfo>();
|
|
|
+ foreach (var item1 in item)
|
|
|
+ {
|
|
|
+ infos.AddRange(item1.HotelItem);
|
|
|
+ }
|
|
|
+ _view.Add(new HotelBookingNumberView() { Name = item.Key, Number = item.Count(), HotelItem = infos });
|
|
|
+ }
|
|
|
+
|
|
|
+ _view = _view.OrderByDescending(it => it.Number).Take(10).ToList();
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功!", views, views.Count));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(false, "操作失败!"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 计算团组ALLType预订数量
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="diIds"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<GroupTypeNumberInfo> GroupBookingsNumber(int type, Grp_DelegationInfo info)
|
|
|
+ {
|
|
|
+ GroupTypeNumberInfo _view = new GroupTypeNumberInfo();
|
|
|
+ if (info == null)
|
|
|
+ {
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
+ _view.DiId = info.Id;
|
|
|
+ _view.GroupName = info.TeamName;
|
|
|
+ List<TypeInfo> _types = new List<TypeInfo>();
|
|
|
+ #region 计算团组ALLType预订数量
|
|
|
+
|
|
|
+ if (type == 1)
|
|
|
+ {
|
|
|
+ //接团 客户集团所在地区
|
|
|
+ string group_region = string.Empty;
|
|
|
+ int group_number = 0;
|
|
|
+ if (!string.IsNullOrEmpty(info.ClientUnit))
|
|
|
+ {
|
|
|
+ var _NewClientData = await _sqlSugar.Queryable<Crm_NewClientData>().Where(it => it.IsDel == 0 && it.Client.Equals(info.ClientUnit)).FirstAsync();
|
|
|
+ if (_NewClientData != null)
|
|
|
+ {
|
|
|
+ var regionInfo = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == _NewClientData.Lvlid).FirstAsync();
|
|
|
+ if (regionInfo != null)
|
|
|
+ {
|
|
|
+ group_region = regionInfo.Name.Replace("级", "");
|
|
|
+ group_number++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (group_number > 0)
|
|
|
+ {
|
|
|
+ _types.Add(new TypeInfo() { Id = 1, RegionItem = new List<RegionInfo>() { new RegionInfo() { Name = group_region, Number = group_number } } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 2)
|
|
|
+ {
|
|
|
+ //酒店
|
|
|
+ var hotelInfos = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == info.Id).ToListAsync();
|
|
|
+
|
|
|
+ if (hotelInfos.Count > 0)
|
|
|
+ {
|
|
|
+ List<RegionInfo> hotelRegions = new List<RegionInfo>();
|
|
|
+ foreach (var item in hotelInfos)
|
|
|
+ {
|
|
|
+ var hotelNumberInfo = new StatisticsHotelInfo()
|
|
|
+ {
|
|
|
+ HotelName = item.HotelName,
|
|
|
+ SingleRoomNum = item.SingleRoomCount,
|
|
|
+ DoubleRoomNum = item.DoubleRoomCount,
|
|
|
+ SuiteRoomNum = item.SuiteRoomCount,
|
|
|
+ OtherRoomNum = item.OtherRoomCount,
|
|
|
+ };
|
|
|
+ int hotelRoomTotal = item.SingleRoomCount + item.DoubleRoomCount + item.SuiteRoomCount + item.OtherRoomCount;
|
|
|
+ if (hotelRegions.Select(it => it.Name).ToList().Contains(item.City))
|
|
|
+ {
|
|
|
+ RegionInfo hotelRegion = hotelRegions.Find(it => it.Name.Equals(item.City));
|
|
|
+ if (hotelRegion != null)
|
|
|
+ {
|
|
|
+ hotelRegions.Remove(hotelRegion);
|
|
|
+ if (hotelRegion.Data.Count > 0)
|
|
|
+ {
|
|
|
+ hotelRegion.Data.Add(hotelNumberInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ hotelRegion.Number += hotelRoomTotal;
|
|
|
+ hotelRegions.Add(hotelRegion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ hotelRegions.Add(new RegionInfo() { Name = item.City, Number = hotelRoomTotal, Data = new List<dynamic>() { hotelNumberInfo } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _types.Add(new TypeInfo() { Id = 2, RegionItem = hotelRegions });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 3)
|
|
|
+ {
|
|
|
+ //机票
|
|
|
+ var airTicketInfos = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .LeftJoin<Grp_CreditCardPayment>((atr, ccp) => atr.Id == ccp.CId && ccp.IsPay == 1)
|
|
|
+ .LeftJoin<Sys_SetData>((atr, ccp, sd) => atr.CType == sd.Id)
|
|
|
+ .Where((atr, ccp, sd) => atr.IsDel == 0 && atr.DIId == info.Id)
|
|
|
+ .Select((atr, ccp, sd) => new { atr.ClientNum, atr.CType, ccp.Payee, AirType = sd.Name })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ if (airTicketInfos.Count > 0)
|
|
|
+ {
|
|
|
+ List<RegionInfo> airTicketRegions = new List<RegionInfo>();
|
|
|
+ foreach (var item in airTicketInfos)
|
|
|
+ {
|
|
|
+ var ticketClass = new
|
|
|
+ {
|
|
|
+ TiketClass = item.AirType,
|
|
|
+ Number = item.ClientNum
|
|
|
+ };
|
|
|
+
|
|
|
+ if (airTicketRegions.Select(it => it.Name).ToList().Contains(item.Payee))
|
|
|
+ {
|
|
|
+ RegionInfo airTicketRegion = airTicketRegions.Find(it => it.Name.Equals(item.Payee));
|
|
|
+ if (airTicketRegion != null)
|
|
|
+ {
|
|
|
+ airTicketRegions.Remove(airTicketRegion);
|
|
|
+ if (airTicketRegion.Data.Count > 0)
|
|
|
+ {
|
|
|
+ airTicketRegion.Data.Add(ticketClass);
|
|
|
+ }
|
|
|
+
|
|
|
+ airTicketRegion.Number += item.ClientNum;
|
|
|
+ airTicketRegions.Add(airTicketRegion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ airTicketRegions.Add(new RegionInfo() { Name = item.Payee, Number = item.ClientNum, Data = new List<dynamic>() { ticketClass } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _types.Add(new TypeInfo() { Id = 3, RegionItem = airTicketRegions });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 4)
|
|
|
+ {
|
|
|
+ //车辆
|
|
|
+ var opInfos = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().Where(it => it.IsDel == 0 && it.DiId == info.Id).ToListAsync();
|
|
|
+ var opContentInfos = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == info.Id).ToListAsync();
|
|
|
+ if (opInfos.Count > 0)
|
|
|
+ {
|
|
|
+ List<RegionInfo> opRegions = new List<RegionInfo>();
|
|
|
+
|
|
|
+ foreach (var item in opInfos)
|
|
|
+ {
|
|
|
+ int carNum = 0;
|
|
|
+ var opContentInfo = opContentInfos.Where(it => it.CTGGRId == item.Id && it.SId == 91).ToList();
|
|
|
+
|
|
|
+ if (opContentInfo.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item1 in opContentInfo)
|
|
|
+ {
|
|
|
+ if (item1.Price > 0 && item1.Count > 0)
|
|
|
+ {
|
|
|
+ carNum += item1.Count;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (carNum > 0)
|
|
|
+ {
|
|
|
+ var opData = new
|
|
|
+ {
|
|
|
+ ServiceCompany = item.ServiceCompany,
|
|
|
+ BusName = item.BusName,
|
|
|
+ Numbuer = carNum
|
|
|
+ };
|
|
|
+ if (opRegions.Select(it => it.Name).ToList().Contains(item.Area))
|
|
|
+ {
|
|
|
+ RegionInfo opRegion = opRegions.Find(it => it.Name.Equals(item.Area));
|
|
|
+ if (opRegion != null)
|
|
|
+ {
|
|
|
+ opRegions.Remove(opRegion);
|
|
|
+ if (opRegion.Data.Count > 0)
|
|
|
+ {
|
|
|
+ opRegion.Data.Add(opData);
|
|
|
+ }
|
|
|
+
|
|
|
+ opRegion.Number += carNum;
|
|
|
+ opRegions.Add(opRegion);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ opRegions.Add(new RegionInfo() { Name = item.Area, Number = carNum, Data = new List<dynamic>() { opData } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ _types.Add(new TypeInfo() { Id = 4, RegionItem = opRegions });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ _view.TypeItem = _types;
|
|
|
+
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
}
|