Example #1
0
        /*   public ObservableCollection<CUSTOMER> UpdateListview()
         * {
         *     List<EMPLOYEE> listp = CustomerDao.Instance().getAll();
         *
         *     ObservableCollection<CUSTOMER> result = new ObservableCollection<CUSTOMER>();
         *     foreach (EMPLOYEE p in listp)
         *     {
         *         CUSTOMER pv = new CUSTOMER(p);
         *         result.Add(pv);
         *     }
         *     return result;
         *
         * }
         */
        private void SelectedItem(CUSTOMER p)
        {
            ResetView();
            OFFICER    of  = OfficerDao.Instance().SelectbyCustId(p.CUST_ID);
            BUSINESS   bu  = BusinessDao.Instance().SelectbyId(p.CUST_ID);
            INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(p.CUST_ID);

            if (ind != null)
            {
                In_lastname  = ind.LAST_NAME;
                In_firstname = ind.FIRST_NAME;
                In_birthdate = ind.BIRTH_DATE.ToString();
            }
            if (of != null)
            {
                Of_lastname  = of.LAST_NAME;
                Of_firstname = of.FIRST_NAME;
                Of_title     = of.TITLE;
                Of_startdate = of.START_DATE.ToString();
                Of_enddate   = of.END_DATE.ToString();
            }
            if (bu != null)
            {
                Bu_name       = bu.NAME;
                Bu_stateid    = bu.STATE_ID;
                Bu_incorpdate = bu.INCORP_DATE.ToString();
            }
        }
Example #2
0
        //发送商家短信
        void SendMessageBusiness(MessageModel model)
        {
            try
            {
                BusinessDao businessDao = new BusinessDao();
                DataTable   dt          = businessDao.GetPhoneNoList(model.PushCity);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["PhoneNo"] == null || dt.Rows[i]["PhoneNo"].ToString() == "")
                    {
                        continue;
                    }

                    string phoneNo = "";
                    if (StringHelper.CheckPhone(dt.Rows[i]["PhoneNo"].ToString()))
                    {
                        phoneNo = dt.Rows[i]["PhoneNo"].ToString();
                    }
                    //string phoneNo = "13520860798";
                    Task.Factory.StartNew(() =>
                    {
                        SendSmsHelper.SendSendSmsSaveLog(phoneNo, model.Content, SystemConst.SMSSOURCE);
                        //写日志
                        LogHelper.LogTraceWriterPhone(model.Id + "  商家:" + phoneNo);
                    });
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogWriter(ex);
            }
        }
Example #3
0
    private void threadProc()
    {
        while (!_isbreak)
        {
            int week      = Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"));
            int beginHour = 8;
            int endHour   = 21;
            if (week > 0 && week < 6)
            //if (true)
            {
                if (DateTime.Now.Hour >= beginHour && DateTime.Now.Hour <= endHour)
                //if (true)
                {
                    List <DebitUserRecord> taskList = BusinessDao.GetReadyReleaseDebitRecords();
                    LoanBank bank = new LoanBank();
                    Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 是放款日,放款时间段:{1}点- {2}点,待放款数据为:{3}条"
                                      , week, beginHour, endHour, taskList.Count);

                    if (taskList.Count > 0)
                    {
                        foreach (DebitUserRecord record in taskList)
                        {
                            try
                            {
                                BusinessDao.SetDebitRecordStatus(record.debitId, 5, "Pencairan dana sedang dalam proses(10002)");
                                string errMsg = String.Empty;
                                if (bank.Transfer(record, out errMsg))
                                {
                                    BusinessDao.SetDebitRecordStatus(record.debitId, 1, "Uang anda telah berhasil di transfer(10002).");
                                    //在此处可增加放款成功的短信通知
                                    WaveCellSMSSingleSender sms = new WaveCellSMSSingleSender();
                                    WaveCellSMSSingleSender.Authorization  = "Bearer yCCTxuCM7nIbdEuIxENllGMuqlF90qjtMlhb201S0bI";
                                    WaveCellSMSSingleSender.SubAccountName = "Prodigy_DANA";
                                }
                                else
                                {
                                    BusinessDao.SetDebitRecordStatus(record.debitId, -1, errMsg);
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.WriteErrorLog("TaskThread::threadProc", ex.Message);
                            }
                        }
                    }
                }
                else
                {
                    Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 放款时间段:{1}点- {2}点,现在是:{3}点"
                                      , week, beginHour, endHour, DateTime.Now.Hour);
                }
            }
            else
            {
                Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 不放款。", week);
            }
            Thread.Sleep(3 * 60 * 1000);
        }
    }
Example #4
0
 private void LlenarControles()
 {
     comboBoxempresa.DataSource = null;
     // comboBoxempresa.ValueMember = "password";
     comboBoxempresa.DisplayMember = "name";
     comboBoxempresa.DataSource    = BusinessDao.getLista();
     comboBoxmenu.DisplayMember    = "name";
     comboBoxmenu.DataSource       = ProductDao.getLista();
 }
Example #5
0
        public JsonResult Delete(string id)
        {
            var business = new BusinessDao();
            var model    = business.Delete(id);

            return(Json(new
            {
                status = model
            }));
        }
Example #6
0
        private void Find(FrameworkElement p)
        {
            string id = "";

            if (p != null)
            {
                var fe = p as Grid;
                if (fe != null)
                {
                    foreach (var item in fe.Children)
                    {
                        var tx = item as TextBox;
                        if (tx != null)
                        {
                            if (tx.Name.Equals("txtSearch"))
                            {
                                id = tx.Text;
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(id))
            {
                String key = id.ToLower();
                ObservableCollection <CUSTOMER> result = new ObservableCollection <CUSTOMER>();
                foreach (CUSTOMER c in CustomerLists)
                {
                    OFFICER    of   = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                    BUSINESS   bu   = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                    INDIVIDUAL ind  = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                    String     temp = c.CUST_ID.ToString() + " " + c.ADDRESS + " " + c.CITY + " " + c.FED_ID + " " + c.POSTAL_CODE + " " + c.STATE + " ";
                    if (of != null && bu != null)
                    {
                        temp +=
                            of.FIRST_NAME + " " + of.LAST_NAME + " " + of.OFFICER_ID + " " + of.TITLE + " " + of.START_DATE.ToString() + " " + of.END_DATE.ToString() + " " +
                            bu.NAME + "  " + bu.STATE_ID + " " + bu.INCORP_DATE.ToString() + " ";
                    }
                    if (ind != null)
                    {
                        temp += ind.LAST_NAME + " " + ind.FIRST_NAME + " " + ind.BIRTH_DATE.ToString();
                    }
                    temp.ToLower();
                    if (temp.Contains(key))
                    {
                        result.Add(c);
                    }
                }
                CustomerLists = result;
            }
            else
            {
                CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
        }
Example #7
0
        private static bool threadSafe = true;//线程安全
        #region IJob 成员

        public void Execute(Quartz.IJobExecutionContext context)
        {
            if (!threadSafe)
            {
                return;
            }
            threadSafe = false;
            try
            {
                LogHelper.LogWriter("执行啦:" + DateTime.Now);
                double hour = ParseHelper.ToDouble(Config.ConfigKey("DataTime"), -1);
                if (hour == -1)
                {
                    return;
                }
                ClienterDao clienterDao           = new ClienterDao();
                BusinessDao businessDao           = new BusinessDao();
                OrderDao    orderDao              = new OrderDao();
                IList <NonJoinWithdrawModel> list = orderDao.GetNonJoinWithdraw(hour);//获取没给可提现金额加钱的订单
                foreach (var item in list)
                {
                    using (IUnitOfWork tran = EdsUtilOfWorkFactory.GetUnitOfWorkOfEDS())
                    {
                        try
                        {
                            LogHelper.LogWriter(string.Concat("执行订单ID:", item.id, ",ClienterId:", item.clienterId));
                            clienterDao.UpdateAllowWithdrawPrice(item.clienterPrice, item.clienterId);
                            //businessDao.UpdateAllowWithdrawPrice(item.businessPrice, item.businessId);
                            orderDao.UpdateJoinWithdraw(item.id);
                            tran.Complete();
                        }
                        catch (Exception ex)
                        {
                            LogHelper.LogWriter(ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogWriter(ex);
            }
            finally
            {
                threadSafe = true;
            }
        }
    private void threadProc()
    {
        while (!_isbreak)
        {
            SortedList <string, string> list = BusinessDao.GetNeedCheckDebitRecords();
            Log.WriteDebugLog("StatusCheckThread::threadProc", "存在{0}个需要确认的订单。", list.Count);
            foreach (string orderId in list.Keys)
            {
                string target = list[orderId];
                Log.WriteDebugLog("StatusCheckThread::threadProc", "{0} 准备开始确认订单的状态,渠道{1}。", orderId, target);
                LoanBank bank         = new LoanBank();
                string   merchantCode = String.Empty;

                InquriyTransferResponse response = bank.DuitkuOrderStatusInquiryRequest(orderId, target);
                if (response.statusCode == "00")
                {
                    CallbackRequestModel callback = new CallbackRequestModel();
                    callback.amount          = response.amount;
                    callback.merchantOrderId = response.merchantOrderId;

                    DataProviderResultModel resultModel = DuitkuProvider.SetDuitkuPaybackRecordStaus(callback);
                    if (resultModel.result == Result.SUCCESS)
                    {
                        Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]重做成功了。", orderId);
                    }
                    else
                    {
                        Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]接口调用成功,但是数据库操作失败了。", orderId);
                    }
                }
                else
                {
                    Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]重做失败了。", orderId);
                }

                ///重做次数+1
                BusinessDao.UpdateRedoUserPayBackRecordStatus(orderId);
            }
            Thread.Sleep(10 * 60 * 1000);
        }
    }
Example #9
0
        //发送商家app
        void SendAppBusiness(MessageModel model)
        {
            try
            {
                BusinessDao businessDao = new BusinessDao();
                DataTable   dt          = businessDao.GetPhoneNoList(model.PushCity);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string businessId = dt.Rows[i]["id"].ToString();
                    long   id         = businessMessageDao.Insert(new BusinessMessage
                    {
                        BusinessId = Convert.ToInt32(businessId),
                        Content    = model.Content,
                        IsRead     = 0
                    }
                                                                  );

                    Task.Factory.StartNew(() =>
                    {
                        JPushModel jpushModel = new JPushModel()
                        {
                            Alert          = "您有新消息啦,请及时查收!",
                            City           = string.Empty,
                            Content        = id.ToString(),
                            ContentKey     = "Notice",
                            RegistrationId = "B_" + businessId,
                            TagId          = 1,
                            Title          = "新消息",
                            PushType       = 1
                        };
                        Push.PushMessage(jpushModel);
                    });
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogWriter(ex);
            }
        }
Example #10
0
 /// <summary>
 /// 生成支付宝二维码
 /// 窦海超
 /// 2015年5月12日 14:36:37
 /// </summary>
 /// <param name="orderNo">订单号</param>
 /// <param name="payAmount">支付金额</param>
 /// <param name="orderId">订单ID,用于查询商家信息用</param>
 /// <returns></returns>
 private ResultModel <PayResultModel> CreateAliPayOrder(string orderNo, decimal payAmount, int orderId, int payStyle)
 {
     #region 通过订单ID,用于查询商家信息用
     BusinessDM businessModel = new BusinessDao().GetByOrderId(orderId);
     string     businessName  = string.Empty;
     if (businessModel == null || string.IsNullOrEmpty(businessModel.Name))
     {
         businessName = "e代送收款";
     }
     else
     {
         businessName = businessModel.Name;
     }
     #endregion
     PayResultModel resultModel = new PayResultModel();
     string         qrcodeUrl   = string.Empty;
     if (payStyle == 1)//用户扫二维码
     {
         //qrcodeUrl = alipayIntegrate.GetQRCodeUrl(orderNo, payAmount, businessName);
         AliModel aliModel = new AliModel()
         {
             body        = string.Empty,
             orderNo     = orderNo,
             payMoney    = payAmount,
             productName = businessName
         };
         qrcodeUrl = new AliCallBack().GetOrder(aliModel);
         if (string.IsNullOrEmpty(qrcodeUrl))
         {
             return(ResultModel <PayResultModel> .Conclude(AliPayStatus.fail));
         }
     }
     resultModel.aliQRCode = qrcodeUrl;
     resultModel.orderNo   = orderNo;
     resultModel.payAmount = payAmount;
     resultModel.payType   = PayTypeEnum.ZhiFuBao.GetHashCode();
     resultModel.notifyUrl = ETS.Config.NotifyUrl;
     return(ResultModel <PayResultModel> .Conclude(AliPayStatus.success, resultModel));
 }
Example #11
0
        private void OKevent(Window p)
        {
            if (validate_customer() == true)
            {
                CUSTOMER cus = new CUSTOMER();
                cus.ADDRESS      = Cus_address;
                cus.CITY         = Cus_city;
                cus.CUST_TYPE_CD = Cus_custype;
                cus.FED_ID       = Cus_fedid;
                cus.POSTAL_CODE  = Cus_postalcode;
                cus.STATE        = Cus_state;
                if (cv == "insert")
                {
                    CustomerDao.Instance().Insert(cus);
                    off = new OFFICER();
                    ind = new INDIVIDUAL();
                    bus = new BUSINESS();
                    int last_cus = CustomerDao.Instance().LastCUST().CUST_ID;
                    off.CUST_ID = last_cus;
                    ind.CUST_ID = last_cus;
                    bus.CUST_ID = last_cus;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;

                            IndividualDao.Instance().Insert(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }

                            OfficerDao.Instance().Insert(off);
                            BusinessDao.Instance().Insert(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                else
                {
                    cus.CUST_ID = custid;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;
                            CustomerDao.Instance().Update(cus);
                            IndividualDao.Instance().Update(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }
                            CustomerDao.Instance().Update(cus);
                            OfficerDao.Instance().Update(off);
                            BusinessDao.Instance().Update(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                p.Close();
                vm.CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
            else
            {
                MessageBox.Show("Customer:Bạn điền thiếu thông tin!", "Thông báo");
            }
        }
Example #12
0
        public CustomerEditVM(CUSTOMER c, CustomerVM vm)
        {
            if (c == null)
            {
                this.In_firstname = "";
                this.In_lastname  = "";
                this.In_birthdate = "";

                this.Bu_name       = "";
                this.Bu_stateid    = "";
                this.Bu_incorpdate = "";

                this.Of_enddate   = "";
                this.Of_firstname = "";
                this.Of_startdate = "";
                this.Of_title     = "";
                this.Of_lastname  = "";

                this.Cus_address    = "";
                this.Cus_city       = "";
                this.Cus_custype    = "";
                this.Cus_postalcode = "";
                this.Cus_fedid      = "";
                this.Cus_state      = "";
                this.cv             = "insert";
            }
            else
            {
                ind = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                bus = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                off = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                if (ind != null)
                {
                    In_lastname  = ind.LAST_NAME;
                    In_firstname = ind.FIRST_NAME;
                    In_birthdate = ind.BIRTH_DATE.ToString();
                }
                if (off != null && bus != null)
                {
                    Of_lastname   = off.LAST_NAME;
                    Of_firstname  = off.FIRST_NAME;
                    Of_title      = off.TITLE;
                    Of_startdate  = off.START_DATE.ToString();
                    Of_enddate    = off.END_DATE.ToString();
                    Bu_name       = bus.NAME;
                    Bu_stateid    = bus.STATE_ID;
                    Bu_incorpdate = bus.INCORP_DATE.ToString();
                }

                this.Cus_address    = c.ADDRESS;
                this.Cus_city       = c.CITY;
                this.Cus_custype    = c.CUST_TYPE_CD;
                this.Cus_postalcode = c.POSTAL_CODE;
                this.Cus_fedid      = c.FED_ID;
                this.Cus_state      = c.STATE;
                this.cv             = "update";
                this.custid         = c.CUST_ID;
            }
            this.vm       = vm;
            OKCommand     = new RelayCommand <Window>((p) => { return(p != null ? true : false); }, (p) => { OKevent(p); });
            CancelCommand = new RelayCommand <Window>((p) => true, (p) => { p.Close(); });
        }
Example #13
0
        /// <summary>
        /// 美团的订单数据转成通用的openapi接入订单数据实体类型 20150421
        /// </summary>
        /// <param name="fromModel">美团数据实体</param>
        public CreatePM_OpenApi TranslateModel(MeiTuanOrdeModel fromModel)
        {
            #region 订单基础数据
            CreatePM_OpenApi model = new CreatePM_OpenApi();
            model.order_id = fromModel.order_id; //订单ID
            //店铺信息  店铺是已经在E代送存在的,这里没有任何实际意义,数据用不到
            Store store = new Store();
            store.store_id      = fromModel.app_poi_code;             //对接方店铺id
            store.store_name    = fromModel.wm_poi_name;              //店铺名称
            store.address       = fromModel.wm_poi_address;           //店铺地址
            store.phone         = fromModel.wm_poi_phone;             //店铺电话
            store.group         = GroupType.Group4.GetHashCode();     //店铺电话
            model.remark        = fromModel.caution;                  //备注
            model.status        = OrderStatus.Status30.GetHashCode(); //初始化订单状态 第三方代接入
            model.create_time   = DateTime.Now;                       //订单发单时间 创建时间
            model.payment       = fromModel.pay_type;                 //支付类型
            model.is_pay        = fromModel.pay_type != 1;            //目前货到付款时取未支付,在线支付取已支付
            model.total_price   = fromModel.total;                    //订单金额
            model.store_info    = store;                              //店铺
            model.invoice_title = fromModel.invoice_title;            //发票标题

            //订单明细不为空时做处理
            if (!string.IsNullOrWhiteSpace(fromModel.detail) && fromModel.detail != "")
            {
                MeiTuanOrdeDetailModel[] meituandetails = JsonHelper.JsonConvertToObject <MeiTuanOrdeDetailModel[]>(fromModel.detail);
                OrderDetail[]            details        = new OrderDetail[meituandetails.Length];
                for (int i = 0; i < meituandetails.Length; i++)
                {
                    OrderDetail tempdetail = new OrderDetail();
                    tempdetail.product_name = meituandetails[i].food_name; //菜品名称
                    tempdetail.quantity     = meituandetails[i].quantity;  //菜品数量
                    tempdetail.unit_price   = meituandetails[i].price;     //菜品单价
                    tempdetail.detail_id    = 0;                           //美团不传递明细id,明细id为0
                    details[i] = tempdetail;
                }
                model.order_details = details; //订单ID
            }

            model.orderfrom = GroupType.Group4.GetHashCode();                     // 订单来源  美团订单的订单来源是 4

            model.receive_time = TimeHelper.TimeStampToDateTime(fromModel.ctime); //美团不传递,E代送必填 要求送餐时间
            #endregion

            #region 订单商户相关信息
            var redis      = new ETS.NoSql.RedisCache.RedisCache();
            int businessId = ParseHelper.ToInt(redis.Get <string>(string.Format(ETS.Const.RedissCacheKey.OtherBusinessIdInfo, model.orderfrom,
                                                                                model.store_info.store_id.ToString()))); //缓存中取E代送商户id
            if (businessId == 0)
            {
                return(null);
            }
            else
            {
                model.businessId = businessId;
            }
            BusListResultModel business = new BusinessDao().GetBusiness(businessId);
            if (business.Status != BusinessStatus.Status1.GetHashCode())//商户非审核通过不允许接单
            {
                return(null);
            }
            model.store_info.delivery_fee       = ParseHelper.ToDecimal(business.DistribSubsidy);     //外送费
            model.store_info.businesscommission = ParseHelper.ToDecimal(business.BusinessCommission); //结算比例
            model.CommissionType     = business.CommissionType;
            model.CommissionFixValue = business.CommissionFixValue;
            model.BusinessGroupId    = business.BusinessGroupId;
            model.MealsSettleMode    = business.MealsSettleMode;
            #endregion

            #region 订单地址信息
            Address address = new Address();
            address.address       = fromModel.recipient_address; //用户收货地址
            address.user_phone    = fromModel.recipient_phone;   //用户联系电话
            address.user_name     = fromModel.recipient_name;    //用户姓名
            address.longitude     = fromModel.longitude;         //经度
            address.latitude      = fromModel.latitude;          //纬度
            address.city_code     = business.CityId;             //市
            address.city          = business.City;
            address.area_code     = business.districtId;         //区
            address.area          = business.district;
            address.province      = business.Province;           //省
            address.province_code = business.ProvinceCode;
            model.address         = address;                     //订单ID
            #endregion

            #region 佣金相关
            model.package_count = 1; //订单份数
            //佣金计算规则
            //model.CommissionFormulaMode = ParseHelper.ToInt(Ets.Dao.GlobalConfig.GlobalConfigDao.GlobalConfigGet(1).CommissionFormulaMode);
            model.CommissionFormulaMode = business.StrategyId;
            //计算获得订单骑士佣金
            OrderCommission orderComm = new OrderCommission()
            {
                Amount             = model.total_price,                   /*订单金额*/
                DistribSubsidy     = model.store_info.delivery_fee,       /*外送费*/
                OrderCount         = model.package_count,                 /*订单数量*/
                BusinessCommission = model.store_info.businesscommission, /*商户结算比例*/
                BusinessGroupId    = model.BusinessGroupId,
                StrategyId         = model.CommissionFormulaMode
            } /*网站补贴*/;
            //OrderPriceProvider commissonPro = CommissionFactory.GetCommission();
            OrderPriceProvider commissonPro = CommissionFactory.GetCommission(business.StrategyId);
            model.ordercommission = commissonPro.GetCurrenOrderCommission(orderComm);                 //骑士佣金
            model.websitesubsidy  = commissonPro.GetOrderWebSubsidy(orderComm);                       //网站补贴
            model.commissionrate  = commissonPro.GetCommissionRate(orderComm);                        //订单佣金比例
            model.settlemoney     = commissonPro.GetSettleMoney(orderComm);                           //订单结算金额
            model.adjustment      = commissonPro.GetAdjustment(orderComm);                            //订单额外补贴金额
            #endregion
            if (!(bool)model.is_pay && model.MealsSettleMode == MealsSettleMode.LineOn.GetHashCode()) //未付款且线上支付
            {
                //paramodel.BusinessReceivable = Decimal.Round(ParseHelper.ToDecimal(paramodel.total_price) +
                //               ParseHelper.ToDecimal(paramodel.store_info.delivery_fee) * ParseHelper.ToInt(paramodel.package_count), 2);
                //只有一个子订单
                model.BusinessReceivable = Decimal.Round(ParseHelper.ToDecimal(model.total_price) +
                                                         ParseHelper.ToDecimal(model.store_info.delivery_fee), 2);
            }

            //fromModel.extras 说明,暂时不用
            return(model);
        }
Example #14
0
 public EnvironmentController()
 {
     _businessDao            = new BusinessDao();
     _environmentDao         = new EnvironmentDao();
     _environmentCategoryDao = new EnvironmentCategoryDao();
 }
        /// <summary>
        /// 获取homecount页的数量
        /// 窦海超
        /// 2015年3月24日 13:36:34
        /// </summary>
        /// <returns></returns>
        public HomeCountTitleModel GetHomeCountTitle()
        {
            HomeCountTitleModel model       = new HomeCountTitleModel();
            ClienterDao         clienterDao = new ClienterDao();
            BusinessDao         businessDao = new BusinessDao();
            OrderDao            orderDao    = new OrderDao();
            SubsidyDao          subsidyDao  = new SubsidyDao();

            Ets.Dao.Statistics.StatisticsDao statisticsDao = new Ets.Dao.Statistics.StatisticsDao();
            HomeCountTitleModel temp = new HomeCountTitleModel();
            //获取当天,订单金额:任务量:订单量:
            //商户结算金额(应收); 骑士佣金总计(应付)
            string CurrentTime = DateTime.Now.ToString("yyyy-MM-dd");
            IList <HomeCountTitleModel> homeCountList         = orderDao.GetCurrentDateCountAndMoney(CurrentTime, CurrentTime);
            IList <HomeCountTitleModel> subsidyOrderCountList = orderDao.GetCurrentDateSubsidyOrderCount(CurrentTime, CurrentTime);

            #region   获取当天,未完成任务量,未被抢任务量
            var unfinish = statisticsDao.GetCurrentUnFinishOrderinfo();
            if (unfinish != null)
            {
                model.UnfinishedMissionCount = unfinish.UnfinishedMissionCount; //未完成任务量
                model.UnGrabMissionCount     = unfinish.UnGrabMissionCount;     //未抢单任务量
            }
            #endregion

            #region 获取活跃商家和活跃骑士
            unfinish = statisticsDao.GetCurrentActiveBussinessAndClienter();
            if (unfinish != null)
            {
                model.ActiveBusiness = unfinish.ActiveBusiness; //活跃商家
                model.ActiveClienter = unfinish.ActiveClienter; //活跃骑士
            }

            #endregion


            if (homeCountList != null && homeCountList.Count > 0)
            {
                temp = homeCountList[0];
            }

            model.OrderPrice    = temp.OrderPrice;                                                            // 订单金额
            model.MisstionCount = temp.MisstionCount;                                                         // 任务量
            model.OrderCount    = temp.OrderCount;                                                            // 订单量
            model.YsPrice       = Math.Round(temp.YsPrice, 2);                                                // 商户结算金额(应收)
            model.YfPrice       = Math.Round(temp.YfPrice, 2);                                                // 骑士佣金总计(应付)
            model.YkPrice       = Math.Round(model.YsPrice - model.YfPrice, 2);                               //盈亏总计:+
            model.PubDate       = temp.PubDate;                                                               //发布时间
            temp              = clienterDao.GetCountAndMoney(model);                                          //获取已申请骑士,通过骑士数量
            model.RzqsCount   = temp.RzqsCount;                                                               // 认证骑士数量
            model.DdrzqsCount = temp.DdrzqsCount;                                                             //等待认证骑士

            temp = businessDao.GetCurrentBusinessCount(model);                                                // 商家总数:
            model.BusinessCount = temp.BusinessCount;                                                         //商家总数

            model.BusinessAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveBusiness); //商户平均发布订单
            model.MissionAverageOrderCount  = ParseHelper.ToDivision(model.OrderCount, model.MisstionCount);  //任务平均订单量
            model.ClienterAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveClienter); //骑士平均完成订单量
            if (subsidyOrderCountList != null && subsidyOrderCountList.Count > 0)
            {
                var zeroSubsidyOrderCount  = subsidyOrderCountList.Where(t => t.DealCount == 0).ToList();
                var oneSubsidyOrderCount   = subsidyOrderCountList.Where(t => t.DealCount == 1).ToList();
                var twoSubsidyOrderCount   = subsidyOrderCountList.Where(t => t.DealCount == 2).ToList();
                var threeSubsidyOrderCount = subsidyOrderCountList.Where(t => t.DealCount == 3).ToList();
                model.ZeroSubsidyOrderCount  = zeroSubsidyOrderCount != null && zeroSubsidyOrderCount.Count > 0 ? zeroSubsidyOrderCount[0].OrderCount : 0;
                model.OneSubsidyOrderCount   = oneSubsidyOrderCount != null && oneSubsidyOrderCount.Count > 0 ? oneSubsidyOrderCount[0].OrderCount : 0;
                model.TwoSubsidyOrderCount   = twoSubsidyOrderCount != null && twoSubsidyOrderCount.Count > 0 ? twoSubsidyOrderCount[0].OrderCount : 0;
                model.ThreeSubsidyOrderCount = threeSubsidyOrderCount != null && threeSubsidyOrderCount.Count > 0 ? threeSubsidyOrderCount[0].OrderCount : 0;
            }
            else
            {
                model.ZeroSubsidyOrderCount  = 0;
                model.OneSubsidyOrderCount   = 0;
                model.TwoSubsidyOrderCount   = 0;
                model.ThreeSubsidyOrderCount = 0;
            }



            return(model);
        }