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
3b9afe43
Commit
3b9afe43
authored
Dec 09, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
ac988790
a105485e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
164 additions
and
3 deletions
+164
-3
RB_Customer.cs
Edu.Model/Entity/Customer/RB_Customer.cs
+10
-0
RB_User_ChangeLog.cs
Edu.Model/Entity/Log/RB_User_ChangeLog.cs
+1
-1
RB_Customer_Extend.cs
Edu.Model/ViewModel/Customer/RB_Customer_Extend.cs
+15
-0
CustomerModule.cs
Edu.Module.Customer/CustomerModule.cs
+32
-1
RB_CustomerRepository.cs
Edu.Repository/Customer/RB_CustomerRepository.cs
+31
-0
RB_StudentRepository.cs
Edu.Repository/User/RB_StudentRepository.cs
+0
-1
B2BCustomerController.cs
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
+75
-0
No files found.
Edu.Model/Entity/Customer/RB_Customer.cs
View file @
3b9afe43
...
...
@@ -201,5 +201,15 @@ namespace Edu.Model.Entity.Customer
/// 小程序ID
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 企业名称
/// </summary>
public
string
EnterpriseName
{
get
;
set
;
}
/// <summary>
/// 同业类型 1企业 2学校
/// </summary>
public
int
CustomerType
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/Entity/Log/RB_User_ChangeLog.cs
View file @
3b9afe43
...
...
@@ -44,7 +44,7 @@ namespace Edu.Model.Entity.Log
private
int
type
=
1
;
/// <summary>
/// 类型1-日常日志;2-订单日志;3-学员日志
/// 类型1-日常日志;2-订单日志;3-学员日志
;4-同业日志
/// </summary>
public
int
Type
{
get
=>
type
;
set
=>
type
=
value
;
}
...
...
Edu.Model/ViewModel/Customer/RB_Customer_Extend.cs
View file @
3b9afe43
...
...
@@ -78,5 +78,20 @@ namespace Edu.Model.ViewModel.Customer
/// 同业Ids
/// </summary>
public
string
CustomerIds
{
get
;
set
;
}
/// <summary>
/// 学生数量
/// </summary>
public
int
StuNum
{
get
;
set
;
}
/// <summary>
/// 订单数量
/// </summary>
public
int
OrderNum
{
get
;
set
;
}
/// <summary>
/// 销售额
/// </summary>
public
decimal
OrderSales
{
get
;
set
;
}
}
}
Edu.Module.Customer/CustomerModule.cs
View file @
3b9afe43
...
...
@@ -2,8 +2,8 @@
using
Edu.Common.Enum
;
using
Edu.Model.ViewModel.Customer
;
using
Edu.Repository.Customer
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.DB
;
namespace
Edu.Module.Customer
...
...
@@ -60,6 +60,8 @@ namespace Edu.Module.Customer
{
nameof
(
RB_Customer_Extend
.
LngLat
),
model
.
LngLat
},
{
nameof
(
RB_Customer_Extend
.
Account
),
model
.
Account
},
{
nameof
(
RB_Customer_Extend
.
Remark
),
model
.
Remark
},
{
nameof
(
RB_Customer_Extend
.
EnterpriseName
),
model
.
EnterpriseName
},
{
nameof
(
RB_Customer_Extend
.
CustomerType
),
model
.
CustomerType
},
{
nameof
(
RB_Customer_Extend
.
UpdateTime
),
model
.
UpdateTime
},
};
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
...
...
@@ -128,5 +130,34 @@ namespace Edu.Module.Customer
var
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
return
flag
;
}
/// <summary>
/// 获取客户分页列表..
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Customer_Extend
>
GetCustomerPageModule_V2
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Customer_Extend
query
)
{
var
list
=
customerRepository
.
GetCustomerPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
.
Any
())
{
string
customerIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
CustomerId
));
//查询客户数量
var
StuNumList
=
customerRepository
.
GetCustomerStuNum
(
customerIds
,
query
.
Group_Id
);
//查询订单数量 及 交易额
var
OrderNumList
=
customerRepository
.
GetCustomerOrderNum
(
customerIds
,
query
.
Group_Id
);
foreach
(
var
item
in
list
)
{
var
stuModel
=
StuNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
).
FirstOrDefault
();
var
orderModel
=
OrderNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
).
FirstOrDefault
();
item
.
StuNum
=
stuModel
?.
StuNum
??
0
;
item
.
OrderNum
=
orderModel
?.
OrderNum
??
0
;
item
.
OrderSales
=
orderModel
?.
OrderSales
??
0
;
}
}
return
list
;
}
}
}
Edu.Repository/Customer/RB_CustomerRepository.cs
View file @
3b9afe43
...
...
@@ -39,6 +39,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Customer_Extend
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
CustomerId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Customer_Extend
.
CustomerId
),
query
.
CustomerId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
CustomerName
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @CustomerName "
,
nameof
(
RB_Customer_Extend
.
CustomerName
));
...
...
@@ -130,6 +134,33 @@ WHERE 1=1
}
}
return
Get
<
RB_Customer_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 获取同业下学生数量
/// </summary>
/// <param name="customerIds"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public
List
<
RB_Customer_Extend
>
GetCustomerStuNum
(
string
customerIds
,
int
group_Id
)
{
string
sql
=
$@"SELECT s.CustomerId,COUNT(0) as StuNum FROM rb_student s
WHERE s.`Status`=0 and s.Group_Id =
{
group_Id
}
and s.CustomerId in(
{
customerIds
}
) GROUP BY s.CustomerId"
;
return
Get
<
RB_Customer_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 获取同业下订单数量
/// </summary>
/// <param name="customerIds"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public
List
<
RB_Customer_Extend
>
GetCustomerOrderNum
(
string
customerIds
,
int
group_Id
)
{
string
sql
=
$@"SELECT o.CustomerId, COUNT(0) as OrderNum, SUM(o.PreferPrice) as OrderSales FROM rb_order o
WHERE o.OrderState in(1,2) and o.Group_Id =
{
group_Id
}
and o.CustomerId in(
{
customerIds
}
) GROUP BY o.CustomerId"
;
return
Get
<
RB_Customer_Extend
>(
sql
).
ToList
();
}
}
}
Edu.Repository/User/RB_StudentRepository.cs
View file @
3b9afe43
...
...
@@ -145,7 +145,6 @@ WHERE 1=1
}
/// <summary>
/// 根据学生id获取同班账户,必须是未开班/学习中的
/// </summary>
...
...
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
View file @
3b9afe43
...
...
@@ -4,6 +4,7 @@ using Edu.Common.Enum.Customer;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Customer
;
using
Edu.Module.Customer
;
using
Edu.Module.Log
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Http
;
...
...
@@ -37,6 +38,12 @@ namespace Edu.WebApi.Controllers.Customer
/// </summary>
private
readonly
CustomerBalanceDetailModule
balanceDetailModule
=
new
CustomerBalanceDetailModule
();
/// <summary>
/// 同业日志
/// </summary>
private
readonly
UserChangeLogModule
userChangeLogModule
=
new
UserChangeLogModule
();
#
region
同行管理
/// <summary>
...
...
@@ -50,6 +57,7 @@ namespace Edu.WebApi.Controllers.Customer
var
query
=
new
RB_Customer_Extend
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
CustomerId
=
base
.
ParmJObj
.
GetInt
(
"CustomerId"
),
CustomerName
=
base
.
ParmJObj
.
GetStringValue
(
"CustomerName"
),
ContactNumber
=
base
.
ParmJObj
.
GetStringValue
(
"ContactNumber"
),
ApproveState
=
base
.
ParmJObj
.
GetInt
(
"ApproveState"
),
...
...
@@ -95,6 +103,8 @@ namespace Edu.WebApi.Controllers.Customer
LngLat
=
base
.
ParmJObj
.
GetStringValue
(
"LngLat"
),
Account
=
base
.
ParmJObj
.
GetStringValue
(
"Account"
),
Remark
=
base
.
ParmJObj
.
GetStringValue
(
"Remark"
),
EnterpriseName
=
base
.
ParmJObj
.
GetStringValue
(
"EnterpriseName"
),
CustomerType
=
base
.
ParmJObj
.
GetInt
(
"CustomerType"
),
};
if
(
string
.
IsNullOrEmpty
(
model
.
CustomerName
))
{
...
...
@@ -431,5 +441,70 @@ namespace Edu.WebApi.Controllers.Customer
bool
flag
=
taskModule
.
ExchangeKudoModule
(
CustomerId
,
exchangeCode
,
out
string
message
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
(
message
:
message
);
}
#
region
同行调整
/// <summary>
/// 获取同行分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCustomerPageList_V2
()
{
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Customer_Extend
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
CustomerId
=
base
.
ParmJObj
.
GetInt
(
"CustomerId"
),
CustomerName
=
base
.
ParmJObj
.
GetStringValue
(
"CustomerName"
),
ContactNumber
=
base
.
ParmJObj
.
GetStringValue
(
"ContactNumber"
),
ApproveState
=
base
.
ParmJObj
.
GetInt
(
"ApproveState"
),
QCustomerState
=
base
.
ParmJObj
.
GetInt
(
"QCustomerState"
),
};
var
list
=
customerModule
.
GetCustomerPageModule_V2
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
}
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
CustomerId
,
x
.
CustomerName
,
x
.
ContactNumber
,
x
.
EnterpriseName
,
x
.
CustomerType
,
x
.
StuNum
,
x
.
OrderNum
,
x
.
OrderSales
,
x
.
ApproveState
,
x
.
ApproveStateStr
,
x
.
CreateBy
,
x
.
CreateByName
,
x
.
CreateTimeStr
});
pageModel
.
Count
=
rowsCount
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取同行佣金幸福存折
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCustomerCommissionPassbook
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
Msg
.
ToString
());
int
CustomerId
=
parms
.
GetInt
(
"CustomerId"
,
0
);
//同业ID
if
(
CustomerId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
return
ApiResult
.
Success
();
}
#
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