From 18a8fab394f764e5b30c48c8e0d6887ef7d44cbf Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 29 十月 2024 14:22:49 +0800
Subject: [PATCH] 取消拆单

---
 CoreCms.Net.Services/Order/CoreCmsOrderServices.cs |  413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 399 insertions(+), 14 deletions(-)

diff --git a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
index c31eadd..85931f5 100644
--- a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
+++ b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
@@ -31,6 +31,7 @@
 using CoreCms.Net.Utility.Extensions;
 using CoreCms.Net.Utility.Helper;
 using CoreCms.Net.WeChat.Service.HttpClients;
+using Essensoft.Paylink.Alipay.Domain;
 using Microsoft.AspNetCore.Http;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
@@ -38,6 +39,7 @@
 using SKIT.FlurlHttpClient.Wechat.Api.Models;
 using SqlSugar;
 using Yitter.IdGenerator;
+using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinUserInfoBatchGetRequest.Types;
 using static SKIT.FlurlHttpClient.Wechat.Api.Models.ChannelsECLeagueHeadSupplierOrderGetResponse.Types.CommssionOrder.Types.OrderDetail.Types;
 
 
@@ -82,6 +84,7 @@
         private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
         private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
         private readonly ICoreCmsPlanOrderServices _planOrderServices;
+     
 
         private IUnitOfWork _unitOfWork;
 
@@ -491,6 +494,13 @@
                     };
                     await _orderLogServices.InsertAsync(orderLog);
 
+
+                    ////鎷嗗崟
+                    //var jms  = await  Chaidan(order.orderId);
+                    //var orderchai = await _dal.QueryByClauseAsync(p => p.orderId == order.orderId);
+                    //orderchai.Orderitems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+
+
                     //濡傛灉鏄棬搴楄嚜鎻愶紝搴旇鑷姩璺宠繃鍙戣揣锛岀敓鎴愭彁璐у崟淇℃伅锛屼娇鐢ㄦ彁璐у崟鏍搁攢銆�
                     if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
                     {
@@ -526,12 +536,12 @@
                             jm.msg = "璁″垝璁㈠崟鑾峰彇澶辫触";
                             return jm;
                         }
-                        if (planOrder.status != 2)
-                        {
-                            _unitOfWork.RollbackTran();
-                            jm.msg = "璁″垝璁㈠崟娌℃湁閿佸崟";
-                            return jm;
-                        }
+                        //if (planOrder.status != 2)
+                        //{
+                        //    _unitOfWork.RollbackTran();
+                        //    jm.msg = "璁″垝璁㈠崟娌℃湁閿佸崟";
+                        //    return jm;
+                        //}
 
                         if ((planOrder.keYongAmount - planOrder.huaFeiAmount - order.orderAmount)<0)
                         {
@@ -586,6 +596,12 @@
                         };
                         await _orderLogServices.InsertAsync(orderLog);
 
+
+                        //鎷嗗崟
+                        //var jms = await Chaidan(order.orderId);
+                        //var orderchai = await _dal.QueryByClauseAsync(p => p.orderId == order.orderId);
+                        //orderchai.Orderitems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+
                         //濡傛灉鏄棬搴楄嚜鎻愶紝搴旇鑷姩璺宠繃鍙戣揣锛岀敓鎴愭彁璐у崟淇℃伅锛屼娇鐢ㄦ彁璐у崟鏍搁攢銆�
                         if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
                         {
@@ -600,8 +616,11 @@
                             }
                         }
 
+                        //缁撲剑澶勭悊
+                        await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderAgentOrDistribution, JsonConvert.SerializeObject(order));
+
                         //鐢ㄦ埛鍗囩骇澶勭悊
-                       // await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.UserUpGrade, JsonConvert.SerializeObject(order));
+                        await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.UserUpGrade, JsonConvert.SerializeObject(order));
                         //鍙戦�佹敮浠樻垚鍔熶俊鎭�,澧炲姞鍙戦�佸唴瀹�
                         await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.OrderPayed.ToString(), JObject.FromObject(order));
                         await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.SellerOrderNotice.ToString(), JObject.FromObject(order));
@@ -666,6 +685,7 @@
                 order.shipAddress = userShipInfo.street + " " + userShipInfo.address;
                 order.shipName = userShipInfo.name;
                 order.shipMobile = userShipInfo.mobile;
+                order.shipCoordinate = userShipInfo.latitude + "," + userShipInfo.longitude;
 
                 var ship = await _shipServices.GetShip(userShipInfo.areaId);
                 if (ship != null)
@@ -907,12 +927,31 @@
             order.aftersalesItem = await _billAftersalesServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
             //鍙戣揣鍗�
             order.delivery = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+
             if (order.delivery != null && order.delivery.Any())
             {
                 foreach (var item in order.delivery)
                 {
-                    var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode);
-                    item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode;
+                    if (item.logiCode == "Distributor")
+                    {
+                        //鏄緵搴斿晢閫佽揣
+                     var ds=   await  _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == item.sendDistributionID).FirstAsync();
+                        if(ds==null)
+                        {
+                            item.logiName = "缁忛攢鍟嗛厤閫侊紝浣嗘槸缁忛攢鍟嗗凡缁忛��鍑烘垨鑰呬笉瀛樺湪";
+                        }
+                        else
+                        {
+                            item.logiName = $"缁忛攢鍟嗛厤閫侊紙{ds.schoolName}--{ds.name}锛�";
+                        }
+                        item.distributionAcceptStr = item.sendDistributionAccept?.GetDescription() ?? "缁忛攢鍟嗘湭纭鎺ュ彈閰嶉��";
+
+                    }
+                    else
+                    {
+                        var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode);
+                        item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode;
+                    }
                 }
             }
             //鑾峰彇鎻愯揣闂ㄥ簵
@@ -1607,6 +1646,13 @@
                         await _invoiceServices.InsertAsync(taxInfo);
                     }
 
+                    //鎷嗗崟
+                    //var jms = await Chaidan(order.orderId);
+                    //var orderchai = await _dal.QueryByClauseAsync(p => p.orderId == order.orderId);
+                    //orderchai.Orderitems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+
+
+
                     //濡傛灉鏄棬搴楄嚜鎻愶紝搴旇鑷姩璺宠繃鍙戣揣锛岀敓鎴愭彁璐у崟淇℃伅锛屼娇鐢ㄦ彁璐у崟鏍搁攢銆�
                     if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
                     {
@@ -1886,6 +1932,7 @@
                 shipMobile = orderInfo[0].shipMobile,
                 logisticsId = orderInfo[0].logisticsId,
                 logisticsName = orderInfo[0].logisticsName,
+                Coordinate= orderInfo[0].shipCoordinate,
                 items = new List<CoreCmsOrderItem>(),
                 orders = orderInfo  //鎶婅鍗曚俊鎭啑浣欎笂鍘�
             };
@@ -1957,7 +2004,12 @@
             //鏄惁鏈夎鍛�
             if (string.IsNullOrEmpty(jm.msg))
             {
-                jm.msg = "璇锋敞鎰忥紒鍚堝苟鍙戣揣璁㈠崟涓瓨鍦細" + jm.msg + "銆傜‘瀹氬彂璐у悧锛�";
+                //澶氬湴鍧�澶氱敤鎴风姝� 鍚堝苟鍙戣揣 20240605
+
+                jm.msg = jm.msg + "銆備笉鍙悎骞跺彂璐�";
+                jm.status = false;
+                return jm;
+               // jm.msg = "璇锋敞鎰忥紒鍚堝苟鍙戣揣璁㈠崟涓瓨鍦細" + jm.msg + "銆傜‘瀹氬彂璐у悧锛�";
             }
             jm.status = true;
             jm.data = newOrder;
@@ -2124,10 +2176,10 @@
         /// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
         /// <returns></returns>
         public async Task<WebApiCallBack> BatchShip(string[] ids, string logiCode, string logiNo,
-            Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
+            Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null)
         {
 
-            var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
+            var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID);
             return result;
 
         }
@@ -2151,9 +2203,9 @@
         /// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
         /// <returns></returns>
         public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo,
-            Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
+            Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null)
         {
-            var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
+            var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID);
             return result;
 
         }
@@ -2682,5 +2734,338 @@
         }
         #endregion
 
+
+
+        #region 璁㈠崟鎷嗗崟
+
+        /// <summary>
+        /// 璁㈠崟鎷嗗崟(鏍规嵁鍟嗗搧鎵�灞炲璁㈠崟杩涜鎷嗗崟)
+        /// </summary>
+        /// <param name="orderId">璁㈠崟缂栧彿</param>
+        /// <returns></returns>
+        public async Task<WebApiCallBack> Chaidan(string orderId)
+        {
+            var jm = new WebApiCallBack() { msg = "璁㈠崟鎷嗗崟澶辫触" };
+
+            //鑾峰彇璁㈠崟
+            var order = await _dal.QueryByClauseAsync(p => p.orderId == orderId);
+            if (order == null)
+            {
+                return jm;
+            }
+            //鏌ヨ璁㈠崟鏄庣粏
+            //璁㈠崟璇︽儏(瀛愯揣鍝佹暟鎹�)
+            var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+            var goodsids = orderItems.Select(x => x.goodsId).ToArray();
+            //鏌ヨ璁㈠崟鍖呭惈鐨勮揣鍝�
+            var coreCmsGoods = await _goodsServices.QueryListByClauseAsync(p => goodsids.Contains(p.id));
+            coreCmsGoods = coreCmsGoods.OrderBy(x => x.publisherId).ToList();
+            //鍒ゆ柇璁㈠崟鏄惁灞炰簬澶氫釜渚涘簲鍟嗭紝濡傛灉灞炰簬澶氫釜渚涘簲鍟嗭紝鍒欐媶鍗曞彂璐�
+            int publisherIdcount = 1 ;
+            int publisherId = coreCmsGoods[0].publisherId.HasValue? coreCmsGoods[0].publisherId.Value : 0;
+
+            for (int i = 1; i < coreCmsGoods.Count; i++)
+            {
+                int publisherIdnow = coreCmsGoods[i].publisherId.HasValue ? coreCmsGoods[i].publisherId.Value : 0;
+
+                if ( publisherId == publisherIdnow)
+                {
+                    continue;
+                }else  
+                {
+                    publisherIdcount += 1;
+                }       
+            }
+          
+
+            if (publisherIdcount <= 1)
+            {
+                //淇敼璁㈠崟鐨勮揣鏉冧汉
+                if (coreCmsGoods[0].publisherId.HasValue)
+                {
+                    order.publisherId = coreCmsGoods[0].publisherId;
+                    await _dal.UpdateAsync(order);
+                }
+                jm.status = true;
+                jm.msg = "璁㈠崟涓嶉渶瑕佹媶鍗�";
+                return jm;
+            }
+
+            foreach (var orderItem in orderItems)
+            {
+                var coreCmsGoods1 = coreCmsGoods.Where(x => x.id == orderItem.goodsId).FirstOrDefault();
+                if (coreCmsGoods1 != null)
+                {
+                    orderItem.publisherId = coreCmsGoods1.publisherId;
+                }
+            }
+            orderItems = orderItems.OrderBy(x => x.publisherId).ToList() ;
+            //璁㈠崟鍟嗗搧鎬讳环
+            var amount = orderItems.Sum(x => x.amount);
+            //寮�濮嬫媶鍗�
+            int orderItemscount = 1;
+            while(orderItemscount < orderItems.Count)
+            {
+                if (orderItems[orderItemscount].publisherId != orderItems[orderItemscount - 1].publisherId)
+                {
+                    //褰撳墠渚涘簲鍟嗙殑鎵�鏈夊晢鍝�
+                    var coreCmsOrderItems = orderItems.Where(x=>x.publisherId == orderItems[orderItemscount].publisherId).ToList();
+                    var coreCmsamount = coreCmsOrderItems.Sum(x => x.amount);
+                    //褰撳墠渚涘簲鍟嗘墍鍗犲晢鍝佷环鏍兼瘮鍊�
+                    var bizhi = coreCmsamount / amount;
+
+                    //鐢熸垚鏂扮殑璁㈠崟
+                    var coreCmsOrder = new CoreCmsOrder();
+                    coreCmsOrder.orderId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.璁㈠崟缂栧彿);
+                    if (order.goodsAmount > 0)
+                    {
+                        coreCmsOrder.goodsAmount = Math.Round(order.goodsAmount * bizhi,2);
+                        order.goodsAmount = order.goodsAmount - coreCmsOrder.goodsAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.goodsAmount = 0;
+                    }
+
+                    if (order.payedAmount > 0)
+                    {
+                        coreCmsOrder.payedAmount = Math.Round(order.payedAmount * bizhi, 2);
+                        order.payedAmount = order.payedAmount - coreCmsOrder.payedAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.payedAmount = 0;
+                    }
+
+                    if (order.orderAmount > 0)
+                    {
+                        coreCmsOrder.orderAmount = Math.Round(order.orderAmount * bizhi, 2);
+                        order.orderAmount = order.orderAmount - coreCmsOrder.orderAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.orderAmount = 0;
+                    }
+
+                    coreCmsOrder.payStatus = order.payStatus;
+                    coreCmsOrder.shipStatus = order.shipStatus;
+                    coreCmsOrder.status = order.status;
+                    coreCmsOrder.orderType = order.orderType;
+                    coreCmsOrder.receiptType = order.receiptType;
+                    coreCmsOrder.paymentCode = order.paymentCode;
+                    coreCmsOrder.paymentTime = order.paymentTime;
+                    coreCmsOrder.logisticsId = order.logisticsId;
+                    coreCmsOrder.logisticsName = order.logisticsName;
+
+                    if (order.costFreight > 0)
+                    {
+                        coreCmsOrder.costFreight = Math.Round(order.costFreight * bizhi, 2);
+                        order.costFreight = order.costFreight - coreCmsOrder.costFreight;
+                    }
+                    else
+                    {
+                        coreCmsOrder.costFreight = 0;
+                    }
+
+                    coreCmsOrder.userId = order.userId;
+                    coreCmsOrder.sellerId = order.sellerId;
+                    coreCmsOrder.confirmStatus = order.confirmStatus;
+                    coreCmsOrder.confirmTime = order.confirmTime;
+                    coreCmsOrder.storeId = order.storeId;
+                    coreCmsOrder.shipAreaId = order.shipAreaId;
+                    coreCmsOrder.shipAddress = order.shipAddress;
+                    coreCmsOrder.shipCoordinate = order.shipCoordinate;
+                    coreCmsOrder.shipName = order.shipName;
+                    coreCmsOrder.shipMobile = order.shipMobile;
+
+                    coreCmsOrder.weight = coreCmsOrderItems.Sum(x=>x.weight);
+                    order.weight = order.weight - coreCmsOrder.weight;
+
+                    coreCmsOrder.taxType = order.taxType;
+                    coreCmsOrder.taxCode = order.taxCode;
+                    coreCmsOrder.taxTitle = order.taxTitle;
+
+                    if (order.point > 0)
+                    {
+                        coreCmsOrder.point = Convert.ToInt32(order.point * bizhi);
+                        order.point = order.point - coreCmsOrder.point;
+                    }
+                    else
+                    {
+                        coreCmsOrder.point = 0;
+                    }
+
+                    if (order.pointMoney > 0)
+                    {
+                        coreCmsOrder.pointMoney = Math.Round(order.pointMoney * bizhi, 2);
+                        order.pointMoney = order.pointMoney - coreCmsOrder.pointMoney;
+                    }
+                    else
+                    {
+                        coreCmsOrder.pointMoney = 0;
+                    }
+
+                    if (order.orderDiscountAmount > 0)
+                    {
+                        coreCmsOrder.orderDiscountAmount = Math.Round(order.orderDiscountAmount * bizhi, 2);
+                        order.orderDiscountAmount = order.orderDiscountAmount - coreCmsOrder.orderDiscountAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.orderDiscountAmount = 0;
+                    }
+
+
+                    if (order.goodsDiscountAmount > 0)
+                    {
+                        coreCmsOrder.goodsDiscountAmount = Math.Round(order.goodsDiscountAmount * bizhi, 2);
+                        order.goodsDiscountAmount = order.goodsDiscountAmount - coreCmsOrder.goodsDiscountAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.goodsDiscountAmount = 0;
+                    }
+
+                    if (order.couponDiscountAmount > 0)
+                    {
+                        coreCmsOrder.couponDiscountAmount = Math.Round(order.couponDiscountAmount * bizhi, 2);
+                        order.couponDiscountAmount = order.couponDiscountAmount - coreCmsOrder.couponDiscountAmount;
+                    }
+                    else
+                    {
+                        coreCmsOrder.couponDiscountAmount = 0;
+                    }
+
+                    coreCmsOrder.coupon = order.coupon;
+                    coreCmsOrder.promotionList = order.promotionList;
+                    coreCmsOrder.memo = order.memo;
+                    coreCmsOrder.ip = order.ip;
+                    coreCmsOrder.mark = order.mark;
+                    coreCmsOrder.source = order.source;
+                    coreCmsOrder.scene = order.scene;
+                    coreCmsOrder.isComment = order.isComment;
+                    coreCmsOrder.isdel = order.isdel;
+                    coreCmsOrder.objectId = order.objectId;
+                    coreCmsOrder.createTime = order.createTime;
+                    coreCmsOrder.updateTime = order.updateTime;
+                    coreCmsOrder.planorderId = order.planorderId;
+                    coreCmsOrder.publisherId = order.publisherId;
+                    coreCmsOrder.oldOderId = order.oldOderId;
+
+
+                    var res =  await _dal.InsertAsync(coreCmsOrder);
+
+                    //淇敼璁㈠崟鐨勬墍鏈夋槑缁�
+                    foreach (var coreCmsOrderItem in coreCmsOrderItems)
+                    {
+                        coreCmsOrderItem.orderId = coreCmsOrder.orderId;
+                        var sss = await _orderItemServices.UpdateAsync(coreCmsOrderItem);
+                    }
+
+                    coreCmsOrder.Orderitems = coreCmsOrderItems;
+
+
+
+                    //鐢熸垚鏀粯淇℃伅
+
+                    //鍒涘缓鏀粯鍗�
+                    var billPayments = new CoreCmsBillPayments();
+                    billPayments.paymentId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.鏀粯鍗曠紪鍙�);
+                    billPayments.sourceId = coreCmsOrder.orderId;
+                    billPayments.money = coreCmsOrder.orderAmount;
+                    billPayments.userId = coreCmsOrder.userId;
+                    billPayments.type = coreCmsOrder.orderType;
+                    billPayments.status = (int)GlobalEnumVars.BillPaymentsStatus.Payed;
+                    billPayments.paymentCode = coreCmsOrder.paymentCode;
+                    billPayments.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
+                    billPayments.payedMsg = "璁㈠崟鎷嗗崟鏀粯鎴愬姛";
+                    billPayments.parameters = "";
+                    billPayments.createTime = DateTime.Now;
+                    billPayments.updateTime = DateTime.Now;
+
+
+                    await _billPaymentsServices.InsertAsync(billPayments);
+
+                    //鍚勭澶勭悊
+                    //濡傛灉鏄棬搴楄嚜鎻愶紝搴旇鑷姩璺宠繃鍙戣揣锛岀敓鎴愭彁璐у崟淇℃伅锛屼娇鐢ㄦ彁璐у崟鏍搁攢銆�
+                    if (coreCmsOrder.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
+                    {
+                        var allConfigs = await _settingServices.GetConfigDictionaries();
+                        var storeOrderAutomaticDelivery = CommonHelper
+                            .GetConfigDictionary(allConfigs, SystemSettingConstVars.StoreOrderAutomaticDelivery)
+                            .ObjectToInt(1);
+                        if (storeOrderAutomaticDelivery == 1)
+                        {
+                            //璁㈠崟鑷姩鍙戣揣
+                            await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderAutomaticDelivery, JsonConvert.SerializeObject(coreCmsOrder));
+                        }
+                    }
+
+                   
+
+                    //缁撲剑澶勭悊
+                    await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderAgentOrDistribution, JsonConvert.SerializeObject(coreCmsOrder));
+                    //鏄撹仈浜戞墦鍗版満鎵撳嵃
+                    await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderPrint, JsonConvert.SerializeObject(coreCmsOrder));
+
+                    //鍙戦�佹敮浠樻垚鍔熶俊鎭�,澧炲姞鍙戦�佸唴瀹�
+                    await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.OrderPayed.ToString(), JObject.FromObject(coreCmsOrder));
+                    await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.SellerOrderNotice.ToString(), JObject.FromObject(coreCmsOrder));
+
+                    //鐢ㄦ埛鍗囩骇澶勭悊
+                    await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.UserUpGrade, JsonConvert.SerializeObject(coreCmsOrder));
+
+
+                    //璺宠浆鍒颁笅涓�涓鍗�
+                    orderItemscount += coreCmsOrderItems.Count;
+                }
+                else
+                {
+                    orderItemscount += 1;
+                }
+            }
+
+            //淇敼璁㈠崟鐨勮揣鏉冧汉
+            if (coreCmsGoods[0].publisherId.HasValue)
+            {
+                order.publisherId = coreCmsGoods[0].publisherId;
+
+            }
+            var ssssss = await _dal.UpdateAsync(order);
+
+            jm.status = true;
+            jm.msg = "璁㈠崟鎷嗗崟鎴愬姛";
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+ 
+            //璁㈠崟璁板綍
+            var orderLog = new CoreCmsOrderLog
+            {
+                orderId = order.orderId,
+                userId = order.userId,
+                type = (int)GlobalEnumVars.OrderLogTypes.LOG_TYPE_PAY,
+                msg = jm.msg,
+                data = JsonConvert.SerializeObject(jm),
+                createTime = DateTime.Now
+            };
+            await _orderLogServices.InsertAsync(orderLog);
+
+            return jm;
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.9.1