Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dt_analysis
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
haoyanbin
dt_analysis
Commits
b156edf0
Commit
b156edf0
authored
Sep 08, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Excel
parent
7970f4d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
30 deletions
+117
-30
survey.go
api/mobile/survey.go
+71
-18
config.yaml
config.yaml
+1
-1
survey.go
model/request/survey.go
+7
-0
survey.go
service/survey.go
+38
-11
No files found.
api/mobile/survey.go
View file @
b156edf0
...
...
@@ -116,34 +116,87 @@ func ExportSurveyUserExcel(c *gin.Context) {
_
=
c
.
ShouldBindQuery
(
&
req
)
req
.
PageSize
=
99999
req
.
Status
=
1
_
,
list
,
_
:=
service
.
GetSurveyUserList
(
req
)
fileName
:=
"
用户
列表"
+
time
.
Now
()
.
Format
(
"20060102"
)
fileName
:=
"
留资信息
列表"
+
time
.
Now
()
.
Format
(
"20060102"
)
f
:=
excelize
.
NewFile
()
// Create a new sheet.
index
:=
f
.
NewSheet
(
fileName
)
f
.
SetCellValue
(
fileName
,
"A1"
,
"链接所属人"
)
f
.
SetCellValue
(
fileName
,
"B1"
,
"链接所属人电话"
)
f
.
SetCellValue
(
fileName
,
"C1"
,
"下单时间"
)
f
.
SetCellValue
(
fileName
,
"D1"
,
"开通天数"
)
f
.
SetCellValue
(
fileName
,
"E1"
,
"订单金额"
)
f
.
SetCellValue
(
fileName
,
"F1"
,
"支付金额"
)
f
.
SetCellValue
(
fileName
,
"G1"
,
"订单类型"
)
f
.
SetCellValue
(
fileName
,
"H1"
,
"备注"
)
f
.
MergeCell
(
fileName
,
"A1"
,
"E1"
)
f
.
SetCellValue
(
fileName
,
"A1"
,
"留资信息"
)
f
.
MergeCell
(
fileName
,
"F1"
,
"P1"
)
f
.
SetCellValue
(
fileName
,
"F1"
,
"电销沟通结果"
)
f
.
MergeCell
(
fileName
,
"Q1"
,
"U1"
)
f
.
SetCellValue
(
fileName
,
"Q1"
,
"渠道信息"
)
f
.
SetCellValue
(
fileName
,
"A2"
,
"联系人"
)
f
.
SetCellValue
(
fileName
,
"B2"
,
"联系电话"
)
f
.
SetCellValue
(
fileName
,
"C2"
,
"留资时间"
)
f
.
SetCellValue
(
fileName
,
"D2"
,
"留资选配产品"
)
f
.
SetCellValue
(
fileName
,
"E2"
,
"备注"
)
f
.
SetCellValue
(
fileName
,
"F2"
,
"电话沟通"
)
f
.
SetCellValue
(
fileName
,
"G2"
,
"沟通日期"
)
f
.
SetCellValue
(
fileName
,
"H2"
,
"医院名称"
)
f
.
SetCellValue
(
fileName
,
"I2"
,
"医院状态"
)
f
.
SetCellValue
(
fileName
,
"J2"
,
"开业时间"
)
f
.
SetCellValue
(
fileName
,
"K2"
,
"所属省份"
)
f
.
SetCellValue
(
fileName
,
"L2"
,
"签单状态"
)
f
.
SetCellValue
(
fileName
,
"M2"
,
"转介绍渠道状态"
)
f
.
SetCellValue
(
fileName
,
"N2"
,
"签约金额"
)
f
.
SetCellValue
(
fileName
,
"O2"
,
"签约选配产品"
)
f
.
SetCellValue
(
fileName
,
"P2"
,
"电销人员"
)
f
.
SetCellValue
(
fileName
,
"Q2"
,
"转介绍人"
)
f
.
SetCellValue
(
fileName
,
"R2"
,
"转介绍人电话"
)
f
.
SetCellValue
(
fileName
,
"S2"
,
"渠道类型"
)
f
.
SetCellValue
(
fileName
,
"T2"
,
"渠道"
)
f
.
SetCellValue
(
fileName
,
"U2"
,
"渠道链接"
)
for
k
,
v
:=
range
list
{
a
:=
strconv
.
Itoa
(
k
+
2
)
f
.
SetCellValue
(
fileName
,
"A"
+
a
,
v
.
WorkerName
)
f
.
SetCellValue
(
fileName
,
"B"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"C"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"D"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"E"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"F"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"G"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"H"
+
a
,
v
.
WorkerMobile
)
surveyData
:=
service
.
GetSurveyUserDataList
(
v
.
Id
)
optionData
:=
""
for
_
,
v2
:=
range
surveyData
{
optionData
+=
v2
.
OptionValue
+
" * "
+
strconv
.
Itoa
(
v2
.
OptionNum
)
+
"; "
}
isReference
:=
"转介绍留资"
if
v
.
Contacts
==
v
.
WorkerMobile
{
isReference
=
"直接留资"
}
moc
:=
""
if
v
.
MocId
==
1
{
moc
=
"短信"
}
url
:=
global
.
GVA_CONFIG
.
Common
.
Url
+
"?"
+
v
.
Vcode
a
:=
strconv
.
Itoa
(
k
+
3
)
f
.
SetCellValue
(
fileName
,
"A"
+
a
,
v
.
Contacts
)
f
.
SetCellValue
(
fileName
,
"B"
+
a
,
v
.
ContactsMobile
)
f
.
SetCellValue
(
fileName
,
"C"
+
a
,
v
.
CreateTime
)
f
.
SetCellValue
(
fileName
,
"D"
+
a
,
optionData
)
f
.
SetCellValue
(
fileName
,
"E"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"F"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"G"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"H"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"I"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"J"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"K"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"L"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"M"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"N"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"O"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"P"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"Q"
+
a
,
v
.
Reference
)
f
.
SetCellValue
(
fileName
,
"R"
+
a
,
v
.
ReferenceMobile
)
f
.
SetCellValue
(
fileName
,
"S"
+
a
,
isReference
)
f
.
SetCellValue
(
fileName
,
"T"
+
a
,
moc
)
f
.
SetCellValue
(
fileName
,
"U"
+
a
,
url
)
}
// Set active sheet of the workbook.
...
...
config.yaml
View file @
b156edf0
...
...
@@ -116,7 +116,7 @@ encrypt:
key
:
"
75SIQyfvwHDU0GbO"
common
:
type
:
"
2"
url
:
"
https://tdt.pet-dbc.cn
/
"
url
:
"
https://tdt.pet-dbc.cn"
sms
:
smsname
:
"
dbc"
...
...
model/request/survey.go
View file @
b156edf0
...
...
@@ -27,6 +27,7 @@ type GetSurveyUserListReq struct {
ReferenceMobile
string
`gorm:"type:string(255)" json:"reference_mobile"`
StartCreateTime
string
`json:"start_create_time" form:"start_create_time"`
EndCreateTime
string
`json:"end_create_time" form:"end_create_time"`
Status
int
`gorm:"type:int(255)" json:"status"`
}
type
GetSurveyUserListReply
struct
{
...
...
@@ -36,15 +37,21 @@ type GetSurveyUserListReply struct {
type
GetSurveyUserList
struct
{
Data
[]
model
.
SurveyUserData
`gorm:"-" json:"data"`
Id
int
`gorm:"type:int(255)" json:"id"`
SurveyId
int
`gorm:"type:int(255)" json:"survey_id"`
UserId
int
`gorm:"type:int(255)" json:"user_id"`
MocId
int
`gorm:"type:int(255)" json:"moc_id"`
CodeMobile
string
`gorm:"type:string(255)" json:"code_mobile"`
Code
string
`gorm:"type:string(255)" json:"code"`
Contacts
string
`gorm:"type:string(255)" json:"contacts"`
ContactsMobile
string
`gorm:"type:string(255)" json:"contacts_mobile"`
Reference
string
`gorm:"type:string(255)" json:"reference"`
ReferenceMobile
string
`gorm:"type:string(255)" json:"reference_mobile"`
WorkerName
string
`gorm:"type:string(255)" json:"worker_name"`
WorkerMobile
string
`gorm:"type:string(255)" json:"worker_mobile"`
CreateTime
string
`gorm:"type:string(255)" json:"create_time"`
Vcode
string
`gorm:"type:string(255)" json:"vcode"`
Status
int
`gorm:"type:int(255)" json:"status"`
}
type
GetSurveyLogListReq
struct
{
...
...
service/survey.go
View file @
b156edf0
...
...
@@ -41,43 +41,49 @@ func GetSurveyUserList(req request.GetSurveyUserListReq) (error, []request.GetSu
list
:=
make
([]
request
.
GetSurveyUserList
,
0
)
table
:=
" survey_user as sur "
+
" left join customer_user as cu on sur.user_id=cu.id "
" left join customer_user as cu on sur.user_id=cu.id "
+
" left join vcode as vc on sur.user_id=vc.user_id and sur.moc_id = vc.moc_id "
field
:=
" sur.id, sur.user_id, sur.moc_id, sur.contacts, sur.contacts_mobile"
+
field
:=
" sur.id, sur.user_id, sur.moc_id, sur.co
de_mobile, sur.code, sur.co
ntacts, sur.contacts_mobile"
+
", sur.reference, sur.reference_mobile, sur.create_time"
+
", sur.country, sur.area, sur.region, sur.city"
+
", cu.worker_name, cu.worker_mobile "
", cu.worker_name, cu.worker_mobile "
+
", vc.code as vcode "
conditions
:=
""
orderby
:=
" sur.create_time desc "
if
req
.
MocId
!=
0
{
conditions
+=
" AND sur.moc_id = "
+
strconv
.
Itoa
(
currentpage
)
conditions
+=
" AND sur.moc_id = "
+
strconv
.
Itoa
(
req
.
MocId
)
}
if
req
.
Status
!=
0
{
conditions
+=
" AND sur.status = "
+
strconv
.
Itoa
(
req
.
Status
)
}
if
req
.
Region
!=
""
{
conditions
+=
" AND region like '%"
+
req
.
Region
+
"%'"
conditions
+=
" AND
sur.
region like '%"
+
req
.
Region
+
"%'"
}
if
req
.
City
!=
""
{
conditions
+=
" AND city like '%"
+
req
.
City
+
"%'"
conditions
+=
" AND
sur.
city like '%"
+
req
.
City
+
"%'"
}
if
req
.
Contacts
!=
""
{
conditions
+=
" AND contacts like '%"
+
req
.
Contacts
+
"%'"
conditions
+=
" AND
sur.
contacts like '%"
+
req
.
Contacts
+
"%'"
}
if
req
.
ContactsMobile
!=
""
{
conditions
+=
" AND contacts_mobile like '%"
+
req
.
ContactsMobile
+
"%'"
conditions
+=
" AND
sur.
contacts_mobile like '%"
+
req
.
ContactsMobile
+
"%'"
}
if
req
.
Reference
!=
""
{
conditions
+=
" AND reference like '%"
+
req
.
Reference
+
"%'"
conditions
+=
" AND
sur.
reference like '%"
+
req
.
Reference
+
"%'"
}
if
req
.
ReferenceMobile
!=
""
{
conditions
+=
" AND reference_mobile like '%"
+
req
.
ReferenceMobile
+
"%'"
conditions
+=
" AND
sur.
reference_mobile like '%"
+
req
.
ReferenceMobile
+
"%'"
}
if
req
.
StartCreateTime
!=
""
{
...
...
@@ -91,7 +97,7 @@ func GetSurveyUserList(req request.GetSurveyUserListReq) (error, []request.GetSu
//@@总条数,总页数
var
totalItem
int64
=
0
sqlStr
:=
"SELECT count(
vo
.id) as totalItem FROM "
+
table
+
" where 1=1 "
+
conditions
sqlStr
:=
"SELECT count(
sur
.id) as totalItem FROM "
+
table
+
" where 1=1 "
+
conditions
global
.
GVA_DB
.
Raw
(
sqlStr
)
.
Count
(
&
totalItem
)
//获取总条数
sqlStr2
:=
"SELECT "
+
field
+
...
...
@@ -107,6 +113,27 @@ func GetSurveyUserList(req request.GetSurveyUserListReq) (error, []request.GetSu
return
nil
,
list
,
totalItem
}
func
GetSurveyUserDataList
(
id
int
)
[]
model
.
SurveyUserData
{
list
:=
make
([]
model
.
SurveyUserData
,
0
)
table
:=
" survey_user_data "
field
:=
" survey_user_id, `option`, option_value, option_num, price "
conditions
:=
" AND survey_user_id = "
+
strconv
.
Itoa
(
id
)
sqlStr2
:=
"SELECT "
+
field
+
" FROM "
+
table
+
" WHERE 1>0 "
+
conditions
global
.
GVA_DB
.
Raw
(
sqlStr2
)
.
Scan
(
&
list
)
if
global
.
GVA_DB
.
Error
!=
nil
{
return
[]
model
.
SurveyUserData
{}
}
return
list
}
func
GetSurveyLogList
(
req
request
.
GetSurveyLogListReq
)
(
error
,
[]
request
.
GetSurveyLogList
,
int64
)
{
pagesize
:=
10
page
:=
1
...
...
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