|
@@ -143,42 +143,43 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
try
|
|
|
{
|
|
|
- DateTime start = new DateTime();
|
|
|
- DateTime end = new DateTime();
|
|
|
+
|
|
|
Grp_CarTouristGuideGroundReservations grpCarOp = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.Id);
|
|
|
|
|
|
- if (!DateTime.TryParse(grpCarOp?.ServiceStartTime, out start))
|
|
|
+ if (!DateTime.TryParse(grpCarOp?.ServiceStartTime, out DateTime start))
|
|
|
{
|
|
|
result.Msg = "服务开始时间不存在!";
|
|
|
result.Code = -1;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- if (!DateTime.TryParse(grpCarOp?.ServiceEndTime, out end))
|
|
|
+ if (!DateTime.TryParse(grpCarOp?.ServiceEndTime, out DateTime end))
|
|
|
{
|
|
|
result.Msg = "服务结束时间不存在!";
|
|
|
result.Code = -1;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ if (!(DateTime.Compare(start,end) < 0))
|
|
|
+ {
|
|
|
+ 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();
|
|
|
-
|
|
|
- string DiId = "0";
|
|
|
- foreach (var item in grp_GroupsTaskAssignment)
|
|
|
- {
|
|
|
- DiId += item.DIId + ",";
|
|
|
- }
|
|
|
- if (DiId != "0")
|
|
|
- {
|
|
|
- DiId = DiId.Substring(0, DiId.Length - 1);
|
|
|
- }
|
|
|
- string sql = string.Format(@"select * from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
|
|
|
+ var diid = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 79)
|
|
|
+ .Select(x=>x.DIId)
|
|
|
+ .Distinct()
|
|
|
+ .ToList();
|
|
|
|
|
|
//团组下拉框
|
|
|
- List<Grp_DelegationInfo> _Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
|
|
|
+ List<Grp_DelegationInfo> _Delegations = diid.Any()
|
|
|
+ ? _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0 && diid.Contains(x.Id)).ToList()
|
|
|
+ : new List<Grp_DelegationInfo>();
|
|
|
List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
|
|
|
|
|
|
//支付方式
|
|
@@ -188,7 +189,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
//列表初始化
|
|
|
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);
|
|
|
-
|
|
|
_TableInitialization = _TableInitialization.OrderBy(x => x.RemarkSort).ToList();
|
|
|
|
|
|
List<Sys_SetData> ssd = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 78).ToList();
|
|
@@ -197,15 +197,16 @@ 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<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
|
|
|
|
|
|
- TableInitialization.RemoveAll(x => x.Id == 1070 || x.Id == 1071);
|
|
|
- var weiKuanArr = _TableInitialization.Where(x => x.Id == 1070 || x.Id == 1071).ToList();
|
|
|
- var weiKuanResultArr = carTouristGuides.Where(x => x.SId == 1070 || x.SId == 1071).ToList();
|
|
|
- carTouristGuides.RemoveAll(x => x.SId == 1070 || x.SId == 1071);
|
|
|
+ var weikuanSign = new int[] { 1070, 1071,};
|
|
|
+ TableInitialization.RemoveAll(x => weikuanSign.Contains(x.Id));
|
|
|
+ var weiKuanArr = _TableInitialization.Where(x => weikuanSign.Contains(x.Id) ).ToList();
|
|
|
+ var weiKuanResultArr = carTouristGuides.Where(x => weikuanSign.Contains(x.SId)).ToList();
|
|
|
+ carTouristGuides.RemoveAll(x => weikuanSign.Contains(x.SId));
|
|
|
|
|
|
+ var existingSIdArr = new HashSet<int>(carTouristGuides.Select(x => x.SId));
|
|
|
foreach (var itemSt in TableInitialization)
|
|
|
{
|
|
|
- var findResult = carTouristGuides.Find(x => x.SId == itemSt.Id);
|
|
|
- if (findResult == null)
|
|
|
+ if (!existingSIdArr.Contains(itemSt.Id))
|
|
|
{
|
|
|
carTouristGuides.Add(new CarTouristGuideGroundReservationsContentView
|
|
|
{
|
|
@@ -213,32 +214,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Count = 1,
|
|
|
SidName = itemSt.Name,
|
|
|
});
|
|
|
+
|
|
|
+ existingSIdArr.Add(itemSt.Id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var groupResult = carTouristGuides.GroupBy(x => x.SId).ToDictionary(x => x.Key, x => x.ToList());
|
|
|
foreach (var item in groupResult.Keys)
|
|
|
{
|
|
|
- #region 倒推初始化逻辑
|
|
|
- //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][0].DatePrice = start;
|
|
|
- // }
|
|
|
- //}
|
|
|
- #endregion
|
|
|
-
|
|
|
var startForTime = start;
|
|
|
|
|
|
var dayResult = new List<CarTouristGuideGroundReservationsContentView>();
|