mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-24 18:57:21 +08:00
【新增】新增【微信发货信息管理】功能对接。实现微信小程序二次发货功能平移到后台业务,减少繁琐的二次发货操作。
This commit is contained in:
@@ -64,6 +64,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
|
||||
|
||||
|
||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||
@@ -82,7 +83,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
, ICoreCmsLogisticsServices logisticsServices
|
||||
, ICoreCmsBillPaymentsServices billPaymentsServices
|
||||
, ICoreCmsPaymentsServices paymentsServices
|
||||
, ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices)
|
||||
, ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsOrderServices = coreCmsOrderServices;
|
||||
@@ -99,6 +100,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
_billDeliveryServices = billDeliveryServices;
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_orderItemServices = orderItemServices;
|
||||
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
@@ -493,7 +495,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var storeList = await _storeServices.QueryAsync();
|
||||
|
||||
var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false);
|
||||
|
||||
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
|
||||
var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id);
|
||||
if (!result.status)
|
||||
{
|
||||
@@ -517,6 +519,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
jm.data = new
|
||||
{
|
||||
orderModel = result.data,
|
||||
deliveryCompany,
|
||||
storeList,
|
||||
logistics,
|
||||
};
|
||||
@@ -543,10 +546,32 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
var ids = entity.orderId.Split(",");
|
||||
result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
|
||||
|
||||
if (result.status)
|
||||
{
|
||||
var orderPaymentIds = await _billPaymentsServices.QueryListByClauseAsync(p => ids.Contains(p.sourceId) && p.paymentCode == GlobalEnumVars.PaymentsTypes.wechatpay.ToString() && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed);
|
||||
if (orderPaymentIds.Any())
|
||||
{
|
||||
//依次推入队列.
|
||||
foreach (var item in orderPaymentIds)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, item.paymentId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
|
||||
|
||||
//微信发货信息管理API发货
|
||||
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == entity.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jm.code = result.status ? 0 : 1;
|
||||
@@ -603,6 +628,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
result = await _coreCmsOrderServices.Ship(order.orderId, "benditongcheng", "无", items, order.shipName, order.shipMobile, order.shipAddress, order.memo, order.storeId, order.shipAreaId, "OTHERS");
|
||||
}
|
||||
|
||||
//微信发货信息管理API发货
|
||||
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == order.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
|
||||
}
|
||||
|
||||
jm.code = result.status ? 0 : 1;
|
||||
jm.msg = result.msg;
|
||||
jm.data = result.data;
|
||||
@@ -1716,7 +1747,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 预览快递进度============================================================
|
||||
// POST: Api/CoreCmsOrder/GetDetails/10
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user