Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
c8d5e867
Commit
c8d5e867
authored
Oct 10, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩导出
parent
f4466621
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
1 deletion
+147
-1
Performance.php
application/index/controller/Performance.php
+4
-1
PerformanceService.php
application/index/service/PerformanceService.php
+143
-0
No files found.
application/index/controller/Performance.php
View file @
c8d5e867
...
@@ -50,8 +50,11 @@ class Performance extends Basic
...
@@ -50,8 +50,11 @@ class Performance extends Basic
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
time
());
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
time
());
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$is_excel
=
!
empty
(
$params
[
"is_excel"
])
?
$params
[
"is_excel"
]
:
''
;
if
(
$is_excel
){
$list
=
$this
->
service_
->
totalAgentExcel
(
$params
[
"type"
],
$end_day
,
$start_day
,
$father_id
,
$params
);
}
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
,
$params
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
,
$params
);
//dump($list);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
if
(
count
(
$list
)
>
0
)
{
...
...
application/index/service/PerformanceService.php
View file @
c8d5e867
<?php
<?php
namespace
app\index\service
;
namespace
app\index\service
;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\GHouses
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OBargainModel
;
...
@@ -300,6 +301,147 @@ class PerformanceService
...
@@ -300,6 +301,147 @@ class PerformanceService
}
}
/**
* 导出业绩excel
* @param $type
* @param $yesterday
* @param $end_day
* @param $father_id
* @return array
*/
public
function
totalAgentExcel
(
$type
,
$yesterday
,
$end_day
,
$father_id
,
$params
)
{
$where_
=
[];
if
(
$father_id
){
if
(
$type
==
1
){
$where_
[
'store_id'
]
=
$father_id
;
}
elseif
(
$type
==
2
){
$where_
[
'district_id'
]
=
$father_id
;
}
}
//区域搜索条件
if
(
!
empty
(
$params
[
'district_id'
]))
{
$where_
[
'district_id'
]
=
$params
[
'district_id'
];
}
//部门搜索条件
if
(
!
empty
(
$params
[
'store_id'
]))
{
$where_
[
'store_id'
]
=
$params
[
'store_id'
];
}
//经纪人搜索条件
if
(
!
empty
(
$params
[
'agent_id'
]))
{
$where_
[
'agent_id'
]
=
$params
[
'agent_id'
];
}
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
/* 成交报告数 bargain_sum
收款数 paylog
进场数 march_in_num
报备数 look_at_num
新增商铺数 add_house_num
新增客户数 add_user_num
团队人数 team_num*/
$field
=
"agent_id,store_id,district_id,
sum(performance) as performance_total,
sum(bargain_sum) as bargain_sum_total,
sum(paylog) as paylog_total,
sum(march_in_num) as march_in_num_total,
sum(look_at_num) as look_at_num_total,
sum(add_house_num) as add_house_num_total,
sum(add_user_num) as add_user_num_total
"
;
$order
=
"performance_total desc"
;
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
case
3
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
}
}
//dump(json_encode($arr));exit;
//return ['list'=>$arr,'total'=>0];
$export
=
new
ExportExcelUntil
();
foreach
(
$arr
as
$key
=>
$v
)
{
$e_data_old
[
'index'
]
=
$v
[
"index_"
];
//排名
$e_data_old
[
'district_name'
]
=
$v
[
'district_name'
]
.
'-'
.
$v
[
'name'
];
//部门
$e_data_old
[
'performance_total'
]
=
$v
[
'performance_total'
];
//业绩
$e_data_old
[
'bargain_sum_total'
]
=
$v
[
'bargain_sum_total'
];
//成交单数
$e_data_old
[
'paylog_total'
]
=
$v
[
'paylog_total'
];
//收款数
$e_data_old
[
'march_in_num_total'
]
=
$v
[
'march_in_num_total'
];
//进场数
$e_data_old
[
'look_at_num_total'
]
=
$v
[
'look_at_num_total'
];
//报备数
$e_data_old
[
'add_house_num_total'
]
=
$v
[
'add_house_num_total'
];
//新增商铺
$e_data_old
[
'add_user_num_total'
]
=
$v
[
'add_user_num_total'
];
//新增客户
$e_data_old
[
'team_num'
]
=
$v
[
'team_num'
];
//团队人数
$e_data_new
[]
=
$e_data_old
;
}
// dump($e_data_new);exit;
$title
=
[
'排名'
,
'部门'
,
'业绩'
,
'成交单数'
,
'收款数'
,
'进场数'
,
'报备数'
,
'新增商铺'
,
'新增客户'
,
'团队人数'
];
$export
->
exportTable
(
'业绩排行'
,
$e_data_new
,
9
,
'业绩排行表'
,
$title
);
return
''
;
}
}
}
\ No newline at end of file
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