Commit d864ab3f authored by liudong1993's avatar liudong1993

退款单号

parent c81230bc
...@@ -295,6 +295,10 @@ namespace Mall.Model.Entity.Product ...@@ -295,6 +295,10 @@ namespace Mall.Model.Entity.Product
/// 拒绝取消订单得备注 /// 拒绝取消订单得备注
/// </summary> /// </summary>
public string RejectRemark { get; set; } public string RejectRemark { get; set; }
/// <summary>
/// 退款单号
/// </summary>
public string RefundOrderNo { get; set; }
} }
......
...@@ -187,5 +187,9 @@ namespace Mall.Model.Entity.Product ...@@ -187,5 +187,9 @@ namespace Mall.Model.Entity.Product
/// 财务单据id /// 财务单据id
/// </summary> /// </summary>
public int? FinanceId { get; set; } public int? FinanceId { get; set; }
/// <summary>
/// 退款单号
/// </summary>
public string RefundOrderNo { get; set; }
} }
} }
...@@ -2610,7 +2610,7 @@ namespace Mall.Module.Product ...@@ -2610,7 +2610,7 @@ namespace Mall.Module.Product
{ {
Id = 0, Id = 0,
CreateDate = DateTime.Now, CreateDate = DateTime.Now,
Description = "订单使用积分抵扣" + TotalIntegralMoney + "元", Description = "订单使用积分抵扣" + TotalIntegralMoney + "元,订单号:"+ demodel.OrderNo,
Image = 0, Image = 0,
Integral = TotalIntegralNumber, Integral = TotalIntegralNumber,
MallBaseId = demodel.MallBaseId, MallBaseId = demodel.MallBaseId,
...@@ -2910,7 +2910,7 @@ namespace Mall.Module.Product ...@@ -2910,7 +2910,7 @@ namespace Mall.Module.Product
{ {
//成本价格大于0的才进行返佣 //成本价格大于0的才进行返佣
string categoryids = string.Join(",", item.CategoryIdList); 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()) if (hpcList.Any())
{ {
RB_Distributor_HPCommission_Extend hpcModel; RB_Distributor_HPCommission_Extend hpcModel;
...@@ -3592,7 +3592,7 @@ namespace Mall.Module.Product ...@@ -3592,7 +3592,7 @@ namespace Mall.Module.Product
if (type == 1) if (type == 1)
{ {
int TotalIntegralNumber = 0; 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()) if (detailList.Any())
{ {
string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct()); string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct());
...@@ -3678,7 +3678,24 @@ namespace Mall.Module.Product ...@@ -3678,7 +3678,24 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal 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)) { if (!string.IsNullOrEmpty(omodel.CouponsIds)) {
...@@ -4924,12 +4941,13 @@ namespace Mall.Module.Product ...@@ -4924,12 +4941,13 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param> /// <param name="tenantId"></param>
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <returns></returns> /// <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>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderAfterSale.ReOrderStatus), OrderAfterSaleStatusEnum.Completed}, { nameof(RB_Goods_OrderAfterSale.ReOrderStatus), OrderAfterSaleStatusEnum.Completed},
{ nameof(RB_Goods_OrderAfterSale.RefundActual), refund}, { nameof(RB_Goods_OrderAfterSale.RefundActual), refund},
{ nameof(RB_Goods_OrderAfterSale.RefundOrderNo), RefundOrderNo},
{ nameof(RB_Goods_OrderAfterSale.FinishTime), DateTime.Now} { nameof(RB_Goods_OrderAfterSale.FinishTime), DateTime.Now}
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
...@@ -5205,7 +5223,7 @@ namespace Mall.Module.Product ...@@ -5205,7 +5223,7 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param> /// <param name="tenantId"></param>
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <returns></returns> /// <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; var trans = goods_OrderRepository.DbTransaction;
try try
...@@ -5215,6 +5233,7 @@ namespace Mall.Module.Product ...@@ -5215,6 +5233,7 @@ namespace Mall.Module.Product
{ {
keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.Cancel); keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.Cancel);
keyValues.Add(nameof(RB_Goods_Order.ApplyForCancelStatus), 1); keyValues.Add(nameof(RB_Goods_Order.ApplyForCancelStatus), 1);
keyValues.Add(nameof(RB_Goods_Order.RefundOrderNo), RefundOrderNo);
} }
else else
{ {
...@@ -5248,7 +5267,7 @@ namespace Mall.Module.Product ...@@ -5248,7 +5267,7 @@ namespace Mall.Module.Product
{ {
int TotalIntegralNumber = 0; 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()) if (detailList.Any())
{ {
string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct()); string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct());
...@@ -5338,6 +5357,7 @@ namespace Mall.Module.Product ...@@ -5338,6 +5357,7 @@ namespace Mall.Module.Product
} }
}; };
member_UserRepository.Update(keyValues1, wheres1, trans); member_UserRepository.Update(keyValues1, wheres1, trans);
} }
//优惠券回滚 //优惠券回滚
if (!string.IsNullOrEmpty(omodel.CouponsIds)) if (!string.IsNullOrEmpty(omodel.CouponsIds))
......
...@@ -775,7 +775,7 @@ namespace Mall.Module.Product ...@@ -775,7 +775,7 @@ namespace Mall.Module.Product
//获取和平分销返佣 //获取和平分销返佣
if (disModel.HPGradeId > 0 && model.CostPrice > 0) { if (disModel.HPGradeId > 0 && model.CostPrice > 0) {
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId)); 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()) if (hpcList.Any())
{ {
RB_Distributor_HPCommission_Extend hpcModel; RB_Distributor_HPCommission_Extend hpcModel;
...@@ -1277,7 +1277,7 @@ namespace Mall.Module.Product ...@@ -1277,7 +1277,7 @@ namespace Mall.Module.Product
if (disModel.HPGradeId > 0 && model.CostPrice > 0) if (disModel.HPGradeId > 0 && model.CostPrice > 0)
{ {
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId)); 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()) if (hpcList.Any())
{ {
RB_Distributor_HPCommission_Extend hpcModel; RB_Distributor_HPCommission_Extend hpcModel;
......
...@@ -3851,12 +3851,12 @@ namespace Mall.Module.User ...@@ -3851,12 +3851,12 @@ namespace Mall.Module.User
List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>(); List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>();
if (string.IsNullOrEmpty(categoryIds)) 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 { 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()) { 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()) { if (hpcList.Any()) {
...@@ -3930,14 +3930,14 @@ namespace Mall.Module.User ...@@ -3930,14 +3930,14 @@ namespace Mall.Module.User
List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>(); List<RB_Distributor_HPCommission_Extend> hpcList = new List<RB_Distributor_HPCommission_Extend>();
if (string.IsNullOrEmpty(categoryIds)) 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 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()) 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()) if (hpcList.Any())
......
...@@ -92,6 +92,9 @@ where {where} group by h.Id order by h.Id desc"; ...@@ -92,6 +92,9 @@ where {where} group by h.Id order by h.Id desc";
if (dmodel.IsCommon == 1) { if (dmodel.IsCommon == 1) {
where += $@" and h.{nameof(RB_Distributor_HPCommission.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 string sql = $@"select h.* from RB_Distributor_HPCommission h
left join RB_Distributor_HPCategory c on h.Id = c.CommissionId left join RB_Distributor_HPCategory c on h.Id = c.CommissionId
......
...@@ -684,7 +684,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -684,7 +684,7 @@ namespace Mall.WebApi.Controllers.MallBase
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor); var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess) 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) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -700,7 +700,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -700,7 +700,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
else 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) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -1471,7 +1471,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1471,7 +1471,7 @@ namespace Mall.WebApi.Controllers.MallBase
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor); var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess) 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) if (flag == false)
{ {
//日志记录 //日志记录
...@@ -1482,7 +1482,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1482,7 +1482,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed(); return ApiResult.Failed();
} }
else { else {
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, req.TenantId, req.MallBaseId); bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, "", req.TenantId, req.MallBaseId);
if (flag) if (flag)
{ {
return ApiResult.Success(""); return ApiResult.Success("");
...@@ -1538,29 +1538,42 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1538,29 +1538,42 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Failed("未查询到订单信息"); return ApiResult.Failed("未查询到订单信息");
} }
//获取小程序信息 int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId); if (IsNormalServer == 1)
int RefundNum = orderModule.GetOrderRefundOnlineTradeNum(ReModel.OrderId ?? 0, req.TenantId, req.MallBaseId);
string RefundOrderNo = orderModel.OrderNo + (RefundNum + 1);
var pram = new Common.Pay.WeChatPat.PayParam()
{
TotalFee = Convert.ToInt32(Refund * 100),
RefundFee = Refund,
OrderNumber = orderModel.MerchantsNo,
RefundNumber = RefundOrderNo
};
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{ {
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, req.TenantId, req.MallBaseId); //获取小程序信息
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId);
int RefundNum = orderModule.GetOrderRefundOnlineTradeNum(ReModel.OrderId ?? 0, req.TenantId, req.MallBaseId);
string RefundOrderNo = orderModel.OrderNo + (RefundNum + 1);
var pram = new Common.Pay.WeChatPat.PayParam()
{
TotalFee = Convert.ToInt32(Refund * 100),
RefundFee = Refund,
OrderNumber = orderModel.MerchantsNo,
RefundNumber = RefundOrderNo
};
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, RefundOrderNo, req.TenantId, req.MallBaseId);
if (flag == false)
{
//日志记录
LogHelper.Write("售后订单:" + ReOrderId + ",金额:" + Refund + " 退款记录失败");
}
return ApiResult.Success("");
}
return ApiResult.Failed();
}
else {
bool flag = orderModule.SetOrderAfterSaleForRefunds(ReOrderId, Refund, "", req.TenantId, req.MallBaseId);
if (flag == false) if (flag == false)
{ {
//日志记录 //日志记录
LogHelper.Write("售后订单:" + ReOrderId + ",金额:" + Refund + " 退款记录失败"); return ApiResult.Failed();
} }
return ApiResult.Success(""); return ApiResult.Success("");
} }
return ApiResult.Failed();
} }
......
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