BuyerOrderInfo 增加id 和退款 id ,采购类型
增加修改买手退款成功api接口 修改数据库退款状态
This commit is contained in:
1 parent
33d6b85e60
commit
04d9e37123
7 files changed
+120
-3
No files matched your search
@@ -0,0 +1,40 @@
|
|||||||
|
using KJD_Web.Services.Buyer;
|
||||||
|
using Store.Framework.Base;
|
||||||
|
using Store.Framework.Dtos;
|
||||||
|
using Store.Framework.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Http;
|
||||||
|
|
||||||
|
namespace KJD_Web.Controllers.WX;
|
||||||
|
|
||||||
|
[RoutePrefix("wxxd_buyer")]
|
||||||
|
[Route("{action}")]
|
||||||
|
|
||||||
|
public class BuyerController : ApiControllerBase
|
||||||
|
{
|
||||||
|
private readonly BuyerService _buyerService;
|
||||||
|
|
||||||
|
public BuyerController(BuyerService buyerService)
|
||||||
|
{
|
||||||
|
_buyerService = buyerService;
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IHttpActionResult UpdateBuyerRefundStatsu(SignRequestBase request, long id)
|
||||||
|
{
|
||||||
|
ApiResultBase ret;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var v = _buyerService.UpdateBuyerRefundStatus(request.UserName, id);
|
||||||
|
ret = ApiResult.Success(v);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ret = ApiResult.Fail("更新失败");
|
||||||
|
}
|
||||||
|
return Ok(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -193,6 +193,7 @@
|
|||||||
<Compile Include="Controllers\AsmxApiController.cs" />
|
<Compile Include="Controllers\AsmxApiController.cs" />
|
||||||
<Compile Include="Controllers\ImageCacheController.cs" />
|
<Compile Include="Controllers\ImageCacheController.cs" />
|
||||||
<Compile Include="Controllers\WX\OEMController.cs" />
|
<Compile Include="Controllers\WX\OEMController.cs" />
|
||||||
|
<Compile Include="Controllers\WX\BuyerController.cs" />
|
||||||
<Compile Include="Controllers\WX\WXShop_N_Controller.cs" />
|
<Compile Include="Controllers\WX\WXShop_N_Controller.cs" />
|
||||||
<Compile Include="Controllers\WX\WXUser_N_Controller.cs" />
|
<Compile Include="Controllers\WX\WXUser_N_Controller.cs" />
|
||||||
<Compile Include="Controllers\WX\WXShopController.cs" />
|
<Compile Include="Controllers\WX\WXShopController.cs" />
|
||||||
@@ -273,6 +274,7 @@
|
|||||||
<Compile Include="Repository\UserPointsRecordRepository.cs" />
|
<Compile Include="Repository\UserPointsRecordRepository.cs" />
|
||||||
<Compile Include="Requests\Users\ShopRenewRequest.cs" />
|
<Compile Include="Requests\Users\ShopRenewRequest.cs" />
|
||||||
<Compile Include="Services\ImageCacheService.cs" />
|
<Compile Include="Services\ImageCacheService.cs" />
|
||||||
|
<Compile Include="Services\Buyer\BuyerService.cs" />
|
||||||
<Compile Include="Services\Shops\ShopRevenueStatisticsService.cs" />
|
<Compile Include="Services\Shops\ShopRevenueStatisticsService.cs" />
|
||||||
<Compile Include="Services\Shops\ShopService.cs" />
|
<Compile Include="Services\Shops\ShopService.cs" />
|
||||||
<Compile Include="Services\Shops\ShopStatsJob.cs" />
|
<Compile Include="Services\Shops\ShopStatsJob.cs" />
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ public class ShopRevenueStatistics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BuyerOrderInfo : StatisticsBase
|
public class BuyerOrderInfo : StatisticsBase
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 采购类型
|
||||||
|
/// </summary>
|
||||||
|
public PurchaseType PurchaseType { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 买手订单
|
/// 买手订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -163,7 +168,7 @@ public class ShopRevenueStatistics
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public long RefundId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退款金额(分)
|
/// 退款金额(分)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace KJD_Web.Responses.Shops;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShopOrderDetailResponse
|
public class ShopOrderDetailResponse
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 店铺ID
|
/// 店铺ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using KJD_Web.Services.Shops;
|
||||||
|
using MAX.Core.DependencyInjection;
|
||||||
|
using MAX.Core.Logger;
|
||||||
|
using Store.Contracts.Order.Entitys;
|
||||||
|
using Store.Contracts.User.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace KJD_Web.Services.Buyer;
|
||||||
|
|
||||||
|
public class BuyerService : ITransientDependency
|
||||||
|
{
|
||||||
|
private readonly IFreeSql _freeSql;
|
||||||
|
private readonly ILoggerFacade _logger;
|
||||||
|
private readonly IUserService _userService;
|
||||||
|
private readonly ShopService _shopService;
|
||||||
|
|
||||||
|
public BuyerService(IFreeSql freeSql, ILoggerFacade logger, ShopService shopService)
|
||||||
|
{
|
||||||
|
_freeSql = freeSql;
|
||||||
|
_logger = logger;
|
||||||
|
_shopService = shopService;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 修改买手退款状态
|
||||||
|
/// 更改为退款成功
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public bool UpdateBuyerRefundStatus(string userName, long id)
|
||||||
|
{
|
||||||
|
var item = _freeSql.Select<OrderPddBuyerAfterSaleEntity>()
|
||||||
|
.Where(a => a.Id == id)
|
||||||
|
.First();
|
||||||
|
if (item == null) return false;
|
||||||
|
|
||||||
|
var shopId = _freeSql.Select<WeiOrderEntity>()
|
||||||
|
.Where(a => a.OrderId == item.WxOrderId)
|
||||||
|
.ToOne(a => a.ShopId);
|
||||||
|
var ret = _shopService.IsShopOwnedByUser(shopId, userName);
|
||||||
|
if (ret == true)
|
||||||
|
{
|
||||||
|
var affrows = _freeSql.Update<OrderPddBuyerAfterSaleEntity>()
|
||||||
|
.Set(a => a.StatusText, "退款成功")
|
||||||
|
.Where(a => a.Id == id)
|
||||||
|
.ExecuteAffrows();
|
||||||
|
return affrows == 1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -532,6 +532,8 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
.OrderBy(a => a.Id) //
|
.OrderBy(a => a.Id) //
|
||||||
.ToList(a => new BuyerOrderInfo
|
.ToList(a => new BuyerOrderInfo
|
||||||
{
|
{
|
||||||
|
Id = a.Id,
|
||||||
|
PurchaseType = PurchaseType.FromWarehouse,
|
||||||
OrderId = a.OrderNo,
|
OrderId = a.OrderNo,
|
||||||
SkuId = a.OrderSkuId,
|
SkuId = a.OrderSkuId,
|
||||||
OutOrderSn = a.OutOrderNo,
|
OutOrderSn = a.OutOrderNo,
|
||||||
@@ -553,6 +555,8 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
.Where(a => batch.Contains(a.WxOrderId))
|
.Where(a => batch.Contains(a.WxOrderId))
|
||||||
.ToList(a => new BuyerOrderInfo
|
.ToList(a => new BuyerOrderInfo
|
||||||
{
|
{
|
||||||
|
Id = a.Id,
|
||||||
|
PurchaseType = PurchaseType.DirectPurchase,
|
||||||
OrderId = a.WxOrderId,
|
OrderId = a.WxOrderId,
|
||||||
SkuId = a.WxSkuId,
|
SkuId = a.WxSkuId,
|
||||||
OutOrderSn = a.OrderSn,
|
OutOrderSn = a.OrderSn,
|
||||||
@@ -587,6 +591,7 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
.OrderBy(a => a.Id)
|
.OrderBy(a => a.Id)
|
||||||
.ToList(a => new BuyerOrderInfo
|
.ToList(a => new BuyerOrderInfo
|
||||||
{
|
{
|
||||||
|
RefundId = a.Id,
|
||||||
OrderId = a.WxOrderId,
|
OrderId = a.WxOrderId,
|
||||||
SkuId = a.WxSkuId,
|
SkuId = a.WxSkuId,
|
||||||
OutOrderSn = a.OrderSn,
|
OutOrderSn = a.OrderSn,
|
||||||
@@ -605,6 +610,7 @@ public class ShopRevenueStatisticsService : ITransientDependency
|
|||||||
var buyerOrder = o.BuyerOrders.FirstOrDefault(a => a.OutOrderSn == r.OutOrderSn);
|
var buyerOrder = o.BuyerOrders.FirstOrDefault(a => a.OutOrderSn == r.OutOrderSn);
|
||||||
if (buyerOrder != null)//补充退款信息
|
if (buyerOrder != null)//补充退款信息
|
||||||
{
|
{
|
||||||
|
buyerOrder.RefundId = r.RefundId;
|
||||||
buyerOrder.RefundAmount = r.RefundAmount;
|
buyerOrder.RefundAmount = r.RefundAmount;
|
||||||
buyerOrder.RefundStatusText = r.RefundStatusText;
|
buyerOrder.RefundStatusText = r.RefundStatusText;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using MAX.Core.DependencyInjection;
|
using MAX.Core.DependencyInjection;
|
||||||
using MAX.Core.Logger;
|
using MAX.Core.Logger;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
using Store.Contracts.Shops;
|
using Store.Contracts.Shops;
|
||||||
using Store.Contracts.User.Interfaces;
|
using Store.Contracts.User.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
@@ -25,7 +26,17 @@ public class ShopService : ITransientDependency
|
|||||||
{
|
{
|
||||||
return _freeSql.Select<ShopEntity>().Count();
|
return _freeSql.Select<ShopEntity>().Count();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 当前商铺是否属于当前用户
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopId"></param>
|
||||||
|
/// <param name="userName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool IsShopOwnedByUser(long shopId, string userName)
|
||||||
|
{
|
||||||
|
var shopIds = GetShopIds(userName);
|
||||||
|
return shopIds.Contains(shopId);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改商铺永不过期
|
/// 修改商铺永不过期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,7 +58,7 @@ public class ShopService : ITransientDependency
|
|||||||
public List<ShopEntity> GetShops(string userName)
|
public List<ShopEntity> GetShops(string userName)
|
||||||
{
|
{
|
||||||
return _freeSql.Select<ShopEntity>()
|
return _freeSql.Select<ShopEntity>()
|
||||||
.Where(a => a.UserName == userName)
|
.Where(a => a.UserName == userName || a.SubUserName.Contains(userName))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user