/// <summary> /// 查询自提点 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public SelfTakeStationResultDTO GetSelfTakeStationExt(SelfTakeStationSearchDTO search) { SelfTakeStationResultDTO result = new SelfTakeStationResultDTO(); if (search == null || search.pageIndex < 1 || search.pageSize < 1 || search.appId == Guid.Empty) { return(result); } var query = from s in AppSelfTakeStation.ObjectSet() where !s.IsDel && s.AppId == search.appId select s; if (!string.IsNullOrEmpty(search.searchContent)) { query = query.Where(n => n.Name.Contains(search.searchContent) || n.Phone.Contains(search.searchContent) || n.Address.Contains(search.searchContent)); } query = query.Distinct(); result.Count = query.Count(); query = query.OrderByDescending(n => n.SubTime).Skip((search.pageIndex - 1) * search.pageSize).Take(search.pageSize); var tmpResult = query.ToList(); if (tmpResult.Count == 0) { result.Count = 0; return(result); } try { foreach (var item in tmpResult) { SelfTakeStationSearchResultDTO data = new SelfTakeStationSearchResultDTO { Id = item.Id, Name = item.Name, Province = ProvinceCityHelper.GetAreaNameByCode(item.Province), City = ProvinceCityHelper.GetAreaNameByCode(item.City), District = ProvinceCityHelper.GetAreaNameByCode(item.District), Address = item.Address, SubTime = item.SubTime, Phone = item.Phone == null ? "" : item.Phone, ModifiedOn = item.ModifiedOn }; result.SelfTakeStationList.Add(data); } return(result); } catch (Exception ex) { LogHelper.Error(string.Format("查询自提点SV服务异常。search:{0}", JsonHelper.JsonSerializer(search)), ex); return(result); } }
/// <summary> /// 得到自提地址 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string GetSelfTakAddress(SelfTakeStation entity) { if (entity != null) { //if (ProvinceCityHelper.GetDirectlyCityList().Select(c => c.AreaCode).ToList().Contains(entity.Province)) //{ // return string.Format("{0} {1}", ProvinceCityHelper.GetAreaNameByCode(entity.Province), entity.Address); //} return(string.Format("{0} {1} {2}", ProvinceCityHelper.GetAreaNameByCode(entity.Province), ProvinceCityHelper.GetAreaNameByCode(entity.City), entity.Address)); } return(string.Empty); }
/// <summary> /// 下订单页获取自提点信息 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public Jinher.AMP.BTP.Deploy.CustomDTO.AppSelfTakeStationDefaultInfoDTO GetAppSelfTakeStationDefaultExt(Jinher.AMP.BTP.Deploy.CustomDTO.AppSelfTakeStationSearchDTO search) { var result = new AppSelfTakeStationDefaultInfoDTO(); if (search == null) { return(null); } if (search.SearchType == 1) { if (search.Id == Guid.Empty) { return(null); } var station = AppSelfTakeStation.ObjectSet() .Where(t => t.Id == search.Id && !t.IsDel) .FirstOrDefault(); if (station == null) { return(null); } result.StationId = station.Id; result.StationName = station.Name; result.DelayDay = station.DelayDay; result.MaxBookDay = station.MaxBookDay; result.StationPhone = station.Phone; if (!string.IsNullOrWhiteSpace(station.Province)) { result.StationAddressDetails = ProvinceCityHelper.GetAreaNameByCode(station.Province) + ProvinceCityHelper.GetAreaNameByCode(station.City) + ProvinceCityHelper.GetAreaNameByCode(station.District) + station.Address; } var officeTime = AppStsOfficeTime.ObjectSet().Where(t => t.SelfTakeStationId == station.Id).ToList(); if (officeTime.Any()) { result.StationTimeList = new List <AppStationOfficeTime>(); foreach (var appStsOfficeTime in officeTime) { var officeTimeModel = new AppStationOfficeTime(); officeTimeModel.StartTime = appStsOfficeTime.StartTime; officeTimeModel.EndTime = appStsOfficeTime.EndTime; officeTimeModel.WeekDays = appStsOfficeTime.WeekDays; result.StationTimeList.Add(officeTimeModel); } } } else if (search.SearchType == 2) { if (search.EsAppId == Guid.Empty) { return(null); } var _userId = this.ContextDTO.LoginUserID; var pickUpOrder = AppOrderPickUp.ObjectSet() .Where(t => t.AppId == search.EsAppId && t.UserId == _userId).OrderByDescending(t => t.SubTime) .FirstOrDefault(); if (pickUpOrder == null) { return(null); } var station = AppSelfTakeStation.ObjectSet() .Where(t => t.Id == pickUpOrder.SelfTakeStationId && t.AppId == pickUpOrder.AppId && !t.IsDel) .FirstOrDefault(); if (station == null) { return(null); } result.StationId = station.Id; result.StationName = station.Name; result.DelayDay = station.DelayDay; result.MaxBookDay = station.MaxBookDay; result.StationPhone = station.Phone; result.PickUpName = pickUpOrder.Name; result.PickUpPhone = pickUpOrder.Phone; if (!string.IsNullOrWhiteSpace(station.Province)) { result.StationAddressDetails = ProvinceCityHelper.GetAreaNameByCode(station.Province) + ProvinceCityHelper.GetAreaNameByCode(station.City) + ProvinceCityHelper.GetAreaNameByCode(station.District) + station.Address; } var officeTime = AppStsOfficeTime.ObjectSet().Where(t => t.SelfTakeStationId == station.Id).ToList(); if (officeTime.Any()) { result.StationTimeList = new List <AppStationOfficeTime>(); foreach (var appStsOfficeTime in officeTime) { var officeTimeModel = new AppStationOfficeTime(); officeTimeModel.StartTime = appStsOfficeTime.StartTime; officeTimeModel.EndTime = appStsOfficeTime.EndTime; officeTimeModel.WeekDays = appStsOfficeTime.WeekDays; result.StationTimeList.Add(officeTimeModel); } } } else { return(null); } result.StationTimeShowList = AppSelfTakeSV.DealScrollTime(result.StationTimeList, result.DelayDay, result.MaxBookDay); return(result); }