Commit d864ab3f authored by liudong1993's avatar liudong1993

退款单号

parent c81230bc
......@@ -295,6 +295,10 @@ namespace Mall.Model.Entity.Product
/// 拒绝取消订单得备注
/// </summary>
public string RejectRemark { get; set; }
/// <summary>
/// 退款单号
/// </summary>
public string RefundOrderNo { get; set; }
}
......
......@@ -187,5 +187,9 @@ namespace Mall.Model.Entity.Product
/// 财务单据id
/// </summary>
public int? FinanceId { get; set; }
/// <summary>
/// 退款单号
/// </summary>
public string RefundOrderNo { get; set; }
}
}
......@@ -2610,7 +2610,7 @@ namespace Mall.Module.Product
{
Id = 0,
CreateDate = DateTime.Now,
Description = "订单使用积分抵扣" + TotalIntegralMoney + "元",
Description = "订单使用积分抵扣" + TotalIntegralMoney + "元,订单号:"+ demodel.OrderNo,
Image = 0,
Integral = TotalIntegralNumber,
MallBaseId = demodel.MallBaseId,
......@@ -2910,7 +2910,7 @@ namespace Mall.Module.Product
{
//成本价格大于0的才进行返佣
string categoryids = string.Join(",", item.CategoryIdList);
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { CategoryIdsT = categoryids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled = 1, CategoryIdsT = categoryids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (hpcList.Any())
{
RB_Distributor_HPCommission_Extend hpcModel;
......@@ -3592,7 +3592,7 @@ namespace Mall.Module.Product
if (type == 1)
{
int TotalIntegralNumber = 0;
var detailList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { GoodsId = omodel.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
var detailList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = omodel.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
if (detailList.Any())
{
string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct());
......@@ -3678,7 +3678,24 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal
}
};
member_UserRepository.Update(keyValues1, wheres1, trans);
bool flag2 = member_UserRepository.Update(keyValues1, wheres1, trans);
if (flag2) {
member_IntegralRepository.Insert(new Model.Entity.User.RB_Member_Integral()
{
Id = 0,
CreateDate = DateTime.Now,
Description = "订单取消返回积分抵扣,订单号:" + omodel.OrderNo,
Image = 0,
Integral = TotalIntegralNumber,
MallBaseId = omodel.MallBaseId,
PlatformType = omodel.OrderSource,
Remarks = "",
TenantId = omodel.TenantId,
Type = Common.Enum.MarketingCenter.RecordTypeEnum.Income,
UserId = omodel.UserId,
OrderId = omodel.OrderId
}, trans);
}
}
//优惠券回滚
if (!string.IsNullOrEmpty(omodel.CouponsIds)) {
......@@ -4924,12 +4941,13 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetOrderAfterSaleForRefunds(int reOrderId, decimal refund, int tenantId, int mallBaseId)
public bool SetOrderAfterSaleForRefunds(int reOrderId, decimal refund,string RefundOrderNo, int tenantId, int mallBaseId)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderAfterSale.ReOrderStatus), OrderAfterSaleStatusEnum.Completed},
{ nameof(RB_Goods_OrderAfterSale.RefundActual), refund},
{ nameof(RB_Goods_OrderAfterSale.RefundOrderNo), RefundOrderNo},
{ nameof(RB_Goods_OrderAfterSale.FinishTime), DateTime.Now}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
......@@ -5205,7 +5223,7 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetOrderApplyForCancelAudit(RB_Goods_Order_Extend omodel, int type, string remark, int tenantId, int mallBaseId)
public bool SetOrderApplyForCancelAudit(RB_Goods_Order_Extend omodel, int type, string remark, string RefundOrderNo, int tenantId, int mallBaseId)
{
var trans = goods_OrderRepository.DbTransaction;
try
......@@ -5215,6 +5233,7 @@ namespace Mall.Module.Product
{
keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.Cancel);
keyValues.Add(nameof(RB_Goods_Order.ApplyForCancelStatus), 1);
keyValues.Add(nameof(RB_Goods_Order.RefundOrderNo), RefundOrderNo);
}
else
{
......@@ -5248,7 +5267,7 @@ namespace Mall.Module.Product
{
int TotalIntegralNumber = 0;
//回滚商品库存
var detailList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { GoodsId = omodel.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
var detailList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = omodel.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
if (detailList.Any())
{
string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct());
......@@ -5338,6 +5357,7 @@ namespace Mall.Module.Product
}
};
member_UserRepository.Update(keyValues1, wheres1, trans);
}
//优惠券回滚
if (!string.IsNullOrEmpty(omodel.CouponsIds))
......
......@@ -775,7 +775,7 @@ namespace Mall.Module.Product
//获取和平分销返佣
if (disModel.HPGradeId > 0 && model.CostPrice > 0) {
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
if (hpcList.Any())
{
RB_Distributor_HPCommission_Extend hpcModel;
......@@ -1277,7 +1277,7 @@ namespace Mall.Module.Product
if (disModel.HPGradeId > 0 && model.CostPrice > 0)
{
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() {Enabled=1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
if (hpcList.Any())
{
RB_Distributor_HPCommission_Extend hpcModel;
......
......@@ -3851,12 +3851,12 @@ namespace Mall.Module.User
List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>();
if (string.IsNullOrEmpty(categoryIds))
{
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() {Enabled=1, IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
}
else {
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { CategoryIds = categoryIds, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() {Enabled=1, CategoryIds = categoryIds, TenantId = tenantId, MallBaseId = mallBaseId });
if (!hpcList.Any()) {
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
}
}
if (hpcList.Any()) {
......@@ -3930,14 +3930,14 @@ namespace Mall.Module.User
List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>();
if (string.IsNullOrEmpty(categoryIds))
{
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
}
else
{
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { CategoryIds = categoryIds, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, CategoryIds = categoryIds, TenantId = tenantId, MallBaseId = mallBaseId });
if (!hpcList.Any())
{
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, IsCommon = 1, TenantId = tenantId, MallBaseId = mallBaseId });
}
}
if (hpcList.Any())
......
......@@ -92,6 +92,9 @@ where {where} group by h.Id order by h.Id desc";
if (dmodel.IsCommon == 1) {
where += $@" and h.{nameof(RB_Distributor_HPCommission.IsCommon)}=1";
}
if (dmodel.Enabled > 0) {
where += $@" and h.{nameof(RB_Distributor_HPCommission.Enabled)}={dmodel.Enabled}";
}
string sql = $@"select h.* from RB_Distributor_HPCommission h
left join RB_Distributor_HPCategory c on h.Id = c.CommissionId
......
......@@ -684,7 +684,7 @@ namespace Mall.WebApi.Controllers.MallBase
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, RefundOrderNo, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
......@@ -700,7 +700,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
else
{
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, "", req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
......@@ -1471,7 +1471,7 @@ namespace Mall.WebApi.Controllers.MallBase
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, RefundOrderNo, req.TenantId, req.MallBaseId);
if (flag == false)
{
//日志记录
......@@ -1482,7 +1482,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed();
}
else {
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, "", req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success("");
......@@ -1538,6 +1538,9 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Failed("未查询到订单信息");
}
int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
if (IsNormalServer == 1)
{
//获取小程序信息
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId);
int RefundNum = orderModule.GetOrderRefundOnlineTradeNum(ReModel.OrderId ?? 0, req.TenantId, req.MallBaseId);
......@@ -1552,7 +1555,7 @@ namespace Mall.WebApi.Controllers.MallBase
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, RefundOrderNo, req.TenantId, req.MallBaseId);
if (flag == false)
{
//日志记录
......@@ -1562,6 +1565,16 @@ namespace Mall.WebApi.Controllers.MallBase
}
return ApiResult.Failed();
}
else {
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, "", req.TenantId, req.MallBaseId);
if (flag == false)
{
//日志记录
return ApiResult.Failed();
}
return ApiResult.Success("");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment