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
e7cef4c8
Commit
e7cef4c8
authored
Apr 02, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2abd6a0d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
617 additions
and
64 deletions
+617
-64
RB_Education_EduSell.cs
Mall.Model/Entity/Education/RB_Education_EduSell.cs
+5
-0
RB_Member_CoffeeLog_Extend.cs
Mall.Model/Extend/Coffee/RB_Member_CoffeeLog_Extend.cs
+70
-0
ActivityModule.cs
Mall.Module.Education/ActivityModule.cs
+42
-42
CoffeeModule.cs
Mall.Module.Education/CoffeeModule.cs
+297
-16
RB_Member_CoffeeLogRepository.cs
Mall.Repository/Coffee/RB_Member_CoffeeLogRepository.cs
+69
-0
RB_AccountRepository.cs
Mall.Repository/Education/RB_AccountRepository.cs
+5
-4
AppletEducationController.cs
...WebApi/Controllers/Education/AppletEducationController.cs
+6
-2
CoffeeController.cs
Mall.WebApi/Controllers/Education/CoffeeController.cs
+123
-0
No files found.
Mall.Model/Entity/Education/RB_Education_EduSell.cs
View file @
e7cef4c8
...
@@ -76,5 +76,10 @@ namespace Mall.Model.Entity.Education
...
@@ -76,5 +76,10 @@ namespace Mall.Model.Entity.Education
/// 定时器是否解绑赠送 1是
/// 定时器是否解绑赠送 1是
/// </summary>
/// </summary>
public
int
IsInitFreeCoffee
{
get
;
set
;
}
public
int
IsInitFreeCoffee
{
get
;
set
;
}
/// <summary>
/// 学员是否内部员工 1是
/// </summary>
public
int
StuIsEmp
{
get
;
set
;
}
}
}
}
}
Mall.Model/Extend/Coffee/RB_Member_CoffeeLog_Extend.cs
View file @
e7cef4c8
...
@@ -10,6 +10,76 @@ namespace Mall.Model.Extend.Coffee
...
@@ -10,6 +10,76 @@ namespace Mall.Model.Extend.Coffee
/// </summary>
/// </summary>
public
class
RB_Member_CoffeeLog_Extend
:
RB_Member_CoffeeLog
public
class
RB_Member_CoffeeLog_Extend
:
RB_Member_CoffeeLog
{
{
/// <summary>
/// 开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 查询类型 1日报表 2月报表 3年报表
/// </summary>
public
int
SelectType
{
get
;
set
;
}
/// <summary>
/// 日期
/// </summary>
public
string
Date
{
get
;
set
;
}
/// <summary>
/// 来宾赠送
/// </summary>
public
int
LBFreeNum
{
get
;
set
;
}
/// <summary>
/// 来宾购买
/// </summary>
public
int
LBBuyNum
{
get
;
set
;
}
/// <summary>
/// 员工赠送
/// </summary>
public
int
EmpFreeNum
{
get
;
set
;
}
/// <summary>
/// 员工购买
/// </summary>
public
int
EmpBuyNum
{
get
;
set
;
}
/// <summary>
/// 学生赠送
/// </summary>
public
int
StuFreeNum
{
get
;
set
;
}
/// <summary>
/// 学生购买
/// </summary>
public
int
StuBuyNum
{
get
;
set
;
}
/// <summary>
/// 收款
/// </summary>
public
decimal
Income
{
get
;
set
;
}
/// <summary>
/// 核销人
/// </summary>
public
string
EmpName
{
get
;
set
;
}
/// <summary>
/// 员工类型 1员工 2学员 3来宾
/// </summary>
public
int
EmpType
{
get
;
set
;
}
/// <summary>
/// 微信名称
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 微信头像
/// </summary>
public
string
UserIcon
{
get
;
set
;
}
/// <summary>
/// 学生/内部人员名称
/// </summary>
public
string
EmpStuName
{
get
;
set
;
}
}
}
}
}
Mall.Module.Education/ActivityModule.cs
View file @
e7cef4c8
...
@@ -628,9 +628,9 @@ namespace Mall.Module.Education
...
@@ -628,9 +628,9 @@ namespace Mall.Module.Education
/// </summary>
/// </summary>
/// <param name="accountId"></param>
/// <param name="accountId"></param>
/// <returns></returns>
/// <returns></returns>
public
bool
GetEduStuLearning
(
int
accountId
)
public
bool
GetEduStuLearning
(
int
accountId
,
out
int
courseId
)
{
{
return
RB_AccountRepository
.
GetStuLearningCourse
(
accountId
,
out
_
)
>
0
;
return
RB_AccountRepository
.
GetStuLearningCourse
(
accountId
,
out
_
,
out
courseId
)
>
0
;
}
}
/// <summary>
/// <summary>
...
@@ -646,46 +646,46 @@ namespace Mall.Module.Education
...
@@ -646,46 +646,46 @@ namespace Mall.Module.Education
flag
=
education_EduSellRepository
.
Insert
(
model
)
>
0
;
flag
=
education_EduSellRepository
.
Insert
(
model
)
>
0
;
if
(
flag
)
{
if
(
flag
)
{
//绑定成功 直接初始化 免费咖啡劵
//绑定成功 直接初始化 免费咖啡劵
if
(
model
.
Type
==
1
)
//
if (model.Type == 1)
{
//
{
//内部人员 直接初始化 内部人员的咖啡劵信息
//
//内部人员 直接初始化 内部人员的咖啡劵信息
int
FreeNum
=
Convert
.
ToInt32
(
dictvalueRepository
.
GetList
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Dictvalue_Extend
()
{
MallBaseId
=
model
.
MallBaseId
??
0
,
DictKey
=
"Edu_CoffeeCoupons_EmpFree"
}).
FirstOrDefault
()?.
Content
??
"0"
);
//
int FreeNum = Convert.ToInt32(dictvalueRepository.GetList(new Model.Extend.BaseSetUp.RB_Dictvalue_Extend() { MallBaseId = model.MallBaseId ?? 0, DictKey = "Edu_CoffeeCoupons_EmpFree" }).FirstOrDefault()?.Content ?? "0");
if
(
FreeNum
>
0
)
//
if (FreeNum > 0)
{
//
{
var
cmodel
=
new
Model
.
Extend
.
Coffee
.
RB_Member_CoffeeCoupons_Extend
()
//
var cmodel = new Model.Extend.Coffee.RB_Member_CoffeeCoupons_Extend()
{
//
{
Id
=
0
,
//
Id = 0,
CreateDate
=
DateTime
.
Now
,
//
CreateDate = DateTime.Now,
FreeNum
=
FreeNum
,
//
FreeNum = FreeNum,
MallBaseId
=
model
.
MallBaseId
??
0
,
//
MallBaseId = model.MallBaseId ?? 0,
SurplusBugNum
=
0
,
//
SurplusBugNum = 0,
TotalBuyNum
=
0
,
//
TotalBuyNum = 0,
UpdateDate
=
DateTime
.
Now
,
//
UpdateDate = DateTime.Now,
UserId
=
model
.
UserId
//
UserId = model.UserId
};
//
};
member_CoffeeCouponsRepository
.
Insert
(
cmodel
);
//
member_CoffeeCouponsRepository.Insert(cmodel);
}
//
}
}
//
}
else
if
(
model
.
Type
==
2
)
//
else if (model.Type == 2)
{
//
{
//学生 要看是否还有正在学习的课程 有的话 可初始化免费的咖啡劵
//
//学生 要看是否还有正在学习的课程 有的话 可初始化免费的咖啡劵
int
FreeNum
=
Convert
.
ToInt32
(
dictvalueRepository
.
GetList
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Dictvalue_Extend
()
{
MallBaseId
=
model
.
MallBaseId
??
0
,
DictKey
=
"Edu_CoffeeCoupons_Free"
}).
FirstOrDefault
()?.
Content
??
"0"
);
//
int FreeNum = Convert.ToInt32(dictvalueRepository.GetList(new Model.Extend.BaseSetUp.RB_Dictvalue_Extend() { MallBaseId = model.MallBaseId??0, DictKey = "Edu_CoffeeCoupons_Free" }).FirstOrDefault()?.Content ?? "0");
if
(
FreeNum
>
0
)
//
if (FreeNum > 0)
{
//
{
var
cmodel
=
new
Model
.
Extend
.
Coffee
.
RB_Member_CoffeeCoupons_Extend
()
//
var cmodel = new Model.Extend.Coffee.RB_Member_CoffeeCoupons_Extend()
{
//
{
Id
=
0
,
//
Id = 0,
CreateDate
=
DateTime
.
Now
,
//
CreateDate = DateTime.Now,
FreeNum
=
FreeNum
,
//
FreeNum = FreeNum,
MallBaseId
=
model
.
MallBaseId
??
0
,
//
MallBaseId = model.MallBaseId ?? 0,
SurplusBugNum
=
0
,
//
SurplusBugNum = 0,
TotalBuyNum
=
0
,
//
TotalBuyNum = 0,
UpdateDate
=
DateTime
.
Now
,
//
UpdateDate = DateTime.Now,
UserId
=
model
.
UserId
//
UserId = model.UserId
};
//
};
member_CoffeeCouponsRepository
.
Insert
(
cmodel
);
//
member_CoffeeCouponsRepository.Insert(cmodel);
}
//
}
}
//
}
}
}
}
}
else
else
...
...
Mall.Module.Education/CoffeeModule.cs
View file @
e7cef4c8
This diff is collapsed.
Click to expand it.
Mall.Repository/Coffee/RB_Member_CoffeeLogRepository.cs
View file @
e7cef4c8
...
@@ -38,6 +38,18 @@ WHERE 1=1
...
@@ -38,6 +38,18 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Member_CoffeeLog_Extend
.
Type
),
query
.
Type
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Member_CoffeeLog_Extend
.
Type
),
query
.
Type
);
}
}
if
(
query
.
BuyType
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Member_CoffeeLog_Extend
.
BuyType
),
query
.
BuyType
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
StartTime
))
{
builder
.
AppendFormat
(
" AND {0} >='{1}' "
,
nameof
(
RB_Member_CoffeeLog_Extend
.
CreateDate
),
query
.
StartTime
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
EndTime
))
{
builder
.
AppendFormat
(
" AND {0} <='{1} 23:59:59' "
,
nameof
(
RB_Member_CoffeeLog_Extend
.
CreateDate
),
query
.
EndTime
);
}
}
}
builder
.
AppendFormat
(
" order by Id desc"
);
builder
.
AppendFormat
(
" order by Id desc"
);
return
GetPage
<
RB_Member_CoffeeLog_Extend
>(
pageIndex
,
pageSize
,
out
count
,
builder
.
ToString
()).
ToList
();
return
GetPage
<
RB_Member_CoffeeLog_Extend
>(
pageIndex
,
pageSize
,
out
count
,
builder
.
ToString
()).
ToList
();
...
@@ -82,5 +94,62 @@ WHERE 1=1
...
@@ -82,5 +94,62 @@ WHERE 1=1
}
}
return
Get
<
RB_Member_CoffeeLog_Extend
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Member_CoffeeLog_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
/// <summary>
/// 获取咖啡劵 日报表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Member_CoffeeLog_Extend
>
GetCoffeeStatisticsToDay
(
RB_Member_CoffeeLog_Extend
demodel
,
int
type
)
{
string
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y-%m-%d')"
;
if
(
type
==
2
)
{
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y-%m')"
;
}
else
if
(
type
==
3
)
{
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
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
WHERE c.MallBaseId =
{
demodel
.
MallBaseId
}
and c.CreateDate >='
{
demodel
.
StartTime
}
' and c.CreateDate <='
{
demodel
.
EndTime
}
23:59:59'
GROUP BY e1.EduSellId,
{
DateStr
}
"
;
return
Get
<
RB_Member_CoffeeLog_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 收款
/// </summary>
/// <param name="demodel"></param>
/// <param name="type"></param>
/// <returns></returns>
public
List
<
RB_Member_CoffeeLog_Extend
>
GetCoffeeMoneyStatisticsToDay
(
RB_Member_CoffeeLog_Extend
demodel
,
int
type
)
{
string
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y-%m-%d')"
;
if
(
type
==
2
)
{
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y-%m')"
;
}
else
if
(
type
==
3
)
{
DateStr
=
"DATE_FORMAT(c.CreateDate,'%Y')"
;
}
string
sql
=
$@"SELECT
{
DateStr
}
as Date, SUM(o.Income) AS Income
FROM rb_member_coffeelog c
INNER JOIN rb_goods_order o on c.OrderId = o.OrderId
WHERE c.MallBaseId =
{
demodel
.
MallBaseId
}
and c.CreateDate >='
{
demodel
.
StartTime
}
' and c.CreateDate <='
{
demodel
.
EndTime
}
23:59:59'
GROUP BY
{
DateStr
}
"
;
return
Get
<
RB_Member_CoffeeLog_Extend
>(
sql
).
ToList
();
}
}
}
}
}
Mall.Repository/Education/RB_AccountRepository.cs
View file @
e7cef4c8
...
@@ -278,9 +278,9 @@ WHERE 1=1 {0}
...
@@ -278,9 +278,9 @@ WHERE 1=1 {0}
/// </summary>
/// </summary>
/// <param name="accountId"></param>
/// <param name="accountId"></param>
/// <returns></returns>
/// <returns></returns>
public
int
GetStuLearningCourse
(
int
accountId
,
out
int
FreeCoffeeNum
)
public
int
GetStuLearningCourse
(
int
accountId
,
out
int
FreeCoffeeNum
,
out
int
courseId
)
{
{
string
sql
=
$@"SELECT COUNT(0) AS IsSelectLevelNor,max(
c.FreeCoffeeNum) as FreeCoffeeNum
FROM rb_account a
string
sql
=
$@"SELECT COUNT(0) AS IsSelectLevelNor,max(
IFNULL(c.FreeCoffeeNum,0)) as FreeCoffeeNum, max(o.CourseId) as LeaveStatus
FROM rb_account a
INNER JOIN rb_student s on a.AccountId = s.StuId
INNER JOIN rb_student s on a.AccountId = s.StuId
INNER JOIN rb_student_orderguest sog on sog.Student_Id = s.StuId
INNER JOIN rb_student_orderguest sog on sog.Student_Id = s.StuId
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
...
@@ -290,6 +290,7 @@ WHERE a.`Status` =0 and a.AccountType =4 and a.Id ={accountId} and og.GuestState
...
@@ -290,6 +290,7 @@ WHERE a.`Status` =0 and a.AccountType =4 and a.Id ={accountId} and og.GuestState
var
rmodel
=
Get
<
RB_Account_ViewModel
>(
sql
).
FirstOrDefault
();
var
rmodel
=
Get
<
RB_Account_ViewModel
>(
sql
).
FirstOrDefault
();
FreeCoffeeNum
=
rmodel
?.
FreeCoffeeNum
??
0
;
FreeCoffeeNum
=
rmodel
?.
FreeCoffeeNum
??
0
;
courseId
=
rmodel
?.
LeaveStatus
??
0
;
return
rmodel
?.
IsSelectLevelNor
??
0
;
return
rmodel
?.
IsSelectLevelNor
??
0
;
}
}
...
@@ -300,7 +301,7 @@ WHERE a.`Status` =0 and a.AccountType =4 and a.Id ={accountId} and og.GuestState
...
@@ -300,7 +301,7 @@ WHERE a.`Status` =0 and a.AccountType =4 and a.Id ={accountId} and og.GuestState
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Account_ViewModel
>
GetStuLearningCourseList
(
int
groupId
=
100000
)
public
List
<
RB_Account_ViewModel
>
GetStuLearningCourseList
(
int
groupId
=
100000
)
{
{
string
sql
=
$@"SELECT a.Id,a.AccountId,IFNULL(s.StuName,'') AS AccountName,s.StuIcon as UserIcon, max(
c.FreeCoffeeNum
) as FreeCoffeeNum
string
sql
=
$@"SELECT a.Id,a.AccountId,IFNULL(s.StuName,'') AS AccountName,s.StuIcon as UserIcon, max(
IFNULL(c.FreeCoffeeNum,0)
) as FreeCoffeeNum
FROM rb_account a
FROM rb_account a
INNER JOIN rb_student s on a.AccountId = s.StuId
INNER JOIN rb_student s on a.AccountId = s.StuId
INNER JOIN rb_student_orderguest sog on sog.Student_Id = s.StuId
INNER JOIN rb_student_orderguest sog on sog.Student_Id = s.StuId
...
...
Mall.WebApi/Controllers/Education/AppletEducationController.cs
View file @
e7cef4c8
...
@@ -2336,7 +2336,7 @@ namespace Mall.WebApi.Controllers.Education
...
@@ -2336,7 +2336,7 @@ namespace Mall.WebApi.Controllers.Education
{
{
return
ApiResult
.
Failed
(
"账户或密码不能为空"
);
return
ApiResult
.
Failed
(
"账户或密码不能为空"
);
}
}
int
EduSellId
;
int
EduSellId
,
StuIsEmp
=
0
;
if
(
EduType
==
1
)
if
(
EduType
==
1
)
{
{
var
model
=
activityModule
.
GetEmployeeListModule
(
new
Employee_ViewModel
()
var
model
=
activityModule
.
GetEmployeeListModule
(
new
Employee_ViewModel
()
...
@@ -2377,10 +2377,13 @@ namespace Mall.WebApi.Controllers.Education
...
@@ -2377,10 +2377,13 @@ namespace Mall.WebApi.Controllers.Education
EduSellId
=
model
.
Id
;
EduSellId
=
model
.
Id
;
//验证 必须是在学习学生才能绑定
//验证 必须是在学习学生才能绑定
if
(!
activityModule
.
GetEduStuLearning
(
model
.
Id
))
if
(!
activityModule
.
GetEduStuLearning
(
model
.
Id
,
out
int
courseId
))
{
{
return
ApiResult
.
Failed
(
"未查询到您正在学习的课程,无法绑定信息"
);
return
ApiResult
.
Failed
(
"未查询到您正在学习的课程,无法绑定信息"
);
}
}
if
(
courseId
==
1
)
{
StuIsEmp
=
1
;
//内部人员
}
}
}
else
else
{
{
...
@@ -2409,6 +2412,7 @@ namespace Mall.WebApi.Controllers.Education
...
@@ -2409,6 +2412,7 @@ namespace Mall.WebApi.Controllers.Education
}
}
eduModel
.
EduSellId
=
EduSellId
;
eduModel
.
EduSellId
=
EduSellId
;
eduModel
.
Type
=
EduType
;
//学生 跟 内部人员区分
eduModel
.
Type
=
EduType
;
//学生 跟 内部人员区分
eduModel
.
StuIsEmp
=
StuIsEmp
;
//学员是否内部员工
bool
result
=
activityModule
.
SetEduSellBaseInfo
(
eduModel
);
bool
result
=
activityModule
.
SetEduSellBaseInfo
(
eduModel
);
return
result
?
ApiResult
.
Success
(
"信息绑定成功"
)
:
ApiResult
.
Failed
(
"信息绑定失败"
);
return
result
?
ApiResult
.
Success
(
"信息绑定成功"
)
:
ApiResult
.
Failed
(
"信息绑定失败"
);
...
...
Mall.WebApi/Controllers/Education/CoffeeController.cs
0 → 100644
View file @
e7cef4c8
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Dnc.Api.Throttle
;
using
Mall.CacheManager.User
;
using
Mall.Common
;
using
Mall.Common.API
;
using
Mall.Common.Enum
;
using
Mall.Common.Enum.Goods
;
using
Mall.Common.Enum.MarketingCenter
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.Coffee
;
using
Mall.Model.Extend.Product
;
using
Mall.Module.Education
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
namespace
Mall.WebApi.Controllers.Education
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
CoffeeController
:
BaseController
{
private
readonly
CoffeeModule
coffeeModule
=
new
CoffeeModule
();
/// <summary>
/// 获取咖啡劵统计
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCoffeeStatistics
()
{
RB_Member_CoffeeLog_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Member_CoffeeLog_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
demodel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
var
list
=
coffeeModule
.
GetCoffeeStatistics
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 咖啡劵统计下载
/// </summary>
[
HttpPost
]
public
FileContentResult
GetCoffeeStatisticsToExcel
()
{
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"
;
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
{
List
<
ExcelDataSource
>
list
=
coffeeModule
.
GetCoffeeStatisticsToExcel
(
demodel
);
slist
.
AddRange
(
list
);
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
);
}
}
/// <summary>
/// 获取咖啡劵消费分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCoffeeCouponsPageList
()
{
ResultPageModel
pageModel
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
base
.
RequestParm
.
msg
.
ToString
());
RB_Member_CoffeeLog_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Member_CoffeeLog_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
demodel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
var
list
=
coffeeModule
.
GetCoffeeCouponsPageList
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
count
,
demodel
);
pageModel
.
count
=
Convert
.
ToInt32
(
count
);
pageModel
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Type
,
x
.
BuyType
,
x
.
Number
,
x
.
Remark
,
x
.
EmpType
,
x
.
UserName
,
x
.
UserIcon
,
x
.
EmpStuName
,
CreateByName
=
x
.
EmpName
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm"
)
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
}
}
\ 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