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
0a468820
Commit
0a468820
authored
Dec 08, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增学生时,自动创建学生账号
parent
4c05590e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
4 deletions
+147
-4
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+127
-1
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+20
-3
No files found.
Edu.Module.Course/OrderModule.cs
View file @
0a468820
...
...
@@ -66,6 +66,18 @@ namespace Edu.Module.Course
/// 助教
/// </summary>
private
readonly
RB_AssistRepository
assistRepository
=
new
RB_AssistRepository
();
/// <summary>
/// 学生
/// </summary>
private
readonly
RB_StudentRepository
studentRepository
=
new
RB_StudentRepository
();
/// <summary>
/// 学生关联
/// </summary>
private
readonly
RB_Student_OrderGuestRepository
student_OrderGuestRepository
=
new
RB_Student_OrderGuestRepository
();
/// <summary>
/// 账号
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
#
region
日语培训
...
...
@@ -459,6 +471,30 @@ namespace Edu.Module.Course
return
orderList
;
}
/// <summary>
/// 设置订单使用最新的班级价格
/// </summary>
/// <param name="orderId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetClassOrderUseNewClassPrice
(
int
orderId
,
UserInfo
userInfo
)
{
var
demodel
=
orderRepository
.
GetEntity
(
orderId
);
//查询班级信息
var
classModel
=
classRepository
.
GetEntity
(
demodel
.
ClassId
);
if
(
classModel
==
null
)
{
return
false
;
}
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
});
}
return
true
;
}
/// <summary>
/// 更新订单销售
/// </summary>
...
...
@@ -804,6 +840,7 @@ namespace Edu.Module.Course
bool
flag
=
order_GuestRepository
.
Update
(
gModel
);
if
(
flag
)
{
//记录日志
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
...
...
@@ -831,6 +868,79 @@ namespace Edu.Module.Course
bool
flag
=
Id
>
0
;
if
(
flag
)
{
var
classmodel
=
classRepository
.
GetEntity
(
ordermodel
.
ClassId
);
//验证账号是否存在
var
accmodel
=
accountRepository
.
GetAccountListRepository
(
new
RB_Account_ViewModel
()
{
Group_Id
=
dmodel
.
Group_Id
,
AccountType
=
Common
.
Enum
.
User
.
AccountTypeEnum
.
Student
,
Account
=
dmodel
.
Mobile
}).
FirstOrDefault
();
string
LogContent
=
"新增学生名单【"
+
Id
+
"】"
;
if
(
accmodel
!=
null
)
{
student_OrderGuestRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Student_OrderGuest
()
{
Id
=
0
,
Account_Id
=
accmodel
.
Id
,
ClassId
=
ordermodel
.
ClassId
,
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
GuestId
=
Id
,
OrderId
=
dmodel
.
OrderId
,
Status
=
DateStateEnum
.
Normal
,
Student_Id
=
accmodel
.
AccountId
});
LogContent
+=
",添加学生账号关联【"
+
accmodel
.
Id
+
"】"
;
}
else
{
//创建学生账号
int
StudentId
=
studentRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Student
()
{
StuId
=
0
,
AreaId
=
0
,
CityId
=
0
,
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
dmodel
.
Group_Id
,
IsDisable
=
1
,
ProviceId
=
0
,
School_Id
=
classmodel
.
School_Id
,
Status
=
DateStateEnum
.
Normal
,
StuBirth
=
null
,
StuIcon
=
""
,
StuName
=
dmodel
.
GuestName
,
StuSex
=
dmodel
.
Sex
-
1
,
StuTel
=
dmodel
.
Mobile
,
UpdateBy
=
dmodel
.
CreateBy
,
UpdateTime
=
DateTime
.
Now
});
int
AccountId
=
accountRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Account
()
{
Id
=
0
,
Account
=
dmodel
.
Mobile
,
AccountId
=
StudentId
,
AccountType
=
Common
.
Enum
.
User
.
AccountTypeEnum
.
Student
,
AnnualLeaveDay
=
0
,
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
dmodel
.
Group_Id
,
School_Id
=
classmodel
.
School_Id
,
Status
=
DateStateEnum
.
Normal
,
UpdateBy
=
dmodel
.
UpdateBy
,
UpdateTime
=
DateTime
.
Now
,
Password
=
Common
.
DES
.
Encrypt
(
Common
.
Config
.
DefaultPwd
)
});
student_OrderGuestRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Student_OrderGuest
()
{
Id
=
0
,
Account_Id
=
AccountId
,
ClassId
=
ordermodel
.
ClassId
,
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
GuestId
=
Id
,
OrderId
=
dmodel
.
OrderId
,
Status
=
DateStateEnum
.
Normal
,
Student_Id
=
StudentId
});
LogContent
+=
",自动创建学生账号【"
+
AccountId
+
"】"
;
}
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
...
...
@@ -838,7 +948,7 @@ namespace Edu.Module.Course
CreateBy
=
dmodel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
dmodel
.
Group_Id
,
LogContent
=
"新增学生名单【"
+
Id
+
"】"
,
LogContent
=
LogContent
,
School_Id
=
dmodel
.
School_Id
,
SourceId
=
dmodel
.
OrderId
});
...
...
@@ -869,6 +979,22 @@ namespace Edu.Module.Course
if
(
flag
)
{
var
gmodel
=
order_GuestRepository
.
GetEntity
(
guestId
);
//查询学生账号
//var sModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel() { OrderId = gmodel?.OrderId ?? 0, GuestId = guestId }).FirstOrDefault();
//if (sModel != null) {
// //更新账号表
// Dictionary<string, object> valuePairs = new Dictionary<string, object>() {
// { nameof(RB_Account_ViewModel.Status),DateStateEnum.Delete}
// };
// List<WhereHelper> wheres1 = new List<WhereHelper>() {
// new WhereHelper(){
// FiledName=nameof(RB_Account_ViewModel.Id),
// FiledValue=sModel.Account_Id,
// OperatorEnum=OperatorEnum.Equal
// }
// };
// accountRepository.Update(valuePairs, wheres1);
//}
changeLogRepository
.
Insert
(
new
Model
.
Entity
.
Log
.
RB_User_ChangeLog
()
{
Id
=
0
,
...
...
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
0a468820
...
...
@@ -544,8 +544,23 @@ namespace Edu.WebApi.Controllers.Course
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetClassOrderUseNewPrice
()
{
return
ApiResult
.
Success
();
public
ApiResult
SetClassOrderUseNewClassPrice
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
orderModule
.
SetClassOrderUseNewClassPrice
(
OrderId
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
...
...
@@ -602,7 +617,9 @@ namespace Edu.WebApi.Controllers.Course
if
(
string
.
IsNullOrEmpty
(
dmodel
.
GuestName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入客人姓名"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Mobile
))
{
return
ApiResult
.
ParamIsNull
(
"请输入手机号码"
);
}
dmodel
.
GuestState
=
1
;
dmodel
.
Status
=
0
;
...
...
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