public string setOrderInfo() { //string content = string.Empty; var respData = new setOrderInfoRespData(); //try //{ string reqContent = ""; Loggers.Debug(new DebugLogInfo() { Message = string.Format("setOrderInfo: {0}", reqContent) }); #region //解析请求字符串 chech //var reqObj = reqContent.DeserializeJSONTo<setOrderInfoReqData>(); //reqObj = reqObj == null ? new setOrderInfoReqData() : reqObj; //if (reqObj.special == null) //{ // reqObj.special = new setOrderInfoReqSpecialData(); //} //if (reqObj.special == null) //{ // respData.code = "102"; // respData.description = "没有特殊参数"; // return respData.ToJSON().ToString(); //} //if (reqObj.special.skuId == null || reqObj.special.skuId.Equals("")) //{ // respData.code = "2201"; // respData.description = "skuId不能为空"; // return respData.ToJSON().ToString(); //} //if (reqObj.special.qty == null || reqObj.special.qty.Equals("")) //{ // respData.code = "2202"; // respData.description = "qty购买的数量不能为空"; // return respData.ToJSON().ToString(); //} //if (reqObj.special.salesPrice == null || reqObj.special.salesPrice.Equals("")) //{ // respData.code = "2203"; // respData.description = "salesPrice销售价格不能为空"; // return respData.ToJSON().ToString(); //} //if (reqObj.special.stdPrice == null || reqObj.special.stdPrice.Equals("")) //{ // respData.code = "2204"; // respData.description = "stdPrice原价格不能为空"; // return respData.ToJSON().ToString(); //} //if (reqObj.special.deliveryId == null || reqObj.special.deliveryId.Equals("")) //{ // respData.code = "2205"; // respData.description = "deliveryId提货方式不能为空"; // return respData.ToJSON().ToString(); //} //if (reqObj.common.userId == null || reqObj.common.userId.Equals("")) //{ // respData.code = "2206"; // respData.description = "userId不能为空"; // return respData.ToJSON().ToString(); //} #endregion #region //判断客户ID是否传递 //if (!string.IsNullOrEmpty(reqObj.common.customerId)) //{ // customerId = reqObj.common.customerId; //} var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; #endregion #region 设置参数 InoutService service = new InoutService(loggingSessionInfo); SetOrderEntity orderInfo = new SetOrderEntity(); orderInfo.SkuId = "1"; orderInfo.TotalQty = 1; //if (reqObj.special.storeId == null || reqObj.special.storeId.Trim().Equals("")) //{ // UnitService unitServer = new UnitService(loggingSessionInfo); // orderInfo.StoreId = unitServer.GetUnitByUnitType("OnlineShopping", null).Id; //获取在线商城的门店标识 //} //else //{ // orderInfo.StoreId = ToStr(reqObj.special.storeId); //} orderInfo.StoreId = "1"; orderInfo.SalesPrice = 0; orderInfo.StdPrice = -1; orderInfo.TotalAmount = 0; orderInfo.Mobile = ""; orderInfo.Email = ""; orderInfo.Remark = ""; orderInfo.CreateBy = ""; orderInfo.LastUpdateBy = ""; orderInfo.DeliveryId = ""; orderInfo.DeliveryTime = ""; orderInfo.DeliveryAddress = ""; orderInfo.CustomerId = loggingSessionInfo.CurrentLoggingManager.Customer_Id; orderInfo.OpenId = ""; orderInfo.username = ""; if (orderInfo.OrderId == null || orderInfo.OrderId.Equals("")) { orderInfo.OrderId = BaseService.NewGuidPub(); orderInfo.OrderDate = System.DateTime.Now.ToString("yyyy-MM-dd"); orderInfo.Status = "100"; orderInfo.StatusDesc = "待审核"; orderInfo.DiscountRate = Convert.ToDecimal((orderInfo.SalesPrice / orderInfo.StdPrice) * 100); //获取订单号 TUnitExpandBLL serviceUnitExpand = new TUnitExpandBLL(loggingSessionInfo); orderInfo.OrderCode = serviceUnitExpand.GetUnitOrderNo(); } #endregion string strError = string.Empty; string strMsg = string.Empty; Loggers.Debug(new DebugLogInfo() { Message = string.Format("setOrderInfo: {0}", "开始保存") }); bool bReturn = service.SetOrderOnlineShoppingCoupon(orderInfo, out strError, out strMsg); #region 返回信息设置 //respData.content = new setOrderInfoRespContentData(); //respData.content.orderId = orderInfo.OrderId; //respData.exception = strError; //respData.description = strMsg; //if (!bReturn) //{ // respData.code = "111"; //} #endregion //} //content = respData.ToJSON(); //return content; return(orderInfo.OrderCode); }
/// <summary> /// 处理订单支付之后业务标识 /// </summary> /// <param name="OrderCustomerInfo"></param> /// <param name="strResult"></param> /// <param name="strOutTradeNo"></param> private void SetPayOrderInfo(string OrderCustomerInfo, string strResult, string strOutTradeNo) { //order_id: 订单号 //result: success(交易成功) 或者 fail(交易失败) //out_trade_no: 与订单号对应的外部交易号(方便日后查询交易中的详细信息) try { #region check if (OrderCustomerInfo == null || OrderCustomerInfo.Equals("")) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo: {0}", "返回订单号为空") }); return; } if (strResult == null || strResult.Equals("fail")) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo: {0}", "支付失败") }); return; } #endregion #region 处理业务 var infos = OrderCustomerInfo.Split(','); if (infos.Length != 2) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo-OrderCustomerInfo: {0}", "长度错误") }); return; } string customerId = infos[0].ToString().Trim(); string orderCode = infos[1].ToString().Trim(); var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); InoutService service = new InoutService(loggingSessionInfo); SetOrderEntity orderInfo = new SetOrderEntity(); orderInfo.OrderCode = orderCode; orderInfo.PaymentTypeId = "BB04817882B149838B19DE2BDDA5E91B"; //orderInfo.PaymentAmount = Convert.ToDecimal(reqObj.special.paymentAmount); //orderInfo.LastUpdateBy = ToStr(reqObj.common.userId); orderInfo.PaymentTime = System.DateTime.Now; orderInfo.Status = "2"; orderInfo.StatusDesc = "已支付"; orderInfo.OutTradeNo = strOutTradeNo; string strError = string.Empty; bool bReturn = service.SetOrderPayment(orderInfo, out strError); if (!bReturn) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo: {0}", "提交失败") }); } else { string openId = string.Empty; string amount = string.Empty; string orderId = string.Empty; //支付成功,发送邮件与短信 cUserService userServer = new cUserService(loggingSessionInfo); userServer.SendOrderMessage(orderCode); bool bReturnx = service.GetOrderOpenId(orderCode, out openId, out amount, out orderId); //推送消息 if (bReturnx) { string dataStr = "{ \"OpenID\":\"" + openId + "\", \"" + amount + "\":2877 }"; //bool bReturnt = SetVipIntegral(loggingSessionInfo, dataStr); VipIntegralBLL vipIntegralBLL = new VipIntegralBLL(loggingSessionInfo); bool bReturnt = vipIntegralBLL.SetPushIntegral(orderId , ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim() , out strError); if (!bReturnt) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo-失败: {0}", "发送失败") }); } } else { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo-失败: {0}", "获取信息失败") }); } } #endregion } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPayOrderInfo-失败: {0}", ex.ToString()) }); } }