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
c83ed12e
Commit
c83ed12e
authored
Nov 24, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 客户管理阶段性提交代码
parent
07237255
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2597 additions
and
224 deletions
+2597
-224
QYCustomerClueHelper.cs
Edu.Common/Data/QYCustomerClueHelper.cs
+94
-0
NPOIHelper.cs
Edu.Common/Plugin/NPOIHelper.cs
+39
-0
RB_WeChat_CustomerConfig.cs
Edu.Model/Entity/WeChat/RB_WeChat_CustomerConfig.cs
+5
-0
RB_WeChat_CustomerInfo.cs
Edu.Model/Entity/WeChat/RB_WeChat_CustomerInfo.cs
+22
-2
RB_WeChat_CustomerLibrary.cs
Edu.Model/Entity/WeChat/RB_WeChat_CustomerLibrary.cs
+115
-0
RB_WeChat_CustomerField_ViewModel.cs
...del/ViewModel/WeChat/RB_WeChat_CustomerField_ViewModel.cs
+5
-0
RB_WeChat_CustomerInfo_ViewModel.cs
...odel/ViewModel/WeChat/RB_WeChat_CustomerInfo_ViewModel.cs
+42
-0
RB_WeChat_CustomerLibrary_ViewModel.cs
...l/ViewModel/WeChat/RB_WeChat_CustomerLibrary_ViewModel.cs
+136
-0
QYCustomerModule.cs
Edu.Module.QYWeChat/QYCustomerModule.cs
+1379
-209
RB_WeChat_CustomerFieldRepository.cs
Edu.Repository/WeChat/RB_WeChat_CustomerFieldRepository.cs
+4
-0
RB_WeChat_CustomerInfoRepository.cs
Edu.Repository/WeChat/RB_WeChat_CustomerInfoRepository.cs
+130
-2
RB_WeChat_CustomerLibraryRepository.cs
Edu.Repository/WeChat/RB_WeChat_CustomerLibraryRepository.cs
+51
-0
QYWeiXinHelper.cs
Edu.ThirdCore/QYWinXin/QYWeiXinHelper.cs
+1
-1
QYCustomerController.cs
Edu.WebApi/Controllers/QYWeChat/QYCustomerController.cs
+495
-4
UploadController.cs
Edu.WebApi/Controllers/Upload/UploadController.cs
+79
-6
No files found.
Edu.Common/Data/QYCustomerClueHelper.cs
0 → 100644
View file @
c83ed12e
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Linq
;
using
Edu.Common.Plugin
;
namespace
Edu.Common.Data
{
/// <summary>
/// 客户导入帮助类
/// </summary>
public
class
QYCustomerClueHelper
{
/// <summary>
/// 根据Excel文件获取列表
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public
static
List
<
CustomerClueListModel
>
GetCustomerClueData
(
string
filePath
,
List
<
string
>
fieldList
)
{
List
<
CustomerClueListModel
>
xlsItems
=
new
List
<
CustomerClueListModel
>();
var
dt
=
Common
.
Plugin
.
NPOIHelper
.
ImportExcelToDatatable
(
filePath
,
0
,
2
,
true
);
if
(
dt
!=
null
&&
dt
.
Rows
.
Count
>
0
)
{
foreach
(
DataRow
item
in
dt
.
Rows
)
{
xlsItems
.
Add
(
DataRowToModel
(
item
,
fieldList
));
}
}
return
xlsItems
;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
private
static
CustomerClueListModel
DataRowToModel
(
DataRow
dr
,
List
<
string
>
fieldList
)
{
List
<
CustomerClueModel
>
list
=
new
List
<
CustomerClueModel
>();
if
(
dr
!=
null
)
{
foreach
(
var
item
in
fieldList
)
{
if
(
dr
.
Table
.
Columns
.
Contains
(
item
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
item
].
ToString
()))
{
list
.
Add
(
new
CustomerClueModel
()
{
Name
=
item
,
Value
=
dr
[
item
].
ToString
()
});
}
//有必填带*情况
else
if
(
dr
.
Table
.
Columns
.
Contains
(
item
+
"*"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
item
+
"*"
].
ToString
()))
{
list
.
Add
(
new
CustomerClueModel
()
{
Name
=
item
,
Value
=
dr
[
item
+
"*"
].
ToString
()
});
}
}
}
return
new
CustomerClueListModel
()
{
list
=
list
};
}
}
/// <summary>
/// 导入数据格式
/// </summary>
public
class
CustomerClueModel
{
/// <summary>
/// 字段名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 字段值
/// </summary>
public
string
Value
{
get
;
set
;
}
}
/// <summary>
/// 导入数据列表
/// </summary>
public
class
CustomerClueListModel
{
public
List
<
CustomerClueModel
>
list
;
}
}
Edu.Common/Plugin/NPOIHelper.cs
View file @
c83ed12e
...
...
@@ -758,5 +758,44 @@ namespace Edu.Common.Plugin
workbook
.
Close
();
out1
.
Close
();
}
/// <summary>
/// excel 指定行插入数据(客户线索专用)
/// </summary>
/// <param name="dtSource"></param>
/// <param name="SheetName"></param>
/// <param name="Path"></param>
/// <param name="NewPath"></param>
/// <param name="rowIndex"></param>
public
static
void
CustomerExportInsert
(
DataTable
dtSource
,
string
SheetName
,
string
Path
,
string
NewPath
,
int
rowIndex
=
0
)
{
FileStream
file
=
new
FileStream
(
Path
,
FileMode
.
Open
,
FileAccess
.
Read
);
XSSFWorkbook
workbook
=
new
XSSFWorkbook
(
file
);
XSSFSheet
sheet
=
workbook
.
GetSheet
(
SheetName
)
as
XSSFSheet
;
foreach
(
DataRow
row
in
dtSource
.
Rows
)
{
#
region
填充内容
var
rowSource
=
sheet
.
GetRow
(
rowIndex
);
var
cellSource
=
rowSource
.
GetCell
(
0
);
//都以第一列的样式复制
XSSFRow
dataRow
=
sheet
.
CreateRow
(
rowIndex
)
as
XSSFRow
;
dataRow
.
Height
=
500
;
foreach
(
DataColumn
column
in
dtSource
.
Columns
)
{
XSSFCell
newCell
=
dataRow
.
CreateCell
(
column
.
Ordinal
)
as
XSSFCell
;
newCell
.
CellStyle
=
cellSource
.
CellStyle
;
String
drValue
=
row
[
column
].
ToString
();
newCell
.
SetCellValue
(
drValue
);
}
#
endregion
rowIndex
++;
}
FileStream
out1
=
new
FileStream
(
NewPath
,
FileMode
.
Create
);
workbook
.
Write
(
out1
);
workbook
.
Close
();
out1
.
Close
();
}
}
}
\ No newline at end of file
Edu.Model/Entity/WeChat/RB_WeChat_CustomerConfig.cs
View file @
c83ed12e
...
...
@@ -142,5 +142,10 @@ namespace Edu.Model.Entity.WeChat
/// </summary>
public
string
TransferCustomerEmp
{
get
;
set
;
}
/// <summary>
/// 公海 查重规则 1客户库查重 2全局查重
/// </summary>
public
int
LookRepeat
{
get
;
set
;
}
}
}
Edu.Model/Entity/WeChat/RB_WeChat_CustomerInfo.cs
View file @
c83ed12e
...
...
@@ -124,7 +124,7 @@ namespace Edu.Model.Entity.WeChat
public
string
CustomContent
{
get
;
set
;
}
/// <summary>
/// 好友状态 1好友客户 2待添加 3已申请
/// 好友状态 1好友客户 2待添加 3已申请
4已删除(客户主动删除) 5已删除(员工主动删除)
/// </summary>
public
int
FriendState
{
get
;
set
;
}
...
...
@@ -144,7 +144,7 @@ namespace Edu.Model.Entity.WeChat
public
int
CheckInNum
{
get
;
set
;
}
/// <summary>
/// 是否公海客户 1是 2否
/// 是否公海客户 1是 2否
(暂时弃用 字段保留)
/// </summary>
public
int
IsPublic
{
get
;
set
;
}
...
...
@@ -192,5 +192,25 @@ namespace Edu.Model.Entity.WeChat
/// 分配客户时间
/// </summary>
public
DateTime
?
AllotCustomerTime
{
get
;
set
;
}
/// <summary>
/// 前负责员工ID (如放弃公海)
/// </summary>
public
int
OldEmpId
{
get
;
set
;
}
/// <summary>
/// 客户库ID (主要用于公海)
/// </summary>
public
int
CustomerLibraryId
{
get
;
set
;
}
/// <summary>
/// 放弃至公海的原因
/// </summary>
public
string
AbandonReason
{
get
;
set
;
}
/// <summary>
/// 放弃至公海的时间
/// </summary>
public
DateTime
?
AbandonTime
{
get
;
set
;
}
}
}
Edu.Model/Entity/WeChat/RB_WeChat_CustomerLibrary.cs
0 → 100644
View file @
c83ed12e
using
Edu.Common.Enum.WeChat
;
using
System
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.WeChat
{
/// <summary>
/// 企业微信客户库实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_WeChat_CustomerLibrary
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 公海名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 是否默认 1是 2否
/// </summary>
public
int
IsDefault
{
get
;
set
;
}
/// <summary>
/// 是否允许重复客户 1允许 2不允许
/// </summary>
public
int
IsAllowRepeat
{
get
;
set
;
}
/// <summary>
/// 部门ids
/// </summary>
public
string
DeptIds
{
get
;
set
;
}
/// <summary>
/// 员工ids
/// </summary>
public
string
EmpIds
{
get
;
set
;
}
/// <summary>
/// 回收类型 1手动回收 2自动回收
/// </summary>
public
int
RecyclingType
{
get
;
set
;
}
/// <summary>
/// 回收条件 存List<obj>
/// </summary>
public
string
RecycleCondition
{
get
;
set
;
}
/// <summary>
/// 免回收的时间段 List<obj>
/// </summary>
public
string
NotRecycleTime
{
get
;
set
;
}
/// <summary>
/// 提前几天提醒
/// </summary>
public
int
RemindDay
{
get
;
set
;
}
/// <summary>
/// 类型 1天 2小时 3分钟
/// </summary>
public
int
RemindType
{
get
;
set
;
}
/// <summary>
/// 回收到公海后,前负责人多少天不能领取
/// </summary>
public
int
LimitDay
{
get
;
set
;
}
/// <summary>
/// 私库限制
/// </summary>
public
string
PrivateLibraryLimit
{
get
;
set
;
}
/// <summary>
/// 占用私库的类型 多选英文逗号分隔
/// </summary>
public
string
PrivateLibraryType
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建日期
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/WeChat/RB_WeChat_CustomerField_ViewModel.cs
View file @
c83ed12e
...
...
@@ -25,6 +25,11 @@ namespace Edu.Model.ViewModel.WeChat
/// 当前客户对应字段的值
/// </summary>
public
string
Value
{
get
;
set
;
}
/// <summary>
/// 自定义字段名称
/// </summary>
public
string
CName
{
get
;
set
;
}
}
/// <summary>
...
...
Edu.Model/ViewModel/WeChat/RB_WeChat_CustomerInfo_ViewModel.cs
View file @
c83ed12e
...
...
@@ -46,6 +46,11 @@ namespace Edu.Model.ViewModel.WeChat
/// </summary>
public
string
EmpName
{
get
;
set
;
}
/// <summary>
/// 前负责人名称
/// </summary>
public
string
OldEmpName
{
get
;
set
;
}
/// <summary>
/// 未跟进天数
/// </summary>
...
...
@@ -71,6 +76,25 @@ namespace Edu.Model.ViewModel.WeChat
/// </summary>
public
string
Q_CustomerIds
{
get
;
set
;
}
/// <summary>
/// 客户企业微信Ids
/// </summary>
public
string
Q_ExternalUserIds
{
get
;
set
;
}
/// <summary>
/// 员工的部门ID
/// </summary>
public
int
DeptId
{
get
;
}
/// <summary>
/// 客人姓名
/// </summary>
public
string
CName
{
get
;
set
;
}
/// <summary>
/// 姓名自定义字段ID
/// </summary>
public
int
CNameId
{
get
;
set
;
}
/// <summary>
/// 创建开始时间
...
...
@@ -88,6 +112,24 @@ namespace Edu.Model.ViewModel.WeChat
/// 好友结束时间
/// </summary>
public
string
FriendETime
{
get
;
set
;
}
/// <summary>
/// 转客户开始时间
/// </summary>
public
string
TurnCustomerSTime
{
get
;
set
;
}
/// <summary>
/// 转客户结束时间
/// </summary>
public
string
TurnCustomerETime
{
get
;
set
;
}
/// <summary>
/// 分配客户开始时间
/// </summary>
public
string
AllotCustomerSTime
{
get
;
set
;
}
/// <summary>
/// 分配客户结束时间
/// </summary>
public
string
AllotCustomerETime
{
get
;
set
;
}
}
/// <summary>
...
...
Edu.Model/ViewModel/WeChat/RB_WeChat_CustomerLibrary_ViewModel.cs
0 → 100644
View file @
c83ed12e
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Edu.Common.Enum.Sale
;
using
Edu.Model.Entity.WeChat
;
using
Edu.Model.Public
;
namespace
Edu.Model.ViewModel.WeChat
{
/// <summary>
/// 企业微信客户库扩展类
/// </summary>
public
class
RB_WeChat_CustomerLibrary_ViewModel
:
RB_WeChat_CustomerLibrary
{
/// <summary>
/// 分配的部门
/// </summary>
public
List
<
User
.
RB_Department_ViewModel
>
DeptList
{
get
;
set
;
}
/// <summary>
/// 分配的员工
/// </summary>
public
List
<
User
.
Employee_ViewModel
>
EmpList
{
get
;
set
;
}
/// <summary>
/// 回收条件列表
/// </summary>
public
List
<
RecycleConditionModel
>
ConditionList
{
get
;
set
;
}
/// <summary>
/// 私库限制列表
/// </summary>
public
List
<
PrivateLibraryLimitExtend
>
LimitList
{
get
;
set
;
}
/// <summary>
/// 免回收时间段列表
/// </summary>
public
List
<
NotRecycleTimeModel
>
NotRecycleTimeList
{
get
;
set
;
}
/// <summary>
/// 占用私库名额类型名称
/// </summary>
public
string
PrivateLibraryTypeStr
{
get
;
set
;
}
}
/// <summary>
/// 免回收时间段
/// </summary>
public
class
NotRecycleTimeModel
{
/// <summary>
/// 开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 类型 1每天
/// </summary>
public
int
Type
{
get
;
set
;
}
}
/// <summary>
/// 自动回收条件
/// </summary>
public
class
RecycleConditionModel
{
/// <summary>
/// 类型 1未跟进 2未加微信好友 3客户阶段未到达"成交"阶段 4客户阶段达到某一个后 没有签到拜访 5没有再次跟进 6没有再次更新客户阶段
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 数量
/// </summary>
public
int
Num
{
get
;
set
;
}
/// <summary>
/// 类型 1天 2小时 3分钟
/// </summary>
public
int
DateType
{
get
;
set
;
}
/// <summary>
/// 阶段ID
/// </summary>
public
int
StageId
{
get
;
set
;
}
}
/// <summary>
/// 私库限制
/// </summary>
public
class
PrivateLibraryLimitModel
{
/// <summary>
/// 是否默认 1是
/// </summary>
public
int
IsDefault
{
get
;
set
;
}
/// <summary>
/// 部门Ids
/// </summary>
public
string
DeptIds
{
get
;
set
;
}
/// <summary>
/// 人员Ids
/// </summary>
public
string
EmpIds
{
get
;
set
;
}
/// <summary>
/// 私库限制客户数量
/// </summary>
public
int
LimitNum
{
get
;
set
;
}
/// <summary>
/// 私库锁库客户数量
/// </summary>
public
int
LockNum
{
get
;
set
;
}
}
/// <summary>
/// 限制扩展
/// </summary>
public
class
PrivateLibraryLimitExtend
:
PrivateLibraryLimitModel
{
/// <summary>
/// 分配的部门
/// </summary>
public
List
<
User
.
RB_Department_ViewModel
>
DeptList
{
get
;
set
;
}
/// <summary>
/// 分配的员工
/// </summary>
public
List
<
User
.
Employee_ViewModel
>
EmpList
{
get
;
set
;
}
}
}
Edu.Module.QYWeChat/QYCustomerModule.cs
View file @
c83ed12e
This diff is collapsed.
Click to expand it.
Edu.Repository/WeChat/RB_WeChat_CustomerFieldRepository.cs
View file @
c83ed12e
...
...
@@ -36,6 +36,10 @@ namespace Edu.Repository.WeChat
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerField_ViewModel
.
Type
)}
=
{(
int
)
demodel
.
Type
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CName
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerField_ViewModel
.
Name
)}
='
{
demodel
.
CName
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerField_ViewModel
.
Name
)}
like @Name"
;
...
...
Edu.Repository/WeChat/RB_WeChat_CustomerInfoRepository.cs
View file @
c83ed12e
...
...
@@ -113,6 +113,35 @@ namespace Edu.Repository.WeChat
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
AddWay
)}
in(
{
demodel
.
Q_AddWay
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
TurnCustomerSTime
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
TurnCustomerTime
)}
>='
{
demodel
.
TurnCustomerSTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
TurnCustomerETime
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
TurnCustomerTime
)}
<='
{
demodel
.
TurnCustomerETime
}
23:59:59'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
AllotCustomerSTime
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
AllotCustomerTime
)}
>='
{
demodel
.
AllotCustomerSTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
AllotCustomerETime
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
AllotCustomerTime
)}
<='
{
demodel
.
AllotCustomerETime
}
23:59:59'"
;
}
if
(
demodel
.
DeptId
>
0
)
{
where
+=
$@" and e.RB_Department_Id =
{
demodel
.
DeptId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
AbandonReason
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
AbandonReason
)}
='
{
demodel
.
AbandonReason
}
'"
;
}
if
(
demodel
.
CustomerLibraryId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
CustomerLibraryId
)}
=
{
demodel
.
CustomerLibraryId
}
"
;
}
#
region
解析查询参数
if
(
demodel
.
SelectList
!=
null
&&
demodel
.
SelectList
.
Any
())
{
...
...
@@ -120,7 +149,19 @@ namespace Edu.Repository.WeChat
where
+=
" and ("
;
foreach
(
var
item
in
demodel
.
SelectList
)
{
if
(
item
.
IsCustom
==
1
)
{
item
.
Name
=
"z"
+
item
.
Name
;
}
if
(
item
.
IsCustom
==
1
)
{
item
.
Name
=
"z"
+
item
.
Name
;
}
else
if
(
item
.
IsCustom
==
2
)
{
//标签
item
.
Name
=
"LableIds"
;
}
else
if
(
item
.
IsCustom
==
3
)
{
//客户阶段
item
.
Name
=
"StageId"
;
}
if
(
Num
!=
1
)
{
where
+=
demodel
.
AddCondition
==
1
?
" and"
:
" or"
;
}
switch
(
item
.
Type
)
{
case
1
:
//包含 都是int类型的
...
...
@@ -259,7 +300,8 @@ namespace Edu.Repository.WeChat
string
vstr
=
"'"
+
string
.
Join
(
"','"
,
vList
)
+
"'"
;
if
(
item
.
IsCustom
==
1
)
{
where
+=
$@" DATE_FORMAT(r.CustomContent -> '$.
{
item
.
Name
}
','%m月%d号') in(
{
vstr
}
) "
;
//where += $@" DATE_FORMAT(r.CustomContent -> '$.{item.Name}','%m月%d号') in({vstr}) ";
where
+=
" date_format(REPLACE( r.CustomContent -> '$."
+
item
.
Name
+
"', '\"', ''), '%m月%d号') in({vstr}) "
;
}
else
{
...
...
@@ -357,6 +399,7 @@ namespace Edu.Repository.WeChat
string
sql
=
$@"
SELECT * From RB_WeChat_CustomerInfo r
left join rb_employee e on r.EmpId = e.EmployeeId
WHERE
{
where
}
ORDER BY
{
orderByStr
}
"
;
return
GetPage
<
RB_WeChat_CustomerInfo_ViewModel
>(
pageIndex
,
pageSize
,
out
count
,
sql
,
parameters
).
ToList
();
...
...
@@ -435,6 +478,10 @@ ORDER BY {orderByStr} ";
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
CorpFullName
)}
like @CorpFullName"
;
parameters
.
Add
(
"CorpFullName"
,
"%"
+
demodel
.
CorpFullName
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
Q_ExternalUserIds
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
ExternalUserId
)}
in(
{
demodel
.
Q_ExternalUserIds
}
)"
;
}
string
sql
=
$@"
SELECT * From RB_WeChat_CustomerInfo r
...
...
@@ -442,5 +489,86 @@ WHERE {where}
ORDER BY r.Id DESC "
;
return
Get
<
RB_WeChat_CustomerInfo_ViewModel
>(
sql
,
parameters
).
ToList
();
}
/// <summary>
/// 获取客户重复跟进 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_WeChat_CustomerInfo_ViewModel
>
GetCustomerRepeatToFollowUpPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_WeChat_CustomerInfo_ViewModel
demodel
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
string
where
=
$" 1=1 and r.`Status` =0 and r.CustomerState =1 and r.EmpId >0 and r.ExternalUserId <> '' "
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CustomerName
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
CustomerName
)}
like @CustomerName"
;
parameters
.
Add
(
"CustomerName"
,
"%"
+
demodel
.
CustomerName
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
WeChatName
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
WeChatName
)}
like @WeChatName"
;
parameters
.
Add
(
"WeChatName"
,
"%"
+
demodel
.
WeChatName
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CustomerMobile
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
CustomerMobile
)}
like @CustomerMobile"
;
parameters
.
Add
(
"CustomerMobile"
,
"%"
+
demodel
.
CustomerMobile
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CName
))
{
where
+=
$@" and r.CustomContent -> '$.z
{
demodel
.
CNameId
}
' like '%
{
demodel
.
CName
}
%' "
;
}
if
(
demodel
.
EmpId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
EmpId
)}
=
{
demodel
.
EmpId
}
"
;
}
if
(
demodel
.
DeptId
>
0
)
{
where
+=
$@" and e.RB_Department_Id =
{
demodel
.
DeptId
}
"
;
}
string
sql
=
$@"select r.ExternalUserId, COUNT(0) as Num from rb_wechat_customerinfo r
left join rb_employee e on r.EmpId = e.EmployeeId
where
{
where
}
GROUP BY r.ExternalUserId HAVING COUNT(0) >1"
;
return
GetPage
<
RB_WeChat_CustomerInfo_ViewModel
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 验证手机号码是否存在
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
ValidataMobile
(
RB_WeChat_CustomerInfo_ViewModel
demodel
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
string
where
=
$@" 1=1 and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
Status
)}
=0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
Id
)}
<>
{
demodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CustomerMobile
))
{
where
+=
$@" and FIND_IN_SET('
{
demodel
.
CustomerMobile
}
'), r.
{
nameof
(
RB_WeChat_CustomerInfo_ViewModel
.
CustomerMobile
)}
)"
;
}
string
sql
=
$@"
SELECT count(0) From RB_WeChat_CustomerInfo r
WHERE
{
where
}
"
;
var
obj
=
ExecuteScalar
(
sql
);
return
(
obj
==
null
?
0
:
Convert
.
ToInt32
(
obj
))
>
0
;
}
}
}
Edu.Repository/WeChat/RB_WeChat_CustomerLibraryRepository.cs
0 → 100644
View file @
c83ed12e
using
Edu.Common.Enum
;
using
Edu.Model.Entity.WeChat
;
using
Edu.Model.ViewModel.WeChat
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB
;
using
VT.FW.DB.Dapper
;
namespace
Edu.Repository.WeChat
{
/// <summary>
/// 企业微信客户库仓储层
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_WeChat_CustomerLibraryRepository
:
BaseRepository
<
RB_WeChat_CustomerLibrary
>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_WeChat_CustomerLibrary_ViewModel
>
GetList
(
RB_WeChat_CustomerLibrary_ViewModel
demodel
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
string
where
=
$@" 1=1 and r.
{
nameof
(
RB_WeChat_CustomerLibrary_ViewModel
.
Status
)}
=0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerLibrary_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerLibrary_ViewModel
.
Id
)}
=
{
demodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
where
+=
$@" and r.
{
nameof
(
RB_WeChat_CustomerLibrary_ViewModel
.
Name
)}
like @Name"
;
parameters
.
Add
(
"Name"
,
"%"
+
demodel
.
Name
+
"%"
);
}
string
sql
=
$@"
SELECT * From RB_WeChat_CustomerLibrary r
WHERE
{
where
}
ORDER BY r.Id DESC "
;
return
Get
<
RB_WeChat_CustomerLibrary_ViewModel
>(
sql
,
parameters
).
ToList
();
}
}
}
Edu.ThirdCore/QYWinXin/QYWeiXinHelper.cs
View file @
c83ed12e
...
...
@@ -622,7 +622,7 @@ namespace Edu.ThirdCore.QYWinXin
userid
=
UserId
,
external_userid
=
ExternalUserId
,
add_tag
=
LableList
};
};
//remove_tag
var
Rmsg
=
HttpHelper
.
HttpPost
(
url
,
JsonHelper
.
Serialize
(
SendDate
),
""
);
if
(!
string
.
IsNullOrEmpty
(
Rmsg
))
...
...
Edu.WebApi/Controllers/QYWeChat/QYCustomerController.cs
View file @
c83ed12e
This diff is collapsed.
Click to expand it.
Edu.WebApi/Controllers/Upload/UploadController.cs
View file @
c83ed12e
...
...
@@ -26,6 +26,10 @@ namespace Edu.WebApi.Controllers.Upload
/// 投稿
/// </summary>
readonly
QYContributeModule
contributeModule
=
new
QYContributeModule
();
/// <summary>
/// 客户管理
/// </summary>
readonly
QYCustomerModule
customerModule
=
new
QYCustomerModule
();
/// <summary>
/// 上传Excel文件
...
...
@@ -44,7 +48,7 @@ namespace Edu.WebApi.Controllers.Upload
}
var
json
=
!
string
.
IsNullOrEmpty
(
Request
.
Form
[
"params"
])
?
JObject
.
Parse
(
Request
.
Form
[
"params"
].
ToString
())
:
null
;
Int32
.
TryParse
((
json
[
"Analysis"
]
!=
null
?
json
[
"Analysis"
].
ToString
():
"0"
),
out
int
Analysis
);
Int32
.
TryParse
((
json
[
"Analysis"
]
!=
null
?
json
[
"Analysis"
].
ToString
()
:
"0"
),
out
int
Analysis
);
Int32
.
TryParse
((
json
[
"Excel"
]
!=
null
?
json
[
"Excel"
].
ToString
()
:
"0"
),
out
int
Excel
);
Int32
.
TryParse
((
json
[
"Word"
]
!=
null
?
json
[
"Word"
].
ToString
()
:
"0"
),
out
int
Word
);
Int32
.
TryParse
((
json
[
"CourseId"
]
!=
null
?
json
[
"CourseId"
].
ToString
()
:
"0"
),
out
int
CourseId
);
...
...
@@ -65,7 +69,7 @@ namespace Edu.WebApi.Controllers.Upload
}
string
path
=
Guid
.
NewGuid
().
ToString
()
+
fileExtention
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
tempPath
=
basepath
+
"\\upfile\\temporary\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"\\"
;
string
tempPath
=
basepath
+
"\\upfile\\temporary\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"\\"
;
string
path_server
=
tempPath
+
path
;
if
(!
Directory
.
Exists
(
tempPath
))
{
...
...
@@ -82,9 +86,9 @@ namespace Edu.WebApi.Controllers.Upload
return
new
QuestionController
().
ImportExcelQuestion
(
path_server
,
CourseId
,
Uid
);
}
//导入Word文件
if
(
Analysis
==
1
&&
Word
==
1
)
if
(
Analysis
==
1
&&
Word
==
1
)
{
return
new
QuestionController
().
ImportWordQuestion
(
path_server
,
CourseId
,
Uid
,
isDelete
:
true
);
return
new
QuestionController
().
ImportWordQuestion
(
path_server
,
CourseId
,
Uid
,
isDelete
:
true
);
}
return
ApiResult
.
Success
(
""
,
new
{
Name
=
filename
,
Path
=
path_server
});
}
...
...
@@ -197,7 +201,7 @@ namespace Edu.WebApi.Controllers.Upload
{
return
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
Fail
,
Message
=
"未选择文件"
,
Data
=
""
};
}
string
filename
=
files
[
0
].
FileName
;
string
fileExtention
=
System
.
IO
.
Path
.
GetExtension
(
files
[
0
].
FileName
);
//验证文件格式
...
...
@@ -308,7 +312,7 @@ namespace Edu.WebApi.Controllers.Upload
}
#
region
图片上传至公众号
string
RMsg
=
contributeModule
.
UploadImageTextGetUrl
(
path_server
,
100000
,
out
bool
flag
);
string
RMsg
=
contributeModule
.
UploadImageTextGetUrl
(
path_server
,
100000
,
out
bool
flag
);
#
endregion
if
(
flag
)
{
...
...
@@ -324,5 +328,74 @@ namespace Edu.WebApi.Controllers.Upload
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 导入客户线索
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
UploadQYWeChatCustomerClueInfo
()
{
try
{
var
files
=
Request
.
Form
.
Files
;
if
(
files
.
Count
==
0
)
{
return
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
Fail
,
Message
=
"未选择文件"
,
Data
=
""
};
}
var
json
=
!
string
.
IsNullOrEmpty
(
Request
.
Form
[
"params"
])
?
JObject
.
Parse
(
Request
.
Form
[
"params"
].
ToString
())
:
null
;
Int32
.
TryParse
((
json
[
"Uid"
]
!=
null
?
json
[
"Uid"
].
ToString
()
:
"0"
),
out
int
UserId
);
string
filename
=
files
[
0
].
FileName
;
string
fileExtention
=
System
.
IO
.
Path
.
GetExtension
(
files
[
0
].
FileName
);
//验证文件格式
List
<
string
>
ExtList
=
new
List
<
string
>()
{
".xls"
,
".xlsx"
};
if
(!
ExtList
.
Contains
(
fileExtention
))
{
return
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
Fail
,
Message
=
"文件格式有误"
,
Data
=
""
};
}
if
(
files
[
0
].
Length
<=
0
)
{
return
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
Fail
,
Message
=
"文件大小有误"
,
Data
=
""
};
}
decimal
fileMNum
=
files
[
0
].
Length
/
(
1024
*
1024
);
if
(
fileMNum
>
10
)
{
return
ApiResult
.
Failed
(
"文件不能超过10M"
);
}
string
path
=
Guid
.
NewGuid
().
ToString
()
+
fileExtention
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
dateStr
=
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
string
tempPath
=
basepath
+
"upfile\\temporary\\"
+
dateStr
+
"\\"
;
string
path_server
=
tempPath
+
path
;
string
httpPath
=
"/upfile/temporary/"
+
dateStr
+
"/"
+
path
;
if
(!
Directory
.
Exists
(
tempPath
))
{
Directory
.
CreateDirectory
(
tempPath
);
}
using
(
FileStream
fstream
=
new
FileStream
(
path_server
,
FileMode
.
OpenOrCreate
,
FileAccess
.
ReadWrite
))
{
files
[
0
].
CopyTo
(
fstream
);
}
#
region
解析文档数据
string
rmsg
=
customerModule
.
ImportExcelForCustomerClue
(
path_server
,
UserId
);
if
(
rmsg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
rmsg
);
}
#
endregion
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"UploadQYWeChatCustomerClueInfo"
);
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