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
f4f41915
Commit
f4f41915
authored
Jul 20, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vip购买返佣分页列表+Excel下载
parent
e1a65b56
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
265 additions
and
5 deletions
+265
-5
RB_VipBuy_Commission_Extend.cs
Mall.Model/Extend/User/RB_VipBuy_Commission_Extend.cs
+4
-0
RB_Vip_Buy_Extend.cs
Mall.Model/Extend/User/RB_Vip_Buy_Extend.cs
+10
-0
UserCommonModule.cs
Mall.Module.User/UserCommonModule.cs
+4
-4
UserVipModule.cs
Mall.Module.User/UserVipModule.cs
+51
-0
RB_VipBuy_CommissionRepository.cs
Mall.Repository/User/RB_VipBuy_CommissionRepository.cs
+5
-1
RB_Vip_BuyRepository.cs
Mall.Repository/User/RB_Vip_BuyRepository.cs
+46
-0
UserVipController.cs
Mall.WebApi/Controllers/User/UserVipController.cs
+145
-0
No files found.
Mall.Model/Extend/User/RB_VipBuy_Commission_Extend.cs
View file @
f4f41915
...
...
@@ -38,6 +38,10 @@ namespace Mall.Model.Extend.User
/// 返佣ids
/// </summary>
public
string
VipIds
{
get
;
set
;
}
/// <summary>
/// 订单ids
/// </summary>
public
string
OrderIds
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Vip_Buy_Extend.cs
View file @
f4f41915
...
...
@@ -17,5 +17,15 @@ namespace Mall.Model.Extend.User
/// 购买人姓名
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 返佣用户id
/// </summary>
public
int
?
DistributionUserId
{
get
;
set
;
}
/// <summary>
/// 返佣列表
/// </summary>
public
List
<
RB_VipBuy_Commission_Extend
>
CommissionList
{
get
;
set
;
}
}
}
Mall.Module.User/UserCommonModule.cs
View file @
f4f41915
...
...
@@ -768,7 +768,7 @@ namespace Mall.Module.User
//可以升级咯
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
FXGradeId
),
fxNext
.
Id
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
dispmodel
.
Remark
+
" 分销商满足升级条件:"
+(
fxNext
.
UpgradeNum
??
0
)+
"位"
+(
gmodel
.
GradeName
??
""
)+
"下线,已自动升级为"
+(
fxNext
.
GradeName
??
""
)},
{
nameof
(
RB_Distributor_Info
.
Remark
),
dispmodel
.
Remark
+
"
;
分销商满足升级条件:"
+(
fxNext
.
UpgradeNum
??
0
)+
"位"
+(
gmodel
.
GradeName
??
""
)+
"下线,已自动升级为"
+(
fxNext
.
GradeName
??
""
)},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
@@ -815,13 +815,13 @@ namespace Mall.Module.User
{
//上级可以升级咯
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
FXGradeId
),
fxNext
.
Id
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
disp
model
.
Remark
+
"
分销商满足升级条件:"
+(
fxpNext
.
UpgradeNum
??
0
)+
"位"
+(
gpmodel
.
GradeName
??
""
)+
"下线,已自动升级为"
+(
fxpNext
.
GradeName
??
""
)},
{
nameof
(
RB_Distributor_Info
.
FXGradeId
),
fx
p
Next
.
Id
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
disp
pmodel
.
Remark
+
" ;
分销商满足升级条件:"
+(
fxpNext
.
UpgradeNum
??
0
)+
"位"
+(
gpmodel
.
GradeName
??
""
)+
"下线,已自动升级为"
+(
fxpNext
.
GradeName
??
""
)},
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
dispmodel
.
Id
,
FiledValue
=
disp
p
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
...
...
Mall.Module.User/UserVipModule.cs
View file @
f4f41915
...
...
@@ -36,6 +36,20 @@ namespace Mall.Module.User
/// vip购买仓储层
/// </summary>
private
readonly
RB_Vip_BuyRepository
vipBuyRepository
=
new
RB_Vip_BuyRepository
();
/// <summary>
/// vip购买返佣
/// </summary>
private
readonly
RB_VipBuy_CommissionRepository
vipBuy_CommissionRepository
=
new
RB_VipBuy_CommissionRepository
();
/// <summary>
/// 粉象等级
/// </summary>
private
readonly
RB_Distributor_FXGradeRepository
distributor_FXGradeRepository
=
new
RB_Distributor_FXGradeRepository
();
/// <summary>
/// 用户
/// </summary>
private
readonly
RB_Member_UserRepository
member_UserRepository
=
new
RB_Member_UserRepository
();
#
region
vip
购买自定义
...
...
@@ -138,5 +152,42 @@ namespace Mall.Module.User
#
endregion
#
region
vip
购买返佣
/// <summary>
/// 获取返佣分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Vip_Buy_Extend
>
GetVipBuyCommissionPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Vip_Buy_Extend
demodel
)
{
var
list
=
vipBuyRepository
.
GetVipBuyCommissionPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
string
OrderIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
var
clist
=
vipBuy_CommissionRepository
.
GetList
(
new
RB_VipBuy_Commission_Extend
()
{
OrderIds
=
OrderIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
FXList
=
distributor_FXGradeRepository
.
GetList
(
new
RB_Distributor_FXGrade_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
//获取用户
var
ulist
=
new
List
<
RB_Member_User_Extend
>();
if
(
clist
.
Any
())
{
ulist
=
member_UserRepository
.
GetList
(
new
RB_Member_User_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
UserIds
=
string
.
Join
(
","
,
clist
.
Select
(
x
=>
x
.
UserId
).
Distinct
())
});
}
foreach
(
var
item
in
list
)
{
item
.
CommissionList
=
clist
.
Where
(
x
=>
x
.
OrderId
==
item
.
Id
).
ToList
();
foreach
(
var
qitem
in
item
.
CommissionList
)
{
var
fxmodel
=
FXList
.
Where
(
x
=>
x
.
Id
==
qitem
.
Grade
).
FirstOrDefault
();
qitem
.
GradeDescription
=
fxmodel
.
GradeName
;
qitem
.
UserName
=
ulist
.
Where
(
x
=>
x
.
Id
==
qitem
.
UserId
).
FirstOrDefault
()?.
Name
??
""
;
}
}
}
return
list
;
}
#
endregion
}
}
Mall.Repository/User/RB_VipBuy_CommissionRepository.cs
View file @
f4f41915
...
...
@@ -82,6 +82,10 @@ where {where} order by v.Id desc";
{
where
+=
$@" and v.
{
nameof
(
RB_VipBuy_Commission
.
OrderId
)}
=
{
dmodel
.
OrderId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
OrderIds
))
{
where
+=
$@" and v.
{
nameof
(
RB_VipBuy_Commission
.
OrderId
)}
in(
{
dmodel
.
OrderIds
}
)"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and v.
{
nameof
(
RB_VipBuy_Commission
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
...
...
@@ -96,7 +100,7 @@ where {where} order by v.Id desc";
string
sql
=
$@"select v.*,vb.OrderNo from RB_VipBuy_Commission v
inner join rb_vip_buy vb on v.OrderId = vb.Id
where
{
where
}
order by v.Id
de
sc"
;
where
{
where
}
order by v.Id
a
sc"
;
return
Get
<
RB_VipBuy_Commission_Extend
>(
sql
).
ToList
();
}
...
...
Mall.Repository/User/RB_Vip_BuyRepository.cs
View file @
f4f41915
...
...
@@ -70,5 +70,51 @@ namespace Mall.Repository.User
}
return
Get
<
RB_Vip_Buy_Extend
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取vip购买返佣分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Vip_Buy_Extend
>
GetVipBuyCommissionPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Vip_Buy_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$@" SELECT a.*,b.`Name` as UserName
FROM rb_vip_buy as a
INNER JOIN rb_member_user as b on a.UserId=b.Id
INNER JOIN rb_vipbuy_commission c on a.Id = c.OrderId
WHERE a.
{
nameof
(
RB_Vip_Buy_Extend
.
Status
)}
=0 group by a.Id"
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Vip_Buy_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Vip_Buy_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Vip_Buy_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
query
.
UserId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Vip_Buy_Extend
.
UserId
)}
=
{
query
.
UserId
}
"
);
}
if
(
query
.
DistributionUserId
>
0
)
{
builder
.
Append
(
$" AND c.
{
nameof
(
RB_VipBuy_Commission
.
UserId
)}
=
{
query
.
DistributionUserId
}
"
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
OrderNo
))
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Vip_Buy_Extend
.
OrderNo
)}
like '%
{
query
.
OrderNo
}
%'"
);
}
}
return
GetPage
<
RB_Vip_Buy_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
}
}
Mall.WebApi/Controllers/User/UserVipController.cs
View file @
f4f41915
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.User
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
...
...
@@ -123,6 +124,7 @@ namespace Mall.WebApi.Controllers.User
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
OrderNo
,
x
.
UserName
,
x
.
Money
,
ExpiryDateStr
=
x
.
ExpiryDate
.
HasValue
?
x
.
ExpiryDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
...
...
@@ -134,5 +136,148 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
#
region
Vip
购买返佣
/// <summary>
/// vip购买返佣分页列表
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetVipBuyCommissionPageList
()
{
var
requestParm
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
requestParm
.
msg
.
ToString
());
RB_Vip_Buy_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Vip_Buy_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
requestParm
.
TenantId
;
demodel
.
MallBaseId
=
requestParm
.
MallBaseId
;
var
list
=
userVipModule
.
GetVipBuyCommissionPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
OrderNo
,
x
.
UserName
,
x
.
Money
,
x
.
GradeName
,
PayTimeStr
=
x
.
PayTime
.
HasValue
?
x
.
PayTime
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
CommissionList
=
x
.
CommissionList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Grade
,
z
.
GradeDescription
,
z
.
Commission
,
z
.
UserName
})
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// vip购买返佣 Excel下载
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[
HttpPost
]
public
FileContentResult
GetVipBuyCommissionPageListToExcel
()
{
var
requestParm
=
RequestParm
;
RB_Vip_Buy_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Vip_Buy_Extend
>(
requestParm
.
msg
.
ToString
());
string
ExcelName
=
"分销订单"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"序号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"订单号"
)
{
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"购买用户"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"购买金额"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"等级名称"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"购买时间"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"返利级别"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"昵称"
)
{
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"佣金"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
}
};
slist
.
Add
(
header
);
try
{
demodel
.
TenantId
=
requestParm
.
TenantId
;
demodel
.
MallBaseId
=
requestParm
.
MallBaseId
;
var
list
=
userVipModule
.
GetVipBuyCommissionPageList
(
1
,
10000
,
out
long
count
,
demodel
);
int
Num
=
0
;
foreach
(
var
item
in
list
)
{
Num
++;
var
ocList
=
item
.
CommissionList
;
int
OCCount
=
ocList
.
Count
();
OCCount
=
OCCount
==
0
?
1
:
OCCount
;
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
Num
.
ToString
()){
Rowspan
=
OCCount
},
},
ColumnHight
=
30
};
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
OrderNo
)
{
Rowspan
=
OCCount
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
UserName
)
{
Rowspan
=
OCCount
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
Money
).
ToString
())
{
Rowspan
=
OCCount
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
GradeName
)
{
Rowspan
=
OCCount
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
PayTime
.
HasValue
?
item
.
PayTime
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
)
{
Rowspan
=
OCCount
});
bool
IsOCFirst
=
true
;
if
(
item
.
CommissionList
.
Any
())
{
foreach
(
var
qitem
in
item
.
CommissionList
)
{
if
(!
IsOCFirst
)
{
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
Num
.
ToString
()){
},
},
ColumnHight
=
30
};
for
(
var
i
=
0
;
i
<
6
;
i
++)
{
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
});
}
}
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
qitem
.
GradeDescription
)
{
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
qitem
.
UserName
)
{
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
qitem
.
Commission
??
0
).
ToString
())
{
});
slist
.
Add
(
datarow
);
IsOCFirst
=
false
;
}
}
else
{
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
});
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
});
slist
.
Add
(
datarow
);
}
}
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetVipBuyCommissionPageListToExcel: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
#
endregion
}
}
\ No newline at end of file
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