Commit 904eb13d authored by liudong1993's avatar liudong1993

售后时间

parent 109fdae5
......@@ -6206,48 +6206,61 @@ namespace Mall.Module.Product
});
if (type == 6)
{
//更新返佣为已返佣
var ocList = goods_OrderCommissionRepository.GetList(new RB_Goods_OrderCommission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderModel.OrderId });
if (ocList.Any())
bool IsUpdateCommission = true;
var mallModel = mallBaseRepository.GetEntity(mallBaseId);
if (mallModel!=null && mallModel.AfterTime > 0)
{
foreach (var item in ocList)
var OrderM = goods_OrderRepository.GetEntity(orderModel.OrderId);
if (OrderM != null && OrderM.ReceivingTime.HasValue && OrderM.ReceivingTime.Value.AddDays(mallModel.AfterTime) > DateTime.Now)
{
//查询是否有申请退款
var afterSaleList = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { OrderDetialId = item.OrderDetailId, Type = 1, MallBaseId = mallBaseId, TenantId = tenantId });
if (!afterSaleList.Any())
IsUpdateCommission = false;
}
}
if (IsUpdateCommission)
{
//更新返佣为已返佣
var ocList = goods_OrderCommissionRepository.GetList(new RB_Goods_OrderCommission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderModel.OrderId });
if (ocList.Any())
{
foreach (var item in ocList)
{
//获取分销商信息
var disInfo = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { UserId = item.UserId, TenantId = tenantId, MallBaseId = mallBaseId }).FirstOrDefault();
if (disInfo != null && disInfo.AuditStatus == DistributorAuditStatusEnum.Audited)
//查询是否有申请退款
var afterSaleList = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { OrderDetialId = item.OrderDetailId, Type = 1, MallBaseId = mallBaseId, TenantId = tenantId });
if (!afterSaleList.Any())
{
//更新分销商佣金
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
//获取分销商信息
var disInfo = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { UserId = item.UserId, TenantId = tenantId, MallBaseId = mallBaseId }).FirstOrDefault();
if (disInfo != null && disInfo.AuditStatus == DistributorAuditStatusEnum.Audited)
{
//更新分销商佣金
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
{ nameof(RB_Distributor_Info_Extend.TotalCommission),(disInfo.TotalCommission??0)+(item.Commission??0)},
{ nameof(RB_Distributor_Info_Extend.CommissionWithdrawal),(disInfo.CommissionWithdrawal??0)+(item.Commission??0)},
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
List<WhereHelper> wheres2 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Distributor_Info_Extend.Id),
FiledValue=disInfo.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag1 = distributor_InfoRepository.Update(keyValues2, wheres2);
if (flag1)
{
//更新返佣状态
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
bool flag1 = distributor_InfoRepository.Update(keyValues2, wheres2);
if (flag1)
{
//更新返佣状态
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderCommission_Extend.CommissionState),2},
{ nameof(RB_Goods_OrderCommission_Extend.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderCommission_Extend.Id),
FiledValue=item.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_OrderCommissionRepository.Update(keyValues1, wheres1);
goods_OrderCommissionRepository.Update(keyValues1, wheres1);
}
}
}
}
......
......@@ -270,5 +270,40 @@ left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and o
string sql = $@"SELECT * FROM rb_goods_ordercommission oc WHERE oc.CommissionState=2 and oc.UserId={UserId} and oc.OrderId in ({OrderIds}) and oc.IsRemit = 1";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
/// <summary>
/// 获取所有订单已完成 未结算佣金的订单
/// </summary>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetAllOrderCompletedNoCommissionForOrder(int tenantId, int mallBaseId)
{
string sql = $@"SELECT oc.OrderId FROM rb_goods_ordercommission oc
INNER JOIN rb_goods_orderdetail od on oc.OrderDetailId = od.Id
INNER JOIN rb_goods_order o on oc.OrderId = o.OrderId
left join rb_goods_orderaftersale oa on oc.OrderId = oa.OrderId and oc.OrderDetailId = oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
where oc.TenantId={tenantId} and oc.MallBaseId={mallBaseId} and oc.CommissionState =1 and o.OrderStatus =5 and o.Recycled=2 and o.Status=0 and oa.ReOrderId is null
GROUP BY oc.OrderId";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
/// <summary>
/// 获取所有订单已完成 未结算佣金的订单
/// </summary>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetAllOrderCompletedNoCommissionList(int tenantId, int mallBaseId)
{
string sql = $@"SELECT oc.* FROM rb_goods_ordercommission oc
INNER JOIN rb_goods_orderdetail od on oc.OrderDetailId = od.Id
INNER JOIN rb_goods_order o on oc.OrderId = o.OrderId
left join rb_goods_orderaftersale oa on oc.OrderId = oa.OrderId and oc.OrderDetailId = oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
where oc.TenantId={tenantId} and oc.MallBaseId={mallBaseId} and oc.CommissionState =1 and o.OrderStatus =5 and o.Recycled=2 and o.Status=0 and oa.ReOrderId is null
";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
}
}
......@@ -482,8 +482,8 @@ GROUP BY o.OrderId)t";
string sql = $@"SELECT oc.OrderId FROM rb_goods_ordercommission oc
INNER JOIN rb_goods_orderdetail od on oc.OrderDetailId = od.Id
INNER JOIN rb_goods_order o on oc.OrderId = o.OrderId
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5)
where oc.TenantId=1 and oc.MallBaseId=1 and oc.CommissionState =1 and o.OrderStatus =5 and o.Recycled=2 and oa.ReOrderId is null
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
where oc.TenantId={tenantId} and oc.MallBaseId={mallBaseId} and oc.CommissionState =1 and o.OrderStatus =5 and o.Recycled=2 and oa.ReOrderId is null
GROUP BY oc.OrderId";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
......
......@@ -63,6 +63,10 @@ namespace Mall.WindowsService.Helper
Module.FinanceModule.AutoReceivingOrder();
LogHelper.Write("AutoReceivingOrder=====End");
}
LogHelper.Write("AutoAfterSaleOrderSendCommission=====Start");
Module.FinanceModule.AutoAfterSaleOrderSendCommission();
LogHelper.Write("AutoAfterSaleOrderSendCommission=====End");
Interlocked.Exchange(ref inTimer2, 0);
}
}
......
This diff is collapsed.
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