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
23e15b9b
You need to sign in or sign up before continuing.
Commit
23e15b9b
authored
Dec 09, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
96578652
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
2 deletions
+140
-2
RB_Customer.cs
Edu.Model/Entity/Customer/RB_Customer.cs
+10
-0
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
+52
-0
No files found.
Edu.Model/Entity/Customer/RB_Customer.cs
View file @
23e15b9b
...
@@ -201,5 +201,15 @@ namespace Edu.Model.Entity.Customer
...
@@ -201,5 +201,15 @@ namespace Edu.Model.Entity.Customer
/// 小程序ID
/// 小程序ID
/// </summary>
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
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/ViewModel/Customer/RB_Customer_Extend.cs
View file @
23e15b9b
...
@@ -78,5 +78,20 @@ namespace Edu.Model.ViewModel.Customer
...
@@ -78,5 +78,20 @@ namespace Edu.Model.ViewModel.Customer
/// 同业Ids
/// 同业Ids
/// </summary>
/// </summary>
public
string
CustomerIds
{
get
;
set
;
}
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 @
23e15b9b
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
using
Edu.Common.Enum
;
using
Edu.Common.Enum
;
using
Edu.Model.ViewModel.Customer
;
using
Edu.Model.ViewModel.Customer
;
using
Edu.Repository.Customer
;
using
Edu.Repository.Customer
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.DB
;
using
VT.FW.DB
;
namespace
Edu.Module.Customer
namespace
Edu.Module.Customer
...
@@ -60,6 +60,8 @@ namespace Edu.Module.Customer
...
@@ -60,6 +60,8 @@ namespace Edu.Module.Customer
{
nameof
(
RB_Customer_Extend
.
LngLat
),
model
.
LngLat
},
{
nameof
(
RB_Customer_Extend
.
LngLat
),
model
.
LngLat
},
{
nameof
(
RB_Customer_Extend
.
Account
),
model
.
Account
},
{
nameof
(
RB_Customer_Extend
.
Account
),
model
.
Account
},
{
nameof
(
RB_Customer_Extend
.
Remark
),
model
.
Remark
},
{
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
},
{
nameof
(
RB_Customer_Extend
.
UpdateTime
),
model
.
UpdateTime
},
};
};
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
...
@@ -128,5 +130,34 @@ namespace Edu.Module.Customer
...
@@ -128,5 +130,34 @@ namespace Edu.Module.Customer
var
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
var
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
return
flag
;
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 @
23e15b9b
...
@@ -39,6 +39,10 @@ WHERE 1=1
...
@@ -39,6 +39,10 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Customer_Extend
.
Group_Id
),
query
.
Group_Id
);
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
))
if
(!
string
.
IsNullOrEmpty
(
query
.
CustomerName
))
{
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @CustomerName "
,
nameof
(
RB_Customer_Extend
.
CustomerName
));
builder
.
AppendFormat
(
" AND A.{0} LIKE @CustomerName "
,
nameof
(
RB_Customer_Extend
.
CustomerName
));
...
@@ -130,6 +134,33 @@ WHERE 1=1
...
@@ -130,6 +134,33 @@ WHERE 1=1
}
}
}
}
return
Get
<
RB_Customer_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
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 @
23e15b9b
...
@@ -144,7 +144,6 @@ WHERE 1=1
...
@@ -144,7 +144,6 @@ WHERE 1=1
}
}
/// <summary>
/// <summary>
/// 根据学生id获取同班账户,必须是未开班/学习中的
/// 根据学生id获取同班账户,必须是未开班/学习中的
/// </summary>
/// </summary>
...
...
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
View file @
23e15b9b
...
@@ -50,6 +50,7 @@ namespace Edu.WebApi.Controllers.Customer
...
@@ -50,6 +50,7 @@ namespace Edu.WebApi.Controllers.Customer
var
query
=
new
RB_Customer_Extend
()
var
query
=
new
RB_Customer_Extend
()
{
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
CustomerId
=
base
.
ParmJObj
.
GetInt
(
"CustomerId"
),
CustomerName
=
base
.
ParmJObj
.
GetStringValue
(
"CustomerName"
),
CustomerName
=
base
.
ParmJObj
.
GetStringValue
(
"CustomerName"
),
ContactNumber
=
base
.
ParmJObj
.
GetStringValue
(
"ContactNumber"
),
ContactNumber
=
base
.
ParmJObj
.
GetStringValue
(
"ContactNumber"
),
ApproveState
=
base
.
ParmJObj
.
GetInt
(
"ApproveState"
),
ApproveState
=
base
.
ParmJObj
.
GetInt
(
"ApproveState"
),
...
@@ -95,6 +96,8 @@ namespace Edu.WebApi.Controllers.Customer
...
@@ -95,6 +96,8 @@ namespace Edu.WebApi.Controllers.Customer
LngLat
=
base
.
ParmJObj
.
GetStringValue
(
"LngLat"
),
LngLat
=
base
.
ParmJObj
.
GetStringValue
(
"LngLat"
),
Account
=
base
.
ParmJObj
.
GetStringValue
(
"Account"
),
Account
=
base
.
ParmJObj
.
GetStringValue
(
"Account"
),
Remark
=
base
.
ParmJObj
.
GetStringValue
(
"Remark"
),
Remark
=
base
.
ParmJObj
.
GetStringValue
(
"Remark"
),
EnterpriseName
=
base
.
ParmJObj
.
GetStringValue
(
"EnterpriseName"
),
CustomerType
=
base
.
ParmJObj
.
GetInt
(
"CustomerType"
),
};
};
if
(
string
.
IsNullOrEmpty
(
model
.
CustomerName
))
if
(
string
.
IsNullOrEmpty
(
model
.
CustomerName
))
{
{
...
@@ -431,5 +434,54 @@ namespace Edu.WebApi.Controllers.Customer
...
@@ -431,5 +434,54 @@ namespace Edu.WebApi.Controllers.Customer
bool
flag
=
taskModule
.
ExchangeKudoModule
(
CustomerId
,
exchangeCode
,
out
string
message
);
bool
flag
=
taskModule
.
ExchangeKudoModule
(
CustomerId
,
exchangeCode
,
out
string
message
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
(
message
:
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
);
}
#
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