public bool CancelFltRetModApply(int rmid) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(rmid); if (fltRetModApplyEntity.OrderStatus == FltModApplyStatusEnum.C.ToString()) { throw new Exception("当前申请已经取消!"); } fltRetModApplyEntity.OrderStatus = FltModApplyStatusEnum.C.ToString(); _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "OrderStatus" }); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == rmid, true).ToList(); foreach (var fltRetModFlightApplyEntity in fltRetModFlightApplyEntities) { fltRetModFlightApplyEntity.OrderStatus = fltRetModApplyEntity.OrderStatus; _fltRetModFlightApplyDal.Update(fltRetModFlightApplyEntity, new string[] { "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity(); log.LogTime = DateTime.Now; log.LogType = "取消申请"; log.Oid = "Sys"; log.Remark = "取消申请"; log.Rmid = rmid; _fltRetModApplyLogDal.Insert(log); return(true); }
/// <summary> /// 待审批信息 /// </summary> /// <param name="sendAppMessageModel"></param> private void GetWaitAuditMessage(SendAppMessageModel sendAppMessageModel) { if (sendAppMessageModel.OrderType == OrderSourceTypeEnum.AduitOrder && sendAppMessageModel.SendType == SendAppMessageTypeEnum.WaitAuditNotice) { List <CorpAduitOrderDetailEntity> corpAduitOrderDetailEntities = _corpAduitOrderDetailDal.Query <CorpAduitOrderDetailEntity>( n => n.AduitOrderId == sendAppMessageModel.OrderId, true).ToList(); if (corpAduitOrderDetailEntities == null || corpAduitOrderDetailEntities.Count == 0) { return; } string orderType = corpAduitOrderDetailEntities[0].OrderType.ValueToDescription <OrderSourceTypeEnum>(); string orderId = corpAduitOrderDetailEntities[0].OrderId.ToString(); if (corpAduitOrderDetailEntities[0].OrderType == (int)OrderSourceTypeEnum.FltModApply || corpAduitOrderDetailEntities[0].OrderType == (int)OrderSourceTypeEnum.FltRetApply) { FltRetModApplyEntity fltRetModApplyEntity = base.Context.Set <FltRetModApplyEntity>().Find(corpAduitOrderDetailEntities[0].OrderId); orderId = fltRetModApplyEntity?.OrderId.ToString(); } sendAppMessageModel.SendContent = string.Format("{0}{1}{2}需要您进行审批", orderType, (orderType.Contains("申请") ? "" : "订单"), orderId); } }
/// <summary> /// 判断当前审批单中的单据是否被取消 /// </summary> private bool CheckOrderIsCancel(CorpAduitOrderEntity corpAduitOrderEntity) { bool isCancel = false; List <CorpAduitOrderDetailEntity> corpAduitOrderDetailEntities = _corpAduitOrderDetailDal.Query <CorpAduitOrderDetailEntity>(n => n.AduitOrderId == corpAduitOrderEntity.AduitOrderId, true).ToList(); List <BaseDealAduitResultDetailModel> list = new List <BaseDealAduitResultDetailModel>(); corpAduitOrderDetailEntities.ForEach(n => { list.Add(new BaseDealAduitResultDetailModel() { OrderId = n.OrderId, OrderSourceType = n.OrderType.ValueToEnum <OrderSourceTypeEnum>() }); }); foreach (BaseDealAduitResultDetailModel orderModel in list) { if (orderModel.OrderSourceType == OrderSourceTypeEnum.Flt) { FltOrderEntity orderEntity = base.Context.Set <FltOrderEntity>().Find(orderModel.OrderId); if (orderEntity?.Orderstatus == "C" || orderEntity?.Orderstatus == "c") { isCancel = true; } } else if (orderModel.OrderSourceType == OrderSourceTypeEnum.FltModApply || orderModel.OrderSourceType == OrderSourceTypeEnum.FltRetApply) { FltRetModApplyEntity flightApplyEntity = base.Context.Set <FltRetModApplyEntity>().Find(orderModel.OrderId); if (flightApplyEntity?.OrderStatus == "C" || flightApplyEntity?.OrderStatus == "c") { isCancel = true; } } else if (orderModel.OrderSourceType == OrderSourceTypeEnum.Tra) { TraOrderStatusEntity orderStatusEntity = base.Context.Set <TraOrderStatusEntity>().FirstOrDefault(n => n.OrderId == orderModel.OrderId); if (orderStatusEntity?.IsCancle == 1) { isCancel = true; } } } if (isCancel) { corpAduitOrderEntity.IsDel = 1; _corpAduitOrderDal.Update <CorpAduitOrderEntity>(corpAduitOrderEntity, new string[] { "IsDel" }); return(false); } return(true); }
/// <summary> /// 机票退票申请待审批通知 /// </summary> /// <param name="sendAppMessageModel"></param> private void GetFltRetApplyWaitAuditMessage(SendAppMessageModel sendAppMessageModel) { if (sendAppMessageModel.OrderType == OrderSourceTypeEnum.FltRetApply && sendAppMessageModel.SendType == SendAppMessageTypeEnum.WaitAuditNotice) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(sendAppMessageModel.OrderId); sendAppMessageModel.SendContent = string.Format("机票退票申请{0}需要您进行审批", fltRetModApplyEntity.OrderId); } }
/// <summary> /// 退票申请核价待确认 /// </summary> /// <returns></returns> private void GetFltRetApplyConfireAuditPriceMessage(SendAppMessageModel sendAppMessageModel) { if (sendAppMessageModel.OrderType == OrderSourceTypeEnum.FltRetApply && sendAppMessageModel.SendType == SendAppMessageTypeEnum.ConfireAuditPriceNotice) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(sendAppMessageModel.OrderId); sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}已经核价成功,请确认核价", fltRetModApplyEntity.OrderId); } }
public int AddRetModApply(AddRetModApplyModel addRetModApplyModel) { FltOrderEntity fltOrderEntity = _fltOrderDal.Find <FltOrderEntity>(addRetModApplyModel.OrderId); FltRetModApplyEntity applyEntity = Mapper.Map <AddRetModApplyModel, FltRetModApplyEntity>(addRetModApplyModel); applyEntity.CorpPolicyId = fltOrderEntity.CorpPolicyId; applyEntity.CorpAduitId = fltOrderEntity.CorpAduitId; if (!applyEntity.ProcessStatus.HasValue) { applyEntity.ProcessStatus = 0; } if (string.IsNullOrEmpty(applyEntity.RefundType)) { applyEntity.RefundType = "实退"; } applyEntity = _fltRetModApplyDal.Insert(applyEntity); List <FltRetModFlightApplyEntity> flightApplyEntities = Mapper.Map <List <FltRetModFlightApplyModel>, List <FltRetModFlightApplyEntity> >(addRetModApplyModel.DetailList); foreach (var fltRetModFlightApplyEntity in flightApplyEntities) { fltRetModFlightApplyEntity.Rmid = applyEntity.Rmid; fltRetModFlightApplyEntity.OrderStatus = applyEntity.OrderStatus; if (string.IsNullOrEmpty(fltRetModFlightApplyEntity.FlightNo)) { FltFlightEntity flightEntity = _fltFlightDal.Query <FltFlightEntity>( n => n.OrderId == applyEntity.OrderId && n.Sequence == fltRetModFlightApplyEntity.Sequence, true) .FirstOrDefault(); if (flightEntity != null) { fltRetModFlightApplyEntity.FlightNo = flightEntity.FlightNo; } } _fltRetModFlightApplyDal.Insert(fltRetModFlightApplyEntity); } string orderType = (addRetModApplyModel.OrderType == "R" ? "退票" : "改签"); FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = applyEntity.Rmid, Oid = applyEntity.CreateOid, LogTime = DateTime.Now, Remark = addRetModApplyModel.Oid + "新增" + orderType + "申请", LogType = "新增" }; _fltRetModApplyLogDal.Insert(log); return(applyEntity.Rmid); }
public AuditResultModel DoSecondAudit(AuditRetApplySecond secondAudit) { FltRetModApplyEntity retApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(_retApplyQuery.Id); List <FltRetModFlightApplyEntity> retFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == retApplyEntity.Rmid).ToList(); FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = retApplyEntity.Rmid, Oid = "sys", LogType = "审批申请", LogTime = DateTime.Now }; #region 进行审批 List <string> properties = new List <string>(); if (IsAgree) { retApplyEntity.OrderStatus = FltRetApplyStatusEnum.D.ToString(); log.Remark = "退票申请审核状态:二级审核通过。二级审核人:" + _retApplyQuery?.AuditCustomer?.RealName; } else { retApplyEntity.OrderStatus = FltRetApplyStatusEnum.C.ToString(); log.Remark = "退票申请审核状态:二级审核不通过。二级审核人:" + _retApplyQuery?.AuditCustomer?.RealName; } #endregion retFlightApplyEntities.ForEach(n => n.OrderStatus = retApplyEntity.OrderStatus); properties.Add("OrderStatus"); _fltRetModApplyDal.Update(retApplyEntity, properties.ToArray()); retFlightApplyEntities.ForEach(n => { _fltRetModFlightApplyDal.Update(n, properties.ToArray()); }); _fltRetModApplyLogDal.Insert(log); return(new AuditResultModel() { Code = 0, AuditResult = log.Remark, OwnCid = retApplyEntity.Cid, Id = retApplyEntity.Rmid, OrderType = OrderSourceTypeEnum.FltRetApply }); }
private void GetFltRetApplyAuditResultMessage(SendAppMessageModel sendAppMessageModel) { if (sendAppMessageModel.OrderType == OrderSourceTypeEnum.FltRetApply && sendAppMessageModel.SendType == SendAppMessageTypeEnum.AuditResultNotice) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(sendAppMessageModel.OrderId); /** * 审批共分为如下情况: * 1.只存在一级审核 * 2.存在二级审核 */ if (fltRetModApplyEntity.Cpid.HasValue && !fltRetModApplyEntity.CpidSecond.HasValue) { if (fltRetModApplyEntity.OrderStatus == "D") { sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}已经通过审批,准备退票", fltRetModApplyEntity.OrderId); } else if (fltRetModApplyEntity.OrderStatus == "C") { sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}被审批人驳回,请您确认", fltRetModApplyEntity.OrderId); } } else if (fltRetModApplyEntity.Cpid.HasValue && fltRetModApplyEntity.CpidSecond.HasValue) { if (fltRetModApplyEntity.OrderStatus == "S") { sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}已经通过一级审批,进入二级审批", fltRetModApplyEntity.OrderId); } if (fltRetModApplyEntity.OrderStatus == "D") { sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}已经通过二级审批,准备退票", fltRetModApplyEntity.OrderId); } else if (fltRetModApplyEntity.OrderStatus == "C") { sendAppMessageModel.SendContent = string.Format("您的机票退票申请{0}被审批人驳回,请您确认", fltRetModApplyEntity.OrderId); } } } }
public ConfirmRetModAuditPriceResultModel ConfirmRetAuditPrice(ConfirmRetModAuditPriceModel query) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(query.Rmid); if (fltRetModApplyEntity == null) { throw new Exception("查无此申请"); } if (fltRetModApplyEntity.OrderStatus != FltRetApplyStatusEnum.A.ToString()) { throw new Exception("该审核已经提交审批"); } fltRetModApplyEntity.EditOid = query.Cid.ToString(); fltRetModApplyEntity.EditTime = DateTime.Now; fltRetModApplyEntity.OrderStatus = FltRetApplyStatusEnum.D.ToString(); _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "EditOid", "EditTime", "OrderStatus" }); bool isViolatePolicy = false; foreach (var detail in query.DetailList) { FltRetModFlightApplyEntity flightApplyEntity = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>( n => n.Rmid == query.Rmid && n.Sequence == detail.Sequence && n.Pid == detail.Pid) .FirstOrDefault(); if (flightApplyEntity == null) { continue; } if (!string.IsNullOrEmpty(flightApplyEntity.PolicyDesc)) { isViolatePolicy = true; } flightApplyEntity.OrderStatus = fltRetModApplyEntity.OrderStatus; flightApplyEntity.ChoiceReasonId = detail.ChoiceReasonId; _fltRetModFlightApplyDal.Update(flightApplyEntity, new string[] { "ChoiceReasonId", "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = fltRetModApplyEntity.Rmid, LogTime = DateTime.Now, LogType = "修改退票申请", Oid = "sys", Remark = "进行核价" }; _fltRetModApplyLogDal.Insert(log); return(new ConfirmRetModAuditPriceResultModel() { IsSuccess = true, Rmid = fltRetModApplyEntity.Rmid, CorpAduitId = fltRetModApplyEntity.CorpAduitId, CorpPolicyId = fltRetModApplyEntity.CorpPolicyId, OwnCid = fltRetModApplyEntity.Cid, IsViolatePolicy = isViolatePolicy }); }
/// <summary> /// 核价确认阶段取消申请 /// </summary> /// <param name="query"></param> /// <returns></returns> public int CancelFltModApplyByWaitAuditStep(CancelFltRetModApplyModel query) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(query.Rmid); string orderType = fltRetModApplyEntity.OrderType == "M" ? "改签" : "退票"; if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" && query.Customer.Cid != fltRetModApplyEntity.Cid) { throw new Exception($"查无此{orderType}申请"); } if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator") { throw new Exception($"管理员帐号不能取消{orderType}申请"); } string orderStatus = FltModApplyStatusEnum.C.ToString(); string wOrderStatus = FltModApplyStatusEnum.A.ToString(); if (fltRetModApplyEntity.OrderType == "R") { orderStatus = FltRetApplyStatusEnum.C.ToString(); wOrderStatus = FltRetApplyStatusEnum.A.ToString(); } if (fltRetModApplyEntity.OrderStatus == orderStatus) { throw new Exception($"当前{orderType}申请已经取消!"); } if (fltRetModApplyEntity.OrderStatus != wOrderStatus) { throw new Exception($"当前{orderType}申请无法取消!"); } fltRetModApplyEntity.OrderStatus = orderStatus; _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "OrderStatus" }); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == query.Rmid, true).ToList(); foreach (var fltRetModFlightApplyEntity in fltRetModFlightApplyEntities) { fltRetModFlightApplyEntity.OrderStatus = orderStatus; _fltRetModFlightApplyDal.Update(fltRetModFlightApplyEntity, new string[] { "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity(); log.LogTime = DateTime.Now; log.LogType = "取消申请"; log.Oid = "Sys"; log.Remark = "核价确认时取消了申请"; log.Rmid = query.Rmid; _fltRetModApplyLogDal.Insert(log); return(0); }
public FltRetModApplyModel GetRetModApply(int rmid) { FltRetModApplyEntity fltRetModApply = _fltRetModApplyDal.Find <FltRetModApplyEntity>(rmid); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == rmid).ToList(); List <FltRetModApplyLogEntity> fltRetModApplyLogEntities = _fltRetModApplyLogDal.Query <FltRetModApplyLogEntity>(n => n.Rmid == rmid).ToList(); FltRetModApplyModel fltRetModApplyModel = Mapper.Map <FltRetModApplyEntity, FltRetModApplyModel>(fltRetModApply); fltRetModApplyModel.DetailList = Mapper.Map <List <FltRetModFlightApplyEntity>, List <FltRetModFlightApplyModel> >( fltRetModFlightApplyEntities); fltRetModApplyModel.LogList = Mapper.Map <List <FltRetModApplyLogEntity>, List <FltRetModApplyLogModel> >( fltRetModApplyLogEntities); List <SearchCityModel> cityModels = AportInfo?.CountryList.SelectMany(n => n.CityList).ToList(); List <SearchAirportModel> airportModels = cityModels?.SelectMany(n => n.AirportList).ToList(); #region 乘机人信息 List <int> pidList = fltRetModApplyModel.DetailList.Select(n => n.Pid).ToList(); List <FltPassengerEntity> passengerEntities = _fltPassengerDal.Query <FltPassengerEntity>(n => pidList.Any(x => x == n.PId)).ToList(); #endregion //4.获取仓等信息 List <FltClassNameModel> classNameModels = _getClassNameBll.GetFlightClassName(); fltRetModApplyModel.DetailList.ForEach(n => { FltFlightEntity orderFlightEntity = _fltFlightDal.Query <FltFlightEntity>(x => x.OrderId == fltRetModApplyModel.OrderId && x.Sequence == n.Sequence) .FirstOrDefault(); if (orderFlightEntity != null) { if (!n.TackoffTime.HasValue) { n.TackoffTime = orderFlightEntity.TackoffTime; } if (string.IsNullOrEmpty(n.FlightNo)) { n.FlightNo = orderFlightEntity.FlightNo; } } string dport = n.Dport.ToLower(); if (fltRetModApplyModel.OrderType == "R" && orderFlightEntity != null) { dport = orderFlightEntity.Dport.ToLower(); } SearchAirportModel airportModel = airportModels.Find(x => x.AirportCode.ToLower() == dport); if (airportModel != null) { n.DportName = airportModel.AirportName; SearchCityModel cityModel = cityModels.Find(x => x.CityCode.ToLower() == airportModel.CityCode.ToLower()); n.DportCity = cityModel.CityName; } string aport = n.Aport.ToLower(); if (fltRetModApplyModel.OrderType == "R" && orderFlightEntity != null) { aport = orderFlightEntity.Aport.ToLower(); } SearchAirportModel airportModel2 = airportModels.Find(x => x.AirportCode.ToLower() == aport); if (airportModel2 != null) { n.AportName = airportModel2.AirportName; SearchCityModel cityModel2 = cityModels.Find(x => x.CityCode.ToLower() == airportModel2.CityCode.ToLower()); n.AportCity = cityModel2.CityName; } FltPassengerModel passengerModel = Mapper.Map <FltPassengerEntity, FltPassengerModel>(passengerEntities.Find(x => x.PId == n.Pid)); n.PassengerModel = passengerModel; if (fltRetModApplyModel.OrderType == "R") { n.PassengerModel.RefundTicketNo = n.TicketNo; } if (n.ChoiceReasonId.HasValue) { n.ChoiceReason = PolicyReasonList?.Find(x => x.Id == n.ChoiceReasonId.Value)?.Reason; } FltClassNameModel classNameModel = classNameModels.Find( x => !string.IsNullOrEmpty(x.MClass) && !string.IsNullOrEmpty(n.Class) && x.MClass.ToLower() == n.Class.ToLower() && !string.IsNullOrEmpty(x.AirlineCode) && !string.IsNullOrEmpty(n.FlightNo) && x.AirlineCode.ToLower() == n.FlightNo.Substring(0, 2).ToLower()); if (classNameModel != null) { n.ClassName = classNameModel.ClassName; } }); return(fltRetModApplyModel); }
/// <summary> /// 针对订单审批后发邮件提醒 /// </summary> /// <param name="request"></param> /// <returns></returns> public BaseDealAduitResultDetailModel GetCorpAduitOrderDetailmail(DoAduitOrderRequestViewModel request) { List <BaseDealAduitResultDetailModel> dorder = _corpAduitBll.GetCorpAduitOrderDetail(request.AduitOrderId); BaseDealAduitResultDetailModel detailorder = new BaseDealAduitResultDetailModel(); if (dorder.Count > 0) { string type = dorder[0].OrderSourceType.ToString(); bool isFly = false; string orderOid = "0"; switch (type) { //飞机正单 case "Flt": detailorder.OrderId = dorder[0].OrderId; FltOrderEntity orderentity = base.Context.Set <FltOrderEntity>().Find(detailorder.OrderId); orderOid = orderentity.CreateOid; isFly = true; break; //飞机改签 case "FltModApply": detailorder.OrderId = dorder[0].OrderId; FltRetModApplyEntity FltRetentity = base.Context.Set <FltRetModApplyEntity>().Find(detailorder.OrderId); detailorder.OrderId = FltRetentity.OrderId; orderOid = FltRetentity.CreateOid; isFly = true; break; //飞机退票 case "FltRetApply": detailorder.OrderId = dorder[0].OrderId; FltRetModApplyEntity Retentity = base.Context.Set <FltRetModApplyEntity>().Find(detailorder.OrderId); detailorder.OrderId = Retentity.OrderId; orderOid = Retentity.CreateOid; isFly = true; break; } OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(orderOid); string mail = operatorModel.Email; string approve = ""; if (!request.IsAgree) { approve = "审批未通过"; } else { approve = "审批已通过"; } StringBuilder mailContent = new StringBuilder(); mailContent.Append("<b>客户审批提醒:<b/>"); mailContent.Append("<br/>"); mailContent.Append("客户已经审批了订单,订单编号:" + detailorder.OrderId.ToString() + "," + approve + "。"); mailContent.Append("<br/>"); mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>"); //发送邮件 if (!string.IsNullOrEmpty(mail) && isFly) { bool flag = EmailHelper.SendEmail("", "客户审批提醒", null, null, mailContent.ToString(), mail); } } return(detailorder); }