Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
f4fb5a8f
Commit
f4fb5a8f
authored
Aug 05, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推荐下单返佣
parent
ec18e54d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
4 deletions
+136
-4
RB_Goods_OrderDetail_Extend.cs
Mall.Model/Extend/Product/RB_Goods_OrderDetail_Extend.cs
+4
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+89
-2
UserCommonModule.cs
Mall.Module.User/UserCommonModule.cs
+10
-0
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+33
-2
No files found.
Mall.Model/Extend/Product/RB_Goods_OrderDetail_Extend.cs
View file @
f4fb5a8f
...
...
@@ -30,6 +30,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
RB_Goods_OrderIntroduction_Extend
OrderIntroduction
{
get
;
set
;
}
/// <summary>
/// 返佣的总金额
/// </summary>
public
decimal
TCommissionMoney
{
get
;
set
;
}
/// <summary>
/// 重量
/// </summary>
public
int
?
GoodsWeight
{
get
;
set
;
}
...
...
Mall.Module.Product/OrderModule.cs
View file @
f4fb5a8f
...
...
@@ -218,6 +218,14 @@ namespace Mall.Module.Product
/// vip购买返佣
/// </summary>
private
readonly
RB_VipBuy_CommissionRepository
vipBuy_CommissionRepository
=
new
RB_VipBuy_CommissionRepository
();
/// <summary>
/// 供应商
/// </summary>
private
readonly
RB_SupplierRepository
supplierRepository
=
new
RB_SupplierRepository
();
/// <summary>
/// 推荐供应商返佣比例
/// </summary>
private
readonly
RB_SupplierCommissionRepository
supplierCommissionRepository
=
new
RB_SupplierCommissionRepository
();
#
region
购物车
...
...
@@ -3471,14 +3479,20 @@ namespace Mall.Module.Product
UserId
=
n1umodel
.
Id
;
break
;
}
else
{
UserId
=
0
;
numodel
=
n1umodel
;
//继续查找下一级
}
}
}
}
}
}
item
.
TCommissionMoney
=
0
;
foreach
(
var
qitem
in
gocList
)
{
qitem
.
Commission
=
(
qitem
.
Commission
??
0
)
*
(
item
.
Number
??
0
);
item
.
TCommissionMoney
+=
(
qitem
.
Commission
??
0
);
goods_OrderCommissionRepository
.
Insert
(
qitem
,
trans
);
}
}
...
...
@@ -4033,11 +4047,13 @@ namespace Mall.Module.Product
}
}
}
item
.
TCommissionMoney
=
0
;
if
(
gocfulList
.
Any
())
{
foreach
(
var
qitem
in
gocfulList
)
{
qitem
.
Commission
=
(
qitem
.
Commission
??
0
)
*
(
item
.
Number
??
0
);
item
.
TCommissionMoney
+=
(
qitem
.
Commission
??
0
);
goods_OrderCommissionRepository
.
Insert
(
qitem
,
trans
);
}
}
...
...
@@ -4046,6 +4062,51 @@ namespace Mall.Module.Product
}
}
}
#
region
推荐返佣
if
(
demodel
.
DetailList
.
Where
(
x
=>
x
.
SupplierId
>
0
).
Any
())
{
string
supplierIds
=
string
.
Join
(
","
,
demodel
.
DetailList
.
Where
(
x
=>
x
.
SupplierId
>
0
).
Select
(
x
=>
x
.
SupplierId
));
var
supplist
=
supplierRepository
.
GetList
(
new
RB_Supplier_Extend
()
{
SupplierIds
=
supplierIds
}).
Where
(
x
=>
x
.
Introducer
>
0
).
ToList
();
if
(
supplist
.
Any
())
{
//有 就需要反推荐佣金
//查出返佣的比例
var
scList
=
supplierCommissionRepository
.
GetListBySupplierIds
(
string
.
Join
(
","
,
supplist
.
Select
(
x
=>
x
.
ID
)));
//查出所有的订单
var
detailList
=
demodel
.
DetailList
.
Where
(
x
=>
supplist
.
Select
(
x
=>
x
.
ID
).
Contains
(
x
.
SupplierId
)).
ToList
();
foreach
(
var
item
in
detailList
)
{
var
supplierModel
=
supplist
.
Where
(
x
=>
x
.
ID
==
item
.
SupplierId
).
FirstOrDefault
();
var
qscList
=
scList
.
Where
(
x
=>
x
.
SupplierId
==
item
.
SupplierId
).
ToList
();
if
(
item
.
CostMoney
>
0
&&
((
item
.
Final_Price
??
0
)
-
(
item
.
CostMoney
??
0
)
-
item
.
TCommissionMoney
)>
0
&&
qscList
.
Any
())
{
decimal
Profit
=
(
item
.
Final_Price
??
0
)
*
(
item
.
Number
??
0
)
-
(
item
.
CostMoney
??
0
)
*
(
item
.
Number
??
0
)
-
item
.
TCommissionMoney
;
decimal
GrossMargin
=
Math
.
Round
(
Profit
/
((
item
.
Final_Price
??
0
)
*
(
item
.
Number
??
0
)),
2
,
MidpointRounding
.
AwayFromZero
);
var
scModel
=
qscList
.
Where
(
x
=>
(
x
.
CommissionType
*
10
)
>
GrossMargin
).
OrderBy
(
x
=>
x
.
CommissionType
).
FirstOrDefault
();
decimal
Commission
=
Math
.
Round
(
Profit
*
scModel
.
CommissionRate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
);
if
(
Commission
>
0
)
{
//插入返佣记录
goods_OrderIntroductionRepository
.
Insert
(
new
RB_Goods_OrderIntroduction
()
{
Commission
=
Commission
,
CommissionRatio
=
scModel
.
CommissionRate
,
CommissionState
=
1
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
demodel
.
MallBaseId
,
OrderDetailId
=
item
.
Id
,
OrderId
=
OrderId
,
Remark
=
"商品总额:"
+
(
item
.
Final_Price
??
0
)
*
(
item
.
Number
??
0
)
+
",总成本:"
+
(
item
.
CostMoney
??
0
)
*
(
item
.
Number
??
0
)
+
",总返佣:"
+
item
.
TCommissionMoney
+
",总利润:"
+
Profit
,
RemitStatus
=
2
,
TenantId
=
demodel
.
TenantId
,
Type
=
1
,
UpdateDate
=
DateTime
.
Now
,
UserId
=
supplierModel
.
Introducer
},
trans
);
}
}
}
}
}
#
endregion
goods_OrderCommissionRepository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
...
...
@@ -7138,9 +7199,9 @@ namespace Mall.Module.Product
{
//更新返佣为已返佣
var
ocList
=
goods_OrderCommissionRepository
.
GetList
(
new
RB_Goods_OrderCommission_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderModel
.
OrderId
});
if
(
ocList
.
Any
())
if
(
ocList
.
Where
(
x
=>
x
.
CommissionState
==
1
).
Any
())
{
foreach
(
var
item
in
ocList
)
foreach
(
var
item
in
ocList
.
Where
(
x
=>
x
.
CommissionState
==
1
)
)
{
//查询是否有申请退款
var
afterSaleList
=
goods_OrderAfterSaleRepository
.
GetList
(
new
RB_Goods_OrderAfterSale_Extend
()
{
OrderDetialId
=
item
.
OrderDetailId
,
Type
=
1
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
});
...
...
@@ -7183,6 +7244,32 @@ namespace Mall.Module.Product
}
}
}
//更新推荐供应商返佣
var
oiList
=
goods_OrderIntroductionRepository
.
GetList
(
new
RB_Goods_OrderIntroduction_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderModel
.
OrderId
});
if
(
oiList
.
Any
())
{
foreach
(
var
item
in
oiList
)
{
//查询是否有申请退款
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
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderIntroduction_Extend
.
CommissionState
),
2
},
{
nameof
(
RB_Goods_OrderIntroduction_Extend
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderIntroduction_Extend
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderIntroductionRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
}
}
//积分赠送
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
OrderId
=
orderModel
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
...
...
Mall.Module.User/UserCommonModule.cs
View file @
f4fb5a8f
...
...
@@ -952,6 +952,11 @@ namespace Mall.Module.User
UserId
=
n1umodel
.
Id
;
break
;
}
else
{
UserId
=
0
;
numodel
=
n1umodel
;
//继续查找下一级
}
}
}
...
...
@@ -1318,6 +1323,11 @@ namespace Mall.Module.User
UserId
=
n1umodel
.
Id
;
break
;
}
else
{
UserId
=
0
;
numodel
=
n1umodel
;
//继续查找下一级
}
}
}
...
...
Mall.WindowsService/Module/FinanceModule.cs
View file @
f4fb5a8f
...
...
@@ -103,6 +103,10 @@ namespace Mall.WindowsService.Module
private
static
RB_Distributor_BasicsRepository
distributor_BasicsRepository
=
new
RB_Distributor_BasicsRepository
();
private
static
RB_Distributor_FXGradeRepository
distributor_FXGradeRepository
=
new
RB_Distributor_FXGradeRepository
();
private
static
RB_Vip_BuyRepository
vip_BuyRepository
=
new
RB_Vip_BuyRepository
();
/// <summary>
/// 推荐返佣
/// </summary>
private
static
RB_Goods_OrderIntroductionRepository
goods_OrderIntroductionRepository
=
new
RB_Goods_OrderIntroductionRepository
();
/// <summary>
...
...
@@ -743,9 +747,9 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{
//更新返佣为已返佣
var
ocList
=
goods_OrderCommissionRepository
.
GetList
(
new
RB_Goods_OrderCommission_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderModel
.
OrderId
});
if
(
ocList
.
Any
())
if
(
ocList
.
Where
(
x
=>
x
.
CommissionState
==
1
).
Any
())
{
foreach
(
var
item
in
ocList
)
foreach
(
var
item
in
ocList
.
Where
(
x
=>
x
.
CommissionState
==
1
)
)
{
//查询是否有申请退款
var
afterSaleList
=
goods_OrderAfterSaleRepository
.
GetList
(
new
RB_Goods_OrderAfterSale_Extend
()
{
OrderDetialId
=
item
.
OrderDetailId
,
Type
=
1
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
});
...
...
@@ -788,6 +792,33 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
}
}
}
//更新推荐供应商返佣
var
oiList
=
goods_OrderIntroductionRepository
.
GetList
(
new
RB_Goods_OrderIntroduction_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderModel
.
OrderId
});
if
(
oiList
.
Any
())
{
foreach
(
var
item
in
oiList
)
{
//查询是否有申请退款
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
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderIntroduction_Extend
.
CommissionState
),
2
},
{
nameof
(
RB_Goods_OrderIntroduction_Extend
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderIntroduction_Extend
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderIntroductionRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
}
}
//积分赠送
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
OrderId
=
orderModel
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment