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
4ddec181
Commit
4ddec181
authored
Jun 20, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监督执行统计
parent
b19733c4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
25 deletions
+112
-25
Performance.php
application/api_broker/controller/Performance.php
+7
-7
PerformanceService.php
application/api_broker/service/PerformanceService.php
+20
-13
ASuperviseModel.php
application/model/ASuperviseModel.php
+23
-0
OBargainModel.php
application/model/OBargainModel.php
+55
-2
ResultsSummaryTask.php
application/task/controller/ResultsSummaryTask.php
+7
-3
No files found.
application/api_broker/controller/Performance.php
View file @
4ddec181
...
...
@@ -69,13 +69,13 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/*
$params = array(
$params
=
array
(
"agent_id"
=>
9
,
"start_time" => "2018-0
4-13
",
"end_time" => "2018-06-
18
",
"start_time"
=>
"2018-0
6-20
"
,
"end_time"
=>
"2018-06-
20
"
,
"is_case"
=>
1
,
//1经纪人 2案场
"house_id"
=>
0
);
*/
);
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"is_case"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -390,20 +390,20 @@ class Performance extends Basic
}
/**
* 获取时间段
进场
数据
* 获取时间段
监督执行
数据
* @return \think\Response
*/
public
function
superviseList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/*
$params = $this->params;
$params = array(
"agent_id" => 78,
"start_time" => "2018-06-12",
"end_time" => "2018-06-20",
"page_no" => 1,
"page_size" => 15
);
);
*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyOther"
);
if
(
true
!==
$checkResult
)
{
...
...
application/api_broker/service/PerformanceService.php
View file @
4ddec181
...
...
@@ -300,39 +300,46 @@ class PerformanceService
if
(
$type
==
1
)
{
//房源
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$params
);
$result
[
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
$result
[
"add_house_num"
]
=
!
empty
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$params
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
$result
[
"add_user_num"
]
=
!
empty
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
1
);
//1表示业绩 2表示实收
$result
[
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"performance"
]
=
!
empty
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
get
AddBargainNum
(
$params
,
2
);
//1表示业绩 2表示实收
$result
[
"official_receipts"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
$receivedSum
=
$this
->
bargainModel
->
get
Received
(
$params
);
$result
[
"official_receipts"
]
=
!
empty
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
}
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
$result
[
"look_at_num"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
$result
[
"look_at_num"
]
=
!
empty
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$params
);
$result
[
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$result
[
"march_in_num"
]
=
!
empty
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNum
(
$params
);
$result
[
"paylog"
]
=
isset
(
$payLogNum
[
0
][
"num"
])
?
$payLogNum
[
0
][
"num"
]
:
0
;
$result
[
"paylog"
]
=
!
empty
(
$payLogNum
[
0
][
"num"
])
?
$payLogNum
[
0
][
"num"
]
:
0
;
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
3
);
//表示统计
$result
[
"bargain_sum"
]
=
isset
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
$result
[
"bargain_sum"
]
=
!
empty
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
return
$result
;
}
/**
* 门店业绩
* @param $agent_id
* @param $start_time
* @param $end_time
* @return array|false|mixed|null|\PDOStatement|string|\think\Collection
*/
public
function
storePerformance
(
$agent_id
,
$start_time
,
$end_time
)
{
//获取经纪人信息
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
// dump($result);
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
...
...
@@ -491,7 +498,7 @@ class PerformanceService
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
1
);
//1表示业绩 2表示实收
$result
[
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
get
AddBargainNum
(
$params
,
2
);
//1表示业绩 2表示实收
$receivedSum
=
$this
->
bargainModel
->
get
Received
(
$params
);
$result
[
"official_receipts"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
//dump($receivedSum);
//约带看
...
...
@@ -509,8 +516,8 @@ class PerformanceService
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNum
(
$params
);
$result
[
"paylog"
]
=
isset
(
$payLogNum
[
0
][
"num"
])
?
$payLogNum
[
0
][
"num"
]
:
0
;
//dump($payLogNum);
//
todo
监督
$result
[
"supervision_num"
]
=
0
;
// 监督
$result
[
"supervision_num"
]
=
$this
->
superviseModel
->
findSuperviseListCount
(
"id"
,
$params
)
;
return
$result
;
}
...
...
application/model/ASuperviseModel.php
View file @
4ddec181
...
...
@@ -59,4 +59,26 @@ class ASuperviseModel extends Model
return
$result
;
}
/**
* 统计监督执行数量分时间
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddPayLogNumGroupTime
(
$params
){
$field
=
"count(1) as num,DATE(create_time) as day"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
])){
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
group
(
"day"
)
->
select
();
}
}
\ No newline at end of file
application/model/OBargainModel.php
View file @
4ddec181
...
...
@@ -546,6 +546,35 @@ class OBargainModel extends Model
return
$data
;
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getReceivedGroupTime
(
$params
)
{
$where_
=
[];
$field
=
"sum(b.money) as num,DATE(b.create_time) as day"
;
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"b.create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_partial_commission b"
,
"a.id=b.bargain_id"
,
"right"
)
->
where
(
$where_
)
->
group
(
"day"
)
->
select
();
}
/**
* @param $params
* @param $type
...
...
@@ -563,7 +592,8 @@ class OBargainModel extends Model
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num,DATE(create_time) as day"
;
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num,DATE(create_time) as day"
;
$field
=
"count(1) as num,DATE(create_time) as day"
;
$where_
[
"trade_type"
]
=
10
;
//产品要求统计数量必须是出租类型的180620
}
if
(
isset
(
$params
[
"agent_id"
]))
{
...
...
@@ -580,7 +610,6 @@ class OBargainModel extends Model
->
select
();
}
public
function
getAddBargainNum
(
$params
,
$type
)
{
$where_
=
[];
...
...
@@ -614,6 +643,30 @@ class OBargainModel extends Model
->
select
();
}
public
function
getReceived
(
$params
)
{
$where_
=
[];
$field
=
"sum(b.money) as num"
;
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"b.create_time"
]
=
$params
[
"create_time"
];
}
$date
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_partial_commission b"
,
"a.id=b.bargain_id"
,
"right"
)
->
where
(
$where_
)
->
select
();
echo
$this
->
getLastSql
();
return
$date
;
}
public
function
getAddBargainList
(
$params
,
$field
,
$page_no
,
$page_size
)
{
$where_
=
[];
...
...
application/task/controller/ResultsSummaryTask.php
View file @
4ddec181
...
...
@@ -4,6 +4,7 @@ namespace app\task\controller;
use
app\extra\RedisExt
;
use
app\model\AAgents
;
use
app\model\ASuperviseModel
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
...
...
@@ -30,6 +31,7 @@ class ResultsSummaryTask
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
private
$superviseModel
;
private
$redis_
;
function
__construct
()
...
...
@@ -43,6 +45,7 @@ class ResultsSummaryTask
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
redis_
=
RedisExt
::
getRedis
();
$this
->
superviseModel
=
new
ASuperviseModel
();
}
public
function
totalAgentResults
()
...
...
@@ -130,7 +133,7 @@ class ResultsSummaryTask
// dump($performanceSum);
$result_arr
[
"performance_sum"
]
=
$this
->
foreachResult
(
$performanceSum
);
//实收
$receivedSum
=
$this
->
bargainModel
->
get
AddBargainNumGroupTime
(
$params
,
2
);
//1表示业绩 2表示实收
$receivedSum
=
$this
->
bargainModel
->
get
ReceivedGroupTime
(
$params
);
$result_arr
[
"received_sum"
]
=
$this
->
foreachResult
(
$receivedSum
);
//dump($receivedSum);
//约带看
...
...
@@ -148,8 +151,9 @@ class ResultsSummaryTask
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNumGroupTime
(
$params
);
$result_arr
[
"pay_log_num"
]
=
$this
->
foreachResult
(
$payLogNum
);
//dump($payLogNum);
//todo 监督
$result_arr
[
"supervision_num"
]
=
$this
->
foreachResult
(
$supervisionNum
=
[]);
// 监督
//$result_arr["supervision_num"] = $this->foreachResult($supervisionNum = []);
$result_arr
[
"supervision_num"
]
=
$this
->
superviseModel
->
getAddPayLogNumGroupTime
(
$params
);
//成交报告
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTime
(
$params
,
3
);
//表示统计
...
...
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