|
@@ -1,4 +1,5 @@
|
|
using AutoMapper;
|
|
using AutoMapper;
|
|
|
|
+using NPOI.SS.UserModel;
|
|
using OASystem.Domain;
|
|
using OASystem.Domain;
|
|
using OASystem.Domain.Dtos.Groups;
|
|
using OASystem.Domain.Dtos.Groups;
|
|
using OASystem.Domain.Entities.Financial;
|
|
using OASystem.Domain.Entities.Financial;
|
|
@@ -120,19 +121,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
try
|
|
try
|
|
{
|
|
{
|
|
-
|
|
|
|
DateTime start = new DateTime();
|
|
DateTime start = new DateTime();
|
|
- var dayResult = GetDifferenceDate(dto.Id, out start);
|
|
|
|
- var day = 0;
|
|
|
|
- if (dayResult.Code == 0)
|
|
|
|
|
|
+ DateTime end = new DateTime();
|
|
|
|
+ Grp_CarTouristGuideGroundReservations grpCarOp = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.Id);
|
|
|
|
+
|
|
|
|
+ if (!DateTime.TryParse(grpCarOp?.ServiceStartTime, out start))
|
|
{
|
|
{
|
|
- day = Convert.ToInt32(dayResult.Data);
|
|
|
|
|
|
+ result.Msg = "服务开始时间不存在!";
|
|
|
|
+ result.Code = -1;
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+
|
|
|
|
+ if (!DateTime.TryParse(grpCarOp?.ServiceEndTime, out end))
|
|
{
|
|
{
|
|
- return dayResult;
|
|
|
|
|
|
+ result.Msg = "服务结束时间不存在!";
|
|
|
|
+ result.Code = -1;
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ TimeSpan ts = end - start; //计算时间差
|
|
|
|
+ int day = ts.Days;
|
|
|
|
|
|
List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 79).ToList();
|
|
List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 79).ToList();
|
|
|
|
|
|
@@ -150,14 +158,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
//团组下拉框
|
|
//团组下拉框
|
|
List<Grp_DelegationInfo> _Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
|
|
List<Grp_DelegationInfo> _Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
|
|
List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
|
|
List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
|
|
|
|
+
|
|
//支付方式
|
|
//支付方式
|
|
List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
|
|
List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
|
|
List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
|
|
List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
|
|
|
|
|
|
- //币种
|
|
|
|
- List<Sys_SetData> CurrencyList = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 66 && a.IsDel == 0).ToList();
|
|
|
|
- List<SetDataInfoView> _CurrencyList = _mapper.Map<List<SetDataInfoView>>(CurrencyList);
|
|
|
|
-
|
|
|
|
//列表初始化
|
|
//列表初始化
|
|
List<Sys_SetData> TableInitialization = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 17 && a.IsDel == 0).ToList();
|
|
List<Sys_SetData> TableInitialization = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 17 && a.IsDel == 0).ToList();
|
|
//List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
|
|
//List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
|
|
@@ -168,7 +173,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
foreach (var itemSt in TableInitialization)
|
|
foreach (var itemSt in TableInitialization)
|
|
{
|
|
{
|
|
- if (carTouristGuides.Find(x=>x.SId == itemSt.Id) == null)
|
|
|
|
|
|
+ var findResult = carTouristGuides.Find(x => x.SId == itemSt.Id);
|
|
|
|
+ if (findResult == null)
|
|
{
|
|
{
|
|
carTouristGuides.Add(new CarTouristGuideGroundReservationsContentView
|
|
carTouristGuides.Add(new CarTouristGuideGroundReservationsContentView
|
|
{
|
|
{
|
|
@@ -192,25 +198,24 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
DatePrice = groupResult[item][0].DatePrice.ObjToDate().AddDays(1),
|
|
DatePrice = groupResult[item][0].DatePrice.ObjToDate().AddDays(1),
|
|
SId = item,
|
|
SId = item,
|
|
Count = 1,
|
|
Count = 1,
|
|
- SidName = TableInitialization.Find(x=>x.Id == item)?.Name
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- groupResult[item].Add(new CarTouristGuideGroundReservationsContentView
|
|
|
|
- {
|
|
|
|
- DatePrice = start,
|
|
|
|
- SId = item,
|
|
|
|
- Count = 1,
|
|
|
|
- SidName = TableInitialization.Find(x => x.Id == item)?.Name
|
|
|
|
- });
|
|
|
|
|
|
+ groupResult[item][0].DatePrice = start;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).ToList();
|
|
|
|
|
|
+
|
|
|
|
+ carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).OrderBy(x=>x.SId).ThenBy(x=>x.DatePrice).ToList();
|
|
|
|
+ foreach (var item in carTouristGuides.Where(x=>string.IsNullOrWhiteSpace(x.SidName)).ToList())
|
|
|
|
+ {
|
|
|
|
+ item.SidName = TableInitialization.Find(x => x.Id == item.SId)?.Name;
|
|
|
|
+ }
|
|
|
|
|
|
Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
|
|
Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
|
|
CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
|
|
CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
|
|
|
|
+
|
|
if (_CreditCardPayment != null)
|
|
if (_CreditCardPayment != null)
|
|
{
|
|
{
|
|
_CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
|
|
_CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
|
|
@@ -222,22 +227,28 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
var data = new
|
|
var data = new
|
|
{
|
|
{
|
|
Payment = _Payment,
|
|
Payment = _Payment,
|
|
- CurrencyList = _CurrencyList,
|
|
|
|
Delegations = grp_Delegations,
|
|
Delegations = grp_Delegations,
|
|
carTouristGuides = carTouristGuides,
|
|
carTouristGuides = carTouristGuides,
|
|
CreditCardPayment = _CreditCardPayment,
|
|
CreditCardPayment = _CreditCardPayment,
|
|
|
|
+ start,
|
|
|
|
+ end,
|
|
};
|
|
};
|
|
|
|
|
|
return result = new Result() { Code = 0, Msg = "查询成功",Data=data };
|
|
return result = new Result() { Code = 0, Msg = "查询成功",Data=data };
|
|
|
|
|
|
}
|
|
}
|
|
- catch (Exception)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
return result = new Result() { Code = -2, Msg = "未知错误" };
|
|
return result = new Result() { Code = -2, Msg = "未知错误" };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public async Task<Result> OpCarTouristGuideGroundContentById(CarTouristGuideGroundIdDto dto)
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// web弃用
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public Result OpCarTouristGuideGroundContentById(CarTouristGuideGroundIdDto dto)
|
|
{
|
|
{
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
try
|
|
try
|
|
@@ -246,46 +257,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.IsDel==0 && a.CTGGRId==dto.Id).ToList();
|
|
List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.IsDel==0 && a.CTGGRId==dto.Id).ToList();
|
|
List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
|
|
List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
|
|
- DateTime start = new DateTime();
|
|
|
|
- var dayResult = GetDifferenceDate(dto.Id, out start);
|
|
|
|
- var day = 0;
|
|
|
|
- if (dayResult.Code == 0)
|
|
|
|
- {
|
|
|
|
- day = Convert.ToInt32(dayResult.Data);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- return dayResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var groupResult = carTouristGuides.GroupBy(x => x.SId).ToDictionary(x=>x.Key,x=>x.ToList());
|
|
|
|
- foreach (var item in groupResult.Keys)
|
|
|
|
- {
|
|
|
|
- while (groupResult[item].Count < day)
|
|
|
|
- {
|
|
|
|
- groupResult[item] = groupResult[item].OrderByDescending(x=>x.DatePrice).ToList();
|
|
|
|
- if (groupResult[item][0]?.DatePrice is not null)
|
|
|
|
- {
|
|
|
|
- groupResult[item].Add(new CarTouristGuideGroundReservationsContentView
|
|
|
|
- {
|
|
|
|
- DatePrice = groupResult[item][0].DatePrice.ObjToDate().AddDays(1),
|
|
|
|
- SId = item,
|
|
|
|
- Count = 1,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- groupResult[item].Add(new CarTouristGuideGroundReservationsContentView
|
|
|
|
- {
|
|
|
|
- DatePrice = start,
|
|
|
|
- SId = item,
|
|
|
|
- Count = 1,
|
|
|
|
- }) ;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).ToList();
|
|
|
|
|
|
|
|
foreach (var item in carTouristGuides)
|
|
foreach (var item in carTouristGuides)
|
|
{
|
|
{
|
|
@@ -313,6 +284,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
return result = new Result() { Code = -2, Msg = "未知错误(" + ex.Message+")" };
|
|
return result = new Result() { Code = -2, Msg = "未知错误(" + ex.Message+")" };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 根据diid查询op费用列表
|
|
/// 根据diid查询op费用列表
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -447,6 +419,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// OP费用录入填写详情
|
|
/// OP费用录入填写详情
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -471,6 +444,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
s.Currency = dto.Currency;
|
|
s.Currency = dto.Currency;
|
|
//s.Remark=item.Remark;
|
|
//s.Remark=item.Remark;
|
|
s.CreateUserId = dto.CreateUserId;
|
|
s.CreateUserId = dto.CreateUserId;
|
|
|
|
+ s.Units = item.Units;
|
|
|
|
+ s.DatePrice = item.DatePrice;
|
|
|
|
+ s.Count = item.Count;
|
|
carTouristList.Add(s);
|
|
carTouristList.Add(s);
|
|
}
|
|
}
|
|
foreach (var item in carTouristList)
|
|
foreach (var item in carTouristList)
|
|
@@ -498,6 +474,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
PriceContent = item.PriceContent,
|
|
PriceContent = item.PriceContent,
|
|
Currency = dto.Currency,
|
|
Currency = dto.Currency,
|
|
Remark = item.Remark,
|
|
Remark = item.Remark,
|
|
|
|
+ DatePrice = item.DatePrice,
|
|
|
|
+ Count = item.Count,
|
|
|
|
+ Units = item.Units,
|
|
}).ExecuteCommandAsync();
|
|
}).ExecuteCommandAsync();
|
|
if (CTable==0)
|
|
if (CTable==0)
|
|
{
|
|
{
|
|
@@ -599,39 +578,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
|
|
- public Result GetDifferenceDate(int id,out DateTime start)
|
|
|
|
- {
|
|
|
|
- Result result = new Domain.Result();
|
|
|
|
-
|
|
|
|
- Grp_CarTouristGuideGroundReservations grpCarOp = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == id);
|
|
|
|
-
|
|
|
|
- DateTime end = new DateTime();
|
|
|
|
- if (!DateTime.TryParse(grpCarOp?.ServiceStartTime, out start))
|
|
|
|
- {
|
|
|
|
- result.Msg = "服务开始时间不存在!";
|
|
|
|
- result.Code = -1;
|
|
|
|
- result.Data = 0;
|
|
|
|
- return result;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!DateTime.TryParse(grpCarOp?.ServiceEndTime, out end))
|
|
|
|
- {
|
|
|
|
- result.Msg = "服务结束时间不存在!";
|
|
|
|
- result.Code = -1;
|
|
|
|
- result.Data = 0;
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- TimeSpan ts = end - start; //计算时间差
|
|
|
|
- int day = ts.Days;
|
|
|
|
-
|
|
|
|
- result.Msg = "success!";
|
|
|
|
- result.Code = 0;
|
|
|
|
- result.Data = day;
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|