|
@@ -73,6 +73,7 @@ using OASystem.Domain.ViewModels.Statistics;
|
|
using NPOI.XSSF.Model;
|
|
using NPOI.XSSF.Model;
|
|
using NetTaste;
|
|
using NetTaste;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
+using EyeSoft.Collections.Generic;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
namespace OASystem.API.Controllers
|
|
{
|
|
{
|
|
@@ -5802,7 +5803,7 @@ namespace OASystem.API.Controllers
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- jw.Msg = "城市数据未空!";
|
|
|
|
|
|
+ jw.Msg = "城市数据为空!";
|
|
jw.Data = new string[0];
|
|
jw.Data = new string[0];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -9002,46 +9003,159 @@ namespace OASystem.API.Controllers
|
|
return Ok(jw);
|
|
return Ok(jw);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 成本获取OP历史车费用
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
[HttpPost]
|
|
[HttpPost]
|
|
public async Task<IActionResult> GetHistoryCarData(HistoryCarDataDto dto)
|
|
public async Task<IActionResult> GetHistoryCarData(HistoryCarDataDto dto)
|
|
{
|
|
{
|
|
var jw = JsonView(false);
|
|
var jw = JsonView(false);
|
|
- List<HistoryCarDataView> view = new List<HistoryCarDataView>();
|
|
|
|
- //获取现有所有车的数据
|
|
|
|
- if (dto.Param.IsNullOrWhiteSpace())
|
|
|
|
|
|
+
|
|
|
|
+ try
|
|
{
|
|
{
|
|
- if (dto.Param.Contains("、")) //
|
|
|
|
|
|
+ List<HistoryCarDataView> dbResult = new List<HistoryCarDataView>();
|
|
|
|
+ //获取现有所有车的数据
|
|
|
|
+ if (!dto.Param.IsNullOrWhiteSpace())
|
|
{
|
|
{
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ string sql = $@"
|
|
|
|
+SELECT gdi.TeamName , gctggr.Area, gctggr.PriceName , gctggrc.Id ,gctggrc.Price , gctggrc.DatePrice , gctggrc.PriceContent , gctggrc.Currency , gctggr.ServiceStartTime , gctggr.ServiceEndTime
|
|
|
|
+FROM Grp_CarTouristGuideGroundReservationsContent gctggrc inner join Grp_CarTouristGuideGroundReservations gctggr on
|
|
|
|
+gctggrc.CTGGRId = gctggr.Id inner JOIN Grp_DelegationInfo gdi on gctggr.DiId = gdi.Id LEFT JOIN Sys_SetData ssd on ssd.Id = gctggr.PriceType
|
|
|
|
+WHERE gctggr.IsDel = 0 and gctggrc.SId = 91 AND gdi.IsDel = 0 AND gctggrc.Price != 0 AND (ssd.Id in (1061,1069) or ssd.Id is NULL) AND gctggr.ServiceStartTime is not null
|
|
|
|
+AND gctggr.ServiceEndTime is not NULL
|
|
|
|
+ORDER by gctggrc.id DESC
|
|
|
|
+";
|
|
|
|
+
|
|
|
|
+ dbResult = await _sqlSugar.SqlQueryable<HistoryCarDataView>(sql).ToListAsync();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ var numeberResult = await Task.Run(() =>
|
|
|
|
+ {
|
|
|
|
+ var numberArr = dbResult.Where(x => int.TryParse(x.Area, out int number)).ToList();
|
|
|
|
+ _ = dbResult.RemoveAll(x => int.TryParse(x.Area, out int number));
|
|
|
|
+ return numberArr;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var cityArr = await _sqlSugar.Queryable<Grp_NationalTravelFee>().ToListAsync();
|
|
|
|
+
|
|
|
|
+ foreach (var item in numeberResult)
|
|
|
|
+ {
|
|
|
|
+ var find = cityArr.Find(x => x.Id == int.Parse(item.Area)) ?? new Grp_NationalTravelFee
|
|
|
|
+ {
|
|
|
|
+ Country = "数据异常!",
|
|
|
|
+ City = string.Empty,
|
|
|
|
+ };
|
|
|
|
+ item.Area = find.Country + " " + find.City;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dbResult.AddRange(numeberResult);
|
|
|
|
+
|
|
|
|
+ if (dto.Param.Contains("、"))
|
|
|
|
+ {
|
|
|
|
+ var sp = dto.Param.Split("、");
|
|
|
|
+ dbResult = dbResult.AsParallel().WithDegreeOfParallelism(Environment.ProcessorCount)
|
|
|
|
+ .Where(x =>
|
|
|
|
+ {
|
|
|
|
+ return System.Array.Exists(sp, e =>
|
|
|
|
+ {
|
|
|
|
+ bool where = false;
|
|
|
|
+ if (x.Area != null)
|
|
|
|
+ {
|
|
|
|
+ where = x.Area.Contains(e);
|
|
|
|
+ if (x.Area.Contains("尾款") || x.PriceName.Contains("尾款"))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (x.PriceName != null && !where)
|
|
|
|
+ {
|
|
|
|
+ where = x.PriceName.Contains(e);
|
|
|
|
+ if (x.PriceName.Contains("尾款") || x.PriceName.Contains("尾款"))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return where;
|
|
|
|
+ });
|
|
|
|
+ }).ToList();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ dbResult = dbResult.AsParallel().WithDegreeOfParallelism(Environment.ProcessorCount)
|
|
|
|
+ .Where(x =>
|
|
|
|
+ {
|
|
|
|
+ bool where = false;
|
|
|
|
+ if (x.Area != null)
|
|
|
|
+ {
|
|
|
|
+ where = x.Area.Contains(dto.Param);
|
|
|
|
+ if (x.Area.Contains("尾款") || x.PriceName.Contains("尾款"))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (x.PriceName != null && !where)
|
|
|
|
+ {
|
|
|
|
+ where = x.PriceName.Contains(dto.Param);
|
|
|
|
+ if (x.PriceName.Contains("尾款") || x.PriceName.Contains("尾款"))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return where;
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .ToList();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- else
|
|
|
|
- {
|
|
|
|
- view = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations, Grp_CarTouristGuideGroundReservationsContent, Sys_SetData, Grp_DelegationInfo>((c, cc, s, d) =>
|
|
|
|
- cc.CTGGRId == c.Id && cc.SId == s.Id && c.DiId == d.Id
|
|
|
|
- ).Where((c, cc, s) => s.Id == 91 && (c.Area.Contains(dto.Param) || c.PriceName.Contains(dto.Param))
|
|
|
|
- && cc.Price != 0 && (c.Area.IndexOf("尾款") == -1))
|
|
|
|
- .Select((c, cc, s, d) => new HistoryCarDataView
|
|
|
|
- {
|
|
|
|
- TeamName = d.TeamName,
|
|
|
|
- Area = c.Area,
|
|
|
|
- PriceName = c.PriceName,
|
|
|
|
- Price = cc.Price,
|
|
|
|
- Start = c.ServiceStartTime,
|
|
|
|
- End = c.ServiceEndTime
|
|
|
|
- }).ToListAsync();
|
|
|
|
-
|
|
|
|
- view = view.Where(x =>
|
|
|
|
|
|
+
|
|
|
|
+ var view = dbResult.Select(x => {
|
|
|
|
+
|
|
|
|
+ decimal dp = 0.00M;
|
|
|
|
+ var startB = DateTime.TryParse(x.Start.ToString(),out DateTime startD);
|
|
|
|
+ var endB = DateTime.TryParse(x.End.ToString(), out DateTime endD);
|
|
|
|
+ if (string.IsNullOrWhiteSpace(x.DatePrice))
|
|
{
|
|
{
|
|
- var a = DateTime.TryParse(x.Start, out DateTime startTime);
|
|
|
|
- var b = DateTime.TryParse(x.End, out DateTime endTime);
|
|
|
|
- if (a && b)
|
|
|
|
|
|
+ if (startB && endB)
|
|
{
|
|
{
|
|
- x.Start = startTime.ToString("yyyy-MM-dd");
|
|
|
|
- x.End = endTime.ToString("yyyy-MM-dd");
|
|
|
|
|
|
+ var timesp = endD.Subtract(startD);
|
|
|
|
+ if ((timesp.Days + 1) != 0 )
|
|
|
|
+ {
|
|
|
|
+ dp = x.Price / (timesp.Days + 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
- return a && b;
|
|
|
|
- }).ToList();
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ dp = x.Price;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return new
|
|
|
|
+ {
|
|
|
|
+ start = startB ? startD.ToString("yyyy-MM-dd") : "",
|
|
|
|
+ end = endB ? endD.ToString("yyyy-MM-dd") : "",
|
|
|
|
+ x.Area,
|
|
|
|
+ x.id,
|
|
|
|
+ price = x.Price.ToString("F2"),
|
|
|
|
+ x.PriceName,
|
|
|
|
+ x.PriceContent,
|
|
|
|
+ x.TeamName,
|
|
|
|
+ x.DatePrice,
|
|
|
|
+ dayPrice = dp.ToString("F2"),
|
|
|
|
+ };
|
|
|
|
+ }).OrderByDescending(x=>x.id).ToList();
|
|
|
|
+
|
|
|
|
+ jw = JsonView(true, "获取成功!", view);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e)
|
|
|
|
+ {
|
|
|
|
+ jw = JsonView(false,e.Message);
|
|
}
|
|
}
|
|
|
|
|
|
return Ok(jw);
|
|
return Ok(jw);
|