/// <summary> /// /// </summary> public string GetVipIntegralDetailData() { var service = new VipIntegralDetailBLL(CurrentUserInfo); string content = string.Empty; string key = string.Empty; if (Request("vip_id") != null && Request("vip_id") != string.Empty) { key = Request("vip_id").ToString().Trim(); } var queryEntity = new VipIntegralDetailEntity(); queryEntity.VIPID = key; int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1; var data = service.GetVipIntegralDetailList(queryEntity, pageIndex, PageSize); var dataTotalCount = service.GetVipIntegralDetailListCount(queryEntity); content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", data.ToJSON(), dataTotalCount); return(content); }
protected override EmptyResponseData ProcessRequest(APIRequest <SetVipIntegralRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息 var vipIntegralDetail = new VipIntegralDetailBLL(loggingSessionInfo); //积分变更业务对象实例化 var objectImagesBLL = new ObjectImagesBLL(loggingSessionInfo); //图片表业务对象实例化 var unitBLL = new t_unitBLL(loggingSessionInfo); var vipIntegralBLL = new VipIntegralBLL(loggingSessionInfo); var vipBLL = new VipBLL(loggingSessionInfo); var vipInfo = vipBLL.GetByID(para.VipID); var unitInfo = unitBLL.GetByID(loggingSessionInfo.CurrentUserRole.UnitId); var pTran = vipIntegralDetail.GetTran(); //事务 var vipIntegral = vipIntegralBLL.GetByID(para.VipID); using (pTran.Connection) { try { var IntegralDetail = new VipIntegralDetailEntity() { Integral = para.Qty, IntegralSourceID = para.IntegralSourceID, ObjectId = "", Reason = para.Reason, Remark = para.Remark }; if (IntegralDetail.Integral != 0) { //变动前积分 string OldIntegral = string.Empty; if (vipIntegral != null) { OldIntegral = (vipIntegral.ValidIntegral ?? 0).ToString(); } else { OldIntegral = "0"; } //变动积分 string ChangeIntegral = (IntegralDetail.Integral ?? 0).ToString(); string vipIntegralDetailId = vipIntegralBLL.AddIntegral(ref vipInfo, unitInfo, IntegralDetail, pTran, loggingSessionInfo); //发送微信积分变动通知模板消息 if (!string.IsNullOrWhiteSpace(vipIntegralDetailId)) { var CommonBLL = new CommonBLL(); CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, loggingSessionInfo); } //增加图片上传 if (!string.IsNullOrEmpty(para.ImageUrl)) { var objectImagesEntity = new ObjectImagesEntity() { ImageId = Guid.NewGuid().ToString(), ObjectId = vipIntegralDetailId, ImageURL = para.ImageUrl }; objectImagesBLL.Create(objectImagesEntity); } } pTran.Commit(); //提交事物 } catch (APIException apiEx) { pTran.Rollback();//回滚事物 throw new APIException(apiEx.ErrorCode, apiEx.Message); } catch (Exception ex) { pTran.Rollback();//回滚事物 throw new Exception(ex.Message); } } return(rd); }
/// <summary> /// /// </summary> public string SaveChangeIntegral() { var vipIntegralDetailBLL = new VipIntegralDetailBLL(this.CurrentUserInfo); var vipIntegralBLL = new VipIntegralBLL(this.CurrentUserInfo); var vipBLL = new VipBLL(this.CurrentUserInfo); string content = string.Empty; string error = ""; var responseData = new ResponseData(); string key = string.Empty; var item = Request("item"); if (FormatParamValue(item) != null && FormatParamValue(item) != string.Empty) { key = FormatParamValue(item).ToString().Trim(); } var vipIntegralDetailEntity = key.DeserializeJSONTo <VipIntegralDetailEntity>(); if (vipIntegralDetailEntity.Integral == null || vipIntegralDetailEntity.Integral == 0) { responseData.success = false; responseData.msg = "积分不能为空或0"; return(responseData.ToJSON()); } if (vipIntegralDetailEntity.Remark == null || vipIntegralDetailEntity.Remark.Trim().Length == 0) { responseData.success = false; responseData.msg = "变动原因不能为空"; return(responseData.ToJSON()); } //[IntegralSourceID]: 11, 人工调整 vipIntegralBLL.ProcessPoint(11, this.CurrentUserInfo.ClientID, vipIntegralDetailEntity.VIPID, this.CurrentUserInfo.UserID, null, null, vipIntegralDetailEntity.Integral.Value, vipIntegralDetailEntity.Remark, this.CurrentUserInfo.UserID); //vipIntegralDetailEntity.VipIntegralDetailID = Utils.NewGuid(); //vipIntegralDetailEntity.EffectiveDate = DateTime.Now; //vipIntegralDetailEntity.CreateBy = CurrentUserInfo.CurrentUser.User_Id; //vipIntegralDetailEntity.CreateTime = DateTime.Now; //vipIntegralDetailEntity.LastUpdateBy = CurrentUserInfo.CurrentUser.User_Id; //vipIntegralDetailEntity.LastUpdateTime = DateTime.Now; //vipIntegralDetailBLL.Create(vipIntegralDetailEntity); //var vipList = vipBLL.QueryByEntity(new VipEntity() //{ // VIPID = vipIntegralDetailEntity.VIPID //}, null); //VipEntity vipObj = vipList[0]; //var vipIntegralList = vipIntegralBLL.QueryByEntity(new VipIntegralEntity() { // VipID = vipIntegralDetailEntity.VIPID //}, null); //VipIntegralEntity vipIntegralObj = null; //if (vipIntegralList != null && vipIntegralList.Length > 0) //{ // vipIntegralObj = vipIntegralList[0]; // if (vipIntegralDetailEntity.Integral > 0) // { // vipIntegralObj.InIntegral = vipIntegralDetailEntity.Integral; // vipIntegralObj.ValidIntegral += vipIntegralDetailEntity.Integral; // vipIntegralObj.EndIntegral = vipIntegralObj.ValidIntegral; // } // else if (vipIntegralDetailEntity.Integral < 0) // { // vipIntegralObj.OutIntegral = vipIntegralDetailEntity.Integral; // vipIntegralObj.ValidIntegral += vipIntegralDetailEntity.Integral; // vipIntegralObj.EndIntegral = vipIntegralObj.ValidIntegral; // } // vipIntegralBLL.Update(vipIntegralObj, false); //} //else //{ // vipIntegralBLL.Create(new VipIntegralEntity() // { // VipID = vipIntegralDetailEntity.VIPID, // BeginIntegral = 0, // InIntegral = vipIntegralDetailEntity.Integral > 0 ? vipIntegralDetailEntity.Integral : 0, // OutIntegral = vipIntegralDetailEntity.Integral < 0 ? vipIntegralDetailEntity.Integral : 0, // EndIntegral = vipIntegralDetailEntity.Integral, // InvalidIntegral = 0, // ValidIntegral = vipIntegralDetailEntity.Integral // }); //} //vipObj.Integration = vipIntegralObj.EndIntegral; //vipBLL.Update(vipObj, false); responseData.success = true; responseData.msg = error; content = responseData.ToJSON(); return(content); }
/// <summary> /// 验证真伪得积分 /// </summary> public string SetCheckReal() { string content = string.Empty; var respData = new SetCheckRealRespData(); try { string openId = Request["openID"]; //openId = "o8Y7Ejl1zl5RHXDvPONCNqoC5Md8"; Loggers.Debug(new DebugLogInfo() { Message = string.Format( "OpenID:{0}", openId) }); var currentUser = Default.GetLoggingSession(); VipBLL vipBLL = new VipBLL(currentUser); IntegralRuleBLL integralRuleBLL = new IntegralRuleBLL(currentUser); VipIntegralDetailBLL vipIntegralDetailBLL = new VipIntegralDetailBLL(currentUser); VipIntegralBLL vipIntegralBLL = new VipIntegralBLL(currentUser); string vipId = null; if (true) { VipEntity vipIdData = null; var vipIdDataList = vipBLL.QueryByEntity(new VipEntity() { WeiXinUserId = openId }, null); if (vipIdDataList == null || vipIdDataList.Length == 0 || vipIdDataList[0] == null || vipIdDataList[0].VIPID == null) { respData.Code = "103"; respData.Description = "数据库操作错误"; respData.Exception = "未查询到Vip会员"; return(respData.ToJSON()); } else { vipIdData = vipIdDataList[0]; vipId = vipIdData.VIPID; } } // SysIntegralSource: 10 string integralSourceId = "10"; int integralValue = 0; if (true) { IntegralRuleEntity integralRuleData = null; var integralRuleDataList = integralRuleBLL.QueryByEntity(new IntegralRuleEntity() { IntegralSourceID = integralSourceId }, null); if (integralRuleDataList == null || integralRuleDataList.Length == 0 || integralRuleDataList[0] == null) { respData.Code = "103"; respData.Description = "数据库操作错误"; respData.Exception = "未查询到积分规则"; return(respData.ToJSON()); } else { integralRuleData = integralRuleDataList[0]; integralValue = int.Parse(integralRuleData.Integral); } } #region 保存积分 if (true) { string tmpVipId = vipId; int tmpIntegralValue = integralValue; string tmpIntegralSourceId = integralSourceId; string tmpOpenId = openId; string msgModel = "【验真品,送积分】活动,您本次验证赢得{0}点积分。您当前的总积分是{1}点。"; // 插入积分明细 VipIntegralDetailEntity vipIntegralDetailEntity = new VipIntegralDetailEntity(); vipIntegralDetailEntity.VipIntegralDetailID = CPOS.Common.Utils.NewGuid(); vipIntegralDetailEntity.VIPID = tmpVipId; vipIntegralDetailEntity.FromVipID = tmpVipId; vipIntegralDetailEntity.SalesAmount = 0; vipIntegralDetailEntity.Integral = tmpIntegralValue; vipIntegralDetailEntity.IntegralSourceID = tmpIntegralSourceId; vipIntegralDetailEntity.IsAdd = 1; //vipIntegralDetailBLL.Create(vipIntegralDetailEntity); // 更新积分 VipIntegralEntity vipIntegralEntity = new VipIntegralEntity(); var vipIntegralDataList = vipIntegralBLL.QueryByEntity( new VipIntegralEntity() { VipID = vipId }, null); if (vipIntegralDataList == null || vipIntegralDataList.Length == 0 || vipIntegralDataList[0] == null) { vipIntegralEntity.VipID = tmpVipId; vipIntegralEntity.BeginIntegral = 0; // 期初积分 vipIntegralEntity.InIntegral = tmpIntegralValue; // 增加积分 vipIntegralEntity.OutIntegral = 0; //消费积分 vipIntegralEntity.EndIntegral = tmpIntegralValue; //积分余额 vipIntegralEntity.InvalidIntegral = 0; // 累计失效积分 vipIntegralEntity.ValidIntegral = tmpIntegralValue; // 当前有效积分 //vipIntegralBLL.Create(vipIntegralEntity); } else { vipIntegralEntity.VipID = tmpVipId; vipIntegralEntity.InIntegral = vipIntegralDataList[0].InIntegral + tmpIntegralValue;; // 增加积分 //vipIntegralEntity.OutIntegral = 0; //消费积分 vipIntegralEntity.EndIntegral = vipIntegralDataList[0].EndIntegral + tmpIntegralValue; //积分余额 //vipIntegralEntity.InvalidIntegral = 0; // 累计失效积分 vipIntegralEntity.ValidIntegral = vipIntegralDataList[0].ValidIntegral + tmpIntegralValue; // 当前有效积分 //vipIntegralBLL.Update(vipIntegralEntity, false); } // 更新VIP VipEntity vipEntity = new VipEntity(); var vipEntityDataList = vipBLL.QueryByEntity( new VipEntity() { VIPID = tmpVipId }, null); if (vipEntityDataList == null || vipEntityDataList.Length == 0 || vipEntityDataList[0] == null) { vipEntity.VIPID = tmpVipId; vipEntity.Integration = vipIntegralEntity.ValidIntegral; //vipEntity.HigherVipID = highOpenId; vipEntity.ClientID = currentUser.CurrentUser.customer_id; vipEntity.Status = 1; vipBLL.Create(vipEntity); } else { vipEntity.VIPID = tmpVipId; vipEntity.Integration = vipIntegralEntity.ValidIntegral; //vipEntity.HigherVipID = highOpenId; vipEntity.ClientID = currentUser.CurrentUser.customer_id; vipBLL.Update(vipEntity, false); } // 推送消息 string msgUrl = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim(); string msgText = string.Format(msgModel, tmpIntegralValue, vipEntity.Integration); string msgData = "<xml><OpenID><![CDATA[" + tmpOpenId + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>"; var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData); Loggers.Debug(new DebugLogInfo() { Message = string.Format("PushMsgResult:{0}", msgResult) }); respData.Data = tmpIntegralValue.ToString(); } #endregion } catch (Exception ex) { respData.Code = "103"; respData.Description = "数据库操作错误"; respData.Exception = ex.ToString(); } content = respData.ToJSON(); return(content); }
protected override GetOrderDetailRD ProcessRequest(DTO.Base.APIRequest <GetOrderDetailRP> pRequest) { GetOrderDetailRD rd = new GetOrderDetailRD(); string orderId = pRequest.Parameters.OrderId; rd.OrderListInfo = new OrderListInfo(); #region 获取订单列表 T_InoutBLL orderBll = new T_InoutBLL(this.CurrentUserInfo); var orderList = orderBll.QueryByEntity(new T_InoutEntity() { order_id = orderId }, null); #endregion #region 获取会员信息 string vipNo = orderList[0].vip_no; VipBLL vipBll = new VipBLL(this.CurrentUserInfo); var vipList = vipBll.QueryByEntity(new VipEntity() { VIPID = vipNo }, null); #endregion #region 获取配方式 //Bear 20160928 注释 更具商品信息获取对应配送 string deliveryId = orderList[0].Field8; DeliveryBLL deliverBll = new DeliveryBLL(this.CurrentUserInfo); var deliverList = deliverBll.QueryByEntity(new DeliveryEntity() { DeliveryId = deliveryId }, null); #endregion #region 获取门店信息 string storeId = orderList[0].sales_unit_id; if (!string.IsNullOrEmpty(orderList[0].purchase_unit_id))//如果有发货门店,则显示发货门店信息 { storeId = orderList[0].purchase_unit_id; } TInoutBLL tInoutBll = new TInoutBLL(this.CurrentUserInfo); //string storeName = tInoutBll.GetStoreName(storeId); DataSet storeDs = tInoutBll.GetStoreInfo(storeId); rd.OrderListInfo.StoreID = storeId; #endregion //配送商 string carrierId = orderList[0].carrier_id; //DataSet carrierDs = tInoutBll.GetStoreInfo(carrierId); //if (carrierDs.Tables[0].Rows.Count > 0) //{ // rd.OrderListInfo.CarrierID = carrierId; // rd.OrderListInfo.CarrierName = carrierDs.Tables[0].Rows[0]["unit_name"].ToString(); //} if (!string.IsNullOrEmpty(carrierId)) { //配送方式 1.送货到家;2.到店提货 if (deliveryId == "1") { var logisticsCompanyBLL = new T_LogisticsCompanyBLL(this.CurrentUserInfo); Guid m_carrierId = Guid.Parse(carrierId); var logCompInfo = logisticsCompanyBLL.GetByID(m_carrierId); if (logCompInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = logCompInfo.LogisticsName; } } else if (deliveryId == "2") { var unitBLL = new t_unitBLL(this.CurrentUserInfo); var unitInfo = unitBLL.GetByID(carrierId); if (unitInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = unitInfo.unit_name; } } else if (deliveryId == "4") { var unitBLL = new t_unitBLL(this.CurrentUserInfo); var unitInfo = unitBLL.GetByID(carrierId); if (unitInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = unitInfo.unit_name; } } } rd.OrderListInfo.CourierNumber = orderList[0].Field2; //配送单号 rd.OrderListInfo.Invoice = orderList[0].Field19 == null ? "" : orderList[0].Field19; //发票信息 if (vipList.Count() > 0) { rd.OrderListInfo.VipID = vipList[0].VIPID; rd.OrderListInfo.Phone = vipList[0].Phone; rd.OrderListInfo.UserName = vipList[0].VipName; rd.OrderListInfo.VipRealName = vipList[0].VipRealName; rd.OrderListInfo.VipLevelDesc = vipList[0].VipLevelDesc; rd.OrderListInfo.VipCode = vipList[0].VipCode; rd.OrderListInfo.Email = vipList[0].Email; rd.OrderListInfo.VipLevel = Convert.ToInt32(vipList[0].VipLevel); } if (storeDs.Tables[0].Rows.Count > 0) { rd.OrderListInfo.StoreName = storeDs.Tables[0].Rows[0]["unit_name"].ToString(); rd.OrderListInfo.StoreAddress = storeDs.Tables[0].Rows[0]["unit_address"].ToString(); rd.OrderListInfo.StoreTel = storeDs.Tables[0].Rows[0]["unit_tel"].ToString(); } if (orderList.Count() > 0) { rd.OrderListInfo.discount_rate = orderList[0].discount_rate ?? 100;//订单折扣 rd.OrderListInfo.OrderID = orderList[0].order_id; rd.OrderListInfo.OrderCode = orderList[0].order_no; rd.OrderListInfo.OrderDate = orderList[0].order_date; rd.OrderListInfo.ReceiverName = orderList[0].Field14; //收件人 rd.OrderListInfo.TotalQty = Convert.ToDecimal(orderList[0].total_qty); string TotalAmount = String.Format("{0:F}", orderList[0].total_amount ?? 0); rd.OrderListInfo.TotalAmount = TotalAmount; rd.OrderListInfo.Total_Retail = Convert.ToDecimal(orderList[0].total_retail); rd.OrderListInfo.Remark = orderList[0].remark; rd.OrderListInfo.Status = orderList[0].status; rd.OrderListInfo.OrderStatus = int.Parse(orderList[0].Field7); rd.OrderListInfo.StatusDesc = orderList[0].status_desc; rd.OrderListInfo.DeliveryAddress = orderList[0].Field4; rd.OrderListInfo.DeliveryTime = orderList[0].Field9; rd.OrderListInfo.ClinchTime = orderList[0].create_time; rd.OrderListInfo.ReceiptTime = orderList[0].accpect_time; rd.OrderListInfo.CouponsPrompt = orderList[0].Field16; rd.OrderListInfo.DeliveryID = orderList[0].Field8; rd.OrderListInfo.IsPayment = orderList[0].Field1; rd.OrderListInfo.ReceivePoints = orderList[0].receive_points; rd.OrderListInfo.PaymentTime = orderList[0].Field1 == "1" ? orderList[0].complete_date : null; rd.OrderListInfo.OrderReasonTypeId = orderList[0].order_reason_id; rd.OrderListInfo.ActualDecimal = orderList[0].actual_amount ?? 0; rd.OrderListInfo.PaymentTypeCode = orderList[0].Payment_Type_Code; rd.OrderListInfo.PaymentTypeName = orderList[0].Payment_Type_Name; rd.OrderListInfo.ReserveTime = orderList[0].reserveDay + " " + orderList[0].reserveQuantum; var deliveryBll = new TOrderCustomerDeliveryStrategyMappingBLL(this.CurrentUserInfo); rd.OrderListInfo.DeliveryAmount = deliveryBll.GetDeliverAmount(orderId); //配送费 add by henry*** if (!string.IsNullOrEmpty(orderList[0].Field15) && orderList[0].Field15 != "0") //是否是团购商品 add by Henry 2014-12-22 { rd.OrderListInfo.IsEvent = 1; //团购商品 } else { rd.OrderListInfo.IsEvent = 0; //普通商品 } #region update by changjian.tian rd.OrderListInfo.Mobile = orderList[0].Field6; //配送联系电话 rd.OrderListInfo.DeliveryRemark = orderList[0].remark; rd.OrderListInfo.IsEvaluation = orderList[0].IsEvaluation == null ? 0 : orderList[0].IsEvaluation.Value;//评论 #endregion } if (deliverList.Count() > 0) { rd.OrderListInfo.DeliveryName = deliverList[0].DeliveryName; } T_Inout_DetailBLL orderDetailBll = new T_Inout_DetailBLL(this.CurrentUserInfo); //退换货Bll实例化 T_SalesReturnBLL salesReturnBll = new T_SalesReturnBLL(this.CurrentUserInfo); var orderDetailList = orderDetailBll.QueryByEntity(new T_Inout_DetailEntity() { order_id = orderId }, null); var inoutService = new InoutService(this.CurrentUserInfo); #region 根据订单ID获取订单明细 var ds = inoutService.GetOrderDetailByOrderId(orderId); #endregion #region 获取订单详细列表中的商品规格 var ggDs = inoutService.GetInoutDetailGgByOrderId(orderId); #endregion if (ds.Tables[0].Rows.Count > 0) { string ItemIdList = ds.Tables[0].AsEnumerable().Aggregate("", (x, j) => { x += string.Format("'{0}',", j["item_id"].ToString()); return(x); }).Trim(','); TInoutDetailBLL tInoutDetailBll = new TInoutDetailBLL(this.CurrentUserInfo); //获取商品的图片 DataSet imageDs = tInoutDetailBll.GetOrderDetailImageList(ItemIdList); var tmp = ds.Tables[0].AsEnumerable().Select(t => new OrderDetailEntity() { ItemID = t["item_id"].ToString(), ItemName = t["item_name"].ToString(), SkuID = t["sku_id"].ToString(), SalesReturnFlag = salesReturnBll.CheckSalesReturn(orderId, t["sku_id"].ToString()),//是否可申请退换货 //GG = t["prop_1_detail_name"].ToString()+t["prop_2_detail_name"].ToString()+t["prop_3_detail_name"].ToString() //+t["prop_4_detail_name"].ToString()+t["prop_5_detail_name"].ToString(), Field9 = t["Field9"].ToString(), isGB = Convert.ToInt32(t["isGB"]), GG = ggDs.Tables[0].AsEnumerable() .Where(tt => tt["sku_id"].ToString() == t["sku_id"].ToString()) .Select(tt => new GuiGeInfo { PropName1 = tt["prop_1_name"].ToString(), PropDetailName1 = tt["prop_1_detail_name"].ToString(), PropName2 = tt["prop_2_name"].ToString(), PropDetailName2 = tt["prop_2_detail_name"].ToString(), PropName3 = tt["prop_3_name"].ToString(), PropDetailName3 = tt["prop_3_detail_name"].ToString(), PropName4 = tt["prop_4_name"].ToString(), PropDetailName4 = tt["prop_4_detail_name"].ToString(), PropName5 = tt["prop_5_name"].ToString(), PropDetailName5 = tt["prop_5_detail_name"].ToString() }).FirstOrDefault(), SalesPrice = Convert.ToDecimal(t["enter_price"]), //DiscountRate = Convert.ToDecimal(t["discount_rate"]), DiscountRate = Convert.ToDecimal(t["order_discount_rate"]), ItemCategoryName = t["itemCategoryName"].ToString(), BeginDate = t["Field1"].ToString(), EndDate = t["Field2"].ToString(), DayCount = Convert.ToInt32(t["DayCount"]), Qty = Convert.ToDecimal(t["enter_qty"]), ImageInfo = imageDs.Tables[0].AsEnumerable() .Where(c => c["ObjectId"].ToString() == t["item_id"].ToString()) .OrderBy(c => c["displayIndex"]) .Select(c => new OrderDetailImage { ImageID = c["imageId"].ToString(), ImageUrl = ImagePathUtil.GetImagePathStr(c["imageUrl"].ToString(), "240") }).ToArray(), IfService = Convert.ToInt32(t["IfService"]) }); int tempCount = 0; foreach (var i in tmp) { if (i.IfService == 0) { tempCount++; } } if (tempCount == 0) { rd.OrderListInfo.IsAllService = 3; // 3-全部为虚拟商品 } else if (tempCount == tmp.Count()) { rd.OrderListInfo.IsAllService = 1; // 1-全部为实物商品 } else { rd.OrderListInfo.IsAllService = 2; // 2-包含实物商品和虚拟商品 } #region 根据商品获取配送方式 var deliveryIds = new List <int?>(); if (rd.OrderListInfo.IsAllService == 3) { deliveryIds.Add(1); deliveryIds.Add(2); deliveryIds.Add(4); rd.OrderListInfo.CanUseDeliveryIDs = deliveryIds; } else { T_Item_Delivery_MappingBLL mappingBll = new T_Item_Delivery_MappingBLL(this.CurrentUserInfo); var complexCondition = new List <IWhereCondition> { }; var itemIdArray = ItemIdList.Replace("'", "").Split(','); complexCondition.Add(new InCondition <string>() { FieldName = "Item_Id", Values = itemIdArray }); var itemDeliveryList = mappingBll.Query(complexCondition.ToArray(), null); bool needAddDelivery4 = false; bool needAddDelivery2 = false; if (itemDeliveryList.ToList().Find(d => d.DeliveryId == 4) != null) { needAddDelivery4 = true; } else { if (itemDeliveryList.ToList().Find(d => d.DeliveryId == 2) != null) { needAddDelivery2 = true; } } var itemDeliveryGroupList = itemDeliveryList.GroupBy(d => d.Item_Id); var index = 0; foreach (var info in itemDeliveryGroupList) { var tmpList = info.ToList <T_Item_Delivery_MappingEntity>(); //分组后的集合 if (index == 0) { deliveryIds.AddRange(tmpList.Select(d => d.DeliveryId)); index++; continue; } deliveryIds = deliveryIds.Intersect(tmpList.Select(d => d.DeliveryId)).ToList(); if (deliveryIds.Count <= 0) { break; // 后面的不用求了 } index++; } if (!deliveryIds.Contains(4) && needAddDelivery4) { deliveryIds.Add(4); } if (!deliveryIds.Contains(2) && needAddDelivery2) { deliveryIds.Add(2); } rd.OrderListInfo.CanUseDeliveryIDs = deliveryIds.OrderBy(t => t.Value).ToList(); } #endregion rd.OrderListInfo.OrderDetailInfo = tmp.ToArray(); } var vipIntegralDetailBll = new VipIntegralDetailBLL(this.CurrentUserInfo); // var integral = vipIntegralDetailBll.GetVipIntegralByOrder(orderId, pRequest.UserID); //使用积分 rd.OrderListInfo.OrderIntegral = Math.Abs(vipIntegralDetailBll.GetVipIntegralByOrder(orderId, vipNo)); //积分抵扣金额 add by Henry 2014-10-8 //decimal integralAmountPre = vipBll.GetIntegralAmountPre(this.CurrentUserInfo.ClientID);//获取积分金额比例 //rd.OrderListInfo.UseIntegralToAmount =rd.OrderListInfo.OrderIntegral*(integralAmountPre>0?integralAmountPre:0.01M); rd.OrderListInfo.UseIntegralToAmount = vipBll.GetAmountByIntegralPer(CurrentUserInfo.ClientID, rd.OrderListInfo.OrderIntegral); var couponUseBll = new CouponUseBLL(this.CurrentUserInfo); var couponParValue = couponUseBll.GetCouponParValue(orderId); rd.OrderListInfo.CouponAmount = couponParValue; var vipAmountDetailBll = new VipAmountDetailBLL(this.CurrentUserInfo); //使用的账户余额 rd.OrderListInfo.VipEndAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 1)); //使用余额,将余额从实付款中分开 if (rd.OrderListInfo.VipEndAmount != 0) { rd.OrderListInfo.ActualDecimal = rd.OrderListInfo.ActualDecimal - rd.OrderListInfo.VipEndAmount; } //使用的返现金额 rd.OrderListInfo.ReturnAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 13)); //使用阿拉币和阿拉币抵扣 add by Henry 2014-10-13 if (pRequest.ChannelId == "4")//阿拉丁APP调用 { decimal aldAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 11)); rd.OrderListInfo.ALDAmount = aldAmount; rd.OrderListInfo.ALDAmountMoney = aldAmount * 0.01M; } #region 获取订单积分,优惠券金额,使用余额 //var vipIntegralDetailBll = new VipIntegralDetailBLL(this.CurrentUserInfo); //var vipIntegralList = vipIntegralDetailBll.QueryByEntity(new VipIntegralDetailEntity() //{ // VIPID = pRequest.UserID, // ObjectId = orderId //}, null); //if (vipIntegralList != null && vipIntegralList.Length > 0) //{ // rd.OrderListInfo.OrderIntegral = Math.Abs(vipIntegralList[0].Integral??0); //} //var tOrderCouponMappingBll = new TOrderCouponMappingBLL(this.CurrentUserInfo); //var tOrderCouponMappingList = tOrderCouponMappingBll.QueryByEntity(new TOrderCouponMappingEntity() //{ // OrderId = orderId //}, null); //if (tOrderCouponMappingList != null && tOrderCouponMappingList.Length > 0) //{ // var couponId = tOrderCouponMappingList[0].CouponId; // var couponBll = new CouponBLL(this.CurrentUserInfo); // var couponEntity = couponBll.GetByID(couponId); // if (couponEntity != null) // { // var couponTypeId = couponEntity.CouponTypeID; // var couponTypeBll = new CouponTypeBLL(this.CurrentUserInfo); // var couponTypeEntity = couponTypeBll.GetByID(couponTypeId); // if (couponTypeEntity != null) // { // rd.OrderListInfo.CouponAmount = couponTypeEntity.ParValue ?? 0; // } // } //} //var vipAmountDetailBll = new VipAmountDetailBLL(this.CurrentUserInfo); //var vipAmountDetailList = vipAmountDetailBll.QueryByEntity(new VipAmountDetailEntity() //{ // VipId = pRequest.UserID, // ObjectId = orderId //}, null); //if (vipAmountDetailList != null && vipAmountDetailList.Length > 0) //{ // rd.OrderListInfo.VipEndAmount = Math.Abs(vipAmountDetailList[0].Amount ?? 0); //} #endregion return(rd); }