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
dd4d4b62
Commit
dd4d4b62
authored
Feb 02, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
d14be932
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
207 additions
and
21 deletions
+207
-21
RB_Point_TeacherCourseOrder.cs
Mall.Model/Entity/Point/RB_Point_TeacherCourseOrder.cs
+1
-1
RB_Point_TeacherCourseOrder_Extend.cs
....Model/Extend/Point/RB_Point_TeacherCourseOrder_Extend.cs
+5
-0
PointModule.cs
Mall.Module.Education/PointModule.cs
+88
-0
RB_Point_TeacherCourseOrderRepository.cs
...Repository/Point/RB_Point_TeacherCourseOrderRepository.cs
+19
-5
AppletPointController.cs
Mall.WebApi/Controllers/Education/AppletPointController.cs
+67
-9
PointController.cs
Mall.WebApi/Controllers/Education/PointController.cs
+27
-6
No files found.
Mall.Model/Entity/Point/RB_Point_TeacherCourseOrder.cs
View file @
dd4d4b62
...
...
@@ -68,7 +68,7 @@ namespace Mall.Model.Entity.Point
/// <summary>
/// 是否推送
放假
信息0-否,1-是
/// 是否推送
房间
信息0-否,1-是
/// </summary>
public
int
IsSendRoom
{
get
;
set
;
}
...
...
Mall.Model/Extend/Point/RB_Point_TeacherCourseOrder_Extend.cs
View file @
dd4d4b62
...
...
@@ -40,5 +40,10 @@ namespace Mall.Model.Extend.Point
/// 结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 用户openid
/// </summary>
public
string
OpenId
{
get
;
set
;
}
}
}
Mall.Module.Education/PointModule.cs
View file @
dd4d4b62
...
...
@@ -25,6 +25,14 @@ namespace Mall.Module.Education
private
readonly
RB_Point_TeacherCourseOrderRepository
pointTeacherCourseOrderRepository
=
new
RB_Point_TeacherCourseOrderRepository
();
#
region
用户基本信息
public
Model
.
Entity
.
User
.
RB_Member_User
GetUserEntity
(
int
UserId
)
{
return
member_UserRepository
.
GetEntity
(
UserId
);
}
#
endregion
#
region
点数商品
/// <summary>
/// 获取列表
...
...
@@ -273,6 +281,7 @@ namespace Mall.Module.Education
};
member_UserRepository
.
Update
(
filedsUser
,
userWhereHelpers
,
trans
);
}
pointOrderRepository
.
DBSession
.
Commit
();
return
flag
;
}
else
...
...
@@ -612,10 +621,38 @@ namespace Mall.Module.Education
if
(
model
.
ID
==
0
)
{
orderId
=
pointTeacherCourseOrderRepository
.
Insert
(
model
,
trans
);
flag
=
orderId
>
0
;
}
else
{
orderId
=
model
.
ID
;
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>
{
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
OrderStaus
),
(
int
)
model
.
OrderStaus
},
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
UpdateDate
),
model
.
UpdateDate
}
};
IList
<
WhereHelper
>
auditrecordWhereHelpers
=
new
List
<
WhereHelper
>
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
ID
),
FiledValue
=
model
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
TenantId
),
FiledValue
=
model
.
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
MallBaseId
),
FiledValue
=
model
.
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
pointTeacherCourseOrderRepository
.
Update
(
fileds
,
auditrecordWhereHelpers
,
trans
);
}
if
(
model
.
OrderStaus
==
Common
.
Enum
.
Point
.
OrderStausEnum
.
Paid
&&
model
.
TotalPointNum
>
0
)
{
...
...
@@ -660,11 +697,62 @@ namespace Mall.Module.Education
}
};
member_UserRepository
.
Update
(
filedsUser
,
userWhereHelpers
,
trans
);
}
pointTeacherCourseOrderRepository
.
DBSession
.
Commit
();
return
flag
;
}
/// <summary>
/// 确认订单
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
ConfirmTeacherCourseOrder
(
List
<
RB_Point_TeacherCourseOrder_Extend
>
list
)
{
bool
flag
=
false
;
var
trans
=
pointTeacherCourseOrderRepository
.
DbTransaction
;
foreach
(
var
model
in
list
)
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>
{
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
OrderStaus
),
(
int
)
model
.
OrderStaus
},
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
IsSendRoom
),
1
},
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
UpdateDate
),
model
.
UpdateDate
},
{
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
RoomInfo
),
model
.
RoomInfo
}
};
IList
<
WhereHelper
>
auditrecordWhereHelpers
=
new
List
<
WhereHelper
>
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
ID
),
FiledValue
=
model
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
TenantId
),
FiledValue
=
model
.
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Point_TeacherCourseOrder_Extend
.
MallBaseId
),
FiledValue
=
model
.
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
pointTeacherCourseOrderRepository
.
Update
(
fileds
,
auditrecordWhereHelpers
,
trans
);
}
if
(
flag
)
//推送房间信息
{
}
return
flag
;
}
...
...
Mall.Repository/Point/RB_Point_TeacherCourseOrderRepository.cs
View file @
dd4d4b62
...
...
@@ -22,20 +22,34 @@ namespace Mall.Repository.Point
public
List
<
RB_Point_TeacherCourseOrder_Extend
>
GetPointOrderList
(
RB_Point_TeacherCourseOrder_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Point_TeacherCourseOrder where state=0"
);
sb
.
Append
(
$@"SELECT a.*, b.`Name` as UserName, t.CourseName, c.CourseClassType, d.Name as TeacherName, d.TeacherLogo, b.OpenId
from RB_Point_TeacherCourseOrder as a
Left join rb_point_teachercourse t on a.CourseId = t.ID
Left Join rb_point_courseclass c on a.CourseClassId = c.ID
Left JOin rb_education_teacher d on a.TeacherId = d.ID
LEFT JOIN rb_member_user as b on a.UserId = b.Id
where a.state = 0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
sb
.
AppendFormat
(
" and a.TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and a.MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
CourseId
>
0
)
{
sb
.
AppendFormat
(
" and a.CourseId={0}"
,
where
.
CourseId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
sb
.
AppendFormat
(
" and
a.
MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
ID
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
ID
);
sb
.
AppendFormat
(
" and
a.
ID={0}"
,
where
.
ID
);
}
}
return
Get
<
RB_Point_TeacherCourseOrder_Extend
>(
sb
.
ToString
()).
ToList
();
...
...
@@ -55,7 +69,7 @@ namespace Mall.Repository.Point
public
List
<
RB_Point_TeacherCourseOrder_Extend
>
GetPointOrderPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Point_TeacherCourseOrder_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT a.*,b.`Name` as UserName , t.CourseName,c.CourseClassType, d.Name as TeacherName ,d.TeacherLogo
sb
.
Append
(
$@"SELECT a.*,b.`Name` as UserName , t.CourseName,c.CourseClassType, d.Name as TeacherName ,d.TeacherLogo
,b.OpenId
from RB_Point_TeacherCourseOrder as a
Left join rb_point_teachercourse t on a.CourseId = t.ID
Left Join rb_point_courseclass c on a.CourseClassId = c.ID
...
...
Mall.WebApi/Controllers/Education/AppletPointController.cs
View file @
dd4d4b62
...
...
@@ -70,7 +70,7 @@ namespace Mall.WebApi.Controllers.Education
/// 保存课程分类信息
/// </summary>
/// <returns></returns>
public
ApiResult
SetTeacherCourseOrder
()
public
ApiResult
Get
SetTeacherCourseOrder
()
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
...
...
@@ -90,14 +90,52 @@ namespace Mall.WebApi.Controllers.Education
if
(
query
.
ID
==
0
)
{
query
.
CreateDate
=
System
.
DateTime
.
Now
;
}
//查询课程信息
var
courseModel
=
pointModule
.
GetTeacherCourseList
(
new
RB_Point_TeacherCourse_Extend
{
TeacherId
=
query
.
TeacherId
,
ID
=
query
.
CourseId
,
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
}).
FirstOrDefault
();
var
courseClassModel
=
pointModule
.
GetPointCourseClassList
(
new
RB_Point_CourseClass_Extend
{
ID
=
query
.
CourseClassId
,
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
}).
FirstOrDefault
();
courseModel
.
StudyStartTime
=
Convert
.
ToDateTime
(
courseModel
.
StudyDate
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
courseModel
.
StudyStartDate
)
;
query
.
TeacherId
=
courseModel
.
TeacherId
;
//判断时长是否一致
if
((
query
.
TotalStudyDuration
%
courseModel
.
StudyDuration
)
!=
0
)
{
return
ApiResult
.
Failed
(
"约课总时长必须课时时长的整数倍"
);
}
//判断时长是否一致
if
(
query
.
StudyDuration
!=
courseModel
.
StudyDuration
)
{
return
ApiResult
.
Failed
(
"约课时长与课时时长不等"
);
}
if
(
query
.
BasePointNum
!=
courseModel
.
PointNum
)
{
return
ApiResult
.
Failed
(
"约课点数错误"
);
}
if
(
query
.
TotalPointNum
!=
(
query
.
BasePointNum
*
(
query
.
TotalStudyDuration
/
courseModel
.
StudyDuration
)))
{
return
ApiResult
.
Failed
(
"约课总点数错误"
);
}
if
(
query
.
OrderStaus
==
Common
.
Enum
.
Point
.
OrderStausEnum
.
Paid
)
{
var
userModel
=
pointModule
.
GetUserEntity
(
userInfo
.
UserId
);
if
(
userModel
==
null
)
{
return
ApiResult
.
Failed
(
"用户信息不存在"
);
}
else
{
if
(
userModel
.
PointNum
<
query
.
TotalPointNum
)
{
return
ApiResult
.
Failed
(
"点数不够,请先购买点数"
);
}
}
}
courseModel
.
StudyStartTime
=
Convert
.
ToDateTime
(
courseModel
.
StudyDate
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
courseModel
.
StudyStartDate
);
if
(
courseModel
.
StudentNumType
==
Common
.
Enum
.
Point
.
StudentNumTypeEnum
.
OneToMany
)
//一对多的时候判断开始时间是否和课程一样
{
if
(
courseModel
.
StudyDate
!=
courseModel
.
StudyStartTime
)
...
...
@@ -106,32 +144,47 @@ namespace Mall.WebApi.Controllers.Education
}
}
else
{
//判断同一时间是否重复预约
{
var
orderList
=
pointModule
.
GetPointOrderList
(
new
RB_Point_TeacherCourseOrder_Extend
{
TeacherId
=
query
.
TeacherId
,
CourseId
=
query
.
CourseId
,
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
});
DateTime
nowOrderDate
=
query
.
StudyDate
;
if
(
query
.
DurationUnit
==
Common
.
Enum
.
Point
.
DurationUnitEnum
.
Hour
)
{
nowOrderDate
=
query
.
StudyDate
.
AddMinutes
(
Convert
.
ToDouble
(
query
.
TotalStudyDuration
*
60
));
}
else
{
nowOrderDate
=
query
.
StudyDate
.
AddMinutes
(
Convert
.
ToDouble
(
query
.
TotalStudyDuration
));
}
//判断同一时间是否重复预约
if
(
query
.
StudyDate
<
courseModel
.
StudyStartTime
)
{
return
ApiResult
.
Failed
(
"预约时间不能小于开始时间"
);
}
if
(
nowOrderDate
>
Convert
.
ToDateTime
(
courseModel
.
StudyDate
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
courseModel
.
StudyEndDate
))
{
return
ApiResult
.
Failed
(
"预约结束时间不能大于课程预约结束时间"
);
}
foreach
(
var
item
in
orderList
)
{
DateTime
endTime
=
item
.
StudyDate
;
if
(
item
.
DurationUnit
==
Common
.
Enum
.
Point
.
DurationUnitEnum
.
Hour
)
{
endTime
=
item
.
StudyDate
.
AddMinutes
(
Convert
.
ToDouble
(
item
.
TotalStudyDuration
*
60
));
}
else
{
endTime
=
item
.
StudyDate
.
AddMinutes
(
Convert
.
ToDouble
(
item
.
TotalStudyDuration
));
}
if
(
query
.
StudyDate
==
item
.
StudyDate
)
{
return
ApiResult
.
Failed
(
"当前预约时间已预约"
);
}
if
(
pointModule
.
GetTimeSpan
(
query
.
StudyDate
,
item
.
StudyDate
.
ToString
(
"HH:mm"
),
endTime
.
ToString
(
"HH:mm"
)))
{
return
ApiResult
.
Failed
(
"当前预约时间已预约"
);
...
...
@@ -142,20 +195,23 @@ namespace Mall.WebApi.Controllers.Education
}
}
}
query
.
ActualPointNum
=
query
.
TotalPointNum
;
query
.
State
=
0
;
query
.
UserId
=
userInfo
.
UserId
;
query
.
UpdateDate
=
System
.
DateTime
.
Now
;
bool
result
=
pointModule
.
SetTeacherCourseOrder
(
query
);
if
(
result
)
{
return
ApiResult
.
Success
(
"
课程分类信息保存
成功"
);
return
ApiResult
.
Success
(
"
预约
成功"
);
}
else
{
return
ApiResult
.
Failed
(
"
课程分类信息保存
失败"
);
return
ApiResult
.
Failed
(
"
预约
失败"
);
}
}
}
/// <summary>
/// 获取订单列表分页列表
/// </summary>
...
...
@@ -245,6 +301,8 @@ namespace Mall.WebApi.Controllers.Education
});
}
#
endregion
}
}
Mall.WebApi/Controllers/Education/PointController.cs
View file @
dd4d4b62
...
...
@@ -186,7 +186,7 @@ namespace Mall.WebApi.Controllers.Education
};
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 后台获取点数记录
/// </summary>
...
...
@@ -232,7 +232,8 @@ namespace Mall.WebApi.Controllers.Education
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPointOrderPageList
()
{
public
ApiResult
GetPointOrderPageList
()
{
var
parms
=
RequestParm
;
var
userInfo
=
UserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
...
...
@@ -274,16 +275,18 @@ namespace Mall.WebApi.Controllers.Education
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPointOrderInfo
()
{
public
ApiResult
GetPointOrderInfo
()
{
var
userInfo
=
UserInfo
;
var
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
if
(
OrderId
<=
0
)
{
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递订单id"
);
}
var
model
=
pointModule
.
GetPointOrderInfo
(
OrderId
,
userInfo
.
TenantId
);
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"订单不存在"
);}
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"订单不存在"
);
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
ID
,
...
...
@@ -311,6 +314,24 @@ namespace Mall.WebApi.Controllers.Education
});
}
/// <summary>
/// 获取订单状态枚举
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOrderStausEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
Common
.
Enum
.
Point
.
OrderStausEnum
));
return
ApiResult
.
Success
(
""
,
list
.
OrderBy
(
x
=>
Convert
.
ToInt32
(
x
.
Value
)).
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
#
endregion
#
region
在线课程分类
...
...
@@ -662,7 +683,7 @@ namespace Mall.WebApi.Controllers.Education
return
ApiResult
.
Failed
(
"请输入点数"
);
}
}
if
(
query
.
StudyDuration
==
0
)
{
return
ApiResult
.
Failed
(
"请输入课时时长"
);
...
...
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