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
9a65b332
Commit
9a65b332
authored
Apr 02, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ae2fc86b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
8 deletions
+77
-8
RB_Member_CoffeeLogRepository.cs
Mall.Repository/Coffee/RB_Member_CoffeeLogRepository.cs
+6
-6
CoffeeController.cs
Mall.WebApi/Controllers/Education/CoffeeController.cs
+71
-2
No files found.
Mall.Repository/Coffee/RB_Member_CoffeeLogRepository.cs
View file @
9a65b332
...
...
@@ -111,12 +111,12 @@ WHERE 1=1
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y')"
;
}
string
sql
=
$@"SELECT e1.EduSellId as CreateBy,
{
DateStr
}
as Date,
case when e.Id is null and c.BuyType =1 then SUM(c.Number) else 0 end
AS LBFreeNum,
case when e.Id is null and c.BuyType =2 then SUM(c.Number) else 0 end
AS LBBuyNum,
case when (e.Type =1 or (e.Type =2 and e.StuIsEmp =1)) and c.BuyType =1 then SUM(c.Number) else 0 end
AS EmpFreeNum,
case when (e.Type =1 or (e.Type =2 and e.StuIsEmp =1)) and c.BuyType =2 then SUM(c.Number) else 0 end
AS EmpBuyNum,
case when e.Type =2 and e.StuIsEmp =0 and c.BuyType =1 then SUM(c.Number) else 0 end
AS StuFreeNum,
case when e.Type =2 and e.StuIsEmp =0 and c.BuyType =2 then SUM(c.Number) else 0 end
AS StuBuyNum
SUM(case when e.Id is null and c.BuyType =1 then c.Number else 0 end)
AS LBFreeNum,
SUM(case when e.Id is null and c.BuyType =2 then c.Number else 0 end)
AS LBBuyNum,
SUM(case when (e.Type =1 or (e.Type =2 and e.StuIsEmp =1)) and c.BuyType =1 then c.Number else 0 end)
AS EmpFreeNum,
SUM(case when (e.Type =1 or (e.Type =2 and e.StuIsEmp =1)) and c.BuyType =2 then c.Number else 0 end)
AS EmpBuyNum,
SUM(case when e.Type =2 and e.StuIsEmp =0 and c.BuyType =1 then c.Number else 0 end)
AS StuFreeNum,
SUM(case when e.Type =2 and e.StuIsEmp =0 and c.BuyType =2 then c.Number else 0 end)
AS StuBuyNum
FROM rb_member_coffeelog c
INNER JOIN rb_education_edusell e1 on c.CreateBy = e1.UserId
LEFT JOIN rb_education_edusell e on c.UserId = e.UserId
...
...
Mall.WebApi/Controllers/Education/CoffeeController.cs
View file @
9a65b332
...
...
@@ -52,7 +52,7 @@ namespace Mall.WebApi.Controllers.Education
{
RB_Member_CoffeeLog_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Member_CoffeeLog_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
demodel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
string
ExcelName
=
"咖啡
统计"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
string
ExcelName
=
"咖啡
"
+
(
demodel
.
SelectType
==
1
?
"日报表"
:
demodel
.
SelectType
==
2
?
"月报表"
:
"年报表"
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
ExcelDataSource
header
=
new
ExcelDataSource
()
{
...
...
@@ -69,7 +69,6 @@ namespace Mall.WebApi.Controllers.Education
new
ExcelColumn
(
value
:
"出品杯数"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
slist
.
Add
(
header
);
try
...
...
@@ -119,5 +118,75 @@ namespace Mall.WebApi.Controllers.Education
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 导出咖啡劵明细
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
FileContentResult
GetCoffeeCouponsListToExcel
()
{
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
=
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
=
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
}
}
};
slist
.
Add
(
header
);
try
{
RB_Member_CoffeeLog_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Member_CoffeeLog_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
demodel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
//不能超过2月时间
if
((
Convert
.
ToDateTime
(
demodel
.
EndTime
)
-
Convert
.
ToDateTime
(
demodel
.
StartTime
)).
Days
>
62
)
{
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
var
list
=
coffeeModule
.
GetCoffeeCouponsPageList
(
1
,
9999
,
out
long
count
,
demodel
);
foreach
(
var
item
in
list
)
{
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
item
.
UserName
){
},
new
ExcelColumn
(
value
:
item
.
UserIcon
){
},
new
ExcelColumn
(
value
:
item
.
Type
==
1
?
"存入"
:
"消费"
){
},
new
ExcelColumn
(
value
:
item
.
BuyType
==
1
?
"赠送"
:
item
.
BuyType
==
2
?
"购买"
:
"-"
){
},
new
ExcelColumn
(
value
:
item
.
EmpType
==
1
?
"员工"
:
item
.
EmpType
==
2
?
"学员"
:
"来宾"
){
},
new
ExcelColumn
(
value
:
item
.
EmpStuName
){
},
new
ExcelColumn
(
value
:
item
.
Number
.
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
Remark
){
},
new
ExcelColumn
(
value
:
item
.
EmpName
){
},
new
ExcelColumn
(
value
:
item
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm"
)){
},
},
ColumnHight
=
30
};
slist
.
Add
(
datarow
);
}
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetFileFromWebApi_requestData: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
}
}
\ 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