예제 #1
0
        public void AddPointGroup(PlatformPointGroupDataObject dataObject)
        {
            var count = platformPointGroupRepository.FindAll(p => p.GroupName == dataObject.GroupName).Count();

            if (count > 0)
            {
                throw new CustomException(505, "扣点组名称重复");
            }
            PlatformPointGroup pointGroup = AutoMapper.Mapper.Map <PlatformPointGroupDataObject, PlatformPointGroup>(dataObject);

            pointGroup.CreateDate      = DateTime.Now;
            pointGroup.OperatorAccount = AuthManager.GetCurrentUser().OperatorAccount;
            this.unitOfWorkRepository.PersistCreationOf(pointGroup);
            this.unitOfWork.Commit();
            if (!string.IsNullOrWhiteSpace(pointGroup.Code))
            {
                var codeArray = pointGroup.Code.Split(',');
                var list      = this.businessmanRepository.FindAll(p => codeArray.Contains(p.Code)).OfType <Carrier>().ToList();
                foreach (var item in list)
                {
                    item.PointGroupID = pointGroup.ID;
                    systemUnitOfWorkRepository.PersistUpdateOf(item);
                }
                systemUnitOfWork.Commit();
            }
        }
예제 #2
0
        public void ModifyOperatorState(string account)
        {
            string code        = AuthManager.GetCurrentUser().Code;
            var    businessman = businessmanRepository.FindAll(x => x.Code == code).SingleOrDefault();

            businessman.CanExecute(account);
            unitOfWorkRepository.PersistUpdateOf(businessman);
            unitOfWork.Commit();
        }
예제 #3
0
        public void Process(HttpRequest request, HttpResponse response)
        {
            Logger.WriteLog(LogType.INFO, request.Url.ToString());
            string orderid  = request.QueryString["orderId"];
            string outPayNo = request.QueryString["payNo"];
            string remark   = request.QueryString["remark"];
            string payway   = request.QueryString["payWay"];
            var    model    = businessmanRepository.FindAll(x => x.Code == remark).FirstOrDefault();

            if (model == null)
            {
                return;
            }
            var buyModel = model.BuyDetails.Where(p => p.PayNo == orderid).FirstOrDefault();

            if (buyModel != null && string.IsNullOrEmpty(buyModel.OutPayNo))
            {
                model.SMSNotify(orderid, outPayNo, ExtHelper.GetPayMethod(payway));
                unitOfWorkRepository.PersistUpdateOf(model);
                unitOfWork.Commit();
            }
            response.WriteLine("success");

            if (string.Equals(remark, "BankOrPlatform", StringComparison.OrdinalIgnoreCase))
            {
            }
        }
예제 #4
0
        public void ModifyMsgState(int Id)
        {
            var mymsg = myMsgRepository.FindAll(p => p.ID == Id).FirstOrDefault();

            mymsg.State = true;
            unitOfWorkRepository.PersistUpdateOf(mymsg);
            unitOfWork.Commit();
        }
예제 #5
0
        public void TestSms()
        {
            BootStrapper.Boot();
            string s   = "100100";
            var    bus = ObjectFactory.GetInstance <IBusinessmanRepository>();
            var    buz = bus.FindAll(p => p.Code == s).FirstOrDefault();

            buz.SendMessage("老赵", "你好", "15608039993", "测试短信");

            IUnitOfWork           unitOfWork           = ObjectFactory.GetNamedInstance <IUnitOfWork>(EnumModule.SystemSetting.ToString());
            IUnitOfWorkRepository unitOfWorkRepository = ObjectFactory.GetNamedInstance <IUnitOfWorkRepository>(EnumModule.SystemSetting.ToString());

            unitOfWorkRepository.PersistUpdateOf(buz);
            unitOfWork.Commit();
        }
예제 #6
0
        public void UpdateFrePasser(FrePasserDto passer)
        {
            var frePasser = this._frePasserRepository.FindAll(p => p.Id == passer.Id).FirstOrDefault();

            frePasser.PasserType      = passer.PasserType;
            frePasser.Name            = passer.Name;
            frePasser.CertificateType = passer.CertificateType;
            frePasser.CertificateNo   = passer.CertificateNo;
            frePasser.Mobile          = passer.Mobile;
            frePasser.AirCardNo       = passer.AirCardNo;
            frePasser.Remark          = passer.Remark;
            frePasser.Birth           = passer.Birth;
            frePasser.SexType         = passer.SexType;
            frePasser.BusinessmanCode = _code;
            unitOfWorkRepository.PersistUpdateOf(frePasser);
            unitOfWork.Commit();
        }
예제 #7
0
        public void PartUpdateLocalPolicy(RequestPartPolicy policy)
        {
            if (policy == null)
            {
                throw new CustomException(400, "输入数据不能为空");
            }
            var localPolicy = this.localPolicyRepository.FindAll(p => p.ID == policy.ID).OfType <LocalNormalPolicy>().FirstOrDefault();

            if (localPolicy == null)
            {
                throw new CustomException(500, "查找修改政策不存在");
            }
            string oldStr = localPolicy.ToString();

            localPolicy.LocalPoint             = policy.LocalPoint;
            localPolicy.Different              = policy.Different;
            localPolicy.TravelType             = policy.TravelType;
            localPolicy.LocalPolicyType        = policy.LocalPolicyType;
            localPolicy.Seats                  = policy.Seats;
            localPolicy.Low                    = policy.Low;
            localPolicy.ChangeCode             = policy.ChangeCode;
            localPolicy.PassengeDate.StartTime = policy.PassengeDate.StartTime;
            localPolicy.PassengeDate.EndTime   = policy.PassengeDate.EndTime;
            localPolicy.IssueDate.StartTime    = policy.IssueDate.StartTime;
            localPolicy.IssueDate.EndTime      = policy.IssueDate.EndTime;

            unitOfWorkRepository.PersistUpdateOf(localPolicy);
            unitOfWork.Commit();
            string newStr = localPolicy.ToString();

            try
            {
                Logger.WriteLog(LogType.INFO, oldStr + "__" + newStr);
            }
            catch (Exception e)
            {
                Logger.WriteLog(LogType.ERROR, "写入错误", e);
            }
        }
        public void EditDeductionGroup(ConsoContracts.DomesticTicket.DataObjects.RequestDeduction deduction)
        {
            if (deduction == null)
            {
                throw new CustomException(500, "数据信息获取失败!");
            }
            var dataModel = this.deductionRepository.FindAll(p => p.ID == deduction.ID).FirstOrDefault();

            if (dataModel == null)
            {
                throw new CustomException(500, "更新扣点组不存在");
            }
            dataModel.Name        = deduction.Name;
            dataModel.Description = deduction.Description;
            dataModel.DeductionRules.Clear();
            if (deduction.DeductionRules != null)
            {
                deduction.DeductionRules.ForEach(p => dataModel.DeductionRules.Add(AutoMapper.Mapper.Map <BPiaoBao.AppServices.ConsoContracts.DomesticTicket.DataObjects.RequestDeductionRule, DeductionRule>(p)));
            }
            dataModel.CheckRule();
            dataModel.DeductionRules.ToList().ForEach(p => p.CheckDetail());
            unitOfWorkRepository.PersistUpdateOf(dataModel);
            unitOfWork.Commit();
        }
예제 #9
0
        public void Process(HttpRequest request, HttpResponse response)
        {
            StringBuilder sbLog  = new StringBuilder();
            string        result = "false";

            try
            {
                sbLog.Append("Start================自动出票通知=====================================================\r\n");
                sbLog.Append("时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\r\n");
                sbLog.Append("内容:\r\n");
                NameValueCollection nv = new NameValueCollection();
                nv.Add(request.Form);
                nv.Add(request.QueryString);
                string ticketXML = string.Empty;
                string payXML    = string.Empty;
                foreach (string key in nv.Keys)
                {
                    sbLog.Append(key + "=" + nv[key] + "\r\n");
                    if (key == "ticketnoinfo")
                    {
                        ticketXML = nv[key];
                    }
                    else if (key == "paymentinfo")
                    {
                        payXML = nv[key];
                    }
                }
                if (!string.IsNullOrEmpty(ticketXML))
                {
                    #region  //B2B自动出票通知
                    B2BResponse           b2BResponse = autoTicketService.SyncTicketCall(ticketXML);
                    List <AutoTicketInfo> b2bList     = b2BResponse.TicketNofityInfo.AutoTicketList;
                    if (b2bList.Count > 0)
                    {
                        string orderId = b2BResponse.TicketNofityInfo.FlatformOrderId;
                        Order  order   = orderRepository.FindAll(p => p.OrderId == orderId).FirstOrDefault();
                        if (order != null && order.OrderStatus != EnumOrderStatus.IssueAndCompleted)
                        {
                            Dictionary <string, string> ticketDict = new Dictionary <string, string>();
                            foreach (AutoTicketInfo item in b2bList)
                            {
                                if (!ticketDict.ContainsKey(item.PassengerName))
                                {
                                    ticketDict.Add(item.PassengerName, item.TicketNumber);
                                }
                            }
                            var behavior = order.State.GetBehaviorByCode("TicketsIssue");
                            behavior.SetParame("ticketDict", ticketDict);
                            behavior.SetParame("operatorName", "系统");
                            behavior.SetParame("platformCode", "系统");
                            behavior.SetParame("opratorSource", "通知");
                            behavior.SetParame("remark", order.Policy.PolicyType + "自动出票");
                            behavior.Execute();
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            result = "true";
                            sbLog.Append("处理成功\r\n");
                            try
                            {
                                MessageQueueManager.SendMessage(orderId, 0);
                            }
                            catch (Exception e)
                            {
                                Logger.WriteLog(LogType.ERROR, string.Format("{0}:写入总表失败", order.OrderId), e);
                            }
                        }
                        else
                        {
                            sbLog.AppendFormat("未找到订单号:{0}\r\n", orderId);
                        }
                    }
                    else
                    {
                        sbLog.AppendFormat("{0}\r\n", b2BResponse.Remark);
                    }
                    #endregion
                }
                else if (!string.IsNullOrEmpty(payXML))
                {
                    //B2B自动支付通知
                    result = "true";
                }
            }
            catch (Exception e)
            {
                sbLog.Append("异常信息:" + e.Message + e.StackTrace + "\r\n");
            }
            finally
            {
                sbLog.Append("End=====================================================================\r\n\r\n");
                new CommLog().WriteLog("B2BNotify", sbLog.ToString());
                //回复数据 true false
                response.WriteLine(result);
            }
        }
예제 #10
0
 public void RegisterAmended(IAggregateRoot entity, IUnitOfWorkRepository unitofWorkRepository)
 {
     unitofWorkRepository.PersistUpdateOf(entity);
 }
예제 #11
0
 public void RegisterAmended(Infrastructure.IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     unitOfWorkRepository.PersistUpdateOf(entity);
 }
예제 #12
0
        public int UpdateOffice(string useOffice, List <int> selectIds)
        {
            int    dataCount       = -1;
            string BusinessmanCode = currentUser.Code;

            try
            {
                List <TravelPaper> travelPaperList = m_travelPaperRepository.FindAll(p => p.BusinessmanCode == BusinessmanCode && selectIds.Contains(p.ID)).ToList();
                if (travelPaperList != null && travelPaperList.Count > 0)
                {
                    for (int i = 0; i < travelPaperList.Count; i++)
                    {
                        travelPaperList[i].WriteLog(new TravelPaperLog()
                        {
                            OperationContent  = "原Office:" + travelPaperList[i].UseOffice + " 新Office:" + useOffice,
                            OperationType     = "修改Office",
                            OperationDatetime = System.DateTime.Now,
                            OperationPerson   = currentUser.OperatorAccount
                        });
                        travelPaperList[i].UseOffice = useOffice;
                        unitOfWorkRepository.PersistUpdateOf(travelPaperList[i]);
                    }
                    unitOfWork.Commit();
                    dataCount = travelPaperList.Count;
                }
                else
                {
                    throw new OrderCommException("批量修改Office失败!");
                }
            }
            catch (Exception ex)
            {
                throw new OrderCommException(ex.Message);
            }
            return(dataCount);
        }
예제 #13
0
        public void Process(HttpRequest request, HttpResponse writer)
        {
            System.Threading.Thread.Sleep(2000);
            //日志
            StringBuilder sbLog = new StringBuilder();

            try
            {
                sbLog.Append("请求参数:\r\n");
                NameValueCollection nv = new NameValueCollection();
                nv.Add(request.Form);
                nv.Add(request.QueryString);
                foreach (string key in nv.Keys)
                {
                    sbLog.Append(key + "=" + nv[key] + "\r\n");
                }
                sbLog.Append("处理结果:");

                bool          rs = false;
                string        PayWayDiscription = "";
                EnumPayMethod?payMethod         = null;
                string        payWay            = request.QueryString["payWay"];   // 充值方式
                string        bankCode          = request.QueryString["bankCode"]; // 银行Code
                string        orderId           = request.QueryString["orderId"];  //订单编号
                string        payNo             = request.QueryString["payNo"];    //交易号
                string        price             = request.QueryString["price"];    //交易金额
                string        currentTime       = request.QueryString["currentTime"];
                string        isRefund          = request.QueryString["isRefund"]; //退款标志(0=支付1=退款)
                string        signature         = request.QueryString["signature"];
                string        remark            = request.QueryString["remark"];
                if (isRefund == "1" && remark.Contains("SaleOrderRefund_"))
                {
                    /*退票单ID:SaleOrderRefund_xx
                     * 退款单ID:orderID
                     * price:退款金额
                     */
                    int saleorderid = remark.Split('_')[1].ToInt();
                    if (SaleOrderRefund(saleorderid, price, orderId))
                    {
                        writer.WriteLine("success");
                    }
                    return;
                }
                List <string> list = new List <string>();
                list.Add(string.Format("payWay={0}", payWay));
                list.Add(string.Format("bankCode={0}", bankCode));
                list.Add(string.Format("orderId={0}", orderId));
                list.Add(string.Format("payNo={0}", payNo));
                list.Add(string.Format("price={0}", price));
                list.Add(string.Format("currentTime={0}", currentTime));
                list.Add(string.Format("isRefund={0}", isRefund));
                list.Add(string.Format("remark={0}", remark.UrlEncode()));
                var    newlist = list.OrderByDescending(p => p);
                string data    = string.Join("&", newlist);
                string sign    = data.Md5();
                // AliPay = 20,ChinaPnrPay = 21,TenPay = 22,BillPay = 23
                switch (payWay.ToLower())
                {
                case "alipay":
                    payMethod         = EnumPayMethod.AliPay;
                    PayWayDiscription = "支付宝";
                    break;

                //case "ChinaPnrPay":
                //    payWay = 3;
                //    PayWayDiscription = "汇付";
                //    break;
                case "tenpay":
                    payMethod         = EnumPayMethod.TenPay;
                    PayWayDiscription = "财付通";
                    break;

                //case "BillPay":
                //    payWay = 2;
                //    PayWayDiscription = "快钱";
                //    break;
                case "internetbank":
                    payMethod         = EnumPayMethod.Bank;
                    PayWayDiscription = "银行卡";
                    payWay            = bankCode;
                    break;
                }
                if (sign == signature)
                {
                    var order = orderRepository.FindAll(p => p.OrderId == orderId).FirstOrDefault();
                    if (isRefund == "1")//退款
                    {
                        //退款中的状态 修改成 退款结束
                        if (order.OrderStatus == EnumOrderStatus.RepelIssueRefunding || order.OrderStatus == EnumOrderStatus.WaitReimburseWithRepelIssue)
                        {
                            //修改为拒绝出票,订单完成
                            order.ChangeStatus(EnumOrderStatus.RepelIssueAndCompleted);
                            order.WriteLog(new OrderLog()
                            {
                                OperationContent  = "日志来源:通知,订单状态:" + order.OrderStatus.ToEnumDesc() + " 退款交易号:" + payNo + ",退款状态:退款完成,退款方式:" + PayWayDiscription,
                                OperationDatetime = System.DateTime.Now,
                                OperationPerson   = remark,
                                IsShowLog         = true
                            });
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            sbLog.Append("退款处理\r\n");
                        }
                    }
                    else if (isRefund == "0")//支付
                    {
                        if (order.OrderPay.PayStatus == EnumPayStatus.NoPay &&
                            (order.OrderStatus == EnumOrderStatus.NewOrder || order.OrderStatus == EnumOrderStatus.PaymentInWaiting)
                            )
                        {
                            if (payMethod.HasValue)
                            {
                                order.OrderPay.PayMethod = payMethod.Value;
                            }
                            //订单支付通知
                            order.PayToPaid(remark, order.OrderPay.PayMethod, payWay, payNo, "通知");
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            //生成接口订单和代付
                            DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>();
                            //支付宝通知回来自动出票
                            if (order.Policy.PolicySourceType != EnumPolicySourceType.Interface)
                            {
                                if (order.OrderPay.PayMethod != null && (order.OrderPay.PayMethod == EnumPayMethod.Bank || order.OrderPay.PayMethod == EnumPayMethod.Platform))
                                {
                                    domesticService.AutoIssue(order.OrderId, order.OrderPay.PayMethod.ToEnumDesc() + "支付", () =>
                                    {
                                        try
                                        {
                                            MessageQueueManager.SendMessage(orderId, 0);
                                        }
                                        catch (Exception e)
                                        {
                                            Logger.WriteLog(LogType.ERROR, string.Format("{0}:写入总表失败", order.OrderId), e);
                                        }
                                    });
                                }
                            }

                            domesticService.CreatePlatformOrderAndPaid(order.OrderId, "系统", "支付通知");
                        }
                        else if (order.OrderPay.PayStatus == EnumPayStatus.NoPay && order.OrderStatus == EnumOrderStatus.OrderCanceled)
                        {
                            order.OrderPay.PayStatus       = EnumPayStatus.OK;
                            order.OrderPay.PaySerialNumber = payNo;
                            order.OrderPay.PayDateTime     = DateTime.Now;
                            order.OrderStatus = EnumOrderStatus.RepelIssueAndCompleted;
                            order.WriteLog(new OrderLog
                            {
                                IsShowLog         = true,
                                OperationContent  = "该订单已过支付时间,退回支付金额",
                                OperationDatetime = DateTime.Now,
                                OperationPerson   = "系统"
                            });
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            MessageQueueManager.SendMessage(order.OrderId, 2);
                            AutoRefund(order);
                        }
                        sbLog.Append("支付处理\r\n");
                    }
                    else
                    {
                        sbLog.Append("未处理\r\n");
                    }
                    writer.WriteLine("success");
                }
                else
                {
                    sbLog.Append("签名验证失败\r\n");
                }
            }
            catch (Exception ex)
            {
                sbLog.Append(ex.Message + "\r\n");
            }
            finally
            {
                //日志
                WriteLog(sbLog.ToString(), request != null ? request.Url.ToString() : "异常");
            }
        }
예제 #14
0
 public void RegisterAmended(IAggregateRoot entity, IUnitOfWorkRepository repository)
 {
     repository.PersistUpdateOf(entity);
 }
예제 #15
0
 public void RegisterNew(IAggregateRoot entity,
                         IUnitOfWorkRepository unitofWorkRepository)
 {
     unitofWorkRepository.PersistUpdateOf(entity);
 }
예제 #16
0
        public void Process(HttpRequest request, HttpResponse response)
        {
            Logger.WriteLog(LogType.INFO, request.Url.ToString());
            string orderid     = request.QueryString["orderId"];
            string outPayNo    = request.QueryString["payNo"];
            string remark      = request.QueryString["remark"];
            string price       = request.QueryString["price"];    //交易金额
            string currentTime = request.QueryString["currentTime"];
            string isRefund    = request.QueryString["isRefund"]; //退款标志(0=支付1=退款)
            string signature   = request.QueryString["signature"];
            string payway      = request.QueryString["payWay"];   //支付方式
            int    saleorderid = orderid.Substring(2).ToInt();

            if (isRefund == "1")
            {
                int refundId = remark.ToInt();

                /*
                 * orderid:退款单ID
                 * remark:退票单ID
                 * price:金额
                 */
                if (SaleOrderRefund(refundId, price, orderid))
                {
                    response.WriteLine("success");
                }
                return;
            }
            var model = afterSaleOrderRepository.FindAll(p => p.Id == saleorderid).FirstOrDefault();

            if (model == null)
            {
                Logger.WriteLog(LogType.INFO, string.Format("改签支付售后订单ID:{0}不存在", saleorderid));
                return;
            }
            ChangeOrder changeOrder = null;

            if (model is ChangeOrder)
            {
                changeOrder = model as ChangeOrder;
            }
            if (changeOrder == null)
            {
                Logger.WriteLog(LogType.INFO, string.Format("售后订单ID:{0}不是改签类型", saleorderid));
                return;
            }
            if (changeOrder.ProcessStatus != EnumTfgProcessStatus.ProcessingWaitPay)
            {
                return;
            }
            changeOrder.OutPayNo      = outPayNo;
            changeOrder.PayTime       = DateTime.Now;
            changeOrder.PayStatus     = EnumChangePayStatus.Payed;
            changeOrder.ProcessStatus = EnumTfgProcessStatus.WaitIssue;
            changeOrder.PayWay        = ExtHelper.GetPayMethod(payway);
            changeOrder.WriteLog(new OrderLog
            {
                IsShowLog         = true,
                OperationContent  = "订单改签支付完成,等待出票",
                OperationDatetime = DateTime.Now,
                OperationPerson   = "系统"
            });
            unitOfWorkRepository.PersistUpdateOf(changeOrder);
            unitOfWork.Commit();
            response.WriteLine("success");
        }