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
393a6596
Commit
393a6596
authored
Feb 09, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
9cd55296
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
137 additions
and
32 deletions
+137
-32
RB_Customer.cs
Edu.Model/Entity/Customer/RB_Customer.cs
+8
-3
RB_Customer_Category_Extend.cs
Edu.Model/ViewModel/Customer/RB_Customer_Category_Extend.cs
+5
-0
RB_Customer_Extend.cs
Edu.Model/ViewModel/Customer/RB_Customer_Extend.cs
+10
-0
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+2
-2
CustomerModule.cs
Edu.Module.Customer/CustomerModule.cs
+24
-19
RB_CustomerRepository.cs
Edu.Repository/Customer/RB_CustomerRepository.cs
+23
-6
B2BCustomerController.cs
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
+65
-2
No files found.
Edu.Model/Entity/Customer/RB_Customer.cs
View file @
393a6596
...
...
@@ -18,7 +18,7 @@ namespace Edu.Model.Entity.Customer
public
int
CustomerId
{
get
;
set
;
}
/// <summary>
///
客户名称
///
联系人
/// </summary>
public
string
CustomerName
{
get
;
set
;
}
...
...
@@ -208,14 +208,19 @@ namespace Edu.Model.Entity.Customer
public
string
EnterpriseName
{
get
;
set
;
}
/// <summary>
/// 同业类型
1企业 2学校
/// 同业类型
(见枚举)
/// </summary>
public
int
CustomerType
{
get
;
set
;
}
public
CatetoryTypeEnum
CustomerType
{
get
;
set
;
}
/// <summary>
/// 微信号码
/// </summary>
public
string
WeChatNo
{
get
;
set
;
}
/// <summary>
/// 客户分类编号
/// </summary>
public
int
CategoryId
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Customer/RB_Customer_Category_Extend.cs
View file @
393a6596
...
...
@@ -24,5 +24,10 @@ namespace Edu.Model.ViewModel.Customer
/// 订单数量
/// </summary>
public
int
OrderCount
{
get
;
set
;
}
/// <summary>
/// 订单金额
/// </summary>
public
decimal
OrderSales
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Customer/RB_Customer_Extend.cs
View file @
393a6596
...
...
@@ -123,5 +123,15 @@ namespace Edu.Model.ViewModel.Customer
/// 结束日期
/// </summary>
public
string
EndDate
{
get
;
set
;
}
/// <summary>
/// 客户编号
/// </summary>
public
string
QCategoryIds
{
get
;
set
;
}
/// <summary>
/// 同业名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
}
}
Edu.Module.Course/OrderModule.cs
View file @
393a6596
...
...
@@ -583,7 +583,7 @@ namespace Edu.Module.Course
else
if
((
int
)
m
.
OrderSourceType
==
2
)
{
var
customerModel
=
customerRepository
.
GetEntity
(
m
.
OrderSourceId
);
if
(
customerModel
.
CustomerType
==
1
)
if
(
customerModel
.
CustomerType
==
Common
.
Enum
.
Customer
.
CatetoryTypeEnum
.
Company
)
{
if
(
courseModel
.
CommissionReType
==
1
)
{
...
...
@@ -1007,7 +1007,7 @@ namespace Edu.Module.Course
}
if
(
orderModel
.
CustomerId
!=
demodel
.
CustomerId
)
{
LogContent
+=
$",关联同行由【
{
customerRepository
.
GetEntity
(
orderModel
.
CustomerId
)?.
CustomerName
??
""
}
】修改为【
{
customerRepository
.
GetEntity
(
demodel
.
CustomerId
)?.
CustomerName
??
""
}
】"
;
LogContent
+=
$",关联同行
联系人
由【
{
customerRepository
.
GetEntity
(
orderModel
.
CustomerId
)?.
CustomerName
??
""
}
】修改为【
{
customerRepository
.
GetEntity
(
demodel
.
CustomerId
)?.
CustomerName
??
""
}
】"
;
}
if
(
orderModel
.
GeneralOccupation
!=
demodel
.
GeneralOccupation
)
{
...
...
Edu.Module.Customer/CustomerModule.cs
View file @
393a6596
...
...
@@ -105,6 +105,7 @@ namespace Edu.Module.Customer
{
nameof
(
RB_Customer_Extend
.
CustomerType
),
model
.
CustomerType
},
{
nameof
(
RB_Customer_Extend
.
UpdateTime
),
model
.
UpdateTime
},
{
nameof
(
RB_Customer_Extend
.
WeChatNo
),
model
.
WeChatNo
},
{
nameof
(
RB_Customer_Extend
.
CategoryId
),
model
.
CategoryId
},
};
flag
=
customerRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Customer_Extend
.
CustomerId
),
model
.
CustomerId
));
if
(
flag
)
...
...
@@ -113,7 +114,7 @@ namespace Edu.Module.Customer
string
LogContent
=
"后台修改同业信息:"
;
if
(
oldModel
.
CustomerName
!=
model
.
CustomerName
)
{
LogContent
+=
"
名称
由'"
+
oldModel
.
CustomerName
+
"'修改为'"
+
model
.
CustomerName
+
"';"
;
LogContent
+=
"
联系人
由'"
+
oldModel
.
CustomerName
+
"'修改为'"
+
model
.
CustomerName
+
"';"
;
}
if
(
oldModel
.
ContactNumber
!=
model
.
ContactNumber
)
{
...
...
@@ -146,7 +147,7 @@ namespace Edu.Module.Customer
}
if
(
oldModel
.
CustomerType
!=
model
.
CustomerType
)
{
LogContent
+=
"类型由'"
+
(
oldModel
.
CustomerType
==
1
?
"企业"
:
"学校"
)
+
"'修改为'"
+
(
model
.
CustomerType
==
1
?
"企业"
:
"学校"
)
+
"';"
;
LogContent
+=
"类型由'"
+
oldModel
.
CustomerType
.
ToName
()
+
"'修改为'"
+
(
model
.
CustomerType
.
ToName
()
)
+
"';"
;
}
if
(
oldModel
.
WeChatNo
!=
model
.
WeChatNo
)
{
...
...
@@ -271,11 +272,11 @@ namespace Edu.Module.Customer
foreach
(
var
item
in
list
)
{
var
stu
Model
=
StuNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
).
FirstOrDefaul
t
();
var
order
Model
=
OrderNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
).
FirstOrDefaul
t
();
item
.
StuNum
=
stu
Model
?.
StuNum
??
0
;
item
.
OrderNum
=
order
Model
?.
OrderNum
??
0
;
item
.
OrderSales
=
order
Model
?.
OrderSales
??
0
;
var
stu
List
=
StuNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
)?.
ToLis
t
();
var
order
List
=
OrderNumList
.
Where
(
x
=>
x
.
CustomerId
==
item
.
CustomerId
)?.
ToLis
t
();
item
.
StuNum
=
stu
List
?.
Sum
(
qitem
=>
qitem
.
StuNum
)??
0
;
item
.
OrderNum
=
order
List
?.
Sum
(
qitem
=>
qitem
.
OrderNum
)
??
0
;
item
.
OrderSales
=
order
List
?.
Sum
(
qitem
=>
qitem
.
OrderSales
)
??
0
;
}
}
return
list
;
...
...
@@ -501,31 +502,35 @@ namespace Edu.Module.Customer
{
string
Ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
CategoryId
));
List
<
RB_Customer_Extend
>
customerLinkList
=
new
List
<
RB_Customer_Extend
>();
List
<
RB_Student_ViewModel
>
studentList
=
new
List
<
RB_Student_ViewModel
>();
List
<
RB_Customer_Extend
>
StuNumList
=
new
List
<
RB_Customer_Extend
>();
List
<
RB_Customer_Extend
>
OrderNumList
=
new
List
<
RB_Customer_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
Ids
))
{
//联系人
customerLinkList
=
customerRepository
.
GetCustomerListRepository
(
new
RB_Customer_Extend
()
{
QCategoryIds
=
Ids
});
//客户数量
studentList
=
studentRepository
.
GetStudentListRepository
(
new
RB_Student_ViewModel
()
if
(
customerLinkList
!=
null
&&
customerLinkList
.
Count
>
0
)
{
});
//订单数量
string
customerIds
=
string
.
Join
(
","
,
customerLinkList
.
Select
(
qitem
=>
qitem
.
CustomerId
));
//查询客户数量
StuNumList
=
customerRepository
.
GetCustomerStuNum
(
customerIds
,
query
.
Group_Id
);
//查询订单数量 及 交易额
OrderNumList
=
customerRepository
.
GetCustomerOrderNum
(
customerIds
,
query
.
Group_Id
);
}
}
foreach
(
var
item
in
list
)
{
var
tempLinkList
=
customerLinkList
;
var
tempLinkList
=
customerLinkList
?.
Where
(
qitem
=>
qitem
.
CategoryId
==
item
.
CategoryId
)?.
ToList
()
;
item
.
LinkManCount
=
tempLinkList
?.
Count
()
??
0
;
var
tempStuList
=
studentList
;
item
.
OrderCount
=
0
;
item
.
StudentCount
=
tempStuList
?.
Count
()
??
0
;
var
stuList
=
StuNumList
.
Where
(
x
=>
x
.
CategoryId
==
item
.
CategoryId
)?.
ToList
();
var
orderList
=
OrderNumList
.
Where
(
x
=>
x
.
CategoryId
==
item
.
CategoryId
)?.
ToList
();
item
.
OrderCount
=
orderList
?.
Sum
(
qitem
=>
qitem
.
OrderNum
)
??
0
;
item
.
OrderSales
=
orderList
?.
Sum
(
qitem
=>
qitem
.
OrderSales
)
??
0
;
item
.
StudentCount
=
stuList
?.
Sum
(
qitem
=>
qitem
.
StuNum
)??
0
;
}
}
return
list
;
...
...
Edu.Repository/Customer/RB_CustomerRepository.cs
View file @
393a6596
...
...
@@ -28,8 +28,8 @@ namespace Edu.Repository.Customer
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Customer AS A
SELECT A.*
,IFNULL(B.CategoryName,'') AS CategoryName
FROM RB_Customer AS A
LEFT JOIN rb_customer_category AS B ON A.CategoryId=B.CategoryId
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Customer_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
...
...
@@ -152,6 +152,14 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0} in({1}) "
,
nameof
(
RB_Customer_Extend
.
CustomerId
),
query
.
CustomerIds
);
}
if
(
query
.
CategoryId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0} in({1}) "
,
nameof
(
RB_Customer_Extend
.
CategoryId
),
query
.
CategoryId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QCategoryIds
))
{
builder
.
AppendFormat
(
" AND A.{0} in({1}) "
,
nameof
(
RB_Customer_Extend
.
CategoryId
),
query
.
QCategoryIds
);
}
}
return
Get
<
RB_Customer_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
...
...
@@ -165,8 +173,13 @@ WHERE 1=1
/// <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"
;
string
sql
=
$@"
SELECT s.CustomerId,C.CategoryId,COUNT(0) as StuNum
FROM rb_student s INNER JOIN rb_customer AS c ON (s.StuSourceId=C.CustomerId AND s.CreateType=2)
WHERE s.`Status`=0 and s.Group_Id =
{
group_Id
}
and s.CustomerId in(
{
customerIds
}
)
GROUP BY s.CustomerId,C.CategoryId
"
;
return
Get
<
RB_Customer_Extend
>(
sql
).
ToList
();
}
...
...
@@ -178,8 +191,12 @@ WHERE s.`Status`=0 and s.Group_Id ={group_Id} and s.CustomerId in({customerIds})
/// <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"
;
string
sql
=
$@"
SELECT o.CustomerId,C.CategoryId,COUNT(0) as OrderNum, SUM(o.PreferPrice) as OrderSales
FROM rb_order o INNER JOIN rb_customer AS c ON (o.CustomerId=C.CustomerId)
WHERE o.OrderState in(1,2) and o.Group_Id =
{
group_Id
}
and o.CustomerId in(
{
customerIds
}
)
GROUP BY o.CustomerId,C.CategoryId
"
;
return
Get
<
RB_Customer_Extend
>(
sql
).
ToList
();
}
...
...
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
View file @
393a6596
...
...
@@ -97,8 +97,9 @@ namespace Edu.WebApi.Controllers.Customer
Account
=
base
.
ParmJObj
.
GetStringValue
(
"Account"
),
Remark
=
base
.
ParmJObj
.
GetStringValue
(
"Remark"
),
EnterpriseName
=
base
.
ParmJObj
.
GetStringValue
(
"EnterpriseName"
),
CustomerType
=
base
.
ParmJObj
.
GetInt
(
"CustomerType"
),
CustomerType
=
(
CatetoryTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"CustomerType"
),
WeChatNo
=
base
.
ParmJObj
.
GetStringValue
(
"WeChatNo"
),
CategoryId
=
base
.
ParmJObj
.
GetInt
(
"CategoryId"
),
};
if
(
string
.
IsNullOrEmpty
(
model
.
CustomerName
))
{
...
...
@@ -858,12 +859,15 @@ namespace Edu.WebApi.Controllers.Customer
[
HttpPost
]
public
ApiResult
SetCustomerCategory
()
{
int
CategoryId
=
base
.
ParmJObj
.
GetInt
(
"CategoryId"
);
var
extModel
=
new
RB_Customer_Category_Extend
()
{
CategoryId
=
base
.
ParmJObj
.
GetInt
(
"CategoryId"
)
,
CategoryId
=
CategoryId
,
CategoryName
=
base
.
ParmJObj
.
GetStringValue
(
"CategoryName"
),
CatetoryType
=
(
CatetoryTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"CatetoryType"
),
};
var
linkMan
=
base
.
ParmJObj
.
GetStringValue
(
"linkMan"
);
var
linkTel
=
base
.
ParmJObj
.
GetStringValue
(
"linkTel"
);
extModel
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
extModel
.
CreateBy
=
base
.
UserInfo
.
Id
;
extModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
...
...
@@ -871,6 +875,53 @@ namespace Edu.WebApi.Controllers.Customer
extModel
.
UpdateTime
=
DateTime
.
Now
;
extModel
.
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
;
bool
flag
=
customerModule
.
SetCustomerCategoryModule
(
extModel
);
if
(
flag
&&
CategoryId
<=
0
)
{
var
customerModel
=
new
RB_Customer_Extend
()
{
CustomerId
=
0
,
CustomerName
=
linkMan
,
ContactNumber
=
linkTel
,
Fax
=
""
,
QQ
=
""
,
Email
=
""
,
Address
=
""
,
Sex
=
1
,
Image
=
""
,
CustomerSourceType
=
(
int
)
extModel
.
CatetoryType
,
CustomerSource
=
extModel
.
CategoryName
,
CountryId
=
0
,
ProvinceId
=
0
,
CityId
=
0
,
DistrictId
=
0
,
LngLat
=
""
,
Account
=
linkTel
,
Remark
=
""
,
EnterpriseName
=
""
,
CustomerType
=
extModel
.
CatetoryType
,
WeChatNo
=
""
,
CategoryId
=
extModel
.
CategoryId
,
};
if
(
string
.
IsNullOrEmpty
(
customerModel
.
CustomerName
))
{
return
ApiResult
.
ParamIsNull
(
message
:
"请填写客户名称!"
);
}
if
(
string
.
IsNullOrEmpty
(
customerModel
.
ContactNumber
)
&&
string
.
IsNullOrEmpty
(
customerModel
.
QQ
)
&&
string
.
IsNullOrEmpty
(
customerModel
.
WeChatNo
))
{
return
ApiResult
.
Failed
(
"手机号码、QQ号码、微信号码至少填写一项!"
);
}
customerModel
.
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
;
customerModel
.
CreateBy
=
base
.
UserInfo
.
Id
;
customerModel
.
CreateTime
=
DateTime
.
Now
;
customerModel
.
UpdateTime
=
DateTime
.
Now
;
customerModel
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
customerModel
.
School_Id
=
base
.
UserInfo
.
School_Id
;
customerModel
.
ApproveState
=
1
;
customerModel
.
ApproveId
=
base
.
UserInfo
.
Id
;
customerModel
.
ApproveTime
=
DateTime
.
Now
;
customerModel
.
CustomerState
=
CustomerStateEnum
.
Normal
;
customerModule
.
SetCustomerModule
(
customerModel
);
}
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
@@ -879,6 +930,7 @@ namespace Edu.WebApi.Controllers.Customer
/// 根据编号获取同行
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCustomerCategory
()
{
var
CategoryId
=
base
.
ParmJObj
.
GetInt
(
"CategoryId"
);
...
...
@@ -890,6 +942,7 @@ namespace Edu.WebApi.Controllers.Customer
/// 根据编号删除同行信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
RemoveCustomerCategory
()
{
var
CategoryId
=
base
.
ParmJObj
.
GetInt
(
"CategoryId"
);
...
...
@@ -897,6 +950,16 @@ namespace Edu.WebApi.Controllers.Customer
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取客户类型列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCatetoryTypeList
()
{
var
list
=
Common
.
Plugin
.
EnumHelper
.
EnumToList
(
typeof
(
CatetoryTypeEnum
));
return
ApiResult
.
Success
(
data
:
list
);
}
#
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