Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
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
黄奎
Education
Commits
6652f1c2
Commit
6652f1c2
authored
Dec 07, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的订单列表
parent
7cdf2f51
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1103 additions
and
26 deletions
+1103
-26
RB_Order_StepPrice.cs
Edu.Model/Entity/Course/RB_Order_StepPrice.cs
+45
-0
RB_User_ChangeLog.cs
Edu.Model/Entity/Log/RB_User_ChangeLog.cs
+4
-0
RB_Order_StepPrice_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Order_StepPrice_ViewModel.cs
+18
-0
RB_Order_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Order_ViewModel.cs
+31
-0
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+431
-14
RB_Class_PlanRepository.cs
Edu.Repository/Course/RB_Class_PlanRepository.cs
+9
-5
RB_OrderRepository.cs
Edu.Repository/Course/RB_OrderRepository.cs
+34
-2
RB_Order_GuestRepository.cs
Edu.Repository/Course/RB_Order_GuestRepository.cs
+49
-0
RB_Order_RemarkRepository.cs
Edu.Repository/Course/RB_Order_RemarkRepository.cs
+2
-2
RB_Order_StepPriceRepository.cs
Edu.Repository/Course/RB_Order_StepPriceRepository.cs
+43
-0
RB_User_ChangeLogRepository.cs
Edu.Repository/Log/RB_User_ChangeLogRepository.cs
+38
-0
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+399
-3
No files found.
Edu.Model/Entity/Course/RB_Order_StepPrice.cs
0 → 100644
View file @
6652f1c2
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.Course
{
/// <summary>
/// 班级阶梯价实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Order_StepPrice
{
/// <summary>
/// 主键编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 人数
/// </summary>
public
int
PersionNum
{
get
;
set
;
}
/// <summary>
/// 价格
/// </summary>
public
decimal
PersionPrice
{
get
;
set
;
}
/// <summary>
/// 订单编号
/// </summary>
public
int
OrderId
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 学校编号
/// </summary>
public
int
School_Id
{
get
;
set
;
}
}
}
Edu.Model/Entity/Log/RB_User_ChangeLog.cs
View file @
6652f1c2
...
...
@@ -47,5 +47,9 @@ namespace Edu.Model.Entity.Log
/// </summary>
public
int
Type
{
get
=>
type
;
set
=>
type
=
value
;
}
/// <summary>
/// 来源id
/// </summary>
public
int
SourceId
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Course/RB_Order_StepPrice_ViewModel.cs
0 → 100644
View file @
6652f1c2
using
Edu.Model.Entity.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Course
{
/// <summary>
/// 订单阶梯价实体类
/// </summary>
public
class
RB_Order_StepPrice_ViewModel
:
RB_Order_StepPrice
{
/// <summary>
/// 订单编号【查询使用】
/// </summary>
public
string
Q_OrderIds
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Course/RB_Order_ViewModel.cs
View file @
6652f1c2
...
...
@@ -24,6 +24,16 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public
string
ClassName
{
get
;
set
;
}
/// <summary>
/// 客人名称
/// </summary>
public
string
GuestName
{
get
;
set
;
}
/// <summary>
/// 课程id
/// </summary>
public
int
CouseId
{
get
;
set
;
}
/// <summary>
/// 订单查询状态 1正常 2取消
/// </summary>
...
...
@@ -34,6 +44,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public
int
Q_OrderBy
{
get
;
set
;
}
/// <summary>
/// 只看未收齐订单 1是
/// </summary>
public
int
Q_NotCollect
{
get
;
set
;
}
/// <summary>
/// 销售备注
/// </summary>
...
...
@@ -54,5 +69,21 @@ namespace Edu.Model.ViewModel.Course
/// 客人列表
/// </summary>
public
List
<
RB_Order_Guest_ViewModel
>
GuestList
{
get
;
set
;
}
/// <summary>
/// 报名开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 报名结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 开班开始时间
/// </summary>
public
string
OPStartTime
{
get
;
set
;
}
/// <summary>
/// 开班结束时间
/// </summary>
public
string
OPEndTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Course/OrderModule.cs
View file @
6652f1c2
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Plugin
;
using
Edu.Model.CacheModel
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Log
;
using
Edu.Repository.Course
;
using
Edu.Repository.Log
;
using
Edu.Repository.User
;
...
...
@@ -44,6 +46,10 @@ namespace Edu.Module.Course
/// </summary>
private
readonly
RB_Class_StepPriceRepository
class_StepPriceRepository
=
new
RB_Class_StepPriceRepository
();
/// <summary>
/// 订单阶梯价格
/// </summary>
private
readonly
RB_Order_StepPriceRepository
order_StepPriceRepository
=
new
RB_Order_StepPriceRepository
();
/// <summary>
/// 课程计划
/// </summary>
private
readonly
RB_Class_PlanRepository
class_PlanRepository
=
new
RB_Class_PlanRepository
();
...
...
@@ -77,12 +83,12 @@ namespace Edu.Module.Course
//查询课程安排
List
<
RB_Class_Plan_ViewModel
>
PlanWeek
=
new
List
<
RB_Class_Plan_ViewModel
>();
List
<
RB_Class_Plan_ViewModel
>
PlanFixed
=
new
List
<
RB_Class_Plan_ViewModel
>();
string
k1classIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
Week
||
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
Month
));
string
k1classIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
Week
||
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
Month
)
.
Select
(
x
=>
x
.
ClassId
)
);
if
(!
string
.
IsNullOrEmpty
(
k1classIds
))
{
PlanWeek
=
class_PlanRepository
.
GetClassPlanForProduct
(
k1classIds
);
}
string
k2classIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
FixedDate
));
string
k2classIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ClassStyle
==
Common
.
Enum
.
Course
.
ClassStyleEnum
.
FixedDate
)
.
Select
(
x
=>
x
.
ClassId
)
);
if
(!
string
.
IsNullOrEmpty
(
k2classIds
))
{
PlanFixed
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
QClassIds
=
k2classIds
});
...
...
@@ -111,8 +117,298 @@ namespace Edu.Module.Course
return
list
;
}
/// <summary>
/// 日语培训下单
/// </summary>
/// <param name="demodel"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
ApiResult
SetClassOrder
(
RB_Order_ViewModel
demodel
,
UserInfo
userInfo
)
{
if
(
demodel
.
OrderId
>
0
)
{
var
orderModel
=
orderRepository
.
GetEntity
(
demodel
.
OrderId
);
if
(
orderModel
==
null
)
{
return
ApiResult
.
Failed
(
"订单不存在"
);
}
if
(
orderModel
.
OrderState
==
Common
.
Enum
.
Course
.
OrderStateEnum
.
Cancel
)
{
return
ApiResult
.
Failed
(
"取消订单无法修改"
);
}
var
classModel
=
classRepository
.
GetEntity
(
orderModel
.
ClassId
);
if
(
classModel
==
null
)
{
return
ApiResult
.
Failed
(
"班级不存在"
);
}
int
BNum
=
orderRepository
.
GetClassOrderPeopleNum
(
demodel
.
ClassId
.
ToString
()).
FirstOrDefault
()?.
GuestNum
??
0
;
if
(
BNum
+
demodel
.
GuestNum
-
orderModel
.
GuestNum
>
classModel
.
ClassPersion
)
{
return
ApiResult
.
Failed
(
"人数报超"
+
(
classModel
.
ClassPersion
-
(
BNum
+
demodel
.
GuestNum
-
orderModel
.
GuestNum
)));
}
decimal
MinPrice
=
orderModel
.
Class_Price
;
if
(
demodel
.
GuestNum
>
1
)
{
var
spList
=
order_StepPriceRepository
.
GetList
(
new
RB_Order_StepPrice_ViewModel
()
{
OrderId
=
demodel
.
OrderId
});
if
(
spList
.
Any
())
{
MinPrice
=
spList
.
Where
(
x
=>
demodel
.
GuestNum
>=
x
.
PersionNum
).
OrderByDescending
(
x
=>
x
.
PersionNum
).
FirstOrDefault
().
PersionPrice
;
}
}
if
(
demodel
.
Unit_Price
<
MinPrice
)
{
return
ApiResult
.
Failed
(
"成交单价不能小于最低价格"
);
}
if
(
demodel
.
PreferPrice
!=
demodel
.
Unit_Price
*
demodel
.
GuestNum
){
return
ApiResult
.
Failed
(
"应收总额不正确"
);
}
var
trans
=
classRepository
.
DbTransaction
;
try
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_ViewModel
.
GuestNum
),
demodel
.
GuestNum
},
{
nameof
(
RB_Order_ViewModel
.
Unit_Price
),
demodel
.
Unit_Price
},
{
nameof
(
RB_Order_ViewModel
.
PreferPrice
),
demodel
.
PreferPrice
},
{
nameof
(
RB_Order_ViewModel
.
OrderSource
),
demodel
.
OrderSource
},
{
nameof
(
RB_Order_ViewModel
.
SaleRemark
),
demodel
.
SaleRemark
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_ViewModel
.
OrderId
),
FiledValue
=
demodel
.
OrderId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
var
flag
=
orderRepository
.
Update
(
keyValues
,
wheres
,
trans
);
if
(
flag
)
{
//记录日志信息
string
LogContent
=
$"修改日语培训订单【
{
demodel
.
OrderId
}
】"
;
if
(
orderModel
.
GuestNum
!=
demodel
.
GuestNum
)
{
LogContent
+=
$",人数由【
{
orderModel
.
GuestNum
}
】修改为【
{
demodel
.
GuestNum
}
】"
;
}
if
(
orderModel
.
Unit_Price
!=
demodel
.
Unit_Price
)
{
LogContent
+=
$",成交单价由【
{
orderModel
.
Unit_Price
}
】修改为【
{
demodel
.
Unit_Price
}
】"
;
}
if
(
orderModel
.
PreferPrice
!=
demodel
.
PreferPrice
)
{
LogContent
+=
$",应收金额由【
{
orderModel
.
PreferPrice
}
】修改为【
{
demodel
.
PreferPrice
}
】"
;
}
if
(
orderModel
.
OrderSource
!=
demodel
.
OrderSource
)
{
LogContent
+=
$",客人来源由【
{
orderModel
.
OrderSource
.
ToName
()}
】修改为【
{
demodel
.
OrderSource
.
ToName
()}
】"
;
}
//记录订单备注
if
(
orderModel
.
SaleRemark
!=
demodel
.
SaleRemark
)
{
LogContent
+=
$",销售备注由【
{
orderModel
.
SaleRemark
}
】修改为【
{
demodel
.
SaleRemark
}
】"
;
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
Content
=
demodel
.
SaleRemark
,
CreateBy
=
demodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
OrderId
=
demodel
.
OrderId
,
Type
=
1
},
trans
);
}
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
Type
=
2
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
LogContent
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
demodel
.
OrderId
},
trans
);
}
orderRepository
.
DBSession
.
Commit
();
return
ApiResult
.
Success
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetClassOrder"
);
orderRepository
.
DBSession
.
Rollback
();
return
ApiResult
.
Failed
();
}
}
else
{
//查询班级信息
var
classModel
=
classRepository
.
GetEntity
(
demodel
.
ClassId
);
if
(
classModel
==
null
)
{
return
ApiResult
.
Failed
(
"班级不存在"
);
}
if
(
classModel
.
ClassStatus
!=
Common
.
Enum
.
Course
.
ClassStatusEnum
.
NonOpenClass
)
{
return
ApiResult
.
Failed
(
"班级状态不正确"
);
}
if
(
classModel
.
EndOrderTime
<
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)))
{
return
ApiResult
.
Failed
(
"已过期,无法报名"
);
}
int
BNum
=
orderRepository
.
GetClassOrderPeopleNum
(
demodel
.
ClassId
.
ToString
()).
FirstOrDefault
()?.
GuestNum
??
0
;
if
(
BNum
+
demodel
.
GuestNum
>
classModel
.
ClassPersion
)
{
return
ApiResult
.
Failed
(
"人数报超"
+
(
classModel
.
ClassPersion
-
(
BNum
+
demodel
.
GuestNum
)));
}
demodel
.
Class_Price
=
classModel
.
SellPrice
;
decimal
MinPrice
=
classModel
.
SellPrice
;
List
<
RB_Class_StepPrice_ViewModel
>
spList
=
new
List
<
RB_Class_StepPrice_ViewModel
>();
if
(
classModel
.
IsStepPrice
==
1
)
{
spList
=
class_StepPriceRepository
.
GetClassStepPriceListRepository
(
new
RB_Class_StepPrice_ViewModel
()
{
ClassId
=
demodel
.
ClassId
});
if
(
spList
.
Any
()
&&
demodel
.
GuestNum
>
1
)
{
MinPrice
=
spList
.
Where
(
x
=>
demodel
.
GuestNum
>=
x
.
PersionNum
).
OrderByDescending
(
x
=>
x
.
PersionNum
).
FirstOrDefault
().
PersionPrice
;
}
}
if
(
demodel
.
Unit_Price
<
MinPrice
)
{
return
ApiResult
.
Failed
(
"成交单价不能小于最低价格"
);
}
if
(
demodel
.
PreferPrice
!=
demodel
.
Unit_Price
*
demodel
.
GuestNum
)
{
return
ApiResult
.
Failed
(
"应收总额不正确"
);
}
var
trans
=
orderRepository
.
DbTransaction
;
try
{
int
OrderId
=
orderRepository
.
Insert
(
demodel
,
trans
);
bool
flag
=
OrderId
>
0
;
if
(
flag
)
{
//记录历史阶梯价格
foreach
(
var
item
in
spList
)
{
order_StepPriceRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_StepPrice
()
{
Id
=
0
,
Group_Id
=
demodel
.
Group_Id
,
OrderId
=
OrderId
,
PersionNum
=
item
.
PersionNum
,
PersionPrice
=
item
.
PersionPrice
,
School_Id
=
demodel
.
School_Id
},
trans
);
}
//记录订单备注
if
(!
string
.
IsNullOrEmpty
(
demodel
.
SaleRemark
))
{
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
Content
=
demodel
.
SaleRemark
,
CreateBy
=
demodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
OrderId
=
OrderId
,
Type
=
1
},
trans
);
}
//记录日志信息
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
Type
=
2
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
"新增日语培训订单"
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
OrderId
},
trans
);
}
orderRepository
.
DBSession
.
Commit
();
return
ApiResult
.
Success
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetClassOrder"
);
orderRepository
.
DBSession
.
Rollback
();
return
ApiResult
.
Failed
();
}
}
}
/// <summary>
/// 获取日志列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_User_ChangeLog_ViewModel
>
GetClassOrderLogList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_User_ChangeLog_ViewModel
dmodel
)
{
return
changeLogRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
dmodel
);
}
/// <summary>
/// 转交订单
/// </summary>
/// <param name="orderId"></param>
/// <param name="careOfPeople"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetClassOrderCareOf
(
int
orderId
,
int
careOfPeople
,
UserInfo
userInfo
)
{
var
ordermodel
=
orderRepository
.
GetEntity
(
orderId
);
if
(
ordermodel
==
null
)
{
return
false
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_ViewModel
.
EnterID
),
careOfPeople
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_ViewModel
.
OrderId
),
FiledValue
=
orderId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
orderRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//记录日志信息
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
Type
=
2
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
$"修改【
{
orderId
}
】订单业务员,由【
{
UserReidsCache
.
GetUserLoginInfo
(
ordermodel
.
EnterID
).
AccountName
}
(
{
ordermodel
.
EnterID
}
)】修改为【
{
UserReidsCache
.
GetUserLoginInfo
(
careOfPeople
).
AccountName
}
(
{
careOfPeople
}
)】"
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
;
}
/// <summary>
/// 取消订单
/// </summary>
/// <param name="orderId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
CancelClassOrder
(
int
orderId
,
UserInfo
userInfo
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_ViewModel
.
OrderState
),
OrderStateEnum
.
Cancel
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_ViewModel
.
OrderId
),
FiledValue
=
orderId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
orderRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//记录日志信息
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
Type
=
2
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
$"取消日语培训订单【
{
orderId
}
】"
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
;
}
#
endregion
#
region
班级订单
/// <summary>
/// 获取班级订单列表
/// </summary>
...
...
@@ -189,10 +485,25 @@ namespace Edu.Module.Course
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
"修改销售,由"
+
(
UserReidsCache
.
GetUserLoginInfo
(
orderModel
.
EnterID
)?.
AccountName
??
""
)
+
"("
+
orderModel
.
EnterID
+
") 修改为"
+
(
UserReidsCache
.
GetUserLoginInfo
(
enterID
)?.
AccountName
??
""
)
+
"("
+
enterID
+
")"
LogContent
=
"修改销售,由"
+
(
UserReidsCache
.
GetUserLoginInfo
(
orderModel
.
EnterID
)?.
AccountName
??
""
)
+
"("
+
orderModel
.
EnterID
+
") 修改为"
+
(
UserReidsCache
.
GetUserLoginInfo
(
enterID
)?.
AccountName
??
""
)
+
"("
+
enterID
+
")"
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
?
""
:
"操作失败,请联系管理员"
;
}
/// <summary>
/// 获取订单备注列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Order_Remark_ViewModel
>
GetClassOrderRemarkList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Order_Remark_ViewModel
dmodel
)
{
return
order_RemarkRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
dmodel
,
""
);
}
/// <summary>
...
...
@@ -208,25 +519,30 @@ namespace Edu.Module.Course
var
orderModel
=
orderRepository
.
GetEntity
(
orderId
);
if
(
orderModel
==
null
)
{
return
false
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
};
string
LogContent
=
""
;
if
(
type
==
1
)
string
LogContent
;
if
(
type
==
2
)
{
if
(
orderModel
.
TeacherRemark
==
remark
)
{
return
true
;
}
keyValues
.
Add
(
nameof
(
RB_Order_ViewModel
.
TeacherRemark
),
remark
);
LogContent
=
"修改教务备注:由【"
+
orderModel
.
TeacherRemark
+
"】修改为【"
+
remark
+
"】"
;
}
else
if
(
type
==
2
)
else
if
(
type
==
3
)
{
if
(
orderModel
.
RectorRemark
==
remark
)
{
return
true
;
}
keyValues
.
Add
(
nameof
(
RB_Order_ViewModel
.
RectorRemark
),
remark
);
LogContent
=
"修改校长备注:由【"
+
orderModel
.
RectorRemark
+
"】修改为【"
+
remark
+
"】"
;
}
else
if
(
type
==
3
)
else
if
(
type
==
4
)
{
if
(
orderModel
.
DirectorRemark
==
remark
)
{
return
true
;
}
keyValues
.
Add
(
nameof
(
RB_Order_ViewModel
.
DirectorRemark
),
remark
);
LogContent
=
"修改经理备注:由【"
+
orderModel
.
DirectorRemark
+
"】修改为【"
+
remark
+
"】"
;
}
else
if
(
type
==
1
)
{
if
(
orderModel
.
SaleRemark
==
remark
)
{
return
true
;
}
keyValues
.
Add
(
nameof
(
RB_Order_ViewModel
.
SaleRemark
),
remark
);
LogContent
=
"修改销售备注:由【"
+
orderModel
.
SaleRemark
+
"】修改为【"
+
remark
+
"】"
;
}
else
{
return
false
;
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
@@ -238,6 +554,52 @@ namespace Edu.Module.Course
var
flag
=
orderRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
if
(
type
==
1
)
{
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
OrderId
=
orderId
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Content
=
remark
,
Type
=
1
});
}
else
if
(
type
==
2
)
{
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
OrderId
=
orderId
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Content
=
remark
,
Type
=
2
});
}
else
if
(
type
==
3
)
{
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
OrderId
=
orderId
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Content
=
remark
,
Type
=
3
});
}
else
if
(
type
==
4
)
{
order_RemarkRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Order_Remark
()
{
Id
=
0
,
OrderId
=
orderId
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Content
=
remark
,
Type
=
4
});
}
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
...
...
@@ -245,7 +607,9 @@ namespace Edu.Module.Course
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
LogContent
LogContent
=
LogContent
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
;
...
...
@@ -292,7 +656,9 @@ namespace Edu.Module.Course
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
"修改提成,由【"
+
orderModel
.
CommissionMoney
+
"】修改为【"
+
commissionMoney
+
"】"
LogContent
=
"修改提成,由【"
+
orderModel
.
CommissionMoney
+
"】修改为【"
+
commissionMoney
+
"】"
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
;
...
...
@@ -330,7 +696,9 @@ namespace Edu.Module.Course
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
LogContent
LogContent
=
LogContent
,
School_Id
=
userInfo
.
School_Id
,
SourceId
=
orderId
});
}
return
flag
;
...
...
@@ -341,7 +709,7 @@ namespace Edu.Module.Course
}
}
#
endregion
#
region
学生名单
/// <summary>
...
...
@@ -435,12 +803,22 @@ namespace Edu.Module.Course
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
dmodel
.
Group_Id
,
LogContent
=
LogContent
LogContent
=
LogContent
,
School_Id
=
dmodel
.
School_Id
,
SourceId
=
gModel
.
OrderId
});
}
return
flag
;
}
else
{
var
ordermodel
=
orderRepository
.
GetEntity
(
dmodel
.
OrderId
);
if
(
ordermodel
==
null
)
{
return
false
;
}
dmodel
.
ClassId
=
ordermodel
.
ClassId
;
int
GuestNum
=
order_GuestRepository
.
GetGuestNum
(
new
RB_Order_Guest_ViewModel
()
{
OrderId
=
dmodel
.
OrderId
,
GuestState
=
1
});
if
(
GuestNum
>=
ordermodel
.
GuestNum
)
{
return
false
;
}
int
Id
=
order_GuestRepository
.
Insert
(
dmodel
);
bool
flag
=
Id
>
0
;
if
(
flag
)
...
...
@@ -452,7 +830,9 @@ namespace Edu.Module.Course
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
dmodel
.
Group_Id
,
LogContent
=
"新增学生名单【"
+
Id
+
"】"
LogContent
=
"新增学生名单【"
+
Id
+
"】"
,
School_Id
=
dmodel
.
School_Id
,
SourceId
=
dmodel
.
OrderId
});
}
return
flag
;
...
...
@@ -480,6 +860,7 @@ namespace Edu.Module.Course
bool
flag
=
order_GuestRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
var
gmodel
=
order_GuestRepository
.
GetEntity
(
guestId
);
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
...
...
@@ -487,12 +868,48 @@ namespace Edu.Module.Course
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
"删除学生名单【"
+
guestId
+
"】"
LogContent
=
"删除学生名单【"
+
guestId
+
"】"
,
School_Id
=
userInfo
.
Id
,
SourceId
=
gmodel
?.
OrderId
??
0
});
}
return
flag
;
}
#
endregion
#
region
销售中心
/// <summary>
/// 获取我的订单列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Order_ViewModel
>
GetMyOrderPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Order_ViewModel
demodel
)
{
//获取订单列表
var
orderList
=
orderRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
orderList
.
Any
())
{
string
orderIds
=
string
.
Join
(
","
,
orderList
.
Select
(
x
=>
x
.
OrderId
));
//获取备注列表
var
remarkList
=
order_RemarkRepository
.
GetList
(
new
RB_Order_Remark_ViewModel
()
{
},
orderIds
);
//获取名单列表
var
guestList
=
order_GuestRepository
.
GetList
(
new
RB_Order_Guest_ViewModel
()
{
OrderIds
=
orderIds
});
foreach
(
var
item
in
orderList
)
{
item
.
SaleRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
1
).
ToList
();
item
.
TeacherRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
2
).
ToList
();
item
.
RectorRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
3
).
ToList
();
item
.
DirectorRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
4
).
ToList
();
item
.
GuestList
=
guestList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
}
}
return
orderList
;
}
#
endregion
}
}
Edu.Repository/Course/RB_Class_PlanRepository.cs
View file @
6652f1c2
...
...
@@ -69,16 +69,20 @@ WHERE 1=1
/// </summary>
/// <param name="classIds"></param>
/// <returns></returns>
public
List
<
RB_Class_Plan_ViewModel
>
GetClassPlanForProduct
(
string
classIds
)
{
public
List
<
RB_Class_Plan_ViewModel
>
GetClassPlanForProduct
(
string
classIds
)
{
string
sql
=
$@"SELECT p.ClassId,DAYOFWEEK(p.ClassDate) as WeekDay FROM rb_class_plan p
INNER JOIN rb_class c on p.ClassId = c.ClassId
WHERE c.ClassStyle =1 AND p.`Status`=0 and p.ClassId in(
{
classIds
}
) GROUP BY p.ClassId,DAYOFWEEK(p.ClassDate);
UNION ALL
WHERE c.ClassStyle =1 AND p.`Status`=0 and p.ClassId in(
{
classIds
}
) GROUP BY p.ClassId,DAYOFWEEK(p.ClassDate)
"
;
string
sql2
=
$@"
SELECT p.ClassId,DAYOFMONTH(p.ClassDate) as WeekDay FROM rb_class_plan p
INNER JOIN rb_class c on p.ClassId = c.ClassId
WHERE c.ClassStyle =2 AND p.`Status`=0 and p.ClassId in(
{
classIds
}
) GROUP BY p.ClassId,DAYOFMONTH(p.ClassDate)
;
"
;
WHERE c.ClassStyle =2 AND p.`Status`=0 and p.ClassId in(
{
classIds
}
) GROUP BY p.ClassId,DAYOFMONTH(p.ClassDate)"
;
return
Get
<
RB_Class_Plan_ViewModel
>(
sql
).
ToList
();
var
list1
=
Get
<
RB_Class_Plan_ViewModel
>(
sql
).
ToList
();
var
list2
=
Get
<
RB_Class_Plan_ViewModel
>(
sql2
).
ToList
();
list1
.
AddRange
(
list2
);
return
list1
;
}
}
}
Edu.Repository/Course/RB_OrderRepository.cs
View file @
6652f1c2
...
...
@@ -70,10 +70,10 @@ namespace Edu.Repository.Course
}
}
string
orderBy
=
""
;
string
orderBy
=
"
o.OrderId asc
"
;
if
(
demodel
.
Q_OrderBy
==
1
)
{
orderBy
=
" o.Id asc"
;
orderBy
=
" o.
Order
Id asc"
;
}
else
if
(
demodel
.
Q_OrderBy
==
2
)
{
...
...
@@ -147,6 +147,38 @@ where {where} order by {orderBy}
where
+=
$@" and o.
{
nameof
(
RB_Order_ViewModel
.
OrderState
)}
=3"
;
}
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ClassName
))
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
ClassName
)}
like '%
{
demodel
.
ClassName
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
GuestName
))
{
where
+=
$@" o.OrderId in (select OrderId from rb_order_guest where Status =0 and GuestName like '%
{
demodel
.
GuestName
}
%')"
;
}
if
(
demodel
.
CouseId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
CouseId
)}
=
{
demodel
.
CouseId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
StartTime
))
{
where
+=
$@" and o.
{
nameof
(
RB_Order_ViewModel
.
CreateTime
)}
>='
{
demodel
.
StartTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
EndTime
))
{
where
+=
$@" and o.
{
nameof
(
RB_Order_ViewModel
.
CreateTime
)}
<='
{
demodel
.
EndTime
}
23:59:59'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
OPStartTime
))
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
OpenTime
)}
>='
{
demodel
.
OPStartTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
OPEndTime
))
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
OpenTime
)}
<='
{
demodel
.
OPEndTime
}
23:59:59'"
;
}
if
(
demodel
.
Q_NotCollect
==
1
)
{
where
+=
$@" and o.
{
nameof
(
RB_Order_ViewModel
.
PreferPrice
)}
> (o.
{
nameof
(
RB_Order_ViewModel
.
Income
)}
- o.
{
nameof
(
RB_Order_ViewModel
.
Refund
)}
+ o.
{
nameof
(
RB_Order_ViewModel
.
DiscountMoney
)}
) "
;
}
string
orderBy
=
""
;
if
(
demodel
.
Q_OrderBy
==
1
)
...
...
Edu.Repository/Course/RB_Order_GuestRepository.cs
View file @
6652f1c2
...
...
@@ -96,5 +96,54 @@ namespace Edu.Repository.Course
return
GetPage
<
RB_Order_Guest_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取客人数量
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
int
GetGuestNum
(
RB_Order_Guest_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and Status=0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
School_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
School_Id
)}
=
{
demodel
.
School_Id
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
ClassId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
ClassId
)}
=
{
demodel
.
ClassId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
OrderIds
))
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
OrderId
)}
in(
{
demodel
.
OrderIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
GuestName
))
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
GuestName
)}
like '%
{
demodel
.
GuestName
}
%'"
;
}
if
(
demodel
.
GuestState
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
GuestState
)}
=
{
demodel
.
GuestState
}
"
;
}
string
sql
=
$@" select count(0) from RB_Order_Guest where
{
where
}
"
;
var
obj
=
ExecuteScalar
(
sql
);
if
(
obj
==
null
)
{
return
0
;
}
else
{
return
int
.
Parse
(
obj
.
ToString
());
}
}
}
}
Edu.Repository/Course/RB_Order_RemarkRepository.cs
View file @
6652f1c2
...
...
@@ -36,7 +36,7 @@ namespace Edu.Repository.Course
where
+=
$@" and
{
nameof
(
RB_Order_Remark
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
string
sql
=
$@" select * from RB_Order_Remark where
{
where
}
"
;
string
sql
=
$@" select * from RB_Order_Remark where
{
where
}
order by Id desc
"
;
return
Get
<
RB_Order_Remark_ViewModel
>(
sql
).
ToList
();
}
...
...
@@ -66,7 +66,7 @@ namespace Edu.Repository.Course
where
+=
$@" and
{
nameof
(
RB_Order_Remark
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
string
sql
=
$@" select * from RB_Order_Remark where
{
where
}
"
;
string
sql
=
$@" select * from RB_Order_Remark where
{
where
}
order by Id desc
"
;
return
GetPage
<
RB_Order_Remark_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
...
...
Edu.Repository/Course/RB_Order_StepPriceRepository.cs
0 → 100644
View file @
6652f1c2
using
Edu.Model.Entity.Course
;
using
Edu.Model.ViewModel.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.Course
{
/// <summary>
/// 订单阶梯价格仓储层
/// </summary>
public
class
RB_Order_StepPriceRepository
:
BaseRepository
<
RB_Order_StepPrice
>
{
/// <summary>
/// 获取订单阶梯价格列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Order_StepPrice_ViewModel
>
GetList
(
RB_Order_StepPrice_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT *
FROM RB_Order_StepPrice
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
OrderId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Order_StepPrice_ViewModel
.
OrderId
),
query
.
OrderId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Q_OrderIds
))
{
builder
.
AppendFormat
(
" AND {0} IN ({1}) "
,
nameof
(
RB_Order_StepPrice_ViewModel
.
OrderId
),
query
.
Q_OrderIds
);
}
}
return
Get
<
RB_Order_StepPrice_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
}
Edu.Repository/Log/RB_User_ChangeLogRepository.cs
View file @
6652f1c2
...
...
@@ -41,5 +41,43 @@ WHERE 1=1
}
return
Get
<
RB_User_ChangeLog_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取日志分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_User_ChangeLog_ViewModel
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_User_ChangeLog_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"SELECT * FROM RB_User_ChangeLog WHERE 1=1 "
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
$" AND
{
nameof
(
RB_User_ChangeLog_ViewModel
.
Group_Id
)}
=
{
query
.
Group_Id
}
"
);
}
if
(
query
.
School_Id
>
0
)
{
builder
.
AppendFormat
(
$" AND
{
nameof
(
RB_User_ChangeLog_ViewModel
.
School_Id
)}
=
{
query
.
School_Id
}
"
);
}
if
(
query
.
CreateBy
>
0
)
{
builder
.
AppendFormat
(
$" AND
{
nameof
(
RB_User_ChangeLog_ViewModel
.
CreateBy
)}
=
{
query
.
CreateBy
}
"
);
}
if
(
query
.
Type
>
0
)
{
builder
.
AppendFormat
(
$" AND
{
nameof
(
RB_User_ChangeLog_ViewModel
.
Type
)}
=
{
query
.
Type
}
"
);
}
if
(
query
.
SourceId
>
0
)
{
builder
.
AppendFormat
(
$" AND
{
nameof
(
RB_User_ChangeLog_ViewModel
.
SourceId
)}
=
{
query
.
SourceId
}
"
);
}
}
builder
.
AppendFormat
(
$" order by Id desc"
);
return
GetPage
<
RB_User_ChangeLog_ViewModel
>(
pageIndex
,
pageSize
,
out
count
,
builder
.
ToString
()).
ToList
();
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
6652f1c2
...
...
@@ -2,8 +2,10 @@
using
System.Linq
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Log
;
using
Edu.Module.Course
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
...
...
@@ -47,8 +49,9 @@ namespace Edu.WebApi.Controllers.Course
x
.
TeacherName
,
x
.
TeacherHead
,
x
.
RoomName
,
x
.
OpenTime
,
x
.
EndOrderTime
,
OpenTime
=
x
.
OpenTime
.
ToString
(
"yyyy年MM月dd日"
),
EndOrderTime
=
x
.
EndOrderTime
.
HasValue
?
x
.
EndOrderTime
.
Value
.
ToString
(
"yyyy年MM月dd日"
)
:
""
,
IsCanApply
=
x
.
EndOrderTime
>=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
))
&&
x
.
ClassPersion
>
x
.
OrderStudentCount
?
1
:
0
,
x
.
OriginalPrice
,
x
.
SellPrice
,
x
.
IsStepPrice
,
...
...
@@ -112,6 +115,68 @@ namespace Edu.WebApi.Controllers.Course
x
.
Income
,
x
.
Refund
,
x
.
DiscountMoney
,
DueInMoney
=
x
.
PreferPrice
-
(
x
.
Income
-
x
.
Refund
+
x
.
DiscountMoney
),
x
.
OrderState
,
OrderStateName
=
x
.
OrderState
.
ToName
(),
x
.
EnterID
,
EnterName
=
UserReidsCache
.
GetUserLoginInfo
(
x
.
EnterID
)?.
AccountName
??
""
,
x
.
CommissionMoney
,
x
.
ExtraRewardMoney
,
x
.
ExtraDeductMoney
,
x
.
IsCommissionGive
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
x
.
SaleRemark
,
x
.
TeacherRemark
,
x
.
RectorRemark
,
x
.
DirectorRemark
,
SaleRemarkList
=
x
.
SaleRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
TeacherRemarkList
=
x
.
TeacherRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
RectorRemarkList
=
x
.
RectorRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
DirectorRemarkList
=
x
.
DirectorRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
GuestList
=
x
.
GuestList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
GuestName
,
z
.
GuestState
})
}),
CancelList
=
orderList
.
Where
(
x
=>
x
.
OrderState
==
Common
.
Enum
.
Course
.
OrderStateEnum
.
Cancel
).
Select
(
x
=>
new
{
x
.
OrderId
,
x
.
ClassId
,
x
.
TradeWay
,
x
.
Class_Price
,
x
.
Unit_Price
,
x
.
GuestNum
,
x
.
PreferPrice
,
x
.
Income
,
x
.
Refund
,
x
.
DiscountMoney
,
DueInMoney
=
x
.
PreferPrice
-
(
x
.
Income
-
x
.
Refund
+
x
.
DiscountMoney
),
x
.
OrderState
,
OrderStateName
=
x
.
OrderState
.
ToName
(),
x
.
EnterID
,
...
...
@@ -164,6 +229,71 @@ namespace Edu.WebApi.Controllers.Course
});
}
/// <summary>
/// 新增修改订单
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetClassOrder
()
{
var
userInfo
=
base
.
UserInfo
;
RB_Order_ViewModel
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
demodel
.
ClassId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递班级id"
);
}
if
(
demodel
.
GuestNum
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递报名人数"
);
}
if
(
demodel
.
Unit_Price
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"成交单价不能小于0"
);
}
if
(
demodel
.
OrderSource
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择客人来源"
);
}
demodel
.
Group_Id
=
userInfo
.
Group_Id
;
demodel
.
School_Id
=
userInfo
.
School_Id
;
demodel
.
Dept_Id
=
userInfo
.
DeptId
;
demodel
.
OrderForm
=
Common
.
Enum
.
Course
.
OrderFormEnum
.
Computer
;
demodel
.
EnterID
=
userInfo
.
Id
;
demodel
.
OrderState
=
Common
.
Enum
.
Course
.
OrderStateEnum
.
Normal
;
demodel
.
TradeWay
=
Common
.
Enum
.
Course
.
TradeWayEnum
.
OnLine
;
demodel
.
CreateBy
=
userInfo
.
Id
;
demodel
.
CreateTime
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
userInfo
.
Id
;
demodel
.
UpdateTime
=
DateTime
.
Now
;
return
orderModule
.
SetClassOrder
(
demodel
,
userInfo
);
}
/// <summary>
/// 取消订单
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
CancelClassOrder
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
prams
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
OrderId
=
prams
.
GetInt
(
"OrderId"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
orderModule
.
CancelClassOrder
(
OrderId
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 修改订单销售
/// </summary>
...
...
@@ -193,6 +323,33 @@ namespace Edu.WebApi.Controllers.Course
}
}
/// <summary>
/// 获取班级订单备注列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetClassOrderRemarkList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_Remark_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
dmodel
.
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
list
=
orderModule
.
GetClassOrderRemarkList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
OrderId
,
x
.
Content
,
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
x
.
CreateBy
).
AccountName
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
x
.
Type
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 修改订单备注
/// </summary>
...
...
@@ -202,7 +359,7 @@ namespace Edu.WebApi.Controllers.Course
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
var
userInfo
=
base
.
UserInfo
;
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
// 类型 1
教务 2校长 3
经理
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
// 类型 1
销售 2教务 3校长 4
经理
string
Remark
=
parms
.
GetStringValue
(
"Remark"
);
if
(
OrderId
<=
0
)
{
...
...
@@ -254,6 +411,131 @@ namespace Edu.WebApi.Controllers.Course
}
}
/// <summary>
/// 获取班级订单日志列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetClassOrderLogList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_User_ChangeLog_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
dmodel
.
SourceId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
dmodel
.
Type
=
2
;
//订单日志
var
list
=
orderModule
.
GetClassOrderLogList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
LogContent
,
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
x
.
CreateBy
).
AccountName
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetGuestBasicsEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
GuestBasicsEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetGuestEducationEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
GuestEducationEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetGuestLearningGoalsEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
GuestLearningGoalsEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOrderFormEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
OrderFormEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOrderSourceEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
OrderSourceEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOrderStateEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
OrderStateEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 订单转班
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetClassOrderCareOfClass
()
{
return
ApiResult
.
Success
();
}
#
endregion
#
region
学生名单
...
...
@@ -354,5 +636,119 @@ namespace Edu.WebApi.Controllers.Course
}
#
endregion
#
region
销售中心
/// <summary>
/// 获取我的订单列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMyOrderPageList
()
{
var
userInfo
=
base
.
UserInfo
;
ResultPageModel
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
RB_Order_ViewModel
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
demodel
.
Group_Id
=
userInfo
.
Group_Id
;
demodel
.
EnterID
=
userInfo
.
Id
;
var
orderList
=
orderModule
.
GetMyOrderPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
demodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
orderList
.
Select
(
x
=>
new
{
x
.
OrderId
,
x
.
ClassId
,
x
.
TradeWay
,
x
.
Class_Price
,
x
.
Unit_Price
,
x
.
GuestNum
,
x
.
PreferPrice
,
x
.
Income
,
x
.
Refund
,
x
.
DiscountMoney
,
DueInMoney
=
x
.
PreferPrice
-
(
x
.
Income
-
x
.
Refund
+
x
.
DiscountMoney
),
x
.
OrderState
,
OrderStateName
=
x
.
OrderState
.
ToName
(),
x
.
EnterID
,
EnterName
=
UserReidsCache
.
GetUserLoginInfo
(
x
.
EnterID
)?.
AccountName
??
""
,
x
.
CommissionMoney
,
x
.
ExtraRewardMoney
,
x
.
ExtraDeductMoney
,
x
.
IsCommissionGive
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
x
.
SaleRemark
,
x
.
TeacherRemark
,
x
.
RectorRemark
,
x
.
DirectorRemark
,
SaleRemarkList
=
x
.
SaleRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
TeacherRemarkList
=
x
.
TeacherRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
RectorRemarkList
=
x
.
RectorRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
DirectorRemarkList
=
x
.
DirectorRemarkList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
Content
,
CreateBy
=
UserReidsCache
.
GetUserLoginInfo
(
z
.
CreateBy
)?.
AccountName
??
""
,
CreateTime
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}),
GuestList
=
x
.
GuestList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
GuestName
,
z
.
GuestState
})
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 订单转交
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetClassOrderCareOf
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
prams
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
OrderId
=
prams
.
GetInt
(
"OrderId"
,
0
);
int
CareOfPeople
=
prams
.
GetInt
(
"CareOfPeople"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
if
(
CareOfPeople
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择转交人"
);
}
bool
flag
=
orderModule
.
SetClassOrderCareOf
(
OrderId
,
CareOfPeople
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
}
}
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