/// <summary> /// 充值 /// </summary> /// <param name="rechargeOrderInfo"></param> /// <param name="vipInfo"></param> /// <param name="unitInfo"></param> /// <param name="paymentTypeId"></param> public void Recharge(RechargeOrderEntity rechargeOrderInfo, VipEntity vipInfo, t_unitEntity unitInfo, string paymentTypeId) { var rechargeOrderBll = new RechargeOrderBLL(CurrentUserInfo); //会员 var vipCardVipMappingBll = new VipCardVipMappingBLL(CurrentUserInfo); var vipAmountBll = new VipAmountBLL(CurrentUserInfo); //门店 var unitBLL = new t_unitBLL(CurrentUserInfo); rechargeOrderInfo.Status = 1;//已支付 rechargeOrderInfo.PayID = paymentTypeId; rechargeOrderInfo.PayDateTime = DateTime.Now; rechargeOrderBll.Update(rechargeOrderInfo); //获取会员卡绑卡信息 var vipCardVipMappingList = vipCardVipMappingBll.QueryByEntity(new VipCardVipMappingEntity() { VIPID = vipInfo.VIPID }, null); //会员无卡并且是续费充值的 if (vipCardVipMappingList.Count() == 0 && rechargeOrderInfo.OrderDesc == "ReRecharge") { vipCardVipMappingBll.BindVipCard(vipInfo.VIPID, vipInfo.VipCardCode, rechargeOrderInfo.UnitId); } var vipAmountEntity = vipAmountBll.QueryByEntity(new VipAmountEntity() { VipId = vipInfo.VIPID, VipCardCode = vipInfo.VipCode }, null).FirstOrDefault(); //充值 var amountDetailInfo = new VipAmountDetailEntity() { Amount = rechargeOrderInfo.TotalAmount.Value, AmountSourceId = "4", ObjectId = rechargeOrderInfo.OrderID.ToString() }; var vipAmountDetailId = vipAmountBll.AddVipAmount(vipInfo, unitInfo, ref vipAmountEntity, amountDetailInfo, null, CurrentUserInfo); if (!string.IsNullOrWhiteSpace(vipAmountDetailId) && rechargeOrderInfo.TotalAmount.Value != 0) { //发送账户余额变动微信模板消息 var CommonBLL = new CommonBLL(); CommonBLL.BalanceChangedMessage(rechargeOrderInfo.OrderNo, vipAmountEntity, amountDetailInfo, vipInfo.WeiXinUserId, vipInfo.VIPID, CurrentUserInfo); } //赠送 if (rechargeOrderInfo.ReturnAmount.Value != 0) { var returnAmountInfo = new VipAmountDetailEntity() { Amount = rechargeOrderInfo.ReturnAmount.Value, AmountSourceId = "6", ObjectId = rechargeOrderInfo.OrderID.ToString() }; var vipReturnDetailId = vipAmountBll.AddVipAmount(vipInfo, unitInfo, ref vipAmountEntity, returnAmountInfo, null, CurrentUserInfo); if (!string.IsNullOrWhiteSpace(vipReturnDetailId) && rechargeOrderInfo.ReturnAmount.Value != 0) { //发送账户余额变动微信模板消息 var CommonBLL = new CommonBLL(); CommonBLL.BalanceChangedMessage(rechargeOrderInfo.OrderNo, vipAmountEntity, returnAmountInfo, vipInfo.WeiXinUserId, vipInfo.VIPID, CurrentUserInfo); } } if (rechargeOrderInfo.OrderDesc == "Upgrade") { //会员卡升级 vipCardVipMappingBll.BindVirtualItem(vipInfo.VIPID, vipInfo.VipCode, rechargeOrderInfo.UnitId, rechargeOrderInfo.VipCardTypeId ?? 0, "Recharge", orderId: rechargeOrderInfo.OrderID.ToString()); } //充值分润 RedisRechargeOrderBLL redisRechargeOrderBll = new RedisRechargeOrderBLL(); redisRechargeOrderBll.SetRedisToRechargeOrder(CurrentUserInfo, rechargeOrderInfo); }
/// <summary> /// 创建潜在分经销商 /// </summary> /// <param name="loggingSessionInfo">loggingSessionInfo</param> /// <param name="vip_no">vip_no</param> public void CreatePrepRetailTrader(LoggingSessionInfo loggingSessionInfo, string vip_no) { VipEntity vipEntity = new VipBLL(loggingSessionInfo).GetVipDetailByVipID(vip_no); RetailTraderDAO retailTraderDao = new RetailTraderDAO(loggingSessionInfo); if (vipEntity == null || string.IsNullOrWhiteSpace(vipEntity.Col20)) { return; } /// 判断当前vip会员手机号是否存在经销记录 var entiryList = this.QueryByEntity(new RetailTraderEntity() { RetailTraderLogin = vipEntity.Phone }, null); if (entiryList != null && entiryList.Length > 0) { return; } t_unitEntity unitEntity = new t_unitBLL(loggingSessionInfo).GetMainUnit(loggingSessionInfo.ClientID); int RetailTraderCode = getMaxRetailTraderCode(loggingSessionInfo.ClientID); RetailTraderEntity pEntity = new RetailTraderEntity(); pEntity.RetailTraderID = Guid.NewGuid().ToString(); pEntity.RetailTraderType = "MultiLevelSaler"; pEntity.RetailTraderCode = RetailTraderCode + 1; pEntity.RetailTraderName = vipEntity.VipName; pEntity.RetailTraderLogin = vipEntity.Phone; pEntity.RetailTraderPass = MD5Helper.Encryption("888888"); pEntity.SalesType = ""; pEntity.RetailTraderMan = ""; pEntity.RetailTraderPhone = vipEntity.Phone; pEntity.RetailTraderAddress = ""; pEntity.CooperateType = ""; pEntity.SellUserID = ""; pEntity.UnitID = unitEntity.unit_id; pEntity.MultiLevelSalerFromVipId = vip_no; if (!string.IsNullOrEmpty(vipEntity.Col20)) { pEntity.HigheRetailTraderID = vipEntity.Col20; } pEntity.CreateTime = DateTime.Now;; pEntity.CreateBy = "sys"; pEntity.LastUpdateBy = "sys"; pEntity.LastUpdateTime = DateTime.Now; pEntity.IsDelete = 0; pEntity.CustomerId = loggingSessionInfo.ClientID; pEntity.Status = "2"; retailTraderDao.Create(pEntity); this.Create2Ap(pEntity);//ap库里的RetailTraderID和商户里的RetailTraderID是一样的 new ObjectImagesBLL(loggingSessionInfo).SaveRetailTraderHeadImg(vipEntity, pEntity); // todo CommonBLL commonBll = new CommonBLL(); string content = "您的帐号:" + pEntity.RetailTraderLogin + ",密码:888888,已经在连锁掌柜注册成功,请在地址http://app.chainclouds.com/download/chengguo/下载一起发码APP,早下载早成为经销商赚钱"; JIT.CPOS.BS.Entity.WX.SendMessageEntity messageEntity = new JIT.CPOS.BS.Entity.WX.SendMessageEntity(); messageEntity.content = content; messageEntity.touser = vipEntity.WeiXinUserId; messageEntity.msgtype = "text"; WApplicationInterfaceEntity[] wApplicationInterfaceEntities = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity { CustomerId = loggingSessionInfo.ClientID }, null); commonBll.SendMessage(messageEntity, wApplicationInterfaceEntities[0].AppID, wApplicationInterfaceEntities[0].AppSecret, loggingSessionInfo); }